Re: [syzbot] [atm?] KMSAN: uninit-value in atmtcp_c_send
From: Kuniyuki Iwashima
Date: Fri Jun 13 2025 - 00:24:29 EST
From: syzbot <syzbot+1d3c235276f62963e93a@xxxxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxxxxxx
> Tested-by: syzbot+1d3c235276f62963e93a@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> 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) {