From 76f4b9cbdf4fd9c9f3a016607ee905b9dd04f1f0 Mon Sep 17 00:00:00 2001 From: Mike Gerdts Date: Tue, 17 Jan 2023 10:12:48 -0600 Subject: [PATCH] lvol: do not reference blob after closing it Once an lvol's blob is closed, the lvol should not retain a reference. Dereferencing lvol->blob could result in a use after free. Signed-off-by: Mike Gerdts Change-Id: Ia96a5a488fc96d642aa4cde83c6efa5cff88b068 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16426 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker --- lib/lvol/lvol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/lvol/lvol.c b/lib/lvol/lvol.c index ce7e887ab..62ade59a1 100644 --- a/lib/lvol/lvol.c +++ b/lib/lvol/lvol.c @@ -979,6 +979,7 @@ lvol_close_blob_cb(void *cb_arg, int lvolerrno) lvol->ref_count--; lvol->action_in_progress = false; + lvol->blob = NULL; SPDK_INFOLOG(lvol, "Lvol %s closed\n", lvol->unique_id); end: