Commit 2ac5da3
scsi: mpt3sas: Fix a locking bug in an error path
JIRA: https://issues.redhat.com/browse/RHEL-81907
Call mutex_unlock(&ioc->hostdiag_unlock_mutex) once from error paths
instead of twice.
This patch fixes the following Clang -Wthread-safety errors:
drivers/scsi/mpt3sas/mpt3sas_base.c:8085:2: error: mutex 'ioc->hostdiag_unlock_mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
8085 | pci_cfg_access_unlock(ioc->pdev);
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8019:2: note: mutex acquired here
8019 | mutex_lock(&ioc->hostdiag_unlock_mutex);
| ^
./include/linux/mutex.h:171:26: note: expanded from macro 'mutex_lock'
171 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8085:2: error: mutex 'ioc->hostdiag_unlock_mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
8085 | pci_cfg_access_unlock(ioc->pdev);
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8019:2: note: mutex acquired here
8019 | mutex_lock(&ioc->hostdiag_unlock_mutex);
| ^
./include/linux/mutex.h:171:26: note: expanded from macro 'mutex_lock'
171 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8087:2: error: releasing mutex 'ioc->hostdiag_unlock_mutex' that was not held [-Werror,-Wthread-safety-analysis]
8087 | mutex_unlock(&ioc->hostdiag_unlock_mutex);
| ^
Cc: Ranjan Kumar <ranjan.kumar@broadcom.com>
Fixes: c076756 ("scsi: mpt3sas: Reload SBR without rebooting HBA")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250210203936.2946494-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 38afcf0)
Signed-off-by: Chandrakanth Patil <chanpati@redhat.com>1 parent 8949d3b commit 2ac5da3
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8018 | 8018 | | |
8019 | 8019 | | |
8020 | 8020 | | |
8021 | | - | |
| 8021 | + | |
8022 | 8022 | | |
8023 | 8023 | | |
8024 | 8024 | | |
| |||
8038 | 8038 | | |
8039 | 8039 | | |
8040 | 8040 | | |
8041 | | - | |
| 8041 | + | |
8042 | 8042 | | |
8043 | 8043 | | |
8044 | 8044 | | |
| |||
8074 | 8074 | | |
8075 | 8075 | | |
8076 | 8076 | | |
8077 | | - | |
| 8077 | + | |
8078 | 8078 | | |
8079 | 8079 | | |
8080 | 8080 | | |
8081 | 8081 | | |
8082 | 8082 | | |
8083 | 8083 | | |
8084 | | - | |
| 8084 | + | |
| 8085 | + | |
| 8086 | + | |
| 8087 | + | |
8085 | 8088 | | |
8086 | 8089 | | |
8087 | | - | |
8088 | 8090 | | |
8089 | 8091 | | |
8090 | 8092 | | |
| |||
0 commit comments