Commit 42d7c5c
Martin Belanger
libnvme: guard against NULL transport handle in discovery path
While stress testing with nvme-stas using repeated nvmet create/delete cycles,
a segmentation fault was observed during teardown when running nvme connect-all.
The crash occurs in nvme_get_log() due to a NULL hdl:
nvme_get_log(hdl=0x0, ...)
Root cause is that the return value of nvme_ctrl_get_transport_handle() is
not validated before use. Under certain conditions, a race can occur where
the udev-triggered [email protected] attempts to operate on a controller
(e.g. nvme1) that has already been removed.
Fix this by checking that the transport handle is non-NULL before issuing
commands that depend on it.
This prevents a potential SIGSEGV during discovery in transient device
removal scenarios.
Signed-off-by: Martin Belanger <[email protected]>1 parent 013f3a9 commit 42d7c5c
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1309 | 1309 | | |
1310 | 1310 | | |
1311 | 1311 | | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
1312 | 1318 | | |
1313 | 1319 | | |
1314 | 1320 | | |
| |||
0 commit comments