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]
Date:   Wed, 1 Feb 2023 09:41:28 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     "D. Starke" <daniel.starke@...mens.com>
Cc:     linux-serial@...r.kernel.org, jirislaby@...nel.org,
        ilpo.jarvinen@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] tty: n_gsm: add TIOCMIWAIT support

On Wed, Feb 01, 2023 at 09:01:51AM +0100, D. Starke wrote:
> From: Daniel Starke <daniel.starke@...mens.com>
> 
> Add support for the TIOCMIWAIT ioctl on the virtual ttys. This enables the
> user to wait for virtual modem signals like RING.
> 
> Signed-off-by: Daniel Starke <daniel.starke@...mens.com>
> ---
>  drivers/tty/n_gsm.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index 118511c1fa37..48fb7dad44cd 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -1542,6 +1542,7 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
>  	if (brk & 0x01)
>  		tty_insert_flip_char(&dlci->port, 0, TTY_BREAK);
>  	dlci->modem_rx = mlines;
> +	wake_up_interruptible(&dlci->gsm->event);
>  }
>  
>  /**
> @@ -3848,6 +3849,35 @@ static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk)
>  	return -EPROTONOSUPPORT;
>  }
>  
> +/**
> + * gsm_wait_modem_change	-	wait for modem status line change

No need for tabs.

Or for kernel doc for static functions, but that's not a big deal.

> + * @dlci: channel
> + * @mask: modem status line bits
> + */
> +

No blank line please, didn't checkpatch warn about that?

> +static int gsm_wait_modem_change(struct gsm_dlci *dlci, u32 mask)
> +{
> +	struct gsm_mux *gsm = dlci->gsm;
> +	u32 old = dlci->modem_rx & mask;
> +	int ret;
> +
> +	if (gsm->dead)
> +		return -ENODEV;
> +
> +	do {
> +		ret = wait_event_interruptible(gsm->event, gsm->dead
> +					      || old ^ (dlci->modem_rx & mask));
> +		if (ret)
> +			return ret;
> +		if (dlci->state != DLCI_OPEN)
> +			return -EL2NSYNC;
> +		if (gsm->dead)
> +			return -ENODEV;
> +	} while ((old ^ (dlci->modem_rx & mask)) == 0);

No way to break out of the loop if it goes for forever?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