[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_EAB6EEFECE8878FA6F142C596DB09568E80A@qq.com>
Date: Wed, 7 Aug 2024 18:59:45 +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")
#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);
Powered by blists - more mailing lists