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] [day] [month] [year] [list]
Date:	Thu, 22 May 2014 11:56:58 +0200
From:	Jean-Jacques Hiblot <jjhiblot@...phandler.com>
To:	Jean-Jacques Hiblot <jjhiblot@...phandler.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	mingo <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
	"jon.povey" <jon.povey@...elogic.co.uk>,
	gregkh <gregkh@...uxfoundation.org>, balbi <balbi@...com>
Subject: Re: [PATCH] PREEMPT_RT: USB serial gadget: Fix locking issue

damn ! I just realized I sent the broken patch. It won't compile.
The right version is comming soon.

2014-05-22 11:45 GMT+02:00 Jean-Jacques Hiblot <jjhiblot@...phandler.com>:
> With CONFIG_PREEMPT_RT_FULL the tty_flip_buffer_push(..) actions are executed
> immeditely (same behaviour as if low_latency flag was set). We thus have to
> release port_lock before callng tty_flip_buffer_push().
>
> This issue resultst of commits:
> 44a0c019: USB: g_serial: don't set low_latency flag
> dc0cbd1b: serial: 8250: Call flush_to_ldisc when the irq is threaded
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
> ---
>  drivers/usb/gadget/u_serial.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
> index b369292..1c4f404 100644
> --- a/drivers/usb/gadget/u_serial.c
> +++ b/drivers/usb/gadget/u_serial.c
> @@ -549,12 +549,25 @@ static void gs_rx_push(unsigned long _port)
>                 port->read_started--;
>         }
>
> -       /* Push from tty to ldisc; without low_latency set this is handled by
> -        * a workqueue, so we won't get callbacks and can hold port_lock
> -        */
> -       if (do_push)
> +       /* Push from tty to ldisc */
> +       if (do_push) {
> +#ifndef CONFIG_PREEMPT_RT_FULL
> +               /* without low_latency set this is handled by a workqueue, so
> +                * we won't get callbacks and can hold port_lock
> +               */
>                 tty_flip_buffer_push(&port->port);
> -
> +#else
> +               /* CONFIG_PREEMPT_RT_FULL makes this a synchronous action. and
> +                * it may trigger synchronous callbacks to this driver. We need
> +                * to release the lock.
> +               */
> +               spin_unlock_irq(&port->port_lock);
> +               tty_flip_buffer_push(&port->port);
> +               spin_lock_irq(&port->port_lock);
> +               /* tty may have been closed */
> +               tty = port->port_tty;
> +#endif
> +       }
>
>         /* We want our data queue to become empty ASAP, keeping data
>          * in the tty and ldisc (not here).  If we couldn't push any
> --
> 1.9.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