diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-04-10 05:45:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-16 14:41:45 -0400 |
commit | e6b1ea773e0a6dd611278d0d6f81ea6ff9d6938b (patch) | |
tree | a8db6f2bccbb5de07024d11eb83ffcb8c0c48be4 | |
parent | d21bb45081484b95fb0c80f1afa492a7275689c2 (diff) |
Staging: unisys: use after free in list_for_each()
These should be using the _safe version of list_for_each() because we
free the current element and it leads to a use after free bug.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset.h | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset_main.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index d4bf203cdfdf..d95825dc5414 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h | |||
@@ -104,9 +104,9 @@ finddevice(struct list_head *list, U32 busNo, U32 devNo) | |||
104 | 104 | ||
105 | static inline void delbusdevices(struct list_head *list, U32 busNo) | 105 | static inline void delbusdevices(struct list_head *list, U32 busNo) |
106 | { | 106 | { |
107 | VISORCHIPSET_DEVICE_INFO *p; | 107 | VISORCHIPSET_DEVICE_INFO *p, *tmp; |
108 | 108 | ||
109 | list_for_each_entry(p, list, entry) { | 109 | list_for_each_entry_safe(p, tmp, list, entry) { |
110 | if (p->busNo == busNo) { | 110 | if (p->busNo == busNo) { |
111 | list_del(&p->entry); | 111 | list_del(&p->entry); |
112 | kfree(p); | 112 | kfree(p); |
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 257c6e59b460..c475e256e34b 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c | |||
@@ -605,16 +605,16 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); | |||
605 | static void | 605 | static void |
606 | cleanup_controlvm_structures(void) | 606 | cleanup_controlvm_structures(void) |
607 | { | 607 | { |
608 | VISORCHIPSET_BUS_INFO *bi; | 608 | VISORCHIPSET_BUS_INFO *bi, *tmp_bi; |
609 | VISORCHIPSET_DEVICE_INFO *di; | 609 | VISORCHIPSET_DEVICE_INFO *di, *tmp_di; |
610 | 610 | ||
611 | list_for_each_entry(bi, &BusInfoList, entry) { | 611 | list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { |
612 | busInfo_clear(bi); | 612 | busInfo_clear(bi); |
613 | list_del(&bi->entry); | 613 | list_del(&bi->entry); |
614 | kfree(bi); | 614 | kfree(bi); |
615 | } | 615 | } |
616 | 616 | ||
617 | list_for_each_entry(di, &DevInfoList, entry) { | 617 | list_for_each_entry_safe(di, tmp_di, &DevInfoList, entry) { |
618 | devInfo_clear(di); | 618 | devInfo_clear(di); |
619 | list_del(&di->entry); | 619 | list_del(&di->entry); |
620 | kfree(di); | 620 | kfree(di); |