All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hv_netvsc: Fix potentionally overflow in netvsc_xdp_xmit()
@ 2021-10-13  3:04 Jiasheng Jiang
  2021-10-13 12:44 ` Haiyang Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-10-13  3:04 UTC (permalink / raw)
  To: kys, haiyangz, sthemmin, wei.liu, decui, davem, kuba, ast,
	daniel, hawk, john.fastabend, andrii, kafai, songliubraving, yhs,
	kpsingh
  Cc: linux-hyperv, netdev, linux-kernel, bpf, Jiasheng Jiang

Adding skb_rx_queue_recorded() to avoid the value of skb->queue_mapping
to be 0. Otherwise 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f682a55..e51201e 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -807,7 +807,7 @@ static void netvsc_xdp_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	int rc;
 
-	skb->queue_mapping = skb_get_rx_queue(skb);
+	skb->queue_mapping = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
 	__skb_push(skb, ETH_HLEN);
 
 	rc = netvsc_xmit(skb, ndev, true);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-13 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  3:04 [PATCH] hv_netvsc: Fix potentionally overflow in netvsc_xdp_xmit() Jiasheng Jiang
2021-10-13 12:44 ` Haiyang Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.