From 79ba049a6fc655dbd6eb22a1caa86dbf935dfb04 Mon Sep 17 00:00:00 2001 From: Mike Gerdts Date: Sat, 1 Jan 2022 10:19:59 -0600 Subject: [PATCH] thread: wrong_thread SEGV when NULL thread passed Signed-off-by: Mike Gerdts Change-Id: I7c121531eda9473b78c46332d6fdb1c8f71c88b7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11266 Reviewed-by: John Levon Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins --- lib/thread/thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index cd109c8a7..b1ebba01f 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -1586,6 +1586,10 @@ static void wrong_thread(const char *func, const char *name, struct spdk_thread *thread, struct spdk_thread *curthread) { + if (thread == NULL) { + SPDK_ERRLOG("%s(%s) called with NULL thread\n", func, name); + abort(); + } SPDK_ERRLOG("%s(%s) called from wrong thread %s:%" PRIu64 " (should be " "%s:%" PRIu64 ")\n", func, name, curthread->name, curthread->id, thread->name, thread->id);