mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+ad601904231505ad6617@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [can?] WARNING: refcount bug in j1939_session_put
Date: Wed,  7 Aug 2024 18:59:45 +0800	[thread overview]
Message-ID: <tencent_EAB6EEFECE8878FA6F142C596DB09568E80A@qq.com> (raw)
In-Reply-To: <000000000000af9991061ef63774@google.com>

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

#syz test: net-next 743ff02152bc

diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 305dd72c844c..c9b446c60e8c 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -1161,6 +1161,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
 				 * fist in the queue
 				 */
 				if (!j1939_session_activate(session)) {
+					printk("1skb: %p, todo_size: %lu, seg size: %lu, %s\n", skb, todo_size, segment_size, __func__);
 					j1939_tp_schedule_txtimer(session, 0);
 				} else {
 					ret = -EBUSY;
@@ -1170,10 +1171,10 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
 					break;
 				}
 			}
-		} else {
-			skcb->offset = session->total_queued_size;
-			j1939_session_skb_queue(session, skb);
 		}
+		skcb->offset = session->total_queued_size;
+		j1939_session_skb_queue(session, skb);
+		printk("2skb: %p, todo_size: %lu, seg size: %lu, %s\n", skb, todo_size, segment_size, __func__);
 
 		todo_size -= segment_size;
 		session->total_queued_size += segment_size;
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 4be73de5033c..dd503bc3adb5 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1505,7 +1505,6 @@ static struct j1939_session *j1939_session_new(struct j1939_priv *priv,
 	session->state = J1939_SESSION_NEW;
 
 	skb_queue_head_init(&session->skb_queue);
-	skb_queue_tail(&session->skb_queue, skb);
 
 	skcb = j1939_skb_to_cb(skb);
 	memcpy(&session->skcb, skcb, sizeof(session->skcb));
@@ -1548,6 +1547,7 @@ j1939_session *j1939_session_fresh_new(struct j1939_priv *priv,
 		kfree_skb(skb);
 		return NULL;
 	}
+	j1939_session_skb_queue(session, skb);
 
 	/* alloc data area */
 	skb_put(skb, size);


  parent reply	other threads:[~2024-08-07 10:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 21:18 syzbot
2024-08-06 13:12 ` Edward Adam Davis
2024-08-06 13:32   ` syzbot
2024-08-06 13:39 ` Edward Adam Davis
2024-08-06 14:04   ` syzbot
2024-08-07  0:51 ` Edward Adam Davis
2024-08-07  1:22   ` syzbot
2024-08-07  1:18 ` Edward Adam Davis
2024-08-07  1:39   ` syzbot
2024-08-07  1:42 ` Edward Adam Davis
2024-08-07  2:00   ` syzbot
2024-08-07  8:02   ` Breno Leitao
2024-08-07 23:06     ` Edward Adam Davis
2024-08-07  2:38 ` Edward Adam Davis
2024-08-07  3:11   ` syzbot
2024-08-07  6:21 ` Edward Adam Davis
2024-08-07  6:40   ` syzbot
2024-08-07  6:56 ` Edward Adam Davis
2024-08-07  8:20   ` syzbot
2024-08-07  8:30 ` Edward Adam Davis
2024-08-07  9:14   ` syzbot
2024-08-07  9:29 ` Edward Adam Davis
2024-08-07 10:20   ` syzbot
2024-08-07 10:59 ` Edward Adam Davis [this message]
2024-08-07 12:12   ` syzbot
2024-08-07 12:35 ` [PATCH net-next] can: j1939: fix uaf in j1939_session_destroy Edward Adam Davis
2024-08-07 14:16   ` Jakub Kicinski
2024-08-07 23:08     ` [PATCH net-next V2] can: j1939: fix uaf warning " Edward Adam Davis
2024-08-08  7:49       ` Oleksij Rempel
2024-08-08 11:07         ` Edward Adam Davis
2024-08-08 11:57           ` Marc Kleine-Budde
2024-10-11 13:41           ` Sabyrzhan Tasbolatov
2024-10-11 14:10             ` Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_EAB6EEFECE8878FA6F142C596DB09568E80A@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+ad601904231505ad6617@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®