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:   Tue, 18 Aug 2020 12:56:09 +0300
From:   Tony Lindgren <tony@...mide.com>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Gregory CLEMENT <gregory.clement@...tlin.com>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH] n_gsm: Fix write handling for zero bytes written

Hi,

* Jiri Slaby <jirislaby@...nel.org> [200818 08:24]:
> On 17. 08. 20, 15:54, Tony Lindgren wrote:
> > If write returns zero we currently end up removing the message
> > from the queue. Instead of removing the message, we want to just
> > break out of the loop just like we already do for error codes.
> 
> When exactly does the only writer (gsmld_output) return zero for
> non-zero len parameter?

I ran into this when testing with the WIP serial core PM runtime
changes from Andy Shevchenko earlier. If there are also other
cases where we have serial drivers return 0, I don't know about
them.

Basically with the WIP serial core changes, if the open serial port
is in PM runtime suspended state with it's autosuspend_delay_ms
expired, we have write return 0 and just wake up the serial device
on TX.

I don't think there's much anything else we can currently do there
in the PM runtime suspended case as we want to get rid of the
remaining pm_runtime_irq_safe() dependencies as it takes a permanent
usage count on the parent device.

Regards,

Tony

> 
> > Signed-off-by: Tony Lindgren <tony@...mide.com>
> > ---
> >  drivers/tty/n_gsm.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> > --- a/drivers/tty/n_gsm.c
> > +++ b/drivers/tty/n_gsm.c
> > @@ -691,7 +691,8 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
> >  			print_hex_dump_bytes("gsm_data_kick: ",
> >  					     DUMP_PREFIX_OFFSET,
> >  					     gsm->txframe, len);
> > -		if (gsm->output(gsm, gsm->txframe, len) < 0)
> > +
> > +		if (gsm->output(gsm, gsm->txframe, len) <= 0)
> >  			break;
> >  		/* FIXME: Can eliminate one SOF in many more cases */
> >  		gsm->tx_bytes -= msg->len;
> > 
> 
> thanks,
> -- 
> js

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