net: mpls: Update lfib_nlmsg_size to skip deleted nexthops
authorDavid Ahern <dsa@cumulusnetworks.com>
Tue, 28 Mar 2017 22:19:49 +0000 (15:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Mar 2017 17:42:38 +0000 (10:42 -0700)
A recent commit skips nexthops in a route if the device has been
deleted. Update lfib_nlmsg_size accordingly.

Reported-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mpls/af_mpls.c

index 673f3d990b5cf94e299975d5852be00cd05bad3d..06ffafde70da35729007695f63900a57c1615853 100644 (file)
@@ -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)