mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
net: print proper warning on dst underflow
Proper warnings with stack traces make it much easier to figure out what's doing the double free and create more meaningful bug reports from users. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3e8b9bfa11
commit
adecda5bee
@ -172,7 +172,7 @@ void dst_release(struct dst_entry *dst)
|
|||||||
int newrefcnt;
|
int newrefcnt;
|
||||||
|
|
||||||
newrefcnt = atomic_dec_return(&dst->__refcnt);
|
newrefcnt = atomic_dec_return(&dst->__refcnt);
|
||||||
if (unlikely(newrefcnt < 0))
|
if (WARN_ONCE(newrefcnt < 0, "dst_release underflow"))
|
||||||
net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
|
net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
|
||||||
__func__, dst, newrefcnt);
|
__func__, dst, newrefcnt);
|
||||||
if (!newrefcnt)
|
if (!newrefcnt)
|
||||||
@ -187,7 +187,7 @@ void dst_release_immediate(struct dst_entry *dst)
|
|||||||
int newrefcnt;
|
int newrefcnt;
|
||||||
|
|
||||||
newrefcnt = atomic_dec_return(&dst->__refcnt);
|
newrefcnt = atomic_dec_return(&dst->__refcnt);
|
||||||
if (unlikely(newrefcnt < 0))
|
if (WARN_ONCE(newrefcnt < 0, "dst_release_immediate underflow"))
|
||||||
net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
|
net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
|
||||||
__func__, dst, newrefcnt);
|
__func__, dst, newrefcnt);
|
||||||
if (!newrefcnt)
|
if (!newrefcnt)
|
||||||
|
Loading…
Reference in New Issue
Block a user