Re: [PATCH] scsi: ufs: Add missing check for alloc_ordered_workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/7/24 10:54 PM, Ma Ke wrote:
As it may return NULL pointer and cause NULL pointer dereference. Add check
for the return value of alloc_ordered_workqueue.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 10e5e37581fc ("scsi: ufs: Add clock ungating to a separate workqueue")
Signed-off-by: Ma Ke <make24@xxxxxxxxxxx>
---
  drivers/ufs/core/ufshcd.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5e3c67e96956..41842f2cd454 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2139,6 +2139,8 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba)
  		 hba->host->host_no);
  	hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name,
  					WQ_MEM_RECLAIM | WQ_HIGHPRI);
+	if (!hba->clk_gating.clk_gating_workq)
+		return;
ufshcd_init_clk_gating_sysfs(hba);

This patch doesn't solve anything since hba->clk_gating.clk_gating_workq
is not used in ufshcd_init_clk_gating() after that workqueue has been
created. Additionally, this patch doesn't prevent that the UFS driver
will attempt to queue work on hba->clk_gating.clk_gating_workq if
allocation of that workqueue fails. If it would be possible to vote on
Linux kernel patches, my vote would be -2.

Bart.






[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux