From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Maxime Jayat <maxime.jayat@mobile-devices.fr>,
Ludovic Desroches <ludovic.desroches@microchip.com>,
Vinod Koul <vinod.koul@intel.com>
Subject: [PATCH 4.4 56/97] dmaengine: at_xdmac: fix rare residue corruption
Date: Sun, 22 Apr 2018 15:53:34 +0200 [thread overview]
Message-ID: <20180422135308.405196681@linuxfoundation.org> (raw)
In-Reply-To: <20180422135304.577223025@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Jayat <maxime.jayat@mobile-devices.fr>
commit c5637476bbf9bb86c7f0413b8f4822a73d8d2d07 upstream.
Despite the efforts made to correctly read the NDA and CUBC registers,
the order in which the registers are read could sometimes lead to an
inconsistent state.
Re-using the timeline from the comments, this following timing of
registers reads could lead to reading NDA with value "@desc2" and
CUBC with value "MAX desc1":
INITD -------- ------------
|____________________|
_______________________ _______________
NDA @desc2 \/ @desc3
_______________________/\_______________
__________ ___________ _______________
CUBC 0 \/ MAX desc1 \/ MAX desc2
__________/\___________/\_______________
| | | |
Events:(1)(2) (3)(4)
(1) check_nda = @desc2
(2) initd = 1
(3) cur_ubc = MAX desc1
(4) cur_nda = @desc2
This is allowed by the condition ((check_nda == cur_nda) && initd),
despite cur_ubc and cur_nda being in the precise state we don't want.
This error leads to incorrect residue computation.
Fix it by inversing the order in which CUBC and INITD are read. This
makes sure that NDA and CUBC are always read together either _before_
INITD goes to 0 or _after_ it is back at 1.
The case where NDA is read before INITD is at 0 and CUBC is read after
INITD is back at 1 will be rejected by check_nda and cur_nda being
different.
Fixes: 53398f488821 ("dmaengine: at_xdmac: fix residue corruption")
Cc: stable@vger.kernel.org
Signed-off-by: Maxime Jayat <maxime.jayat@mobile-devices.fr>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/dma/at_xdmac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1473,10 +1473,10 @@ at_xdmac_tx_status(struct dma_chan *chan
for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) {
check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
rmb();
- initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);
- rmb();
cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
rmb();
+ initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);
+ rmb();
cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
rmb();
next prev parent reply other threads:[~2018-04-22 14:17 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-22 13:52 [PATCH 4.4 00/97] 4.4.129-stable review Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 01/97] media: v4l2-compat-ioctl32: dont oops on overlay Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 02/97] parisc: Fix out of array access in match_pci_device() Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 03/97] perf intel-pt: Fix overlap detection to identify consecutive buffers correctly Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 04/97] perf intel-pt: Fix sync_switch Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 05/97] perf intel-pt: Fix error recovery from missing TIP packet Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 06/97] perf intel-pt: Fix timestamp following overflow Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 08/97] Revert "perf tests: Decompress kernel module before objdump" Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 09/97] block/loop: fix deadlock after loop_set_status Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 10/97] s390/qdio: dont retry EQBS after CCQ 96 Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 11/97] s390/qdio: dont merge ERROR output buffers Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 12/97] s390/ipl: ensure loadparm valid flag is set Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 13/97] getname_kernel() needs to make sure that ->name != ->iname in long case Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 14/97] rtl8187: Fix NULL pointer dereference in priv->conf_mutex Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 15/97] hwmon: (ina2xx) Fix access to uninitialized mutex Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 16/97] cdc_ether: flag the Cinterion AHS8 modem by gemalto as WWAN Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 17/97] slip: Check if rstate is initialized before uncompressing Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 18/97] lan78xx: Correctly indicate invalid OTP Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 19/97] x86/hweight: Get rid of the special calling convention Greg Kroah-Hartman
2018-04-22 13:52 ` [PATCH 4.4 21/97] tty: make n_tty_read() always abort if hangup is in progress Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 22/97] ubifs: Check ubifs_wbuf_sync() return code Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 23/97] ubi: fastmap: Dont flush fastmap work on detach Greg Kroah-Hartman
2018-05-16 16:53 ` Ben Hutchings
2018-05-16 17:37 ` Richard Weinberger
2018-04-22 13:53 ` [PATCH 4.4 24/97] ubi: Fix error for write access Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 25/97] ubi: Reject MLC NAND Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 26/97] fs/reiserfs/journal.c: add missing resierfs_warning() arg Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 27/97] resource: fix integer overflow at reallocation Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 28/97] ipc/shm: fix use-after-free of shm file via remap_file_pages() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 29/97] mm, slab: reschedule cache_reap() on the same CPU Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 30/97] usb: musb: gadget: misplaced out of bounds check Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 31/97] ARM: dts: at91: at91sam9g25: fix mux-mask pinctrl property Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 32/97] ARM: dts: at91: sama5d4: fix pinctrl compatible string Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 33/97] xen-netfront: Fix hang on device removal Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 34/97] regmap: Fix reversed bounds check in regmap_raw_write() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 35/97] ACPI / video: Add quirk to force acpi-video backlight on Samsung 670Z5E Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 36/97] ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 38/97] usb: dwc3: pci: Properly cleanup resource Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 39/97] HID: i2c-hid: fix size check and type usage Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 40/97] powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 41/97] powerpc/64: Fix smp_wmb barrier definition use use lwsync consistently Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 42/97] powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 43/97] HID: Fix hid_report_len usage Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 44/97] HID: core: Fix size as type u32 Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 45/97] ASoC: ssm2602: Replace reg_default_raw with reg_default Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 46/97] thunderbolt: Resume control channel after hibernation image is created Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 47/97] random: use a tighter cap in credit_entropy_bits_safe() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 48/97] jbd2: if the journal is aborted then dont allow update of the log tail Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 49/97] ext4: dont update checksum of new initialized bitmaps Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 50/97] ext4: add validity checks for bitmap block numbers Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 51/97] ext4: fail ext4_iget for root directory if unallocated Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 52/97] RDMA/ucma: Dont allow setting RDMA_OPTION_IB_PATH without an RDMA device Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 53/97] ALSA: pcm: Fix UAF at PCM release via PCM timer access Greg Kroah-Hartman
2018-05-16 20:51 ` Ben Hutchings
2018-05-16 22:09 ` Takashi Iwai
2018-05-17 8:54 ` Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 54/97] IB/srp: Fix srp_abort() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 55/97] IB/srp: Fix completion vector assignment algorithm Greg Kroah-Hartman
2018-04-22 13:53 ` Greg Kroah-Hartman [this message]
2018-04-22 13:53 ` [PATCH 4.4 57/97] um: Use POSIX ucontext_t instead of struct ucontext Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 58/97] iommu/vt-d: Fix a potential memory leak Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 59/97] mmc: jz4740: Fix race condition in IRQ mask update Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 60/97] clk: mvebu: armada-38x: add support for 1866MHz variants Greg Kroah-Hartman
2018-05-16 23:32 ` Ben Hutchings
2018-05-16 23:34 ` Ben Hutchings
2018-04-22 13:53 ` [PATCH 4.4 61/97] clk: mvebu: armada-38x: add support for missing clocks Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 62/97] clk: bcm2835: De-assert/assert PLL reset signal when appropriate Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 63/97] thermal: imx: Fix race condition in imx_thermal_probe() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 64/97] watchdog: f71808e_wdt: Fix WD_EN register read Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 65/97] ALSA: oss: consolidate kmalloc/memset 0 call to kzalloc Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 66/97] ALSA: pcm: Use ERESTARTSYS instead of EINTR in OSS emulation Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 67/97] ALSA: pcm: Avoid potential races between OSS ioctls and read/write Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 68/97] ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 69/97] ALSA: pcm: Fix mutex unbalance in OSS emulation ioctls Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 70/97] ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 71/97] vfio-pci: Virtualize PCIe & AF FLR Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 72/97] vfio/pci: Virtualize Maximum Payload Size Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 73/97] vfio/pci: Virtualize Maximum Read Request Size Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 74/97] ext4: dont allow r/w mounts if metadata blocks overlap the superblock Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 76/97] ext4: fix crashes in dioread_nolock mode Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 77/97] ext4: fix deadlock between inline_data and ext4_expand_extra_isize_ea() Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 79/97] ALSA: rawmidi: Fix missing input substream checks in compat ioctls Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 80/97] ALSA: hda - New VIA controller suppor no-snoop path Greg Kroah-Hartman
2018-04-22 13:53 ` [PATCH 4.4 81/97] HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 82/97] MIPS: uaccess: Add micromips clobbers to bzero invocation Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 83/97] MIPS: memset.S: EVA & fault support for small_memset Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 84/97] MIPS: memset.S: Fix return of __clear_user from Lpartial_fixup Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 85/97] MIPS: memset.S: Fix clobber of v1 in last_fixup Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 86/97] powerpc/eeh: Fix enabling bridge MMIO windows Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 87/97] powerpc/lib: Fix off-by-one in alternate feature patching Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 88/97] jffs2_kill_sb(): deal with failed allocations Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 89/97] hypfs_kill_super(): " Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 90/97] rpc_pipefs: fix double-dput() Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 91/97] Dont leak MNT_INTERNAL away from internal mounts Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 92/97] autofs: mount point create should honour passed in mode Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 93/97] mm: allow GFP_{FS,IO} for page_cache_read page cache allocation Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 94/97] mm/filemap.c: fix NULL pointer in page_cache_tree_insert() Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 96/97] fanotify: fix logic of events on child Greg Kroah-Hartman
2018-04-22 13:54 ` [PATCH 4.4 97/97] writeback: safer lock nesting Greg Kroah-Hartman
2018-04-22 20:44 ` [PATCH 4.4 00/97] 4.4.129-stable review Nathan Chancellor
2018-04-23 6:57 ` Greg Kroah-Hartman
2018-04-23 7:38 ` Naresh Kamboju
2018-04-23 16:53 ` Guenter Roeck
2018-04-23 21:38 ` Shuah Khan
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=20180422135308.405196681@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=maxime.jayat@mobile-devices.fr \
--cc=stable@vger.kernel.org \
--cc=vinod.koul@intel.com \
/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).