]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
authorKeerthy <j-keerthy@ti.com>
Mon, 31 Jul 2017 04:31:36 +0000 (10:01 +0530)
committerArnd Bergmann <arnd@arndb.de>
Mon, 21 Aug 2017 07:19:50 +0000 (09:19 +0200)
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>
drivers/soc/ti/knav_qmss_queue.c

index 279e7c5551dd55588fa95fee7547ea8a945ab58d..39225de9d7f1455e43d2ac6279193a68e5518562 100644 (file)
@@ -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);