From: Greg KH <gregkh@linuxfoundation.org>
To: Kalle Valo <kvalo@kernel.org>
Cc: duoming@zju.edu.cn, linux-wireless@vger.kernel.org,
amitkarwar@gmail.com, ganapathi017@gmail.com,
sharvari.harisangam@nxp.com, huxinming820@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, rafael@kernel.org,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH v3] mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv
Date: Mon, 23 May 2022 15:41:37 +0200 [thread overview]
Message-ID: <YouPEdlNbU2ea1Cx@kroah.com> (raw)
In-Reply-To: <87r14kzdqz.fsf@kernel.org>
On Mon, May 23, 2022 at 02:31:48PM +0300, Kalle Valo wrote:
> (adding Johannes)
>
> duoming@zju.edu.cn writes:
>
> >> > --- a/lib/kobject.c
> >> > +++ b/lib/kobject.c
> >> > @@ -254,7 +254,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
> >> > if (kobj->name && !fmt)
> >> > return 0;
> >> >
> >> > - s = kvasprintf_const(GFP_KERNEL, fmt, vargs);
> >> > + s = kvasprintf_const(GFP_ATOMIC, fmt, vargs);
> >> > if (!s)
> >> > return -ENOMEM;
> >> >
> >> > @@ -267,7 +267,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
> >> > if (strchr(s, '/')) {
> >> > char *t;
> >> >
> >> > - t = kstrdup(s, GFP_KERNEL);
> >> > + t = kstrdup(s, GFP_ATOMIC);
> >> > kfree_const(s);
> >> > if (!t)
> >> > return -ENOMEM;
> >>
> >> Please no, you are hurting the whole kernel because of one odd user.
> >> Please do not make these calls under atomic context.
> >
> > Thanks for your time and suggestions. I will remove the gfp_t
> > parameter of dev_coredumpv in order to show it could not be used in
> > atomic context.
>
> In a way it would be nice to be able to call dev_coredump from atomic
> contexts, though I don't know how practical it actually is.
Dumping core information from atomic context feels very very wrong to
me.
Why not just not do that?
> Is there any other option? What about adding a gfp_t parameter to
> dev_set_name()? Or is there an alternative for dev_set_name() which
> can be called in atomic contexts?
dev_set_name() should not be called in atomic context as that implies
you are doing a very slow operation with locks disabled, not a good
thing at all.
thanks,
greg k-h
next prev parent reply other threads:[~2022-05-23 13:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 5:28 [PATCH v3] mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv Duoming Zhou
2022-05-23 6:31 ` Greg KH
[not found] ` <41a266af.2abb6.180efa8594d.Coremail.duoming@zju.edu.cn>
2022-05-23 11:31 ` Kalle Valo
2022-05-23 13:41 ` Greg KH [this message]
2022-05-23 16:27 ` Kalle Valo
2022-05-23 13:43 ` Johannes Berg
2022-05-23 14:20 ` Eric W. Biederman
2022-05-23 15:58 ` duoming
2022-05-23 16:31 ` Kalle Valo
2022-05-24 2:08 ` duoming
2022-05-23 19:42 ` Brian Norris
2022-05-24 1:54 ` duoming
2022-05-23 17:55 ` Brian Norris
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=YouPEdlNbU2ea1Cx@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=amitkarwar@gmail.com \
--cc=davem@davemloft.net \
--cc=duoming@zju.edu.cn \
--cc=edumazet@google.com \
--cc=ganapathi017@gmail.com \
--cc=huxinming820@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@kernel.org \
--cc=sharvari.harisangam@nxp.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;
as well as URLs for NNTP newsgroup(s).