From: Todd Poynor <toddpoynor@xxxxxxxxxx> Take the global mutex on driver unregistration updates for proper ordering of updates and consistent access procedures. Signed-off-by: Zhongze Hu <frankhu@xxxxxxxxxxxx> Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx> --- drivers/staging/gasket/gasket_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c index cbadab7544c81..2ff328652356a 100644 --- a/drivers/staging/gasket/gasket_core.c +++ b/drivers/staging/gasket/gasket_core.c @@ -371,7 +371,9 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc) 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); } -- 2.18.0.203.gfac676dfb9-goog _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel