Commit 1fffa905adffbf0d3767fc978ef09afb830275eb
Committed by
John W. Linville
1 parent
d4fa14cd62
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
bcma: fix unregistration of cores
When cores are unregistered, entries need to be removed from cores list in a safe manner. Reported-by: Stanislaw Gruszka <sgruszka@redhat.com> Reviewed-by: Arend Van Spriel <arend@broadcom.com> Signed-off-by: Piotr Haber <phaber@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
drivers/bcma/main.c
... | ... | @@ -158,9 +158,10 @@ |
158 | 158 | |
159 | 159 | static void bcma_unregister_cores(struct bcma_bus *bus) |
160 | 160 | { |
161 | - struct bcma_device *core; | |
161 | + struct bcma_device *core, *tmp; | |
162 | 162 | |
163 | - list_for_each_entry(core, &bus->cores, list) { | |
163 | + list_for_each_entry_safe(core, tmp, &bus->cores, list) { | |
164 | + list_del(&core->list); | |
164 | 165 | if (core->dev_registered) |
165 | 166 | device_unregister(&core->dev); |
166 | 167 | } |