]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
virtio: fix memory leak of virtio ida cache layers
authorSuman Anna <s-anna@ti.com>
Thu, 17 Sep 2015 00:29:17 +0000 (19:29 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Mar 2016 23:06:49 +0000 (15:06 -0800)
commit6c08efea2e18f6ea6931d619e27fbe900e3af9ad
tree70eb762a9777450c54191b5f339e394b16d4881f
parent6fa733e9dba350f1c4de4ff3cde8ee0afc9243e5
virtio: fix memory leak of virtio ida cache layers

commit c13f99b7e945dad5273a8b7ee230f4d1f22d3354 upstream.

The virtio core uses a static ida named virtio_index_ida for
assigning index numbers to virtio devices during registration.
The ida core may allocate some internal idr cache layers and
an ida bitmap upon any ida allocation, and all these layers are
truely freed only upon the ida destruction. The virtio_index_ida
is not destroyed at present, leading to a memory leak when using
the virtio core as a module and atleast one virtio device is
registered and unregistered.

Fix this by invoking ida_destroy() in the virtio core module
exit.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/virtio/virtio.c