lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_FADDBB192B4F958DFF25E68DEF920F5D8507@qq.com>
Date: Wed,  7 Aug 2024 10:38:58 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+ad601904231505ad6617@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
	syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [can?] WARNING: refcount bug in j1939_session_put

Fixes: c9c0ee5f20c5 ("net: skbuff: Skip early return in skb_unref when debugging")

Root cause: In commit c9c0ee5f20c5, There are following rules:
In debug builds (CONFIG_DEBUG_NET set), the reference count is always  decremented, even when it's 1

This rule will cause the reference count to be 0 after calling skc_unref,
which will affect the release of skb.

#syz test: net-next 743ff02152bc

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 4be73de5033c..257740076616 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -279,6 +279,9 @@ static void j1939_session_destroy(struct j1939_session *session)
 	while ((skb = skb_dequeue(&session->skb_queue)) != NULL) {
 		/* drop ref taken in j1939_session_skb_queue() */
 		skb_unref(skb);
+		if (IS_ENABLED(CONFIG_DEBUG_NET) &&
+		    refcount_read(&skb->users) <= 0)
+			refcount_set(&skb->users, 1);
 		kfree_skb(skb);
 	}
 	__j1939_session_drop(session);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