* [PATCH] crypto: crypto_user: Replace GFP_ATOMIC with GFP_KERNEL in crypto_report
@ 2018-01-25 10:06 Jia-Ju Bai
2018-02-15 15:43 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-01-25 10:06 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-crypto, linux-kernel, Jia-Ju Bai
After checking all possible call chains to crypto_report here,
my tool finds that crypto_report is never called in atomic context.
And crypto_report calls crypto_alg_match which calls down_read,
thus it proves again that crypto_report can call functions which may sleep.
Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL.
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
crypto/crypto_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 0dbe2be7..23baef1 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -271,7 +271,7 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh,
return -ENOENT;
err = -ENOMEM;
- skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
+ skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!skb)
goto drop_alg;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: crypto_user: Replace GFP_ATOMIC with GFP_KERNEL in crypto_report
2018-01-25 10:06 [PATCH] crypto: crypto_user: Replace GFP_ATOMIC with GFP_KERNEL in crypto_report Jia-Ju Bai
@ 2018-02-15 15:43 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-02-15 15:43 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: davem, linux-crypto, linux-kernel
On Thu, Jan 25, 2018 at 06:06:02PM +0800, Jia-Ju Bai wrote:
> After checking all possible call chains to crypto_report here,
> my tool finds that crypto_report is never called in atomic context.
> And crypto_report calls crypto_alg_match which calls down_read,
> thus it proves again that crypto_report can call functions which may sleep.
> Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL.
>
> This is found by a static analysis tool named DCNS written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-15 15:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 10:06 [PATCH] crypto: crypto_user: Replace GFP_ATOMIC with GFP_KERNEL in crypto_report Jia-Ju Bai
2018-02-15 15:43 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.