1 From: Suresh Siddha <suresh.b.siddha@intel.com>
2 Subject: dmar: use list_for_each_entry_safe() in dmar_dev_scope_init()
3 References: fate #303948 and fate #303984
4 Patch-Mainline: queued for .28
5 Commit-ID: 228324076234ca6a8cd34be89be78022773459f1
7 Signed-off-by: Thomas Renninger <trenn@suse.de>
9 In dmar_dev_scope_init(), functions called under for_each_drhd_unit()/
10 for_each_rmrr_units() can delete the list entry under some error conditions.
12 So we should use list_for_each_entry_safe() for safe traversal.
14 Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
15 Acked-by: Yinghai Lu <yhlu.kernel@gmail.com>
16 Signed-off-by: Ingo Molnar <mingo@elte.hu>
19 drivers/pci/dmar.c | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
22 Index: linux-2.6.26/drivers/pci/dmar.c
23 ===================================================================
24 --- linux-2.6.26.orig/drivers/pci/dmar.c
25 +++ linux-2.6.26/drivers/pci/dmar.c
26 @@ -373,10 +373,10 @@ dmar_find_matched_drhd_unit(struct pci_d
28 int __init dmar_dev_scope_init(void)
30 - struct dmar_drhd_unit *drhd;
31 + struct dmar_drhd_unit *drhd, *drhd_n;
34 - for_each_drhd_unit(drhd) {
35 + list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
36 ret = dmar_parse_dev(drhd);
39 @@ -384,8 +384,8 @@ int __init dmar_dev_scope_init(void)
43 - struct dmar_rmrr_unit *rmrr;
44 - for_each_rmrr_units(rmrr) {
45 + struct dmar_rmrr_unit *rmrr, *rmrr_n;
46 + list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
47 ret = rmrr_parse_dev(rmrr);