Skip to contentSkip to conversation

driver core: dd: fix return value of __setup handler

PATCH In review Randy Dunlap 2 participants 2 messages Mar 1, 2022 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: dd: fix return value of __setup handler

When "driver_async_probe=nulltty" is used on the kernel boot command line, it causes an Unknown parameter message and the string is added to init's environment strings, polluting them.

Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc6 driver_async_probe=nulltty", will be passed to user space.

Run /sbin/init as init process
with arguments:
/sbin/init
with environment:

     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc6
     driver_async_probe=nulltty

Change the return value of the __setup function to 1 to indicate that the __setup option has been handled.

Fixes 1ea61b68d0f8 ("async: Add cmdline option to specify drivers to be async probed")
Link lore.kernel.org/r/[email protected]
Cc Feng Tang <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
---
 drivers/base/dd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
@@ -810,7 +810,7 @@ static int __init save_async_options(cha
 		pr_warn("Too long list of driver names for 'driver_async_probe'!\n");
 
 	strlcpy(async_probe_drv_names, buf, ASYNC_DRV_NAMES_MAX_LEN);
-	return 0;
+	return 1;
 }
 __setup("driver_async_probe=", save_async_options);
 
Reviewed-by on v1 1/1
#1 lore raw

Hi Randy,

Quoted 11 lines · Randy Dunlap

When "driver_async_probe=nulltty" is used on the kernel boot command line, it causes an Unknown parameter message and the string is added to init's environment strings, polluting them.

Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc6 driver_async_probe=nulltty", will be passed to user space.

Run /sbin/init as init process
with arguments:
/sbin/init
with environment:

Quoted 7 lines
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc6
     driver_async_probe=nulltty

Change the return value of the __setup function to 1 to indicate that the __setup option has been handled.

Thanks for the fix!

Quoted 22 lines
Fixes 1ea61b68d0f8 ("async: Add cmdline option to specify drivers to be async probed")
Link lore.kernel.org/r/[email protected]
Cc Feng Tang <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
---
 drivers/base/dd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
@@ -810,7 +810,7 @@ static int __init save_async_options(cha
 		pr_warn("Too long list of driver names for 'driver_async_probe'!\n");
 
 	strlcpy(async_probe_drv_names, buf, ASYNC_DRV_NAMES_MAX_LEN);
-	return 0;
+	return 1;
 }
 __setup("driver_async_probe=", save_async_options);