mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-19 20:12:32 +00:00
x25: Do not reference freed memory.
commit 96642d42f076101ba98866363d908cab706d156c upstream. 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 <randy.dunlap@oracle.com> Tested-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
cbc0238c26
commit
7599b39d52
@ -391,9 +391,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…
x
Reference in New Issue
Block a user