[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1392350408-3811-1-git-send-email-wuzhy@linux.vnet.ibm.com>
Date: Fri, 14 Feb 2014 12:00:08 +0800
From: Zhi Yong Wu <wuzhy@...ux.vnet.ibm.com>
To: netdev@...r.kernel.org
Cc: Zhi Yong Wu <wuzhy@...ux.vnet.ibm.com>
Subject: [PATCH] virtio_net: fix the potential NULL pointer in xmit_skb()
The pointer hdr isn't assigned before hdr->mhdr and hdr->hdr
are used, so it could be one invalid pointer.
Signed-off-by: Zhi Yong Wu <wuzhy@...ux.vnet.ibm.com>
---
drivers/net/virtio_net.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d75f8ed..bf6397f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -807,9 +807,9 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);
if (vi->mergeable_rx_bufs)
- hdr_len = sizeof hdr->mhdr;
+ hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
else
- hdr_len = sizeof hdr->hdr;
+ hdr_len = sizeof(struct virtio_net_hdr);
can_push = vi->any_header_sg &&
!((unsigned long)skb->data & (__alignof__(*hdr) - 1)) &&
--
1.8.4.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists