public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio_ring: add an error code check in virtqueue_resize
@ 2023-10-20  9:23 Su Hui
  2023-10-20  9:28 ` Xuan Zhuo
  2023-10-20  9:34 ` Michael S. Tsirkin
  0 siblings, 2 replies; 17+ messages in thread
From: Su Hui @ 2023-10-20  9:23 UTC (permalink / raw)
  To: mst, jasowang, xuanzhuo
  Cc: Su Hui, virtualization, linux-kernel, kernel-janitors

virtqueue_resize_packed() or virtqueue_resize_split() can return
error code if failed, so add a check for this.

Signed-off-by: Su Hui <suhui@nfschina.com>
---

I'm not sure that return directly is right or not,
maybe there are some process should do before return.

 drivers/virtio/virtio_ring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 51d8f3299c10..cf662c3a755b 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2759,6 +2759,9 @@ int virtqueue_resize(struct virtqueue *_vq, u32 num,
 	else
 		err = virtqueue_resize_split(_vq, num);
 
+	if (err)
+		return err;
+
 	return virtqueue_enable_after_reset(_vq);
 }
 EXPORT_SYMBOL_GPL(virtqueue_resize);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-10-23 11:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  9:23 [PATCH] virtio_ring: add an error code check in virtqueue_resize Su Hui
2023-10-20  9:28 ` Xuan Zhuo
2023-10-20  9:34 ` Michael S. Tsirkin
2023-10-20  9:36   ` Xuan Zhuo
2023-10-20  9:42     ` Michael S. Tsirkin
2023-10-20  9:50       ` Xuan Zhuo
2023-10-20 10:08         ` Michael S. Tsirkin
2023-10-23  2:26           ` Xuan Zhuo
2023-10-23  2:51             ` Su Hui
2023-10-23  2:53               ` Xuan Zhuo
2023-10-23  3:06                 ` Su Hui
2023-10-23  5:46                   ` Xuan Zhuo
2023-10-23  9:50                     ` Su Hui
2023-10-23  9:52                       ` Xuan Zhuo
2023-10-23 10:52                         ` Xuan Zhuo
2023-10-23 11:18                           ` Michael S. Tsirkin
2023-10-23 11:17                         ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox