From patchwork Tue Apr 28 01:14:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 465299 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D78961400B7 for ; Tue, 28 Apr 2015 09:56:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964838AbbD0Xz4 (ORCPT ); Mon, 27 Apr 2015 19:55:56 -0400 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:37122 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbbD0Xzy (ORCPT ); Mon, 27 Apr 2015 19:55:54 -0400 Received: from linuxonhyperv.com ([72.167.245.219]) by p3plsmtps2ded01.prod.phx3.secureserver.net with : DED : id MBvs1q01r4kklxU01BvsuS; Mon, 27 Apr 2015 16:55:54 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id 5FCB81901F9; Mon, 27 Apr 2015 18:14:52 -0700 (PDT) From: "K. Y. Srinivasan" To: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com Cc: "K. Y. Srinivasan" Subject: [PATCH net 1/1] hv_netvsc: Fix a bug in netvsc_start_xmit() Date: Mon, 27 Apr 2015 18:14:50 -0700 Message-Id: <1430183690-24198-1-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit commit b08cc79155fc26d0d112b1470d1ece5034651a4b eliminated memory allocation in the packet send path. This commit introduced a bug since it did not account for the case if the skb was cloned. Fix this bug by using the pre-reserved head room only if the skb is not cloned. Signed-off-by: K. Y. Srinivasan Tested-by: Dexuan Cui --- drivers/net/hyperv/netvsc_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index a3a9d38..7eb0251 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -421,7 +421,7 @@ check_size: pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE; - if (head_room < pkt_sz) { + if (skb->cloned || head_room < pkt_sz) { packet = kmalloc(pkt_sz, GFP_ATOMIC); if (!packet) { /* out of memory, drop packet */