Skip to content

Commit caca951

Browse files
committed
firmware loader: allow builtin firmware load even if usermodehelper is disabled
In commit a144c6a ("PM: Print a warning if firmware is requested when tasks are frozen") we not only printed a warning if somebody tried to load the firmware when tasks are frozen - we also failed the load. But that check was done before the check for built-in firmware, and then when we disallowed usermode helpers during bootup (commit 288d5ab: "Boot up with usermodehelper disabled"), that actually means that built-in modules can no longer load their firmware even if the firmware is built in too. Which used to work, and some people depended on it for the R100 driver. So move the test for usermodehelper_is_disabled() down, to after checking the built-in firmware. This should fix: https://bugzilla.kernel.org/show_bug.cgi?id=40952 Reported-by: James Cloos <cloos@hjcloos.com> Bisected-by: Elimar Riesebieter <riesebie@lxtec.de> Cc: Michel Dänzer <michel@daenzer.net> Cc: Rafael Wysocki <rjw@sisk.pl> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 650cf77 commit caca951

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/base/firmware_class.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,6 @@ static int _request_firmware(const struct firmware **firmware_p,
521521
if (!firmware_p)
522522
return -EINVAL;
523523

524-
if (WARN_ON(usermodehelper_is_disabled())) {
525-
dev_err(device, "firmware: %s will not be loaded\n", name);
526-
return -EBUSY;
527-
}
528-
529524
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
530525
if (!firmware) {
531526
dev_err(device, "%s: kmalloc(struct firmware) failed\n",
@@ -539,6 +534,12 @@ static int _request_firmware(const struct firmware **firmware_p,
539534
return 0;
540535
}
541536

537+
if (WARN_ON(usermodehelper_is_disabled())) {
538+
dev_err(device, "firmware: %s will not be loaded\n", name);
539+
retval = -EBUSY;
540+
goto out;
541+
}
542+
542543
if (uevent)
543544
dev_dbg(device, "firmware: requesting %s\n", name);
544545

0 commit comments

Comments
 (0)