File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3229,17 +3229,24 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs)
3229
3229
return 0 ;
3230
3230
3231
3231
if (!keep_devs ) {
3232
- /* Delete any children which might still exist. */
3232
+ struct list_head removed ;
3233
+
3234
+ /* Move all present children to the list on stack */
3235
+ INIT_LIST_HEAD (& removed );
3233
3236
spin_lock_irqsave (& hbus -> device_list_lock , flags );
3234
- list_for_each_entry_safe (hpdev , tmp , & hbus -> children , list_entry ) {
3237
+ list_for_each_entry_safe (hpdev , tmp , & hbus -> children , list_entry )
3238
+ list_move_tail (& hpdev -> list_entry , & removed );
3239
+ spin_unlock_irqrestore (& hbus -> device_list_lock , flags );
3240
+
3241
+ /* Remove all children in the list */
3242
+ list_for_each_entry_safe (hpdev , tmp , & removed , list_entry ) {
3235
3243
list_del (& hpdev -> list_entry );
3236
3244
if (hpdev -> pci_slot )
3237
3245
pci_destroy_slot (hpdev -> pci_slot );
3238
3246
/* For the two refs got in new_pcichild_device() */
3239
3247
put_pcichild (hpdev );
3240
3248
put_pcichild (hpdev );
3241
3249
}
3242
- spin_unlock_irqrestore (& hbus -> device_list_lock , flags );
3243
3250
}
3244
3251
3245
3252
ret = hv_send_resources_released (hdev );
You can’t perform that action at this time.
0 commit comments