From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Youssef Samir <quic_yabdulra@quicinc.com>
Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jeffrey Hugo <quic_jhugo@quicinc.com>
Subject: Re: [PATCH] bus: mhi: host: Free mhi_buf vector inside mhi_alloc_bhie_table()
Date: Fri, 15 Nov 2024 11:37:31 +0530 [thread overview]
Message-ID: <20241115060731.345c2nx53bpluxjx@thinkpad> (raw)
In-Reply-To: <20241024214715.1208940-1-quic_yabdulra@quicinc.com>
On Thu, Oct 24, 2024 at 11:47:15PM +0200, Youssef Samir wrote:
> 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: 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations")
> Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
Applied to mhi-next!
- Mani
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> ---
> drivers/bus/mhi/host/boot.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c
> index 21bf042db9be..2e9ef55a566a 100644
> --- a/drivers/bus/mhi/host/boot.c
> +++ b/drivers/bus/mhi/host/boot.c
> @@ -415,6 +415,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl,
> for (--i, --mhi_buf; i >= 0; i--, mhi_buf--)
> dma_free_coherent(mhi_cntrl->cntrl_dev, mhi_buf->len,
> mhi_buf->buf, mhi_buf->dma_addr);
> + kfree(img_info->mhi_buf);
>
> error_alloc_mhi_buf:
> kfree(img_info);
> --
> 2.25.1
>
--
மணிவண்ணன் சதாசிவம்
prev parent reply other threads:[~2024-11-15 6:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 21:47 Youssef Samir
2024-10-24 21:48 ` Jeffrey Hugo
2024-11-15 6:06 ` Manivannan Sadhasivam
2024-11-15 6:07 ` Manivannan Sadhasivam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241115060731.345c2nx53bpluxjx@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhi@lists.linux.dev \
--cc=quic_jhugo@quicinc.com \
--cc=quic_yabdulra@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®