openwrtv4/target/linux/ramips/patches-4.14
André Draszik ace1686200 ramips: mt7620: eMMC: stop invalid memory access if only one device is defined
pdev->id is -1 when only one device exists, and is used:
* as an index into drv_mode[] to determine whether to use
  PIO or DMA mode (via host->id)
* as an index into msdc_6575_host[], to store the
  mmc_priv() data.

Obviously, -1 is not a valid index in either case, causing
us to read invalid memory, and memory corruption,
respectively.

The invalid memory read is causing non-deterministic
behaviour, in particular in the v4.4 kernel it still
picked DMA mode, but in the v4.9 it now always picks
PIO mode.
Also, PIO mode doesn't work, causing the following:

/ # echo 3 > /proc/sys/vm/drop_caches
[ 3845.249237] sh (128): drop_caches: 3

/ # /root/usr/lib/libc.so
[ 3846.096070] do_page_fault(): sending SIGSEGV to libc.so for invalid read access from 7f9cb5a0
[ 3846.104758] epc = 779b0ea4 in libc.so[7792f000+c3000]
[ 3846.109907] ra  = 779a8004 in libc.so[7792f000+c3000]
Segmentation fault

/ # /root/usr/lib/libc.so
musl libc (mipsel-sf)
Version 1.1.16-git-40-g54807d47
Dynamic Program Loader
Usage: /root/usr/lib/libc.so [options] [--] pathname [args]

(i.e. initial page-in of any binary causes a segfault,
subsequent access works.)

While this change doesn't fix PIO mode, it at least makes
us deterministically use DMA (which works), and it also
stops us from corrupting memory.

Signed-off-by: André Draszik <git@andred.net>
2018-04-04 08:29:17 +02:00
..
0004-MIPS-ralink-add-MT7621-pcie-driver.patch ramips: fix MT7621 PCI driver on 4.14 2018-02-21 14:46:45 +01:00
0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch
0006-MIPS-ralink-add-cpu-frequency-scaling.patch
0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch
0009-PCI-MIPS-enable-PCIe-on-MT7688.patch
0013-owrt-hack-fix-mt7688-cache-issue.patch kernel: bump 4.14 to 4.14.23 2018-03-02 21:33:08 +01:00
0015-arch-mips-do-not-select-illegal-access-driver-by-def.patch
0024-GPIO-add-named-gpio-exports.patch
0025-pinctrl-ralink-add-pinctrl-driver.patch
0026-DT-Add-documentation-for-gpio-ralink.patch
0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
0028-GPIO-ralink-add-mt7621-gpio-controller.patch
0031-uvc-add-iPassion-iP2970-support.patch
0032-USB-dwc2-add-device_reset.patch
0034-NET-multi-phy-support.patch kernel: update kernel 4.14 to 4.14.32 2018-04-03 23:26:45 +02:00
0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch
0037-mtd-cfi-cmdset-0002-force-word-write.patch
0039-mtd-add-mt7621-nand-support.patch Kernel: bump 4.14 to 4.14.29 2018-03-23 23:49:55 +01:00
0040-nand-hack-restore-write_page.patch Kernel: bump 4.14 to 4.14.29 2018-03-23 23:49:55 +01:00
0040-nand-hack.patch Kernel: bump 4.14 to 4.14.29 2018-03-23 23:49:55 +01:00
0041-DT-Add-documentation-for-spi-rt2880.patch
0042-SPI-ralink-add-Ralink-SoC-spi-driver.patch
0043-spi-add-mt7621-support.patch ramips: remove chunked-io patch and set spi->max_transfer_size instead 2018-02-24 16:05:28 +01:00
0044-i2c-MIPS-adds-ralink-I2C-driver.patch
0045-i2c-add-mt7621-driver.patch
0046-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch ramips: mt7620: eMMC: stop invalid memory access if only one device is defined 2018-04-04 08:29:17 +02:00
0047-DMA-ralink-add-rt2880-dma-engine.patch
0048-asoc-add-mt7620-support.patch
0051-serial-add-ugly-custom-baud-rate-hack.patch
0052-pwm-add-mediatek-support.patch
0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch ramips: remove chunked-io patch and set spi->max_transfer_size instead 2018-02-24 16:05:28 +01:00
0069-awake-rt305x-dwc2-controller.patch
0070-weak_reordering.patch
0090-ethernet.patch
0098-disable_cm.patch
0099-pci-mt7620.patch
100-mt7621-core-detect-hack.patch
0100-prom_fixes.patch
101-mt7621-timer.patch
110-mt7621-perfctr-fix.patch ramips: fix spurious IRQ7 events when using perf on 4.14 2018-02-27 17:30:33 +01:00
0200-linkit_bootstrap.patch
302-spi-nor-add-gd25q512.patch
303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch ramips: remove chunked-io patch and set spi->max_transfer_size instead 2018-02-24 16:05:28 +01:00
998-mt7621-needs-jiffies.patch
999-fix-pci-init-mt7620.patch