eal: fix multi-process hotplug rollback
If a device fails to attach before it's plugged,
the subsequent rollback will still try to detach it,
causing a segfault. Unplugging a device that wasn't
plugged isn't really supported, so this patch adds
an extra error check to prevent that from happening.
While here, fix this also for normal (non-rollback)
detach, which could also theoretically segfault on
non-plugged device.
Fixes: 244d513071
("eal: enable hotplug on multi-process")
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
047e3f9f2a
commit
5d36bf2bcd
@ -264,6 +264,19 @@ static void __handle_primary_request(void *param)
|
|||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rte_dev_is_probed(dev)) {
|
||||||
|
if (req->t == EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK) {
|
||||||
|
/**
|
||||||
|
* Don't fail the rollback just because there's
|
||||||
|
* nothing to do.
|
||||||
|
*/
|
||||||
|
ret = 0;
|
||||||
|
} else
|
||||||
|
ret = -ENODEV;
|
||||||
|
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = local_dev_remove(dev);
|
ret = local_dev_remove(dev);
|
||||||
quit:
|
quit:
|
||||||
free(da->args);
|
free(da->args);
|
||||||
|
Loading…
Reference in New Issue
Block a user