lkml.org 
[lkml]   [2019]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 003/267] usb: gadget: u_serial: add missing port entry locking
    Date
    From: Michał Mirosław <mirq-linux@rere.qmqm.pl>

    commit daf82bd24e308c5a83758047aff1bd81edda4f11 upstream.

    gserial_alloc_line() misses locking (for a release barrier) while
    resetting port entry on TTY allocation failure. Fix this.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Tested-by: Ladislav Michl <ladis@linux-mips.org>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/usb/gadget/function/u_serial.c | 2 ++
    1 file changed, 2 insertions(+)

    --- a/drivers/usb/gadget/function/u_serial.c
    +++ b/drivers/usb/gadget/function/u_serial.c
    @@ -1392,8 +1392,10 @@ int gserial_alloc_line(unsigned char *li
    __func__, port_num, PTR_ERR(tty_dev));

    ret = PTR_ERR(tty_dev);
    + mutex_lock(&ports[port_num].lock);
    port = ports[port_num].port;
    ports[port_num].port = NULL;
    + mutex_unlock(&ports[port_num].lock);
    gserial_free_port(port);
    goto err;
    }

    \
     
     \ /
      Last update: 2019-12-16 18:51    [W:2.270 / U:26.672 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site