linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Oliver Neukum <oneukum@suse.de>
Cc: syzbot <syzbot+9a48339b077c5a80b869@syzkaller.appspotmail.com>,
	andreyknvl@google.com, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-usb@vger.kernel.org,
	mchehab@kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: KASAN: use-after-free Read in uvc_probe
Date: Tue, 11 Feb 2020 17:38:23 +0200	[thread overview]
Message-ID: <20200211153823.GD22612@pendragon.ideasonboard.com> (raw)
In-Reply-To: <1581431490.1580.6.camel@suse.de>

Hi Oliver,

On Tue, Feb 11, 2020 at 03:31:30PM +0100, Oliver Neukum wrote:
> Am Montag, den 10.02.2020, 16:18 +0200 schrieb Laurent Pinchart:
> > On Mon, Feb 10, 2020 at 03:13:26PM +0100, Oliver Neukum wrote:
> > > Am Montag, den 13.01.2020, 04:24 -0800 schrieb syzbot:
> > > > Hello,
> > > > 
> > > > syzbot found the following crash on:
> > > > 
> > > > HEAD commit:    ae179410 usb: gadget: add raw-gadget interface
> > > > git tree:       https://github.com/google/kasan.git usb-fuzzer
> > > > console output: https://syzkaller.appspot.com/x/log.txt?x=132223fee00000
> > > > kernel config:  https://syzkaller.appspot.com/x/.config?x=ad1d751a3a72ae57
> > > > dashboard link: https://syzkaller.appspot.com/bug?extid=9a48339b077c5a80b869
> > > > compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> > > > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16857325e00000
> > > > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=142e069ee00000
> > > > 
> > > > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > > > Reported-by: syzbot+9a48339b077c5a80b869@syzkaller.appspotmail.com
> > > > 
> > > > usb 1-1: New USB device found, idVendor=0bd3, idProduct=0555,  
> > > > bcdDevice=69.6a
> > > > usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> > > > usb 1-1: config 0 descriptor??
> > > > usb 1-1: string descriptor 0 read error: -71
> > > > uvcvideo: Found UVC 0.00 device <unnamed> (0bd3:0555)
> > > > ==================================================================
> > > > BUG: KASAN: use-after-free in uvc_register_terms  
> > > > drivers/media/usb/uvc/uvc_driver.c:2038 [inline]
> > > > BUG: KASAN: use-after-free in uvc_register_chains  
> > > > drivers/media/usb/uvc/uvc_driver.c:2070 [inline]
> > > > BUG: KASAN: use-after-free in uvc_probe.cold+0x2193/0x29de  
> > > > drivers/media/usb/uvc/uvc_driver.c:2201
> > > > Read of size 2 at addr ffff8881d4f1bc2e by task kworker/1:2/94
> > > 
> > > #syz test: https://github.com/google/kasan.git ae179410
> > > 
> > > From db844641a5e30f3cfc0ce9cde156b3cc356b6c0c Mon Sep 17 00:00:00 2001
> > > From: Oliver Neukum <oneukum@suse.com>
> > > Date: Mon, 10 Feb 2020 15:10:36 +0100
> > > Subject: [PATCH] UVC: deal with unnamed streams
> > > 
> > > The pointer can be NULL
> > > 
> > > Signed-off-by: Oliver Neukum <oneukum@suse.com>
> > > ---
> > >  drivers/media/usb/uvc/uvc_driver.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > > index 99883550375e..26558a89f2fe 100644
> > > --- a/drivers/media/usb/uvc/uvc_driver.c
> > > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > > @@ -2069,7 +2069,8 @@ static int uvc_register_terms(struct uvc_device *dev,
> > >  		stream = uvc_stream_by_id(dev, term->id);
> > >  		if (stream == NULL) {
> > >  			uvc_printk(KERN_INFO, "No streaming interface found "
> > > -				   "for terminal %u.", term->id);
> > > +				   "for terminal %u.",
> > > +				   term->id ? term->id : "(Unnamed)");
> > 
> > Have you tried compiling this ?
> 
> Yes. It does compile. Why?

Because term->id is a u8, "(Unnamed)" is a const char *, and %u requires
an integer. I'm surprised the compiler doesn't complain, but in any
case, it's not right :-)

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2020-02-11 15:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13 12:24 KASAN: use-after-free Read in uvc_probe syzbot
2020-02-10 14:13 ` Oliver Neukum
2020-02-10 14:18   ` Laurent Pinchart
2020-02-11 14:31     ` Oliver Neukum
2020-02-11 15:38       ` Laurent Pinchart [this message]
2020-02-12 13:58         ` Oliver Neukum
2020-02-10 15:51   ` syzbot
2020-06-19 16:10 ` Andrey Konovalov

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=20200211153823.GD22612@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=andreyknvl@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=oneukum@suse.de \
    --cc=syzbot+9a48339b077c5a80b869@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;
as well as URLs for NNTP newsgroup(s).