public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+e29c204bd2e3906fe69c@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] [nfc?] WARNING: locking bug in nci_close_device (2)
Date: Thu,  4 Apr 2024 08:00:49 +0800	[thread overview]
Message-ID: <20240404000049.3868-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000195eea0615368539@google.com>

On Wed, 03 Apr 2024 12:49:25 -0700
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    fe46a7dd189e Merge tag 'sound-6.9-rc1' of git://git.kernel..
> git tree:       upstream
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1201b6d3180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  fe46a7dd189e

--- x/net/nfc/nci/core.c
+++ y/net/nfc/nci/core.c
@@ -560,7 +560,8 @@ static int nci_close_device(struct nci_d
 	 */
 	mutex_lock(&ndev->req_lock);
 
-	if (!test_and_clear_bit(NCI_UP, &ndev->flags)) {
+	if (!test_and_clear_bit(NCI_UP, &ndev->flags) &&
+	    !test_bit(NCI_UNREG +1, &ndev->flags)) {
 		/* Need to flush the cmd wq in case
 		 * there is a queued/running cmd_work
 		 */
@@ -601,6 +602,7 @@ static int nci_close_device(struct nci_d
 
 	/* Clear flags except NCI_UNREG */
 	ndev->flags &= BIT(NCI_UNREG);
+	set_bit(NCI_UNREG +1, &ndev->flags);
 
 	mutex_unlock(&ndev->req_lock);
 
--

  reply	other threads:[~2024-04-04  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30 11:02 [syzbot] [nfc?] [net?] WARNING: locking bug in nci_close_device (2) syzbot
2024-03-30 11:02 ` syzbot
2024-03-30 11:02 ` syzbot
2024-04-03 19:49 ` [syzbot] [net?] [nfc?] " syzbot
2024-04-04  0:00   ` Hillf Danton [this message]
2024-04-04 10:15     ` syzbot
2024-04-04 10:58   ` Hillf Danton
2024-04-04 20:23     ` syzbot

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=20240404000049.3868-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+e29c204bd2e3906fe69c@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