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>
        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);
        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);
 }