[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_A51B5C25CDBA1CBBBA33419EFB1B3B4B6508@qq.com>
Date: Wed, 9 Oct 2024 17:04:02 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+1f8ca5ee82576ec01f12@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [usb?] possible deadlock in chaoskey_open
delay get the chaoskey_list_lock, avoid to circular locking dependency
chaoskey_release has a wrong logic lock for chaoskey_list_lock, it need unlock.
#syz test
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index e8b63df5f975..225863321dc4 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -232,10 +232,10 @@ static void chaoskey_disconnect(struct usb_interface *interface)
if (dev->hwrng_registered)
hwrng_unregister(&dev->hwrng);
- mutex_lock(&chaoskey_list_lock);
usb_deregister_dev(interface, &chaoskey_class);
usb_set_intfdata(interface, NULL);
+ mutex_lock(&chaoskey_list_lock);
mutex_lock(&dev->lock);
dev->present = false;
@@ -319,7 +319,7 @@ static int chaoskey_release(struct inode *inode, struct file *file)
bail:
mutex_unlock(&dev->lock);
destruction:
- mutex_lock(&chaoskey_list_lock);
+ mutex_unlock(&chaoskey_list_lock);
usb_dbg(interface, "release success");
return rv;
}
Powered by blists - more mailing lists