linux-stable/drivers/target
Bob Pearson 9127169922 scsi: target: core: Fix error path in target_setup_session()
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: 4edba7e4a8 ("scsi: target: Move cmd counter allocation")
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Link: https://lore.kernel.org/r/20230613144259.12890-1-rpearsonhpe@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-06-14 21:54:35 -04:00
..
iscsi scsi: target: iscsi: Prevent login threads from racing between each other 2023-05-22 16:29:39 -04:00
loopback scsi: target: tcm_loop: Remove redundant driver match function 2023-03-24 20:44:14 -04:00
sbp scsi: target: sbp: Remove default fabric ops callouts 2023-03-16 23:36:36 -04:00
tcm_fc scsi: target: fcoe: Remove default fabric ops callouts 2023-03-16 23:36:36 -04:00
tcm_remote scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
Kconfig scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
Makefile scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
target_core_alua.c scsi: target: core: Use RTPI from target port 2023-03-09 21:29:23 -05:00
target_core_alua.h
target_core_configfs.c scsi: target: Add default fabric ops callouts 2023-03-16 23:36:35 -04:00
target_core_device.c Merge patch series "target: TMF and recovery fixes" 2023-03-24 17:39:15 -04:00
target_core_fabric_configfs.c scsi: target: core: Fix invalid memory access 2023-04-11 20:49:43 -04:00
target_core_fabric_lib.c
target_core_file.c target: use bvec_set_page to initialize bvecs 2023-02-03 08:20:55 -07:00
target_core_file.h
target_core_hba.c
target_core_iblock.c SCSI misc on 20221213 2022-12-14 08:58:51 -08:00
target_core_iblock.h
target_core_internal.h Merge patch series "target: TMF and recovery fixes" 2023-03-24 17:39:15 -04:00
target_core_pr.c scsi: target: core: Use RTPI from target port 2023-03-09 21:29:23 -05:00
target_core_pr.h
target_core_pscsi.c scsi: target: target_core_pscsi: Convert to scsi_execute_cmd() 2023-01-13 21:34:09 -05:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target: core: Fix hard lockup when executing a compare-and-write command 2022-11-24 03:22:58 +00:00
target_core_spc.c scsi: target: core: Remove unused 'prod_len' variable 2023-04-02 21:35:52 -04:00
target_core_stat.c scsi: target: core: Use RTPI from target port 2023-03-09 21:29:23 -05:00
target_core_tmr.c scsi: target: Fix multiple LUN_RESET handling 2023-03-24 17:32:23 -04:00
target_core_tpg.c Merge patch series "target: TMF and recovery fixes" 2023-03-24 17:39:15 -04:00
target_core_transport.c scsi: target: core: Fix error path in target_setup_session() 2023-06-14 21:54:35 -04:00
target_core_ua.c
target_core_ua.h
target_core_user.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
target_core_xcopy.c scsi: target: Pass in cmd counter to use during cmd setup 2023-03-24 17:32:23 -04:00
target_core_xcopy.h scsi: target: core: Change the way target_xcopy_do_work() sets restiction on max I/O 2022-11-24 02:16:19 +00:00