From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Oliver Neukum <oneukum@suse.com>,
syzbot <syzbot+26ec41e9f788b3eba396@syzkaller.appspotmail.com>,
andreyknvl@google.com, syzkaller-bugs@googlegroups.com,
mchehab@kernel.org, corbet@lwn.net, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: KASAN: use-after-free Read in dvb_usb_device_exit
Date: Mon, 15 Apr 2019 19:22:29 +0300 [thread overview]
Message-ID: <1e782001-7f5c-623e-f4c6-6e1e0fc90598@cogentembedded.com> (raw)
In-Reply-To: <1555326745.13626.10.camel@suse.com>
Hello!
On 04/15/2019 02:12 PM, Oliver Neukum wrote:
[...]
> From d6097d205ac61745334b79639d3b8b910ae66c71 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oneukum@suse.com>
> Date: Mon, 15 Apr 2019 13:06:01 +0200
> Subject: [PATCH] dvb: usb: fix use after free in dvb_usb_device_exit
>
> dvb_usb_device_exit() frees and uses teh device name in that order
s/teh/the/.
> Fix by storing the name in a buffer before freeing it
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Reported-by: syzbot+26ec41e9f788b3eba396@syzkaller.appspotmail.com
> ---
> drivers/media/usb/dvb-usb/dvb-usb-init.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
> index 99951e02a880..2e1670cc3903 100644
> --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
> +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
> @@ -288,13 +288,18 @@ void dvb_usb_device_exit(struct usb_interface *intf)
> {
> struct dvb_usb_device *d = usb_get_intfdata(intf);
> const char *name = "generic DVB-USB module";
> + char identifier[40];
>
> usb_set_intfdata(intf, NULL);
> if (d != NULL && d->desc != NULL) {
> name = d->desc->name;
> + memcpy(identifier, name, 39);
> + identifier[39] = NULL;
NULL is for pointers, no?
> dvb_usb_exit(d);
> + } else {
> + memcpy(identifier, name, 39);
> }
> - info("%s successfully deinitialized and disconnected.", name);
> + info("%s successfully deinitialized and disconnected.", identifier);
>
> }
> EXPORT_SYMBOL(dvb_usb_device_exit);
MBR, Sergei
next prev parent reply other threads:[~2019-04-15 16:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 11:46 KASAN: use-after-free Read in dvb_usb_device_exit syzbot
2019-04-15 11:12 ` Oliver Neukum
2019-04-15 16:22 ` Sergei Shtylyov [this message]
2019-04-24 14:09 ` Hans Verkuil
2019-04-25 14:08 ` Oliver Neukum
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=1e782001-7f5c-623e-f4c6-6e1e0fc90598@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=andreyknvl@google.com \
--cc=corbet@lwn.net \
--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.com \
--cc=syzbot+26ec41e9f788b3eba396@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).