diff options
| author | Pengpeng Hou <pengpeng@iscas.ac.cn> | 2026-07-22 12:16:19 +0800 |
|---|---|---|
| committer | Will Deacon <will@kernel.org> | 2026-07-24 13:05:48 +0000 |
| commit | 649e5ef83671009bb89d683f54b16615adf94bf0 (patch) | |
| tree | ded24de8548ddd089b03a95826494684f047869d | |
| parent | b0d50c9016c4c2959dfa61bf9549cf98f9aa19cd (diff) | |
| download | linux-next-649e5ef83671009bb89d683f54b16615adf94bf0.tar.gz linux-next-649e5ef83671009bb89d683f54b16615adf94bf0.zip | |
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>
| -rw-r--r-- | drivers/iommu/msm_iommu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 708baeb29c03..038f6ed797ea 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -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; } |
