netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuni1840@gmail.com>
To: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
Cc: 3chas3@gmail.com, kuni1840@gmail.com, kuniyu@google.com,
	linux-atm-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
Date: Thu, 12 Jun 2025 21:24:05 -0700	[thread overview]
Message-ID: <20250613042412.328342-1-kuni1840@gmail.com> (raw)
In-Reply-To: <684b9f72.050a0220.be214.0299.GAE@google.com>

From: syzbot <syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com>
Date: Thu, 12 Jun 2025 20:48:02 -0700
> Hello,
> 
> syzbot has tested the proposed patch and the reproducer did not trigger any issue:
> 
> Reported-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
> Tested-by: syzbot+1d3c235276f62963e93a@syzkaller.appspotmail.com
> 
> Tested on:
> 
> commit:         27605c8c Merge tag 'net-6.16-rc2' of git://git.kernel...
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16d17682580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=42d51b7b9f9e61d
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d3c235276f62963e93a
> compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> patch:          https://syzkaller.appspot.com/x/patch.diff?x=129e7682580000
> 
> Note: testing is done by a robot and is best-effort only.

I noticed the original code didn't call dev_kfree_skb() and leaked
sk_buff_head.

Also, most of the ATM drivers don't call atm_return() to revert
the memory accounting by atm_account_tx() in vcc_sendmsg(), but
that's another bug...

#syz test

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index d4aa0f353b6c..5ce3c6c066e1 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -288,7 +288,11 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
 	struct sk_buff *new_skb;
 	int result = 0;
 
-	if (!skb->len) return 0;
+	if (skb->len < sizeof(struct atmtcp_hdr)) {
+		dev_kfree_skb(skb);
+		return -EINVAL;
+	}
+
 	dev = vcc->dev_data;
 	hdr = (struct atmtcp_hdr *) skb->data;
 	if (hdr->length == ATMTCP_HDR_MAGIC) {

  reply	other threads:[~2025-06-13  4:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 23:41 [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send syzbot
2025-06-12 23:49 ` Kuniyuki Iwashima
2025-06-13  2:40   ` syzbot
2025-06-13  3:00     ` Kuniyuki Iwashima
2025-06-13  3:48       ` syzbot
2025-06-13  4:24         ` Kuniyuki Iwashima [this message]
2025-06-13  5:11           ` 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=20250613042412.328342-1-kuni1840@gmail.com \
    --to=kuni1840@gmail.com \
    --cc=3chas3@gmail.com \
    --cc=kuniyu@google.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+1d3c235276f62963e93a@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;
as well as URLs for NNTP newsgroup(s).