Skip to content

Commit

Permalink
scsi: ufs: core: Fix an error handling path in ufshcd_read_desc_param()
Browse files Browse the repository at this point in the history
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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Christophe JAILLET authored and Martin K. Petersen committed Feb 9, 2023
1 parent 3682212 commit 833f7d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/ufs/core/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3537,7 +3537,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 */
Expand Down

0 comments on commit 833f7d4

Please sign in to comment.