summaryrefslogtreecommitdiffstats
path: root/drivers/staging/gasket/gasket_core.c
diff options
context:
space:
mode:
authorTodd Poynor2018-07-28 21:33:24 +0200
committerGreg Kroah-Hartman2018-07-29 08:05:45 +0200
commit5b6e80cc9806a5cf78f68df2b6b64812b51d91c9 (patch)
tree182cac21ed72e2d6825b3602ac9e665c99bbbc6d /drivers/staging/gasket/gasket_core.c
parentstaging: erofs: fix conditional uninitialized `pcn' in z_erofs_map_blocks_iter (diff)
downloadkernel-qcow2-linux-5b6e80cc9806a5cf78f68df2b6b64812b51d91c9.tar.gz
kernel-qcow2-linux-5b6e80cc9806a5cf78f68df2b6b64812b51d91c9.tar.xz
kernel-qcow2-linux-5b6e80cc9806a5cf78f68df2b6b64812b51d91c9.zip
staging: gasket: core: hold reference on device while in use
Hold a reference on the struct device while a pointer to that device is in use by gasket. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket/gasket_core.c')
-rw-r--r--drivers/staging/gasket/gasket_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 859a6df9e12d..2b484d067c38 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -448,7 +448,7 @@ static int gasket_alloc_dev(
gasket_dev->internal_desc = internal_desc;
gasket_dev->dev_idx = dev_idx;
snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
- gasket_dev->dev = parent;
+ gasket_dev->dev = get_device(parent);
/* 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 +487,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);
-
+ put_device(gasket_dev->dev);
kfree(gasket_dev);
}