mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Erwan Yvin <erwan.yvin@stericsson.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org, Andrew Lunn <andrew+netdev@lunn.ch>
Subject: Re: [PATCH] caif_virtio: fix wrong pointer check in cfv_probe()
Date: Thu, 27 Feb 2025 21:51:43 +0100	[thread overview]
Message-ID: <1ea6a1df-357d-4d00-828b-98345254b4b2@engleder-embedded.com> (raw)
In-Reply-To: <20250227184716.4715-1-v.shevtsov@mt-integration.ru>

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@mt-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@engleder-embedded.com>

  reply	other threads:[~2025-02-27 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 18:46 Vitaliy Shevtsov
2025-02-27 20:51 ` Gerhard Engleder [this message]
2025-03-01  2:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ea6a1df-357d-4d00-828b-98345254b4b2@engleder-embedded.com \
    --to=gerhard@engleder-embedded.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=erwan.yvin@stericsson.com \
    --cc=jiri@resnulli.us \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=v.shevtsov@mt-integration.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®