mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
x25: Do not reference freed memory.
In x25_link_free(), we destroy 'nb' before dereferencing 'nb->dev'. Don't do this, because 'nb' might be freed by then. Reported-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
ebc02e9c52
commit
96642d42f0
1 changed files with 4 additions and 1 deletions
|
|
@ -396,9 +396,12 @@ void __exit x25_link_free(void)
|
|||
write_lock_bh(&x25_neigh_list_lock);
|
||||
|
||||
list_for_each_safe(entry, tmp, &x25_neigh_list) {
|
||||
struct net_device *dev;
|
||||
|
||||
nb = list_entry(entry, struct x25_neigh, node);
|
||||
dev = nb->dev;
|
||||
__x25_remove_neigh(nb);
|
||||
dev_put(nb->dev);
|
||||
dev_put(dev);
|
||||
}
|
||||
write_unlock_bh(&x25_neigh_list_lock);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue