ipv4: remove BUG_ON() from fib_compute_spec_dst
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 ipv4: remove BUG_ON() from fib_compute_spec_dst
Remove BUG_ON() from fib_compute_spec_dst routine and check in_dev pointer during flowi4 data structure initialization. fib_compute_spec_dst routine can be run concurrently with device removal where ip_ptr net_device pointer is set to NULL. This can happen if userspace enables pkt info on UDP rx socket and the device is removed while traffic is flowing
--- net/ipv4/fib_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_frontend.c +2 -2
@@ -292,19 +292,19 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)return ip_hdr (skb)->daddr; in_dev =__in_dev_get_rcu (dev); -BUG_ON (!in_dev); net =dev_net (dev); scope =RT_SCOPE_UNIVERSE ;if (!ipv4_is_zeronet (ip_hdr (skb)->saddr)) { +bool vmark = in_dev &&IN_DEV_SRC_VMARK (in_dev);struct flowi4 fl4 = { .flowi4_iif =LOOPBACK_IFINDEX , .flowi4_oif =l3mdev_master_ifindex_rcu (dev), .daddr =ip_hdr (skb)->saddr, .flowi4_tos =RT_TOS (ip_hdr (skb)->tos), .flowi4_scope = scope, - .flowi4_mark =IN_DEV_SRC_VMARK (in_dev) ? skb->mark :0 , + .flowi4_mark = vmark ? skb->mark :0 , };if (!fib_lookup (net, &fl4, &res,0 ))return FIB_RES_PREFSRC (net, res);
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Lorenzo Bianconi <[email protected]>
Date: Fri, 27 Jul 2018 18:15:46 +0200
Quoted 9 lines
Remove
BUG_ON()fromfib_compute_spec_dstroutine and checkin_devpointer during flowi4 data structure initialization.fib_compute_spec_dstroutine can be run concurrently with device removal whereip_ptrnet_devicepointer is set to NULL. This can happen if userspace enables pkt info on UDP rx socket and the device is removed while traffic is flowingFixes 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper")Signed-off-by Lorenzo Bianconi <[email protected]>
Applied and queued up for -stable, thank you.