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 @@ -3259,17 +3259,24 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs)
32593259 return 0 ;
32603260
32613261 if (!keep_devs ) {
3262- /* Delete any children which might still exist. */
3262+ struct list_head removed ;
3263+
3264+ /* Move all present children to the list on stack */
3265+ INIT_LIST_HEAD (& removed );
32633266 spin_lock_irqsave (& hbus -> device_list_lock , flags );
3264- list_for_each_entry_safe (hpdev , tmp , & hbus -> children , list_entry ) {
3267+ list_for_each_entry_safe (hpdev , tmp , & hbus -> children , list_entry )
3268+ list_move_tail (& hpdev -> list_entry , & removed );
3269+ spin_unlock_irqrestore (& hbus -> device_list_lock , flags );
3270+
3271+ /* Remove all children in the list */
3272+ list_for_each_entry_safe (hpdev , tmp , & removed , list_entry ) {
32653273 list_del (& hpdev -> list_entry );
32663274 if (hpdev -> pci_slot )
32673275 pci_destroy_slot (hpdev -> pci_slot );
32683276 /* For the two refs got in new_pcichild_device() */
32693277 put_pcichild (hpdev );
32703278 put_pcichild (hpdev );
32713279 }
3272- spin_unlock_irqrestore (& hbus -> device_list_lock , flags );
32733280 }
32743281
32753282 ret = hv_send_resources_released (hdev );
You can’t perform that action at this time.
0 commit comments