[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YHQUrpbSIXJ47nXL@vkoul-mobl.Dlink>
Date: Mon, 12 Apr 2021 15:06:46 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Cc: dave.jiang@...el.com, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] dma: Fix a double free in dma_async_device_register
On 30-03-21, 18:44, Lv Yunlong wrote:
> In the first list_for_each_entry() macro of dma_async_device_register,
> it gets the chan from list and calls __dma_async_device_channel_register
> (..,chan). We can see that chan->local is allocated by alloc_percpu() and
> it is freed chan->local by free_percpu(chan->local) when
> __dma_async_device_channel_register() failed.
>
> But after __dma_async_device_channel_register() failed, the caller will
> goto err_out and freed the chan->local in the second time by free_percpu().
>
> The cause of this problem is forget to set chan->local to NULL when
> chan->local was freed in __dma_async_device_channel_register(). My
> patch sets chan->local to NULL when the callee failed to avoid double free.
Applied after fixing subsystem name, thanks
--
~Vinod
Powered by blists - more mailing lists