From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: Michael S. Tsirkin <mst@redhat.com>
Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_ring: mark ring unused on error
Date: Thu, 06 Jan 2022 21:04:54 +0800 [thread overview]
Message-ID: <1641474294.475928-1-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20220106130046.422417-1-mst@redhat.com>
On Thu, 6 Jan 2022 08:00:48 -0500, Michael S. Tsirkin <mst@redhat.com> wrote:
> A recently added error path does not mark ring unused when exiting on
> OOM, which will lead to BUG on the next entry in debug builds.
>
> TODO: refactor code so we have START_USE and END_USE in the same function.
>
> Fixes: fc6d70f40b3d ("virtio_ring: check desc == NULL when using indirect with packed")
> Cc: "Xuan Zhuo" <xuanzhuo@linux.alibaba.com>
> Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
LGTM
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> drivers/virtio/virtio_ring.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 028b05d44546..962f1477b1fa 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -1197,8 +1197,10 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq,
> if (virtqueue_use_indirect(_vq, total_sg)) {
> err = virtqueue_add_indirect_packed(vq, sgs, total_sg, out_sgs,
> in_sgs, data, gfp);
> - if (err != -ENOMEM)
> + if (err != -ENOMEM) {
> + END_USE(vq);
> return err;
> + }
>
> /* fall back on direct */
> }
> --
> MST
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-01-06 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 13:00 [PATCH] virtio_ring: mark ring unused on error Michael S. Tsirkin
2022-01-06 13:04 ` Xuan Zhuo [this message]
2022-01-07 2:24 ` Jason Wang
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=1641474294.475928-1-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox