]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netvsc: unshare skb in VF rx handler
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 28 May 2019 18:47:30 +0000 (11:47 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ 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 <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/hyperv/netvsc_drv.c

index 9d76de99a215ab3f3058ad72f900bdb7112ccae9..cd5b1d8a3be1af6467b0ea138c358f028cefdd3b 100644 (file)
@@ -1892,6 +1892,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);