From: Paolo Abeni <pabeni@redhat.com>
To: Edward Adam Davis <eadavis@qq.com>, horms@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
syzbot+5dd615f890ddada54057@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH net v2] net: atm: implement pre_send to check input before sending
Date: Thu, 4 Dec 2025 11:35:39 +0100 [thread overview]
Message-ID: <70b71e0c-e1dc-4c9d-a75f-7adb9c92e394@redhat.com> (raw)
In-Reply-To: <tencent_E83074AB763967783C9D36949674363C4A09@qq.com>
On 12/1/25 5:31 AM, Edward Adam Davis wrote:
> diff --git a/net/atm/lec.c b/net/atm/lec.c
> index afb8d3eb2185..8a9660abd134 100644
> --- a/net/atm/lec.c
> +++ b/net/atm/lec.c
> @@ -340,6 +340,23 @@ static int lec_close(struct net_device *dev)
> return 0;
> }
>
> +static int lec_atm_pre_send(struct atm_vcc *vcc, struct sk_buff *skb)
> +{
> + struct atmlec_msg *mesg;
> + int sizeoftlvs;
> + int msg_size = sizeof(struct atmlec_msg);
Please respect the revers christmas tree above.
> +
> + if (skb->len < msg_size)
> + return -EINVAL;
> +
> + mesg = (struct atmlec_msg *)skb->data;
> + sizeoftlvs = mesg->sizeoftlvs;
> + if (sizeoftlvs > 0 && !pskb_may_pull(skb, msg_size + sizeoftlvs))
AI based review noticed that negative `sizeoftlvs` values will foul the
above check:
https://netdev-ai.bots.linux.dev/ai-review.html?id=8b2b0db8-e11a-4215-85a6-a0735c7d908b
AFAICS the lec code always interpret `sizeoftlvs` as u32, regardless of
the type used by `struct atmlec_msg`. I suggest doing the same.
/P
next prev parent reply other threads:[~2025-12-04 10:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 11:59 [syzbot] [net?] KMSAN: uninit-value in lec_atm_send syzbot
2025-11-28 15:56 ` [PATCH] net: atm: targetless need more input msg Edward Adam Davis
2025-11-30 15:56 ` Simon Horman
2025-12-01 1:35 ` Edward Adam Davis
2025-12-01 4:31 ` [PATCH net v2] net: atm: implement pre_send to check input before sending Edward Adam Davis
2025-12-04 10:35 ` Paolo Abeni [this message]
2025-12-04 10:26 ` [PATCH] net: atm: targetless need more input msg Paolo Abeni
2025-12-07 3:29 ` Forwarded: [PATCH] net: atm: lec: add pre_send validation to avoid uninitialized 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=70b71e0c-e1dc-4c9d-a75f-7adb9c92e394@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=eadavis@qq.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzbot+5dd615f890ddada54057@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®