Re: [syzbot] [net?] KASAN: slab-use-after-free Read in handle_tx (2)

Hillf Danton
2025-01-18T11:06:19Z

On Fri, 17 Jan 2025 09:11:25 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 9bffa1ad25b8 Merge tag 'drm-fixes-2025-01-17' of https://g..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17d6c2b0580000

#syz test

--- x/drivers/net/caif/caif_serial.c
+++ y/drivers/net/caif/caif_serial.c
@@ -304,11 +304,14 @@ static void ser_release(struct work_stru
spin_unlock(&ser_lock);

if (!list_empty(&list)) {
+ struct tty_struct *tty;
rtnl_lock();
list_for_each_entry_safe(ser, tmp, &list, node) {
+ tty = ser->tty;
dev_close(ser->dev);
unregister_netdevice(ser->dev);
debugfs_deinit(ser);
+ tty_kref_put(tty);
}
rtnl_unlock();
}
@@ -369,8 +372,6 @@ static void ldisc_close(struct tty_struc
{
struct ser_device *ser = tty->disc_data;

- tty_kref_put(ser->tty);
-
spin_lock(&ser_lock);
list_move(&ser->node, &ser_release_list);
spin_unlock(&ser_lock);
--