From: duoming@zju.edu.cn
To: "Greg KH" <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, davem@davemloft.net,
kuba@kernel.org, alexander.deucher@amd.com, broonie@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback
Date: Mon, 6 Jun 2022 15:11:39 +0800 (GMT+08:00) [thread overview]
Message-ID: <6c014f68.52c9b.18137daddd9.Coremail.duoming@zju.edu.cn> (raw)
In-Reply-To: <Yp2T7xSM8YX7lX0/@kroah.com>
Hello,
On Mon, 6 Jun 2022 07:43:11 +0200 greg k-h wrote:
> On Fri, May 20, 2022 at 02:15:41PM +0800, Duoming Zhou wrote:
> > There are sleep in atomic context bugs when dm_fsync_timer_callback is
> > executing. The root cause is that the memory allocation functions with
> > GFP_KERNEL parameter are called in dm_fsync_timer_callback which is a
> > timer handler. The call paths that could trigger bugs are shown below:
> >
> > (interrupt context)
> > dm_fsync_timer_callback
> > write_nic_byte
> > kzalloc(sizeof(data), GFP_KERNEL); //may sleep
> > write_nic_dword
> > kzalloc(sizeof(data), GFP_KERNEL); //may sleep
> >
> > This patch changes allocation mode from GFP_KERNEL to GFP_ATOMIC
> > in order to prevent atomic context sleeping. The GFP_ATOMIC flag
> > makes memory allocation operation could be used in atomic context.
> >
> > Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
>
> What commit id does this fix?
Thanks for your time and reply!
The commit id this patch fix is 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging").
> And how did you find this issue? Did you run the code to verify it
> still works properly?
I find this issue by writing codeql query. I am trying to use usb raw-gadget to simulate
rtl8192u card in order to test this code.
What`s more, I found the usb_control_msg() with GFP_NOIO parameter in write_nic_byte()
and write_nic_dword() may also sleep. So I think use the delayed queue to replace timer
is better.
Best regards,
Duoming Zhou
next prev parent reply other threads:[~2022-06-06 7:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 6:15 Duoming Zhou
2022-06-06 5:43 ` Greg KH
2022-06-06 7:11 ` duoming [this message]
2022-06-07 11:01 ` Greg KH
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=6c014f68.52c9b.18137daddd9.Coremail.duoming@zju.edu.cn \
--to=duoming@zju.edu.cn \
--cc=alexander.deucher@amd.com \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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®