Skip to content
Snippets Groups Projects
  1. Apr 12, 2022
  2. Apr 11, 2022
  3. Apr 02, 2022
    • Serge Semin's avatar
      serial: 8250: Fix max baud limit in generic 8250 port · 5597897f
      Serge Semin authored
      
      stable inclusion
      from linux-4.19.130
      commit 0eeaf62981ecc79e8395ca8caa1570eaf3a12257
      category: bugfix
      bugzilla: 89545
      CVE: N/A
      
      ------------------------------------------------
      
      [ Upstream commit 7b668c06 ]
      
      Standard 8250 UART ports are designed in a way so they can communicate
      with baud rates up to 1/16 of a reference frequency. It's expected from
      most of the currently supported UART controllers. That's why the former
      version of serial8250_get_baud_rate() method called uart_get_baud_rate()
      with min and max baud rates passed as (port->uartclk / 16 / UART_DIV_MAX)
      and ((port->uartclk + tolerance) / 16) respectively. Doing otherwise, like
      it was suggested in commit ("serial: 8250_mtk: support big baud rate."),
      caused acceptance of bauds, which was higher than the normal UART
      controllers actually supported. As a result if some user-space program
      requested to set a baud greater than (uartclk / 16) it would have been
      permitted without truncation, but then serial8250_get_divisor(baud)
      (which calls uart_get_divisor() to get the reference clock divisor) would
      have returned a zero divisor. Setting zero divisor will cause an
      unpredictable effect varying from chip to chip. In case of DW APB UART the
      communications just stop.
      
      Lets fix this problem by getting back the limitation of (uartclk +
      tolerance) / 16 maximum baud supported by the generic 8250 port. Mediatek
      8250 UART ports driver developer shouldn't have touched it in the first
      place  notably seeing he already provided a custom version of set_termios()
      callback in that glue-driver which took into account the extended baud
      rate values and accordingly updated the standard and vendor-specific
      divisor latch registers anyway.
      
      Fixes: 81bb549f ("serial: 8250_mtk: support big baud rate.")
      Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
      Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Long Cheng <long.cheng@mediatek.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mediatek@lists.infradead.org
      Link: https://lore.kernel.org/r/20200506233136.11842-2-Sergey.Semin@baikalelectronics.ru
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYi Yang <yiyang13@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
    • Zhang Qiao's avatar
      sched/fair: Add qos_throttle_list node in struct cfs_rq · fb59563c
      Zhang Qiao authored
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I50PPU
      
      
      CVE: NA
      
      -----------------------------------------------------------------
      
      when unthrottle a cfs_rq at distribute_cfs_runtime(), another cpu
      may re-throttle this cfs_rq at qos_throttle_cfs_rq() before access
      the cfs_rq->throttle_list.next, but meanwhile, qos throttle will
      attach the cfs_rq throttle_list node to percpu qos_throttled_cfs_rq,
      it will change cfs_rq->throttle_list.next and cause panic or hardlockup
      at distribute_cfs_runtime().
      
      Fix it by adding a qos_throttle_list node in struct cfs_rq, and qos
      throttle disuse the cfs_rq->throttle_list.
      
      Signed-off-by: default avatarZhang Qiao <zhangqiao22@huawei.com>
      Reviewed-by: default avatarzheng zucheng <zhengzucheng@huawei.com>
      Reviewed-by: default avatarChen Hui <judy.chenhui@huawei.com>
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
      fb59563c