Commit 08422b58 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

bdev_virtio: fix use-after-free in scsi scan_ctx



Found while debugging issue #2596, unfortunately this
is not the root cause of that issue.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I27501e283ce7c9bf7a431e8b48842c83f80792c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14165


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
parent 29977e85
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -805,6 +805,11 @@ bdev_virtio_poll(void *arg)
		bdev_virtio_io_cpl(io[i]);
	}

	/* scan_ctx could have been freed while processing completions above, so
	 * we need to re-read the value again here into the local variable before
	 * using it.
	 */
	scan_ctx = svdev->scan_ctx;
	if (spdk_unlikely(scan_ctx && scan_ctx->needs_resend)) {
		if (svdev->removed) {
			_virtio_scsi_dev_scan_finish(scan_ctx, -EINTR);