]> www.infradead.org Git - users/willy/xarray.git/commit
mpls: drop skb's dst in mpls_forward()
authorGuillaume Nault <gnault@redhat.com>
Sat, 31 Oct 2020 00:07:25 +0000 (01:07 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Nov 2020 20:55:53 +0000 (12:55 -0800)
commit0992d67bc2bcd723d57c6ee7883bda4524450179
tree903f3d2bf87fd50a0bb247d5297435abfdb651e7
parent6d89076e6ef09337a29a7b1ea4fdf2d892be9650
mpls: drop skb's dst in mpls_forward()

Commit 394de110a733 ("net: Added pointer check for
dst->ops->neigh_lookup in dst_neigh_lookup_skb") added a test in
dst_neigh_lookup_skb() to avoid a NULL pointer dereference. The root
cause was the MPLS forwarding code, which doesn't call skb_dst_drop()
on incoming packets. That is, if the packet is received from a
collect_md device, it has a metadata_dst attached to it that doesn't
implement any dst_ops function.

To align the MPLS behaviour with IPv4 and IPv6, let's drop the dst in
mpls_forward(). This way, dst_neigh_lookup_skb() doesn't need to test
->neigh_lookup any more. Let's keep a WARN condition though, to
document the precondition and to ease detection of such problems in the
future.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/f8c2784c13faa54469a2aac339470b1049ca6b63.1604102750.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/dst.h
net/mpls/af_mpls.c