Re: [PATCH] nitrox: avoid double free on error path in nitrox_sriov_init()

From: Herbert Xu
Date: Fri Oct 21 2022 - 07:34:56 EST


On Wed, Sep 28, 2022 at 01:25:05PM +0300, Natalia Petrova wrote:
> If alloc_workqueue() fails in nitrox_mbox_init() it deallocates
> ndev->iov.vfdev and returns error code, but then nitrox_sriov_init()
> calls nitrox_sriov_cleanup() where ndev->iov.vfdev is deallocated
> again.
>
> Fix this by nulling ndev->iov.vfdev after the first deallocation.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Natalia Petrova <n.petrova@xxxxxxxxxx>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@xxxxxxxxx>
> ---
> drivers/crypto/cavium/nitrox/nitrox_mbx.c | 1 +
> 1 file changed, 1 insertion(+)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt