diff --git a/net/core/dst.c b/net/core/dst.c index 09c1530f46814d287929a37ce948885d44f8bb03..57bc4d5b8d084c053cded6ebddfe66bf6255d9f5 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -263,9 +263,11 @@ struct dst_entry *dst_destroy(struct dst_entry * dst) void dst_release(struct dst_entry *dst) { if (dst) { - WARN_ON(atomic_read(&dst->__refcnt) < 1); + int newrefcnt; + smp_mb__before_atomic_dec(); - atomic_dec(&dst->__refcnt); + newrefcnt = atomic_dec_return(&dst->__refcnt); + WARN_ON(newrefcnt < 0); } } EXPORT_SYMBOL(dst_release);