Commit Graph

1165099 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
fcfc7a6d64 Merge 6.1.112 into android14-6.1-lts
Changes in 6.1.112
	ASoC: SOF: mediatek: Add missing board compatible
	ASoC: allow module autoloading for table db1200_pids
	ASoC: allow module autoloading for table board_ids
	ALSA: hda/realtek - Fixed ALC256 headphone no sound
	ALSA: hda/realtek - FIxed ALC285 headphone no sound
	scsi: lpfc: Fix overflow build issue
	pinctrl: at91: make it work with current gpiolib
	hwmon: (asus-ec-sensors) remove VRM temp X570-E GAMING
	microblaze: don't treat zero reserved memory regions as error
	net: ftgmac100: Ensure tx descriptor updates are visible
	LoongArch: Define ARCH_IRQ_INIT_FLAGS as IRQ_NOPROBE
	wifi: iwlwifi: lower message level for FW buffer destination
	wifi: iwlwifi: mvm: fix iwl_mvm_scan_fits() calculation
	wifi: iwlwifi: mvm: pause TCM when the firmware is stopped
	wifi: iwlwifi: mvm: don't wait for tx queues if firmware is dead
	wifi: mac80211: free skb on error path in ieee80211_beacon_get_ap()
	wifi: iwlwifi: clear trans->state earlier upon error
	can: mcp251xfd: mcp251xfd_ring_init(): check TX-coalescing configuration
	ASoC: Intel: soc-acpi-cht: Make Lenovo Yoga Tab 3 X90F DMI match less strict
	ASoC: intel: fix module autoloading
	ASoC: tda7419: fix module autoloading
	spi: spidev: Add an entry for elgin,jg10309-01
	drm: komeda: Fix an issue related to normalized zpos
	spi: bcm63xx: Enable module autoloading
	smb: client: fix hang in wait_for_response() for negproto
	x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency
	tools: hv: rm .*.cmd when make clean
	block: Fix where bio IO priority gets set
	spi: spidev: Add missing spi_device_id for jg10309-01
	ocfs2: add bounds checking to ocfs2_xattr_find_entry()
	ocfs2: strict bound check before memcmp in ocfs2_xattr_find_entry()
	xfs: dquot shrinker doesn't check for XFS_DQFLAG_FREEING
	xfs: Fix deadlock on xfs_inodegc_worker
	xfs: fix extent busy updating
	xfs: don't use BMBT btree split workers for IO completion
	xfs: fix low space alloc deadlock
	xfs: prefer free inodes at ENOSPC over chunk allocation
	xfs: block reservation too large for minleft allocation
	xfs: fix uninitialized variable access
	xfs: quotacheck failure can race with background inode inactivation
	xfs: fix BUG_ON in xfs_getbmap()
	xfs: buffer pins need to hold a buffer reference
	xfs: defered work could create precommits
	xfs: fix AGF vs inode cluster buffer deadlock
	xfs: collect errors from inodegc for unlinked inode recovery
	xfs: fix ag count overflow during growfs
	xfs: remove WARN when dquot cache insertion fails
	xfs: fix the calculation for "end" and "length"
	xfs: load uncached unlinked inodes into memory on demand
	xfs: fix negative array access in xfs_getbmap
	xfs: fix unlink vs cluster buffer instantiation race
	xfs: correct calculation for agend and blockcount
	xfs: use i_prev_unlinked to distinguish inodes that are not on the unlinked list
	xfs: reload entire unlinked bucket lists
	xfs: make inode unlinked bucket recovery work with quotacheck
	xfs: fix reloading entire unlinked bucket lists
	xfs: set bnobt/cntbt numrecs correctly when formatting new AGs
	xfs: journal geometry is not properly bounds checked
	netfilter: nft_socket: make cgroupsv2 matching work with namespaces
	netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
	netfilter: nft_set_pipapo: walk over current view on netlink dump
	netfilter: nf_tables: missing iterator type in lookup walk
	Revert "wifi: cfg80211: check wiphy mutex is held for wdev mutex"
	gpiolib: cdev: Ignore reconfiguration without direction
	gpio: prevent potential speculation leaks in gpio_device_get_desc()
	can: mcp251xfd: properly indent labels
	can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop()
	selftests: mptcp: join: restrict fullmesh endp on 1st sf
	btrfs: calculate the right space for delayed refs when updating global reserve
	powercap: RAPL: fix invalid initialization for pl4_supported field
	x86/mm: Switch to new Intel CPU model defines
	USB: serial: pl2303: add device id for Macrosilicon MS3020
	USB: usbtmc: prevent kernel-usb-infoleak
	Linux 6.1.112

Change-Id: Iaa071658c42ce95ef06571de3232cfa7ddc96689
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 15:11:38 +00:00
Greg Kroah-Hartman
8fe68de869 Merge 6.1.111 into android14-6.1-lts
Changes in 6.1.111
	ksmbd: override fsids for share path check
	ksmbd: override fsids for smb2_query_info()
	usbnet: ipheth: fix carrier detection in modes 1 and 4
	net: ethernet: use ip_hdrlen() instead of bit shift
	drm: panel-orientation-quirks: Add quirk for Ayn Loki Zero
	drm: panel-orientation-quirks: Add quirk for Ayn Loki Max
	net: phy: vitesse: repair vsc73xx autonegotiation
	powerpc/mm: Fix boot warning with hugepages and CONFIG_DEBUG_VIRTUAL
	btrfs: update target inode's ctime on unlink
	Input: ads7846 - ratelimit the spi_sync error message
	Input: synaptics - enable SMBus for HP Elitebook 840 G2
	HID: multitouch: Add support for GT7868Q
	scripts: kconfig: merge_config: config files: add a trailing newline
	platform/surface: aggregator_registry: Add Support for Surface Pro 10
	platform/surface: aggregator_registry: Add support for Surface Laptop Go 3
	drm/msm/adreno: Fix error return if missing firmware-name
	Input: i8042 - add Fujitsu Lifebook E756 to i8042 quirk table
	smb/server: fix return value of smb2_open()
	NFSv4: Fix clearing of layout segments in layoutreturn
	NFS: Avoid unnecessary rescanning of the per-server delegation list
	platform/x86: panasonic-laptop: Fix SINF array out of bounds accesses
	platform/x86: panasonic-laptop: Allocate 1 entry extra in the sinf array
	mptcp: pm: Fix uaf in __timer_delete_sync
	arm64: dts: rockchip: fix eMMC/SPI corruption when audio has been used on RK3399 Puma
	arm64: dts: rockchip: override BIOS_DISABLE signal via GPIO hog on RK3399 Puma
	minmax: reduce min/max macro expansion in atomisp driver
	net: tighten bad gso csum offset check in virtio_net_hdr
	dm-integrity: fix a race condition when accessing recalc_sector
	mm: avoid leaving partial pfn mappings around in error case
	net: xilinx: axienet: Fix race in axienet_stop
	pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
	fs/ntfs3: Use kvfree to free memory allocated by kvmalloc
	arm64: dts: rockchip: fix PMIC interrupt pin in pinctrl for ROCK Pi E
	eeprom: digsy_mtc: Fix 93xx46 driver probe failure
	cxl/core: Fix incorrect vendor debug UUID define
	selftests/bpf: Support SOCK_STREAM in unix_inet_redir_to_connected()
	hwmon: (pmbus) Conditionally clear individual status bits for pmbus rev >= 1.2
	ice: fix accounting for filters shared by multiple VSIs
	igb: Always call igb_xdp_ring_update_tail() under Tx lock
	net/mlx5: Update the list of the PCI supported devices
	net/mlx5e: Add missing link modes to ptys2ethtool_map
	net/mlx5: Explicitly set scheduling element and TSAR type
	net/mlx5: Add missing masks and QoS bit masks for scheduling elements
	net/mlx5: Correct TASR typo into TSAR
	net/mlx5: Verify support for scheduling element and TSAR type
	net/mlx5: Fix bridge mode operations when there are no VFs
	fou: fix initialization of grc
	octeontx2-af: Set XOFF on other child transmit schedulers during SMQ flush
	octeontx2-af: Modify SMQ flush sequence to drop packets
	net: ftgmac100: Enable TX interrupt to avoid TX timeout
	netfilter: nft_socket: fix sk refcount leaks
	net: dpaa: Pad packets to ETH_ZLEN
	spi: nxp-fspi: fix the KASAN report out-of-bounds bug
	soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
	dma-buf: heaps: Fix off-by-one in CMA heap fault handler
	drm/amdgpu/atomfirmware: Silence UBSAN warning
	spi: geni-qcom: Convert to platform remove callback returning void
	spi: geni-qcom: Undo runtime PM changes at driver exit time
	spi: geni-qcom: Fix incorrect free_irq() sequence
	drm/i915/guc: prevent a possible int overflow in wq offsets
	pinctrl: meteorlake: Add Arrow Lake-H/U ACPI ID
	ASoC: meson: axg-card: fix 'use-after-free'
	Linux 6.1.111

