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: <523A15F1.60306@redhat.com>
Date:	Wed, 18 Sep 2013 23:06:57 +0200
From:	Nikolay Aleksandrov <nikolay@...hat.com>
To:	David Miller <davem@...emloft.net>
CC:	netdev@...r.kernel.org
Subject: Re: [PATCH -net] netpoll: fix NULL pointer dereference in netpoll_cleanup

On 09/18/2013 06:15 PM, David Miller wrote:
> From: Nikolay Aleksandrov <nikolay@...hat.com>
> Date: Tue, 17 Sep 2013 16:12:35 +0200
> 
>> @@ -1284,15 +1284,15 @@ EXPORT_SYMBOL_GPL(__netpoll_free_async);
>>  
>>  void netpoll_cleanup(struct netpoll *np)
>>  {
>> -	if (!np->dev)
>> -		return;
>> -
>>  	rtnl_lock();
>> +	if (!np->dev) {
>> +		rtnl_unlock();
>> +		return;
>> +	}
>>  	__netpoll_cleanup(np);
>> -	rtnl_unlock();
>> -
>>  	dev_put(np->dev);
>>  	np->dev = NULL;
>> +	rtnl_unlock();
>>  }
>>  EXPORT_SYMBOL(netpoll_cleanup);
> 
> I know it seems arbitrary, but please do this like:
> 
> 	lock();
> 	if (condition) {
> 		...
> 	}
> 	unlock();
> 
> rather than having multiple return/unlock code paths.
> 
> This style I am suggesting is easier to audit for locking problems.
> 
> Thanks.
> 
Got it, I'll edit it and re-post.

Thanks,
 Nik
--
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