]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
netpoll: shut up a kernel warning on refcount
authorWANG Cong <xiyou.wangcong@gmail.com>
Wed, 12 Jul 2017 22:56:41 +0000 (15:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Jul 2017 15:16:59 +0000 (08:16 -0700)
When we convert atomic_t to refcount_t, a new kernel warning
on "increment on 0" is introduced in the netpoll code,
zap_completion_queue(). In fact for this special case, we know
the refcount is 0 and we just have to set it to 1 to satisfy
the following dev_kfree_skb_any(), so we can just use
refcount_set(..., 1) instead.

Fixes: 633547973ffc ("net: convert sk_buff.users from atomic_t to refcount_t")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Cc: Reshetova, Elena <elena.reshetova@intel.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index d3408a69316622a59de0ce19d5197be56d5a87a4..8357f164c66092b9c99996782d29de246c54dbd6 100644 (file)
@@ -277,7 +277,7 @@ static void zap_completion_queue(void)
                        struct sk_buff *skb = clist;
                        clist = clist->next;
                        if (!skb_irq_freeable(skb)) {
-                               refcount_inc(&skb->users);
+                               refcount_set(&skb->users, 1);
                                dev_kfree_skb_any(skb); /* put this one back */
                        } else {
                                __kfree_skb(skb);