* [Patch net] netpoll: shut up a kernel warning on refcount
@ 2017-07-12 22:56 Cong Wang
2017-07-14 15:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2017-07-12 22:56 UTC (permalink / raw)
To: netdev; +Cc: davej, Cong Wang, Reshetova, Elena
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>
---
net/core/netpoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index d3408a6..8357f16 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -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);
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] netpoll: shut up a kernel warning on refcount
2017-07-12 22:56 [Patch net] netpoll: shut up a kernel warning on refcount Cong Wang
@ 2017-07-14 15:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-14 15:17 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, davej, elena.reshetova
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Wed, 12 Jul 2017 15:56:41 -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>
Applied, thanks Cong.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-14 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12 22:56 [Patch net] netpoll: shut up a kernel warning on refcount Cong Wang
2017-07-14 15:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).