lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140304.164014.2134736768960109055.davem@davemloft.net>
Date:	Tue, 04 Mar 2014 16:40:14 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	David.Laight@...LAB.COM
Cc:	nikolay@...hat.com, netdev@...r.kernel.org, davej@...hat.com,
	steffen.klassert@...unet.com, fan.du@...driver.com
Subject: Re: [PATCH 1/2] net: af_key: fix sleeping under rcu

From: David Laight <David.Laight@...LAB.COM>
Date: Tue, 4 Mar 2014 12:46:48 +0000

> From: Nikolay Aleksandrov
>> 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.
> ...
>> @@ -3239,7 +3240,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
>>  		}
>>  		if ((*dir = verify_sec_ctx_len(p)))
>>  			goto out;
>> -		uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx);
>> +		uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_ATOMIC);
>>  		*dir = security_xfrm_policy_alloc(&xp->security, uctx);
>>  		kfree(uctx);
> 
> This looks like the only one that isn't passed GFP_KERNEL.
> It looks as though it is missing the check for the allocation failing
> (there might be a check inside security_xfrm_policy_alloc()).
> 
> In any case it looks as though this ought to be codeable without
> the allocation of 'uctx' - since it is freed a line later.

Unfortunately, it is not possible to avoid allocations.  The uctx is
of a variable size, because it is a base struct, with a variable
length part afterwards.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