mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
dmar: use list_for_each_entry_safe() in dmar_dev_scope_init()
In dmar_dev_scope_init(), functions called under for_each_drhd_unit()/ for_each_rmrr_units() can delete the list entry under some error conditions. So we should use list_for_each_entry_safe() for safe traversal. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Acked-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
74d04bd7dc
commit
04e2ea6706
@ -397,10 +397,10 @@ dmar_find_matched_drhd_unit(struct pci_dev *dev)
|
|||||||
|
|
||||||
int __init dmar_dev_scope_init(void)
|
int __init dmar_dev_scope_init(void)
|
||||||
{
|
{
|
||||||
struct dmar_drhd_unit *drhd;
|
struct dmar_drhd_unit *drhd, *drhd_n;
|
||||||
int ret = -ENODEV;
|
int ret = -ENODEV;
|
||||||
|
|
||||||
for_each_drhd_unit(drhd) {
|
list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
|
||||||
ret = dmar_parse_dev(drhd);
|
ret = dmar_parse_dev(drhd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -408,8 +408,8 @@ int __init dmar_dev_scope_init(void)
|
|||||||
|
|
||||||
#ifdef CONFIG_DMAR
|
#ifdef CONFIG_DMAR
|
||||||
{
|
{
|
||||||
struct dmar_rmrr_unit *rmrr;
|
struct dmar_rmrr_unit *rmrr, *rmrr_n;
|
||||||
for_each_rmrr_units(rmrr) {
|
list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
|
||||||
ret = rmrr_parse_dev(rmrr);
|
ret = rmrr_parse_dev(rmrr);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user