21 May, 2016

1 commit

  • Pull tty and serial driver updates from Greg KH:
    "Here's the large TTY and Serial driver update for 4.7-rc1.

    A few new serial drivers are added here, and Peter has fixed a bunch
    of long-standing bugs in the tty layer and serial drivers as normal.
    Full details in the shortlog.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'tty-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (88 commits)
    MAINTAINERS: 8250: remove website reference
    serial: core: Fix port mutex assert if lockdep disabled
    serial: 8250_dw: fix wrong logic in dw8250_check_lcr()
    tty: vt, finish looping on duplicate
    tty: vt, return error when con_startup fails
    QE-UART: add "fsl,t1040-ucc-uart" to of_device_id
    serial: mctrl_gpio: Drop support for out1-gpios and out2-gpios
    serial: 8250dw: Add device HID for future AMD UART controller
    Fix OpenSSH pty regression on close
    serial: mctrl_gpio: add IRQ locking
    serial: 8250: Integrate Fintek into 8250_base
    serial: mps2-uart: add support for early console
    serial: mps2-uart: add MPS2 UART driver
    dt-bindings: document the MPS2 UART bindings
    serial: sirf: Use generic uart-has-rtscts DT property
    serial: sirf: Introduce helper variable struct device_node *np
    serial: mxs-auart: Use generic uart-has-rtscts DT property
    serial: imx: Use generic uart-has-rtscts DT property
    doc: DT: Add Generic Serial Device Tree Bindings
    serial: 8250: of: Make tegra_serial_handle_break() static
    ...

    Linus Torvalds
     

05 May, 2016

1 commit

  • Replace all trans_start updates with netif_trans_update helper.
    change was done via spatch:

    struct net_device *d;
    @@
    - d->trans_start = jiffies
    + netif_trans_update(d)

    Compile tested only.

    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-xtensa@linux-xtensa.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-rdma@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: MPT-FusionLinux.pdl@broadcom.com
    Cc: linux-scsi@vger.kernel.org
    Cc: linux-can@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-hams@vger.kernel.org
    Cc: linux-usb@vger.kernel.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: devel@driverdev.osuosl.org
    Cc: b.a.t.m.a.n@lists.open-mesh.org
    Cc: linux-bluetooth@vger.kernel.org
    Signed-off-by: Florian Westphal
    Acked-by: Felipe Balbi
    Acked-by: Mugunthan V N
    Acked-by: Antonio Quartulli
    Signed-off-by: David S. Miller

    Florian Westphal
     

01 May, 2016

6 commits

  • Replace ASYNC_INITIALIZED bit in the tty_port::flags field with
    TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers
    tty_port_set_initialized() and tty_port_initialized() to abstract
    atomic bit ops.

    Note: the transforms for test_and_set_bit() and test_and_clear_bit()
    are unnecessary as the state transitions are already mutually exclusive;
    the tty lock prevents concurrent open/close/hangup.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Replace ASYNC_CHECK_CD bit in the tty_port::flags field with
    TTY_PORT_CHECK_CD bit in the tty_port::iflags field. Introduce helpers
    tty_port_set_check_carrier() and tty_port_check_carrier() to abstract
    the atomic bit ops.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Replace ASYNC_NORMAL_ACTIVE bit in the tty_port::flags field with
    TTY_PORT_ACTIVE bit in the tty_port::iflags field. Introduce helpers
    tty_port_set_active() and tty_port_active() to abstract atomic bit ops.

    Extract state changes from port lock sections, as this usage is
    broken and confused; the state transitions are protected by the
    tty lock (which mutually excludes parallel open/close/hangup),
    and no user tests the active state while holding the port lock.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Replace ASYNC_CTS_FLOW bit in the tty_port::flags field with
    TTY_PORT_CTS_FLOW bit in the tty_port::iflags field. Add
    tty_port_set_cts_flow() helper to abstract the atomic bit ops.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Abstract TTY_THROTTLED bit tests with tty_throttled().

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • Abstract TTY_IO_ERROR status test treewide with tty_io_error().
    NB: tty->flags uses atomic bit ops; replace non-atomic bit test
    with test_bit().

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

07 Feb, 2016

1 commit

  • synclinkmp_init_one() ignores all errors and does not release
    all resources if something fails.

    The patch adds returned code to device_init() and add_device()
    and proper error handling.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: Greg Kroah-Hartman

    Alexey Khoroshilov
     

