Skip to content

Commit 707be1f

Browse files
yoshfujidavem330
authored andcommitted
ipv6: Do not depend on rt->n in ip6_dst_lookup_tail().
Signed-off-by: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9bb5a14 commit 707be1f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/ipv6/ip6_output.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,12 @@ static int ip6_dst_lookup_tail(struct sock *sk,
913913
* dst entry of the nexthop router
914914
*/
915915
rt = (struct rt6_info *) *dst;
916-
n = rt->n;
917-
if (n && !(n->nud_state & NUD_VALID)) {
916+
rcu_read_lock_bh();
917+
n = __ipv6_neigh_lookup_noref(rt->dst.dev, rt6_nexthop(rt, &fl6->daddr));
918+
err = n && !(n->nud_state & NUD_VALID) ? -EINVAL : 0;
919+
rcu_read_unlock_bh();
920+
921+
if (err) {
918922
struct inet6_ifaddr *ifp;
919923
struct flowi6 fl_gw6;
920924
int redirect;

0 commit comments

Comments
 (0)