Skip to content

Commit 833f7d4

Browse files
tititiou36martinkpetersen
authored andcommitted
scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
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: 16ed9d3 ("scsi: ufs: core: Remove ufshcd_map_desc_id_to_length()") Link: https://lore.kernel.org/r/2c6e42205e5ec22e5e8c7c85c6deb8fde31c74da.1673781835.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3682212 commit 833f7d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3537,7 +3537,8 @@ int ufshcd_read_desc_param(struct ufs_hba *hba,
35373537
if (param_offset >= buff_len) {
35383538
dev_err(hba->dev, "%s: Invalid offset 0x%x in descriptor IDN 0x%x, length 0x%x\n",
35393539
__func__, param_offset, desc_id, buff_len);
3540-
return -EINVAL;
3540+
ret = -EINVAL;
3541+
goto out;
35413542
}
35423543

35433544
/* Sanity check */

0 commit comments

Comments
 (0)