Skip to content

Commit 527b9e4

Browse files
committed
iommufd: Initialize the flags of vevent in iommufd_viommu_report_event()
commit 41464a4 Author: Yi Liu <yi.l.liu@intel.com> Date: Mon Mar 24 05:00:33 2025 -0700 iommufd: Initialize the flags of vevent in iommufd_viommu_report_event() The vevent->header.flags is not initialized per allocation, hence the vevent read path may treat the vevent as lost_events_header wrongly. Use kzalloc() to alloc memory for new vevent. Fixes: e8e1ef9 ("iommufd/viommu: Add iommufd_viommu_report_event helper") Link: https://patch.msgid.link/r/20250324120034.5940-2-yi.l.liu@intel.com Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> (cherry picked from commit 41464a4) Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com> Upstream-Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git JIRA: https://issues.redhat.com/browse/RHEL-73596
1 parent 90ffd11 commit 527b9e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/iommufd/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int iommufd_viommu_report_event(struct iommufd_viommu *viommu,
102102
goto out_set_header;
103103
}
104104

105-
vevent = kmalloc(struct_size(vevent, event_data, data_len), GFP_ATOMIC);
105+
vevent = kzalloc(struct_size(vevent, event_data, data_len), GFP_ATOMIC);
106106
if (!vevent) {
107107
rc = -ENOMEM;
108108
vevent = &veventq->lost_events_header;

0 commit comments

Comments
 (0)