diff options
author | Todd Poynor <toddpoynor@google.com> | 2018-07-17 13:56:46 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-19 11:39:47 +0200 |
commit | 722c902aacfefcda4aa0517be82af5cfd2ec4bb0 (patch) | |
tree | f14c04cb89249102ace1273c5533e343de3bc838 /drivers | |
parent | staging: gasket: remove driver registration on class creation failure (diff) | |
download | linux-dev-722c902aacfefcda4aa0517be82af5cfd2ec4bb0.tar.xz linux-dev-722c902aacfefcda4aa0517be82af5cfd2ec4bb0.zip |
staging: gasket: hold mutex on gasket driver unregistration
Take the global mutex on driver unregistration updates for proper
ordering of updates and consistent access procedures.
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/gasket/gasket_core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c index cbadab7544c8..2ff328652356 100644 --- a/drivers/staging/gasket/gasket_core.c +++ b/drivers/staging/gasket/gasket_core.c @@ -371,7 +371,9 @@ fail1: class_destroy(internal->class); unregister_gasket_driver: + mutex_lock(&g_mutex); g_descs[desc_idx].driver_desc = NULL; + mutex_unlock(&g_mutex); return ret; } EXPORT_SYMBOL(gasket_register_device); @@ -408,7 +410,9 @@ void gasket_unregister_device(const struct gasket_driver_desc *driver_desc) class_destroy(internal_desc->class); /* Finally, effectively "remove" the driver. */ + mutex_lock(&g_mutex); g_descs[desc_idx].driver_desc = NULL; + mutex_unlock(&g_mutex); gasket_nodev_info("removed %s driver", driver_desc->name); } |