diff options
| author | Suman Anna <s-anna@ti.com> | 2020-02-24 15:26:43 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-18 07:17:55 +0100 |
| commit | a6ea1df9490306bdc43eecfc0757d2902219e667 (patch) | |
| tree | c16f190588be08bf700bce6eb09dcd7253b6f5ab /include/linux/buffer_head.h | |
| parent | b758686cf05a0ec76ef3c2891f793f8ec08eb7f7 (diff) | |
virtio_ring: Fix mem leak with vring_new_virtqueue()
commit f13f09a12cbd0c7b776e083c5d008b6c6a9c4e0b upstream.
The functions vring_new_virtqueue() and __vring_new_virtqueue() are used
with split rings, and any allocations within these functions are managed
outside of the .we_own_ring flag. The commit cbeedb72b97a ("virtio_ring:
allocate desc state for split ring separately") allocates the desc state
within the __vring_new_virtqueue() but frees it only when the .we_own_ring
flag is set. This leads to a memory leak when freeing such allocated
virtqueues with the vring_del_virtqueue() function.
Fix this by moving the desc_state free code outside the flag and only
for split rings. Issue was discovered during testing with remoteproc
and virtio_rpmsg.
Fixes: cbeedb72b97a ("virtio_ring: allocate desc state for split ring separately")
Signed-off-by: Suman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20200224212643.30672-1-s-anna@ti.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/buffer_head.h')
0 files changed, 0 insertions, 0 deletions
