diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-10 08:48:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-10 09:36:13 +0300 |
commit | 96642d42f076101ba98866363d908cab706d156c (patch) | |
tree | 07043558ca37f51e072cf32c0a3a7db05dd91ce7 /net/x25 | |
parent | ebc02e9c524e9ff377dd8a3820522d381adf19c8 (diff) | |
download | linux-96642d42f076101ba98866363d908cab706d156c.tar.xz |
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 <randy.dunlap@oracle.com>
Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/x25')
-rw-r--r-- | net/x25/x25_link.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 4cbc942f762a..21306928d47f 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -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); } |