diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2007-08-22 23:01:51 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-23 04:52:46 +0200 |
commit | 59d9445e851976d973a5a4009f80a3d55959d231 (patch) | |
tree | 36eb5a8f9171fe410575ca996d63eb86abbac915 /drivers/w1/w1_int.c | |
parent | Fix VM_FAULT flags conversion for hugetlb (diff) | |
download | linux-59d9445e851976d973a5a4009f80a3d55959d231.tar.xz linux-59d9445e851976d973a5a4009f80a3d55959d231.zip |
w1: fix w1_remove_master_device() searching
In case bus master driver provided bogus value as its private data, search
can be incorrect. Problem found by Adrian Bunk.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/w1_int.c')
-rw-r--r-- | drivers/w1/w1_int.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 2fbd8dd16df5..6840dfebe4d4 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c @@ -170,22 +170,24 @@ void __w1_remove_master_device(struct w1_master *dev) void w1_remove_master_device(struct w1_bus_master *bm) { - struct w1_master *dev = NULL; + struct w1_master *dev, *found = NULL; list_for_each_entry(dev, &w1_masters, w1_master_entry) { if (!dev->initialized) continue; - if (dev->bus_master->data == bm->data) + if (dev->bus_master->data == bm->data) { + found = dev; break; + } } - if (!dev) { + if (!found) { printk(KERN_ERR "Device doesn't exist.\n"); return; } - __w1_remove_master_device(dev); + __w1_remove_master_device(found); } EXPORT_SYMBOL(w1_add_master_device); |