Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699683 > unrolled thread

[PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create

Started byKeerthy <j-keerthy@ti.com>
First post2017-07-31 06:40 +0200
Last post2017-07-31 22:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create Keerthy <j-keerthy@ti.com> - 2017-07-31 06:40 +0200
    Re: [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in  knav_pool_create Santosh Shilimkar <santosh.shilimkar@oracle.com> - 2017-07-31 22:10 +0200

#1699683 — [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create

FromKeerthy <j-keerthy@ti.com>
Date2017-07-31 06:40 +0200
Subject[PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
Message-ID<u9aEN-1Ca-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1700361 — Re: [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create

FromSantosh Shilimkar <santosh.shilimkar@oracle.com>
Date2017-07-31 22:10 +0200
SubjectRe: [PATCH v2] soc: ti: knav: Add a NULL pointer check for kdev in knav_pool_create
Message-ID<u9paO-2ga-11@gated-at.bofh.it>
In reply to#1699683
On 7/30/2017 9:31 PM, Keerthy wrote:
> 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.

Thanks. Will add it to the queue.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web