Thread (10 messages) 10 messages, 4 authors, 2018-09-27

Re: [PATCH 2/2] soc: fsl: qbman: qman: avoid allocating from non existing gen_pool

From: Roy Pledge <roy.pledge@nxp.com>
Date: 2018-08-24 14:54:03
Also in: linux-arm-kernel, lkml

On 8/23/2018 5:36 PM, Alexandre Belloni wrote:=0A=
If the qman driver didn't probe, calling qman_alloc_fqid_range,=0A=
qman_alloc_pool_range or qman_alloc_cgrid_range (as done in dpaa_eth) wil=
l=0A=
quoted hunk ↗ jump to hunk
pass a NULL pointer to gen_pool_alloc, leading to a NULL pointer=0A=
dereference.=0A=
=0A=
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>=0A=
---=0A=
 drivers/soc/fsl/qbman/qman.c | 3 +++=0A=
 1 file changed, 3 insertions(+)=0A=
=0A=
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c=
=0A=
quoted hunk ↗ jump to hunk
index ecb22749df0b..8cc015183043 100644=0A=
--- a/drivers/soc/fsl/qbman/qman.c=0A=
+++ b/drivers/soc/fsl/qbman/qman.c=0A=
@@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32=
 *result, u32 cnt)=0A=
 {=0A=
 	unsigned long addr;=0A=
 =0A=
+	if (!p)=0A=
+		return -ENODEV;=0A=
+=0A=
 	addr =3D gen_pool_alloc(p, cnt);=0A=
 	if (!addr)=0A=
 		return -ENOMEM;=0A=
=0A=
Reviewed-by: Roy Pledge <roy.pledge@nxp.com>=0A=
=0A=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help