[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1ea6a1df-357d-4d00-828b-98345254b4b2@engleder-embedded.com>
Date: Thu, 27 Feb 2025 21:51:43 +0100
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Vitaliy Shevtsov <v.shevtsov@...integration.ru>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, "Michael S. Tsirkin" <mst@...hat.com>,
Jiri Pirko <jiri@...nulli.us>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Rusty Russell <rusty@...tcorp.com.au>, Erwan Yvin
<erwan.yvin@...ricsson.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org,
Andrew Lunn <andrew+netdev@...n.ch>
Subject: Re: [PATCH] caif_virtio: fix wrong pointer check in cfv_probe()
On 27.02.25 19:46, Vitaliy Shevtsov wrote:
> del_vqs() frees virtqueues, therefore cfv->vq_tx pointer should be checked
> for NULL before calling it, not cfv->vdev. Also the current implementation
> is redundant because the pointer cfv->vdev is dereferenced before it is
> checked for NULL.
>
> Fix this by checking cfv->vq_tx for NULL instead of cfv->vdev before
> calling del_vqs().
>
> Found by Linux Verification Center (linuxtesting.org) with Svace.
>
> Fixes: 0d2e1a2926b1 ("caif_virtio: Introduce caif over virtio")
> Signed-off-by: Vitaliy Shevtsov <v.shevtsov@...integration.ru>
> ---
> drivers/net/caif/caif_virtio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/caif/caif_virtio.c b/drivers/net/caif/caif_virtio.c
> index 7fea00c7ca8a..c60386bf2d1a 100644
> --- a/drivers/net/caif/caif_virtio.c
> +++ b/drivers/net/caif/caif_virtio.c
> @@ -745,7 +745,7 @@ static int cfv_probe(struct virtio_device *vdev)
>
> if (cfv->vr_rx)
> vdev->vringh_config->del_vrhs(cfv->vdev);
> - if (cfv->vdev)
> + if (cfv->vq_tx)
> vdev->config->del_vqs(cfv->vdev);
> free_netdev(netdev);
> return err;
Reviewed-by: Gerhard Engleder <gerhard@...leder-embedded.com>
Powered by blists - more mailing lists