linux/drivers
Alyssa Ross bee9ca40b8 loop: LOOP_CONFIGURE: send uevents for partitions
[ Upstream commit bb430b6942 ]

LOOP_CONFIGURE is, as far as I understand it, supposed to be a way to
combine LOOP_SET_FD and LOOP_SET_STATUS64 into a single syscall.  When
using LOOP_SET_FD+LOOP_SET_STATUS64, a single uevent would be sent for
each partition found on the loop device after the second ioctl(), but
when using LOOP_CONFIGURE, no such uevent was being sent.

In the old setup, uevents are disabled for LOOP_SET_FD, but not for
LOOP_SET_STATUS64.  This makes sense, as it prevents uevents being
sent for a partially configured device during LOOP_SET_FD - they're
only sent at the end of LOOP_SET_STATUS64.  But for LOOP_CONFIGURE,
uevents were disabled for the entire operation, so that final
notification was never issued.  To fix this, reduce the critical
section to exclude the loop_reread_partitions() call, which causes
the uevents to be issued, to after uevents are re-enabled, matching
the behaviour of the LOOP_SET_FD+LOOP_SET_STATUS64 combination.

I noticed this because Busybox's losetup program recently changed from
using LOOP_SET_FD+LOOP_SET_STATUS64 to LOOP_CONFIGURE, and this broke
my setup, for which I want a notification from the kernel any time a
new partition becomes available.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
[hch: reduced the critical section]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Fixes: 3448914e8c ("loop: Add LOOP_CONFIGURE ioctl")
Link: https://lore.kernel.org/r/20230320125430.55367-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-06 12:10:47 +02:00
..
accessibility
acpi ACPI: bus: Rework system-level device notification handling 2023-04-06 12:10:46 +02:00
amba
android
ata
atm atm: idt77252: fix kmemleak when rmmod idt77252 2023-03-30 12:49:09 +02:00
auxdisplay
base
bcma
block loop: LOOP_CONFIGURE: send uevents for partitions 2023-04-06 12:10:47 +02:00
bluetooth Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work 2023-03-30 12:49:12 +02:00
bus bus: imx-weim: fix branch condition evaluates to a garbage value 2023-03-30 12:49:29 +02:00
cdrom
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle cpuidle: psci: Iterate backwards over list in psci_pd_remove() 2023-03-22 13:34:04 +01:00
crypto
cxl
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware firmware: arm_scmi: Fix device node validation for mailbox transport 2023-03-30 12:49:29 +02:00
fpga
fsi
gnss
gpio
gpu drm/i915/tc: Fix the ICL PHY ownership check in TC-cold state 2023-04-06 12:10:46 +02:00
greybus
hid HID: intel-ish-hid: ipc: Fix potential use-after-free in work function 2023-03-30 12:49:16 +02:00
hsi
hte
hv
hwmon hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs 2023-03-30 12:49:13 +02:00
hwspinlock
hwtracing
i2c i2c: xgene-slimpro: Fix out-of-bounds bug in xgene_slimpro_i2c_xfer() 2023-03-30 12:49:30 +02:00
i3c
idle
iio
infiniband
input
interconnect interconnect: qcom: qcm2290: Fix MASTER_SNOC_BIMC_NRT 2023-03-30 12:48:59 +02:00
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md md: avoid signed overflow in slot_store() 2023-04-06 12:10:39 +02:00
media media: m5mols: fix off-by-one loop termination error 2023-03-22 13:33:53 +01:00
memory memory: tegra30-emc: fix interconnect registration race 2023-03-22 13:33:56 +01:00
memstick
message
mfd
misc
mmc mmc: sdhci_am654: lower power-on failed message severity 2023-03-22 13:34:03 +01:00
most
mtd mtd: rawnand: meson: invalidate cache on polling ECC bit 2023-04-06 12:10:43 +02:00
mux
net net: stmmac: don't reject VLANs when IFF_PROMISC is set 2023-04-06 12:10:46 +02:00
nfc
ntb
nubus
nvdimm
nvme nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM620 2023-04-06 12:10:40 +02:00
nvmem
of
opp
parisc
parport
pci PCI: dwc: Fix PORT_LINK_CONTROL update when CDM check enabled 2023-04-06 12:10:43 +02:00
pcmcia
peci
perf
phy
pinctrl
platform platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix 2023-04-06 12:10:46 +02:00
pnp
power power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition 2023-03-30 12:49:01 +02:00
powercap
pps
ps3
ptp ptp_qoriq: fix memory leak in probe() 2023-04-06 12:10:44 +02:00
pwm
rapidio
ras
regulator regulator: Handle deferred clk 2023-04-06 12:10:46 +02:00
remoteproc
reset
rpmsg
rtc
s390 s390/vfio-ap: fix memory leak in vfio_ap device driver 2023-04-06 12:10:46 +02:00
sbus
scsi scsi: mpt3sas: Don't print sense pool info twice 2023-04-06 12:10:44 +02:00
sh
siox
slimbus
soc soc: qcom: llcc: Fix slice configuration values for SC8280XP 2023-03-30 12:49:29 +02:00
soundwire
spi
spmi
ssb
staging
target scsi: target: iscsi: Fix an error message in iscsi_check_key() 2023-03-30 12:49:17 +02:00
tc
tee tee: amdtee: fix race condition in amdtee_open_session 2023-03-30 12:49:29 +02:00
thermal
thunderbolt thunderbolt: Limit USB3 bandwidth of certain Intel USB4 host routers 2023-04-06 12:10:33 +02:00
tty tty: serial: fsl_lpuart: fix race on RX DMA shutdown 2023-04-06 12:10:36 +02:00
ufs scsi: ufs: core: Add soft dependency on governor_simpleondemand 2023-03-30 12:49:17 +02:00
uio
usb usb: ucsi_acpi: Increase the command completion timeout 2023-03-30 12:49:25 +02:00
vdpa vp_vdpa: fix the crash in hot unplug with vp_vdpa 2023-03-22 13:34:03 +01:00
vfio
vhost
video fbdev: au1200fb: Fix potential divide by zero 2023-04-06 12:10:41 +02:00
virt virt/coco/sev-guest: Add throttling awareness 2023-03-22 13:34:06 +01:00
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile