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 11:02:58 +0000 (12:02 +0100)
commit45a05e32d6eca1bd65ab93a63f324fd556937ea4
tree054bcbee763f21977797c7b450f6a1e3dd4d4694
parentbd33ff5842c63ebb831b4fdc18d61c1805329f00
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