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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBGnniL7x5ENju6H@kroah.com>
Date:   Wed, 15 Mar 2023 12:10:22 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Sherry Sun <sherry.sun@....com>
Cc:     jirislaby@...nel.org, robh@...nel.org,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-imx@....com
Subject: Re: [PATCH] tty: serdev: serdev-ttyport: add devt for ctrl->dev

On Wed, Mar 15, 2023 at 06:54:00PM +0800, Sherry Sun wrote:
> For serdev framework, the serdev_controller device is the tty device,
> which is also the child device of the uart_port device. If we don't set
> devt property for ctrl->dev, device_find_child(uport->dev, ...) may
> always return NULL in uart_suspend_port() function, which prevents us
> from properly handling uart port suspend, so fix it here.
> 
> Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
> Signed-off-by: Sherry Sun <sherry.sun@....com>
> ---
>  drivers/tty/serdev/serdev-ttyport.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
> index bba37ab90215..c58af8141380 100644
> --- a/drivers/tty/serdev/serdev-ttyport.c
> +++ b/drivers/tty/serdev/serdev-ttyport.c
> @@ -268,6 +268,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
>  {
>  	struct serdev_controller *ctrl;
>  	struct serport *serport;
> +	dev_t devt = MKDEV(drv->major, drv->minor_start) + idx;
>  	int ret;
>  
>  	if (!port || !drv || !parent)
> @@ -282,6 +283,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
>  	serport->tty_idx = idx;
>  	serport->tty_drv = drv;
>  
> +	ctrl->dev.devt = devt;

This feels wrong as you can't just create a magic dev_t out of no where
and expect it to be handled properly.  Where now is this dev_t exposed?

Something else feels wrong here, sorry, I do not think this is correct.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