29 Jan, 2016

1 commit

  • Expressions of the form "tty->termios.c_*flag & FLAG"
    are more clearly expressed with the termios flags macros,
    I_FLAG(), C_FLAG(), O_FLAG(), and L_FLAG().

    Convert treewide.

    Signed-off-by: Peter Hurley
    Acked-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

18 Oct, 2015

1 commit

  • Since at least before 2.6.30, tty drivers that do not drop the tty lock
    while closing cannot observe ASYNC_CLOSING set while holding the
    tty lock; this includes the tty driver's open() and hangup() methods,
    since the tty core calls these methods holding the tty lock.

    For these drivers, waiting for ASYNC_CLOSING to clear while opening
    is not required, since this condition cannot occur. Similarly, even
    when the open() method drops and reacquires the tty lock after
    blocking, ASYNC_CLOSING cannot be set (again, for drivers that
    do not drop the tty lock while closing).

    Now that tty port drivers no longer drop the tty lock while closing
    (since 'tty: Remove tty_wait_until_sent_from_close()'), the same
    conditions apply: waiting for ASYNC_CLOSING to clear while opening
    is not required, nor is re-checking ASYNC_CLOSING after dropping and
    reacquiring the tty lock while blocking (eg., in *_block_til_ready()).

    Note: The ASYNC_CLOSING flag state is still maintained since several
    bitrotting drivers use it for (dubious) other purposes.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

11 May, 2015

1 commit


11 Jul, 2014

1 commit

  • Since at least before 2.6.30, it has not been possible to observe
    a hung up file pointer in a tty driver's open() method unless/until
    the driver open() releases the tty_lock() (eg., before blocking).

    This is because tty_open() adds the file pointer while holding
    the tty_lock() _and_ doesn't release the lock until after calling
    the tty driver's open() method. [ Before tty_lock(), this was
    lock_kernel(). ]

    Since __tty_hangup() first waits on the tty_lock() before
    enumerating and hanging up the open file pointers, either
    __tty_hangup() will wait for the tty_lock() or tty_open() will
    not yet have added the file pointer. For example,

    CPU 0 | CPU 1
    |
    tty_open | __tty_hangup
    .. | ..
    tty_lock | ..
    tty_reopen | tty_lock / blocks
    .. |
    tty_add_file(tty, filp) |
    .. |
    tty->ops->open(tty, filp) |
    tty_port_open |
    tty_port_block_til_ready |
    .. |
    while (1) |
    .. |
    tty_unlock | / unblocks
    schedule | for each filp on tty->tty_files
    | f_ops = tty_hung_up_fops;
    | ..
    | tty_unlock
    tty_lock |
    .. |
    tty_unlock |

    Note that since tty_port_block_til_ready() and similar drop
    the tty_lock while blocking, when woken, the file pointer
    must then be tested for having been hung up.

    Also, fix bit-rotted drivers that used extra_count to track the
    port->count bump.

    CC: Mikael Starvik
    CC: Samuel Ortiz
    CC: "David S. Miller"
    Signed-off-by: Peter Hurley
    Acked-by: Jesper Nilsson
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

18 Mar, 2014

1 commit

  • The hdlcdev_ioctl() code fails to initialize the two padding bytes of
    struct sync_serial_settings after the ->loopback member. Add an explicit
    memset(0) before filling the structure to avoid the info leak.

    Signed-off-by: Salva Peiró
    Signed-off-by: Greg Kroah-Hartman

    Salva Peiró
     

08 Jan, 2014

1 commit

  • The four variants of the synclink driver use the same code in their
    open() callback to wait for a port in process of being closed,
    using interruptible_sleep_on, which is racy and going away soon.

    Making things worse, these functions hold the BTM while doing so,
    which means that if we ever enter this code path, we cannot actually
    continue since the other thread that is in process of closing the
    port can no longer get the BTM.

    This addresses both issues by using wait_event_interruptible_tty()
    instead.

    Signed-off-by: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

25 Jul, 2013

1 commit

  • This is a static checker fix and I don't have a way to test it. But
    from the context it looks like this is a typo where SCABUFSIZE was
    intended instead of sizeof(SCABUFSIZE). SCABUFSIZE is 1024 and
    sizeof(int) is 4. I would suspect this is a bad bug.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

