linux-stable/drivers
Mikulas Patocka ad10289f68 dm: call the resume method on internal suspend
[ Upstream commit 65e8fbde64 ]

There is this reported crash when experimenting with the lvm2 testsuite.
The list corruption is caused by the fact that the postsuspend and resume
methods were not paired correctly; there were two consecutive calls to the
origin_postsuspend function. The second call attempts to remove the
"hash_list" entry from a list, while it was already removed by the first
call.

Fix __dm_internal_resume so that it calls the preresume and resume
methods of the table's targets.

If a preresume method of some target fails, we are in a tricky situation.
We can't return an error because dm_internal_resume isn't supposed to
return errors. We can't return success, because then the "resume" and
"postsuspend" methods would not be paired correctly. So, we set the
DMF_SUSPENDED flag and we fake normal suspend - it may confuse userspace
tools, but it won't cause a kernel crash.

------------[ cut here ]------------
kernel BUG at lib/list_debug.c:56!
invalid opcode: 0000 [#1] PREEMPT SMP
CPU: 1 PID: 8343 Comm: dmsetup Not tainted 6.8.0-rc6 #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
RIP: 0010:__list_del_entry_valid_or_report+0x77/0xc0
<snip>
RSP: 0018:ffff8881b831bcc0 EFLAGS: 00010282
RAX: 000000000000004e RBX: ffff888143b6eb80 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffffffff819053d0 RDI: 00000000ffffffff
RBP: ffff8881b83a3400 R08: 00000000fffeffff R09: 0000000000000058
R10: 0000000000000000 R11: ffffffff81a24080 R12: 0000000000000001
R13: ffff88814538e000 R14: ffff888143bc6dc0 R15: ffffffffa02e4bb0
FS:  00000000f7c0f780(0000) GS:ffff8893f0a40000(0000) knlGS:0000000000000000
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000057fb5000 CR3: 0000000143474000 CR4: 00000000000006b0
Call Trace:
 <TASK>
 ? die+0x2d/0x80
 ? do_trap+0xeb/0xf0
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? do_error_trap+0x60/0x80
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? exc_invalid_op+0x49/0x60
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? asm_exc_invalid_op+0x16/0x20
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 ? __list_del_entry_valid_or_report+0x77/0xc0
 origin_postsuspend+0x1a/0x50 [dm_snapshot]
 dm_table_postsuspend_targets+0x34/0x50 [dm_mod]
 dm_suspend+0xd8/0xf0 [dm_mod]
 dev_suspend+0x1f2/0x2f0 [dm_mod]
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 ctl_ioctl+0x300/0x5f0 [dm_mod]
 dm_compat_ctl_ioctl+0x7/0x10 [dm_mod]
 __x64_compat_sys_ioctl+0x104/0x170
 do_syscall_64+0x184/0x1b0
 entry_SYSCALL_64_after_hwframe+0x46/0x4e
RIP: 0033:0xf7e6aead
<snip>
---[ end trace 0000000000000000 ]---

Fixes: ffcc393641 ("dm: enhance internal suspend and resume interface")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:20:43 -04:00
..
accessibility
acpi ACPI: scan: Fix device check notification handling 2024-03-26 18:20:38 -04:00
amba
android binder: signal epoll threads of self-work 2024-02-23 09:12:39 +01:00
ata ahci: Extend ASM1061 43-bit DMA address quirk to other ASM106x parts 2024-03-01 13:26:39 +01:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-16 19:06:26 +01:00
auxdisplay auxdisplay: hd44780: move cursor home after clear display command 2023-12-08 08:51:16 +01:00
base x86/rfds: Mitigate Register File Data Sampling (RFDS) 2024-03-15 10:48:21 -04:00
bcma
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:20:29 -04:00
bluetooth Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() 2024-03-26 18:20:40 -04:00
bus bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:20:36 -04:00
cdrom
char hwrng: core - Fix page fault dead lock on mmap-ed hwrng 2024-01-31 16:16:58 -08:00
clk clk: tegra20: fix gcc-7 constant overflow warning 2024-03-06 14:45:05 +00:00
clocksource clocksource/drivers/timer-ti-dm: Fix make W=n kerneldoc warnings 2024-01-25 15:27:39 -08:00
comedi
connector
counter counter: microchip-tcb-capture: Fix the use of internal GCLK logic 2023-10-19 23:08:58 +02:00
cpufreq cpufreq: mediatek-hw: Don't error out if supply is not found 2024-03-26 18:20:32 -04:00
cpuidle
crypto crypto: virtio/akcipher - Fix stack overflow on memcpy 2024-03-01 13:26:32 +01:00
cxl cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window 2024-03-01 13:26:31 +01:00
dax
dca
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-05 20:12:47 +00:00
dio
dma dmaengine: fsl-qdma: init irq after reg initialization 2024-03-06 14:45:10 +00:00
dma-buf dma-buf: fix check in dma_resv_add_fence 2023-12-08 08:51:15 +01:00
edac EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 15:27:18 -08:00
eisa
extcon
firewire firewire: core: use long bus reset on gap count error 2024-03-26 18:20:27 -04:00
firmware firmware: arm_scmi: Fix double free in SMC transport cleanup path 2024-03-26 18:20:37 -04:00
fpga
fsi
gnss
gpio gpio: vf610: allow disabling the vf610 driver 2024-03-26 18:20:33 -04:00
gpu drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series 2024-03-26 18:20:27 -04:00
greybus
hid HID: multitouch: Add required quirk for Synaptics 0xcddc device 2024-03-26 18:20:25 -04:00
hsi
hte hte: tegra: Fix missing error code in tegra_hte_test_probe() 2023-11-20 11:51:58 +01:00
hv
hwmon hwmon: (coretemp) Enlarge per package core count limit 2024-03-01 13:26:29 +01:00
hwspinlock
hwtracing coresight: etm4x: Fix width of CCITMIN field 2024-01-20 11:50:11 +01:00
i2c i2c: imx: when being a target, mark the last read as processed 2024-03-01 13:26:38 +01:00
i3c i3c: master: cdns: Update maximum prescaler value for i2c clock 2024-02-05 20:12:58 +00:00
idle
iio iio: imu: bno055: serdev requires REGMAP 2024-02-23 09:12:41 +01:00
infiniband RDMA/mlx5: Relax DEVX access upon modify commands 2024-03-26 18:20:25 -04:00
input Input: gpio_keys_polled - suppress deferred probe error for gpio 2024-03-26 18:20:27 -04:00
interconnect Revert "interconnect: Teach lockdep about icc_bw_lock order" 2024-03-06 14:45:19 +00:00
iommu iommu: Fix compilation without CONFIG_IOMMU_INTEL 2024-03-26 18:20:41 -04:00
ipack
irqchip irqchip/sifive-plic: Enable interrupt if needed before EOI 2024-03-01 13:26:32 +01:00
isdn
leds leds: trigger: panic: Don't register panic notifier if creating the trigger failed 2024-02-05 20:12:57 +00:00
macintosh
mailbox mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt 2024-02-05 20:12:58 +00:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 17:07:13 +00:00
md dm: call the resume method on internal suspend 2024-03-26 18:20:43 -04:00
media media: rkisp1: Fix IRQ handling due to shared interrupts 2024-03-26 18:20:24 -04:00
memory
memstick
message
mfd mfd: ti_am335x_tscadc: Fix TI SoC dependencies 2024-02-05 20:12:58 +00:00
misc misc: open-dice: Fix spurious lockdep warning 2024-03-01 13:26:27 +01:00
mmc mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function 2024-03-26 18:20:39 -04:00
most
mtd mtd: spinand: gigadevice: Fix the get ecc status issue 2024-03-06 14:45:06 +00:00
mux
net nfp: flower: handle acti_netdevs allocation failure 2024-03-26 18:20:43 -04:00
nfc
ntb
nubus
nvdimm nd_btt: Make BTT lanes preemptible 2023-11-20 11:52:05 +01:00
nvme nvmet-fc: take ref count on tgtport before delete assoc 2024-03-01 13:26:28 +01:00
nvmem nvmem: imx: correct nregs for i.MX6UL 2023-11-02 09:35:31 +01:00
of of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing 2024-03-06 14:45:09 +00:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:20:42 -04:00
parisc parisc/power: Fix power soft-off button emulation on qemu 2024-01-31 16:16:59 -08:00
parport parport: parport_serial: Add Brainboxes device IDs and geometry 2024-01-20 11:50:11 +01:00
pci PCI: Make pci_dev_is_disconnected() helper public for other drivers 2024-03-26 18:20:39 -04:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:52:13 +01:00
peci
perf perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count) 2024-03-26 18:20:24 -04:00
phy phy: freescale: phy-fsl-imx8-mipi-dphy: Fix alias name to use dashes 2024-03-06 14:45:19 +00:00
pinctrl pinctrl: cy8c95x0: Fix get_pincfg 2024-01-20 11:50:09 +01:00
platform platform/x86: thinkpad_acpi: Only update profile if successfully converted 2024-03-01 13:26:37 +01:00
pnp PNP: ACPI: fix fortify warning 2024-02-05 20:12:47 +00:00
power power: supply: bq27xxx-i2c: Do not free non existing IRQ 2024-03-06 14:45:09 +00:00
powercap powercap: dtpm_cpu: Fix error check against freq_qos_add_request() 2024-03-26 18:20:36 -04:00
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 17:07:05 +00:00
pwm pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan 2024-03-26 18:20:34 -04:00
rapidio
ras
regulator regulator: pwm-regulator: Add validity checks in continuous .get_voltage 2024-03-01 13:26:26 +01:00
remoteproc
reset reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning 2024-01-20 11:50:07 +01:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-01-31 16:16:59 -08:00
rtc rtc: test: Fix invalid format specifier. 2024-03-26 18:20:29 -04:00
s390 s390/dasd: fix double module refcount decrement 2024-03-26 18:20:28 -04:00
sbus
scsi scsi: mpt3sas: Prevent sending diag_reset when the controller is ready 2024-03-26 18:20:26 -04:00
sh
siox
slimbus
soc pmdomain: qcom: rpmhpd: Drop SA8540P gfx.lvl 2024-03-26 18:20:32 -04:00
soundwire soundwire: stream: fix NULL pointer dereference for multi_link 2023-12-20 17:00:25 +01:00
spi spi: sh-msiof: avoid integer overflow in constants 2024-03-01 13:26:27 +01:00
spmi spmi: mediatek: Fix UAF on device remove 2024-02-05 20:12:58 +00:00
ssb
staging staging: iio: ad5933: fix type mismatch regression 2024-02-23 09:12:40 +01:00
target scsi: target: pscsi: Fix bio_put() for error case 2024-03-01 13:26:31 +01:00
tc
tee tee: optee: Fix supplicant based device enumeration 2023-12-13 18:39:12 +01:00
thermal thermal: intel: hfi: Add syscore callbacks for system-wide PM 2024-01-31 16:17:09 -08:00
thunderbolt thunderbolt: Fix memory leak in margining_port_remove() 2024-01-01 12:39:08 +00:00
tty serial: amba-pl011: Fix DMA transmission in RS485 mode 2024-03-01 13:26:33 +01:00
ufs scsi: ufs: core: Remove the ufshcd_release() in ufshcd_err_handling_prepare() 2024-03-01 13:26:30 +01:00
uio uio: Fix use-after-free in uio_open 2024-01-20 11:50:10 +01:00
usb xhci: handle isoc Babble and Buffer Overrun events properly 2024-03-15 10:48:20 -04:00
vdpa vdpa: Fix an error handling path in eni_vdpa_probe() 2024-01-25 15:27:47 -08:00
vfio iommufd/iova_bitmap: Consider page offset for the pages to be pinned 2024-03-01 13:26:35 +01:00
vhost vhost: use kzalloc() instead of kmalloc() followed by memset() 2024-02-16 19:06:31 +01:00
video fbcon: always restore the old font data in fbcon_do_set_font() 2024-03-06 14:45:09 +00:00
virt virt: sevguest: Fix passing a stack buffer as a scatterlist target 2023-11-20 11:52:13 +01:00
virtio virtio_pci: fix the common cfg map size 2023-11-02 09:35:23 +01:00
vlynq
w1
watchdog watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 2024-02-05 20:12:56 +00:00
xen xen/events: close evtchn after mapping cleanup 2024-03-06 14:45:20 +00:00
zorro
Kconfig
Makefile