Messages in this thread | | | Date | Wed, 23 Feb 2022 14:23:47 +0300 | Subject | Re: [syzbot] KASAN: use-after-free Read in dev_uevent | From | Pavel Skripkin <> |
| |
Hi Qiang1,
On 2/23/22 14:17, Zhang, Qiang1 wrote: > > Cc: Alan Stern > Felipe Balbi > > Hello syzbot, Please try it: > > From 574d45ff924e2d2f9b9f5cc3e846f8004498a811 Mon Sep 17 00:00:00 2001 > From: Zqiang <qiang1.zhang@intel.com> > Date: Wed, 23 Feb 2022 18:18:22 +0800 > Subject: [PATCH] driver core: Fix use-after-free in dev_uevent() > > In dev_uevent(), if the "dev->driver" is valid, the "dev->driver->name" > be accessed, there may be a window period between these two operations. > in this window period if the "dev->driver" is set to null > (in usb_gadget_unregister_driver function), when the "dev->driver->name" > is accessed again, invalid address will be accessed. fix it by checking > "dev->driver" again. > > Signed-off-by: Zqiang <qiang1.zhang@intel.com> > --- > drivers/base/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 3d6430eb0c6a..a45b927ee76e 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -2317,7 +2317,7 @@ static int dev_uevent(struct kobject *kobj, struct kobj_uevent_env *env) > add_uevent_var(env, "DEVTYPE=%s", dev->type->name); > > if (dev->driver) > - add_uevent_var(env, "DRIVER=%s", dev->driver->name); > + add_uevent_var(env, "DRIVER=%s", dev_driver_string(dev)); > > /* Add common DT information about the device */ > of_device_uevent(dev, env); > -- > 2.25.1 >
you should use '#syz test' command to ask syzbot to test the patch. Basic syntax is '#syz test: <git tree> <branch or sha>' and syzbot will apply attached patch (if you have attached it)
More about syzbot interactions here [1].
[1] https://github.com/google/syzkaller/blob/15439f1624735bde5ae3f3b66c1b964a98
With regards, Pavel Skripkin
| |