From: Eric Biggers <ebiggers@kernel.org>
To: Himadri Pandya <himadrispandya@gmail.com>
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org,
kuba@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org,
davem@davemloft.net
Subject: Re: [Linux-kernel-mentees] [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
Date: Thu, 27 Aug 2020 10:52:15 -0700 [thread overview]
Message-ID: <20200827175215.GA2582911@gmail.com> (raw)
In-Reply-To: <20200827065355.15177-1-himadrispandya@gmail.com>
On Thu, Aug 27, 2020 at 12:23:55PM +0530, Himadri Pandya wrote:
> The buffer size is 2 Bytes and we expect to receive the same amount of
> data. But sometimes we receive less data and run into uninit-was-stored
> issue upon read. Hence modify the error check on the return value to match
> with the buffer size as a prevention.
>
> Reported-and-tested by: syzbot+a7e220df5a81d1ab400e@syzkaller.appspotmail.com
> Signed-off-by: Himadri Pandya <himadrispandya@gmail.com>
> ---
> drivers/net/usb/asix_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index e39f41efda3e..7bc6e8f856fe 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal)
>
> netdev_dbg(dev->net, "asix_get_phy_addr()\n");
>
> - if (ret < 0) {
> + if (ret < 2) {
> netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
> goto out;
> }
If ret is 0 or 1 here, shouldn't asix_read_phy_addr() return an error code
instead of 0 or 1?
- Eric
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Himadri Pandya <himadrispandya@gmail.com>
Cc: davem@davemloft.net, kuba@kernel.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com,
linux-kernel-mentees@lists.linuxfoundation.org,
gregkh@linuxfoundation.org
Subject: Re: [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
Date: Thu, 27 Aug 2020 10:52:15 -0700 [thread overview]
Message-ID: <20200827175215.GA2582911@gmail.com> (raw)
In-Reply-To: <20200827065355.15177-1-himadrispandya@gmail.com>
On Thu, Aug 27, 2020 at 12:23:55PM +0530, Himadri Pandya wrote:
> The buffer size is 2 Bytes and we expect to receive the same amount of
> data. But sometimes we receive less data and run into uninit-was-stored
> issue upon read. Hence modify the error check on the return value to match
> with the buffer size as a prevention.
>
> Reported-and-tested by: syzbot+a7e220df5a81d1ab400e@syzkaller.appspotmail.com
> Signed-off-by: Himadri Pandya <himadrispandya@gmail.com>
> ---
> drivers/net/usb/asix_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index e39f41efda3e..7bc6e8f856fe 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal)
>
> netdev_dbg(dev->net, "asix_get_phy_addr()\n");
>
> - if (ret < 0) {
> + if (ret < 2) {
> netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
> goto out;
> }
If ret is 0 or 1 here, shouldn't asix_read_phy_addr() return an error code
instead of 0 or 1?
- Eric
next prev parent reply other threads:[~2020-08-27 17:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 6:53 [Linux-kernel-mentees] [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() Himadri Pandya
2020-08-27 6:53 ` Himadri Pandya
2020-08-27 7:57 ` [Linux-kernel-mentees] " Sergei Shtylyov
2020-08-27 7:57 ` Sergei Shtylyov
2020-08-28 11:06 ` [Linux-kernel-mentees] " Himadri Pandya
2020-08-28 11:06 ` Himadri Pandya
2020-08-27 14:37 ` [Linux-kernel-mentees] " David Miller
2020-08-27 14:37 ` David Miller
2020-08-27 17:52 ` Eric Biggers [this message]
2020-08-27 17:52 ` Eric Biggers
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=20200827175215.GA2582911@gmail.com \
--to=ebiggers@kernel.org \
--cc=davem@davemloft.net \
--cc=himadrispandya@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.