stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Peter Rosin <peda@axentia.se>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: [PATCH 5.10 86/95] dmaengine: at_hdmac: Fix concurrency over descriptor
Date: Mon, 14 Nov 2022 13:46:20 +0100	[thread overview]
Message-ID: <20221114124446.093216587@linuxfoundation.org> (raw)
In-Reply-To: <20221114124442.530286937@linuxfoundation.org>

From: Tudor Ambarus <tudor.ambarus@microchip.com>

commit 06988949df8c3007ad82036d3606d8ae72ed9000 upstream.

The descriptor was added to the free_list before calling the callback,
which could result in reissuing of the same descriptor and calling of a
single callback for both. Move the decriptor to the free list after the
callback is invoked.

Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20221025090306.297886-1-tudor.ambarus@microchip.com
Link: https://lore.kernel.org/r/20221025090306.297886-9-tudor.ambarus@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/at_hdmac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -450,11 +450,8 @@ atc_chain_complete(struct at_dma_chan *a
 		desc->memset_buffer = false;
 	}
 
-	/* move children to free_list */
-	list_splice_init(&desc->tx_list, &atchan->free_list);
-	/* move myself to free_list */
-	list_move(&desc->desc_node, &atchan->free_list);
-
+	/* Remove transfer node from the active list. */
+	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
 	dma_descriptor_unmap(txd);
@@ -464,6 +461,13 @@ atc_chain_complete(struct at_dma_chan *a
 		dmaengine_desc_get_callback_invoke(txd, NULL);
 
 	dma_run_dependencies(txd);
+
+	spin_lock_irqsave(&atchan->lock, flags);
+	/* move children to free_list */
+	list_splice_init(&desc->tx_list, &atchan->free_list);
+	/* add myself to free_list */
+	list_add(&desc->desc_node, &atchan->free_list);
+	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
 /**



  parent reply	other threads:[~2022-11-14 12:51 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 12:44 [PATCH 5.10 00/95] 5.10.155-rc1 review Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 01/95] fuse: fix readdir cache race Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 02/95] hwspinlock: qcom: correct MMIO max register for newer SoCs Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 03/95] phy: stm32: fix an error code in probe Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 04/95] wifi: cfg80211: silence a sparse RCU warning Greg Kroah-Hartman
2022-11-14 12:44 ` [PATCH 5.10 05/95] wifi: cfg80211: fix memory leak in query_regdb_file() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 06/95] bpf, sockmap: Fix the sk->sk_forward_alloc warning of sk_stream_kill_queues Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 07/95] bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 08/95] HID: hyperv: fix possible memory leak in mousevsc_probe() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 09/95] bpf: Support for pointers beyond pkt_end Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 10/95] bpf: Add helper macro bpf_for_each_reg_in_vstate Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 11/95] bpf: Fix wrong reg type conversion in release_reference() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 12/95] net: gso: fix panic on frag_list with mixed head alloc types Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 13/95] macsec: delete new rxsc when offload fails Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 14/95] macsec: fix secy->n_rx_sc accounting Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 15/95] macsec: fix detection of RXSCs when toggling offloading Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 16/95] macsec: clear encryption keys from the stack after setting up offload Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 17/95] net: tun: Fix memory leaks of napi_get_frags Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 18/95] bnxt_en: Fix possible crash in bnxt_hwrm_set_coal() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 19/95] bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 20/95] net: fman: Unregister ethernet device on removal Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 21/95] capabilities: fix undefined behavior in bit shift for CAP_TO_MASK Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 22/95] KVM: s390x: fix SCK locking Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 23/95] KVM: s390: pv: dont allow userspace to set the clock under PV Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 24/95] net: lapbether: fix issue of dev reference count leakage in lapbeth_device_event() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 25/95] hamradio: fix issue of dev reference count leakage in bpq_device_event() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 26/95] drm/vc4: Fix missing platform_unregister_drivers() call in vc4_drm_register() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 27/95] tcp: prohibit TCP_REPAIR_OPTIONS if data was already sent Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 28/95] ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network Greg Kroah-Hartman
2022-11-14 12:48   ` syzbot
2022-11-14 12:45 ` [PATCH 5.10 29/95] can: af_can: fix NULL pointer dereference in can_rx_register() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 30/95] net: stmmac: dwmac-meson8b: fix meson8b_devm_clk_prepare_enable() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 31/95] net: broadcom: Fix BCMGENET Kconfig Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 32/95] tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 33/95] dmaengine: pxa_dma: use platform_get_irq_optional Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 34/95] dmaengine: mv_xor_v2: Fix a resource leak in mv_xor_v2_remove() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 35/95] drivers: net: xgene: disable napi when register irq failed in xgene_enet_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 36/95] perf stat: Fix printing os->prefix in CSV metrics output Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 37/95] net: marvell: prestera: fix memory leak in prestera_rxtx_switch_init() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 38/95] net: nixge: disable napi when enable interrupts failed in nixge_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 39/95] net/mlx5: Allow async trigger completion execution on single CPU systems Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 40/95] net/mlx5e: E-Switch, Fix comparing termination table instance Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 41/95] net: cpsw: disable napi in cpsw_ndo_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 42/95] net: cxgb3_main: disable napi when bind qsets failed in cxgb_up() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 43/95] cxgb4vf: shut down the adapter when t4vf_update_port_info() failed in cxgb4vf_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 44/95] net: phy: mscc: macsec: clear encryption keys when freeing a flow Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 45/95] net: atlantic: macsec: clear encryption keys from the stack Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 46/95] ethernet: s2io: disable napi when start nic failed in s2io_card_up() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 47/95] net: mv643xx_eth: disable napi when init rxq or txq failed in mv643xx_eth_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 48/95] ethernet: tundra: free irq when alloc ring failed in tsi108_open() Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 49/95] net: macvlan: fix memory leaks of macvlan_common_newlink Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 50/95] riscv: process: fix kernel info leakage Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 51/95] riscv: vdso: fix build with llvm Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 52/95] riscv: Enable CMA support Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 53/95] riscv: Separate memory init from paging init Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 54/95] riscv: fix reserved memory setup Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 55/95] arm64: efi: Fix handling of misaligned runtime regions and drop warning Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 56/95] MIPS: jump_label: Fix compat branch range check Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 57/95] mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 58/95] mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 59/95] mmc: sdhci_am654: " Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 60/95] mmc: sdhci-tegra: " Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 61/95] ALSA: hda/hdmi - enable runtime pm for more AMD display audio Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 62/95] ALSA: hda/ca0132: add quirk for EVGA Z390 DARK Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 63/95] ALSA: hda: fix potential memleak in add_widget_node Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 64/95] ALSA: hda/realtek: Add Positivo C6300 model quirk Greg Kroah-Hartman
2022-11-14 12:45 ` [PATCH 5.10 65/95] ALSA: usb-audio: Add quirk entry for M-Audio Micro Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 66/95] ALSA: usb-audio: Add DSD support for Accuphase DAC-60 Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 67/95] vmlinux.lds.h: Fix placement of .data..decrypted section Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 68/95] ata: libata-scsi: fix SYNCHRONIZE CACHE (16) command failure Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 69/95] nilfs2: fix deadlock in nilfs_count_free_blocks() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 70/95] nilfs2: fix use-after-free bug of ns_writer on remount Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 71/95] drm/i915/dmabuf: fix sg_table handling in map_dma_buf Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 72/95] platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 73/95] btrfs: selftests: fix wrong error check in btrfs_free_dummy_root() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 74/95] mms: sdhci-esdhc-imx: Fix SDHCI_RESET_ALL for CQHCI Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 75/95] udf: Fix a slab-out-of-bounds write bug in udf_find_entry() Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 76/95] mm/memremap.c: map FS_DAX device memory as decrypted Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 77/95] can: j1939: j1939_send_one(): fix missing CAN header initialization Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 78/95] cert host tools: Stop complaining about deprecated OpenSSL functions Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 79/95] dmaengine: at_hdmac: Fix at_lli struct definition Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 80/95] dmaengine: at_hdmac: Dont start transactions at tx_submit level Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 81/95] dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 82/95] dmaengine: at_hdmac: Fix premature completion of desc " Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 83/95] dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 84/95] dmaengine: at_hdmac: Protect atchan->status with the channel lock Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 85/95] dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all() Greg Kroah-Hartman
2022-11-14 12:46 ` Greg Kroah-Hartman [this message]
2022-11-14 12:46 ` [PATCH 5.10 87/95] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 88/95] dmaengine: at_hdmac: Fix concurrency over the active list Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 89/95] dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 90/95] dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 91/95] dmaengine: at_hdmac: Dont allow CPU to reorder channel enable Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 92/95] dmaengine: at_hdmac: Fix impossible condition Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 93/95] dmaengine: at_hdmac: Check return code of dma_async_device_register Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 94/95] net: tun: call napi_schedule_prep() to ensure we own a napi Greg Kroah-Hartman
2022-11-14 12:46 ` [PATCH 5.10 95/95] mmc: sdhci-esdhc-imx: Convert the driver to DT-only Greg Kroah-Hartman
2022-11-14 18:35 ` [PATCH 5.10 00/95] 5.10.155-rc1 review Pavel Machek
2022-11-14 20:20 ` Shuah Khan
2022-11-14 21:06 ` Slade Watkins
2022-11-14 21:44 ` Florian Fainelli
2022-11-15  0:12 ` Guenter Roeck
2022-11-15 10:50 ` Sudip Mukherjee
2022-11-15 10:58 ` Naresh Kamboju
2022-11-15 11:49 ` Rudi Heitbaum
2022-11-16  1:44 ` zhouzhixiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114124446.093216587@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=patches@lists.linux.dev \
    --cc=peda@axentia.se \
    --cc=stable@vger.kernel.org \
    --cc=tudor.ambarus@microchip.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).