diff options
author | Alexander Nyberg <alexn@telia.com> | 2005-08-10 13:11:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-10 14:03:02 -0400 |
commit | 22d0def9d09111513f5a8d38583210620f97d710 (patch) | |
tree | b17c0fd6d98afc0af6920d18e096e7ab814189de | |
parent | c0438174e8272d23fe43a5d3f23d777f5b412e87 (diff) |
[PATCH] ns558 list handling fix
Need to use list_for_entry_safe(), as we're removing items during the
traversal. list_for_each_entry() uses the first ptr also as an iterator, if
you kfree() it slab takes it, might poison it and then you try to use it to
iterate to the next object in list.
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/input/gameport/ns558.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index 1ab5f2dc8a2a..70f051894a3c 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c | |||
@@ -275,9 +275,9 @@ static int __init ns558_init(void) | |||
275 | 275 | ||
276 | static void __exit ns558_exit(void) | 276 | static void __exit ns558_exit(void) |
277 | { | 277 | { |
278 | struct ns558 *ns558; | 278 | struct ns558 *ns558, *safe; |
279 | 279 | ||
280 | list_for_each_entry(ns558, &ns558_list, node) { | 280 | list_for_each_entry_safe(ns558, safe, &ns558_list, node) { |
281 | gameport_unregister_port(ns558->gameport); | 281 | gameport_unregister_port(ns558->gameport); |
282 | release_region(ns558->io & ~(ns558->size - 1), ns558->size); | 282 | release_region(ns558->io & ~(ns558->size - 1), ns558->size); |
283 | kfree(ns558); | 283 | kfree(ns558); |