linux-stable/drivers
Marc Kleine-Budde afdbb66eb2 spi: spi-imx: spi_imx_transfer_one(): check for DMA transfer first
commit e85e9e0d8c upstream.

The SPI framework checks for each transfer (with the struct
spi_controller::can_dma callback) whether the driver wants to use DMA
for the transfer. If the driver returns true, the SPI framework will
map the transfer's data to the device, start the actual transfer and
map the data back.

In commit 07e7593877 ("spi: spi-imx: add PIO polling support") the
spi-imx driver's spi_imx_transfer_one() function was extended. If the
estimated duration of a transfer does not exceed a configurable
duration, a polling transfer function is used. This check happens
before checking if the driver decided earlier for a DMA transfer.

If spi_imx_can_dma() decided to use a DMA transfer, and the user
configured a big maximum polling duration, a polling transfer will be
used. The DMA unmap after the transfer destroys the transferred data.

To fix this problem check in spi_imx_transfer_one() if the driver
decided for DMA transfer first, then check the limits for a polling
transfer.

Fixes: 07e7593877 ("spi: spi-imx: add PIO polling support")
Link: https://lore.kernel.org/all/20221111003032.82371-1-festevam@gmail.com
Reported-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Cc: David Jander <david@protonic.nl>
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20221116164930.855362-1-mkl@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-02 17:43:11 +01:00
..
accessibility speakup: replace utils' u_char with unsigned char 2022-11-26 09:27:45 +01:00
acpi ACPI: video: Add backlight=native DMI quirk for Dell G15 5515 2022-12-02 17:43:00 +01:00
amba ARM: 9229/1: amba: Fix use-after-free in amba_read_periphid() 2022-08-30 11:12:52 +01:00
android binder: validate alloc->mm in ->mmap() handler 2022-12-02 17:42:59 +01:00
ata ata: libata-core: do not issue non-internal commands once EH is pending 2022-11-26 09:27:33 +01:00
atm atm: idt77252: fix use-after-free bugs caused by tst_timer 2022-08-08 20:51:59 -07:00
auxdisplay
base PM: domains: Fix handling of unavailable/disabled idle states 2022-11-04 00:00:32 +09:00
bcma
block drbd: use after free in drbd_create_device() 2022-11-26 09:27:37 +01:00
bluetooth Bluetooth: virtio_bt: Use skb_put to set length 2022-11-10 18:17:21 +01:00
bus bus: ixp4xx: Don't touch bit 7 on IXP42x 2022-12-02 17:43:11 +01:00
cdrom
char hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() 2022-11-10 18:17:24 +01:00
clk clk: renesas: r8a779g0: Add SASYNCPER clocks 2022-11-10 18:17:30 +01:00
clocksource clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe 2022-10-21 12:39:00 +02:00
comedi pci-v5.20-changes 2022-08-04 19:30:35 -07:00
connector
counter counter: 104-quad-8: Fix race getting function mode and direction 2022-11-04 00:00:23 +09:00
cpufreq cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init 2022-12-02 17:43:11 +01:00
cpuidle cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage 2022-10-21 12:38:56 +02:00
crypto crypto: cavium - prevent integer overflow loading firmware 2022-10-21 12:39:01 +02:00
cxl cxl/pmem: Use size_add() against integer overflow 2022-11-26 09:27:21 +01:00
dax devdax: Fix soft-reservation memory description 2022-09-24 18:05:53 -07:00
dca
devfreq More power management updates for 5.20-rc1 2022-08-08 14:29:00 -07:00
dio
dma dmaengine: at_hdmac: Check return code of dma_async_device_register 2022-11-16 10:04:14 +01:00
dma-buf dma-buf: Use dma_fence_unwrap_for_each when importing fences 2022-12-02 17:43:10 +01:00
edac powerpc updates for 6.0 2022-08-06 16:38:17 -07:00
eisa
extcon
firewire firewire: net: Make use of get_unaligned_be48(), put_unaligned_be48() 2022-07-28 22:21:54 -07:00
firmware firmware: coreboot: Register bus in module init 2022-11-26 09:27:50 +01:00
fpga fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() 2022-10-21 12:38:42 +02:00
fsi fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe 2022-10-21 12:39:26 +02:00
gnss
gpio gpio: rockchip: request GPIO mux to pinctrl when setting direction 2022-10-21 12:37:45 +02:00
gpu drm/i915: Fix warn in intel_display_power_*_domain() functions 2022-12-02 17:43:05 +01:00
greybus
hid HID: hyperv: fix possible memory leak in mousevsc_probe() 2022-11-16 10:03:52 +01:00
hsi HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() 2022-10-21 12:39:23 +02:00
hte
hv Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register() 2022-12-02 17:43:06 +01:00
hwmon hwmon/coretemp: Handle large core ID value 2022-10-29 10:08:30 +02:00
hwspinlock hwspinlock: qcom: correct MMIO max register for newer SoCs 2022-11-16 10:03:50 +01:00
hwtracing coresight: cti: Fix hang in cti_disable_hw() 2022-11-04 00:00:22 +09:00
i2c i2c: i801: add lis3lv02d's I2C address for Vostro 5568 2022-11-26 09:27:19 +01:00
i3c
idle Power management updates for 5.20-rc1 2022-08-02 11:17:00 -07:00
iio iio: accel: bma400: Fix memory leak in bma400_get_steps_reg() 2022-12-02 17:43:10 +01:00
infiniband RDMA/efa: Add EFA 0xefa2 PCI ID 2022-11-26 09:27:18 +01:00
input Input: i8042 - fix leaking of platform device on module removal 2022-11-26 09:27:54 +01:00
interconnect
iommu iommu/vt-d: Set SRE bit only when hardware has SRS cap 2022-11-26 09:27:50 +01:00
ipack
irqchip irqchip/loongson-pch-lpc: Add dependence on LoongArch 2022-09-16 09:25:51 +01:00
isdn mISDN: fix misuse of put_device() in mISDN_register_device() 2022-11-26 09:27:35 +01:00
leds leds: lm3601x: Don't use mutex after it was destroyed 2022-10-21 12:38:02 +02:00
macintosh
mailbox mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg 2022-10-21 12:38:55 +02:00
mcb
md dm ioctl: fix misbehavior if list_versions races with module loading 2022-11-26 09:27:48 +01:00
media media: platform: cros-ec: Add Kuldax to the match table 2022-11-10 18:17:23 +01:00
memory memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() 2022-10-21 12:38:31 +02:00
memstick MMC core: 2022-08-04 19:41:09 -07:00
message
mfd mfd: da9061: Fix Failed to set Two-Wire Bus Mode. 2022-10-21 12:38:52 +02:00
misc misc/vmw_vmci: fix an infoleak in vmci_host_do_receive_datagram() 2022-11-26 09:27:51 +01:00
mmc mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put() 2022-11-26 09:27:50 +01:00
most
mtd mtd: onenand: omap2: add dependency on GPMC 2022-11-26 09:27:28 +01:00
mux
net can: gs_usb: remove dma allocations 2022-12-02 17:43:09 +01:00
nfc nfc: st-nci: fix incorrect sizing calculations in EVT_TRANSACTION 2022-12-02 17:43:09 +01:00
ntb NTB: epf: Allow more flexibility in the memory BAR map method 2022-08-09 17:54:03 -04:00
nubus
nvdimm Merge branch 'for-6.0/dax' into libnvdimm-fixes 2022-09-24 18:14:12 -07:00
nvme nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked 2022-12-02 17:43:01 +01:00
nvmem nvmem: core: Fix memleak in nvmem_register() 2022-10-21 12:37:40 +02:00
of of: fdt: fix off-by-one error in unflatten_dt_nodes() 2022-08-16 11:29:57 -06:00
opp OPP: Fix an un-initialized variable usage 2022-08-16 10:48:08 +05:30
parisc parisc: Export iosapic_serial_irq() symbol for serial port driver 2022-11-10 18:17:35 +01:00
parport parport_pc: Avoid FIFO port location truncation 2022-11-26 09:27:30 +01:00
pci PCI: hv: Only reuse existing IRTE allocation for Multi-MSI 2022-12-02 17:43:03 +01:00
pcmcia
peci peci: cpu: Fix use-after-free in adev_release() 2022-08-15 20:31:35 +02:00
perf RISC-V: Re-enable counter access from userspace 2022-10-21 12:37:39 +02:00
phy phy: qcom-qmp-combo: fix NULL-deref on runtime resume 2022-11-16 10:04:09 +01:00
pinctrl pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map 2022-11-26 09:27:31 +01:00
platform platform/x86/intel/hid: Add some ACPI device IDs 2022-12-02 17:43:00 +01:00
pnp
power power: supply: ab8500: Defer thermal zone probe 2022-12-02 17:43:02 +01:00
powercap powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue 2022-10-21 12:39:04 +02:00
pps
ps3
ptp SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
pwm SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
rapidio
ras
regulator regulator: twl6030: re-add TWL6032_SUBCLASS 2022-12-02 17:43:07 +01:00
remoteproc remoteproc: Harden rproc_handle_vdev() against integer overflow 2022-10-21 12:38:45 +02:00
reset reset: npcm: fix iprst2 and iprst4 setting 2022-09-22 17:48:35 +02:00
rpmsg rpmsg: char: Avoid double destroy of default endpoint 2022-10-21 12:37:53 +02:00
rtc rtc: spear: set range max 2022-08-09 00:56:41 +02:00
s390 s390/dasd: fix no record found for raw_track_access 2022-12-02 17:43:08 +01:00
sbus
scsi scsi: storvsc: Fix handling of srb_status and capacity change events 2022-12-02 17:43:02 +01:00
sh
siox siox: fix possible memory leak in siox_device_add() 2022-11-26 09:27:30 +01:00
slimbus slimbus: stream: correct presence rate frequencies 2022-11-26 09:27:45 +01:00
soc soc: imx8m: Enable OCOTP clock before reading the register 2022-11-26 09:27:34 +01:00
soundwire soundwire: qcom: check for outanding writes before doing a read 2022-11-16 10:03:50 +01:00
spi spi: spi-imx: spi_imx_transfer_one(): check for DMA transfer first 2022-12-02 17:43:11 +01:00
spmi spmi: pmic-arb: correct duplicate APID to PPID mapping logic 2022-10-21 12:38:53 +02:00
ssb
staging media: hantro: HEVC: Fix chroma offset computation 2022-11-10 18:17:24 +01:00
target scsi: target: tcm_loop: Fix possible name leak in tcm_loop_setup_hba_bus() 2022-11-26 09:27:53 +01:00
tc
tee tee: optee: fix possible memory leak in optee_register_device() 2022-12-02 17:43:03 +01:00
thermal thermal: intel_powerclamp: Use first online CPU as control_cpu 2022-10-26 12:22:55 +02:00
thunderbolt thunderbolt: Add DP OUT resource when DP tunnel is discovered 2022-11-16 10:03:48 +01:00
tty serial: 8250_lpss: Use 16B DMA burst with Elkhart Lake 2022-11-26 09:27:48 +01:00
ufs scsi: ufs: core: Reduce the power mode change timeout 2022-08-19 21:34:36 -04:00
uio
usb usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1 2022-12-02 17:43:10 +01:00
vdpa vdpa/mlx5: Fix MQ to support non power of two num queues 2022-09-27 18:32:45 -04:00
vfio vfio: Split the register_device ops call into functions 2022-11-26 09:27:52 +01:00
vhost vhost/vsock: Use kvmalloc/kvfree for larger packets. 2022-10-21 12:38:19 +02:00
video fbdev/core: Avoid uninitialized read in aperture_remove_conflicting_pci_device() 2022-11-04 00:00:24 +09:00
virt virt/sev-guest: Prevent IV reuse in the SNP guest driver 2022-12-02 17:43:10 +01:00
virtio virtio: kerneldocs fixes and enhancements 2022-08-16 01:40:24 -04:00
vlynq
w1
watchdog linux-watchdog 5.20-rc1 tag 2022-08-08 15:04:04 -07:00
xen xen/pcpu: fix possible memory leak in register_pcpu() 2022-11-26 09:27:36 +01:00
zorro
Kconfig
Makefile Staging driver patches for 6.0-rc1 2022-08-04 12:01:42 -07:00