No description
Find a file
Ilpo Järvinen fc8548c75c serial: 8250_dma: Fix DMA Rx rearm race
commit 57e9af7831 upstream.

As DMA Rx can be completed from two places, it is possible that DMA Rx
completes before DMA completion callback had a chance to complete it.
Once the previous DMA Rx has been completed, a new one can be started
on the next UART interrupt. The following race is possible
(uart_unlock_and_check_sysrq_irqrestore() replaced with
spin_unlock_irqrestore() for simplicity/clarity):

CPU0					CPU1
					dma_rx_complete()
serial8250_handle_irq()
  spin_lock_irqsave(&port->lock)
  handle_rx_dma()
    serial8250_rx_dma_flush()
      __dma_rx_complete()
        dma->rx_running = 0
        // Complete DMA Rx
  spin_unlock_irqrestore(&port->lock)

serial8250_handle_irq()
  spin_lock_irqsave(&port->lock)
  handle_rx_dma()
    serial8250_rx_dma()
      dma->rx_running = 1
      // Setup a new DMA Rx
  spin_unlock_irqrestore(&port->lock)

					  spin_lock_irqsave(&port->lock)
					  // sees dma->rx_running = 1
					  __dma_rx_complete()
					    dma->rx_running = 0
					    // Incorrectly complete
					    // running DMA Rx

This race seems somewhat theoretical to occur for real but handle it
correctly regardless. Check what is the DMA status before complething
anything in __dma_rx_complete().

Reported-by: Gilles BULOZ <gilles.buloz@kontron.com>
Tested-by: Gilles BULOZ <gilles.buloz@kontron.com>
Fixes: 9ee4b83e51 ("serial: 8250: Add support for dmaengine")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230130114841.25749-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-22 12:50:29 +01:00
arch riscv: disable generation of unwind tables 2023-02-22 12:50:28 +01:00
block blk-cgroup: fix missing pd_online_fn() while activating policy 2023-02-06 07:52:48 +01:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:11:22 +02:00
crypto crypto: tcrypt - Fix multibuffer skcipher speed test mem leak 2023-01-18 11:41:19 +01:00
Documentation docs: Fix path paste-o for /sys/kernel/warn_count 2023-02-06 07:52:50 +01:00
drivers serial: 8250_dma: Fix DMA Rx rearm race 2023-02-22 12:50:29 +01:00
fs Squashfs: fix handling and sanity checking of xattr_ids count 2023-02-22 12:50:28 +01:00
include mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps 2023-02-22 12:50:28 +01:00
init init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash 2022-12-08 11:22:59 +01:00
ipc ipc/sem: Fix dangling sem_array access in semtimedop race 2022-12-08 11:23:06 +01:00
kernel exit: Use READ_ONCE() for all oops/warn limit reads 2023-02-06 07:52:50 +01:00
lib netlink: prevent potential spectre v1 gadgets 2023-02-06 07:52:45 +01:00
LICENSES
mm mm: swap: properly update readahead statistics in unuse_pte_range() 2023-02-22 12:50:29 +01:00
net xprtrdma: Fix regbuf data not freed in rpcrdma_req_create() 2023-02-22 12:50:29 +01:00
samples samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe() 2023-01-18 11:41:26 +01:00
scripts ftrace/scripts: Update the instructions for ftrace-bisect.sh 2023-02-06 07:52:44 +01:00
security tomoyo: fix broken dependency on *.conf.default 2023-02-06 07:52:35 +01:00
sound ALSA: hda/via: Avoid potential array out-of-bound in add_secret_dac_path() 2023-02-22 12:50:23 +01:00
tools selftests: net: udpgso_bench_tx: Cater for pending datagrams zerocopy benchmarking 2023-02-22 12:50:25 +01:00
usr initramfs: restore default compression behavior 2020-04-08 09:08:38 +02:00
virt KVM: arm64: vgic: Fix exit condition in scan_its_table() 2022-10-29 10:20:35 +02:00
.clang-format clang-format: Update with the latest for_each macro list 2019-08-31 10:00:51 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Modules updates for v5.4 2019-09-22 10:34:46 -07:00
.mailmap ARM: SoC fixes 2019-11-10 13:41:59 -08:00
COPYING
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer 2019-10-10 08:12:51 -07:00
Kbuild
Kconfig
MAINTAINERS net/phy/mdio-i2c: Move header file to include/linux/mdio 2023-02-06 07:52:46 +01:00
Makefile Linux 5.4.231 2023-02-06 07:52:51 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.