summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShiraz Hashim <shashim@codeaurora.org>2016-07-04 15:05:14 +0530
committerKyle Yan <kyan@codeaurora.org>2016-07-11 14:26:28 -0700
commit81218366f19d6d290f861a3dcb565fb49c21b488 (patch)
treea424d5a952f769c04a400b80e179f9070bda8b95 /drivers
parent87b1536fb347209143e306f5b56b8dc23282d192 (diff)
iommu/io-pgtable-fast: validate data before use
Return error on data allocation failure to prevent use after free case. Change-Id: I9d173756e277c9006220c02c209309167f179609 Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/io-pgtable-fast.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/io-pgtable-fast.c b/drivers/iommu/io-pgtable-fast.c
index 44307f67fd22..9a25ebfdc778 100644
--- a/drivers/iommu/io-pgtable-fast.c
+++ b/drivers/iommu/io-pgtable-fast.c
@@ -420,6 +420,9 @@ av8l_fast_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
struct av8l_fast_io_pgtable *data =
av8l_fast_alloc_pgtable_data(cfg);
+ if (!data)
+ return NULL;
+
/* restrict according to the fast map requirements */
cfg->ias = 32;
cfg->pgsize_bitmap = SZ_4K;