04 Jan, 2021

3 commits

  • This is the 5.10.4 stable release

    * tag 'v5.10.4': (717 commits)
    Linux 5.10.4
    x86/CPU/AMD: Save AMD NodeId as cpu_die_id
    drm/edid: fix objtool warning in drm_cvt_modes()
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    drivers/gpu/drm/imx/dcss/dcss-plane.c
    drivers/media/i2c/ov5640.c

    Jason Liu
     
  • This is the 5.10.3 stable release

    * tag 'v5.10.3': (41 commits)
    Linux 5.10.3
    md: fix a warning caused by a race between concurrent md_ioctl()s
    nl80211: validate key indexes for cfg80211_registered_device
    ...

    Signed-off-by: Jason Liu

    Jason Liu
     
  • This is the 5.10.2 stable release

    * tag 'v5.10.2': (17 commits)
    Linux 5.10.2
    serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access
    ALSA: pcm: oss: Fix potential out-of-bounds shift
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    drivers/usb/host/xhci-hub.c
    drivers/usb/host/xhci.h

    Jason Liu
     

30 Dec, 2020

2 commits

  • commit a7b5458ce73b235be027cf2658c39b19b7e58cf2 upstream.

    Don't add platform resources that won't be used. This avoids a
    recently-added warning from the driver core, that can show up on a
    multi-platform kernel when !MACH_IS_MAC.

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at drivers/base/platform.c:224 platform_get_irq_optional+0x8e/0xce
    0 is an invalid IRQ number
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper Not tainted 5.9.0-multi #1
    Stack from 004b3f04:
    004b3f04 00462c2f 00462c2f 004b3f20 0002e128 004754db 004b6ad4 004b3f4c
    0002e19c 004754f7 000000e0 00285ba0 00000009 00000000 004b3f44 ffffffff
    004754db 004b3f64 004b3f74 00285ba0 004754f7 000000e0 00000009 004754db
    004fdf0c 005269e2 004fdf0c 00000000 004b3f88 00285cae 004b6964 00000000
    004fdf0c 004b3fac 0051cc68 004b6964 00000000 004b6964 00000200 00000000
    0051cc3e 0023c18a 004b3fc0 0051cd8a 004fdf0c 00000002 0052b43c 004b3fc8
    Call Trace: [] __warn+0xa6/0xd6
    [] warn_slowpath_fmt+0x44/0x76
    [] platform_get_irq_optional+0x8e/0xce
    [] platform_get_irq_optional+0x8e/0xce
    [] platform_get_irq+0x12/0x4c
    [] pmz_init_port+0x2a/0xa6
    [] pmz_init_port+0x0/0xa6
    [] strlen+0x0/0x22
    [] pmz_probe+0x34/0x88
    [] pmz_console_init+0x8/0x28
    [] console_init+0x1e/0x28
    [] printk+0x0/0x16
    [] start_kernel+0x368/0x4ce
    [] _sinittext+0x4f8/0xc48
    random: get_random_bytes called from print_oops_end_marker+0x56/0x80 with crng_init=0
    ---[ end trace 392d8e82eed68d6c ]---

    Commit a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid"),
    which introduced the WARNING, suggests that testing for irq == 0 is
    undesirable. Instead of that comparison, just test for resource existence.

    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Joshua Thompson
    Cc: Greg Kroah-Hartman
    Cc: Jiri Slaby
    Cc: stable@vger.kernel.org # v5.8+
    Reported-by: Laurent Vivier
    Signed-off-by: Finn Thain
    Link: https://lore.kernel.org/r/0c0fe1e4f11ccec202d4df09ea7d9d98155d101a.1606001297.git.fthain@telegraphics.com.au
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Finn Thain
     
  • [ Upstream commit 6e4e636e0e3e0b5deffc5e233adcb2cd4e68f2d0 ]

    The pm_runtime_enable will increase power disable depth.
    Thus a pairing decrement is needed on the error handling
    path to keep it balanced according to context.

    Fixes: e32a83c70cf98 ("serial: 8250-mtk: modify mtk uart power and clock management")
    Signed-off-by: Zhang Qilong
    Link: https://lore.kernel.org/r/20201119141126.168850-1-zhangqilong3@huawei.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Zhang Qilong
     

26 Dec, 2020

