提交 3a2cb02a 编写于 作者: P Pan Bian 提交者: Yang Yingliang

spi: img-spfi: fix potential double release

[ Upstream commit e9a8ba9769a0e354341bc6cc01b98aadcea1dfe9 ]

The channels spfi->tx_ch and spfi->rx_ch are not set to NULL after they
are released. As a result, they will be released again, either on the
error handling branch in the same function or in the corresponding
remove function, i.e. img_spfi_remove(). This patch fixes the bug by
setting the two members to NULL.
Signed-off-by: NPan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/1573007769-20131-1-git-send-email-bianpan2016@163.comSigned-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8a4848d5
...@@ -676,6 +676,8 @@ static int img_spfi_probe(struct platform_device *pdev) ...@@ -676,6 +676,8 @@ static int img_spfi_probe(struct platform_device *pdev)
dma_release_channel(spfi->tx_ch); dma_release_channel(spfi->tx_ch);
if (spfi->rx_ch) if (spfi->rx_ch)
dma_release_channel(spfi->rx_ch); dma_release_channel(spfi->rx_ch);
spfi->tx_ch = NULL;
spfi->rx_ch = NULL;
dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n"); dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n");
} else { } else {
master->dma_tx = spfi->tx_ch; master->dma_tx = spfi->tx_ch;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册