All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
@ 2023-01-15 11:24 Christophe JAILLET
  2023-02-09  2:26 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2023-01-15 11:24 UTC (permalink / raw)
  To: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
	Martin K. Petersen, Arthur Simchaev, Bean Huo
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi

If an error occurs, some memory may need to be freed, as in the other
error handling paths.

Before the commit in the Fixes tag, this test was done before the memory
allocation, so there was no issue.

Fixes: 16ed9d312b42 ("scsi: ufs: core: Remove ufshcd_map_desc_id_to_length()")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/ufs/core/ufshcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 6ec65dcdd689..097f2489bc91 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3452,7 +3452,8 @@ int ufshcd_read_desc_param(struct ufs_hba *hba,
 	if (param_offset >= buff_len) {
 		dev_err(hba->dev, "%s: Invalid offset 0x%x in descriptor IDN 0x%x, length 0x%x\n",
 			__func__, param_offset, desc_id, buff_len);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out;
 	}
 
 	/* Sanity check */
-- 
2.34.1


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

* Re: [PATCH] scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
  2023-01-15 11:24 [PATCH] scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param() Christophe JAILLET
@ 2023-02-09  2:26 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2023-02-09  2:26 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
	Martin K. Petersen, Arthur Simchaev, Bean Huo, linux-kernel,
	kernel-janitors, linux-scsi


Christophe,

> If an error occurs, some memory may need to be freed, as in the other
> error handling paths.

Applied to 6.3/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2023-02-09  2:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-15 11:24 [PATCH] scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param() Christophe JAILLET
2023-02-09  2:26 ` Martin K. Petersen

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.