lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a6771f11aa2b3e032223e94f744d2f32@codeaurora.org>
Date:   Wed, 10 Feb 2021 09:45:13 -0800
From:   Bhaumik Bhatt <bbhatt@...eaurora.org>
To:     Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc:     gregkh@...uxfoundation.org, hemantk@...eaurora.org,
        linux-arm-msm@...r.kernel.org, jhugo@...eaurora.org,
        linux-kernel@...r.kernel.org, loic.poulain@...aro.org,
        kvalo@...eaurora.org, ath11k@...ts.infradead.org
Subject: Re: [PATCH 1/1] mhi: Fix double dma free

On 2021-02-10 12:25 AM, Manivannan Sadhasivam wrote:
> From: Loic Poulain <loic.poulain@...aro.org>
> 
> mhi_deinit_chan_ctxt functionthat takes care of unitializing channel
s/functionthat/function that, uninitializing
> 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
uninitialize
> 
> 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.
> 
> Fixes: a7f422f2f89e ("bus: mhi: Fix channel close issue on driver 
> remove")
> Signed-off-by: Loic Poulain <loic.poulain@...aro.org>
> Reported-by: Kalle Valo <kvalo@...eaurora.org>
> Tested-by: Kalle Valo <kvalo@...eaurora.org>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> Link:
> https://lore.kernel.org/r/1612894264-15956-1-git-send-email-loic.poulain@linaro.org
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> ---
>  drivers/bus/mhi/core/init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index aa575d3fb3ae..be4eebb0971b 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -557,6 +557,9 @@ void mhi_deinit_chan_ctxt(struct mhi_controller 
> *mhi_cntrl,
>  	tre_ring = &mhi_chan->tre_ring;
>  	chan_ctxt = &mhi_cntrl->mhi_ctxt->chan_ctxt[mhi_chan->chan];
> 
> +	if (!chan_ctxt->rbase) /* Already uninitialized */
> +		return;
> +
>  	mhi_free_coherent(mhi_cntrl, tre_ring->alloc_size,
>  			  tre_ring->pre_aligned, tre_ring->dma_handle);
>  	vfree(buf_ring->base);

As mentioned in my previous email, I see some improvements can be made 
to the commit
message and title of this patch. Highlighted those above.

Please update title to "bus: mhi: core: Fix double DMA free from 
mhi_deinit_chan_ctxt()".

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