13 Apr, 2013

1 commit

  • Make sure to check ASYNC_INITIALISED before raising DTR when waking up
    from blocked open in block_til_ready.

    Currently DTR could get raised at hang up as a blocked process would
    raise DTR unconditionally before checking for hang up and returning.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

30 Jan, 2013

1 commit

  • Dan Carpenter noticed a missing set of parentheses
    around a multiple field addition.

    https://lkml.org/lkml/2013/1/27/166

    His original commit message:

    There is a kind of precedence problem here, but it doesn't affect how
    the code works because ->serial_signals is unsigned char. We want to
    clear two flags here.

    #define SerialSignal_RTS 0x20 /* Request to Send */
    #define SerialSignal_DTR 0x80 /* Data Terminal Ready */

    Without the parenthesis then it does:

    info->serial_signals &= 0x5f;

    With the parenthesis it does:

    info->serial_signals &= 0xffffff5f;

    info->serial_signals is an unsigned char so the two statements are
    equivalent, but it's cleaner to add the parenthesis. In other dtr_rts()
    functions the parenthesis are there so this makes it more consistent.

    Other changes:

    Convert all + uses to | for these bit operations.

    Reorder the multiple fields for consistency.
    Update the comments too.

    Reported-by: Dan Carpenter
    Signed-off-by: Joe Perches
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     

16 Jan, 2013

5 commits

  • info in synclink bottom-halves cannot be NULL because it is taken from
    work_struct using container_of. Remove the tests.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Now, we start converting tty buffer functions to actually use
    tty_port. This will allow us to get rid of the need of tty in many
    call sites. Only tty_port will needed and hence no more
    tty_port_tty_get in those paths.

    Now, the one where most of tty_port_tty_get gets removed:
    tty_flip_buffer_push.

    IOW we also closed all the races in drivers not using tty_port_tty_get
    at all yet.

    Also we move tty_flip_buffer_push declaration from include/linux/tty.h
    to include/linux/tty_flip.h to all others while we are changing it
    anyway.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • One point is to have less places where we actually need tty pointer.
    The other is that low_latency is bound to buffer processing and
    buffers are now in tty_port. So it makes sense to move low_latency to
    tty_port too.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Now, we start converting tty buffer functions to actually use
    tty_port. This will allow us to get rid of the need of tty in many
    call sites. Only tty_port will needed and hence no more
    tty_port_tty_get in those paths.

    tty_insert_flip_char is the next one to proceed. This one is used all
    over the code, so the patch is huge.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Fix call to line discipline receive_buf by synclink drivers.
    Dummy flag buffer argument is ignored by N_HDLC line discipline but might
    be of insufficient size if accessed by a different line discipline
    selected by mistake. flag buffer allocation now matches max size of data
    buffer. Unused char_buf buffers are removed.

    Signed-off-by: Paul Fulghum
    Signed-off-by: Greg Kroah-Hartman

    Paul Fulghum
     

22 Nov, 2012

3 commits

  • CONFIG_HOTPLUG is going away as an option so __devexit is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Jiri Slaby
    Cc: Alan Cox
    Acked-by: Tobias Klauser
    Cc: Lucas Tavares
    Cc: Daniel Walker
    Cc: Bryan Huntsman
    Cc: "David S. Miller"
    Cc: Peter Korsgaard
    Cc: Tony Prisk
    Acked-by: David Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Jiri Slaby
    Cc: Alan Cox
    Cc: Lucas Tavares
    Cc: "David S. Miller"
    Cc: Peter Korsgaard
    Cc: Tony Prisk
    Acked-by: Tobias Klauser
    Acked-by: Nicolas Ferre
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

16 Nov, 2012

1 commit

  • After commit "TTY: move tty buffers to tty_port", the tty buffers are
    not freed in some drivers. This is because tty_port_destructor is not
    called whenever a tty_port is freed. This was an assumption I counted
    with but was unfortunately untrue. So fix the drivers to fulfil this
    assumption.

    To be sure, the TTY buffers (and later some stuff) are gone along with
    the tty_port, we have to call tty_port_destroy at tear-down places.
    This is mostly where the structure containing a tty_port is freed.
    This patch does exactly that -- put tty_port_destroy at those places.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

06 Sep, 2012

