1
0
Fork 0

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>
hifive-unleashed-5.1
Keerthy 2017-07-31 10:01:36 +05:30 committed by Arnd Bergmann
parent 4dd6a9973b
commit 4459398b6d
1 changed files with 3 additions and 0 deletions

View 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);