Change-Id: I797d56398f40448fc26f301327ab9500346f4eee
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 15:10:46 +00:00
Greg Kroah-Hartman
8b7627ad15 Merge 6.1.110 into android14-6.1-lts
Changes in 6.1.110
	sch/netem: fix use after free in netem_dequeue
	ASoC: dapm: Fix UAF for snd_soc_pcm_runtime object
	KVM: x86: Acquire kvm->srcu when handling KVM_SET_VCPU_EVENTS
	KVM: SVM: fix emulation of msr reads/writes of MSR_FS_BASE and MSR_GS_BASE
	KVM: SVM: Don't advertise Bus Lock Detect to guest if SVM support is missing
	ALSA: hda/conexant: Add pincfg quirk to enable top speakers on Sirius devices
	ALSA: hda/realtek: add patch for internal mic in Lenovo V145
	ALSA: hda/realtek: Support mute LED on HP Laptop 14-dq2xxx
	ksmbd: unset the binding mark of a reused connection
	ksmbd: Unlock on in ksmbd_tcp_set_interfaces()
	ata: libata: Fix memory leak for error path in ata_host_alloc()
	x86/tdx: Fix data leak in mmio_read()
	perf/x86/intel: Limit the period on Haswell
	irqchip/gic-v2m: Fix refcount leak in gicv2m_of_init()
	x86/kaslr: Expose and use the end of the physical memory address space
	rtmutex: Drop rt_mutex::wait_lock before scheduling
	nvme-pci: Add sleep quirk for Samsung 990 Evo
	Revert "Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE"
	Bluetooth: MGMT: Ignore keys being loaded with invalid type
	mmc: core: apply SD quirks earlier during probe
	mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K
	mmc: sdhci-of-aspeed: fix module autoloading
	mmc: cqhci: Fix checking of CQHCI_HALT state
	fuse: update stats for pages in dropped aux writeback list
	fuse: use unsigned type for getxattr/listxattr size truncation
	clk: qcom: clk-alpha-pll: Fix the pll post div mask
	clk: qcom: clk-alpha-pll: Fix the trion pll postdiv set rate API
	can: mcp251x: fix deadlock if an interrupt occurs during mcp251x_open
	spi: rockchip: Resolve unbalanced runtime PM / system PM handling
	tracing: Avoid possible softlockup in tracing_iter_reset()
	net: mctp-serial: Fix missing escapes on transmit
	x86/fpu: Avoid writing LBR bit to IA32_XSS unless supported
	Revert "drm/amdgpu: align pp_power_profile_mode with kernel docs"
	tcp_bpf: fix return value of tcp_bpf_sendmsg()
	ila: call nf_unregister_net_hooks() sooner
	sched: sch_cake: fix bulk flow accounting logic for host fairness
	nilfs2: fix missing cleanup on rollforward recovery error
	nilfs2: protect references to superblock parameters exposed in sysfs
	nilfs2: fix state management in error path of log writing function
	ALSA: control: Apply sanity check of input values for user elements
	ALSA: hda: Add input value sanity checks to HDMI channel map controls
	smack: unix sockets: fix accept()ed socket label
	ELF: fix kernel.randomize_va_space double read
	irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1
	af_unix: Remove put_pid()/put_cred() in copy_peercred().
	x86/kmsan: Fix hook for unaligned accesses
	iommu: sun50i: clear bypass register
	netfilter: nf_conncount: fix wrong variable type
	udf: Avoid excessive partition lengths
	fs/ntfs3: One more reason to mark inode bad
	media: vivid: fix wrong sizeimage value for mplane
	leds: spi-byte: Call of_node_put() on error path
	wifi: brcmsmac: advertise MFP_CAPABLE to enable WPA3
	usb: uas: set host status byte on data completion error
	usb: gadget: aspeed_udc: validate endpoint index for ast udc
	drm/amd/display: Check HDCP returned status
	drm/amdgpu: Fix smatch static checker warning
	drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts
	media: vivid: don't set HDMI TX controls if there are no HDMI outputs
	PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)
	Input: ili210x - use kvmalloc() to allocate buffer for firmware update
	media: qcom: camss: Add check for v4l2_fwnode_endpoint_parse
	pcmcia: Use resource_size function on resource object
	drm/amd/display: Check denominator pbn_div before used
	drm/amdgpu: check for LINEAR_ALIGNED correctly in check_tiling_flags_gfx6
	can: bcm: Remove proc entry when dev is unregistered.
	can: m_can: Release irq on error in m_can_open
	can: mcp251xfd: fix ring configuration when switching from CAN-CC to CAN-FD mode
	rust: Use awk instead of recent xargs
	rust: kbuild: fix export of bss symbols
	cifs: Fix FALLOC_FL_ZERO_RANGE to preflush buffered part of target region
	igb: Fix not clearing TimeSync interrupts for 82580
	ice: Add netif_device_attach/detach into PF reset flow
	platform/x86: dell-smbios: Fix error path in dell_smbios_init()
	regulator: Add of_regulator_bulk_get_all
	regulator: core: Stub devm_regulator_bulk_get_const() if !CONFIG_REGULATOR
	igc: Unlock on error in igc_io_resume()
	ice: Use ice_max_xdp_frame_size() in ice_xdp_setup_prog()
	ice: allow hot-swapping XDP programs
	ice: do not bring the VSI up, if it was down before the XDP setup
	usbnet: modern method to get random MAC
	bareudp: Fix device stats updates.
	fou: Fix null-ptr-deref in GRO.
	net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN
	net: dsa: vsc73xx: fix possible subblocks range of CAPT block
	firmware: cs_dsp: Don't allow writes to read-only controls
	phy: zynqmp: Take the phy mutex in xlate
	ASoC: topology: Properly initialize soc_enum values
	dm init: Handle minors larger than 255
	iommu/vt-d: Handle volatile descriptor status read
	cgroup: Protect css->cgroup write under css_set_lock
	um: line: always fill *error_out in setup_one_line()
	devres: Initialize an uninitialized struct member
	pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
	crypto: qat - fix unintentional re-enabling of error interrupts
	hwmon: (adc128d818) Fix underflows seen when writing limit attributes
	hwmon: (lm95234) Fix underflows seen when writing limit attributes
	hwmon: (nct6775-core) Fix underflows seen when writing limit attributes
	hwmon: (w83627ehf) Fix underflows seen when writing limit attributes
	libbpf: Add NULL checks to bpf_object__{prev_map,next_map}
	drm/amdgpu: Set no_hw_access when VF request full GPU fails
	ext4: fix possible tid_t sequence overflows
	dma-mapping: benchmark: Don't starve others when doing the test
	wifi: mwifiex: Do not return unused priv in mwifiex_get_priv_by_id()
	smp: Add missing destroy_work_on_stack() call in smp_call_on_cpu()
	fs/ntfs3: Check more cases when directory is corrupted
	btrfs: replace BUG_ON with ASSERT in walk_down_proc()
	btrfs: clean up our handling of refs == 0 in snapshot delete
	btrfs: replace BUG_ON() with error handling at update_ref_for_cow()
	riscv: set trap vector earlier
	PCI: Add missing bridge lock to pci_bus_lock()
	tcp: Don't drop SYN+ACK for simultaneous connect().
	net: dpaa: avoid on-stack arrays of NR_CPUS elements
	i3c: mipi-i3c-hci: Error out instead on BUG_ON() in IBI DMA setup
	kselftests: dmabuf-heaps: Ensure the driver name is null-terminated
	btrfs: initialize location to fix -Wmaybe-uninitialized in btrfs_lookup_dentry()
	s390/vmlinux.lds.S: Move ro_after_init section behind rodata section
	HID: cougar: fix slab-out-of-bounds Read in cougar_report_fixup
	HID: amd_sfh: free driver_data after destroying hid device
	Input: uinput - reject requests with unreasonable number of slots
	usbnet: ipheth: race between ipheth_close and error handling
	Squashfs: sanity check symbolic link size
	of/irq: Prevent device address out-of-bounds read in interrupt map walk
	lib/generic-radix-tree.c: Fix rare race in __genradix_ptr_alloc()
	MIPS: cevt-r4k: Don't call get_c0_compare_int if timer irq is installed
	ata: pata_macio: Use WARN instead of BUG
	NFSv4: Add missing rescheduling points in nfs_client_return_marked_delegations
	selftests: mptcp: fix backport issues
	selftests: mptcp: join: validate event numbers
	selftests: mptcp: join: check re-re-adding ID 0 signal
	io_uring/io-wq: stop setting PF_NO_SETAFFINITY on io-wq workers
	io_uring/sqpoll: Do not set PF_NO_SETAFFINITY on sqpoll threads
	tcp: process the 3rd ACK with sk_socket for TFO/MPTCP
	staging: iio: frequency: ad9834: Validate frequency parameter value
	iio: buffer-dmaengine: fix releasing dma channel on error
	iio: fix scale application in iio_convert_raw_to_processed_unlocked
	iio: adc: ad7124: fix config comparison
	iio: adc: ad7606: remove frstdata check for serial mode
	iio: adc: ad7124: fix chip ID mismatch
	usb: dwc3: core: update LC timer as per USB Spec V3.2
	binder: fix UAF caused by offsets overwrite
	nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc
	uio_hv_generic: Fix kernel NULL pointer dereference in hv_uio_rescind
	Drivers: hv: vmbus: Fix rescind handling in uio_hv_generic
	VMCI: Fix use-after-free when removing resource in vmci_resource_remove()
	clocksource/drivers/imx-tpm: Fix return -ETIME when delta exceeds INT_MAX
	clocksource/drivers/imx-tpm: Fix next event not taking effect sometime
	clocksource/drivers/timer-of: Remove percpu irq related code
	uprobes: Use kzalloc to allocate xol area
	perf/aux: Fix AUX buffer serialization
	fuse: add "expire only" mode to FUSE_NOTIFY_INVAL_ENTRY
	fuse: allow non-extending parallel direct writes on the same file
	fuse: add request extension
	fuse: fix memory leak in fuse_create_open
	net: mana: Fix error handling in mana_create_txq/rxq's NAPI cleanup
	workqueue: wq_watchdog_touch is always called with valid CPU
	workqueue: Improve scalability of workqueue watchdog touch
	ACPI: processor: Return an error if acpi_processor_get_info() fails in processor_add()
	ACPI: processor: Fix memory leaks in error paths of processor_add()
	arm64: acpi: Move get_cpu_for_acpi_id() to a header
	arm64: acpi: Harden get_cpu_for_acpi_id() against missing CPU entry
	can: mcp251xfd: mcp251xfd_handle_rxif_ring_uinc(): factor out in separate function
	can: mcp251xfd: rx: prepare to workaround broken RX FIFO head index erratum
	can: mcp251xfd: clarify the meaning of timestamp
	can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd
	drm/amd: Add gfx12 swizzle mode defs
	drm/amdgpu: handle gfx12 in amdgpu_display_verify_sizes
	powerpc/64e: remove unused IBM HTW code
	powerpc/64e: split out nohash Book3E 64-bit code
	powerpc/64e: Define mmu_pte_psize static
	ASoC: tegra: Fix CBB error during probe()
	nvmet-tcp: fix kernel crash if commands allocation fails
	ASoc: SOF: topology: Clear SOF link platform name upon unload
	ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode
	drm/i915/fence: Mark debug_fence_init_onstack() with __maybe_unused
	drm/i915/fence: Mark debug_fence_free() with __maybe_unused
	gpio: rockchip: fix OF node leak in probe()
	gpio: modepin: Enable module autoloading
	ublk_drv: fix NULL pointer dereference in ublk_ctrl_start_recovery()
	x86/mm: Fix PTI for i386 some more
	btrfs: fix race between direct IO write and fsync when using same fd
	bpf: Silence a warning in btf_type_id_size()
	memcg: protect concurrent access to mem_cgroup_idr
	regulator: of: fix a NULL vs IS_ERR() check in of_regulator_bulk_get_all()
	fuse: add feature flag for expire-only
	Linux 6.1.110

Change-Id: I58340d95835bd9cb4da4dd8ce1d0e49c5070ea2e
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 15:09:39 +00:00
Greg Kroah-Hartman
b3fe05ecd2 Merge 5e20208dfe ("fuse: fix memory leak in fuse_create_open") into android14-6.1-lts
Steps on the way to 6.1.110

Resolves merge conflicts in:
	fs/fuse/fuse_i.h

Change-Id: Iee80d4790e074e54560b9c6cb9949474e4217346
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 11:27:02 +00:00
Greg Kroah-Hartman
99de38240f Revert "perf/aux: Fix AUX buffer serialization"
This reverts commit 9dc7ad2b67 which is
commit 2ab9d830262c132ab5db2f571003d80850d56b2a upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Id119523c115b8a3aec08978e22bdb4e894701923
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 09:40:08 +00:00
Greg Kroah-Hartman
2fa599b850 Revert "clocksource/drivers/timer-of: Remove percpu irq related code"
This reverts commit b62c4a07a3 which is
commit 471ef0b5a8aaca4296108e756b970acfc499ede4 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I9569403775730bf2219ee35aaf361371a0e961f4
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 09:39:00 +00:00
Greg Kroah-Hartman
ad793062e0 Merge 9dc7ad2b67 ("perf/aux: Fix AUX buffer serialization") into android14-6.1-lts
Steps on the way to 6.1.110

Resolves merge conflicts in:
	io_uring/sqpoll.c

Change-Id: Ic3cb865b98eb20277b5d566683e5c1f53a0d5e76
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 08:56:19 +00:00
Greg Kroah-Hartman
a8d720c192 Merge ae7b2bd3d4 ("mmc: cqhci: Fix checking of CQHCI_HALT state") into android14-6.1-lts
Steps on the way to 6.10.110

