Commit 96642d42 authored by David S. Miller's avatar David S. Miller

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: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Tested-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ebc02e9c
...@@ -396,9 +396,12 @@ void __exit x25_link_free(void) ...@@ -396,9 +396,12 @@ void __exit x25_link_free(void)
write_lock_bh(&x25_neigh_list_lock); write_lock_bh(&x25_neigh_list_lock);
list_for_each_safe(entry, tmp, &x25_neigh_list) { list_for_each_safe(entry, tmp, &x25_neigh_list) {
struct net_device *dev;
nb = list_entry(entry, struct x25_neigh, node); nb = list_entry(entry, struct x25_neigh, node);
dev = nb->dev;
__x25_remove_neigh(nb); __x25_remove_neigh(nb);
dev_put(nb->dev); dev_put(dev);
} }
write_unlock_bh(&x25_neigh_list_lock); write_unlock_bh(&x25_neigh_list_lock);
} }
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