From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Edward Adam Davis <eadavis@qq.com>,
syzbot+2b131f51bb4af224ab40@syzkaller.appspotmail.com
Cc: davem@davemloft.net, edumazet@google.com,
gregkh@linuxfoundation.org, hdanton@sina.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, penguin-kernel@i-love.sakura.ne.jp,
stern@rowland.harvard.edu, syzkaller-bugs@googlegroups.com,
torvalds@linux-foundation.org
Subject: Re: [PATCH] nfc/nci: fix task hung in nfc_targets_found
Date: Mon, 15 Jan 2024 10:36:39 +0100 [thread overview]
Message-ID: <10fa514a-7fa0-449f-a7fd-cd3bfb0180d7@linaro.org> (raw)
In-Reply-To: <tencent_E44436084AA874977705670A3CDD37BE9609@qq.com>
On 14/01/2024 09:20, Edward Adam Davis wrote:
> nci_start_poll() holds the dev->mutex required by the kworker of nci_close_device(),
> and the related tasks are as follows:
> |cpu0 |cpu1 |cpu2 |
> |nci_close_device() | | |
> |mutex_lock(&ndev->req_lock); | | |
> |... |nfc_genl_start_poll() | |
> |flush_workqueue(ndev->rx_wq) |mutex_lock(&dev->genl_data.genl_data_mutex); | |
> | |nfc_start_poll() | |
> | |device_lock(&dev->dev); |process_one_work() |
> | |nci_start_poll() |nfc_targets_found() |
> | |nci_request() |device_lock(&dev->dev); |
> | |mutex_lock(&ndev->req_lock); | |
>
> Therefore, before applying for req_lock in nci_request(), it should be determined
> whether the execution of nci_close_device() has already begun.
>
> Reported-and-tested-by: syzbot+2b131f51bb4af224ab40@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> net/nfc/nci/core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
> index 6c9592d05120..9a277228a875 100644
> --- a/net/nfc/nci/core.c
> +++ b/net/nfc/nci/core.c
> @@ -145,6 +145,8 @@ inline int nci_request(struct nci_dev *ndev,
> {
> int rc;
>
> + if (test_bit(NCI_UNREG, &ndev->flags))
> + return -ENODEV;
nci_close_device() clears the NCI_UP, which is tested here, just after
acquiring mutex. And there is explicit comment about it just below your
code. Why it is not relevant?
Your code looks really unnecessary, at least with that code flow from
commit msg. Especially considering you do it outside of mutex, so how
does it solve anything?
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-01-15 9:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 0:59 [syzbot] [net?] [nfc?] INFO: " syzbot
2024-01-04 5:05 ` Hillf Danton
2024-01-04 10:34 ` Tetsuo Handa
2024-01-11 19:08 ` syzbot
2024-01-14 8:20 ` [PATCH] nfc/nci: fix " Edward Adam Davis
2024-01-15 9:36 ` Krzysztof Kozlowski [this message]
2024-01-15 11:08 ` Tetsuo Handa
2024-01-15 11:15 ` Krzysztof Kozlowski
2024-01-13 17:29 ` [syzbot] [net?] [nfc?] INFO: " syzbot
2024-01-14 7:35 ` Edward Adam Davis
2024-01-14 8:05 ` syzbot
2024-06-24 17:54 ` 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=10fa514a-7fa0-449f-a7fd-cd3bfb0180d7@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=davem@davemloft.net \
--cc=eadavis@qq.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdanton@sina.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=stern@rowland.harvard.edu \
--cc=syzbot+2b131f51bb4af224ab40@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=torvalds@linux-foundation.org \
/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®