Re: [PATCH 2/7] CAN: Add PF_CAN core module

Patrick McHardy
2007-09-22T11:01:17Z

Urs Thuermann wrote:
> Patrick McHardy <kaber@trash.net> writes:
>
>
>>You drop the module reference again when leaving this function.
>>So sock->ops might contain a stale pointer if the module is
>>unloaded after this. You need to either keep the module reference
>>while the socket is alive or remove stale references when
>>unregistering the protocol.
>
>
> I don't think that can happen. Before we drop the module reference we
> call sk_alloc() which gets another module reference via its cp->prot
> argument. If sk_alloc() fails we return with error from can_create()
> I assume sock->ops won't be used after that.

You're right, that should be enough.