History

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.

Eric Dumazet committed 11 years ago

Commit d69bbf81 parent 8c94ddb1 file · +1 −1Browse files

Unified · Split

net/core/dst.c+1−1
@@ -306,7 +306,7 @@ void dst_release(struct dst_entry *dst) · 305 unmodified lines
306 if (unlikely(newrefcnt < 0))306 if (unlikely(newrefcnt < 0))
307 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",307 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
308 __func__, dst, newrefcnt);308 __func__, dst, newrefcnt);
309 if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)309 if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
310 call_rcu(&dst->rcu_head, dst_destroy_rcu);310 call_rcu(&dst->rcu_head, dst_destroy_rcu);
311 }311 }
312}312}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t