diff mbox series

hv_netvsc: Add comment of netvsc_xdp_xmit()

Message ID 1634174786-1810351-1-git-send-email-jiasheng@iscas.ac.cn (mailing list archive)
State Accepted
Commit 78e0a006914b9fc0dd714d68f0bb6e0f50c944f2
Delegated to: Netdev Maintainers
Headers show
Series hv_netvsc: Add comment of netvsc_xdp_xmit() | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 9 maintainers not CCed: hawk@kernel.org andrii@kernel.org daniel@iogearbox.net songliubraving@fb.com yhs@fb.com john.fastabend@gmail.com kafai@fb.com ast@kernel.org kpsingh@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Jiasheng Jiang Oct. 14, 2021, 1:26 a.m. UTC
Adding comment to avoid the misusing of netvsc_xdp_xmit().
Otherwise the value of skb->queue_mapping could be 0 and
then the return value of skb_get_rx_queue() could be MAX_U16
cause by overflow.

Fixes: 351e158 ("hv_netvsc: Add XDP support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/hyperv/netvsc_drv.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Haiyang Zhang Oct. 14, 2021, 12:51 p.m. UTC | #1
> -----Original Message-----
> From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> Sent: Wednesday, October 13, 2021 9:26 PM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> wei.liu@kernel.org; Dexuan Cui <decui@microsoft.com>;
> davem@davemloft.net; kuba@kernel.org
> Cc: linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; bpf@vger.kernel.org; Jiasheng Jiang
> <jiasheng@iscas.ac.cn>
> Subject: [PATCH] hv_netvsc: Add comment of netvsc_xdp_xmit()
> 
> Adding comment to avoid the misusing of netvsc_xdp_xmit().
> Otherwise the value of skb->queue_mapping could be 0 and
> then the return value of skb_get_rx_queue() could be MAX_U16
> cause by overflow.
> 
> Fixes: 351e158 ("hv_netvsc: Add XDP support")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> index f682a55..ac9529c 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -803,6 +803,7 @@ void netvsc_linkstatus_callback(struct net_device
> *net,
>  	schedule_delayed_work(&ndev_ctx->dwork, 0);
>  }
> 
> +/* This function should only be called after skb_record_rx_queue() */
>  static void netvsc_xdp_xmit(struct sk_buff *skb, struct net_device
> *ndev)
>  {

Thanks.

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
patchwork-bot+netdevbpf@kernel.org Oct. 15, 2021, 2:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 14 Oct 2021 01:26:26 +0000 you wrote:
> Adding comment to avoid the misusing of netvsc_xdp_xmit().
> Otherwise the value of skb->queue_mapping could be 0 and
> then the return value of skb_get_rx_queue() could be MAX_U16
> cause by overflow.
> 
> Fixes: 351e158 ("hv_netvsc: Add XDP support")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> 
> [...]

Here is the summary with links:
  - hv_netvsc: Add comment of netvsc_xdp_xmit()
    https://git.kernel.org/netdev/net-next/c/78e0a006914b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f682a55..ac9529c 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -803,6 +803,7 @@  void netvsc_linkstatus_callback(struct net_device *net,
 	schedule_delayed_work(&ndev_ctx->dwork, 0);
 }
 
+/* This function should only be called after skb_record_rx_queue() */
 static void netvsc_xdp_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	int rc;