Commit 88318e0f authored by Tomas Henzl's avatar Tomas Henzl Committed by He Yujie
Browse files

scsi: megaraid_sas: Fix for a potential deadlock

stable inclusion
from stable-v6.6.69
commit f50783148ec98a1d38b87422e2ceaf2380b7b606
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBJC6H
CVE: CVE-2024-57807

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f50783148ec98a1d38b87422e2ceaf2380b7b606



--------------------------------

[ Upstream commit 50740f4dc78b41dec7c8e39772619d5ba841ddd7 ]

This fixes a 'possible circular locking dependency detected' warning
      CPU0                    CPU1
      ----                    ----
 lock(&instance->reset_mutex);
                              lock(&shost->scan_mutex);
                              lock(&instance->reset_mutex);
 lock(&shost->scan_mutex);

Fix this by temporarily releasing the reset_mutex.

Signed-off-by: default avatarTomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20240923174833.45345-1-thenzl@redhat.com


Acked-by: default avatarChandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarHe Yujie <coka.heyujie@huawei.com>
parent 97a32f07
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -8904,8 +8904,11 @@ megasas_aen_polling(struct work_struct *work)
						   (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL),
						   (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL),
						   0);
			if (sdev1)
			if (sdev1) {
				mutex_unlock(&instance->reset_mutex);
				megasas_remove_scsi_device(sdev1);
				mutex_lock(&instance->reset_mutex);
			}

			event_type = SCAN_VD_CHANNEL;
			break;