Change-Id: I1216c9bbd000b12d4527001399684236d905b6b6
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-02 06:11:12 +00:00
Greg Kroah-Hartman
eccb72fb65 Revert "hwspinlock: Introduce hwspin_lock_bust()"
This reverts commit 1227a242dd which is
commit 7c327d56597d8de1680cf24e956b704270d3d84a upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Iaf3c3ada1531c0d19e2f0825f33e125acbbbfbea
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 18:28:53 +00:00
Greg Kroah-Hartman
d0af2ae8d5 Merge 6.1.109 into android14-6.1-lts
Changes in 6.1.109
	drm: panel-orientation-quirks: Add quirk for OrangePi Neo
	scsi: ufs: core: Bypass quick recovery if force reset is needed
	ALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown
	ALSA: hda/conexant: Mute speakers at suspend / shutdown
	i2c: Fix conditional for substituting empty ACPI functions
	dma-debug: avoid deadlock between dma debug vs printk and netconsole
	net: usb: qmi_wwan: add MeiG Smart SRM825L
	ASoC: amd: yc: Support mic on Lenovo Thinkpad E14 Gen 6
	mptcp: make pm_remove_addrs_and_subflows static
	mptcp: pm: fix RM_ADDR ID for the initial subflow
	PCI/MSI: Fix UAF in msi_capability_init
	f2fs: fix to truncate preallocated blocks in f2fs_file_open()
	mptcp: pm: fullmesh: select the right ID later
	mptcp: pm: avoid possible UaF when selecting endp
	mptcp: pm: reuse ID 0 after delete and re-add
	mptcp: pm: fix ID 0 endp usage after multiple re-creations
	selftests: mptcp: join: validate fullmesh endp on 1st sf
	selftests: mptcp: join: check re-using ID of closed subflow
	selftests: mptcp: add explicit test case for remove/readd
	selftests: mptcp: join: test for flush/re-add endpoints
	selftests: mptcp: join: check re-using ID of unused ADD_ADDR
	selftests: mptcp: join: check re-adding init endp with != id
	mptcp: pr_debug: add missing \n at the end
	mptcp: avoid duplicated SUB_CLOSED events
	selftests: mptcp: join: check removing ID 0 endpoint
	selftests: mptcp: join: no extra msg if no counter
	selftests: mptcp: join: check re-re-adding ID 0 endp
	selftests: mptcp: join: cannot rm sf if closed
	drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr
	drm/amd/display: Assign linear_pitch_alignment even for VM
	drm/amdgpu: fix overflowed array index read warning
	drm/amdgpu/pm: Check the return value of smum_send_msg_to_smc
	drm/amd/pm: fix uninitialized variable warning
	drm/amd/pm: fix uninitialized variable warning for smu8_hwmgr
	drm/amd/pm: fix warning using uninitialized value of max_vid_step
	drm/amd/pm: Fix negative array index read
	drm/amd/pm: fix the Out-of-bounds read warning
	drm/amd/pm: fix uninitialized variable warnings for vega10_hwmgr
	drm/amdgpu: avoid reading vf2pf info size from FB
	drm/amd/display: Check gpio_id before used as array index
	drm/amd/display: Stop amdgpu_dm initialize when stream nums greater than 6
	drm/amd/display: Add array index check for hdcp ddc access
	drm/amd/display: Check num_valid_sets before accessing reader_wm_sets[]
	drm/amd/display: Check msg_id before processing transcation
	drm/amd/display: Fix Coverity INTEGER_OVERFLOW within dal_gpio_service_create
	drm/amd/display: Spinlock before reading event
	drm/amd/display: Ensure index calculation will not overflow
	drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration
	drm/amd/amdgpu: Check tbo resource pointer
	drm/amd/pm: fix uninitialized variable warnings for vangogh_ppt
	drm/amdgpu/pm: Fix uninitialized variable warning for smu10
	drm/amdgpu/pm: Fix uninitialized variable agc_btc_response
	drm/amdgpu: Fix out-of-bounds write warning
	drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number
	drm/amdgpu: fix ucode out-of-bounds read warning
	drm/amdgpu: fix mc_data out-of-bounds read warning
	drm/amdkfd: Reconcile the definition and use of oem_id in struct kfd_topology_device
	apparmor: fix possible NULL pointer dereference
	wifi: ath11k: initialize 'ret' in ath11k_qmi_load_file_target_mem()
	drm/amdgpu/pm: Check input value for CUSTOM profile mode setting on legacy SOCs
	drm/amdgpu: fix dereference after null check
	drm/amdgpu: fix the waring dereferencing hive
	drm/amd/pm: check specific index for aldebaran
	drm/amdgpu: the warning dereferencing obj for nbio_v7_4
	drm/amd/pm: check negtive return for table entries
	wifi: rtw89: ser: avoid multiple deinit on same CAM
	drm/amdgpu: update type of buf size to u32 for eeprom functions
	wifi: iwlwifi: remove fw_running op
	cpufreq: scmi: Avoid overflow of target_freq in fast switch
	PCI: al: Check IORESOURCE_BUS existence during probe
	hwspinlock: Introduce hwspin_lock_bust()
	RDMA/efa: Properly handle unexpected AQ completions
	ionic: fix potential irq name truncation
	pwm: xilinx: Fix u32 overflow issue in 32-bit width PWM mode.
	rcu/nocb: Remove buggy bypass lock contention mitigation
	usbip: Don't submit special requests twice
	usb: typec: ucsi: Fix null pointer dereference in trace
	fsnotify: clear PARENT_WATCHED flags lazily
	regmap: spi: Fix potential off-by-one when calculating reserved size
	smack: tcp: ipv4, fix incorrect labeling
	net/mlx5e: SHAMPO, Fix incorrect page release
	drm/meson: plane: Add error handling
	drm/bridge: tc358767: Check if fully initialized before signalling HPD event via IRQ
	dmaengine: altera-msgdma: use irq variant of spin_lock/unlock while invoking callbacks
	dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor
	hwmon: (k10temp) Check return value of amd_smn_read()
	wifi: cfg80211: make hash table duplicates more survivable
	driver: iio: add missing checks on iio_info's callback access
	block: remove the blk_flush_integrity call in blk_integrity_unregister
	drm/amd/display: added NULL check at start of dc_validate_stream
	drm/amd/display: Correct the defined value for AMDGPU_DMUB_NOTIFICATION_MAX
	drm/amd/display: Skip wbscl_set_scaler_filter if filter is null
	media: uvcvideo: Enforce alignment of frame and interval
	virtio_net: Fix napi_skb_cache_put warning
	Bluetooth: SCO: Fix possible circular locking dependency on sco_connect_cfm
	Bluetooth: SCO: fix sco_conn related locking and validity issues
	ext4: fix inode tree inconsistency caused by ENOMEM
	udf: Limit file size to 4TB
	ext4: reject casefold inode flag without casefold feature
	ext4: handle redirtying in ext4_bio_write_page()
	i2c: Use IS_REACHABLE() for substituting empty ACPI functions
	Linux 6.1.109

Change-Id: If689bfd671fb92d4092b9221d742121d3f3d669e
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 16:27:04 +00:00
Greg Kroah-Hartman
c59cc7f298 Merge 6.1.108 into android14-6.1-lts
Changes in 6.1.108
	drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc
	LoongArch: Remove the unused dma-direct.h
	btrfs: run delayed iputs when flushing delalloc
	smb/client: avoid dereferencing rdata=NULL in smb2_new_read_req()
	pinctrl: rockchip: correct RK3328 iomux width flag for GPIO2-B pins
	pinctrl: single: fix potential NULL dereference in pcs_get_function()
	of: Add cleanup.h based auto release via __free(device_node) markings
	wifi: wfx: repair open network AP mode
	wifi: mwifiex: duplicate static structs used in driver instances
	net: mana: Fix race of mana_hwc_post_rx_wqe and new hwc response
	mptcp: close subflow when receiving TCP+FIN
	mptcp: sched: check both backup in retrans
	mptcp: pm: skip connecting to already established sf
	mptcp: pm: reset MPC endp ID when re-added
	mptcp: pm: send ACK on an active subflow
	mptcp: pm: do not remove already closed subflows
	mptcp: pm: ADD_ADDR 0 is not a new address
	drm/amdgpu: align pp_power_profile_mode with kernel docs
	drm/amdgpu/swsmu: always force a state reprogram on init
	ata: libata-core: Fix null pointer dereference on error
	usb: typec: fix up incorrectly backported "usb: typec: tcpm: unregister existing source caps before re-registration"
	mmc: Avoid open coding by using mmc_op_tuning()
	mmc: mtk-sd: receive cmd8 data when hs400 tuning fail
	mptcp: unify pm get_local_id interfaces
	mptcp: pm: remove mptcp_pm_remove_subflow()
	mptcp: pm: only mark 'subflow' endp as available
	mptcp: pm: check add_addr_accept_max before accepting new ADD_ADDR
	of: Introduce for_each_*_child_of_node_scoped() to automate of_node_put() handling
	thermal: of: Fix OF node leak in thermal_of_trips_init() error path
	thermal: of: Fix OF node leak in of_thermal_zone_find() error paths
	ASoC: amd: acp: fix module autoloading
	ASoC: SOF: amd: Fix for acp init sequence
	pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE
	mm: Fix missing folio invalidation calls during truncation
	btrfs: fix extent map use-after-free when adding pages to compressed bio
	soundwire: stream: fix programming slave ports for non-continous port maps
	phy: xilinx: add runtime PM support
	phy: xilinx: phy-zynqmp: dynamic clock support for power-save
	phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume
	dmaengine: dw: Add peripheral bus width verification
	dmaengine: dw: Add memory bus width verification
	Bluetooth: hci_core: Fix not handling hibernation actions
	iommu: Do not return 0 from map_pages if it doesn't do anything
	netfilter: nf_tables: restore IP sanity checks for netdev/egress
	wifi: iwlwifi: fw: fix wgds rev 3 exact size
	ethtool: check device is present when getting link settings
	netfilter: nf_tables_ipv6: consider network offset in netdev/egress validation
	selftests: forwarding: no_forwarding: Down ports on cleanup
	selftests: forwarding: local_termination: Down ports on cleanup
	bonding: implement xdo_dev_state_free and call it after deletion
	gtp: fix a potential NULL pointer dereference
	sctp: fix association labeling in the duplicate COOKIE-ECHO case
	drm/amd/display: avoid using null object of framebuffer
	net: busy-poll: use ktime_get_ns() instead of local_clock()
	nfc: pn533: Add poll mod list filling check
	soc: qcom: cmd-db: Map shared memory as WC, not WB
	cdc-acm: Add DISABLE_ECHO quirk for GE HealthCare UI Controller
	USB: serial: option: add MeiG Smart SRM825L
	usb: dwc3: omap: add missing depopulate in probe error path
	usb: dwc3: core: Prevent USB core invalid event buffer address access
	usb: dwc3: st: fix probed platform device ref count on probe error path
	usb: dwc3: st: add missing depopulate in probe error path
	usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes()
	usb: cdnsp: fix incorrect index in cdnsp_get_hw_deq function
	usb: cdnsp: fix for Link TRB with TC
	phy: zynqmp: Enable reference clock correctly
	igc: Fix reset adapter logics when tx mode change
	igc: Fix qbv tx latency by setting gtxoffset
	scsi: aacraid: Fix double-free on probe failure
	apparmor: fix policy_unpack_test on big endian systems
	fbdev: offb: fix up missing cleanup.h
	Linux 6.1.108