1 commit

  • In most of the time, the driver needs to check if the cts flow control
    is enabled. But now, the driver checks the ASYNC_CTS_FLOW flag manually,
    which is not a grace way. So add a new wraper function to make the code
    tidy and clean.

    Signed-off-by: Huang Shijie
    Signed-off-by: Greg Kroah-Hartman

    Huang Shijie
     

14 Aug, 2012

1 commit

  • This has two outcomes:
    * we give the TTY layer a tty_port
    * we do not find the info structure every time open is called on that
    tty

    Signed-off-by: Jiri Slaby
    Acked-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

11 Aug, 2012

1 commit

  • The termios and other changes mean the other protections needed on the driver
    tty arrays should be adequate. Turn it all back on.

    This contains pieces folded in from the fixes made to the original patches

    | From: Geert Uytterhoeven (fix m68k)
    | From: Paul Gortmaker (fix cris)
    | From: Jiri Kosina (lockdep)
    | From: Eric Dumazet (lockdep)

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

17 Jul, 2012

2 commits

  • This will let us sort out a whole pile of tty related races. The
    alternative would be to keep points and refcount the termios objects.
    However
    1. They are tiny anyway
    2. Many devices don't use the stored copies
    3. We can remove a pty special case

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • I sent GregKH this after the pre-requisites. He dropped the pre-requesites
    for good reason and unfortunately then applied this patch. Without this
    reverted you get random kernel memory corruption which will make bisecting
    anything between it and the properly applied patches a complete sod.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

07 Jul, 2012

1 commit

  • The termios and other changes mean the other protections needed on the driver
    tty arrays should be adequate. Turn it all back on.

    This contains pieces folded in from the fixes made to the original patches

    | From: Geert Uytterhoeven (fix m68k)
    | From: Paul Gortmaker (fix cris)
    | From: Jiri Kosina (lockdep)
    | From: Eric Dumazet (lockdep)

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

03 Jun, 2012

1 commit

  • This reverts the tty layer change to use per-tty locking, because it's
    not correct yet, and fixing it will require some more deep surgery.

    The main revert is d29f3ef39be4 ("tty_lock: Localise the lock"), but
    there are several smaller commits that built upon it, they also get
    reverted here. The list of reverted commits is:

    fde86d310886 - tty: add lockdep annotations
    8f6576ad476b - tty: fix ldisc lock inversion trace
    d3ca8b64b97e - pty: Fix lock inversion
    b1d679afd766 - tty: drop the pty lock during hangup
    abcefe5fc357 - tty/amiserial: Add missing argument for tty_unlock()
    fd11b42e3598 - cris: fix missing tty arg in wait_event_interruptible_tty call
    d29f3ef39be4 - tty_lock: Localise the lock

    The revert had a trivial conflict in the 68360serial.c staging driver
    that got removed in the meantime.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

05 May, 2012

1 commit

  • In each remaining case the tty_lock is associated with a specific tty. This
    means we can now lock on a per tty basis. We do need tty_lock_pair() for
    the pty case. Uglier but still a step in the right direction.

    [fixed up calls in 3 missing drivers - gregkh]

    Signed-off-by: Alan Cox
    Acked-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

29 Mar, 2012

1 commit


09 Mar, 2012

2 commits

  • Checking if tty->index is in bounds is not needed. The tty has the
    index set in the initial open. This is done in get_tty_driver. And it
    can be only in interval num).

    So remove the tests which check exactly this interval. Some are
    left untouched as they check against the current backing device count.
    (Leaving apart that the check is racy in most of the cases.)

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • All num, magic and owner are set by alloc_tty_driver. No need to
    re-set them on each allocation site.

    pti driver sets something different to what it passes to
    alloc_tty_driver. It is not a bug, since we don't use the lines
    parameter in any way. Anyway this is fixed, and now we do the right
    thing.

    Signed-off-by: Jiri Slaby
    Acked-by: Tilman Schmidt
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

13 Jan, 2012

1 commit


30 Sep, 2011

1 commit

  • My main concern here was the line that said:
    copy_count = min_t(unsigned short,count,SCABUFSIZE);
    "count" is an unsigned int here so the cast to unsigned short
    truncates the upper bits. So if count is 0x10000 then copy_count is
    0 and the loop never exits.

    "count" comes from skb->len in hdlcdev_xmit().

    The other min_t() changes are just cleanups.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter