summaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-08-23 23:36:00 +0200
committerOlof Johansson <olof@lixom.net>2018-09-25 22:57:25 +0200
commit64e9e22e68512da8df3c9a7430f07621e48db3c2 (patch)
tree584df8f3b1e15ed9103c26cd146be64b83e8fbef /drivers/soc
parentMerge tag 'arm-soc/for-4.19/devicetree-fixes' of https://github.com/Broadcom/... (diff)
downloadlinux-64e9e22e68512da8df3c9a7430f07621e48db3c2.tar.xz
linux-64e9e22e68512da8df3c9a7430f07621e48db3c2.zip
soc: fsl: qbman: qman: avoid allocating from non existing gen_pool
If the qman driver didn't probe, calling qman_alloc_fqid_range, qman_alloc_pool_range or qman_alloc_cgrid_range (as done in dpaa_eth) will pass a NULL pointer to gen_pool_alloc, leading to a NULL pointer dereference. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Roy Pledge <roy.pledge@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com> (cherry picked from commit f72487a2788aa70c3aee1d0ebd5470de9bac953a) Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/fsl/qbman/qman.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index ecb22749df0b..8cc015183043 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt)
{
unsigned long addr;
+ if (!p)
+ return -ENODEV;
+
addr = gen_pool_alloc(p, cnt);
if (!addr)
return -ENOMEM;