Subject: Re: [PATCH] linux 2.9.10-rc1: Fix oops in unix_dgram_sendmsg when using SELinux and SOCK_SEQPACKET

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Fri, 19 Nov 2004 11:16:30 -0200

Arnaldo Carvalho de Melo wrote:
> 
> 
> Chris Wright wrote:
> 
>> * Ross Kendall Axe ([email-masked]) wrote:
>>
>>> Taking this idea further, couldn't we split unix_dgram_sendmsg into 2 
>>> functions, do_unix_dgram_sendmsg and do_unix_connectionless_sendmsg 
>>> (and similarly for unix_stream_sendmsg), then all we'd need is:
>>>
>>> <pseudocode>
>>> static int do_unix_dgram_sendmsg(...);
>>> static int do_unix_stream_sendmsg(...);
>>> static int do_unix_connectionless_sendmsg(...);
>>> static int do_unix_connectional_sendmsg(...);
>>
>>
>>
>> We could probably break it down to better functions and helpers, but I'm
>> not sure that's quite the breakdown.  That looks to me like an indirect
>> way to pass a flag which is already encoded in the ops and sk_type.
>> At anyrate, for 2.6.10 the changes should be small and obvious.
>> Better refactoring should be left for 2.6.11.
> 
> 
> Hey, go ahead, do the split and please, please use sk->sk_prot, that is
> the way to do the proper split and will allow us to nuke several
> pointers in struct sock (sk_slab, sk_owner for now) :-)
> 
> I have a friend doing this for X.25, will submit his patches as soon
> as we do some more testing and 2.6.10 is out.

Ah, this is the way the inet transport protos have been working for
years, and I've been factoring out the struct proto_ops methods from
TCP into the networking core, look at net/core/stream.c and the
sock_common_ prefixed functions in net/core/sock.c.

- Arnaldo