mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+1f8ca5ee82576ec01f12@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [usb?] possible deadlock in chaoskey_open
Date: Wed,  9 Oct 2024 16:39:07 +0800	[thread overview]
Message-ID: <tencent_50D0A5FA0DA39222DD8A5DDF192D4FC80D07@qq.com> (raw)
In-Reply-To: <6705f457.050a0220.3f80e.0021.GAE@google.com>

delay get the chaoskey_list_lock, avoid to circular locking dependency

#syz test

diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index e8b63df5f975..17e29c6e878b 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;


  reply	other threads:[~2024-10-09  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  3:11 [syzbot] [usb?] possible deadlock in usb_deregister_dev (3) syzbot
2024-10-09  8:39 ` Edward Adam Davis [this message]
2024-10-09  9:12   ` syzbot
2024-10-09  9:04 ` [usb?] possible deadlock in chaoskey_open Edward Adam Davis
2024-10-09 14:33   ` [syzbot] [usb?] possible deadlock in usb_deregister_dev (3) syzbot
  -- strict thread matches above, loose matches on Subject: below --
2024-10-09  3:33 [syzbot] [usb?] possible deadlock in chaoskey_release syzbot
2024-10-09  8:43 ` [usb?] possible deadlock in chaoskey_open Edward Adam Davis
2024-10-09  3:00 [syzbot] " syzbot
2024-10-09  8:36 ` Edward Adam Davis
2024-10-09  9:03 ` Edward Adam Davis

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=tencent_50D0A5FA0DA39222DD8A5DDF192D4FC80D07@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+1f8ca5ee82576ec01f12@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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

all inboxes | Powered by JetHome®