lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023080224-nutrient-regress-c95e@gregkh>
Date:   Wed, 2 Aug 2023 15:48:26 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Jiri Slaby <jirislaby@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...el.com>,
        Dhruva Gole <d-gole@...com>,
        Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        John Ogness <john.ogness@...utronix.de>,
        Johan Hovold <johan@...nel.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH] serial: core: Fix serial_base_match() after fixing
 controller port name

On Wed, Aug 02, 2023 at 02:48:43PM +0300, Tony Lindgren wrote:
> While fixing DEVNAME to be more usable, I broke serial_base_match() as
> the ctrl and port prefix for device seemed unnecessary.
> 
> Let's fix the issue by checking against dev->type and drv->name.
> 
> Fixes: 1ef2c2df1199 ("serial: core: Fix serial core controller port name to show controller id")
> Reported-by: kernel test robot <oliver.sang@...el.com>
> Signed-off-by: Tony Lindgren <tony@...mide.com>
> ---
>  drivers/tty/serial/serial_base.h     |  3 +++
>  drivers/tty/serial/serial_base_bus.c | 10 ++++++++--
>  drivers/tty/serial/serial_ctrl.c     |  2 +-
>  drivers/tty/serial/serial_port.c     |  2 +-
>  4 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_base.h b/drivers/tty/serial/serial_base.h
> --- a/drivers/tty/serial/serial_base.h
> +++ b/drivers/tty/serial/serial_base.h
> @@ -6,6 +6,9 @@
>   * Author: Tony Lindgren <tony@...mide.com>
>   */
>  
> +#define SERIAL_BASE_CTRL_NAME	"ctrl"
> +#define SERIAL_BASE_PORT_NAME	"port"
> +
>  #define to_serial_base_ctrl_device(d) container_of((d), struct serial_ctrl_device, dev)
>  #define to_serial_base_port_device(d) container_of((d), struct serial_port_device, dev)
>  
> diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
> --- a/drivers/tty/serial/serial_base_bus.c
> +++ b/drivers/tty/serial/serial_base_bus.c
> @@ -29,9 +29,15 @@ static const struct device_type serial_port_type = {
>  
>  static int serial_base_match(struct device *dev, struct device_driver *drv)
>  {
> -	int len = strlen(drv->name);
> +	if (dev->type == &serial_ctrl_type &&
> +	    !strncmp(SERIAL_BASE_CTRL_NAME, drv->name, 4))

maybe:
	    !strncmp(SERIAL_BASE_CTRL_NAME, drv->name, strlen(SERIAL_BASE_CTRL_NAME))

as "4" is a magic number :)


thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