Re: netconsole refcount warning
From: Cong Wang <hidden>
Date: 2017-07-12 22:30:59
On Sun, Jul 9, 2017 at 4:57 PM, Dave Jones [off-list ref] wrote:
The new refcount debugging code spews this twice during boot on my router.. refcount_t: increment on 0; use-after-free. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 17 at lib/refcount.c:152 refcount_inc+0x2b/0x30 CPU: 1 PID: 17 Comm: ksoftirqd/1 Not tainted 4.12.0-firewall+ #8 task: ffff8801d4441ac0 task.stack: ffff8801d4450000 RIP: 0010:refcount_inc+0x2b/0x30 RSP: 0018:ffff8801d4456da8 EFLAGS: 00010046 RAX: 000000000000002c RBX: ffff8801d4c3cf40 RCX: 0000000000000000 RDX: 000000000000002c RSI: 0000000000000003 RDI: ffffed003a88adab RBP: ffff8801d4456da8 R08: 0000000000000003 R09: fffffbfff4afcb57 R10: 0000000000000000 R11: fffffbfff4afcb58 R12: ffff8801d4c3c540 R13: 0000000000000082 R14: ffff8801ce9c7ff8 R15: ffff8801ce9c8aa0 FS: 0000000000000000(0000) GS:ffff8801d6a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fa2b803156e CR3: 00000001c405d000 CR4: 00000000000406e0 Call Trace: zap_completion_queue+0xad/0x1a0
Sigh... it is on purpose:
commit 8a455b087c9629b3ae3b521b4f1ed16672f978cc
Author: Jarek Poplawski [off-list ref]
Date: Thu Mar 20 16:07:27 2008 -0700
netpoll: zap_completion_queue: adjust skb->users counter
zap_completion_queue() retrieves skbs from completion_queue where they have
zero skb->users counter. Before dev_kfree_skb_any() it should be non-zero
yet, so it's increased now.
Reported-and-tested-by: Andrew Morton [off-list ref]
Signed-off-by: Jarek Poplawski [off-list ref]
Signed-off-by: Andrew Morton [off-list ref]
Signed-off-by: David S. Miller [off-list ref]
We need to review it now. :-/