Change-Id: I8ef0e85c12e4e2ecccaf467f40d86c559db7d007
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 14:30:35 +00:00
Greg Kroah-Hartman
db06d215a8 Revert "posix-timers: Ensure timer ID search-loop limit is valid"
This reverts commit 6a0ac84501 which is
commit 8ce8849dd1 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Ie271fbc9312fe3c85aa472ecad68db55985fd96c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 12:57:15 +00:00
Greg Kroah-Hartman
3e3e85a2c0 Revert "pid: Replace struct pid 1-element array with flex-array"
This reverts commit 5ea9dcfcd9 which is
commit b69f0aeb06 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Id78fddc05ab98cf79beff0adc409fbc588f7499f
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 12:56:11 +00:00
Greg Kroah-Hartman
524ae3c9d3 Merge 6.1.107 into android14-6.1-lts
Changes in 6.1.107
	tty: atmel_serial: use the correct RTS flag.
	fuse: Initialize beyond-EOF page contents before setting uptodate
	char: xillybus: Don't destroy workqueue from work item running on it
	char: xillybus: Refine workqueue handling
	char: xillybus: Check USB endpoints when probing device
	ALSA: usb-audio: Add delay quirk for VIVO USB-C-XE710 HEADSET
	ALSA: usb-audio: Support Yamaha P-125 quirk entry
	xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
	thunderbolt: Mark XDomain as unplugged when router is removed
	s390/dasd: fix error recovery leading to data corruption on ESE devices
	riscv: change XIP's kernel_map.size to be size of the entire kernel
	arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
	dm resume: don't return EINVAL when signalled
	dm persistent data: fix memory allocation failure
	vfs: Don't evict inode under the inode lru traversing context
	fs/ntfs3: add prefix to bitmap_size() and use BITS_TO_U64()
	s390/cio: rename bitmap_size() -> idset_bitmap_size()
	btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits()
	bitmap: introduce generic optimized bitmap_size()
	fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
	i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
	rtla/osnoise: Prevent NULL dereference in error handling
	fs/netfs/fscache_cookie: add missing "n_accesses" check
	selinux: fix potential counting error in avc_add_xperms_decision()
	mm/memory-failure: use raw_spinlock_t in struct memory_failure_cpu
	btrfs: zoned: properly take lock to read/update block group's zoned variables
	btrfs: tree-checker: add dev extent item checks
	drm/amdgpu: Actually check flags for all context ops.
	memcg_write_event_control(): fix a user-triggerable oops
	drm/amdgpu/jpeg2: properly set atomics vmid field
	s390/uv: Panic for set and remove shared access UVC errors
	bpf: Fix updating attached freplace prog in prog_array map
	nilfs2: prevent WARNING in nilfs_dat_commit_end()
	ext4, jbd2: add an optimized bmap for the journal inode
	9P FS: Fix wild-memory-access write in v9fs_get_acl
	nilfs2: initialize "struct nilfs_binfo_dat"->bi_pad field
	mm: khugepaged: fix kernel BUG in hpage_collapse_scan_file()
	bpf: Split off basic BPF verifier log into separate file
	bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log
	posix-timers: Ensure timer ID search-loop limit is valid
	pid: Replace struct pid 1-element array with flex-array
	gfs2: Rename remaining "transaction" glock references
	gfs2: Rename the {freeze,thaw}_super callbacks
	gfs2: Rename gfs2_freeze_lock{ => _shared }
	gfs2: Rename SDF_{FS_FROZEN => FREEZE_INITIATOR}
	gfs2: Rework freeze / thaw logic
	gfs2: Stop using gfs2_make_fs_ro for withdraw
	Bluetooth: Fix hci_link_tx_to RCU lock usage
	wifi: mac80211: take wiphy lock for MAC addr change
	wifi: mac80211: fix change_address deadlock during unregister
	net: sched: Print msecs when transmit queue time out
	net: don't dump stack on queue timeout
	jfs: fix shift-out-of-bounds in dbJoin
	squashfs: squashfs_read_data need to check if the length is 0
	Squashfs: fix variable overflow triggered by sysbot
	reiserfs: fix uninit-value in comp_keys
	erofs: avoid debugging output for (de)compressed data
	quota: Detect loops in quota tree
	net:rds: Fix possible deadlock in rds_message_put
	net: sctp: fix skb leak in sctp_inq_free()
	pppoe: Fix memory leak in pppoe_sendmsg()
	wifi: mac80211: fix and simplify unencrypted drop check for mesh
	wifi: cfg80211: move A-MSDU check in ieee80211_data_to_8023_exthdr
	wifi: cfg80211: factor out bridge tunnel / RFC1042 header check
	wifi: mac80211: remove mesh forwarding congestion check
	wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces
	wifi: mac80211: add a workaround for receiving non-standard mesh A-MSDU
	wifi: cfg80211: check A-MSDU format more carefully
	docs/bpf: Document BPF_MAP_TYPE_LPM_TRIE map
	bpf: Replace bpf_lpm_trie_key 0-length array with flexible array
	bpf: Avoid kfree_rcu() under lock in bpf_lpm_trie.
	Bluetooth: RFCOMM: Fix not validating setsockopt user input
	ext4: check the return value of ext4_xattr_inode_dec_ref()
	ext4: fold quota accounting into ext4_xattr_inode_lookup_create()
	ext4: do not create EA inode under buffer lock
	udf: Fix bogus checksum computation in udf_rename()
	bpf, net: Use DEV_STAT_INC()
	fou: remove warn in gue_gro_receive on unsupported protocol
	jfs: fix null ptr deref in dtInsertEntry
	jfs: Fix shift-out-of-bounds in dbDiscardAG
	fs/ntfs3: Do copy_to_user out of run_lock
	ALSA: usb: Fix UBSAN warning in parse_audio_unit()
	igc: Correct the launchtime offset
	igc: Fix packet still tx after gate close by reducing i226 MAC retry buffer
	net/mlx5e: Take state lock during tx timeout reporter
	net/mlx5e: Correctly report errors for ethtool rx flows
	atm: idt77252: prevent use after free in dequeue_rx()
	net: axienet: Fix register defines comment description
	net: dsa: vsc73xx: pass value in phy_write operation
	net: dsa: vsc73xx: use read_poll_timeout instead delay loop
	net: dsa: vsc73xx: check busy flag in MDIO operations
	mlxbf_gige: Remove two unused function declarations
	mlxbf_gige: disable RX filters until RX path initialized
	mptcp: correct MPTCP_SUBFLOW_ATTR_SSN_OFFSET reserved size
	netfilter: allow ipv6 fragments to arrive on different devices
	netfilter: flowtable: initialise extack before use
	netfilter: nf_queue: drop packets with cloned unconfirmed conntracks
	netfilter: nf_tables: Audit log dump reset after the fact
	netfilter: nf_tables: Drop pointless memset in nf_tables_dump_obj
	netfilter: nf_tables: Unconditionally allocate nft_obj_filter
	netfilter: nf_tables: A better name for nft_obj_filter
	netfilter: nf_tables: Carry s_idx in nft_obj_dump_ctx
	netfilter: nf_tables: nft_obj_filter fits into cb->ctx
	netfilter: nf_tables: Carry reset boolean in nft_obj_dump_ctx
	netfilter: nf_tables: Introduce nf_tables_getobj_single
	netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests
	net: hns3: fix wrong use of semaphore up
	net: hns3: use the user's cfg after reset
	net: hns3: fix a deadlock problem when config TC during resetting
	ALSA: hda/realtek: Fix noise from speakers on Lenovo IdeaPad 3 15IAU7
	drm/amd/amdgpu/imu_v11_0: Increase buffer size to ensure all possible values can be stored
	ssb: Fix division by zero issue in ssb_calc_clock_rate
	wifi: cfg80211: check wiphy mutex is held for wdev mutex
	wifi: mac80211: fix BA session teardown race
	mm: Remove kmem_valid_obj()
	rcu: Dump memory object info if callback function is invalid
	rcu: Eliminate rcu_gp_slow_unregister() false positive
	wifi: cw1200: Avoid processing an invalid TIM IE
	cgroup: Avoid extra dereference in css_populate_dir()
	i2c: riic: avoid potential division by zero
	RDMA/rtrs: Fix the problem of variable not initialized fully
	s390/smp,mcck: fix early IPI handling
	drm/bridge: tc358768: Attempt to fix DSI horizontal timings
	i3c: mipi-i3c-hci: Remove BUG() when Ring Abort request times out
	i3c: mipi-i3c-hci: Do not unmap region not mapped for transfer
	drm/amdkfd: Move dma unmapping after TLB flush
	media: radio-isa: use dev_name to fill in bus_info
	staging: iio: resolver: ad2s1210: fix use before initialization
	usb: gadget: uvc: cleanup request when not in correct state
	drm/amd/display: Validate hw_points_num before using it
	staging: ks7010: disable bh on tx_dev_lock
	media: s5p-mfc: Fix potential deadlock on condlock
	md/raid5-cache: use READ_ONCE/WRITE_ONCE for 'conf->log'
	binfmt_misc: cleanup on filesystem umount
	drm/tegra: Zero-initialize iosys_map
	media: qcom: venus: fix incorrect return value
	scsi: spi: Fix sshdr use
	gfs2: setattr_chown: Add missing initialization
	wifi: iwlwifi: abort scan when rfkill on but device enabled
	wifi: iwlwifi: fw: Fix debugfs command sending
	clk: visconti: Add bounds-checking coverage for struct visconti_pll_provider
	IB/hfi1: Fix potential deadlock on &irq_src_lock and &dd->uctxt_lock
	hwmon: (ltc2992) Avoid division by zero
	kbuild: rust_is_available: normalize version matching
	kbuild: rust_is_available: handle failures calling `$RUSTC`/`$BINDGEN`
	rust: work around `bindgen` 0.69.0 issue
	rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
	rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
	arm64: Fix KASAN random tag seed initialization
	block: Fix lockdep warning in blk_mq_mark_tag_wait
	drm/msm: Reduce fallout of fence signaling vs reclaim hangs
	memory: tegra: Skip SID programming if SID registers aren't set
	powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
	ASoC: SOF: ipc4: check return value of snd_sof_ipc_msg_data
	hwmon: (pc87360) Bounds check data->innr usage
	drm/rockchip: vop2: clear afbc en and transform bit for cluster window at linear mode
	Bluetooth: hci_conn: Check non NULL function before calling for HFP offload
	gfs2: Refcounting fix in gfs2_thaw_super
	nvmet-trace: avoid dereferencing pointer too early
	ext4: do not trim the group with corrupted block bitmap
	afs: fix __afs_break_callback() / afs_drop_open_mmap() race
	fuse: fix UAF in rcu pathwalks
	quota: Remove BUG_ON from dqget()
	kernfs: fix false-positive WARN(nr_mmapped) in kernfs_drain_open_files
	media: pci: cx23885: check cx23885_vdev_init() return
	fs: binfmt_elf_efpic: don't use missing interpreter's properties
	scsi: lpfc: Initialize status local variable in lpfc_sli4_repost_sgl_list()
	media: drivers/media/dvb-core: copy user arrays safely
	net/sun3_82586: Avoid reading past buffer in debug output
	drm/lima: set gp bus_stop bit before hard reset
	hrtimer: Select housekeeping CPU during migration
	virtiofs: forbid newlines in tags
	clocksource/drivers/arm_global_timer: Guard against division by zero
	netlink: hold nlk->cb_mutex longer in __netlink_dump_start()
	md: clean up invalid BUG_ON in md_ioctl
	x86: Increase brk randomness entropy for 64-bit systems
	memory: stm32-fmc2-ebi: check regmap_read return value
	parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367
	powerpc/boot: Handle allocation failure in simple_realloc()
	powerpc/boot: Only free if realloc() succeeds
	btrfs: delayed-inode: drop pointless BUG_ON in __btrfs_remove_delayed_item()
	btrfs: change BUG_ON to assertion when checking for delayed_node root
	btrfs: tests: allocate dummy fs_info and root in test_find_delalloc()
	btrfs: handle invalid root reference found in may_destroy_subvol()
	btrfs: send: handle unexpected data in header buffer in begin_cmd()
	btrfs: change BUG_ON to assertion in tree_move_down()
	btrfs: delete pointless BUG_ON check on quota root in btrfs_qgroup_account_extent()
	f2fs: fix to do sanity check in update_sit_entry
	usb: gadget: fsl: Increase size of name buffer for endpoints
	nvme: clear caller pointer on identify failure
	Bluetooth: bnep: Fix out-of-bound access
	firmware: cirrus: cs_dsp: Initialize debugfs_root to invalid
	rtc: nct3018y: fix possible NULL dereference
	net: hns3: add checking for vf id of mailbox
	nvmet-tcp: do not continue for invalid icreq
	NFS: avoid infinite loop in pnfs_update_layout.
	openrisc: Call setup_memory() earlier in the init sequence
	s390/iucv: fix receive buffer virtual vs physical address confusion
	irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time
	clocksource: Make watchdog and suspend-timing multiplication overflow safe
	platform/x86: lg-laptop: fix %s null argument warning
	usb: dwc3: core: Skip setting event buffers for host only controllers
	fbdev: offb: replace of_node_put with __free(device_node)
	irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc
	ext4: set the type of max_zeroout to unsigned int to avoid overflow
	nvmet-rdma: fix possible bad dereference when freeing rsps
	drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
	hrtimer: Prevent queuing of hrtimer without a function callback
	gtp: pull network headers in gtp_dev_xmit()
	media: solo6x10: replace max(a, min(b, c)) by clamp(b, a, c)
	i2c: tegra: allow DVC support to be compiled out
	i2c: tegra: allow VI support to be compiled out
	i2c: tegra: Do not mark ACPI devices as irq safe
	dm suspend: return -ERESTARTSYS instead of -EINTR
	net: mana: Fix doorbell out of order violation and avoid unnecessary doorbell rings
	btrfs: replace sb::s_blocksize by fs_info::sectorsize
	btrfs: send: allow cloning non-aligned extent if it ends at i_size
	drm/amd/display: Adjust cursor position
	platform/surface: aggregator: Fix warning when controller is destroyed in probe
	drm/amdkfd: reserve the BO before validating it
	Bluetooth: hci_core: Fix LE quote calculation
	Bluetooth: SMP: Fix assumption of Central always being Initiator
	net: dsa: tag_ocelot: do not rely on skb_mac_header() for VLAN xmit
	net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX
	net: mscc: ocelot: use ocelot_xmit_get_vlan_info() also for FDMA and register injection
	net: mscc: ocelot: fix QoS class for injected packets with "ocelot-8021q"
	net: mscc: ocelot: serialize access to the injection/extraction groups
	tc-testing: don't access non-existent variable on exception
	selftests/net: synchronize udpgro tests' tx and rx connection
	selftests: udpgro: report error when receive failed
	tcp/dccp: bypass empty buckets in inet_twsk_purge()
	tcp/dccp: do not care about families in inet_twsk_purge()
	tcp: prevent concurrent execution of tcp_sk_exit_batch
	net: mctp: test: Use correct skb for route input check
	kcm: Serialise kcm_sendmsg() for the same socket.
	netfilter: nft_counter: Disable BH in nft_counter_offload_stats().
	netfilter: nft_counter: Synchronize nft_counter_reset() against reader.
	ip6_tunnel: Fix broken GRO
	bonding: fix bond_ipsec_offload_ok return type
	bonding: fix null pointer deref in bond_ipsec_offload_ok
	bonding: fix xfrm real_dev null pointer dereference
	bonding: fix xfrm state handling when clearing active slave
	ice: Prepare legacy-rx for upcoming XDP multi-buffer support
	ice: Add xdp_buff to ice_rx_ring struct
	ice: Store page count inside ice_rx_buf
	ice: Pull out next_to_clean bump out of ice_put_rx_buf()
	ice: fix page reuse when PAGE_SIZE is over 8k
	ice: fix ICE_LAST_OFFSET formula
	dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()
	net: dsa: mv88e6xxx: Fix out-of-bound access
	netem: fix return value if duplicate enqueue fails
	ipv6: prevent UAF in ip6_send_skb()
	ipv6: fix possible UAF in ip6_finish_output2()
	ipv6: prevent possible UAF in ip6_xmit()
	netfilter: flowtable: validate vlan header
	octeontx2-af: Fix CPT AF register offset calculation
	net: xilinx: axienet: Always disable promiscuous mode
	net: xilinx: axienet: Fix dangling multicast addresses
	drm/msm/dpu: don't play tricks with debug macros
	drm/msm/dp: fix the max supported bpp logic
	drm/msm/dp: reset the link phy params before link training
	drm/msm/dpu: cleanup FB if dpu_format_populate_layout fails
	mmc: mmc_test: Fix NULL dereference on allocation failure
	Bluetooth: MGMT: Add error handling to pair_device()
	scsi: core: Fix the return value of scsi_logical_block_count()
	ksmbd: the buffer of smb2 query dir response has at least 1 byte
	drm/amdgpu: Validate TA binary size
	MIPS: Loongson64: Set timer mode in cpu-probe
	HID: wacom: Defer calculation of resolution until resolution_code is known
	HID: microsoft: Add rumble support to latest xbox controllers
	Input: i8042 - add forcenorestore quirk to leave controller untouched even on s3
	Input: i8042 - use new forcenorestore quirk to replace old buggy quirk combination
	cxgb4: add forgotten u64 ivlan cast before shift
	KVM: arm64: Make ICC_*SGI*_EL1 undef in the absence of a vGICv3
	mmc: dw_mmc: allow biu and ciu clocks to defer
	pmdomain: imx: wait SSAR when i.MX93 power domain on
	mptcp: pm: re-using ID of unused removed ADD_ADDR
	mptcp: pm: re-using ID of unused removed subflows
	mptcp: pm: re-using ID of unused flushed subflows
	mptcp: pm: only decrement add_addr_accepted for MPJ req
	Revert "usb: gadget: uvc: cleanup request when not in correct state"
	Revert "drm/amd/display: Validate hw_points_num before using it"
	tcp: do not export tcp_twsk_purge()
	hwmon: (ltc2992) Fix memory leak in ltc2992_parse_dt()
	ALSA: timer: Relax start tick time check for slave timer elements
	mm/vmalloc: fix page mapping if vm_area_alloc_pages() with high order fallback to order 0
	mm/numa: no task_numa_fault() call if PMD is changed
	mm/numa: no task_numa_fault() call if PTE is changed
	nfsd: Simplify code around svc_exit_thread() call in nfsd()
	nfsd: separate nfsd_last_thread() from nfsd_put()
	NFSD: simplify error paths in nfsd_svc()
	nfsd: call nfsd_last_thread() before final nfsd_put()
	nfsd: drop the nfsd_put helper
	nfsd: don't call locks_release_private() twice concurrently
	nfsd: Fix a regression in nfsd_setattr()
	Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
	drm/amdgpu/vcn: identify unified queue in sw init
	drm/amdgpu/vcn: not pause dpg for unified queue
	KVM: x86: fire timer when it is migrated and expired, and in oneshot mode
	Revert "s390/dasd: Establish DMA alignment"
	udp: allow header check for dodgy GSO_UDP_L4 packets.
	gso: fix dodgy bit handling for GSO_UDP_L4
	net: more strict VIRTIO_NET_HDR_GSO_UDP_L4 validation
	net: drop bad gso csum_start and offset in virtio_net_hdr
	wifi: mac80211: add documentation for amsdu_mesh_control
	wifi: mac80211: fix mesh path discovery based on unicast packets
	wifi: mac80211: fix mesh forwarding
	wifi: mac80211: fix flow dissection for forwarded packets
	wifi: mac80211: fix receiving mesh packets in forwarding=0 networks
	wifi: mac80211: drop bogus static keywords in A-MSDU rx
	wifi: mac80211: fix potential null pointer dereference
	wifi: cfg80211: fix receiving mesh packets without RFC1042 header
	gfs2: Fix another freeze/thaw hang
	gfs2: don't withdraw if init_threads() got interrupted
	gfs2: Remove LM_FLAG_PRIORITY flag
	gfs2: Remove freeze_go_demote_ok
	udp: fix receiving fraglist GSO packets
	ice: fix W=1 headers mismatch
	Revert "jfs: fix shift-out-of-bounds in dbJoin"
	net: change maximum number of UDP segments to 128
	selftests: net: more strict check in net_helper
	Input: MT - limit max slots
	tools: move alignment-related macros to new <linux/align.h>
	Linux 6.1.107

