[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250921123825.7352-1-hdanton@sina.com>
Date: Sun, 21 Sep 2025 20:38:24 +0800
From: Hillf Danton <hdanton@...a.com>
To: syzbot <syzbot+a56aa983ce6a1bf12485@...kaller.appspotmail.com>
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [fs?] KASAN: slab-use-after-free Read in driver_remove_file
> Date: Sat, 20 Sep 2025 21:04:28 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 3b08f56fbbb9 Merge tag 'x86-urgent-2025-09-20' of git://gi..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=14ce5858580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=8f01d8629880e620
> dashboard link: https://syzkaller.appspot.com/bug?extid=a56aa983ce6a1bf12485
> compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15571534580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=152f7e42580000
#syz test
--- x/drivers/comedi/drivers.c
+++ y/drivers/comedi/drivers.c
@@ -961,7 +961,7 @@ EXPORT_SYMBOL_GPL(comedi_legacy_detach);
int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
struct comedi_driver *driv;
- int ret;
+ int ret, detach;
lockdep_assert_held(&dev->mutex);
if (dev->attached)
@@ -1004,11 +1004,15 @@ int comedi_device_attach(struct comedi_d
dev->driver = driv;
dev->board_name = dev->board_ptr ? *(const char **)dev->board_ptr
: dev->driver->driver_name;
+ detach = 0;
ret = driv->attach(dev, it);
- if (ret >= 0)
+ if (ret >= 0) {
+ detach = 1;
ret = comedi_device_postconfig(dev);
+ }
if (ret < 0) {
- comedi_device_detach(dev);
+ if (detach)
+ comedi_device_detach(dev);
module_put(driv->module);
}
/* On success, the driver module count has been incremented. */
--
Powered by blists - more mailing lists