[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180728052200.228796-6-toddpoynor@gmail.com>
Date: Fri, 27 Jul 2018 22:22:00 -0700
From: Todd Poynor <toddpoynor@...il.com>
To: Rob Springer <rspringer@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Ben Chan <benchan@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Todd Poynor <toddpoynor@...gle.com>
Subject: [PATCH 5/5] staging: gasket: core: hold reference on device kobj while in use
From: Todd Poynor <toddpoynor@...gle.com>
Hold a reference on the struct device kobject while a pointer to that
device is in use by gasket.
Reported-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Todd Poynor <toddpoynor@...gle.com>
---
drivers/staging/gasket/gasket_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 859a6df9e12df..1dc7273e38734 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -449,6 +449,7 @@ static int gasket_alloc_dev(
gasket_dev->dev_idx = dev_idx;
snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
gasket_dev->dev = parent;
+ kobject_get(&gasket_dev->dev->kobj);
/* gasket_bar_data is uninitialized. */
gasket_dev->num_page_tables = driver_desc->num_page_tables;
/* max_page_table_size and *page table are uninit'ed */
@@ -487,7 +488,7 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
mutex_lock(&internal_desc->mutex);
internal_desc->devs[gasket_dev->dev_idx] = NULL;
mutex_unlock(&internal_desc->mutex);
-
+ kobject_put(&gasket_dev->dev->kobj);
kfree(gasket_dev);
}
--
2.18.0.345.g5c9ce644c3-goog
Powered by blists - more mailing lists