[PATCH V2 net 1/1] hv_netvsc: Fix a bug in netvsc_start_xmit()

Dexuan Cui decui at microsoft.com
Wed Apr 29 03:51:44 UTC 2015


> -----Original Message-----
> From: devel [mailto:driverdev-devel-bounces at linuxdriverproject.org] On
> Behalf Of K. Y. Srinivasan
> Sent: Wednesday, April 29, 2015 9:00
> To: davem at davemloft.net; netdev at vger.kernel.org; linux-
> kernel at vger.kernel.org; devel at linuxdriverproject.org; olaf at aepfle.de;
> apw at canonical.com; jasowang at redhat.com
> Subject: [PATCH V2 net 1/1] hv_netvsc: Fix a bug in netvsc_start_xmit()
> 
> Commit b08cc79155fc26d0d112b1470d1ece5034651a4b eliminated
> memory
> allocation in the packet send path:
> 
>     "hv_netvsc: Eliminate memory allocation in the packet send path
> 
>     The network protocol used to communicate with the host is the remote
> ndis (rndis)
>     protocol. We need to decorate each outgoing packet with a rndis header
> and
>     additional rndis state (rndis per-packet state). To manage this state, we
>     currently allocate memory in the transmit path. Eliminate this allocation
> by
>     requesting additional head room in the skb."
> 
> This commit introduced a bug since it did not account for the case if the skb
> was cloned. Fix this bug.
> 
> 
> Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
> ---
> 	V2: Used skb_cow_head() based on Dave Miller's feedback
> 	V2: Fixed up the commit log based on feedback from Sergei
> Shtylyov
> 
>  drivers/net/hyperv/hyperv_net.h |    1 -
>  drivers/net/hyperv/netvsc.c     |    5 -----
>  drivers/net/hyperv/netvsc_drv.c |   27 +++++++--------------------
>  3 files changed, 7 insertions(+), 26 deletions(-)

Without the patch, the guest can panic due to memory corruption.

I confirm the patch can fix the panic I saw.

Tested-by: Dexuan Cui <decui at microsoft.com>

-- Dexuan


More information about the devel mailing list