Patch "scsi: target: core: Fix error path in target_setup_session()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: target: core: Fix error path in target_setup_session()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-target-core-fix-error-path-in-target_setup_session.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 91271699228bfc66f1bc8abc0327169dc156d854 Mon Sep 17 00:00:00 2001
From: Bob Pearson <rpearsonhpe@xxxxxxxxx>
Date: Tue, 13 Jun 2023 09:43:00 -0500
Subject: scsi: target: core: Fix error path in target_setup_session()

From: Bob Pearson <rpearsonhpe@xxxxxxxxx>

commit 91271699228bfc66f1bc8abc0327169dc156d854 upstream.

In the error exits in target_setup_session(), if a branch is taken to
free_sess: transport_free_session() may call to target_free_cmd_counter()
and then fall through to call target_free_cmd_counter() a second time.
This can, and does, sometimes cause seg faults since the data field in
cmd_cnt->refcnt has been freed in the first call.

Fix this problem by simply returning after the call to
transport_free_session(). The second call is redundant for those cases.

Fixes: 4edba7e4a8f3 ("scsi: target: Move cmd counter allocation")
Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx>
Link: https://lore.kernel.org/r/20230613144259.12890-1-rpearsonhpe@xxxxxxxxx
Reviewed-by: Mike Christie <michael.christie@xxxxxxxxxx>
Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/target/target_core_transport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 86adff2a86ed..687adc9e086c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_group *tpg,
 
 free_sess:
 	transport_free_session(sess);
+	return ERR_PTR(rc);
+
 free_cnt:
 	target_free_cmd_counter(cmd_cnt);
 	return ERR_PTR(rc);
-- 
2.41.0



Patches currently in stable-queue which might be from rpearsonhpe@xxxxxxxxx are

queue-6.1/scsi-target-core-fix-error-path-in-target_setup_session.patch
queue-6.1/rdma-rxe-fix-packet-length-checks.patch
queue-6.1/rdma-rxe-fix-ref-count-error-in-check_rkey.patch
queue-6.1/rdma-rxe-removed-unused-name-from-rxe_task-struct.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux