LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create
@ 2018-04-10 8:31 Jia-Ju Bai
2018-04-11 11:09 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2018-04-10 8:31 UTC (permalink / raw)
To: jikos, dsterba, gregkh, jslaby, johannes.berg, stephen, davem
Cc: linux-kernel, Jia-Ju Bai
ipwireless_network_create() is never called in atomic context.
The call chain ending up at ipwireless_network_create() is:
[1] ipwireless_network_create() <- config_ipwireless() <-
ipwireless_attach()
ipwireless_attach() is only set as ".probe" in struct pcmcia_driver.
Despite never getting called from atomic context,
ipwireless_network_create() calls kzalloc() with GFP_ATOMIC,
which does not sleep for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
which can sleep and improve the possibility of sucessful allocation.
This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
---
drivers/tty/ipwireless/network.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c
index c2f9a32..17b04b5 100644
--- a/drivers/tty/ipwireless/network.c
+++ b/drivers/tty/ipwireless/network.c
@@ -415,7 +415,7 @@ void ipwireless_network_packet_received(struct ipw_network *network,
struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw)
{
struct ipw_network *network =
- kzalloc(sizeof(struct ipw_network), GFP_ATOMIC);
+ kzalloc(sizeof(struct ipw_network), GFP_KERNEL);
if (!network)
return NULL;
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create
2018-04-10 8:31 [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create Jia-Ju Bai
@ 2018-04-11 11:09 ` David Sterba
2018-04-11 12:11 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2018-04-11 11:09 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: davem, johannes.berg, jikos, gregkh, stephen, Jiri Slaby, linux-kernel
On Tue, Apr 10, 2018 at 04:31:46PM +0800, Jia-Ju Bai wrote:
> ipwireless_network_create() is never called in atomic context.
>
> The call chain ending up at ipwireless_network_create() is:
> [1] ipwireless_network_create() <- config_ipwireless() <-
> ipwireless_attach()
> ipwireless_attach() is only set as ".probe" in struct pcmcia_driver.
>
> Despite never getting called from atomic context,
> ipwireless_network_create() calls kzalloc() with GFP_ATOMIC,
> which does not sleep for allocation.
> GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
> which can sleep and improve the possibility of sucessful allocation.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
We don't have any other patches queued for this driver so it would be
best if this patch goes via net or Greg's tree.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create
2018-04-11 11:09 ` David Sterba
@ 2018-04-11 12:11 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-04-11 12:11 UTC (permalink / raw)
To: dsterba, Jia-Ju Bai, davem, johannes.berg, jikos, stephen,
Jiri Slaby, linux-kernel
On Wed, Apr 11, 2018 at 01:09:45PM +0200, David Sterba wrote:
> On Tue, Apr 10, 2018 at 04:31:46PM +0800, Jia-Ju Bai wrote:
> > ipwireless_network_create() is never called in atomic context.
> >
> > The call chain ending up at ipwireless_network_create() is:
> > [1] ipwireless_network_create() <- config_ipwireless() <-
> > ipwireless_attach()
> > ipwireless_attach() is only set as ".probe" in struct pcmcia_driver.
> >
> > Despite never getting called from atomic context,
> > ipwireless_network_create() calls kzalloc() with GFP_ATOMIC,
> > which does not sleep for allocation.
> > GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
> > which can sleep and improve the possibility of sucessful allocation.
> >
> > This is found by a static analysis tool named DCNS written by myself.
> > And I also manually check it.
> >
> > Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
>
> Reviewed-by: David Sterba <dsterba@suse.com>
>
> We don't have any other patches queued for this driver so it would be
> best if this patch goes via net or Greg's tree.
I can take it, after 4.17-rc1 is out, thanks!
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-11 12:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 8:31 [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create Jia-Ju Bai
2018-04-11 11:09 ` David Sterba
2018-04-11 12:11 ` Greg KH
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).