virtio-blk: Fix memory leak among suspend/resume procedure
authorXie Yongji <xieyongji@bytedance.com>
Mon, 17 May 2021 08:43:32 +0000 (16:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:53 +0000 (16:17 +0200)
[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ]

The vblk->vqs should be freed before we call init_vqs()
in virtblk_restore().

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210517084332.280-1-xieyongji@bytedance.com
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/virtio_blk.c

index 2f15e38fb3f8c2d5670821bf0d651ef8daa7df4e..437d43747c6d04cafe3b4b1e6582e897f9f25492 100644 (file)
@@ -931,6 +931,8 @@ static int virtblk_freeze(struct virtio_device *vdev)
        blk_mq_quiesce_queue(vblk->disk->queue);
 
        vdev->config->del_vqs(vdev);
+       kfree(vblk->vqs);
+
        return 0;
 }