1 commit

  • commit 2f70e49ed860020f5abae4f7015018ebc10e1f0e upstream.

    At the moment opening a serial device node (such as /dev/ttyS3)
    succeeds even if there is no actual serial device behind it.
    Reading/writing/ioctls fail as expected because the uart port is not
    initialized (the type is PORT_UNKNOWN) and the TTY_IO_ERROR error state
    bit is set fot the tty.

    However setting line discipline does not have these checks
    8250_port.c (8250 is the default choice made by univ8250_console_init()).
    As the result of PORT_UNKNOWN, uart_port::iobase is NULL which
    a platform translates onto some address accessing which produces a crash
    like below.

    This adds tty_port_initialized() to uart_set_ldisc() to prevent the crash.

    Found by syzkaller.

    Signed-off-by: Alexey Kardashevskiy
    Link: https://lore.kernel.org/r/20201203055834.45838-1-aik@ozlabs.ru
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Alexey Kardashevskiy
     

21 Dec, 2020

1 commit

  • commit d96f04d347e4011977abdbb4da5d8f303ebd26f8 upstream.

    It has been observed that once per 300-1300 port openings the first
    transmitted byte is being corrupted on AM3352 ("v" written to FIFO appeared
    as "e" on the wire). It only happened if single byte has been transmitted
    right after port open, which means, DMA is not used for this transfer and
    the corruption never happened afterwards.

    Therefore I've carefully re-read the MDR1 errata (link below), which says
    "when accessing the MDR1 registers that causes a dummy under-run condition
    that will freeze the UART in IrDA transmission. In UART mode, this may
    corrupt the transferred data". Strictly speaking,
    omap_8250_mdr1_errataset() performs a read access and if the value is the
    same as should be written, exits without errata-recommended FIFO reset.

    A brief check of the serial_omap_mdr1_errataset() from the competing
    omap-serial driver showed it has no read access of MDR1. After removing the
    read access from omap_8250_mdr1_errataset() the data corruption never
    happened any more.

    Link: https://www.ti.com/lit/er/sprz360i/sprz360i.pdf
    Fixes: 61929cf0169d ("tty: serial: Add 8250-core based omap driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexander Sverdlin
    Link: https://lore.kernel.org/r/20201210055257.1053028-1-alexander.sverdlin@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Sverdlin
     

14 Dec, 2020

22 commits

  • Avoid to submit dma descriptor after dma chan terminated.

    Reviewed-by: Robin Gong
    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Clear RTSD status before suspend due to the port also
    use RTS pin as wakeup source.

    Reviewed-by: Richard Zhu
    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • When TX fifo has dirty data, user initialize the port and
    wait transmit engine complete, it should disable flow control,
    otherwise tx fifo never be empty.

    Tested-by: Yang Tian
    Reviewed-by: Richard Zhu
    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add LINFlexD FIFO mode support with DMA to avoid generating one interrupt
    per character and losing characters while copy-pasting. If the eDMA is not
    enabled, the LINFlexD driver will fall back to Buffer mode.

    The support is based on the version of the Freescale LPUART driver after
    the commit b3e3bf2ef2c7 ("Merge 4.0-rc7 into tty-next"). In addition, it
    includes multiple fixes for the ALB codebase:

    - The memory used to be corrupted when using DMA. The issue was easily seen
    when the SLUB allocator was used and that affected the RT patch. The
    corruption used to happen in linflex_dma_tx_complete(), when calling
    async_tx_ack(), because the function modified the memory freed in
    fsl_edma_free_desc(). DMA_CTRL_ACK, if cleared, the descriptor cannot be
    reused by provider until the client sends ACK, i.e. has a chance to
    establish any dependency chains. In our case, we don't need the
    descriptor after completion so we can set the flag in
    dmaengine_prep_slave_single();

    - When executing the 'reboot' command, the driver used to freeze inside a
    DMA transfer function because of the DTFTFF bit of the UARTSR register
    not being cleared. When operating using DMA, thus in FIFO mode, this bit
    is set and cleared by hardware to indicate whether or not the TX FIFO is
    full. The workaround was to write a NULL character to the device TX FIFO,
    thus causing it send said character and in turn clear the DTFTFF bit. The
    workaround is applied only after the boot sequence has been completed,
    with the assumption that a standard boot process does not take longer
    than 10 seconds to complete;

    - The DMA rx timeout is set according to the baud rate;

    - There was a deadlock between linflex_dma_rx_complete() and
    linflex_timer_func() caused by not disabling the timer when the DMA
    callback was called;

    - DMATXE is now enabled only after LINFlexD is configured to run in FIFO
    mode, as the reference manual indicates;

    - DMA is deactivated while calling linflex_console_write(), as the
    reference manual indicates;

    - In the open port function, we used to allocate memory without freeing it.
    The memory is now freed when we close the port.

    Signed-off-by: Stoica Cosmin-Stefan
    Signed-off-by: Larisa Grigore
    Signed-off-by: Adrian.Nitu
    Signed-off-by: Nica Dan
    Signed-off-by: Costea Ciprian
    Signed-off-by: Phu Luu An
    Signed-off-by: Stefan-Gabriel Mirea
    Reviewed-by: Fugang Duan

    Larisa Grigore
     
  • Baud rate is computed as LIN_CLK / (OSR × LDIV) when ROSE is 1 or
    LIN_CLK / (16 × LDIV) when ROSE is 0. LDIV is an unsigned fixed point
    number. The mantissa is coded into 20 bits of LINIBRR and the fraction is
    coded on 4 bits of LINFBRR, so setting the baud rate means setting LINFBRR
    and LINIBRR.

    LINIBRR is the integer part of LIN_CLK / (f(ROSE) * baud rate) and LINFBRR
    is the fractional part of it multiplied by 16, where f(ROSE) can be 16 or
    OSR value.

    Signed-off-by: Adrian.Nitu
    Signed-off-by: Stoica Cosmin-Stefan
    Signed-off-by: Larisa Grigore
    Signed-off-by: Stefan-Gabriel Mirea
    Reviewed-by: Fugang Duan

    Larisa Grigore
     
  • Make sure that the LINFlexD driver enables the LIN_CLK clock, which will be
    necessary when clock gating will be supported.

    The patch is based on the version of the Freescale LPUART driver after
    commit b3e3bf2ef2c7 ("Merge 4.0-rc7 into tty-next"), with just the LINFlexD
    serial clock name updated to "lin".

    Signed-off-by: Adrian.Nitu
    Signed-off-by: Stoica Cosmin-Stefan
    Signed-off-by: Stefan-Gabriel Mirea
    Reviewed-by: Fugang Duan

    Adrian.Nitu
     
  • Make the UART port a field of the linflex_port structure. Such containers
    will also include clock and DMA-related fields in the future.

    Signed-off-by: Adrian.Nitu
    Signed-off-by: Stoica Cosmin-Stefan
    Signed-off-by: Stefan-Gabriel Mirea
    Reviewed-by: Fugang Duan

    Adrian.Nitu
     
  • Disable UCR4_OREN bit in .stop_rx() to avoid endless
    interrupt happen while tty port is shuting down.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add two stop bits support.
    User can run the command to enable two stop bits
    for test: stty cstopb -F /dev/ttyLPx

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • When use lpuart with DMA mode as wake up source, it still switch to
    cpu mode in .suspend() that enable cpu interrupts RIE and ILIE as
    wakeup source. Enable the wakeup irq bits in .suspend_noirq() and
    disable the wakeup irq bits in .resume_noirq().

    For DMA mode, after system resume back, it needs to setup DMA again,
    if DMA setup is failed, it switchs to CPU mode. .resume() will share
    the HW setup code with .startup(), so abstract the same code to the
    api like lpuartx_hw_setup().

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add runtime pm support to manage lpuart clock and its power domain
    to save power in system idle and system suspend stages.

    Signed-off-by: Fugang Duan
    Reviewed-by: Robin Gong

    Fugang Duan
     
  • Do HW reset for communication port after the port is registered
    if the UART controller support the feature.

    Do partition reset with LPUART's power on, LPUART registers will
    keep the previous status, like on i.MX8QM platform, which is not
    expected action, so reset the HW is required.

    Currently, only i.MX7ULP and i.MX8QM LPUART controllers include
    global register that support HW reset.

    Tested-by: Robin Gong
    Tested-by: Peng Fan
    Reviewed-by: Robby Cai
    Signed-off-by: Fugang Duan
    (cherry picked from commit c2bc1f62ec28981462c9cb5ceac17134931ca19f)
    Signed-off-by: Arulpandiyan Vadivel
    Signed-off-by: Shrikant Bobade
    (cherry picked from commit 9f396f540093402317c3c1b9a8fe955b91c89164)

    Fugang Duan
     
  • There have a corner case that tx DMA .callback() is coming after
    .flush_buffer(), then .callback() should check dma_tx_in_progress
    flag and return in directly.

    Signed-off-by: Fugang Duan
    Signed-off-by: Vipul Kumar

    Fugang Duan
     
  • Enable lpuart32 loopback mode.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • imx8qxp lpuart support eDMA for dma mode, support EOP (end-of-packet)
    feature. But eDMA cannot detect the correct DADDR for current major
    loop in cyclic mode, so it doesn't support cyclic mode.

    The patch is to enable lpuart prep slave sg dma mode for imx8qxp.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Register offset needs to be applied on mapbase also.
    dma_tx/rx_request use the physical address of UARTDATA.
    Register offset is currently only applied to membase (the
    corresponding virtual addr) but not on mapbase.

    Reviewed-by: Leonard Crestez
    Acked-by: Fugang Duan
    Signed-off-by: Adriana Reus

    Andy Duan
     
  • Add magic SysRq key support.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add modem device reset, wthether to reset depend on dts configuration.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • lpuart dma mode depends on dma channel's power domain like:
    power-domains = ,
    ,
    ;
    power-domain-names = "uart", "rxdma", "txdma";

    So define the multiple power domain for lpuart.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add modem device reset for Bluetooth device.
    The device reset is optional.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add busfreq and pm qos support for DMA mode.

    DMA mode cannot work stablely at low busfreq mode, so request
    high busfreq once DMA is enabled.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • The IP module clock maximum clock rate is 80MHz, Once the module
    clock is great than 80MHz, there may have risk.

    So set the maximum module clock to 80MHz.

    Signed-off-by: Fugang Duan

    Fugang Duan
     

05 Dec, 2020

2 commits

  • Currently, locking of ->session is very inconsistent; most places
    protect it using the legacy tty mutex, but disassociate_ctty(),
    __do_SAK(), tiocspgrp() and tiocgsid() don't.
    Two of the writers hold the ctrl_lock (because they already need it for
    ->pgrp), but __proc_set_tty() doesn't do that yet.

    On a PREEMPT=y system, an unprivileged user can theoretically abuse
    this broken locking to read 4 bytes of freed memory via TIOCGSID if
    tiocgsid() is preempted long enough at the right point. (Other things
    might also go wrong, especially if root-only ioctls are involved; I'm
    not sure about that.)

    Change the locking on ->session such that:

    - tty_lock() is held by all writers: By making disassociate_ctty()
    hold it. This should be fine because the same lock can already be
    taken through the call to tty_vhangup_session().
    The tricky part is that we need to shorten the area covered by
    siglock to be able to take tty_lock() without ugly retry logic; as
    far as I can tell, this should be fine, since nothing in the
    signal_struct is touched in the `if (tty)` branch.
    - ctrl_lock is held by all writers: By changing __proc_set_tty() to
    hold the lock a little longer.
    - All readers that aren't holding tty_lock() hold ctrl_lock: By
    adding locking to tiocgsid() and __do_SAK(), and expanding the area
    covered by ctrl_lock in tiocspgrp().

    Cc: stable@kernel.org
    Signed-off-by: Jann Horn
    Reviewed-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     
  • tiocspgrp() takes two tty_struct pointers: One to the tty that userspace
    passed to ioctl() (`tty`) and one to the TTY being changed (`real_tty`).
    These pointers are different when ioctl() is called with a master fd.

    To properly lock real_tty->pgrp, we must take real_tty->ctrl_lock.

    This bug makes it possible for racing ioctl(TIOCSPGRP, ...) calls on
    both sides of a PTY pair to corrupt the refcount of `struct pid`,
    leading to use-after-free errors.

    Fixes: 47f86834bbd4 ("redo locking of tty->pgrp")
    CC: stable@kernel.org
    Signed-off-by: Jann Horn
    Reviewed-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     

12 Nov, 2020

3 commits

  • ar933x_uart_probe() does not invoke clk_disable_unprepare()
    on one error handling path. This patch fixes that.

    Fixes: 9be1064fe524 ("serial: ar933x_uart: add RS485 support")
    Reported-by: Hulk Robot
    Signed-off-by: Zheng Zengkai
    Link: https://lore.kernel.org/r/20201111124426.42638-1-zhengzengkai@huawei.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Zheng Zengkai
     
  • For below code, there has chance to cause deadlock in SMP system:
    Thread 1:
    clk_enable_lock();
    pr_info("debug message");
    clk_enable_unlock();

    Thread 2:
    imx_uart_console_write()
    clk_enable()
    clk_enable_lock();

    Thread 1:
    Acuired clk enable_lock -> printk -> console_trylock_spinning
    Thread 2:
    console_unlock() -> imx_uart_console_write -> clk_disable -> Acquite clk enable_lock

    So the patch is to keep console port clocks always on like
    other console drivers.

    Fixes: 1cf93e0d5488 ("serial: imx: remove the uart_console() check")
    Acked-by: Uwe Kleine-König
    Signed-off-by: Fugang Duan
    Link: https://lore.kernel.org/r/20201111025136.29818-1-fugang.duan@nxp.com
    Cc: stable
    [fix up build warning - gregkh]
    Signed-off-by: Greg Kroah-Hartman

    Fugang Duan
     
  • Enabling the lock dependency validator has revealed
    that the way spinlocks are used in the IMX serial
    port could result in a deadlock.

    Specifically, imx_uart_int() acquires a spinlock
    without disabling the interrupts, meaning that another
    interrupt could come along and try to acquire the same
    spinlock, potentially causing the two to wait for each
    other indefinitely.

    Use spin_lock_irqsave() instead to disable interrupts
    upon acquisition of the spinlock.

    Fixes: c974991d2620 ("tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr")
    Reviewed-by: Uwe Kleine-König
    Signed-off-by: Sam Nobs
    Link: https://lore.kernel.org/r/1604955006-9363-1-git-send-email-samuel.nobs@taitradio.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Sam Nobs
     

09 Nov, 2020

2 commits

  • Pull tty/serial fixes from Greg KH:
    "Here are a small number of small tty and serial fixes for some
    reported problems for the tty core, vt code, and some serial drivers.

    They include fixes for:

    - a buggy and obsolete vt font ioctl removal

    - 8250_mtk serial baudrate runtime warnings

    - imx serial earlycon build configuration fix

    - txx9 serial driver error path cleanup issues

    - tty core fix in release_tty that can be triggered by trying to bind
    an invalid serial port name to a speakup console device

    Almost all of these have been in linux-next without any problems, the
    only one that hasn't, just deletes code :)"

    * tag 'tty-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
    vt: Disable KD_FONT_OP_COPY
    tty: fix crash in release_tty if tty->port is not set
    serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init
    tty: serial: imx: enable earlycon by default if IMX_SERIAL_CONSOLE is enabled
    serial: 8250_mtk: Fix uart_get_baud_rate warning

    Linus Torvalds
     
  • It's buggy:

    On Fri, Nov 06, 2020 at 10:30:08PM +0800, Minh Yuan wrote:
    > We recently discovered a slab-out-of-bounds read in fbcon in the latest
    > kernel ( v5.10-rc2 for now ). The root cause of this vulnerability is that
    > "fbcon_do_set_font" did not handle "vc->vc_font.data" and
    > "vc->vc_font.height" correctly, and the patch
    > for VT_RESIZEX can't handle this
    > issue.
    >
    > Specifically, we use KD_FONT_OP_SET to set a small font.data for tty6, and
    > use KD_FONT_OP_SET again to set a large font.height for tty1. After that,
    > we use KD_FONT_OP_COPY to assign tty6's vc_font.data to tty1's vc_font.data
    > in "fbcon_do_set_font", while tty1 retains the original larger
    > height. Obviously, this will cause an out-of-bounds read, because we can
    > access a smaller vc_font.data with a larger vc_font.height.

    Further there was only one user ever.
    - Android's loadfont, busybox and console-tools only ever use OP_GET
    and OP_SET
    - fbset documentation only mentions the kernel cmdline font: option,
    not anything else.
    - systemd used OP_COPY before release 232 published in Nov 2016

    Now unfortunately the crucial report seems to have gone down with
    gmane, and the commit message doesn't say much. But the pull request
    hints at OP_COPY being broken

    https://github.com/systemd/systemd/pull/3651

    So in other words, this never worked, and the only project which
    foolishly every tried to use it, realized that rather quickly too.

    Instead of trying to fix security issues here on dead code by adding
    missing checks, fix the entire thing by removing the functionality.

    Note that systemd code using the OP_COPY function ignored the return
    value, so it doesn't matter what we're doing here really - just in
    case a lone server somewhere happens to be extremely unlucky and
    running an affected old version of systemd. The relevant code from
    font_copy_to_all_vcs() in systemd was:

    /* copy font from active VT, where the font was uploaded to */
    cfo.op = KD_FONT_OP_COPY;
    cfo.height = vcs.v_active-1; /* tty1 == index 0 */
    (void) ioctl(vcfd, KDFONTOP, &cfo);

    Note this just disables the ioctl, garbage collecting the now unused
    callbacks is left for -next.

    v2: Tetsuo found the old mail, which allowed me to find it on another
    archive. Add the link too.

    Acked-by: Peilin Ye
    Reported-by: Minh Yuan
    References: https://lists.freedesktop.org/archives/systemd-devel/2016-June/036935.html
    References: https://github.com/systemd/systemd/pull/3651
    Cc: Greg KH
    Cc: Peilin Ye
    Cc: Tetsuo Handa
    Signed-off-by: Daniel Vetter
    Link: https://lore.kernel.org/r/20201108153806.3140315-1-daniel.vetter@ffwll.ch
    Signed-off-by: Greg Kroah-Hartman

    Daniel Vetter
     

07 Nov, 2020

4 commits

  • Commit 2ae0b31e0face ("tty: don't crash in tty_init_dev when missing
    tty_port") didn't fully prevent the crash as the cleanup path in
    tty_init_dev() calls release_tty() which dereferences tty->port
    without checking it for non-null.

    Add tty->port checks to release_tty to avoid the kernel crash.

    Fixes: 2ae0b31e0face ("tty: don't crash in tty_init_dev when missing tty_port")
    Signed-off-by: Matthias Reichl
    Link: https://lore.kernel.org/r/20201105123432.4448-1-hias@horus.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Matthias Reichl
     
  • Add the missing platform_driver_unregister() before return
    from serial_txx9_init in the error handling case when failed
    to register serial_txx9_pci_driver with macro ENABLE_SERIAL_TXX9_PCI
    defined.

    Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
    Signed-off-by: Qinglang Miao
    Link: https://lore.kernel.org/r/20201103084942.109076-1-miaoqinglang@huawei.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Qinglang Miao
     
  • Since 699cc4dfd140 (tty: serial: imx: add imx earlycon driver), the earlycon
    part of imx serial is a separate driver and isn't necessarily enabled anymore
    when the console is enabled. This causes users to loose the earlycon
    functionality when upgrading their kenrel configuration via oldconfig.

    Enable earlycon by default when IMX_SERIAL_CONSOLE is enabled.

    Fixes: 699cc4dfd140 (tty: serial: imx: add imx earlycon driver)
    Reviewed-by: Fabio Estevam
    Reviewed-by: Fugang Duan
    Signed-off-by: Lucas Stach
    Link: https://lore.kernel.org/r/20201105204026.1818219-1-l.stach@pengutronix.de
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Lucas Stach
     
  • Mediatek 8250 port supports speed higher than uartclk / 16. If the baud
    rates in both the new and the old termios setting are higher than
    uartclk / 16, the WARN_ON in uart_get_baud_rate() will be triggered.
    Passing NULL as the old termios so uart_get_baud_rate() will use
    uartclk / 16 - 1 as the new baud rate which will be replaced by the
    original baud rate later by tty_termios_encode_baud_rate() in
    mtk8250_set_termios().

    Fixes: 551e553f0d4a ("serial: 8250_mtk: Fix high-speed baud rates clamping")
    Signed-off-by: Claire Chang
    Link: https://lore.kernel.org/r/20201102120749.374458-1-tientzu@chromium.org
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Claire Chang