Re: [BUG] A panic caused by null pointer dereference aftering updating to

From: David Miller
Date: Mon Apr 14 2014 - 15:22:38 EST


From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Date: Mon, 14 Apr 2014 12:06:36 -0700

> On Mon, 2014-04-14 at 14:48 -0400, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
>> Date: Mon, 14 Apr 2014 11:19:26 -0700
>>
>> > ip_local_out() doesn't use skb->sk
>>
>> It does Eric.
>>
>
> Hmmm, right...
>
>> We had just such a report with this in the backtrace, when AF_PACKET
>> sends over vxlan devices.
>>
>> The problem is ip_mc_output().
>
> So this means that : User socket wanted sk_mc_loop(sk), but because
> vxlan changed skb->sk to internal socket, we were doing something else
> anyway.

Actually the exact opposite is happening. vxlan does not override skb->sk,
and leaves it as AF_PACKET's socket. Then we crash in ip_mc_output() because
it only expects IP sockets, not AF_PACKET ones, attached to skb->sk.

> There are a lot of undocumented features here... like
>
> skb->priority = sk->sk_priority;
> skb->mark = sk->sk_mark;
>
> which socket do we want here (in ip_queue_xmit()) ?

Probably that of tunnel.

> Its interesting to see ip6_xmit() already has a 'struct sock *sk'
> parameter...
>
> This was the preliminary patch I tested :

You still need to make similar transformation to ip_local_out() as mentioned
above.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/