mirror of https://gitee.com/openkylin/linux.git
net: fix a race in dst_release()
Only cpu seeing dst refcount going to 0 can safely
dereference dst->flags.
Otherwise an other cpu might already have freed the dst.
Fixes: 27b75c95f1
("net: avoid RCU for NOCACHE dst")
Reported-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8c94ddbc13
commit
d69bbf88c8
|
@ -306,7 +306,7 @@ void dst_release(struct dst_entry *dst)
|
|||
if (unlikely(newrefcnt < 0))
|
||||
net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
|
||||
__func__, dst, newrefcnt);
|
||||
if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
|
||||
if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
|
||||
call_rcu(&dst->rcu_head, dst_destroy_rcu);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue