From: David Ahern Date: Tue, 28 Mar 2017 22:19:49 +0000 (-0700) Subject: net: mpls: Update lfib_nlmsg_size to skip deleted nexthops X-Git-Tag: v4.12-rc1~108^2~291 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=e944e97afc66e619603390fc5f0c6bc02f961353;p=linux.git net: mpls: Update lfib_nlmsg_size to skip deleted nexthops A recent commit skips nexthops in a route if the device has been deleted. Update lfib_nlmsg_size accordingly. Reported-by: Roopa Prabhu Signed-off-by: David Ahern Acked-by: Roopa Prabhu Acked-by: Robert Shearman Signed-off-by: David S. Miller --- diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 673f3d990b5c..06ffafde70da 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -1880,6 +1880,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) size_t nhsize = 0; for_nexthops(rt) { + if (!rtnl_dereference(nh->nh_dev)) + continue; nhsize += nla_total_size(sizeof(struct rtnexthop)); /* RTA_VIA */ if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC)