Commit 9eabad02 authored by Herbert Xu's avatar Herbert Xu Committed by Thomas Graf

[NET]: Add barriers for dst refcnt.

In light of the recent discussion about sk_buff, I think we need
the following patch for dst_entry.  This adds a memory barrier
before dst_release drops the refcnt, and a read memory barrier
before dst_destroy starts destroying the entry.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 09d3e84d
...@@ -147,6 +147,7 @@ void dst_release(struct dst_entry * dst) ...@@ -147,6 +147,7 @@ void dst_release(struct dst_entry * dst)
{ {
if (dst) { if (dst) {
WARN_ON(atomic_read(&dst->__refcnt) < 1); WARN_ON(atomic_read(&dst->__refcnt) < 1);
smp_mb__before_atomic_dec();
atomic_dec(&dst->__refcnt); atomic_dec(&dst->__refcnt);
} }
} }
......
...@@ -169,6 +169,8 @@ struct dst_entry *dst_destroy(struct dst_entry * dst) ...@@ -169,6 +169,8 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
struct neighbour *neigh; struct neighbour *neigh;
struct hh_cache *hh; struct hh_cache *hh;
smp_rmb();
again: again:
neigh = dst->neighbour; neigh = dst->neighbour;
hh = dst->hh; hh = dst->hh;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment