Skip to content

Commit 8838a60

Browse files
Chandrakanth Patilroot
authored andcommitted
scsi: mpi3mr: Fix locking in an error path
JIRA: https://issues.redhat.com/browse/RHEL-80698 Make all error paths unlock rioc->bsg_cmds.mutex. This patch fixes the following Clang -Wthread-safety errors: drivers/scsi/mpi3mr/mpi3mr_app.c:2835:1: error: mutex 'mrioc->bsg_cmds.mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis] 2835 | } | ^ drivers/scsi/mpi3mr/mpi3mr_app.c:2332:6: note: mutex acquired here 2332 | if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex)) | ^ ./include/linux/mutex.h:172:40: note: expanded from macro 'mutex_lock_interruptible' 172 | #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) | ^ Cc: Sathya Prakash <sathya.prakash@broadcom.com> Fixes: fb231d7 ("scsi: mpi3mr: Support for preallocation of SGL BSG data buffers part-2") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20250210203936.2946494-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit c733741) Signed-off-by: Chandrakanth Patil <chanpati@redhat.com>
1 parent ebec6ce commit 8838a60

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
24252425
}
24262426

24272427
if (!mrioc->ioctl_sges_allocated) {
2428+
mutex_unlock(&mrioc->bsg_cmds.mutex);
24282429
dprint_bsg_err(mrioc, "%s: DMA memory was not allocated\n",
24292430
__func__);
24302431
return -ENOMEM;

0 commit comments

Comments
 (0)