Re: [PATCH] mhi: Fix double dma free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-02-09 08:06 AM, Loic Poulain wrote:
On Tue, 9 Feb 2021 at 16:55, Jeffrey Hugo <jhugo@xxxxxxxxxxxxxx> wrote:

On 2/9/2021 8:53 AM, Loic Poulain wrote:
> mhi_deinit_chan_ctxt functionthat takes care of unitializing channel
> resources, including unmapping coherent MHI areas, can be called
> from different path in case of controller unregistering/removal:
>   - From a client driver remove callback, via mhi_unprepare_channel
>   - From mhi_driver_remove that unitialize all channels
>
> mhi_driver_remove()
> |-> driver->remove()
> |    |-> mhi_unprepare_channel()
> |        |-> mhi_deinit_chan_ctxt()
> |...
> |-> mhi_deinit_chan_ctxt()
>
> This leads to double dma freeing...
>
> Fix that by preventing deinit for already uninitialized channel.
>
> Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxx>
> Reported-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
> ---

Seems like this should have a Fixes: tag, no?

Right, thanks, i'll add it in V2 once I get feedback.

Hi Loic, Mani,

I saw this same issue a while back but could not collect the logs for it.

I had already pushed a patch to fix this differently [1] which was recently reviewed by Hemant.

Although there wasn't a purposeful fixes tag for it. I think the culprit for this issue is [2]:

As it allows the unprepare to go through on remove(), which was traditionally not allowed and
ends up uncovering this issue as it fixes another.

Channel updates [3] address that and provide a bunch of other improvements. Please consider them.

Thanks,
Bhaumik

[1] https://lkml.org/lkml/2021/2/4/1161
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/bus/mhi?h=v5.11-rc7&id=a7f422f2f89e7d48aa66e6488444a4c7f01269d5
[3] https://lkml.org/lkml/2021/2/4/1155

---
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux