From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f195.google.com ([209.85.210.195]:44588 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728881AbfEPVy2 (ORCPT ); Thu, 16 May 2019 17:54:28 -0400 Received: by mail-pf1-f195.google.com with SMTP id g9so2522483pfo.11 for ; Thu, 16 May 2019 14:54:28 -0700 (PDT) From: Stephen Hemminger Subject: [PATCH net 1/3] netvsc: unshare skb in VF rx handler Date: Thu, 16 May 2019 14:54:21 -0700 Message-Id: <20190516215423.14185-2-sthemmin@microsoft.com> In-Reply-To: <20190516215423.14185-1-sthemmin@microsoft.com> References: <20190516215423.14185-1-sthemmin@microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: xdp-newbies-owner@vger.kernel.org List-ID: To: netdev@vger.kernel.org, davem@davemloft.net Cc: xdp-newbies@vger.kernel.org, bpf@vger.kernel.org, Stephen Hemminger 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 --- 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 06393b215102..9873b8679f81 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2000,6 +2000,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); -- 2.20.1