mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+75ec36af46e2098f253c@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [can?] KASAN: slab-use-after-free Read in j1939_xtp_rx_dat_one
Date: Sun, 14 Apr 2024 17:30:11 +0800	[thread overview]
Message-ID: <20240414093011.2358-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000a87d17061608997e@google.com>

On Sat, 13 Apr 2024 23:27:33 -0700
> syzbot found the following issue on:
> 
> HEAD commit:    2c71fdf02a95 Merge tag 'drm-fixes-2024-04-09' of https://g..
> git tree:       upstream
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11ae00cb180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  2c71fdf02a95

--- x/net/can/j1939/transport.c
+++ y/net/can/j1939/transport.c
@@ -2122,10 +2122,12 @@ static void j1939_tp_cmd_recv(struct j19
 int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb)
 {
 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
+	int ret = 1;
 
 	if (!j1939_tp_im_involved_anydir(skcb) && !j1939_cb_is_broadcast(skcb))
 		return 0;
 
+	skb_get(skb);
 	switch (skcb->addr.pgn) {
 	case J1939_ETP_PGN_DAT:
 		skcb->addr.type = J1939_ETP;
@@ -2138,14 +2140,18 @@ int j1939_tp_recv(struct j1939_priv *pri
 		skcb->addr.type = J1939_ETP;
 		fallthrough;
 	case J1939_TP_PGN_CTL:
-		if (skb->len < 8)
-			return 0; /* Don't care. Nothing to extract here */
+		if (skb->len < 8) {
+			ret = 0; /* Don't care. Nothing to extract here */
+			break;
+		}
 
 		j1939_tp_cmd_recv(priv, skb);
 		break;
 	default:
-		return 0; /* no problem */
+		ret = 0; /* no problem */
+		break;
 	}
+	kfree_skb(skb);
 	return 1; /* "I processed the message" */
 }
 
--

  reply	other threads:[~2024-04-14  9:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14  6:27 syzbot
2024-04-14  9:30 ` Hillf Danton [this message]
2024-04-14  9:52   ` syzbot

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=20240414093011.2358-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+75ec36af46e2098f253c@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®