From patchwork Fri Jan 24 09:30:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63DD6C2D0DB for ; Fri, 24 Jan 2020 09:59:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36DDB214DB for ; Fri, 24 Jan 2020 09:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859957; bh=By4OvHUTQ9bKhUDXqtTxktQSyR3+kTd2EvfP69EFbJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MfQS965kOoFl5/+GWAAlya8+dSZEpF80H34rTLMGPGQSI67Dz0opCviEp1tVhSFyE 3b0Xugttu54yjuMvAdENtGe+9RUXIcSWzJJviR9R7MvkBt8GIVvldD8vkw6nG5jqjr pNGu/mtOb03ruWWT94NZHUZYFRmdq2GejZ0ufJTg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730687AbgAXJ7Q (ORCPT ); Fri, 24 Jan 2020 04:59:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:34756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgAXJ7Q (ORCPT ); Fri, 24 Jan 2020 04:59:16 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 518DC20718; Fri, 24 Jan 2020 09:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859956; bh=By4OvHUTQ9bKhUDXqtTxktQSyR3+kTd2EvfP69EFbJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XEjKaUEJ53L20aIEdXL9/BpmmS4HVpAQ8mY3rYKh6GPld9j1ZfeUOwKrgVOfnMUvg SD1tBJDKk5Lvur/pgOHCCdSSX+MZ+jY7fPTD+pntsDZBhHILjiuI3spWV/V+GJ9Brk 9taPETZKJAyxeYwWUvxGdJ5ppLz8PsUvPCU5fMc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Hemminger , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 227/343] netvsc: unshare skb in VF rx handler Date: Fri, 24 Jan 2020 10:30:45 +0100 Message-Id: <20200124092950.009980706@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stephen Hemminger [ Upstream commit 996ed04741467f6d1552440c92988b132a9487ec ] The netvsc VF skb handler should make sure that skb is not shared. Similar logic already exists in bonding and team device drivers. This is not an issue in practice because the VF devicex does not send up shared skb's. But the netvsc driver should do the right thing if it did. Fixes: 0c195567a8f6 ("netvsc: transparent VF management") Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/hyperv/netvsc_drv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index a89de5752a8c2..9e48855f64074 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1840,6 +1840,12 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb) struct netvsc_vf_pcpu_stats *pcpu_stats = this_cpu_ptr(ndev_ctx->vf_stats); + skb = skb_share_check(skb, GFP_ATOMIC); + if (unlikely(!skb)) + return RX_HANDLER_CONSUMED; + + *pskb = skb; + skb->dev = ndev; u64_stats_update_begin(&pcpu_stats->syncp);