Subject: Re: Possible fix

From: Nikolay Aleksandrov <[email-masked]>
Date: Thu, 27 Feb 2014 17:24:30 +0100

On 02/27/2014 05:17 PM, Nikolay Aleksandrov wrote:
> Hi,
> I'm not familiar with the code but happened to see the bug, could you
> try the following patch, I believe it should fix the issue.
> 
> Thanks,
>  Nik
> 
> [PATCH net] net: af_key: fix sleeping under rcu
> 
> There's a kmalloc with GFP_KERNEL in a helper
> (pfkey_sadb2xfrm_user_sec_ctx) used in pfkey_compile_policy which is
> called under rcu_read_lock. Adjust pfkey_sadb2xfrm_user_sec_ctx to have
> a gfp argument and adjust the users.
> 
> CC: Dave Jones <[email-masked]>
> CC: Steffen Klassert <[email-masked]>
> CC: Fan Du <[email-masked]>
> CC: David S. Miller <[email-masked]>
> 
> Signed-off-by: Nikolay Aleksandrov <[email-masked]>
> ---
> I'm not familiar with this code, but just happen to see the bug. I believe
> this patch should take care of it.
> I've left the already very long lines.
> 
Actually there isn't a check if uctx is NULL upon return which can happen.
This is only a test patch and that check should be added as well.

Nik