linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
@ 2017-07-31  4:31 Keerthy
  2017-07-31 20:09 ` Santosh Shilimkar
  2017-08-21  5:44 ` santosh.shilimkar at oracle.com
  0 siblings, 2 replies; 4+ messages in thread
From: Keerthy @ 2017-07-31  4:31 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---

Changes in v2:

  * Fixed returning an int to returning pointer.

 drivers/soc/ti/knav_qmss_queue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 279e7c5..d91626b 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);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-21  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-31  4:31 [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create Keerthy
2017-07-31 20:09 ` Santosh Shilimkar
2017-08-21  5:44 ` santosh.shilimkar at oracle.com
2017-08-21  7:21   ` Arnd Bergmann

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).