spi: img-spfi: fix potential double release
authorPan Bian <bianpan2016@163.com>
Wed, 6 Nov 2019 02:36:09 +0000 (10:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:44:46 +0000 (16:44 +0100)
commitcc492872180a5c58ac4166ca650d80468db97ba3
tree39e9d4a2fe340573ffc04ff662fbc2e26474974c
parent197803ca31017f4fe52336a2a220796d0deb647a
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: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/1573007769-20131-1-git-send-email-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-img-spfi.c