diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-05-22 18:28:38 +0200 |
---|---|---|
committer | Daniel Rosenberg <drosen@google.com> | 2015-01-06 13:30:41 -0800 |
commit | 1945e4386b31917d99f1423ab8d3ff402a4cbc88 (patch) | |
tree | 10f3eae91c34670431a41d497296c65ca65a9481 /drivers/base | |
parent | 2422b3c265a8a3594c12c906029fec02fb650191 (diff) |
firmware: Avoid deadlock of usermodehelper lock at shutdown
When a system goes to reboot/shutdown, it tries to disable the
usermode helper via usermodehelper_disable(). This might be blocked
when a driver tries to load a firmware beforehand and it's stuck by
some reason. For example, dell_rbu driver loads the firmware in
non-hotplug mode and waits for user-space clearing the loading sysfs
flag. If user-space doesn't clear the flag, it waits forever, thus
blocks the reboot, too.
As a workaround, in this patch, the firmware class driver registers a
reboot notifier so that it can abort all pending f/w bufs before
issuing usermodehelper_disable().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:
drivers/base/firmware_class.c
Change-Id: I7ff6c198cd34090e55845b9d4035b1e5dc86226b
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/firmware_class.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index c30df50e4440..33a70bd492de 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -905,6 +905,10 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); } + mutex_lock(&fw_lock); + list_add(&buf->pending_list, &pending_fw_head); + mutex_unlock(&fw_lock); + wait_for_completion(&buf->completion); cancel_delayed_work_sync(&fw_priv->timeout_work); |