From: Yuxuan-Hu <yuxuanhu@buaa.edu.cn>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Yuxuan Hu <20373622@buaa.edu.cn>,
gregkh@linuxfoundation.org, johan@kernel.org,
davem@davemloft.net, u.kleine-koenig@pengutronix.de,
Jonathan.Cameron@huawei.com, francesco.dolcini@toradex.com,
jirislaby@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, sy2239101@buaa.edu.cn
Subject: Re: [PATCH] nfc: pn533: Fix null-ptr-deref in pn533_recv_frame()
Date: Wed, 24 Apr 2024 22:00:49 +0800 [thread overview]
Message-ID: <fdc7ada8-6ca9-4835-982a-3e45ee7ac009@buaa.edu.cn> (raw)
In-Reply-To: <f229256f-ceac-4a82-afa4-ecea67712ec3@kernel.org>
Hi Krzysztof,
Thanks for your reply.
On 2024/4/24 13:36, Krzysztof Kozlowski wrote:
> A bit better solution would be to NULL-ify dev->cmd at the beginning of
> pn533_send_async_complete(), because that seems logical. The complete
> callback takes ownership of dev->cmd, so why it performs the assignment
> at the end?
>
> However even above code will keep the race open for short period.
> Probably some locking would solve it or checking for dev->cmd in few
> places with barriers.
>
> Best regards,
> Krzysztof
I think adding a lock seems to be a better solution, however, acquire a
lock on each access to dev->cmd does not seem to be an appropriate
implementation.
I wonder whether you think it is appropriate to acquire a lock at the
beginning of pn533_recv_frame(), and release it when
pn533_wq_cmd_complete() is finished, thus ensuring that another work
will not start when one pn533_wq_cmd_complete() work is not yet finished.
Best regards,
Yuxuan
next prev parent reply other threads:[~2024-04-24 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 8:04 Yuxuan Hu
2024-04-24 5:36 ` Krzysztof Kozlowski
2024-04-24 14:00 ` Yuxuan-Hu [this message]
2024-04-24 18:13 ` Krzysztof Kozlowski
2024-04-24 5:38 ` Krzysztof Kozlowski
2024-04-24 6:06 ` Markus Elfring
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=fdc7ada8-6ca9-4835-982a-3e45ee7ac009@buaa.edu.cn \
--to=yuxuanhu@buaa.edu.cn \
--cc=20373622@buaa.edu.cn \
--cc=Jonathan.Cameron@huawei.com \
--cc=baijiaju1990@gmail.com \
--cc=davem@davemloft.net \
--cc=francesco.dolcini@toradex.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sy2239101@buaa.edu.cn \
--cc=u.kleine-koenig@pengutronix.de \
/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®