From: Keerthy Date: Mon, 31 Jul 2017 04:31:36 +0000 (+0530) Subject: soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4459398b6d9e3055ced5de9820364b3bdd79ac25;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Santosh Shilimkar Signed-off-by: Arnd Bergmann --- 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);