Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: petkan@nucleusys.com, davem@davemloft.net, kuba@kernel.org
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+02c9f70f3afae308464a@syzkaller.appspotmail.com
Subject: Re: [PATCH] net: pegasus: fix uninit-value in get_interrupt_interval
Date: Wed, 4 Aug 2021 13:44:05 +0300	[thread overview]
Message-ID: <9576d0cc-1f3e-4acc-4009-79fb2dbeda34@gmail.com> (raw)
In-Reply-To: <20210730214411.1973-1-paskripkin@gmail.com>



On 7/31/21 12:44 AM, Pavel Skripkin wrote:
> Syzbot reported uninit value pegasus_probe(). The problem was in missing
> error handling.
> 
> get_interrupt_interval() internally calls read_eprom_word() which can
> fail in some cases. For example: failed to receive usb control message.
> These cases should be handled to prevent uninit value bug, since
> read_eprom_word() will not initialize passed stack variable in case of
> internal failure.
> 
> Fail log:
> 
> BUG: KMSAN: uninit-value in get_interrupt_interval drivers/net/usb/pegasus.c:746 [inline]
> BUG: KMSAN: uninit-value in pegasus_probe+0x10e7/0x4080 drivers/net/usb/pegasus.c:1152
> CPU: 1 PID: 825 Comm: kworker/1:1 Not tainted 5.12.0-rc6-syzkaller #0
> ...
> Workqueue: usb_hub_wq hub_event
> Call Trace:
>   __dump_stack lib/dump_stack.c:79 [inline]
>   dump_stack+0x24c/0x2e0 lib/dump_stack.c:120
>   kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118
>   __msan_warning+0x5c/0xa0 mm/kmsan/kmsan_instr.c:197
>   get_interrupt_interval drivers/net/usb/pegasus.c:746 [inline]
>   pegasus_probe+0x10e7/0x4080 drivers/net/usb/pegasus.c:1152
> ....
> 
> Local variable ----data.i@pegasus_probe created at:
>   get_interrupt_interval drivers/net/usb/pegasus.c:1151 [inline]
>   pegasus_probe+0xe57/0x4080 drivers/net/usb/pegasus.c:1152
>   get_interrupt_interval drivers/net/usb/pegasus.c:1151 [inline]
>   pegasus_probe+0xe57/0x4080 drivers/net/usb/pegasus.c:1152
> 
> Reported-and-tested-by: syzbot+02c9f70f3afae308464a@syzkaller.appspotmail.com
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
>   drivers/net/usb/pegasus.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> 

Hi, David and Jakub!

Should I rebase this patch on top of Petko's clean-up patches? :

1. https://git.kernel.org/netdev/net/c/8a160e2e9aeb
2. https://git.kernel.org/netdev/net/c/bc65bacf239d



With regards,
Pavel Skripkin

  parent reply	other threads:[~2021-08-04 10:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 21:44 Pavel Skripkin
2021-08-01 12:36 ` Petko Manolov
2021-08-01 19:35   ` Pavel Skripkin
2021-08-01 20:24     ` Petko Manolov
2021-08-02 20:07     ` Petko Manolov
2021-08-02 22:18       ` Pavel Skripkin
2021-08-03  5:36       ` Greg KH
2021-08-04 10:44 ` Pavel Skripkin [this message]
2021-08-04 11:58   ` Jakub Kicinski
2021-08-04 14:30     ` [PATCH net v2] " Pavel Skripkin
2021-08-05 14:50       ` patchwork-bot+netdevbpf

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=9576d0cc-1f3e-4acc-4009-79fb2dbeda34@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petkan@nucleusys.com \
    --cc=syzbot+02c9f70f3afae308464a@syzkaller.appspotmail.com \
    --subject='Re: [PATCH] net: pegasus: fix uninit-value in get_interrupt_interval' \
    /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

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).