Change-Id: I11d18ae169b1e55f18f0dc2953df2dd3a1f25624
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-10-01 11:35:58 +00:00
Greg Kroah-Hartman
8f2e4ac396 Revert "cgroup: Make operations on the cgroup root_list RCU safe"
This reverts commit f5b7a97920 which is
commit d23b5c577715892c87533b13923306acc6243f93 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I6b60c2d6e3ef46d02d40e76c8fd0d0ca8ac58af9
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-09-30 15:23:48 +00:00
Greg Kroah-Hartman
b4c085bbdb Revert "cgroup: Move rcu_head up near the top of cgroup_root"
This reverts commit 0e76e9bb1d which is
commit a7fb0423c201ba12815877a0b5a68a6a1710b23a upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Ib15a38a3826b47d2a058a29c6b042107e70d2e33
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-09-30 15:23:36 +00:00
Greg Kroah-Hartman
aa4cd140bb Linux 6.1.112
Link: https://lore.kernel.org/r/20240927121719.897851549@linuxfoundation.org
Tested-by: Peter Schneider <pschneider1968@googlemail.com>
Tested-by: Allen Pais <apais@linux.microsoft.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: kernelci.org bot <bot@kernelci.org>
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:56 +02:00
Edward Adam Davis
ba6269e187 USB: usbtmc: prevent kernel-usb-infoleak
commit 625fa77151f00c1bd00d34d60d6f2e710b3f9aad upstream.

The syzbot reported a kernel-usb-infoleak in usbtmc_write,
we need to clear the structure before filling fields.

Fixes: 4ddc645f40 ("usb: usbtmc: Add ioctl for vendor specific write")
Reported-and-tested-by: syzbot+9d34f80f841e948c3fdb@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/tencent_9649AA6EC56EDECCA8A7D106C792D1C66B06@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:56 +02:00
Junhao Xie
c74796ff4f USB: serial: pl2303: add device id for Macrosilicon MS3020
commit 7d47d22444bb7dc1b6d768904a22070ef35e1fc0 upstream.

Add the device id for the Macrosilicon MS3020 which is a
PL2303HXN based device.

Signed-off-by: Junhao Xie <bigfoot@classfun.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:56 +02:00
Tony Luck
a20eea14a6 x86/mm: Switch to new Intel CPU model defines
commit 2eda374e883ad297bd9fe575a16c1dc850346075 upstream.

New CPU #defines encode vendor and family as well as model.

