virtio_ring: mark ring unused on error
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 6 Jan 2022 12:57:46 +0000 (07:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:35 +0000 (11:05 +0100)
commitbe82a92c46bc9b80781f6bcfba7ffcc527c1bfee
tree2c8da1c005f504c141915bec9e65ca518de4b692
parent0d3334c47a2eb0088432e38f91b8689b2c2762e2
virtio_ring: mark ring unused on error

commit 1861ba626ae9b98136f3e504208cdef6b29cd3ec upstream.

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>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/virtio/virtio_ring.c