If the full path to be built by ceph_mdsc_build_path() happens to be
longer than PATH_MAX, then this function will enter an endless (retry)
loop, effectively blocking the whole task. Most of the machine
becomes unusable, making this a very simple and effective DoS
vulnerability.
I cannot imagine why this retry was ever implemented, but it seems
rather useless and harmful to me. Let's remove it and fail with
ENAMETOOLONG instead.
Cc: stable(a)vger.kernel.org
Reported-by: Dario Weißer <dario(a)cure53.de>
Signed-off-by: Max Kellermann <max.kellermann(a)ionos.com>
---
fs/ceph/mds_client.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index c4a5fd94bbbb..4f6ac015edcd 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2808,12 +2808,11 @@ char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc, struct dentry *dentry,
if (pos < 0) {
/*
- * A rename didn't occur, but somehow we didn't end up where
- * we thought we would. Throw a warning and try again.
+ * The path is longer than PATH_MAX and this function
+ * cannot ever succeed. Creating paths that long is
+ * possible with Ceph, but Linux cannot use them.
*/
- pr_warn_client(cl, "did not end path lookup where expected (pos = %d)\n",
- pos);
- goto retry;
+ return ERR_PTR(-ENAMETOOLONG);
}
*pbase = base;
--
2.45.2
This series fixes various small issues in the drivers, and adds a few
things (a couple of pixel formats and a debugging feature).
It also takes a few steps in adding more i2c read/write error handlings
to the drivers, but covers only the easy places.
Adding error handling to all reads/writes needs more thinking, perhaps
adding a "ret" parameter to the calls, similar to the cci_* functions,
or perhaps adding helpers for writing multiple registers from a given
table. Also, in some places rolling back from an error will require
work.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen(a)ideasonboard.com>
---
Changes in v4:
- Add Jai's Rb
- Use HZ_PER_MHZ in MHZ() macro
- Use num_rxports when setting up the DEBUG_I2C_RX_ID
- Add Reported-by's to patches that add error handling. Note: The
patches don't close the issue, so I use "Link:" instead of "Closes:"
as directed in Documentation/process/5.Posting.rst. However, checkpatch
seems to want "Closes", so it warns about these.
- Link to v3: https://lore.kernel.org/r/20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboa…
Changes in v3:
- Include bitfield.h for FIELD_PREP()
- Cc stable for relevant fixes
- Link to v2: https://lore.kernel.org/r/20241108-ub9xx-fixes-v2-0-c7db3b2ad89f@ideasonboa…
Changes in v2:
- Address comments from Andy
- Add two new patches:
- media: i2c: ds90ub960: Fix shadowing of local variables
- media: i2c: ds90ub960: Use HZ_PER_MHZ
- Link to v1: https://lore.kernel.org/r/20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboa…
---
Tomi Valkeinen (15):
media: i2c: ds90ub9x3: Fix extra fwnode_handle_put()
media: i2c: ds90ub960: Fix UB9702 refclk register access
media: i2c: ds90ub960: Fix use of non-existing registers on UB9702
media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702
media: i2c: ds90ub960: Fix UB9702 VC map
media: i2c: ds90ub960: Use HZ_PER_MHZ
media: i2c: ds90ub960: Add support for I2C_RX_ID
media: i2c: ds90ub960: Add RGB24, RAW8 and RAW10 formats
media: i2c: ds90ub953: Clear CRC errors in ub953_log_status()
media: i2c: ds90ub960: Drop unused indirect block define
media: i2c: ds90ub960: Reduce sleep in ub960_rxport_wait_locks()
media: i2c: ds90ub960: Handle errors in ub960_log_status_ub960_sp_eq()
media: i2c: ds90ub913: Add error handling to ub913_hw_init()
media: i2c: ds90ub953: Add error handling for i2c reads/writes
media: i2c: ds90ub960: Fix shadowing of local variables
drivers/media/i2c/ds90ub913.c | 26 ++++--
drivers/media/i2c/ds90ub953.c | 56 +++++++++----
drivers/media/i2c/ds90ub960.c | 188 ++++++++++++++++++++++++++++--------------
3 files changed, 188 insertions(+), 82 deletions(-)
---
base-commit: adc218676eef25575469234709c2d87185ca223a
change-id: 20241004-ub9xx-fixes-bba80dc48627
Best regards,
--
Tomi Valkeinen <tomi.valkeinen(a)ideasonboard.com>
I'm announcing the release of the 4.19.325 kernel.
It's the last 4.19.y release, please move off to a newer kernel version.
This one is finished, it is end-of-life as of right now.
It had a good life, despite being born out of internal strife. The
community has proven that it can change and move forward which is great
to see, as again, the only thing that is going to stop Linux, is us, the
Linux community. Let's always try to work together to make sure that
doesn't happen.
As a "fun" proof that this one is finished (and that any company saying
they care about it really should have their statements validated with
facts), I looked at the "unfixed" CVEs from this kernel release.
Currently it is a list 983 CVEs long, too long to list here.
You can verify it yourself by cloning the vulns.git repo at
git.kernel.org and running:
./scripts/strak v4.19.325
Note, this does NOT count the hardware CVEs which kernel.org does not
track, and many are sill unfixed in this kernel branch.
Yes, CVE counts don't mean much these days, but hey, it's a signal of
something, right? I take it to mean that no one is caring enough to
backport the needed fixes to this branch, which means that you shouldn't
be using it anymore.
Anyway, please move off to a more modern kernel if you were using this
one for some reason. Like 6.12.y, the next LTS kernel we will be
supporting for multiple years.
The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.19.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/devicetree/bindings/clock/adi,axi-clkgen.yaml | 67 ++++
Documentation/devicetree/bindings/clock/axi-clkgen.txt | 25 -
Makefile | 2
arch/arm/boot/dts/sun9i-a80-cubieboard4.dts | 4
arch/arm64/kernel/process.c | 2
arch/m68k/coldfire/device.c | 8
arch/m68k/include/asm/mcfgpio.h | 2
arch/m68k/include/asm/mvme147hw.h | 4
arch/m68k/kernel/early_printk.c | 9
arch/m68k/mvme147/config.c | 30 ++
arch/m68k/mvme147/mvme147.h | 6
arch/m68k/mvme16x/config.c | 2
arch/m68k/mvme16x/mvme16x.h | 6
arch/powerpc/include/asm/sstep.h | 5
arch/powerpc/include/asm/vdso.h | 1
arch/powerpc/lib/sstep.c | 12
arch/s390/kernel/syscalls/Makefile | 2
arch/sh/kernel/cpu/proc.c | 2
arch/um/drivers/net_kern.c | 2
arch/um/drivers/ubd_kern.c | 2
arch/um/drivers/vector_kern.c | 3
arch/um/kernel/process.c | 2
arch/x86/include/asm/amd_nb.h | 5
block/blk-mq.c | 6
block/blk-mq.h | 13
crypto/pcrypt.c | 12
drivers/acpi/arm64/gtdt.c | 2
drivers/base/regmap/regmap-irq.c | 4
drivers/clk/clk-axi-clkgen.c | 26 +
drivers/cpufreq/loongson2_cpufreq.c | 4
drivers/crypto/bcm/cipher.c | 5
drivers/crypto/cavium/cpt/cptpf_main.c | 6
drivers/edac/fsl_ddr_edac.c | 22 -
drivers/firmware/arm_scpi.c | 3
drivers/gpu/drm/drm_mm.c | 2
drivers/gpu/drm/etnaviv/etnaviv_drv.h | 11
drivers/gpu/drm/etnaviv/etnaviv_dump.c | 13
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 48 ++-
drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 20 +
drivers/gpu/drm/omapdrm/omap_gem.c | 10
drivers/hid/wacom_wac.c | 4
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7
drivers/infiniband/hw/bnxt_re/qplib_fp.h | 2
drivers/media/dvb-core/dvbdev.c | 15 -
drivers/media/radio/wl128x/fmdrv_common.c | 3
drivers/message/fusion/mptsas.c | 4
drivers/mfd/da9052-spi.c | 2
drivers/mfd/rt5033.c | 4
drivers/misc/apds990x.c | 12
drivers/mmc/host/dw_mmc.c | 4
drivers/mmc/host/mmc_spi.c | 9
drivers/mtd/nand/raw/atmel/pmecc.c | 8
drivers/mtd/nand/raw/atmel/pmecc.h | 2
drivers/mtd/ubi/attach.c | 12
drivers/mtd/ubi/wl.c | 9
drivers/net/ethernet/broadcom/tg3.c | 3
drivers/net/ethernet/marvell/pxa168_eth.c | 13
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2
drivers/net/usb/lan78xx.c | 11
drivers/net/usb/qmi_wwan.c | 1
drivers/net/wireless/ath/ath9k/htc_hst.c | 3
drivers/net/wireless/marvell/mwifiex/fw.h | 2
drivers/nvme/host/core.c | 7
drivers/pci/hotplug/cpqphp_pci.c | 19 -
drivers/pci/slot.c | 4
drivers/power/supply/power_supply_core.c | 2
drivers/rpmsg/qcom_glink_native.c | 175 ++++++++----
drivers/rtc/interface.c | 7
drivers/scsi/bfa/bfad.c | 3
drivers/scsi/qedi/qedi_main.c | 1
drivers/sh/intc/core.c | 2
drivers/soc/qcom/qcom-geni-se.c | 3
drivers/spi/spi.c | 13
drivers/tty/serial/8250/8250_omap.c | 4
drivers/tty/tty_ldisc.c | 2
drivers/usb/dwc3/gadget.c | 9
drivers/usb/gadget/composite.c | 18 +
drivers/usb/host/ehci-spear.c | 7
drivers/usb/misc/chaoskey.c | 35 +-
drivers/usb/misc/iowarrior.c | 46 ++-
drivers/vfio/pci/vfio_pci_config.c | 16 -
drivers/video/fbdev/sh7760fb.c | 11
fs/ext4/fsmap.c | 54 +++
fs/ext4/mballoc.c | 18 -
fs/ext4/mballoc.h | 1
fs/ext4/super.c | 8
fs/hfsplus/hfsplus_fs.h | 3
fs/hfsplus/wrapper.c | 2
fs/jffs2/erase.c | 7
fs/jfs/xattr.c | 2
fs/nfs/nfs4proc.c | 8
fs/nfsd/nfs4callback.c | 16 -
fs/nfsd/nfs4recover.c | 3
fs/nilfs2/btnode.c | 2
fs/nilfs2/gcinode.c | 4
fs/nilfs2/mdt.c | 1
fs/nilfs2/page.c | 2
fs/ocfs2/aops.h | 2
fs/ocfs2/file.c | 4
fs/ocfs2/resize.c | 2
fs/ocfs2/super.c | 13
fs/proc/softirqs.c | 2
fs/ubifs/super.c | 6
include/linux/blkdev.h | 2
include/linux/jiffies.h | 2
include/linux/netpoll.h | 2
init/initramfs.c | 15 +
kernel/time/time.c | 2
kernel/trace/trace_event_perf.c | 6
lib/string_helpers.c | 2
mm/shmem.c | 2
net/9p/trans_xen.c | 9
net/bluetooth/rfcomm/sock.c | 10
net/mac80211/main.c | 2
net/netfilter/ipset/ip_set_bitmap_ip.c | 7
net/netlink/af_netlink.c | 31 --
net/netlink/af_netlink.h | 2
net/rfkill/rfkill-gpio.c | 8
samples/bpf/xdp_adjust_tail_kern.c | 1
scripts/mkcompile_h | 2
scripts/mod/file2alias.c | 5
security/apparmor/capability.c | 2
sound/soc/codecs/da7219.c | 9
sound/soc/intel/boards/bytcr_rt5640.c | 15 +
sound/usb/6fire/chip.c | 10
sound/usb/caiaq/audio.c | 10
sound/usb/caiaq/audio.h | 1
sound/usb/caiaq/device.c | 19 +
sound/usb/caiaq/input.c | 12
sound/usb/caiaq/input.h | 1
sound/usb/quirks.c | 18 -
sound/usb/usx2y/us122l.c | 5
tools/perf/util/probe-finder.c | 17 +
tools/testing/selftests/vDSO/parse_vdso.c | 3
tools/testing/selftests/watchdog/watchdog-test.c | 6
135 files changed, 898 insertions(+), 426 deletions(-)
Aleksandr Mishin (1):
acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
Alex Zenla (2):
9p/xen: fix init sequence
9p/xen: fix release of IRQ
Alexandru Ardelean (2):
dt-bindings: clock: adi,axi-clkgen: convert old binding to yaml format
clk: axi-clkgen: use devm_platform_ioremap_resource() short-hand
Alper Nebi Yasak (1):
wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_config_scan()
Andre Przywara (1):
ARM: dts: cubieboard4: Fix DCDC5 regulator constraints
Andrej Shadura (1):
Bluetooth: Fix type of len in rfcomm_sock_getsockopt{,_old}()
Andrew Morton (1):
mm: revert "mm: shmem: fix data-race in shmem_getattr()"
Andy Shevchenko (2):
regmap: irq: Set lockdep class for hierarchical IRQ domains
drm/mm: Mark drm_mm_interval_tree*() functions with __maybe_unused
Antonio Quartulli (1):
m68k: coldfire/device.c: only build FEC when HW macros are defined
Arnd Bergmann (1):
x86/amd_nb: Fix compile-testing without CONFIG_AMD_NB
Artem Sadovnikov (1):
jfs: xattr: check invalid xattr size more strictly
Arun Kumar Neelakantam (2):
rpmsg: glink: Add TX_DATA_CONT command while sending
rpmsg: glink: Send READ_NOTIFY command in FIFO full case
Aurelien Jarno (1):
Revert "mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K"
Avihai Horon (1):
vfio/pci: Properly hide first-in-list PCIe extended capability
Bart Van Assche (1):
power: supply: core: Remove might_sleep() from power_supply_put()
Bartosz Golaszewski (2):
mmc: mmc_spi: drop buggy snprintf()
lib: string_helpers: silence snprintf() output truncation warning
Ben Greear (1):
mac80211: fix user-power when emulating chanctx
Benoît Monin (1):
net: usb: qmi_wwan: add Quectel RG650V
Benoît Sevens (1):
ALSA: usb-audio: Fix potential out-of-bound accesses for Extigy and Mbox devices
Bin Liu (1):
serial: 8250: omap: Move pm_runtime_get_sync
Bjorn Andersson (2):
rpmsg: glink: Fix GLINK command prefix
rpmsg: glink: Propagate TX failures in intentless mode as well
Breno Leitao (1):
netpoll: Use rcu_access_pointer() in netpoll_poll_lock
Chen Ridong (1):
crypto: bcm - add error check in the ahash_hmac_init function
Chris Down (1):
kbuild: Use uname for LINUX_COMPILE_HOST detection
Christoph Hellwig (1):
block: return unsigned int from bdev_io_min
Christophe JAILLET (1):
crypto: cavium - Fix an error handling path in cpt_ucode_load_fw()
Christophe Leroy (1):
powerpc/vdso: Flag VDSO64 entry points as functions
Chuck Lever (3):
NFSD: Prevent NULL dereference in nfsd4_process_cb_update()
NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir()
NFSD: Prevent a potential integer overflow
Claudiu Beznea (1):
serial: sh-sci: Clean sci_ports[0] after at earlycon exit
Dan Carpenter (2):
soc: qcom: geni-se: fix array underflow in geni_se_clk_tbl_get()
sh: intc: Fix use-after-free bug in register_intc_controller()
Daniel Palmer (2):
m68k: mvme147: Fix SCSI controller IRQ numbers
m68k: mvme147: Reinstate early console
David Disseldorp (1):
initramfs: avoid filename buffer overrun
David Wang (1):
proc/softirqs: replace seq_printf with seq_put_decimal_ull_width
Dmitry Antipov (3):
ocfs2: uncache inode which has failed entering the group
ocfs2: fix UBSAN warning in ocfs2_verify_volume()
ocfs2: fix uninitialized value in ocfs2_file_read_iter()
Doug Brown (1):
drm/etnaviv: fix power register offset on GC300
Edward Adam Davis (1):
USB: chaoskey: Fix possible deadlock chaoskey_list_lock
Everest K.C (1):
crypto: cavium - Fix the if condition to exit loop after timeout
Geert Uytterhoeven (1):
m68k: mvme16x: Add and use "mvme16x.h"
Greg Kroah-Hartman (2):
Revert "serial: sh-sci: Clean sci_ports[0] after at earlycon exit"
Linux 4.19.325
Hans de Goede (1):
ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet
Huacai Chen (1):
sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
Ilpo Järvinen (1):
PCI: cpqphp: Fix PCIBIOS_* return value confusion
Jakub Kicinski (1):
netlink: terminate outstanding dump on socket close
Jason Gerecke (1):
HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
Jean-Michel Hautbois (1):
m68k: mcfgpio: Fix incorrect register offset for CONFIG_M5441x
Jeongjun Park (4):
wifi: ath9k: add range check for conn_rsp_epid in htc_connect_service()
usb: using mutex lock and supporting O_NONBLOCK flag in iowarrior_read()
ext4: supress data-race warnings in ext4_free_inodes_{count,set}()
netfilter: ipset: add missing range check in bitmap_ip_uadt
Jinjie Ruan (1):
misc: apds990x: Fix missing pm_runtime_disable()
Jonathan Marek (1):
rpmsg: glink: use only lower 16-bits of param2 for CMD_OPEN name length
Kashyap Desai (1):
RDMA/bnxt_re: Check cqe flags to know imm_data vs inv_irkey
Leo Yan (1):
perf probe: Correct demangled symbols in C++ program
Levi Yun (1):
trace/trace_event_perf: remove duplicate samples on the first tracepoint event
Li Zhijian (1):
selftests/watchdog-test: Fix system accidentally reset after watchdog-test
Lucas Stach (2):
drm/etnaviv: consolidate hardware fence handling in etnaviv_gpu
drm/etnaviv: hold GPU lock across perfmon sampling
Lukas Wunner (1):
PCI: Fix use-after-free of slot->bus on hot remove
Luo Qiu (1):
firmware: arm_scpi: Check the DVFS OPP count returned by the firmware
Marc Kleine-Budde (1):
drm/etnaviv: dump: fix sparse warnings
Marcus Folkesson (1):
mfd: da9052-spi: Change read-mask to write-mask
Masahiro Yamada (2):
s390/syscalls: Avoid creation of arch/arch/ directory
modpost: remove incorrect code in do_eisa_entry()
Mauro Carvalho Chehab (1):
media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set
Maxime Chevallier (1):
net: stmmac: dwmac-socfpga: Set RX watchdog interrupt as broken
Michal Suchanek (1):
powerpc/sstep: make emulate_vsx_load and emulate_vsx_store static
Michal Vrastil (1):
Revert "usb: gadget: composite: fix OS descriptors w_value logic"
Miguel Ojeda (1):
time: Fix references to _msecs_to_jiffies() handling of values
Mingwei Zheng (1):
net: rfkill: gpio: Add check for clk_enable()
Miquel Raynal (1):
mtd: rawnand: atmel: Fix possible memory leak
Muchun Song (1):
block: fix ordering between checking BLK_MQ_S_STOPPED request adding
Nicolas Bouchinet (1):
tty: ldsic: fix tty_ldisc_autoload sysctl's proc_handler
Nuno Sa (2):
dt-bindings: clock: axi-clkgen: include AXI clk
clk: clk-axi-clkgen: make sure to enable the AXI bus clock
Oleksij Rempel (2):
net: usb: lan78xx: Fix memory leak on device unplug by freeing PHY device
net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
Oliver Neukum (1):
USB: chaoskey: fail open after removal
Pavan Chebbi (1):
tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets
Priyanka Singh (1):
EDAC/fsl_ddr: Fix bad bit shift operations
Puranjay Mohan (1):
nvme: fix metadata handling in nvme-passthrough
Qingfang Deng (1):
jffs2: fix use of uninitialized variable
Qiu-ji Chen (2):
ASoC: codecs: Fix atomicity violation in snd_soc_component_get_drvdata()
media: wl128x: Fix atomicity violation in fmc_send_cmd()
Ryusuke Konishi (2):
nilfs2: fix null-ptr-deref in block_touch_buffer tracepoint
nilfs2: fix null-ptr-deref in block_dirty_buffer tracepoint
Stanislaw Gruszka (1):
spi: Fix acpi deferred irq probe
Takashi Iwai (3):
ALSA: us122l: Use snd_card_free_when_closed() at disconnection
ALSA: caiaq: Use snd_card_free_when_closed() at disconnection
ALSA: 6fire: Release resources at card release
Thadeu Lima de Souza Cascardo (1):
hfsplus: don't query the device logical block size multiple times
Theodore Ts'o (1):
ext4: fix FS_IOC_GETFSMAP handling
Thinh Nguyen (1):
usb: dwc3: gadget: Fix checking for number of TRBs left
Thomas Zimmermann (1):
fbdev/sh7760fb: Alloc DMA memory from hardware device
Tiwei Bie (4):
um: ubd: Do not use drvdata in release
um: net: Do not use drvdata in release
um: vector: Do not use drvdata in release
um: Fix the return value of elf_core_copy_task_fpregs
Tomi Valkeinen (1):
drm/omap: Fix locking in omap_gem_new_dmabuf()
Trond Myklebust (1):
NFSv4.0: Fix a use-after-free problem in the asynchronous open()
Vitalii Mordan (2):
marvell: pxa168_eth: fix call balance of pep->clk handling routines
usb: ehci-spear: fix call balance of sehci clk handling routines
Will Deacon (1):
arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled
Ye Bin (1):
scsi: bfa: Fix use-after-free in bfad_im_module_exit()
Yi Yang (1):
crypto: pcrypt - Call crypto layer directly when padata_do_parallel() return -EBUSY
Yongliang Gao (1):
rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
Yuan Can (1):
cpufreq: loongson2: Unregister platform_driver on failure
Yuan Chen (1):
bpf: Fix the xdp_adjust_tail sample prog issue
Zeng Heng (1):
scsi: fusion: Remove unused variable 'rc'
Zhang Changzhong (1):
mfd: rt5033: Fix missing regmap_del_irq_chip()
Zhen Lei (2):
scsi: qedi: Fix a possible memory leak in qedi_alloc_and_init_sb()
fbdev: sh7760fb: Fix a possible memory leak in sh7760fb_alloc_mem()
Zhihao Cheng (3):
ubi: wl: Put source PEB into correct list if trying locking LEB failed
ubifs: Correct the total block count by deducting journal reservation
ubi: fastmap: Fix duplicate slab cache names while attaching
chao liu (1):
apparmor: fix 'Do simple duplicate message elimination'
weiyufeng (1):
PCI: cpqphp: Use PCI_POSSIBLE_ERROR() to check config reads
The patch titled
Subject: zram: fix uninitialized ZRAM not releasing backing device
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
zram-fix-uninitialized-zram-not-releasing-backing-device.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Kairui Song <kasong(a)tencent.com>
Subject: zram: fix uninitialized ZRAM not releasing backing device
Date: Tue, 10 Dec 2024 00:57:16 +0800
Setting backing device is done before ZRAM initialization. If we set the
backing device, then remove the ZRAM module without initializing the
device, the backing device reference will be leaked and the device will be
hold forever.
Fix this by always reset the ZRAM fully on rmmod or reset store.
Link: https://lkml.kernel.org/r/20241209165717.94215-3-ryncsn@gmail.com
Fixes: 013bf95a83ec ("zram: add interface to specif backing device")
Signed-off-by: Kairui Song <kasong(a)tencent.com>
Reported-by: Desheng Wu <deshengwu(a)tencent.com>
Suggested-by: Sergey Senozhatsky <senozhatsky(a)chromium.org>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
drivers/block/zram/zram_drv.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-fix-uninitialized-zram-not-releasing-backing-device
+++ a/drivers/block/zram/zram_drv.c
@@ -1444,12 +1444,16 @@ static void zram_meta_free(struct zram *
size_t num_pages = disksize >> PAGE_SHIFT;
size_t index;
+ if (!zram->table)
+ return;
+
/* Free all pages that are still in this zram device */
for (index = 0; index < num_pages; index++)
zram_free_page(zram, index);
zs_destroy_pool(zram->mem_pool);
vfree(zram->table);
+ zram->table = NULL;
}
static bool zram_meta_alloc(struct zram *zram, u64 disksize)
@@ -2334,11 +2338,6 @@ static void zram_reset_device(struct zra
zram->limit_pages = 0;
- if (!init_done(zram)) {
- up_write(&zram->init_lock);
- return;
- }
-
set_capacity_and_notify(zram->disk, 0);
part_stat_set_all(zram->disk->part0, 0);
_
Patches currently in -mm which might be from kasong(a)tencent.com are
zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch
zram-fix-uninitialized-zram-not-releasing-backing-device.patch
The patch titled
Subject: nilfs2: prevent use of deleted inode
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
nilfs2-prevent-use-of-deleted-inode.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Edward Adam Davis <eadavis(a)qq.com>
Subject: nilfs2: prevent use of deleted inode
Date: Mon, 9 Dec 2024 15:56:52 +0900
syzbot reported a WARNING in nilfs_rmdir. [1]
Because the inode bitmap is corrupted, an inode with an inode number that
should exist as a ".nilfs" file was reassigned by nilfs_mkdir for "file0",
causing an inode duplication during execution. And this causes an
underflow of i_nlink in rmdir operations.
The inode is used twice by the same task to unmount and remove directories
".nilfs" and "file0", it trigger warning in nilfs_rmdir.
Avoid to this issue, check i_nlink in nilfs_iget(), if it is 0, it means
that this inode has been deleted, and iput is executed to reclaim it.
[1]
WARNING: CPU: 1 PID: 5824 at fs/inode.c:407 drop_nlink+0xc4/0x110 fs/inode.c:407
...
Call Trace:
<TASK>
nilfs_rmdir+0x1b0/0x250 fs/nilfs2/namei.c:342
vfs_rmdir+0x3a3/0x510 fs/namei.c:4394
do_rmdir+0x3b5/0x580 fs/namei.c:4453
__do_sys_rmdir fs/namei.c:4472 [inline]
__se_sys_rmdir fs/namei.c:4470 [inline]
__x64_sys_rmdir+0x47/0x50 fs/namei.c:4470
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Link: https://lkml.kernel.org/r/20241209065759.6781-1-konishi.ryusuke@gmail.com
Fixes: d25006523d0b ("nilfs2: pathname operations")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Reported-by: syzbot+9260555647a5132edd48(a)syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9260555647a5132edd48
Tested-by: syzbot+9260555647a5132edd48(a)syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis(a)qq.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
fs/nilfs2/inode.c | 8 +++++++-
fs/nilfs2/namei.c | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
--- a/fs/nilfs2/inode.c~nilfs2-prevent-use-of-deleted-inode
+++ a/fs/nilfs2/inode.c
@@ -544,8 +544,14 @@ struct inode *nilfs_iget(struct super_bl
inode = nilfs_iget_locked(sb, root, ino);
if (unlikely(!inode))
return ERR_PTR(-ENOMEM);
- if (!(inode->i_state & I_NEW))
+
+ if (!(inode->i_state & I_NEW)) {
+ if (!inode->i_nlink) {
+ iput(inode);
+ return ERR_PTR(-ESTALE);
+ }
return inode;
+ }
err = __nilfs_read_inode(sb, root, ino, inode);
if (unlikely(err)) {
--- a/fs/nilfs2/namei.c~nilfs2-prevent-use-of-deleted-inode
+++ a/fs/nilfs2/namei.c
@@ -67,6 +67,11 @@ nilfs_lookup(struct inode *dir, struct d
inode = NULL;
} else {
inode = nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino);
+ if (inode == ERR_PTR(-ESTALE)) {
+ nilfs_error(dir->i_sb,
+ "deleted inode referenced: %lu", ino);
+ return ERR_PTR(-EIO);
+ }
}
return d_splice_alias(inode, dentry);
_
Patches currently in -mm which might be from eadavis(a)qq.com are
nilfs2-prevent-use-of-deleted-inode.patch
The patch titled
Subject: zram: refuse to use zero sized block device as backing device
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Kairui Song <kasong(a)tencent.com>
Subject: zram: refuse to use zero sized block device as backing device
Date: Tue, 10 Dec 2024 00:57:15 +0800
Patch series "zram: fix backing device setup issue", v2.
This series fixes two bugs of backing device setting:
- ZRAM should reject using a zero sized (or the uninitialized ZRAM
device itself) as the backing device.
- Fix backing device leaking when removing a uninitialized ZRAM
device.
This patch (of 2):
Setting a zero sized block device as backing device is pointless, and one
can easily create a recursive loop by setting the uninitialized ZRAM
device itself as its own backing device by (zram0 is uninitialized):
echo /dev/zram0 > /sys/block/zram0/backing_dev
It's definitely a wrong config, and the module will pin itself, kernel
should refuse doing so in the first place.
By refusing to use zero sized device we avoided misuse cases including
this one above.
Link: https://lkml.kernel.org/r/20241209165717.94215-1-ryncsn@gmail.com
Link: https://lkml.kernel.org/r/20241209165717.94215-2-ryncsn@gmail.com
Fixes: 013bf95a83ec ("zram: add interface to specif backing device")
Signed-off-by: Kairui Song <kasong(a)tencent.com>
Reported-by: Desheng Wu <deshengwu(a)tencent.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky(a)chromium.org>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
drivers/block/zram/zram_drv.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/block/zram/zram_drv.c~zram-refuse-to-use-zero-sized-block-device-as-backing-device
+++ a/drivers/block/zram/zram_drv.c
@@ -614,6 +614,12 @@ static ssize_t backing_dev_store(struct
}
nr_pages = i_size_read(inode) >> PAGE_SHIFT;
+ /* Refuse to use zero sized device (also prevents self reference) */
+ if (!nr_pages) {
+ err = -EINVAL;
+ goto out;
+ }
+
bitmap_sz = BITS_TO_LONGS(nr_pages) * sizeof(long);
bitmap = kvzalloc(bitmap_sz, GFP_KERNEL);
if (!bitmap) {
_
Patches currently in -mm which might be from kasong(a)tencent.com are
zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch
zram-fix-uninitialized-zram-not-releasing-backing-device.patch
Three fixes I'd like to get into stable.
These conflict with my psy extensions series [0],
I'd like to apply the fixes first.
[0] https://lore.kernel.org/lkml/20241205-power-supply-extensions-v5-0-f0f996db…
Signed-off-by: Thomas Weißschuh <linux(a)weissschuh.net>
---
Thomas Weißschuh (3):
power: supply: cros_charge-control: add mutex for driver data
power: supply: cros_charge-control: allow start_threshold == end_threshold
power: supply: cros_charge-control: hide start threshold on v2 cmd
drivers/power/supply/cros_charge-control.c | 36 ++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 9 deletions(-)
---
base-commit: 7503345ac5f5e82fd9a36d6e6b447c016376403a
change-id: 20241202-cros_charge-control-v2-d155194f5304
Best regards,
--
Thomas Weißschuh <linux(a)weissschuh.net>
Currently, the pointer stored in call->prog_array is loaded in
__uprobe_perf_func(), with no RCU annotation and no RCU protection, so the
loaded pointer can immediately be dangling. Later,
bpf_prog_run_array_uprobe() starts a RCU-trace read-side critical section,
but this is too late. It then uses rcu_dereference_check(), but this use of
rcu_dereference_check() does not actually dereference anything.
It looks like the intention was to pass a pointer to the member
call->prog_array into bpf_prog_run_array_uprobe() and actually dereference
the pointer in there. Fix the issue by actually doing that.
Fixes: 8c7dcb84e3b7 ("bpf: implement sleepable uprobes by chaining gps")
Cc: stable(a)vger.kernel.org
Signed-off-by: Jann Horn <jannh(a)google.com>
---
To reproduce, in include/linux/bpf.h, patch in a mdelay(10000) directly
before the might_fault() in bpf_prog_run_array_uprobe() and add an
include of linux/delay.h.
Build this userspace program:
```
$ cat dummy.c
#include <stdio.h>
int main(void) {
printf("hello world\n");
}
$ gcc -o dummy dummy.c
```
Then build this BPF program and load it (change the path to point to
the "dummy" binary you built):
```
$ cat bpf-uprobe-kern.c
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
SEC("uprobe//home/user/bpf-uprobe-uaf/dummy:main")
int BPF_UPROBE(main_uprobe) {
bpf_printk("main uprobe triggered\n");
return 0;
}
$ clang -O2 -g -target bpf -c -o bpf-uprobe-kern.o bpf-uprobe-kern.c
$ sudo bpftool prog loadall bpf-uprobe-kern.o uprobe-test autoattach
```
Then run ./dummy in one terminal, and after launching it, run
`sudo umount uprobe-test` in another terminal. Once the 10-second
mdelay() is over, a use-after-free should occur, which may or may
not crash your kernel at the `prog->sleepable` check in
bpf_prog_run_array_uprobe() depending on your luck.
---
Changes in v2:
- remove diff chunk in patch notes that confuses git
- Link to v1: https://lore.kernel.org/r/20241206-bpf-fix-uprobe-uaf-v1-1-6869c8a17258@goo…
---
include/linux/bpf.h | 4 ++--
kernel/trace/trace_uprobe.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index eaee2a819f4c150a34a7b1075584711609682e4c..00b3c5b197df75a0386233b9885b480b2ce72f5f 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2193,7 +2193,7 @@ bpf_prog_run_array(const struct bpf_prog_array *array,
* rcu-protected dynamically sized maps.
*/
static __always_inline u32
-bpf_prog_run_array_uprobe(const struct bpf_prog_array __rcu *array_rcu,
+bpf_prog_run_array_uprobe(struct bpf_prog_array __rcu **array_rcu,
const void *ctx, bpf_prog_run_fn run_prog)
{
const struct bpf_prog_array_item *item;
@@ -2210,7 +2210,7 @@ bpf_prog_run_array_uprobe(const struct bpf_prog_array __rcu *array_rcu,
run_ctx.is_uprobe = true;
- array = rcu_dereference_check(array_rcu, rcu_read_lock_trace_held());
+ array = rcu_dereference_check(*array_rcu, rcu_read_lock_trace_held());
if (unlikely(!array))
goto out;
old_run_ctx = bpf_set_run_ctx(&run_ctx.run_ctx);
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index fed382b7881b82ee3c334ea77860cce77581a74d..c4eef1eb5ddb3c65205aa9d64af1c72d62fab87f 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -1404,7 +1404,7 @@ static void __uprobe_perf_func(struct trace_uprobe *tu,
if (bpf_prog_array_valid(call)) {
u32 ret;
- ret = bpf_prog_run_array_uprobe(call->prog_array, regs, bpf_prog_run);
+ ret = bpf_prog_run_array_uprobe(&call->prog_array, regs, bpf_prog_run);
if (!ret)
return;
}
---
base-commit: 509df676c2d79c985ec2eaa3e3a3bbe557645861
change-id: 20241206-bpf-fix-uprobe-uaf-53d928bab3d0
--
Jann Horn <jannh(a)google.com>