mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
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: e8e1ef9b77 ("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>
This commit is contained in:
parent
6d9500bb1f
commit
41464a4628
|
|
@ -102,7 +102,7 @@ int iommufd_viommu_report_event(struct iommufd_viommu *viommu,
|
|||
goto out_set_header;
|
||||
}
|
||||
|
||||
vevent = kmalloc(struct_size(vevent, event_data, data_len), GFP_ATOMIC);
|
||||
vevent = kzalloc(struct_size(vevent, event_data, data_len), GFP_ATOMIC);
|
||||
if (!vevent) {
|
||||
rc = -ENOMEM;
|
||||
vevent = &veventq->lost_events_header;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user