From: Greg KH <gregkh@linuxfoundation.org>
To: Dharanitharan R <dharanitharan725@gmail.com>
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com,
syzbot+b4d5d8faea6996fd55e3@syzkaller.appspotmail.com
Subject: Re: [PATCH v3] usb: rtl8150: Initialize buffers to fix KMSAN uninit-value in rtl8150_open
Date: Thu, 6 Nov 2025 16:09:58 +0900 [thread overview]
Message-ID: <2025110612-lint-eggnog-590b@gregkh> (raw)
In-Reply-To: <20251105195626.4285-1-dharanitharan725@gmail.com>
On Wed, Nov 05, 2025 at 07:56:26PM +0000, Dharanitharan R wrote:
> KMSAN reported an uninitialized value use in rtl8150_open().
> Initialize rx_skb->data and intr_buff before submitting URBs to
> ensure memory is in a defined state.
>
> Changes in v3:
> - Fixed whitespace and indentation (checkpatch clean)
> - Corrected syzbot tag
> - Corrected syzbot hash and tag
Please follow the documentation for where to put this version
information.
> Reported-by: syzbot+b4d5d8faea6996fd55e3@syzkaller.appspotmail.com
> Signed-off-by: Dharanitharan R <dharanitharan725@gmail.com>
> ---
> drivers/net/usb/rtl8150.c | 34 +++++++++++++++-------------------
> 1 file changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
> index f1a868f0032e..a7116d03c3d3 100644
> --- a/drivers/net/usb/rtl8150.c
> +++ b/drivers/net/usb/rtl8150.c
> @@ -735,33 +735,30 @@ static int rtl8150_open(struct net_device *netdev)
> rtl8150_t *dev = netdev_priv(netdev);
> int res;
>
> - if (dev->rx_skb == NULL)
> - dev->rx_skb = pull_skb(dev);
> - if (!dev->rx_skb)
> - return -ENOMEM;
It looks like you are attempting to break existing situations?
> -
> set_registers(dev, IDR, 6, netdev->dev_addr);
>
> /* Fix: initialize memory before using it (KMSAN uninit-value) */
> memset(dev->rx_skb->data, 0, RTL8150_MTU);
> memset(dev->intr_buff, 0, INTBUFSIZE);
>
> - usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
> - dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
> - if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) {
> - if (res == -ENODEV)
> - netif_device_detach(dev->netdev);
> + usb_fill_bulk_urb(dev->rx_urb, dev->udev,
> + usb_rcvbulkpipe(dev->udev, 1),
> + dev->rx_skb->data, RTL8150_MTU,
> + read_bulk_callback, dev);
> +
> + res = usb_submit_urb(dev->rx_urb, GFP_KERNEL);
> + if (res) {
Why did you break the -ENODEV situation?
How was this tested?
greg k-h
prev parent reply other threads:[~2025-11-06 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 19:56 [PATCH v3] usb: rtl8150: Initialize buffers to fix KMSAN uninit-value in rtl8150_open Dharanitharan R
2025-11-05 20:26 ` Andrew Lunn
2025-11-05 20:37 ` Andrew Lunn
2025-11-06 7:09 ` Greg KH [this message]
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=2025110612-lint-eggnog-590b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=dharanitharan725@gmail.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+b4d5d8faea6996fd55e3@syzkaller.appspotmail.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).