Subject: Re: [PATCH 09/14] Phonet: allocate and initialize new sockets

From: Pavel Emelyanov <[email-masked]>
Date: Fri, 19 Sep 2008 14:14:08 +0400

Rémi Denis-Courmont wrote:
> 	Hello,
> 
> On Tuesday 16 September 2008 21:42:52 ext Pavel Emelyanov, you wrote:
>>> @@ -71,8 +73,22 @@ static int pn_socket_create(struct net *net, struct
>>> socket *sock, int protocol) goto out;
>>>  	}
>>>
>>> -	/* TODO: create and init the struct sock */
>>> -	err = -EPROTONOSUPPORT;
>>> +	sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot);
>>> +	if (sk == NULL) {
>>> +		err = -ENOMEM;
>>> +		goto out;
>>> +	}
>> This turns to be a little bit messy wrt net namespaces.
>> Look - you allow for sockets to be created (and isolated from each
>> other) in each namespace,
> 
> I expect pn_socket_create() should forbid this, no?

Well, to be honest, I'd prefer making this ns aware from the very
beginning, but not to force you make things you (probably) don't want
to, I will answer - yes, please, ban this protocol for !init_ns :)

>     if (net != &init_net)
>             return -EAFNOSUPPORT;
>     /* ... */
>     sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot);
> 
>> the list of devices is global,
> 
> Hmmm, good point. Should I forbid adding an address to devices outside the 
> initial namespace? what about a device with an existing address being 
> migrated?
> 
>> whilst the sysctls are visible in init_net only...
> 
> Regards,
>