mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
iommu/msm: Limit the per-master Machine ID list
The OF translation path appends each unique stream ID from an IOMMU specifier to the fixed mids array in the per-master object. It currently has no capacity check before storing at mids[num_mids] and incrementing num_mids. Return -ENOSPC when the array is full rather than writing the next ID beyond it. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
b0d50c9016
commit
649e5ef836
|
|
@ -622,6 +622,9 @@ static int insert_iommu_master(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (master->num_mids >= MAX_NUM_MIDS)
|
||||
return -ENOSPC;
|
||||
|
||||
master->mids[master->num_mids++] = spec->args[0];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user