Skip to content

Commit b495629

Browse files
committed
ioct: avoid segfault for list & list-subsys commands
Below segfault seen in nvme_submit_passthru64() while running list and list-subsys commands: scan controller nvme0 lookup subsystem /sys/class/nvme-subsystem/nvme-subsys0/nvme0 scan controller nvme0 path nvme0c0n1 failed to scan ctrl nvme0: Success scan subsystem nvme-subsys0 scan subsystem nvme-subsys0 namespace nvme0n1 Segmentation fault (core dumped) This is due to an invalid dereferencing of the nvme_transport_handle structure content at hdl->ctx->dry_run. Fix the same. Signed-off-by: Martin George <marting@netapp.com>
1 parent a138f6e commit b495629

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libnvme/src/nvme/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int nvme_submit_passthru64(struct nvme_transport_handle *hdl,
156156
int err = 0;
157157

158158
user_data = hdl->submit_entry(hdl, cmd);
159-
if (hdl->ctx->dry_run)
159+
if (hdl->ctx && hdl->ctx->dry_run)
160160
goto out;
161161

162162
do {

0 commit comments

Comments
 (0)