Patch "vdpasim: fix memory leak when freeing IOTLBs" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    vdpasim: fix memory leak when freeing IOTLBs

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     vdpasim-fix-memory-leak-when-freeing-iotlbs.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 401340f32955edd3700fb714169fc5d7f2d20ffd
Author: Jason Wang <jasowang@xxxxxxxxxx>
Date:   Tue Dec 13 17:07:17 2022 +0800

    vdpasim: fix memory leak when freeing IOTLBs
    
    [ Upstream commit 0b7a04a30eef20e6b24926a45c0ce7906ae85bd6 ]
    
    After commit bda324fd037a ("vdpasim: control virtqueue support"),
    vdpasim->iommu became an array of IOTLB, so we should clean the
    mappings of each free one by one instead of just deleting the ranges
    in the first IOTLB which may leak maps.
    
    Fixes: bda324fd037a ("vdpasim: control virtqueue support")
    Cc: Gautam Dawar <gautam.dawar@xxxxxxxxxx>
    Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
    Message-Id: <20221213090717.61529-1-jasowang@xxxxxxxxxx>
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Reviewed-by: Gautam Dawar <gautam.dawar@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index 1701e0623408..6489f44bca1a 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -679,7 +679,9 @@ static void vdpasim_free(struct vdpa_device *vdpa)
 	}
 
 	kvfree(vdpasim->buffer);
-	vhost_iotlb_free(vdpasim->iommu);
+	for (i = 0; i < vdpasim->dev_attr.nas; i++)
+		vhost_iotlb_reset(&vdpasim->iommu[i]);
+	kfree(vdpasim->iommu);
 	kfree(vdpasim->vqs);
 	kfree(vdpasim->config);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux