Commit 94d2276
PCI: hv: Fix a race condition when removing the device
On removing the device, any work item (hv_pci_devices_present() or
hv_pci_eject_device()) scheduled on workqueue hbus->wq may still be running
and race with hv_pci_remove().
This can happen because the host may send PCI_EJECT or PCI_BUS_RELATIONS(2)
and decide to rescind the channel immediately after that.
Fix this by flushing/destroying the workqueue of hbus before doing hbus remove.
Link: https://lore.kernel.org/r/1620806800-30983-1-git-send-email-longli@linuxonhyperv.com
Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>1 parent 6efb943 commit 94d2276
1 file changed
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | 447 | | |
449 | 448 | | |
450 | 449 | | |
| |||
3243 | 3242 | | |
3244 | 3243 | | |
3245 | 3244 | | |
3246 | | - | |
3247 | 3245 | | |
| 3246 | + | |
| 3247 | + | |
3248 | 3248 | | |
3249 | 3249 | | |
3250 | 3250 | | |
| |||
3256 | 3256 | | |
3257 | 3257 | | |
3258 | 3258 | | |
3259 | | - | |
3260 | | - | |
3261 | | - | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
3262 | 3269 | | |
3263 | 3270 | | |
3264 | 3271 | | |
| |||
3301 | 3308 | | |
3302 | 3309 | | |
3303 | 3310 | | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
3304 | 3322 | | |
3305 | 3323 | | |
3306 | 3324 | | |
3307 | 3325 | | |
3308 | 3326 | | |
3309 | 3327 | | |
3310 | | - | |
3311 | 3328 | | |
3312 | 3329 | | |
3313 | 3330 | | |
| |||
3322 | 3339 | | |
3323 | 3340 | | |
3324 | 3341 | | |
3325 | | - | |
3326 | 3342 | | |
3327 | 3343 | | |
3328 | 3344 | | |
| |||
0 commit comments