linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov via Linux-kernel-mentees <linux-kernel-mentees@lists.linuxfoundation.org>
To: Phong Tran <tranmanphong@gmail.com>
Cc: alex.theissen@me.com, USB list <linux-usb@vger.kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com,
	2pi@mok.nu, linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] usb: appledisplay: fix use-after-free in bl_get_brightness
Date: Wed, 6 Nov 2019 13:11:09 +0100	[thread overview]
Message-ID: <CAAeHK+zzio=k6aN8rX2meYk1bWiE_TvyzovRkGXm01fbCc_nwA@mail.gmail.com> (raw)
In-Reply-To: <CAAeHK+zKShqnZ=R8KQvVjsfOkAGrWW5jbsXRUnuEY8k4XN3+Fw@mail.gmail.com>

On Wed, Nov 6, 2019 at 1:10 PM Andrey Konovalov <andreyknvl@google.com> wrote:
>
> On Wed, Nov 6, 2019 at 12:37 AM Phong Tran <tranmanphong@gmail.com> wrote:
> >
> > In context of USB disconnect, the delaywork trigger and calling
> > appledisplay_bl_get_brightness() and the msgdata was freed.
> >
> > add the checking return value of usb_control_msg() and only update the
> > data while the retval is valid.
> >
> > Reported-by: syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com
> > Reported-and-tested-by:
> > syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com
> >
> > https://groups.google.com/d/msg/syzkaller-bugs/dRmkh2UYusY/l2a6Mg3FAQAJ
>
> Hi Phong,
>
> FYI, when testing patches with the usb-fuzzer instance, you need to
> provide the same kernel commit id as the one where the bug was
> triggered. Please see here for details:

https://github.com/google/syzkaller/blob/master/docs/syzbot.md#usb-bugs

>
> >
> > Signed-off-by: Phong Tran <tranmanphong@gmail.com>
> > ---
> >  drivers/usb/misc/appledisplay.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
> > index ac92725458b5..3e3dfa5a3954 100644
> > --- a/drivers/usb/misc/appledisplay.c
> > +++ b/drivers/usb/misc/appledisplay.c
> > @@ -164,7 +164,8 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)
> >                 0,
> >                 pdata->msgdata, 2,
> >                 ACD_USB_TIMEOUT);
> > -       brightness = pdata->msgdata[1];
> > +       if (retval >= 0)
> > +               brightness = pdata->msgdata[1];
> >         mutex_unlock(&pdata->sysfslock);
> >
> >         if (retval < 0)
> > --
> > 2.20.1
> >
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2019-11-06 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <00000000000042d60805933945b5@google.com>
2019-11-05 23:36 ` [Linux-kernel-mentees] [PATCH] usb: appledisplay: fix use-after-free in bl_get_brightness Phong Tran
2019-11-06 11:42   ` Oliver Neukum
2019-11-06 12:26     ` [Linux-kernel-mentees] KASAN: use-after-free Read in appledisplay_bl_get_brightness syzbot
2019-11-06 14:22     ` [Linux-kernel-mentees] [PATCH] usb: appledisplay: fix use-after-free in bl_get_brightness Phong Tran
2019-11-07  8:50       ` Oliver Neukum
2019-11-06 12:10   ` Andrey Konovalov via Linux-kernel-mentees
2019-11-06 12:11     ` Andrey Konovalov via Linux-kernel-mentees [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='CAAeHK+zzio=k6aN8rX2meYk1bWiE_TvyzovRkGXm01fbCc_nwA@mail.gmail.com' \
    --to=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=2pi@mok.nu \
    --cc=alex.theissen@me.com \
    --cc=andreyknvl@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=syzbot+495dab1f175edc9c2f13@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tranmanphong@gmail.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).