android_kernel_samsung_sm8650/drivers/s390
Tony Krowiak 6a40fda14b s390/vfio-ap: fix memory leak in vfio_ap device driver
[ Upstream commit 8f8cf767589f2131ae5d40f3758429095c701c84 ]

The device release callback function invoked to release the matrix device
uses the dev_get_drvdata(device *dev) function to retrieve the
pointer to the vfio_matrix_dev object in order to free its storage. The
problem is, this object is not stored as drvdata with the device; since the
kfree function will accept a NULL pointer, the memory for the
vfio_matrix_dev object is never freed.

Since the device being released is contained within the vfio_matrix_dev
object, the container_of macro will be used to retrieve its pointer.

Fixes: 1fde573413 ("s390: vfio-ap: base implementation of VFIO AP device driver")
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://lore.kernel.org/r/20230320150447.34557-1-akrowiak@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-06 12:10:46 +02:00
..
block s390/dasd: Fix potential memleak in dasd_eckd_init() 2023-03-10 09:32:45 +01:00
char s390/early: fix sclp_early_sccb variable lifetime 2023-03-10 09:32:53 +01:00
cio s390/cio: fix out-of-bounds access on cio_ignore free 2022-10-26 14:47:31 +02:00
crypto s390/vfio-ap: fix memory leak in vfio_ap device driver 2023-04-06 12:10:46 +02:00
net s390/lcs: Fix return type of lcs_start_xmit() 2022-12-31 13:33:01 +01:00
scsi scsi: zfcp: Fix double free of FSF request when qdio send fails 2022-11-17 17:51:06 +00:00
virtio virtio: Revert "virtio: find_vqs() add arg sizes" 2022-08-16 01:40:24 -04:00
Makefile s390: remove pointless drivers-y in drivers/s390/Makefile 2019-09-16 13:21:51 +02:00