All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
       [not found] <20241211183908.3808070-1-sashal@kernel.org>
@ 2024-12-11 19:09 ` Thomas Gleixner
  2024-12-12  6:57   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2024-12-11 19:09 UTC (permalink / raw)
  To: stable, stable-commits
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Manivannan Sadhasivam


From: Manivannan Sadhasivam <mani@kernel.org>

commit 64506b3d23a337e98a74b18dcb10c8619365f2bd upstream.

Otherwise, it will result in a NULL pointer dereference as below:

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
Call trace:
 mutex_lock+0xc/0x54
 platform_device_msi_free_irqs_all+0x14/0x20
 ufs_qcom_remove+0x34/0x48 [ufs_qcom]
 platform_remove+0x28/0x44
 device_remove+0x4c/0x80
 device_release_driver_internal+0xd8/0x178
 driver_detach+0x50/0x9c
 bus_remove_driver+0x6c/0xbc
 driver_unregister+0x30/0x60
 platform_driver_unregister+0x14/0x20
 ufs_qcom_pltform_exit+0x18/0xb94 [ufs_qcom]
 __arm64_sys_delete_module+0x180/0x260
 invoke_syscall+0x44/0x100
 el0_svc_common.constprop.0+0xc0/0xe0
 do_el0_svc+0x1c/0x28
 el0_svc+0x34/0xdc
 el0t_64_sync_handler+0xc0/0xc4
 el0t_64_sync+0x190/0x194

Cc: stable@vger.kernel.org # 6.3
Fixes: 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241111-ufs_bug_fix-v1-2-45ad8b62f02e@linaro.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/ufs/host/ufs-qcom.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1926,7 +1926,8 @@ static int ufs_qcom_remove(struct platfo
 
 	pm_runtime_get_sync(&(pdev)->dev);
 	ufshcd_remove(hba);
-	platform_msi_domain_free_irqs(hba->dev);
+	if (host->esi_enabled)
+		platform_msi_domain_free_irqs(hba->dev);
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
  2024-12-11 19:09 ` Thomas Gleixner
@ 2024-12-12  6:57   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-12  6:57 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: stable, stable-commits, Rafael J. Wysocki, Manivannan Sadhasivam

On Wed, Dec 11, 2024 at 08:09:51PM +0100, Thomas Gleixner wrote:
> 
> From: Manivannan Sadhasivam <mani@kernel.org>
> 
> commit 64506b3d23a337e98a74b18dcb10c8619365f2bd upstream.
> 
> Otherwise, it will result in a NULL pointer dereference as below:
> 
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
> Call trace:
>  mutex_lock+0xc/0x54
>  platform_device_msi_free_irqs_all+0x14/0x20
>  ufs_qcom_remove+0x34/0x48 [ufs_qcom]
>  platform_remove+0x28/0x44
>  device_remove+0x4c/0x80
>  device_release_driver_internal+0xd8/0x178
>  driver_detach+0x50/0x9c
>  bus_remove_driver+0x6c/0xbc
>  driver_unregister+0x30/0x60
>  platform_driver_unregister+0x14/0x20
>  ufs_qcom_pltform_exit+0x18/0xb94 [ufs_qcom]
>  __arm64_sys_delete_module+0x180/0x260
>  invoke_syscall+0x44/0x100
>  el0_svc_common.constprop.0+0xc0/0xe0
>  do_el0_svc+0x1c/0x28
>  el0_svc+0x34/0xdc
>  el0t_64_sync_handler+0xc0/0xc4
>  el0t_64_sync+0x190/0x194
> 
> Cc: stable@vger.kernel.org # 6.3
> Fixes: 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Link: https://lore.kernel.org/r/20241111-ufs_bug_fix-v1-2-45ad8b62f02e@linaro.org
> Reviewed-by: Bean Huo <beanhuo@micron.com>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  drivers/ufs/host/ufs-qcom.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for this, I've dropped the other backports and just taken this
one instead.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
@ 2025-03-27  9:10 jianqi.ren.cn
  2025-03-28 17:03 ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: jianqi.ren.cn @ 2025-03-27  9:10 UTC (permalink / raw)
  To: stable
  Cc: patches, gregkh, linux-kernel, jianqi.ren.cn, mani, agross,
	andersson, konrad.dybcio, jejb, martin.petersen, bvanassche,
	quic_asutoshd, quic_cang, linux-arm-msm, linux-scsi,
	manivannan.sadhasivam, beanhuo

From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

commit 64506b3d23a337e98a74b18dcb10c8619365f2bd upstream.

Otherwise, it will result in a NULL pointer dereference as below:

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
Call trace:
 mutex_lock+0xc/0x54
 platform_device_msi_free_irqs_all+0x14/0x20
 ufs_qcom_remove+0x34/0x48 [ufs_qcom]
 platform_remove+0x28/0x44
 device_remove+0x4c/0x80
 device_release_driver_internal+0xd8/0x178
 driver_detach+0x50/0x9c
 bus_remove_driver+0x6c/0xbc
 driver_unregister+0x30/0x60
 platform_driver_unregister+0x14/0x20
 ufs_qcom_pltform_exit+0x18/0xb94 [ufs_qcom]
 __arm64_sys_delete_module+0x180/0x260
 invoke_syscall+0x44/0x100
 el0_svc_common.constprop.0+0xc0/0xe0
 do_el0_svc+0x1c/0x28
 el0_svc+0x34/0xdc
 el0t_64_sync_handler+0xc0/0xc4
 el0t_64_sync+0x190/0x194

Cc: stable@vger.kernel.org # 6.3
Fixes: 519b6274a777 ("scsi: ufs: qcom: Add MCQ ESI config vendor specific ops")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241111-ufs_bug_fix-v1-2-45ad8b62f02e@linaro.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
Verified the build test
---
 drivers/ufs/host/ufs-qcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index c5a6b133d364..51ed40529f9a 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1918,10 +1918,12 @@ static int ufs_qcom_probe(struct platform_device *pdev)
 static int ufs_qcom_remove(struct platform_device *pdev)
 {
 	struct ufs_hba *hba =  platform_get_drvdata(pdev);
+	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
 	pm_runtime_get_sync(&(pdev)->dev);
 	ufshcd_remove(hba);
-	platform_msi_domain_free_irqs(hba->dev);
+	if (host->esi_enabled)
+		platform_msi_domain_free_irqs(hba->dev);
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
  2025-03-27  9:10 [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled jianqi.ren.cn
@ 2025-03-28 17:03 ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2025-03-28 17:03 UTC (permalink / raw)
  To: stable; +Cc: jianqi.ren.cn, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: 64506b3d23a337e98a74b18dcb10c8619365f2bd

WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Manivannan Sadhasivam<manivannan.sadhasivam@linaro.org>

Status in newer kernel trees:
6.13.y | Present (exact SHA1)
6.12.y | Present (different SHA1: f99cb5f6344e)

Note: The patch differs from the upstream commit:
---
1:  64506b3d23a33 < -:  ------------- scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
-:  ------------- > 1:  e2ac4e6ae36e7 scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-28 17:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27  9:10 [PATCH 6.6.y] scsi: ufs: qcom: Only free platform MSIs when ESI is enabled jianqi.ren.cn
2025-03-28 17:03 ` Sasha Levin
     [not found] <20241211183908.3808070-1-sashal@kernel.org>
2024-12-11 19:09 ` Thomas Gleixner
2024-12-12  6:57   ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.