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

From: Dexuan Cui
Date: Tue Apr 28 2015 - 23:52:02 EST


> -----Original Message-----
> From: devel [mailto:driverdev-devel-bounces@xxxxxxxxxxxxxxxxxxxxxx] On
> Behalf Of K. Y. Srinivasan
> Sent: Wednesday, April 29, 2015 9:00
> To: davem@xxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; devel@xxxxxxxxxxxxxxxxxxxxxx; olaf@xxxxxxxxx;
> apw@xxxxxxxxxxxxx; jasowang@xxxxxxxxxx
> 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@xxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxx>

-- Dexuan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/