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]
Date:	Wed, 06 Apr 2011 16:39:03 +0200
From:	Oliver Hartkopp <socketcan@...tkopp.net>
To:	Kurt Van Dijck <kurt.van.dijck@....be>
CC:	David Miller <davem@...emloft.net>,
	Linux Netdev List <netdev@...r.kernel.org>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Urs Thuermann <urs@...ogud.escape.de>
Subject: Re: [PATCH net-next-2.6 v2] can: convert protocol handling to RCU

On 06.04.2011 11:27, Kurt Van Dijck wrote:
> On Tue, Apr 05, 2011 at 08:01:16PM +0200, Oliver Hartkopp wrote:

>>  
>> +static struct can_proto *can_try_module_get(int protocol)
>> +{
>> +	struct can_proto *cp;
>> +
>> +	rcu_read_lock();
>> +	cp = rcu_dereference(proto_tab[protocol]);
>> +	if (cp && !try_module_get(cp->prot->owner))
> After the xxx_get, is the 'cp' pointer persistent?

try_module_get() increases the usage counter of the module - therefore it is.
It is protected until module_put(cp->prot->owner) at the end of can_create() .

>>  	/* check for available protocol and correct usage */
>>  
>>  	if (!cp)
>>  		return -EPROTONOSUPPORT;
>>  
>>  	if (cp->type != sock->type) {
> I don't see how this will evaluate to true?
> can_proto_register takes care of it.

This check compares the type of the socket that is to be created with the type
that's defined for this protocol.

E.g. if you would give

s = socket(PF_CAN, SOCK_STREAM, CAN_RAW);

instead of the correct

s = socket(PF_CAN, SOCK_RAW, CAN_RAW);

you will get this error.

>> -		err = -EPROTONOSUPPORT;
>> +		err = -EPROTOTYPE;
>>  		goto errout;
>>  	}
>>  

Regards,
Oliver
--
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