Skip to content

Commit b3551ea

Browse files
committed
iommufd: Make sure to zero vfio_iommu_type1_info before copying to user
Missed a zero initialization here. Most of the struct is filled with a copy_from_user(), however minsz for that copy is smaller than the actual struct by 8 bytes, thus we don't fill the padding. Cc: [email protected] # 6.1+ Fixes: d624d66 ("iommufd: vfio container FD ioctl compatibility") Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Kevin Tian <[email protected]> Reported-by: [email protected] Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent bed9e51 commit b3551ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/iommufd/vfio_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ static int iommufd_vfio_iommu_get_info(struct iommufd_ctx *ictx,
448448
};
449449
size_t minsz = offsetofend(struct vfio_iommu_type1_info, iova_pgsizes);
450450
struct vfio_info_cap_header __user *last_cap = NULL;
451-
struct vfio_iommu_type1_info info;
451+
struct vfio_iommu_type1_info info = {};
452452
struct iommufd_ioas *ioas;
453453
size_t total_cap_size;
454454
int rc;

0 commit comments

Comments
 (0)