From b386a3a9a2a5443a038cdc7b4e88c6ac50539cf9 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 8 Nov 2019 07:17:18 +0900 Subject: [PATCH] lib/scsi: Assert if ref count of task goes negative We didn't have any check if ref count of SCSI task doesn't go negative. This addition will verify the idea to LUN hotplug issue by subsequent patches. Signed-off-by: Shuhei Matsumoto Signed-off-by: Ziye Yang Change-Id: I1d6ca9b9439bc7c4b701b65cc004cdf5cae16e91 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473585 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/scsi/task.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/scsi/task.c b/lib/scsi/task.c index d49deaa7f6..0058f642c3 100644 --- a/lib/scsi/task.c +++ b/lib/scsi/task.c @@ -47,6 +47,7 @@ spdk_scsi_task_put(struct spdk_scsi_task *task) return; } + assert(task->ref > 0); task->ref--; if (task->ref == 0) {