mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] driver core: dd: fix return value of __setup handler
@ 2022-03-01  4:18 Randy Dunlap
  2022-03-01  6:27 ` Feng Tang
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2022-03-01  4:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: patches, Randy Dunlap, Igor Zhbanov, Feng Tang,
	Greg Kroah-Hartman, Rafael J. Wysocki

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")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Feng Tang <feng.tang@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
---
 drivers/base/dd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20220228.orig/drivers/base/dd.c
+++ linux-next-20220228/drivers/base/dd.c
@@ -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);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] driver core: dd: fix return value of __setup handler
  2022-03-01  4:18 [PATCH] driver core: dd: fix return value of __setup handler Randy Dunlap
@ 2022-03-01  6:27 ` Feng Tang
  0 siblings, 0 replies; 2+ messages in thread
From: Feng Tang @ 2022-03-01  6:27 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, patches, Igor Zhbanov, Greg Kroah-Hartman,
	Rafael J. Wysocki

Hi Randy,

On Mon, Feb 28, 2022 at 08:18:29PM -0800, Randy Dunlap wrote:
> 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.

Thanks for the fix!

Reviewed-by: Feng Tang <feng.tang@intel.com>


> Fixes: 1ea61b68d0f8 ("async: Add cmdline option to specify drivers to be async probed")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
> Cc: Feng Tang <feng.tang@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> ---
>  drivers/base/dd.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- linux-next-20220228.orig/drivers/base/dd.c
> +++ linux-next-20220228/drivers/base/dd.c
> @@ -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);
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-01  6:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  4:18 [PATCH] driver core: dd: fix return value of __setup handler Randy Dunlap
2022-03-01  6:27 ` Feng Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®