[ dhansen: vertically align 0's in invlpg_miss_ids[] ]

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/all/20240424181518.41946-1-tony.luck%40intel.com
[ Ricardo: I used the old match macro X86_MATCH_INTEL_FAM6_MODEL()
  instead of X86_MATCH_VFM() as in the upstream commit.
  I also kept the ALDERLAKE_N name instead of ATOM_GRACEMONT. Both refer
  to the same CPU model. ]
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:56 +02:00
Sumeet Pawnikar
ee8adcb4c0 powercap: RAPL: fix invalid initialization for pl4_supported field
commit d05b5e0baf upstream.

The current initialization of the struct x86_cpu_id via
pl4_support_ids[] is partial and wrong. It is initializing
"stepping" field with "X86_FEATURE_ANY" instead of "feature" field.

Use X86_MATCH_INTEL_FAM6_MODEL macro instead of initializing
each field of the struct x86_cpu_id for pl4_supported list of CPUs.
This X86_MATCH_INTEL_FAM6_MODEL macro internally uses another macro
X86_MATCH_VENDOR_FAM_MODEL_FEATURE for X86 based CPU matching with
appropriate initialized values.

Reported-by: Dave Hansen <dave.hansen@intel.com>
Link: https://lore.kernel.org/lkml/28ead36b-2d9e-1a36-6f4e-04684e420260@intel.com
Fixes: eb52bc2ae5 ("powercap: RAPL: Add Power Limit4 support for Meteor Lake SoC")
Fixes: b08b95cf30 ("powercap: RAPL: Add Power Limit4 support for Alder Lake-N and Raptor Lake-P")
Fixes: 5157559069 ("powercap: RAPL: Add Power Limit4 support for RaptorLake")
Fixes: 1cc5b9a411 ("powercap: Add Power Limit4 support for Alder Lake SoC")
Fixes: 8365a898fe ("powercap: Add Power Limit4 support")
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
[ Ricardo: I removed METEORLAKE and METEORLAKE_L from pl4_support_ids as
  they are not included in v6.1. ]
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:56 +02:00
Filipe Manana
563df8b411 btrfs: calculate the right space for delayed refs when updating global reserve
commit f8f210dc84 upstream.

When updating the global block reserve, we account for the 6 items needed
by an unlink operation and the 6 delayed references for each one of those
items. However the calculation for the delayed references is not correct
in case we have the free space tree enabled, as in that case we need to
touch the free space tree as well and therefore need twice the number of
bytes. So use the btrfs_calc_delayed_ref_bytes() helper to calculate the
number of bytes need for the delayed references at
btrfs_update_global_block_rsv().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[Diogo: this patch has been cherry-picked from the original commit;
conflicts included lack of a define (picked from commit 5630e2bcfe)
and lack of btrfs_calc_delayed_ref_bytes (picked from commit 0e55a54502)
- changed const struct -> struct for compatibility.]
Signed-off-by: Diogo Jahchan Koike <djahchankoike@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Matthieu Baerts (NGI0)
2626cbee1f selftests: mptcp: join: restrict fullmesh endp on 1st sf
commit 49ac6f05ace5bb0070c68a0193aa05d3c25d4c83 upstream.

A new endpoint using the IP of the initial subflow has been recently
added to increase the code coverage. But it breaks the test when using
old kernels not having commit 86e39e0448 ("mptcp: keep track of local
endpoint still available for each msk"), e.g. on v5.15.

Similar to commit d4c81bbb86 ("selftests: mptcp: join: support local
endpoint being tracked or not"), it is possible to add the new endpoint
conditionally, by checking if "mptcp_pm_subflow_check_next" is present
in kallsyms: this is not directly linked to the commit introducing this
symbol but for the parent one which is linked anyway. So we can know in
advance what will be the expected behaviour, and add the new endpoint
only when it makes sense to do so.

Fixes: 4878f9f8421f ("selftests: mptcp: join: validate fullmesh endp on 1st sf")
Cc: stable@vger.kernel.org
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240910-net-selftests-mptcp-fix-install-v1-1-8f124aa9156d@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Conflicts in mptcp_join.sh, because the 'run_tests' helper has been
  modified in multiple commits that are not in this version, e.g. commit
  e571fb09c8 ("selftests: mptcp: add speed env var"). The conflict was
  in the context, the new lines can still be added at the same place. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Marc Kleine-Budde
0ba8b599c3 can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop()
commit a7801540f325d104de5065850a003f1d9bdc6ad3 upstream.

The mcp251xfd wakes up from Low Power or Sleep Mode when SPI activity
is detected. To avoid this, make sure that the timestamp worker is
stopped before shutting down the chip.

Split the starting of the timestamp worker out of
mcp251xfd_timestamp_init() into the separate function
mcp251xfd_timestamp_start().

Call mcp251xfd_timestamp_init() before mcp251xfd_chip_start(), move
mcp251xfd_timestamp_start() to mcp251xfd_chip_start(). In this way,
mcp251xfd_timestamp_stop() can be called unconditionally by
mcp251xfd_chip_stop().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Marc Kleine-Budde
88047c4b2d can: mcp251xfd: properly indent labels
commit 51b2a721612236335ddec4f3fb5f59e72a204f3a upstream.

To fix the coding style, remove the whitespace in front of labels.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Hagar Hemdan
672c19165f gpio: prevent potential speculation leaks in gpio_device_get_desc()
commit d795848ecce24a75dfd46481aee066ae6fe39775 upstream.

Userspace may trigger a speculative read of an address outside the gpio
descriptor array.
Users can do that by calling gpio_ioctl() with an offset out of range.
Offset is copied from user and then used as an array index to get
the gpio descriptor without sanitization in gpio_device_get_desc().

This change ensures that the offset is sanitized by using
array_index_nospec() to mitigate any possibility of speculative
information leaks.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
Link: https://lore.kernel.org/r/20240523085332.1801-1-hagarhem@amazon.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Kent Gibson
5c3a421c1f gpiolib: cdev: Ignore reconfiguration without direction
commit b440396387418fe2feaacd41ca16080e7a8bc9ad upstream.

linereq_set_config() behaves badly when direction is not set.
The configuration validation is borrowed from linereq_create(), where,
to verify the intent of the user, the direction must be set to in order to
effect a change to the electrical configuration of a line. But, when
applied to reconfiguration, that validation does not allow for the unset
direction case, making it possible to clear flags set previously without
specifying the line direction.

Adding to the inconsistency, those changes are not immediately applied by
linereq_set_config(), but will take effect when the line value is next get
or set.

For example, by requesting a configuration with no flags set, an output
line with GPIO_V2_LINE_FLAG_ACTIVE_LOW and GPIO_V2_LINE_FLAG_OPEN_DRAIN
set could have those flags cleared, inverting the sense of the line and
changing the line drive to push-pull on the next line value set.

Skip the reconfiguration of lines for which the direction is not set, and
only reconfigure the lines for which direction is set.

Fixes: a54756cb24 ("gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240626052925.174272-3-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Ping-Ke Shih
e388656a85 Revert "wifi: cfg80211: check wiphy mutex is held for wdev mutex"
This reverts commit 19d13ec00a which is
commmit 1474bc87fe57deac726cc10203f73daa6c3212f7 upstream.

The reverted commit is based on implementation of wiphy locking that isn't
planned to redo on a stable kernel, so revert it to avoid warning:

 WARNING: CPU: 0 PID: 9 at net/wireless/core.h:231 disconnect_work+0xb8/0x144 [cfg80211]
 CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.6.51-00141-ga1649b6f8ed6 #7
 Hardware name: Freescale i.MX6 SoloX (Device Tree)
 Workqueue: events disconnect_work [cfg80211]
  unwind_backtrace from show_stack+0x10/0x14
  show_stack from dump_stack_lvl+0x58/0x70
  dump_stack_lvl from __warn+0x70/0x1c0
  __warn from warn_slowpath_fmt+0x16c/0x294
  warn_slowpath_fmt from disconnect_work+0xb8/0x144 [cfg80211]
  disconnect_work [cfg80211] from process_one_work+0x204/0x620
  process_one_work from worker_thread+0x1b0/0x474
  worker_thread from kthread+0x10c/0x12c
  kthread from ret_from_fork+0x14/0x24

Reported-by: petter@technux.se
Closes: https://lore.kernel.org/linux-wireless/9e98937d781c990615ef27ee0c858ff9@technux.se/T/#t
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:55 +02:00
Pablo Neira Ayuso
ddeead4761 netfilter: nf_tables: missing iterator type in lookup walk
commit efefd4f00c967d00ad7abe092554ffbb70c1a793 upstream.

Add missing decorator type to lookup expression and tighten WARN_ON_ONCE
check in pipapo to spot earlier that this is unset.

Fixes: 29b359cf6d95 ("netfilter: nft_set_pipapo: walk over current view on netlink dump")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Pablo Neira Ayuso
52735a010f netfilter: nft_set_pipapo: walk over current view on netlink dump
commit 29b359cf6d95fd60730533f7f10464e95bd17c73 upstream.

The generation mask can be updated while netlink dump is in progress.
The pipapo set backend walk iterator cannot rely on it to infer what
view of the datastructure is to be used. Add notation to specify if user
wants to read/update the set.

Based on patch from Florian Westphal.

Fixes: 2b84e215f8 ("netfilter: nft_set_pipapo: .walk does not deal with generations")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Dan Carpenter
8a64f87e74 netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level()
commit 7052622fccb1efb850c6b55de477f65d03525a30 upstream.

The cgroup_get_from_path() function never returns NULL, it returns error
pointers.  Update the error handling to match.

Fixes: 7f3287db6543 ("netfilter: nft_socket: make cgroupsv2 matching work with namespaces")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Link: https://patch.msgid.link/bbc0c4e0-05cc-4f44-8797-2f4b3920a820@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Florian Westphal
ace0db36b4 netfilter: nft_socket: make cgroupsv2 matching work with namespaces
commit 7f3287db654395f9c5ddd246325ff7889f550286 upstream.

When running in container environmment, /sys/fs/cgroup/ might not be
the real root node of the sk-attached cgroup.

Example:

In container:
% stat /sys//fs/cgroup/
Device: 0,21    Inode: 2214  ..
% stat /sys/fs/cgroup/foo
Device: 0,21    Inode: 2264  ..

The expectation would be for:

  nft add rule .. socket cgroupv2 level 1 "foo" counter

to match traffic from a process that got added to "foo" via
"echo $pid > /sys/fs/cgroup/foo/cgroup.procs".

However, 'level 3' is needed to make this work.

Seen from initial namespace, the complete hierarchy is:

% stat /sys/fs/cgroup/system.slice/docker-.../foo
  Device: 0,21    Inode: 2264 ..

i.e. hierarchy is
0    1               2              3
/ -> system.slice -> docker-1... -> foo

... but the container doesn't know that its "/" is the "docker-1.."
cgroup.  Current code will retrieve the 'system.slice' cgroup node
and store its kn->id in the destination register, so compare with
2264 ("foo" cgroup id) will not match.

Fetch "/" cgroup from ->init() and add its level to the level we try to
extract.  cgroup root-level is 0 for the init-namespace or the level
of the ancestor that is exposed as the cgroup root inside the container.

In the above case, cgrp->level of "/" resolved in the container is 2
(docker-1...scope/) and request for 'level 1' will get adjusted
to fetch the actual level (3).

v2: use CONFIG_SOCK_CGROUP_DATA, eval function depends on it.
    (kernel test robot)

Cc: cgroups@vger.kernel.org
Fixes: e0bb96db96 ("netfilter: nft_socket: add support for cgroupsv2")
Reported-by: Nadia Pinaeva <n.m.pinaeva@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Dave Chinner
5899daf1d8 xfs: journal geometry is not properly bounds checked
[ Upstream commit f1e1765aad ]

If the journal geometry results in a sector or log stripe unit
validation problem, it indicates that we cannot set the log up to
safely write to the the journal. In these cases, we must abort the
mount because the corruption needs external intervention to resolve.
Similarly, a journal that is too large cannot be written to safely,
either, so we shouldn't allow those geometries to mount, either.

If the log is too small, we risk having transaction reservations
overruning the available log space and the system hanging waiting
for space it can never provide. This is purely a runtime hang issue,
not a corruption issue as per the first cases listed above. We abort
mounts of the log is too small for V5 filesystems, but we must allow
v4 filesystems to mount because, historically, there was no log size
validity checking and so some systems may still be out there with
undersized logs.

The problem is that on V4 filesystems, when we discover a log
geometry problem, we skip all the remaining checks and then allow
the log to continue mounting. This mean that if one of the log size
checks fails, we skip the log stripe unit check. i.e. we allow the
mount because a "non-fatal" geometry is violated, and then fail to
check the hard fail geometries that should fail the mount.

Move all these fatal checks to the superblock verifier, and add a
new check for the two log sector size geometry variables having the
same values. This will prevent any attempt to mount a log that has
invalid or inconsistent geometries long before we attempt to mount
the log.

However, for the minimum log size checks, we can only do that once
we've setup up the log and calculated all the iclog sizes and
roundoffs. Hence this needs to remain in the log mount code after
the log has been initialised. It is also the only case where we
should allow a v4 filesystem to continue running, so leave that
handling in place, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Darrick J. Wong
68e6efe0d4 xfs: set bnobt/cntbt numrecs correctly when formatting new AGs
[ Upstream commit 8e698ee72c ]

Through generic/300, I discovered that mkfs.xfs creates corrupt
filesystems when given these parameters:

Filesystems formatted with --unsupported are not supported!!
meta-data=/dev/sda               isize=512    agcount=8, agsize=16352 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=1
         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=1
data     =                       bsize=4096   blocks=130816, imaxpct=25
         =                       sunit=32     swidth=128 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=8192, version=2
         =                       sectsz=512   sunit=32 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
         =                       rgcount=0    rgsize=0 blks
Discarding blocks...Done.
Phase 1 - find and verify superblock...
        - reporting progress in intervals of 15 minutes
Phase 2 - using internal log
        - zero log...
        - 16:30:50: zeroing log - 16320 of 16320 blocks done
        - scan filesystem freespace and inode maps...
agf_freeblks 25, counted 0 in ag 4
sb_fdblocks 8823, counted 8798

The root cause of this problem is the numrecs handling in
xfs_freesp_init_recs, which is used to initialize a new AG.  Prior to
calling the function, we set up the new bnobt block with numrecs == 1
and rely on _freesp_init_recs to format that new record.  If the last
record created has a blockcount of zero, then it sets numrecs = 0.

That last bit isn't correct if the AG contains the log, the start of the
log is not immediately after the initial blocks due to stripe alignment,
and the end of the log is perfectly aligned with the end of the AG.  For
this case, we actually formatted a single bnobt record to handle the
free space before the start of the (stripe aligned) log, and incremented
arec to try to format a second record.  That second record turned out to
be unnecessary, so what we really want is to leave numrecs at 1.

The numrecs handling itself is overly complicated because a different
function sets numrecs == 1.  Change the bnobt creation code to start
with numrecs set to zero and only increment it after successfully
formatting a free space extent into the btree block.

Fixes: f327a00745 ("xfs: account for log space when formatting new AGs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Darrick J. Wong
af871df651 xfs: fix reloading entire unlinked bucket lists
[ Upstream commit 537c013b14 ]

During review of the patcheset that provided reloading of the incore
iunlink list, Dave made a few suggestions, and I updated the copy in my
dev tree.  Unfortunately, I then got distracted by ... who even knows
what ... and forgot to backport those changes from my dev tree to my
release candidate branch.  I then sent multiple pull requests with stale
patches, and that's what was merged into -rc3.

So.

This patch re-adds the use of an unlocked iunlink list check to
determine if we want to allocate the resources to recreate the incore
list.  Since lost iunlinked inodes are supposed to be rare, this change
helps us avoid paying the transaction and AGF locking costs every time
we open any inode.

This also re-adds the shutdowns on failure, and re-applies the
restructuring of the inner loop in xfs_inode_reload_unlinked_bucket, and
re-adds a requested comment about the quotachecking code.

Retain the original RVB tag from Dave since there's no code change from
the last submission.

Fixes: 68b957f64f ("xfs: load uncached unlinked inodes into memory on demand")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Darrick J. Wong
62ca591045 xfs: make inode unlinked bucket recovery work with quotacheck
[ Upstream commit 49813a21ed ]

Teach quotacheck to reload the unlinked inode lists when walking the
inode table.  This requires extra state handling, since it's possible
that a reloaded inode will get inactivated before quotacheck tries to
scan it; in this case, we need to ensure that the reloaded inode does
not have dquots attached when it is freed.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:54 +02:00
Darrick J. Wong
e9d1551f80 xfs: reload entire unlinked bucket lists
[ Upstream commit 83771c50e4 ]

The previous patch to reload unrecovered unlinked inodes when adding a
newly created inode to the unlinked list is missing a key piece of
functionality.  It doesn't handle the case that someone calls xfs_iget
on an inode that is not the last item in the incore list.  For example,
if at mount time the ondisk iunlink bucket looks like this:

AGI -> 7 -> 22 -> 3 -> NULL

None of these three inodes are cached in memory.  Now let's say that
someone tries to open inode 3 by handle.  We need to walk the list to
make sure that inodes 7 and 22 get loaded cold, and that the
i_prev_unlinked of inode 3 gets set to 22.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Darrick J. Wong
8ffd3ae7a0 xfs: use i_prev_unlinked to distinguish inodes that are not on the unlinked list
[ Upstream commit f12b96683d ]

Alter the definition of i_prev_unlinked slightly to make it more obvious
when an inode with 0 link count is not part of the iunlink bucket lists
rooted in the AGI.  This distinction is necessary because it is not
sufficient to check inode.i_nlink to decide if an inode is on the
unlinked list.  Updates to i_nlink can happen while holding only
ILOCK_EXCL, but updates to an inode's position in the AGI unlinked list
(which happen after the nlink update) requires both ILOCK_EXCL and the
AGI buffer lock.

The next few patches will make it possible to reload an entire unlinked
bucket list when we're walking the inode table or performing handle
operations and need more than the ability to iget the last inode in the
chain.

The upcoming directory repair code also needs to be able to make this
distinction to decide if a zero link count directory should be moved to
the orphanage or allowed to inactivate.  An upcoming enhancement to the
online AGI fsck code will need this distinction to check and rebuild the
AGI unlinked buckets.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Shiyang Ruan
8e2147f37f xfs: correct calculation for agend and blockcount
[ Upstream commit 3c90c01e49 ]

The agend should be "start + length - 1", then, blockcount should be
"end + 1 - start".  Correct 2 calculation mistakes.

Also, rename "agend" to "range_agend" because it's not the end of the AG
per se; it's the end of the dead region within an AG's agblock space.

Fixes: 5cf32f63b0 ("xfs: fix the calculation for "end" and "length"")
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Dave Chinner
d931b6c6a9 xfs: fix unlink vs cluster buffer instantiation race
[ Upstream commit 348a1983cf4cf5099fc398438a968443af4c9f65 ]

Luis has been reporting an assert failure when freeing an inode
cluster during inode inactivation for a while. The assert looks
like:

 XFS: Assertion failed: bp->b_flags & XBF_DONE, file: fs/xfs/xfs_trans_buf.c, line: 241
 ------------[ cut here ]------------
 kernel BUG at fs/xfs/xfs_message.c:102!
 Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
 CPU: 4 PID: 73 Comm: kworker/4:1 Not tainted 6.10.0-rc1 #4
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
 Workqueue: xfs-inodegc/loop5 xfs_inodegc_worker [xfs]
 RIP: 0010:assfail (fs/xfs/xfs_message.c:102) xfs
 RSP: 0018:ffff88810188f7f0 EFLAGS: 00010202
 RAX: 0000000000000000 RBX: ffff88816e748250 RCX: 1ffffffff844b0e7
 RDX: 0000000000000004 RSI: ffff88810188f558 RDI: ffffffffc2431fa0
 RBP: 1ffff11020311f01 R08: 0000000042431f9f R09: ffffed1020311e9b
 R10: ffff88810188f4df R11: ffffffffac725d70 R12: ffff88817a3f4000
 R13: ffff88812182f000 R14: ffff88810188f998 R15: ffffffffc2423f80
 FS:  0000000000000000(0000) GS:ffff8881c8400000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 000055fe9d0f109c CR3: 000000014426c002 CR4: 0000000000770ef0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
 PKRU: 55555554
 Call Trace:
  <TASK>
 xfs_trans_read_buf_map (fs/xfs/xfs_trans_buf.c:241 (discriminator 1)) xfs
 xfs_imap_to_bp (fs/xfs/xfs_trans.h:210 fs/xfs/libxfs/xfs_inode_buf.c:138) xfs
 xfs_inode_item_precommit (fs/xfs/xfs_inode_item.c:145) xfs
 xfs_trans_run_precommits (fs/xfs/xfs_trans.c:931) xfs
 __xfs_trans_commit (fs/xfs/xfs_trans.c:966) xfs
 xfs_inactive_ifree (fs/xfs/xfs_inode.c:1811) xfs
 xfs_inactive (fs/xfs/xfs_inode.c:2013) xfs
 xfs_inodegc_worker (fs/xfs/xfs_icache.c:1841 fs/xfs/xfs_icache.c:1886) xfs
 process_one_work (kernel/workqueue.c:3231)
 worker_thread (kernel/workqueue.c:3306 (discriminator 2) kernel/workqueue.c:3393 (discriminator 2))
 kthread (kernel/kthread.c:389)
 ret_from_fork (arch/x86/kernel/process.c:147)
 ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
  </TASK>

And occurs when the the inode precommit handlers is attempt to look
up the inode cluster buffer to attach the inode for writeback.

The trail of logic that I can reconstruct is as follows.

	1. the inode is clean when inodegc runs, so it is not
	   attached to a cluster buffer when precommit runs.

	2. #1 implies the inode cluster buffer may be clean and not
	   pinned by dirty inodes when inodegc runs.

	3. #2 implies that the inode cluster buffer can be reclaimed
	   by memory pressure at any time.

	4. The assert failure implies that the cluster buffer was
	   attached to the transaction, but not marked done. It had
	   been accessed earlier in the transaction, but not marked
	   done.

	5. #4 implies the cluster buffer has been invalidated (i.e.
	   marked stale).

	6. #5 implies that the inode cluster buffer was instantiated
	   uninitialised in the transaction in xfs_ifree_cluster(),
	   which only instantiates the buffers to invalidate them
	   and never marks them as done.

Given factors 1-3, this issue is highly dependent on timing and
environmental factors. Hence the issue can be very difficult to
reproduce in some situations, but highly reliable in others. Luis
has an environment where it can be reproduced easily by g/531 but,
OTOH, I've reproduced it only once in ~2000 cycles of g/531.

I think the fix is to have xfs_ifree_cluster() set the XBF_DONE flag
on the cluster buffers, even though they may not be initialised. The
reasons why I think this is safe are:

	1. A buffer cache lookup hit on a XBF_STALE buffer will
	   clear the XBF_DONE flag. Hence all future users of the
	   buffer know they have to re-initialise the contents
	   before use and mark it done themselves.

	2. xfs_trans_binval() sets the XFS_BLI_STALE flag, which
	   means the buffer remains locked until the journal commit
	   completes and the buffer is unpinned. Hence once marked
	   XBF_STALE/XFS_BLI_STALE by xfs_ifree_cluster(), the only
	   context that can access the freed buffer is the currently
	   running transaction.

	3. #2 implies that future buffer lookups in the currently
	   running transaction will hit the transaction match code
	   and not the buffer cache. Hence XBF_STALE and
	   XFS_BLI_STALE will not be cleared unless the transaction
	   initialises and logs the buffer with valid contents
	   again. At which point, the buffer will be marked marked
	   XBF_DONE again, so having XBF_DONE already set on the
	   stale buffer is a moot point.

	4. #2 also implies that any concurrent access to that
	   cluster buffer will block waiting on the buffer lock
	   until the inode cluster has been fully freed and is no
	   longer an active inode cluster buffer.

	5. #4 + #1 means that any future user of the disk range of
	   that buffer will always see the range of disk blocks
	   covered by the cluster buffer as not done, and hence must
	   initialise the contents themselves.

	6. Setting XBF_DONE in xfs_ifree_cluster() then means the
	   unlinked inode precommit code will see a XBF_DONE buffer
	   from the transaction match as it expects. It can then
	   attach the stale but newly dirtied inode to the stale
	   but newly dirtied cluster buffer without unexpected
	   failures. The stale buffer will then sail through the
	   journal and do the right thing with the attached stale
	   inode during unpin.

Hence the fix is just one line of extra code. The explanation of
why we have to set XBF_DONE in xfs_ifree_cluster, OTOH, is long and
complex....

Fixes: 82842fee6e ("xfs: fix AGF vs inode cluster buffer deadlock")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Tested-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Darrick J. Wong
1486aeb788 xfs: fix negative array access in xfs_getbmap
[ Upstream commit 1bba82fe1a ]

In commit 8ee81ed581, Ye Bin complained about an ASSERT in the bmapx
code that trips if we encounter a delalloc extent after flushing the
pagecache to disk.  The ioctl code does not hold MMAPLOCK so it's
entirely possible that a racing write page fault can create a delalloc
extent after the file has been flushed.  The proposed solution was to
replace the assertion with an early return that avoids filling out the
bmap recordset with a delalloc entry if the caller didn't ask for it.

At the time, I recall thinking that the forward logic sounded ok, but
felt hesitant because I suspected that changing this code would cause
something /else/ to burst loose due to some other subtlety.

syzbot of course found that subtlety.  If all the extent mappings found
after the flush are delalloc mappings, we'll reach the end of the data
fork without ever incrementing bmv->bmv_entries.  This is new, since
before we'd have emitted the delalloc mappings even though the caller
didn't ask for them.  Once we reach the end, we'll try to set
BMV_OF_LAST on the -1st entry (because bmv_entries is zero) and go
corrupt something else in memory.  Yay.

I really dislike all these stupid patches that fiddle around with debug
code and break things that otherwise worked well enough.  Nobody was
complaining that calling XFS_IOC_BMAPX without BMV_IF_DELALLOC would
return BMV_OF_DELALLOC records, and now we've gone from "weird behavior
that nobody cared about" to "bad behavior that must be addressed
immediately".

Maybe I'll just ignore anything from Huawei from now on for my own sake.

Reported-by: syzbot+c103d3808a0de5faaf80@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-xfs/20230412024907.GP360889@frogsfrogsfrogs/
Fixes: 8ee81ed581 ("xfs: fix BUG_ON in xfs_getbmap()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Darrick J. Wong
4790c167cc xfs: load uncached unlinked inodes into memory on demand
[ Upstream commit 68b957f64f ]

shrikanth hegde reports that filesystems fail shortly after mount with
the following failure:

	WARNING: CPU: 56 PID: 12450 at fs/xfs/xfs_inode.c:1839 xfs_iunlink_lookup+0x58/0x80 [xfs]

This of course is the WARN_ON_ONCE in xfs_iunlink_lookup:

	ip = radix_tree_lookup(&pag->pag_ici_root, agino);
	if (WARN_ON_ONCE(!ip || !ip->i_ino)) { ... }

>From diagnostic data collected by the bug reporters, it would appear
that we cleanly mounted a filesystem that contained unlinked inodes.
Unlinked inodes are only processed as a final step of log recovery,
which means that clean mounts do not process the unlinked list at all.

Prior to the introduction of the incore unlinked lists, this wasn't a
problem because the unlink code would (very expensively) traverse the
entire ondisk metadata iunlink chain to keep things up to date.
However, the incore unlinked list code complains when it realizes that
it is out of sync with the ondisk metadata and shuts down the fs, which
is bad.

Ritesh proposed to solve this problem by unconditionally parsing the
unlinked lists at mount time, but this imposes a mount time cost for
every filesystem to catch something that should be very infrequent.
Instead, let's target the places where we can encounter a next_unlinked
pointer that refers to an inode that is not in cache, and load it into
cache.

Note: This patch does not address the problem of iget loading an inode
from the middle of the iunlink list and needing to set i_prev_unlinked
correctly.

Reported-by: shrikanth hegde <sshegde@linux.vnet.ibm.com>
Triaged-by: Ritesh Harjani <ritesh.list@gmail.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Shiyang Ruan
0cc1922687 xfs: fix the calculation for "end" and "length"
[ Upstream commit 5cf32f63b0 ]

The value of "end" should be "start + length - 1".

Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:53 +02:00
Dave Chinner
4427e3d362 xfs: remove WARN when dquot cache insertion fails
[ Upstream commit 4b827b3f30 ]

It just creates unnecessary bot noise these days.

Reported-by: syzbot+6ae213503fb12e87934f@syzkaller.appspotmail.com
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Long Li
e8c6533404 xfs: fix ag count overflow during growfs
[ Upstream commit c3b880acad ]

I found a corruption during growfs:

 XFS (loop0): Internal error agbno >= mp->m_sb.sb_agblocks at line 3661 of
   file fs/xfs/libxfs/xfs_alloc.c.  Caller __xfs_free_extent+0x28e/0x3c0
 CPU: 0 PID: 573 Comm: xfs_growfs Not tainted 6.3.0-rc7-next-20230420-00001-gda8c95746257
 Call Trace:
  <TASK>
  dump_stack_lvl+0x50/0x70
  xfs_corruption_error+0x134/0x150
  __xfs_free_extent+0x2c1/0x3c0
  xfs_ag_extend_space+0x291/0x3e0
  xfs_growfs_data+0xd72/0xe90
  xfs_file_ioctl+0x5f9/0x14a0
  __x64_sys_ioctl+0x13e/0x1c0
  do_syscall_64+0x39/0x80
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
 XFS (loop0): Corruption detected. Unmount and run xfs_repair
 XFS (loop0): Internal error xfs_trans_cancel at line 1097 of file
   fs/xfs/xfs_trans.c.  Caller xfs_growfs_data+0x691/0xe90
 CPU: 0 PID: 573 Comm: xfs_growfs Not tainted 6.3.0-rc7-next-20230420-00001-gda8c95746257
 Call Trace:
  <TASK>
  dump_stack_lvl+0x50/0x70
  xfs_error_report+0x93/0xc0
  xfs_trans_cancel+0x2c0/0x350
  xfs_growfs_data+0x691/0xe90
  xfs_file_ioctl+0x5f9/0x14a0
  __x64_sys_ioctl+0x13e/0x1c0
  do_syscall_64+0x39/0x80
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
 RIP: 0033:0x7f2d86706577

The bug can be reproduced with the following sequence:

 # truncate -s  1073741824 xfs_test.img
 # mkfs.xfs -f -b size=1024 -d agcount=4 xfs_test.img
 # truncate -s 2305843009213693952  xfs_test.img
 # mount -o loop xfs_test.img /mnt/test
 # xfs_growfs -D  1125899907891200  /mnt/test

The root cause is that during growfs, user space passed in a large value
of newblcoks to xfs_growfs_data_private(), due to current sb_agblocks is
too small, new AG count will exceed UINT_MAX. Because of AG number type
is unsigned int and it would overflow, that caused nagcount much smaller
than the actual value. During AG extent space, delta blocks in
xfs_resizefs_init_new_ags() will much larger than the actual value due to
incorrect nagcount, even exceed UINT_MAX. This will cause corruption and
be detected in __xfs_free_extent. Fix it by growing the filesystem to up
to the maximally allowed AGs and not return EINVAL when new AG count
overflow.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Dave Chinner
02f44e7ff6 xfs: collect errors from inodegc for unlinked inode recovery
[ Upstream commit d4d12c02bf ]

Unlinked list recovery requires errors removing the inode the from
the unlinked list get fed back to the main recovery loop. Now that
we offload the unlinking to the inodegc work, we don't get errors
being fed back when we trip over a corruption that prevents the
inode from being removed from the unlinked list.

This means we never clear the corrupt unlinked list bucket,
resulting in runtime operations eventually tripping over it and
shutting down.

Fix this by collecting inodegc worker errors and feed them
back to the flush caller. This is largely best effort - the only
context that really cares is log recovery, and it only flushes a
single inode at a time so we don't need complex synchronised
handling. Essentially the inodegc workers will capture the first
error that occurs and the next flush will gather them and clear
them. The flush itself will only report the first gathered error.

In the cases where callers can return errors, propagate the
collected inodegc flush error up the error handling chain.

In the case of inode unlinked list recovery, there are several
superfluous calls to flush queued unlinked inodes -
xlog_recover_iunlink_bucket() guarantees that it has flushed the
inodegc and collected errors before it returns. Hence nothing in the
calling path needs to run a flush, even when an error is returned.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Dave Chinner
65fc94fc87 xfs: fix AGF vs inode cluster buffer deadlock
[ Upstream commit 82842fee6e ]

Lock order in XFS is AGI -> AGF, hence for operations involving
inode unlinked list operations we always lock the AGI first. Inode
unlinked list operations operate on the inode cluster buffer,
so the lock order there is AGI -> inode cluster buffer.

For O_TMPFILE operations, this now means the lock order set down in
xfs_rename and xfs_link is AGI -> inode cluster buffer -> AGF as the
unlinked ops are done before the directory modifications that may
allocate space and lock the AGF.

Unfortunately, we also now lock the inode cluster buffer when
logging an inode so that we can attach the inode to the cluster
buffer and pin it in memory. This creates a lock order of AGF ->
inode cluster buffer in directory operations as we have to log the
inode after we've allocated new space for it.

This creates a lock inversion between the AGF and the inode cluster
buffer. Because the inode cluster buffer is shared across multiple
inodes, the inversion is not specific to individual inodes but can
occur when inodes in the same cluster buffer are accessed in
different orders.

To fix this we need move all the inode log item cluster buffer
interactions to the end of the current transaction. Unfortunately,
xfs_trans_log_inode() calls are littered throughout the transactions
with no thought to ordering against other items or locking. This
makes it difficult to do anything that involves changing the call
sites of xfs_trans_log_inode() to change locking orders.

However, we do now have a mechanism that allows is to postpone dirty
item processing to just before we commit the transaction: the
->iop_precommit method. This will be called after all the
modifications are done and high level objects like AGI and AGF
buffers have been locked and modified, thereby providing a mechanism
that guarantees we don't lock the inode cluster buffer before those
high level objects are locked.

This change is largely moving the guts of xfs_trans_log_inode() to
xfs_inode_item_precommit() and providing an extra flag context in
the inode log item to track the dirty state of the inode in the
current transaction. This also means we do a lot less repeated work
in xfs_trans_log_inode() by only doing it once per transaction when
all the work is done.

Fixes: 298f7bec50 ("xfs: pin inode backing buffer to the inode log item")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Dave Chinner
b4aea9f9e0 xfs: defered work could create precommits
[ Upstream commit cb04211748 ]

To fix a AGI-AGF-inode cluster buffer deadlock, we need to move
inode cluster buffer operations to the ->iop_precommit() method.
However, this means that deferred operations can require precommits
to be run on the final transaction that the deferred ops pass back
to xfs_trans_commit() context. This will be exposed by attribute
handling, in that the last changes to the inode in the attr set
state machine "disappear" because the precommit operation is not run.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Dave Chinner
8127489103 xfs: buffer pins need to hold a buffer reference
[ Upstream commit 89a4bf0dc3 ]

When a buffer is unpinned by xfs_buf_item_unpin(), we need to access
the buffer after we've dropped the buffer log item reference count.
This opens a window where we can have two racing unpins for the
buffer item (e.g. shutdown checkpoint context callback processing
racing with journal IO iclog completion processing) and both attempt
to access the buffer after dropping the BLI reference count.  If we
are unlucky, the "BLI freed" context wins the race and frees the
buffer before the "BLI still active" case checks the buffer pin
count.

This results in a use after free that can only be triggered
in active filesystem shutdown situations.

To fix this, we need to ensure that buffer existence extends beyond
the BLI reference count checks and until the unpin processing is
complete. This implies that a buffer pin operation must also take a
buffer reference to ensure that the buffer cannot be freed until the
buffer unpin processing is complete.

Reported-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00
Ye Bin
cbf91ddb88 xfs: fix BUG_ON in xfs_getbmap()
[ Upstream commit 8ee81ed581 ]

There's issue as follows:
XFS: Assertion failed: (bmv->bmv_iflags & BMV_IF_DELALLOC) != 0, file: fs/xfs/xfs_bmap_util.c, line: 329
------------[ cut here ]------------
kernel BUG at fs/xfs/xfs_message.c:102!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 14612 Comm: xfs_io Not tainted 6.3.0-rc2-next-20230315-00006-g2729d23ddb3b-dirty #422
RIP: 0010:assfail+0x96/0xa0
RSP: 0018:ffffc9000fa178c0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff888179a18000
RDX: 0000000000000000 RSI: ffff888179a18000 RDI: 0000000000000002
RBP: 0000000000000000 R08: ffffffff8321aab6 R09: 0000000000000000
R10: 0000000000000001 R11: ffffed1105f85139 R12: ffffffff8aacc4c0
R13: 0000000000000149 R14: ffff888269f58000 R15: 000000000000000c
FS:  00007f42f27a4740(0000) GS:ffff88882fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000b92388 CR3: 000000024f006000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 xfs_getbmap+0x1a5b/0x1e40
 xfs_ioc_getbmap+0x1fd/0x5b0
 xfs_file_ioctl+0x2cb/0x1d50
 __x64_sys_ioctl+0x197/0x210
 do_syscall_64+0x39/0xb0
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Above issue may happen as follows:
         ThreadA                       ThreadB
do_shared_fault
 __do_fault
  xfs_filemap_fault
   __xfs_filemap_fault
    filemap_fault
                             xfs_ioc_getbmap -> Without BMV_IF_DELALLOC flag
			      xfs_getbmap
			       xfs_ilock(ip, XFS_IOLOCK_SHARED);
			       filemap_write_and_wait
 do_page_mkwrite
  xfs_filemap_page_mkwrite
   __xfs_filemap_fault
    xfs_ilock(XFS_I(inode), XFS_MMAPLOCK_SHARED);
    iomap_page_mkwrite
     ...
     xfs_buffered_write_iomap_begin
      xfs_bmapi_reserve_delalloc -> Allocate delay extent
                              xfs_ilock_data_map_shared(ip)
	                      xfs_getbmap_report_one
			       ASSERT((bmv->bmv_iflags & BMV_IF_DELALLOC) != 0)
	                        -> trigger BUG_ON

As xfs_filemap_page_mkwrite() only hold XFS_MMAPLOCK_SHARED lock, there's
small window mkwrite can produce delay extent after file write in xfs_getbmap().
To solve above issue, just skip delalloc extents.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-30 16:23:52 +02:00