aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-09 21:48:36 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-02 09:47:07 -0500
commit7599b39d52b21cd13dcc53e395b459f826fb4728 (patch)
tree640513697af29776e9050eaecef69d10e5145abd /net
parentcbc0238c26e7a18eff2892ab9a24fa8eed5dc333 (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/x25/x25_link.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c
index 8954783597c..3f1816a6284 100644
--- a/net/x25/x25_link.c
+++ b/net/x25/x25_link.c
@@ -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);
}