linux/drivers/base
Srivatsa S. Bhat b298d289c7 PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()
Commit a144c6a (PM: Print a warning if firmware is requested when tasks
are frozen) introduced usermodehelper_is_disabled() to warn and exit
immediately if firmware is requested when usermodehelpers are disabled.

However, it is racy. Consider the following scenario, currently used in
drivers/base/firmware_class.c:

...
if (usermodehelper_is_disabled())
        goto out;

/* Do actual work */
...

out:
        return err;

Nothing prevents someone from disabling usermodehelpers just after the check
in the 'if' condition, which means that it is quite possible to try doing the
"actual work" with usermodehelpers disabled, leading to undesirable
consequences.

In particular, this race condition in _request_firmware() causes task freezing
failures whenever suspend/hibernation is in progress because, it wrongly waits
to get the firmware/microcode image from userspace when actually the
usermodehelpers are disabled or userspace has been frozen.
Some of the example scenarios that cause freezing failures due to this race
are those that depend on userspace via request_firmware(), such as x86
microcode module initialization and microcode image reload.

Previous discussions about this issue can be found at:
http://thread.gmane.org/gmane.linux.kernel/1198291/focus=1200591

This patch adds proper synchronization to fix this issue.

It is to be noted that this patchset fixes the freezing failures but doesn't
remove the warnings. IOW, it does not attempt to add explicit synchronization
to x86 microcode driver to avoid requesting microcode image at inopportune
moments. Because, the warnings were introduced to highlight such cases, in the
first place. And we need not silence the warnings, since we take care of the
*real* problem (freezing failure) and hence, after that, the warnings are
pretty harmless anyway.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-12-09 23:36:36 +01:00
..
power PM / Sleep: Unify diagnostic messages from device suspend/resume 2011-12-06 22:09:45 +01:00
regmap drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required. 2011-10-31 19:31:38 -04:00
attribute_container.c [SCSI] attirbute_container: Initialize sysfs attributes with sysfs_attr_init 2010-03-27 15:15:24 -04:00
base.h drivers/base: base.h implicitly depends on <linux/notifier.h> 2011-10-31 19:31:39 -04:00
bus.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-01-13 10:05:56 -08:00
class.c class: Implement support for class attrs in tagged sysfs directories. 2011-10-19 19:24:15 -04:00
core.c PM / driver core: disable device's runtime PM during shutdown 2011-11-15 21:52:29 +01:00
cpu.c drivers/base/cpu.c: fix the output from /sys/devices/system/cpu/offline 2010-05-21 09:37:28 -07:00
dd.c drivers: base: print rejected matches with DEBUG_DRIVER 2011-09-26 16:21:15 -07:00
devres.c base/devres.c: quiet sparse noise about context imbalance 2011-08-22 14:12:24 -07:00
devtmpfs.c drivers/base/devtmpfs.c: correct annotation of `setup_done' 2011-08-08 13:53:50 -07:00
dma-coherent.c drivers/base: dma-coherent.c is a module and needs module.h 2011-10-31 19:31:38 -04:00
dma-mapping.c drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required. 2011-10-31 19:31:38 -04:00
driver.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
firmware.c firmware: change firmware_kset to firmware_kobj 2008-01-24 20:40:23 -08:00
firmware_class.c PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() 2011-12-09 23:36:36 +01:00
hypervisor.c drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required. 2011-10-31 19:31:38 -04:00
init.c Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev 2009-09-15 09:50:49 -07:00
isa.c dma-mapping: replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24) 2009-04-07 08:31:12 -07:00
Kconfig Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 2011-07-25 23:06:24 -07:00
Makefile Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap 2011-07-23 11:14:47 -07:00
map.c
memory.c mm: memory hotplug: Check if pages are correctly reserved on a per-section basis 2011-10-18 14:01:24 -07:00
module.c driver core: module.c: Use kasprintf 2010-05-21 09:37:29 -07:00
node.c drivers/base/node.c: fix compilation error with older versions of gcc 2011-11-18 10:39:24 -08:00
platform.c Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core 2011-10-25 12:13:59 +02:00
sys.c PM: Remove sysdev suspend, resume and shutdown operations 2011-05-11 21:37:15 +02:00
syscore.c PM: Reintroduce dropped call to check_wakeup_irqs 2011-07-11 10:51:49 +02:00
topology.c topology/sysfs: Provide book id and siblings attributes 2010-09-09 20:41:25 +02:00
transport_class.c drivers/base: transport_class explicitly requires EXPORT_SYMBOL 2011-10-31 19:31:15 -04:00