On Wed, Apr 24, 2019 at 11:29:25AM -0700, Eric Dumazet wrote:
> On Wed, Apr 24, 2019 at 11:21 AM Guillaume Nault <gna...@redhat.com> wrote:
> 
> >
> > And then, we'd need to make sure that ->sk_user_data is in sync with
> > the encap_rcv() callback (or whatever actually uses the data pointed
> > to). Otherwise a module could treat ->sk_user_data as a struct foo
> > pointer while it actually points to a struct bar.
> >
> > For example, a quick look at net/sunrpc/svcsock.c seems to indicate
> > that svc_addsock() would accept any (unconnected) UDP socket and pass
> > it to svc_addsock(), which in turn would override ->sk_user_data with
> > a struct svc_sock pointer. If the socket was previously set up by L2TP,
> > then we'd end up with ->sk_user_data pointing to a svc_sock structure,
> > but ->encap_rcv still pointing to l2tp_udp_encap_recv(). That's going
> > to give unexpected results when l2tp_udp_encap_recv() will dereference
> > ->sk_user_data to access (what it believes to be) its tunnel structure.
> 
> A full audit is needed, and I have started it. If you want to help
> just send a patch ;)
> 
> I have looked at this l2tp code only after fixing another issue in
> RXRPC, and would have
> looked later at SUNRPC.

Hum, sorry, I didn't realise that. I'm really interested in the
solutions you can come up with.

Reply via email to