summaryrefslogtreecommitdiffstats
path: root/drivers/soc/ti/knav_qmss_queue.c
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2017-07-31 06:31:36 +0200
committerArnd Bergmann <arnd@arndb.de>2017-08-21 09:19:50 +0200
commit4459398b6d9e3055ced5de9820364b3bdd79ac25 (patch)
tree0abf5181b2fe16ecd19229382d61f5d413dcf48c /drivers/soc/ti/knav_qmss_queue.c
parentsoc: ti: ti_sci_pm_domains: Populate name for genpd (diff)
downloadlinux-4459398b6d9e3055ced5de9820364b3bdd79ac25.tar.xz
linux-4459398b6d9e3055ced5de9820364b3bdd79ac25.zip
soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
knav_pool_create is an exported function. In the event of a call before knav_queue_probe, we encounter a NULL pointer dereference in the following line. Hence return -EPROBE_DEFER to the caller till the kdev pointer is non-NULL. Signed-off-by: Keerthy <j-keerthy@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/soc/ti/knav_qmss_queue.c')
-rw-r--r--drivers/soc/ti/knav_qmss_queue.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 279e7c5551dd..39225de9d7f1 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -745,6 +745,9 @@ void *knav_pool_create(const char *name,
bool slot_found;
int ret;
+ if (!kdev)
+ return ERR_PTR(-EPROBE_DEFER);
+
if (!kdev->dev)
return ERR_PTR(-ENODEV);