[lvc-project] [PATCH] drivers: nvme: target: core: deref after null
    Alexandr Sapozhnikov 
    ncr at securitycode.ru
       
    Fri Jun  7 16:38:34 MSK 2024
    
    
  
From: Alexandr Sapozhnikov <alsp705 at gmail.com>
After having been compared to a NULL value at core.c:813, 
pointer '(**sq->ctrl).sqs' is dereferenced at core.c:838.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexandr Sapozhnikov <alsp705 at gmail.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 06f0c587f343..5a67d2bc0c55 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -827,7 +827,7 @@ void nvmet_sq_destroy(struct nvmet_sq *sq)
 	 */
 	ctrl = sq->ctrl;
 
-	if (ctrl) {
+	if (ctrl && ctrl->sqs) {
 		/*
 		 * The teardown flow may take some time, and the host may not
 		 * send us keep-alive during this period, hence reset the
-- 
2.39.2
    
    
More information about the lvc-project
mailing list