From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Li Yang <leoyang.li@nxp.com>
Cc: Roy Pledge <roy.pledge@nxp.com>,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [PATCH 2/2] soc: fsl: qbman: qman: avoid allocating from non existing gen_pool
Date: Thu, 23 Aug 2018 23:36:00 +0200 [thread overview]
Message-ID: <20180823213600.23426-2-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20180823213600.23426-1-alexandre.belloni@bootlin.com>
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>
---
drivers/soc/fsl/qbman/qman.c | 3 +++
1 file changed, 3 insertions(+)
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;
--
2.18.0
next prev parent reply other threads:[~2018-08-23 21:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 21:35 [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Alexandre Belloni
2018-08-23 21:36 ` Alexandre Belloni [this message]
2018-08-24 14:53 ` [PATCH 2/2] soc: fsl: qbman: qman: avoid allocating from non existing gen_pool Roy Pledge
2018-08-24 14:52 ` [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Roy Pledge
2018-08-28 22:49 ` Li Yang
2018-09-25 19:45 ` Olof Johansson
2018-09-25 22:11 ` Li Yang
2018-09-26 9:27 ` Alexandre Belloni
2018-09-26 18:15 ` Li Yang
2018-09-27 19:24 ` Li Yang
2018-09-27 19:24 ` Li Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180823213600.23426-2-alexandre.belloni@bootlin.com \
--to=alexandre.belloni@bootlin.com \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=roy.pledge@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).