From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eli Cohen <elic@nvidia.com>
Cc: eperezma@redhat.com, parav@mellanox.com,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2] vdpa/mlx5: Verify wq is a valid pointer in mlx5_vdpa_suspend
Date: Tue, 4 Apr 2023 11:07:22 -0400 [thread overview]
Message-ID: <20230404110652-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230328071810.843361-1-elic@nvidia.com>
On Tue, Mar 28, 2023 at 10:18:10AM +0300, Eli Cohen wrote:
> mlx5_vdpa_suspend() flushes the workqueue as part of its logic. However,
> if the device has been deleted while a VM was running, the workqueue
> will be destroyed first and wq will become null. After the VM is destroyed,
> suspend can be called and will access a null pointer.
>
> Fix it by verifying wq is not NULL.
>
> Fixes: cae15c2ed8e6 ("vdpa/mlx5: Implement susupend virtqueue callback")
> Signed-off-by: Eli Cohen <elic@nvidia.com>
This conflicts with the patch for not losing link state updates.
How do you want to handle this?
> ---
> v1 -> v2:
> Fix spelling errors
>
> drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 85866ace0061..b73c5943aefd 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -2929,7 +2929,8 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev)
> down_write(&ndev->reslock);
> ndev->nb_registered = false;
> mlx5_notifier_unregister(mvdev->mdev, &ndev->nb);
> - flush_workqueue(ndev->mvdev.wq);
> + if (ndev->mvdev.wq)
> + flush_workqueue(ndev->mvdev.wq);
> for (i = 0; i < ndev->cur_num_vqs; i++) {
> mvq = &ndev->vqs[i];
> suspend_vq(ndev, mvq);
> --
> 2.38.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
parent reply other threads:[~2023-04-04 15:07 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20230328071810.843361-1-elic@nvidia.com>]
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=20230404110652-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=elic@nvidia.com \
--cc=eperezma@redhat.com \
--cc=parav@mellanox.com \
--cc=virtualization@lists.linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.