Skip to content

Commit 7222ae1

Browse files
Youssef SamirMani-Sadhasivam
authored andcommitted
bus: mhi: host: Free mhi_buf vector inside mhi_alloc_bhie_table()
mhi_alloc_bhie_table() starts by allocating a vector of struct mhi_buf then it allocates a DMA buffer for each element. If allocation fails, it will free the allocated DMA buffers, but it neglects freeing the mhi_buf vector. Avoid memory leaks by freeing the mhi_buf vector on error. Fixes: 3000f85 ("bus: mhi: core: Add support for basic PM operations") Signed-off-by: Youssef Samir <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
1 parent 40384c8 commit 7222ae1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/bus/mhi/host/boot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl,
357357
for (--i, --mhi_buf; i >= 0; i--, mhi_buf--)
358358
dma_free_coherent(mhi_cntrl->cntrl_dev, mhi_buf->len,
359359
mhi_buf->buf, mhi_buf->dma_addr);
360+
kfree(img_info->mhi_buf);
360361

361362
error_alloc_mhi_buf:
362363
kfree(img_info);

0 commit comments

Comments
 (0)