diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d98cf41edf2a0632fcd779d2530249b185d07d7b..4bf362baa97aac4aed43b30fd660ac038a327610 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1089,8 +1089,10 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, neigh_hold(neigh); else { neigh = __neigh_lookup_errno(&nd_tbl, &fl6->daddr, dev); - if (IS_ERR(neigh)) - neigh = NULL; + if (IS_ERR(neigh)) { + dst_free(&rt->dst); + return ERR_CAST(neigh); + } } rt->dst.flags |= DST_HOST;