6.12.66-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 6.12.66-rc1 review
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.12.66-rc1
Shardul Bankar <[email protected]>
bpf: test_run: Fix ctx leak in bpf_prog_test_run_xdp error path
Takashi Iwai <[email protected]>
ALSA: hda: intel-dsp-config: Prefer legacy driver as fallback
Jarkko Sakkinen <[email protected]>
tpm2-sessions: Fix out of range indexing in name_size
Mateusz Litwin <[email protected]>
spi: cadence-quadspi: Prevent lost complete() call during indirect read
Michal Rábek <[email protected]>
scsi: sg: Fix occasional bogus elapsed time that exceeds timeout
Alexander Stein <[email protected]>
ASoC: fsl_sai: Add missing registers to cache default
Kai Vehmanen <[email protected]>
ALSA: hda/realtek: enable woofer speakers on Medion NM14LNL
Andrew Elantsev <[email protected]>
ASoC: amd: yc: Add quirk for Honor MagicBook X16 2025
Jussi Laako <[email protected]>
ALSA: usb-audio: Update for native DSD support quirks
Tetsuo Handa <[email protected]>
can: j1939: make j1939_session_activate() fail if device is no longer registered
Brian Kocoloski <[email protected]>
drm/amdkfd: Fix improper NULL termination of queue restore SMI event string
Fei Shao <[email protected]>
spi: mt65xx: Use IRQF_ONESHOT with threaded IRQ
Charlene Liu <[email protected]>
drm/amd/display: Fix DP no audio issue
Niklas Cassel <[email protected]>
ata: libata-core: Disable LPM on ST2000DM008-2FR102
Florian Westphal <[email protected]>
netfilter: nf_tables: avoid chain re-validation if possible
Sumeet Pawnikar <[email protected]>
powercap: fix sscanf() error return value handling
Sumeet Pawnikar <[email protected]>
powercap: fix race condition in register_control_type()
Marcus Hughes <[email protected]>
net: sfp: extend Potron XGSPON quirk to cover additional EEPROM variant
Tetsuo Handa <[email protected]>
bpf: Fix reference count leak in bpf_prog_test_run_xdp()
Toke Høiland-Jørgensen <[email protected]>
bpf, test_run: Subtract size of xdp_frame from allowed metadata size
Amery Hung <[email protected]>
bpf: Support specifying linear xdp packet data size for BPF_PROG_TEST_RUN
Amery Hung <[email protected]>
bpf: Make variables in bpf_prog_test_run_xdp less confusing
Yonghong Song <[email protected]>
bpf: Fix an issue in bpf_prog_test_run_xdp when page size greater than 4K
Qu Wenruo <[email protected]>
btrfs: fix beyond-EOF write handling
Filipe Manana <[email protected]>
btrfs: use variable for end offset in extent_writepage_io()
Filipe Manana <[email protected]>
btrfs: truncate ordered extent when skipping writeback past i_size
Qu Wenruo <[email protected]>
btrfs: remove btrfs_fs_info::sectors_per_page
Qu Wenruo <[email protected]>
btrfs: add extra error messages for delalloc range related errors
Qu Wenruo <[email protected]>
btrfs: subpage: dump the involved bitmap when ASSERT() failed
Qu Wenruo <[email protected]>
btrfs: fix error handling of submit_uncompressed_range()
Haoxiang Li <[email protected]>
ALSA: ac97: fix a double free in snd_ac97_controller_register()
Takashi Iwai <[email protected]>
ALSA: ac97bus: Use guard() for mutex locks
Gao Xiang <[email protected]>
erofs: fix file-backed mounts no longer working on EROFS partitions
Gao Xiang <[email protected]>
erofs: don't bother with s_stack_depth increasing for now
Eric Dumazet <[email protected]>
arp: do not assume dev_hard_header() does not change skb->head
Wei Fang <[email protected]>
net: enetc: fix build warning when PAGE_SIZE is greater than 128K
Petko Manolov <[email protected]>
net: usb: pegasus: fix memory leak in update_eth_regs_async()
Xiang Mei <[email protected]>
net/sched: sch_qfq: Fix NULL deref when deactivating inactive aggregate in qfq_reset
René Rebe <[email protected]>
HID: quirks: work around VID/PID conflict for appledisplay
Yohei Kojima <[email protected]>
net: netdevsim: fix inconsistent carrier state after link/unlink
Joshua Hay <[email protected]>
idpf: cap maximum Rx buffer size
Emil Tantilov <[email protected]>
idpf: fix memory leak in idpf_vport_rel()
Emil Tantilov <[email protected]>
idpf: keep the netdev when a reset fails
Mohammad Heib <[email protected]>
net: fix memory leak in skb_segment_list for GRO packets
Guo Ren (Alibaba DAMO Academy) <[email protected]>
riscv: pgtable: Cleanup useless VA_USER_XXX definitions
Qu Wenruo <[email protected]>
btrfs: only enforce free space tree if v1 cache is required for bs < ps cases
Michal Luczaj <[email protected]>
vsock: Make accept()ed sockets use custom setsockopt()
Srijit Bose <[email protected]>
bnxt_en: Fix potential data corruption with HW GRO/LRO
Zilin Guan <[email protected]>
net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
Gal Pressman <[email protected]>
net/mlx5e: Don't print error message due to invalid module
Di Zhu <[email protected]>
netdev: preserve NETIF_F_ALL_FOR_ALL across TSO updates
Weiming Shi <[email protected]>
net: sock: fix hardened usercopy panic in sock_recv_errqueue
yuan.gao <[email protected]>
inet: ping: Fix icmp out counting
Jerry Wu <[email protected]>
net: mscc: ocelot: Fix crash when adding interface under a lag
Alexandre Knecht <[email protected]>
bridge: fix C-VLAN preservation in 802.1ad vlan_tunnel egress
Alok Tiwari <[email protected]>
net: marvell: prestera: fix NULL dereference on devlink_alloc() failure
Fernando Fernandez Mancera <[email protected]>
netfilter: nf_conncount: update last_gc only when GC has been performed
Zilin Guan <[email protected]>
netfilter: nf_tables: fix memory leak in nf_tables_newrule()
Ernest Van Hoecke <[email protected]>
gpio: pca953x: handle short interrupt pulses on PCAL devices
Potin Lai <[email protected]>
gpio: pca953x: Add support for level-triggered interrupts
Fernando Fernandez Mancera <[email protected]>
netfilter: nft_synproxy: avoid possible data-race on update operation
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo: fix range overlap detection
Alexander Stein <[email protected]>
arm64: dts: mba8mx: Fix Ethernet PHY IRQ support
Sherry Sun <[email protected]>
arm64: dts: imx8qm-ss-dma: correct the dma channels of lpuart
Marek Vasut <[email protected]>
arm64: dts: imx8mp: Fix LAN8740Ai PHY reference clock on DH electronics i.MX8M Plus DHCOM
Ian Ray <[email protected]>
ARM: dts: imx6q-ba16: fix RTC interrupt level
Haibo Chen <[email protected]>
arm64: dts: add off-on-delay-us for usdhc2 regulator
Harshita Bhilwaria <[email protected]>
crypto: qat - fix duplicate restarting msg during AER error
Wadim Egorov <[email protected]>
arm64: dts: ti: k3-am62-lp-sk-nand: Rename pinctrls to fix schema warnings
Nathan Chancellor <[email protected]>
drm/amd/display: Apply e4479aecf658 to dml
Nathan Chancellor <[email protected]>
drm/amd/display: Respect user's CONFIG_FRAME_WARN more for dml files
Miquel Sabaté Solà <[email protected]>
btrfs: fix NULL dereference on root when tracing inode eviction
Filipe Manana <[email protected]>
btrfs: tracepoints: use btrfs_root_id() to get the id of a root
Qu Wenruo <[email protected]>
btrfs: qgroup: update all parent qgroups when doing quick inherit
Boris Burkov <[email protected]>
btrfs: fix qgroup_snapshot_quick_inherit() squota bug
Xingui Yang <[email protected]>
scsi: Revert "scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed"
Brian Kao <[email protected]>
scsi: ufs: core: Fix EH failure after W-LUN resume error
Wen Xiong <[email protected]>
scsi: ipr: Enable/disable IRQD_NO_BALANCING during reset
ChenXiaoSong <[email protected]>
smb/client: fix NT_STATUS_NO_DATA_DETECTED value
ChenXiaoSong <[email protected]>
smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
ChenXiaoSong <[email protected]>
smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
Rosen Penev <[email protected]>
drm/amd/display: shrink struct members
Trond Myklebust <[email protected]>
NFS: Fix up the automount fs_context to use the correct cred
Krzysztof Kozlowski <[email protected]>
ASoC: rockchip: Fix Wvoid-pointer-to-enum-cast warning (again)
Scott Mayhew <[email protected]>
NFSv4: ensure the open stateid seqid doesn't go backwards
Mikulas Patocka <[email protected]>
dm-snapshot: fix 'scheduling while atomic' on real-time kernels
Sam James <[email protected]>
alpha: don't reference obsolete termio struct for TC* constants
Sebastian Andrzej Siewior <[email protected]>
ARM: 9461/1: Disable HIGHPTE on PREEMPT_RT kernels
Yang Li <[email protected]>
csky: fix csky_cmpxchg_fixup not working
Xin Wang <[email protected]>
drm/xe: Ensure GT is in C0 during resumes
Xin Wang <[email protected]>
drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally
Kuniyuki Iwashima <[email protected]>
tls: Use __sk_dst_get() and dst_dev_rcu() in get_netdev_for_sock().
Ilya Dryomov <[email protected]>
libceph: make calc_target() set t->paused, not just clear it
Sam Edwards <[email protected]>
libceph: reset sparse-read state in osd_fault()
Ilya Dryomov <[email protected]>
libceph: return the handler error from mon_handle_auth_done()
Tuo Li <[email protected]>
libceph: make free_choose_arg_map() resilient to partial allocation
Ilya Dryomov <[email protected]>
libceph: replace overzealous BUG_ON in osdmap_apply_incremental()
ziming zhang <[email protected]>
libceph: prevent potential out-of-bounds reads in handle_auth_done()
Johannes Berg <[email protected]>
wifi: mac80211: restore non-chanctx injection behaviour
Eric Dumazet <[email protected]>
wifi: avoid kernel-infoleak from struct iw_point
Bartosz Golaszewski <[email protected]>
pinctrl: qcom: lpass-lpi: mark the GPIO controller as sleeping
Bartosz Golaszewski <[email protected]>
gpio: rockchip: mark the GPIO controller as sleeping
Alex Deucher <[email protected]>
drm/radeon: Remove __counted_by from ClockInfoArray.clockInfo[]
Miaoqian Lin <[email protected]>
drm/pl111: Fix error handling in pl111_amba_probe
Alan Liu <[email protected]>
drm/amdgpu: Fix query for VPE block_type and ip_count
Alexander Sverdlin <[email protected]>
counter: interrupt-cnt: Drop IRQF_NO_THREAD flag
Haotian Zhang <[email protected]>
counter: 104-quad-8: Fix incorrect return value in IRQ handler
Eric Biggers <[email protected]>
lib/crypto: aes: Fix missing MMU protection for AES S-box
Alexander Usyskin <[email protected]>
mei: me: add nova lake point S DID
Filipe Manana <[email protected]>
btrfs: always detect conflicting inodes when logging inode refs
Yeoreum Yun <[email protected]>
arm64: Fix cleared E0POE bit after cpu_suspend()/resume()
Thomas Fourier <[email protected]>
net: 3com: 3c59x: fix possible null dereference in vortex_probe1()
Thomas Fourier <[email protected]>
atm: Fix dma_free_coherent() size
Chuck Lever <[email protected]>
NFSD: Remove NFSERR_EAGAIN
Edward Adam Davis <[email protected]>
NFSD: net ref data still needs to be freed even if net hasn't startup
Olga Kornievskaia <[email protected]>
nfsd: check that server is running in unlock_filesystem
NeilBrown <[email protected]>
nfsd: use correct loop termination in nfsd4_revoke_states()
NeilBrown <[email protected]>
nfsd: provide locking for v4_end_grace
Scott Mayhew <[email protected]>
NFSD: Fix permission check for read access to executable-only files
-------------
Diffstat:
Makefile | 4 +- arch/alpha/include/uapi/asm/ioctls.h | 8 +- arch/arm/Kconfig | 2 +- arch/arm/boot/dts/nxp/imx/imx6q-ba16.dtsi | 2 +- .../arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi | 1 + arch/arm64/boot/dts/freescale/imx8qm-mek.dts | 1 + arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi | 8 +- arch/arm64/boot/dts/freescale/mba8mx.dtsi | 2 +- arch/arm64/boot/dts/ti/k3-am62-lp-sk-nand.dtso | 2 +- arch/arm64/include/asm/suspend.h | 2 +- arch/arm64/mm/proc.S | 8 ++ arch/csky/mm/fault.c | 4 +- arch/riscv/include/asm/pgtable.h | 4 - drivers/ata/libata-core.c | 3 + drivers/atm/he.c | 3 +- drivers/char/tpm/tpm2-cmd.c | 23 +++- drivers/char/tpm/tpm2-sessions.c | 114 ++++++++++++------ drivers/counter/104-quad-8.c | 20 +++- drivers/counter/interrupt-cnt.c | 3 +- drivers/crypto/intel/qat/qat_common/adf_aer.c | 2 - drivers/gpio/gpio-pca953x.c | 55 ++++++++- drivers/gpio/gpio-rockchip.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 + drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +- drivers/gpu/drm/amd/display/dc/dml/Makefile | 18 ++- drivers/gpu/drm/amd/display/dc/dml2/Makefile | 22 ++-- .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 11 +- drivers/gpu/drm/amd/display/include/audio_types.h | 14 +-- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- drivers/gpu/drm/radeon/pptable.h | 2 +- drivers/gpu/drm/xe/xe_gt_idle.c | 20 ++-- drivers/gpu/drm/xe/xe_gt_idle.h | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 10 +- drivers/gpu/drm/xe/xe_pm.c | 8 +- drivers/hid/hid-quirks.c | 9 ++ drivers/md/dm-exception-store.h | 2 +- drivers/md/dm-snap.c | 73 ++++++------ drivers/misc/mei/hw-me-regs.h | 2 + drivers/misc/mei/pci-me.c | 2 + drivers/net/ethernet/3com/3c59x.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 ++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +- drivers/net/ethernet/freescale/enetc/enetc.h | 4 +- drivers/net/ethernet/intel/idpf/idpf_lib.c | 19 ++- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 +- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 1 + .../ethernet/marvell/prestera/prestera_devlink.c | 2 + drivers/net/ethernet/mellanox/mlx5/core/port.c | 3 +- drivers/net/ethernet/mscc/ocelot.c | 6 +- drivers/net/netdevsim/bus.c | 8 ++ drivers/net/phy/sfp.c | 2 + drivers/net/usb/pegasus.c | 2 + drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 + drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +- drivers/powercap/powercap_sys.c | 22 ++-- drivers/scsi/ipr.c | 28 ++++- drivers/scsi/libsas/sas_internal.h | 14 --- drivers/scsi/sg.c | 20 ++-- drivers/spi/spi-cadence-quadspi.c | 10 +- drivers/spi/spi-mt65xx.c | 2 +- drivers/ufs/core/ufshcd.c | 40 +++++-- fs/btrfs/disk-io.c | 1 - fs/btrfs/extent_io.c | 68 ++++++++--- fs/btrfs/fs.h | 7 +- fs/btrfs/inode.c | 29 ++--- fs/btrfs/ordered-data.c | 5 +- fs/btrfs/qgroup.c | 21 +++- fs/btrfs/subpage.c | 129 ++++++++++++++------- fs/btrfs/super.c | 12 +- fs/btrfs/tree-log.c | 6 +- fs/erofs/super.c | 19 ++- fs/nfs/namespace.c | 5 + fs/nfs/nfs4proc.c | 13 ++- fs/nfs/nfs4trace.h | 1 + fs/nfs_common/common.c | 1 - fs/nfsd/netns.h | 2 + fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c | 49 +++++++- fs/nfsd/nfsctl.c | 12 +- fs/nfsd/nfsd.h | 1 - fs/nfsd/nfssvc.c | 28 ++--- fs/nfsd/state.h | 6 +- fs/nfsd/vfs.c | 4 +- fs/smb/client/nterr.h | 6 +- include/linux/netdevice.h | 3 +- include/linux/tpm.h | 13 ++- include/net/netfilter/nf_tables.h | 34 ++++-- include/trace/events/btrfs.h | 51 ++++---- include/trace/misc/nfs.h | 2 - include/uapi/linux/nfs.h | 1 - lib/crypto/aes.c | 4 +- net/bpf/test_run.c | 60 ++++++---- net/bridge/br_vlan_tunnel.c | 11 +- net/can/j1939/transport.c | 2 + net/ceph/messenger_v2.c | 2 + net/ceph/mon_client.c | 2 +- net/ceph/osd_client.c | 14 ++- net/ceph/osdmap.c | 24 ++-- net/core/skbuff.c | 8 +- net/core/sock.c | 7 +- net/ipv4/arp.c | 7 +- net/ipv4/ping.c | 4 +- net/mac80211/tx.c | 2 + net/netfilter/nf_conncount.c | 2 +- net/netfilter/nf_tables_api.c | 72 +++++++++++- net/netfilter/nft_set_pipapo.c | 4 +- net/netfilter/nft_synproxy.c | 6 +- net/sched/sch_qfq.c | 2 +- net/tls/tls_device.c | 18 +-- net/vmw_vsock/af_vsock.c | 4 + net/wireless/wext-core.c | 4 + net/wireless/wext-priv.c | 4 + security/keys/trusted-keys/trusted_tpm2.c | 29 ++++- sound/ac97/bus.c | 32 +++-- sound/hda/intel-dsp-config.c | 3 +- sound/pci/hda/patch_realtek.c | 1 + sound/soc/amd/yc/acp6x-mach.c | 7 ++ sound/soc/fsl/fsl_sai.c | 3 + sound/soc/rockchip/rockchip_pdm.c | 2 +- sound/usb/quirks.c | 10 ++ .../selftests/bpf/prog_tests/xdp_adjust_tail.c | 96 +++++++++++++-- .../bpf/prog_tests/xdp_context_test_run.c | 4 +- .../bpf/progs/test_xdp_adjust_tail_grow.c | 8 +- 123 files changed, 1164 insertions(+), 522 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/119 NFSD: Fix permission check for read access to executable-only files
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
commit e901c7fce59e72d9f3c92733c379849c4034ac50 upstream.
Commit abc02e5602f7 ("NFSD: Support write delegations in LAYOUTGET") added NFSD_MAY_OWNER_OVERRIDE to the access flags passed from nfsd4_layoutget() to fh_verify(). This causes LAYOUTGET to fail for executable-only files, and causes xfstests generic/126 to fail on pNFS SCSI.
To allow read access to executable-only files, what we really want is:
1. The "permissions" portion of the access flags (the lower 6 bits) must be exactly NFSD_MAY_READ
2. The "hints" portion of the access flags (the upper 26 bits) can contain any combination of NFSD_MAY_OWNER_OVERRIDE and NFSD_MAY_READ_IF_EXEC
--- fs/nfsd/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/vfs.c +2 -2
@@ -2568,8 +2568,8 @@ nfsd_permission(struct svc_cred *cred, s/* Allow read access to binaries even when mode 111 */ if (err == -EACCES &&S_ISREG (inode->i_mode) && - (acc == (NFSD_MAY_READ |NFSD_MAY_OWNER_OVERRIDE ) || - acc == (NFSD_MAY_READ |NFSD_MAY_READ_IF_EXEC ))) + (((acc &NFSD_MAY_MASK ) ==NFSD_MAY_READ ) && + (acc & (NFSD_MAY_OWNER_OVERRIDE |NFSD_MAY_READ_IF_EXEC )))) err =inode_permission (&nop_mnt_idmap, inode,MAY_EXEC );return err?nfserrno (err) :0 ;
Greg Kroah-Hartman
maintainerPATCH 2/119 nfsd: provide locking for v4_end_grace
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 2857bd59feb63fcf40fe4baf55401baea6b4feb4 upstream.
Writing to v4_end_grace can race with server shutdown and result in memory being accessed after it was freed - reclaim_str_hashtbl in particularly.
We cannot hold nfsd_mutex across the nfsd4_end_grace() call as that is held while client_tracking_op->init() is called and that can wait for an upcall to nfsdcltrack which can write to v4_end_grace, resulting in a deadlock.
nfsd4_end_grace() is also called by the landromat work queue and this doesn't require locking as server shutdown will stop the work and wait for it before freeing anything that nfsd4_end_grace() might access.
However, we must be sure that writing to v4_end_grace doesn't restart the work item after shutdown has already waited for it. For this we add a new flag protected with nn->client_lock. It is set only while it is safe to make client tracking calls, and v4_end_grace only schedules work while the flag is set with the spinlock held.
So this patch adds a nfsd_net field "client_tracking_active" which is set as described. Another field "grace_end_forced", is set when v4_end_grace is written. After this is set, and providing client_tracking_active is set, the laundromat is scheduled. This "grace_end_forced" field bypasses other checks for whether the grace period has finished.
This resolves a race which can result in use-after-free.
--- fs/nfsd/netns.h | 2 ++ fs/nfsd/nfs4state.c | 42 ++++++++++++++++++++++++++++++++++++++++-- fs/nfsd/nfsctl.c | 3 +-- fs/nfsd/state.h | 2 +- 4 files changed, 44 insertions(+), 5 deletions(-)
fs/nfsd/netns.h +2 -0
@@ -66,6 +66,8 @@ struct nfsd_net {struct lock_manager nfsd4_manager;bool grace_ended; +bool grace_end_forced; +bool client_tracking_active;time64_t boot_time;struct dentry *nfsd_client_dir;
fs/nfsd/nfs4state.c +40 -2
84 lines not on this page · raw message
fs/nfsd/nfsctl.c +1 -2
@@ -1123,10 +1123,9 @@ static ssize_t write_v4_end_grace(structcase 'Y' :case 'y' :case '1' : -if (!nn->nfsd_serv) +if (!nfsd4_force_end_grace (nn))return -EBUSY ;trace_nfsd_end_grace (netns (file)); -nfsd4_end_grace (nn);break ;default :return -EINVAL ;
fs/nfsd/state.h +1 -1
@@ -767,7 +767,7 @@ static inline void nfsd4_revoke_states(s#endif /* grace period management */ -void nfsd4_end_grace (struct nfsd_net *nn); +bool nfsd4_force_end_grace (struct nfsd_net *nn);/* nfs4recover operations */ extern int nfsd4_client_tracking_init (struct net *net);
Greg Kroah-Hartman
maintainerPATCH 3/119 nfsd: use correct loop termination in nfsd4_revoke_states()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit fb321998de7639f1954430674475e469fb529d9c upstream.
The loop in nfsd4_revoke_states() stops one too early because the end value given is CLIENT_HASH_MASK where it should be CLIENT_HASH_SIZE.
This means that an admin request to drop all locks for a filesystem will miss locks held by clients which hash to the maximum possible hash value.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -1764,7 +1764,7 @@ void nfsd4_revoke_states(struct net *net sc_types =SC_TYPE_OPEN |SC_TYPE_LOCK |SC_TYPE_DELEG |SC_TYPE_LAYOUT ;spin_lock (&nn->client_lock); -for (idhashval =0 ; idhashval <CLIENT_HASH_MASK ; idhashval++) { +for (idhashval =0 ; idhashval <CLIENT_HASH_SIZE ; idhashval++) {struct list_head *head = &nn->conf_id_hashtbl[idhashval];struct nfs4_client *clp; retry:
Greg Kroah-Hartman
maintainerPATCH 4/119 nfsd: check that server is running in unlock_filesystem
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit d0424066fcd294977f310964bed6f2a487fa4515 upstream.
If we are trying to unlock the filesystem via an administrative interface and nfsd isn't running, it crashes the server. This happens currently because nfsd4_revoke_states() access state structures (eg., conf_id_hashtbl) that has been freed as a part of the server shutdown.
[ 59.465072] Call trace: [ 59.465308] nfsd4_revoke_states+0x1b4/0x898 [nfsd] (P) [ 59.465830] write_unlock_fs+0x258/0x440 [nfsd] [ 59.466278] nfsctl_transaction_write+0xb0/0x120 [nfsd] [ 59.466780] vfs_write+0x1f0/0x938 [ 59.467088] ksys_write+0xfc/0x1f8 [ 59.467395] __arm64_sys_write+0x74/0xb8 [ 59.467746] invoke_syscall.constprop.0+0xdc/0x1e8 [ 59.468177] do_el0_svc+0x154/0x1d8 [ 59.468489] el0_svc+0x40/0xe0 [ 59.468767] el0t_64_sync_handler+0xa0/0xe8 [ 59.469138] el0t_64_sync+0x1ac/0x1b0
Ensure this can't happen by taking the nfsd_mutex and checking that the server is still up, and then holding the mutex across the call to nfsd4_revoke_states().
--- fs/nfsd/nfs4state.c | 5 ++--- fs/nfsd/nfsctl.c | 9 ++++++++- fs/nfsd/state.h | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-)
fs/nfsd/nfs4state.c +2 -3
@@ -1743,7 +1743,7 @@ static struct nfs4_stid *find_one_sb_sti/** * nfsd4_revoke_states - revoke all nfsv4 states associated with given filesystem -* @net: used to identify instance of nfsd (there is one per net namespace) +* @nn: used to identify instance of nfsd (there is one per net namespace) * @sb: super_block used to identify target filesystem * * All nfs4 states (open, lock, delegation, layout) held by the server instance
@@ -1755,9 +1755,8 @@ static struct nfs4_stid *find_one_sb_sti* The clients which own the states will subsequently being notified that the * states have been "admin-revoked". */ -void nfsd4_revoke_states (struct net *net,struct super_block *sb) +void nfsd4_revoke_states (struct nfsd_net *nn,struct super_block *sb) { -struct nfsd_net *nn =net_generic (net, nfsd_net_id);unsigned int idhashval;unsigned int sc_types;
fs/nfsd/nfsctl.c +8 -1
@@ -262,6 +262,7 @@ static ssize_t write_unlock_fs(struct fistruct path path;char *fo_path;int error; +struct nfsd_net *nn;/* sanity check */ if (size ==0 )
@@ -288,7 +289,13 @@ static ssize_t write_unlock_fs(struct fi* 3. Is that directory the root of an exported file system? */ error =nlmsvc_unlock_all_by_sb (path.dentry->d_sb); -nfsd4_revoke_states (netns (file), path.dentry->d_sb); +mutex_lock (&nfsd_mutex); + nn =net_generic (netns (file), nfsd_net_id); +if (nn->nfsd_serv) +nfsd4_revoke_states (nn, path.dentry->d_sb); +else + error = -EINVAL ; +mutex_unlock (&nfsd_mutex);path_put (&path);return error;
fs/nfsd/state.h +2 -2
@@ -759,9 +759,9 @@ static inline void get_nfs4_file(structstruct nfsd_file *find_any_file (struct nfs4_file *f);#ifdef CONFIG_NFSD_V4 -void nfsd4_revoke_states (struct net *net,struct super_block *sb); +void nfsd4_revoke_states (struct nfsd_net *nn,struct super_block *sb);#else -static inline void nfsd4_revoke_states (struct net *net,struct super_block *sb) +static inline void nfsd4_revoke_states (struct nfsd_net *nn,struct super_block *sb) { }#endif
Greg Kroah-Hartman
maintainerPATCH 5/119 NFSD: net ref data still needs to be freed even if net hasnt startup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
commit 0b88bfa42e5468baff71909c2f324a495318532b upstream.
When the NFSD instance doesn't to startup, the net ref data memory is not properly reclaimed, which triggers the memory leak issue reported by syzbot [1].
To avoid the problem reported in [1], the net ref data memory reclamation action is moved outside of nfsd_net_up when the net is shutdown.
[1]
unreferenced object 0xffff88812a39dfc0 (size 64):
backtrace (crc a2262fc6):
percpu_ref_init+0x94/0x1e0 lib/percpu-refcount.c:76
nfsd_create_serv+0xbe/0x260 fs/nfsd/nfssvc.c:605
nfsd_nl_listener_set_doit+0x62/0xb00 fs/nfsd/nfsctl.c:1882
genl_family_rcv_msg_doit+0x11e/0x190 net/netlink/genetlink.c:1115
genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
genl_rcv_msg+0x2fd/0x440 net/netlink/genetlink.c:1210
BUG: memory leak--- fs/nfsd/nfssvc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
fs/nfsd/nfssvc.c +15 -15
@@ -434,26 +434,26 @@ static void nfsd_shutdown_net(struct net {struct nfsd_net *nn =net_generic (net, nfsd_net_id); -if (!nn->nfsd_net_up) -return ; - -percpu_ref_kill_and_confirm (&nn->nfsd_net_ref, nfsd_net_done); -wait_for_completion (&nn->nfsd_net_confirm_done); - -nfsd_export_flush (net); -nfs4_state_shutdown_net (net); -nfsd_reply_cache_shutdown (nn); -nfsd_file_cache_shutdown_net (net); -if (nn->lockd_up) { -lockd_down (net); - nn->lockd_up = false; +if (nn->nfsd_net_up) { +percpu_ref_kill_and_confirm (&nn->nfsd_net_ref, nfsd_net_done); +wait_for_completion (&nn->nfsd_net_confirm_done); + +nfsd_export_flush (net); +nfs4_state_shutdown_net (net); +nfsd_reply_cache_shutdown (nn); +nfsd_file_cache_shutdown_net (net); +if (nn->lockd_up) { +lockd_down (net); + nn->lockd_up = false; + } +wait_for_completion (&nn->nfsd_net_free_done); } -wait_for_completion (&nn->nfsd_net_free_done);percpu_ref_exit (&nn->nfsd_net_ref); +if (nn->nfsd_net_up) +nfsd_shutdown_generic (); nn->nfsd_net_up = false; -nfsd_shutdown_generic (); }static DEFINE_SPINLOCK (nfsd_notifier_lock);
Greg Kroah-Hartman
maintainerPATCH 6/119 NFSD: Remove NFSERR_EAGAIN
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit c6c209ceb87f64a6ceebe61761951dcbbf4a0baa upstream.
I haven't found an NFSERR_EAGAIN in RFCs 1094, 1813, 7530, or 8881. None of these RFCs have an NFS status code that match the numeric value "11".
Based on the meaning of the EAGAIN errno, I presume the use of this status in NFSD means NFS4ERR_DELAY. So replace the one usage of nfserr_eagain, and remove it from NFSD's NFS status conversion tables.
As far as I can tell, NFSERR_EAGAIN has existed since the pre-git era, but was not actually used by any code until commit f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed."), at which time it become possible for NFSD to return a status code of 11 (which is not valid NFS protocol).
--- fs/nfs_common/common.c | 1 - fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfsd.h | 1 - include/trace/misc/nfs.h | 2 -- include/uapi/linux/nfs.h | 1 - 5 files changed, 1 insertion(+), 6 deletions(-)
fs/nfs_common/common.c +0 -1
@@ -17,7 +17,6 @@ static const struct { { NFSERR_NOENT, -ENOENT }, { NFSERR_IO, -EIO }, { NFSERR_NXIO, -ENXIO }, -/* { NFSERR_EAGAIN, -EAGAIN }, */ { NFSERR_ACCES, -EACCES }, { NFSERR_EXIST, -EEXIST }, { NFSERR_XDEV, -EXDEV },
fs/nfsd/nfs4proc.c +1 -1
@@ -1359,7 +1359,7 @@ try_again: (schedule_timeout(20*HZ) == 0)) {finish_wait (&nn->nfsd_ssc_waitq, &wait);kfree (work); -return nfserr_eagain; +return nfserr_jukebox; }finish_wait (&nn->nfsd_ssc_waitq, &wait); goto try_again;
fs/nfsd/nfsd.h +0 -1
@@ -226,7 +226,6 @@ void nfsd_lockd_shutdown(void);#define nfserr_noent cpu_to_be32(NFSERR_NOENT)#define nfserr_io cpu_to_be32(NFSERR_IO)#define nfserr_nxio cpu_to_be32(NFSERR_NXIO) -#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)#define nfserr_acces cpu_to_be32(NFSERR_ACCES)#define nfserr_exist cpu_to_be32(NFSERR_EXIST)#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
include/trace/misc/nfs.h +0 -2
@@ -16,7 +16,6 @@ TRACE_DEFINE_ENUM(NFSERR_PERM);TRACE_DEFINE_ENUM (NFSERR_NOENT );TRACE_DEFINE_ENUM (NFSERR_IO );TRACE_DEFINE_ENUM (NFSERR_NXIO ); -TRACE_DEFINE_ENUM (NFSERR_EAGAIN );TRACE_DEFINE_ENUM (NFSERR_ACCES );TRACE_DEFINE_ENUM (NFSERR_EXIST );TRACE_DEFINE_ENUM (NFSERR_XDEV );
@@ -52,7 +51,6 @@ TRACE_DEFINE_ENUM(NFSERR_JUKEBOX); { NFSERR_NXIO, "NXIO" }, \ { ECHILD, "CHILD" }, \ { ETIMEDOUT, "TIMEDOUT" }, \ - { NFSERR_EAGAIN, "AGAIN" }, \ { NFSERR_ACCES, "ACCES" }, \ { NFSERR_EXIST, "EXIST" }, \ { NFSERR_XDEV, "XDEV" }, \
include/uapi/linux/nfs.h +0 -1
@@ -49,7 +49,6 @@NFSERR_NOENT =2 ,/* v2 v3 v4 */ NFSERR_IO =5 ,/* v2 v3 v4 */ NFSERR_NXIO =6 ,/* v2 v3 v4 */ -NFSERR_EAGAIN =11 ,/* v2 v3 */ NFSERR_ACCES =13 ,/* v2 v3 v4 */ NFSERR_EXIST =17 ,/* v2 v3 v4 */ NFSERR_XDEV = 18, /* v3 v4 */
Greg Kroah-Hartman
maintainerPATCH 7/119 atm: Fix dma_free_coherent() size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit 4d984b0574ff708e66152763fbfdef24ea40933f upstream.
The size of the buffer is not the same when alloc'd with dma_alloc_coherent() in he_init_tpdrq() and freed.
--- drivers/atm/he.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/atm/he.c +2 -1
@@ -1587,7 +1587,8 @@ he_stop(struct he_dev *he_dev) he_dev->tbrq_base, he_dev->tbrq_phys);if (he_dev->tpdrq_base) -dma_free_coherent (&he_dev->pci_dev->dev,CONFIG_TBRQ_SIZE *sizeof (struct he_tbrq ), +dma_free_coherent (&he_dev->pci_dev->dev, +CONFIG_TPDRQ_SIZE *sizeof (struct he_tpdrq ), he_dev->tpdrq_base, he_dev->tpdrq_phys);dma_pool_destroy (he_dev->tpd_pool);
Greg Kroah-Hartman
maintainerPATCH 8/119 net: 3com: 3c59x: fix possible null dereference in vortex_probe1()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit a4e305ed60f7c41bbf9aabc16dd75267194e0de3 upstream.
pdev can be null and free_ring: can be called in 1297 with a null pdev.
--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -1473,7 +1473,7 @@ static int vortex_probe1(struct device *return 0 ; free_ring: -dma_free_coherent (&pdev->dev, +dma_free_coherent (gendev,sizeof (struct boom_rx_desc ) *RX_RING_SIZE +sizeof (struct boom_tx_desc ) *TX_RING_SIZE , vp->rx_ring, vp->rx_ring_dma);
Greg Kroah-Hartman
maintainerPATCH 9/119 arm64: Fix cleared E0POE bit after cpu_suspend()/resume()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yeoreum Yun <[email protected]>
commit bdf3f4176092df5281877cacf42f843063b4784d upstream.
TCR2_ELx.E0POE is set during smp_init().
However, this bit is not reprogrammed when the CPU enters suspension and later resumes via cpu_resume(), as __cpu_setup() does not re-enable E0POE and there is no save/restore logic for the TCR2_ELx system register.
As a result, the E0POE feature no longer works after cpu_resume().
To address this, save and restore TCR2_EL1 in the cpu_suspend()/cpu_resume() path, rather than adding related logic to __cpu_setup(), taking into account possible future extensions of the TCR2_ELx feature.
--- arch/arm64/include/asm/suspend.h | 2 +- arch/arm64/mm/proc.S | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm64/include/asm/suspend.h +1 -1
@@ -2,7 +2,7 @@#ifndef __ASM_SUSPEND_H#define __ASM_SUSPEND_H -#define NR_CTX_REGS 13 +#define NR_CTX_REGS 14#define NR_CALLEE_SAVED_REGS 12/*
arch/arm64/mm/proc.S +8 -0
@@ -100,6 +100,10 @@ SYM_FUNC_START(cpu_do_suspend) * call stack. */ str x18, [x0, #96] +alternative_if ARM64_HAS_TCR2 + mrs x2, REG_TCR2_EL1 + str x2, [x0, #104] +alternative_else_nop_endif ret SYM_FUNC_END(cpu_do_suspend)
@@ -134,6 +138,10 @@ SYM_FUNC_START(cpu_do_resume) msr tcr_el1, x8 msr vbar_el1, x9 msr mdscr_el1, x10 +alternative_if ARM64_HAS_TCR2 + ldr x2, [x0, #104] + msr REG_TCR2_EL1, x2 +alternative_else_nop_endif msr sctlr_el1, x12 set_this_cpu_offset x13
Greg Kroah-Hartman
maintainerPATCH 10/119 btrfs: always detect conflicting inodes when logging inode refs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 7ba0b6461bc4edb3005ea6e00cdae189bcf908a5 upstream.
After rename exchanging (either with the rename exchange operation or regular renames in multiple non-atomic steps) two inodes and at least one of them is a directory, we can end up with a log tree that contains only of the inodes and after a power failure that can result in an attempt to delete the other inode when it should not because it was not deleted before the power failure. In some case that delete attempt fails when the target inode is a directory that contains a subvolume inside it, since the log replay code is not prepared to deal with directory entries that point to root items (only inode items).
1) We have directories "dir1" (inode A) and "dir2" (inode B) under the same parent directory;
2) We have a file (inode C) under directory "dir1" (inode A);
3) We have a subvolume inside directory "dir2" (inode B);
4) All these inodes were persisted in a past transaction and we are currently at transaction N;
5) We rename the file (inode C), so at btrfs_log_new_name() we update inode C's last_unlink_trans to N;
6) We get a rename exchange for "dir1" (inode A) and "dir2" (inode B), so after the exchange "dir1" is inode B and "dir2" is inode A. During the rename exchange we call btrfs_log_new_name() for inodes A and B, but because they are directories, we don't update their last_unlink_trans to N;
7) An fsync against the file (inode C) is done, and because its inode has a last_unlink_trans with a value of N we log its parent directory (inode A) (through btrfs_log_all_parents(), called from btrfs_log_inode_parent()).
8) So we end up with inode B not logged, which now has the old name of inode A. At copy_inode_items_to_log(), when logging inode A, we did not check if we had any conflicting inode to log because inode A has a generation lower than the current transaction (created in a past transaction);
9) After a power failure, when replaying the log tree, since we find that inode A has a new name that conflicts with the name of inode B in the fs tree, we attempt to delete inode B... this is wrong since that directory was never deleted before the power failure, and because there is a subvolume inside that directory, attempting to delete it will fail since replay_dir_deletes() and btrfs_unlink_inode() are not prepared to deal with dir items that point to roots instead of inodes.
When that happens the mount fails and we get a stack trace like the following:
[87.2314] BTRFS info (device dm-0): start tree-log replay [87.2318] BTRFS critical (device dm-0): failed to delete reference to subvol, root 5 inode 256 parent 259 [87.2332] ------------[ cut here ]------------ [87.2338] BTRFS: Transaction aborted (error -2) [87.2346] WARNING: CPU: 1 PID: 638968 at fs/btrfs/inode.c:4345 __btrfs_unlink_inode+0x416/0x440 [btrfs] [87.2368] Modules linked in: btrfs loop dm_thin_pool (...) [87.2470] CPU: 1 UID: 0 PID: 638968 Comm: mount Tainted: G W 6.18.0-rc7-btrfs-next-218+ #2 PREEMPT(full) [87.2489] Tainted: [W]=WARN [87.2494] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 [87.2514] RIP: 0010:__btrfs_unlink_inode+0x416/0x440 [btrfs] [87.2538] Code: c0 89 04 24 (...) [87.2568] RSP: 0018:ffffc0e741f4b9b8 EFLAGS: 00010286 [87.2574] RAX: 0000000000000000 RBX: ffff9d3ec8a6cf60 RCX: 0000000000000000 [87.2582] RDX: 0000000000000002 RSI: ffffffff84ab45a1 RDI: 00000000ffffffff [87.2591] RBP: ffff9d3ec8a6ef20 R08: 0000000000000000 R09: ffffc0e741f4b840 [87.2599] R10: ffff9d45dc1fffa8 R11: 0000000000000003 R12: ffff9d3ee26d77e0 [87.2608] R13: ffffc0e741f4ba98 R14: ffff9d4458040800 R15: ffff9d44b6b7ca10 [87.2618] FS: 00007f7b9603a840(0000) GS:ffff9d4658982000(0000) knlGS:0000000000000000 [87.2629] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [87.2637] CR2: 00007ffc9ec33b98 CR3: 000000011273e003 CR4: 0000000000370ef0 [87.2648] Call Trace: [87.2651] <TASK> [87.2654] btrfs_unlink_inode+0x15/0x40 [btrfs] [87.2661] unlink_inode_for_log_replay+0x27/0xf0 [btrfs] [87.2669] check_item_in_log+0x1ea/0x2c0 [btrfs] [87.2676] replay_dir_deletes+0x16b/0x380 [btrfs] [87.2684] fixup_inode_link_count+0x34b/0x370 [btrfs] [87.2696] fixup_inode_link_counts+0x41/0x160 [btrfs] [87.2703] btrfs_recover_log_trees+0x1ff/0x7c0 [btrfs] [87.2711] ? __pfx_replay_one_buffer+0x10/0x10 [btrfs] [87.2719] open_ctree+0x10bb/0x15f0 [btrfs] [87.2726] btrfs_get_tree.cold+0xb/0x16c [btrfs] [87.2734] ? fscontext_read+0x15c/0x180 [87.2740] ? rw_verify_area+0x50/0x180 [87.2746] vfs_get_tree+0x25/0xd0 [87.2750] vfs_cmd_create+0x59/0xe0 [87.2755] __do_sys_fsconfig+0x4f6/0x6b0 [87.2760] do_syscall_64+0x50/0x1220 [87.2764] entry_SYSCALL_64_after_hwframe+0x76/0x7e [87.2770] RIP: 0033:0x7f7b9625f4aa [87.2775] Code: 73 01 c3 48 (...) [87.2803] RSP: 002b:00007ffc9ec35b08 EFLAGS: 00000246 ORIG_RAX: 00000000000001af [87.2817] RAX: ffffffffffffffda RBX: 0000558bfa91ac20 RCX: 00007f7b9625f4aa [87.2829] RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000003 [87.2842] RBP: 0000558bfa91b120 R08: 0000000000000000 R09: 0000000000000000 [87.2854] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [87.2864] R13: 00007f7b963f1580 R14: 00007f7b963f326c R15: 00007f7b963d8a23 [87.2877] </TASK> [87.2882] ---[ end trace 0000000000000000 ]--- [87.2891] BTRFS: error (device dm-0 state A) in __btrfs_unlink_inode:4345: errno=-2 No such entry [87.2904] BTRFS: error (device dm-0 state EAO) in do_abort_log_replay:191: errno=-2 No such entry [87.2915] BTRFS critical (device dm-0 state EAO): log tree (for root 5) leaf currently being processed (slot 7 key (258 12 257)): [87.2929] BTRFS info (device dm-0 state EAO): leaf 30736384 gen 10 total ptrs 7 free space 15712 owner 18446744073709551610 [87.2929] BTRFS info (device dm-0 state EAO): refs 3 lock_owner 0 current 638968 [87.2929] item 0 key (257 INODE_ITEM 0) itemoff 16123 itemsize 160 [87.2929] inode generation 9 transid 10 size 0 nbytes 0 [87.2929] block group 0 mode 40755 links 1 uid 0 gid 0 [87.2929] rdev 0 sequence 7 flags 0x0 [87.2929] atime 1765464494.678070921 [87.2929] ctime 1765464494.686606513 [87.2929] mtime 1765464494.686606513 [87.2929] otime 1765464494.678070921 [87.2929] item 1 key (257 INODE_REF 256) itemoff 16109 itemsize 14 [87.2929] index 4 name_len 4 [87.2929] item 2 key (257 DIR_LOG_INDEX 2) itemoff 16101 itemsize 8 [87.2929] dir log end 2 [87.2929] item 3 key (257 DIR_LOG_INDEX 3) itemoff 16093 itemsize 8 [87.2929] dir log end 18446744073709551615 [87.2930] item 4 key (257 DIR_INDEX 3) itemoff 16060 itemsize 33 [87.2930] location key (258 1 0) type 1 [87.2930] transid 10 data_len 0 name_len 3 [87.2930] item 5 key (258 INODE_ITEM 0) itemoff 15900 itemsize 160 [87.2930] inode generation 9 transid 10 size 0 nbytes 0 [87.2930] block group 0 mode 100644 links 1 uid 0 gid 0 [87.2930] rdev 0 sequence 2 flags 0x0 [87.2930] atime 1765464494.678456467 [87.2930] ctime 1765464494.686606513 [87.2930] mtime 1765464494.678456467 [87.2930] otime 1765464494.678456467 [87.2930] item 6 key (258 INODE_REF 257) itemoff 15887 itemsize 13 [87.2930] index 3 name_len 3 [87.2930] BTRFS critical (device dm-0 state EAO): log replay failed in unlink_inode_for_log_replay:1045 for root 5, stage 3, with error -2: failed to unlink inode 256 parent dir 259 name subvol root 5 [87.2963] BTRFS: error (device dm-0 state EAO) in btrfs_recover_log_trees:7743: errno=-2 No such entry [87.2981] BTRFS: error (device dm-0 state EAO) in btrfs_replay_log:2083: errno=-2 No such entry (Failed to recover log tr
So fix this by changing copy_inode_items_to_log() to always detect if there are conflicting inodes for the ref/extref of the inode being logged even if the inode was created in a past transaction.
A test case for fstests will follow soon.
--- fs/btrfs/tree-log.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/btrfs/tree-log.c +2 -4
@@ -6032,10 +6032,8 @@ again:* and no keys greater than that, so bail out. */ break ; - }else if ((min_key->type ==BTRFS_INODE_REF_KEY || - min_key->type ==BTRFS_INODE_EXTREF_KEY ) && - (inode->generation == trans->transid || - ctx->logging_conflict_inodes)) { + }else if (min_key->type ==BTRFS_INODE_REF_KEY || + min_key->type ==BTRFS_INODE_EXTREF_KEY ) {u64 other_ino =0 ;u64 other_parent =0 ;
Greg Kroah-Hartman
maintainerPATCH 11/119 mei: me: add nova lake point S DID
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit 420f423defcf6d0af2263d38da870ca4a20c0990 upstream.
Add Nova Lake S device id.
--- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/pci-me.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/misc/mei/hw-me-regs.h +2 -0
@@ -122,6 +122,8 @@#define MEI_DEV_ID_WCL_P 0x4D70/* Wildcat Lake P */ +#define MEI_DEV_ID_NVL_S 0x6E68/* Nova Lake Point S */ +/* * MEI HW Section */
drivers/misc/mei/pci-me.c +2 -0
@@ -129,6 +129,8 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_WCL_P, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_NVL_S, MEI_ME_PCH15_CFG)}, +/* required last entry */ {0, } };
Greg Kroah-Hartman
maintainerPATCH 12/119 lib/crypto: aes: Fix missing MMU protection for AES S-box
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 74d74bb78aeccc9edc10db216d6be121cf7ec176 upstream.
__cacheline_aligned puts the data in the ".data..cacheline_aligned" section, which isn't marked read-only i.e. it doesn't receive MMU protection. Replace it with ____cacheline_aligned which does the right thing and just aligns the data while keeping it in ".rodata".
--- lib/crypto/aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/crypto/aes.c +2 -2
@@ -12,7 +12,7 @@* Emit the sbox as volatile const to prevent the compiler from doing * constant folding on sbox references involving fixed indexes. */ -static volatile const u8 __cacheline_aligned aes_sbox[] = { +static volatile const u8 ____cacheline_aligned aes_sbox[] = {0x63 ,0x7c ,0x77 ,0x7b ,0xf2 ,0x6b ,0x6f ,0xc5 ,0x30 ,0x01 ,0x67 ,0x2b ,0xfe ,0xd7 ,0xab ,0x76 ,0xca ,0x82 ,0xc9 ,0x7d ,0xfa ,0x59 ,0x47 ,0xf0 ,
@@ -47,7 +47,7 @@ static volatile const u8 __cacheline_ali 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, }; -static volatile const u8 __cacheline_aligned aes_inv_sbox[] = { +static volatile const u8 ____cacheline_aligned aes_inv_sbox[] = {0x52 ,0x09 ,0x6a ,0xd5 ,0x30 ,0x36 ,0xa5 ,0x38 ,0xbf ,0x40 ,0xa3 ,0x9e ,0x81 ,0xf3 ,0xd7 ,0xfb ,0x7c ,0xe3 ,0x39 ,0x82 ,0x9b ,0x2f ,0xff ,0x87 ,
Greg Kroah-Hartman
maintainerPATCH 13/119 counter: 104-quad-8: Fix incorrect return value in IRQ handler
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
commit 9517d76dd160208b7a432301ce7bec8fc1ddc305 upstream.
quad8_irq_handler() should return irqreturn_t enum values, but it directly returns negative errno codes from regmap operations on error.
Return IRQ_NONE if the interrupt status cannot be read. If clearing the interrupt fails, return IRQ_HANDLED to prevent the kernel from disabling the IRQ line due to a spurious interrupt storm. Also, log these regmap failures with dev_WARN_ONCE.
--- drivers/counter/104-quad-8.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/counter/104-quad-8.c +14 -6
@@ -1192,6 +1192,7 @@ static irqreturn_t quad8_irq_handler(int {struct counter_device *counter = private;struct quad8 *const priv =counter_priv (counter); +struct device *dev = counter->parent;unsigned int status;unsigned long irq_status;unsigned long channel;
@@ -1200,8 +1201,11 @@ static irqreturn_t quad8_irq_handler(intint ret; ret =regmap_read (priv->map,QUAD8_INTERRUPT_STATUS , &status); -if (ret) -return ret; +if (ret) { +dev_WARN_ONCE (dev, true, +"Attempt to read Interrupt Status Register failed: %d\n" , ret); +return IRQ_NONE ; + }if (!status)return IRQ_NONE ;
@@ -1223,8 +1227,9 @@ static irqreturn_t quad8_irq_handler(intbreak ;default :/* should never reach this path */ -WARN_ONCE (true,"invalid interrupt trigger function %u configured for channel %lu\n" , - flg_pins, channel); +dev_WARN_ONCE (dev, true, +"invalid interrupt trigger function %u configured for channel %lu\n" , + flg_pins, channel);continue ; }
@@ -1232,8 +1237,11 @@ static irqreturn_t quad8_irq_handler(int } ret =regmap_write (priv->map,QUAD8_CHANNEL_OPERATION ,CLEAR_PENDING_INTERRUPTS ); -if (ret) -return ret; +if (ret) { +dev_WARN_ONCE (dev, true, +"Attempt to clear pending interrupts by writing to Channel Operation Register failed: %d\n" , ret); +return IRQ_HANDLED ; + }return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 14/119 counter: interrupt-cnt: Drop IRQF_NO_THREAD flag
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 23f9485510c338476b9735d516c1d4aacb810d46 upstream.
An IRQ handler can either be IRQF_NO_THREAD or acquire spinlock_t, as CONFIG_PROVE_RAW_LOCK_NESTING warns:
=============================
[ BUG: Invalid wait context ]
6.18.0-rc1+git... #1
-----------------------------
some-user-space-process/1251 is trying to lock:
(&counter->events_list_lock){....}-{3:3}, at: counter_push_event [counter] other info that might help us debug this:
context-{2:2}
no locks held by some-user-space-process/....
stack backtrace: CPU: 0 UID: 0 PID: 1251 Comm: some-user-space-process 6.18.0-rc1+git... #1 PREEMPT Call trace: show_stack (C) dump_stack_lvl dump_stack __lock_acquire lock_acquire _raw_spin_lock_irqsave counter_push_event [counter] interrupt_cnt_isr [interrupt_cnt] __handle_irq_event_percpu handle_irq_event handle_simple_irq handle_irq_desc generic_handle_domain_irq gpio_irq_handler handle_irq_desc generic_handle_domain_irq gic_handle_irq call_on_irq_stack do_interrupt_handler el0_interrupt __el0_irq_handler_common el0t_64_irq_handler el0t_64_irq
... and Sebastian correctly points out. Remove IRQF_NO_THREAD as an alternative to switching to raw_spinlock_t, because the latter would limit all potential nested locks to raw_spinlock_t only.
--- drivers/counter/interrupt-cnt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/counter/interrupt-cnt.c +1 -2
@@ -229,8 +229,7 @@ static int interrupt_cnt_probe(struct plirq_set_status_flags (priv->irq,IRQ_NOAUTOEN ); ret =devm_request_irq (dev, priv->irq, interrupt_cnt_isr, -IRQF_TRIGGER_RISING |IRQF_NO_THREAD , -dev_name (dev), counter); +IRQF_TRIGGER_RISING ,dev_name (dev), counter);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 15/119 drm/amdgpu: Fix query for VPE block_type and ip_count
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Liu <[email protected]>
commit 72d7f4573660287f1b66c30319efecd6fcde92ee upstream.
[Why]
Query for VPE block_type and ip_count is missing.
[How]
Add VPE case in ip_block_type and hw_ip_count query.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +6 -0
@@ -200,6 +200,9 @@ static enum amd_ip_block_type type = (amdgpu_device_ip_get_ip_block (adev,AMD_IP_BLOCK_TYPE_JPEG )) ?AMD_IP_BLOCK_TYPE_JPEG :AMD_IP_BLOCK_TYPE_VCN ;break ; +case AMDGPU_HW_IP_VPE : + type =AMD_IP_BLOCK_TYPE_VPE ; +break ;default : type =AMD_IP_BLOCK_TYPE_NUM ;break ;
@@ -670,6 +673,9 @@ int amdgpu_info_ioctl(struct drm_devicecase AMD_IP_BLOCK_TYPE_UVD : count = adev->uvd.num_uvd_inst;break ; +case AMD_IP_BLOCK_TYPE_VPE : + count = adev->vpe.num_instances; +break ;/* For all other IP block types not listed in the switch statement * the ip status is valid here and the instance count is one. */
Greg Kroah-Hartman
maintainerPATCH 16/119 drm/pl111: Fix error handling in pl111_amba_probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqian Lin <[email protected]>
commit 0ddd3bb4b14c9102c0267b3fd916c81fe5ab89c1 upstream.
Jump to the existing dev_put label when devm_request_irq() fails so drm_dev_put() and of_reserved_mem_device_release() run instead of returning early and leaking resources.
Found via static analysis and code review.
--- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/pl111/pl111_drv.c +1 -1
@@ -294,7 +294,7 @@ static int pl111_amba_probe(struct amba_ variant->name, priv);if (ret !=0 ) {dev_err (dev,"%s failed irq %d\n" , __func__, ret); -return ret; + goto dev_put; } ret =pl111_modeset_init (drm);
Greg Kroah-Hartman
maintainerPATCH 17/119 drm/radeon: Remove __counted_by from ClockInfoArray.clockInfo[]
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 19158c7332468bc28572bdca428e89c7954ee1b1 upstream.
clockInfo[] is a generic uchar pointer to variable sized structures which vary from ASIC to ASIC.
--- drivers/gpu/drm/radeon/pptable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/pptable.h +1 -1
@@ -450,7 +450,7 @@ typedef struct _ClockInfoArray{//sizeof(ATOM_PPLIB_CLOCK_INFO) UCHAR ucEntrySize; - UCHAR clockInfo[] __counted_by(ucNumEntries); +UCHAR clockInfo[]/*__counted_by(ucNumEntries)*/ ; }ClockInfoArray; typedef struct _NonClockInfoArray{
Greg Kroah-Hartman
maintainerPATCH 18/119 gpio: rockchip: mark the GPIO controller as sleeping
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 20cf2aed89ac6d78a0122e31c875228e15247194 upstream.
The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization.
This can cause the following lockdep splat with shared GPIOs enabled on boards which have multiple devices using the same GPIO:
BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:591in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 12, name:
kworker/u16:0preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
6 locks held by kworker/u16:0/12:
#0: ffff0001f0018d48 ((wq_completion)events_unbound#2){+.+.}-{0:0},
at: process_one_work+0x18c/0x604
#1: ffff8000842dbdf0 (deferred_probe_work){+.+.}-{0:0}, at:
process_one_work+0x1b4/0x604
#2: ffff0001f18498f8 (&dev->mutex){....}-{4:4}, at:
__device_attach+0x38/0x1b0
#3: ffff0001f75f1e90 (&gdev->srcu){.+.?}-{0:0}, at:
gpiod_direction_output_raw_commit+0x0/0x360
#4: ffff0001f46e3db8 (&shared_desc->spinlock){....}-{3:3}, at:
gpio_shared_proxy_direction_output+0xd0/0x144 [gpio_shared_proxy]
#5: ffff0001f180ee90 (&gdev->srcu){.+.?}-{0:0}, at:
gpiod_direction_output_raw_commit+0x0/0x360
irq event stamp: 81450
hardirqs last enabled at (81449): [<ffff8000813acba4>]
_raw_spin_unlock_irqrestore+0x74/0x78
hardirqs last disabled at (81450): [<ffff8000813abfb8>]
_raw_spin_lock_irqsave+0x84/0x88
softirqs last enabled at (79616): [<ffff8000811455fc>]
__alloc_skb+0x17c/0x1e8
softirqs last disabled at (79614): [<ffff8000811455fc>]
__alloc_skb+0x17c/0x1e8
CPU: 2 UID: 0 PID: 12 Comm: kworker/u16:0 Not tainted
6.19.0-rc4-next-20260105+ #11975 PREEMPT
Hardware name: Hardkernel ODROID-M1 (DT)
Workqueue: events_unbound deferred_probe_work_func
Call trace:
show_stack+0x18/0x24 (C)
dump_stack_lvl+0x90/0xd0
dump_stack+0x18/0x24
__might_resched+0x144/0x248
__might_sleep+0x48/0x98
__mutex_lock+0x5c/0x894
mutex_lock_nested+0x24/0x30
pinctrl_get_device_gpio_range+0x44/0x128
pinctrl_gpio_direction+0x3c/0xe0
pinctrl_gpio_direction_output+0x14/0x20
rockchip_gpio_direction_output+0xb8/0x19c
gpiochip_direction_output+0x38/0x94
gpiod_direction_output_raw_commit+0x1d8/0x360
gpiod_direction_output_nonotify+0x7c/0x230
gpiod_direction_output+0x34/0xf8
gpio_shared_proxy_direction_output+0xec/0x144 [gpio_shared_proxy]
gpiochip_direction_output+0x38/0x94
gpiod_direction_output_raw_commit+0x1d8/0x360
gpiod_direction_output_nonotify+0x7c/0x230
gpiod_configure_flags+0xbc/0x480
gpiod_find_and_request+0x1a0/0x574
gpiod_get_index+0x58/0x84
devm_gpiod_get_index+0x20/0xb4
devm_gpiod_get_optional+0x18/0x30
rockchip_pcie_probe+0x98/0x380
platform_probe+0x5c/0xac
really_probe+0xbc/0x298--- drivers/gpio/gpio-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-rockchip.c +1 -0
@@ -584,6 +584,7 @@ static int rockchip_gpiolib_register(str gc->ngpio = bank->nr_pins; gc->label = bank->name; gc->parent = bank->dev; + gc->can_sleep = true; ret =gpiochip_add_data (gc, bank);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 19/119 pinctrl: qcom: lpass-lpi: mark the GPIO controller as sleeping
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit ebc18e9854e5a2b62a041fb57b216a903af45b85 upstream.
The gpio_chip settings in this driver say the controller can't sleep but it actually uses a mutex for synchronization. This triggers the following BUG():
[ 9.233659] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281 [ 9.233665] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 554, name: (udev-worker) [ 9.233669] preempt_count: 1, expected: 0 [ 9.233673] RCU nest depth: 0, expected: 0 [ 9.233688] Tainted: [W]=WARN [ 9.233690] Hardware name: Dell Inc. Latitude 7455/0FK7MX, BIOS 2.10.1 05/20/2025 [ 9.233694] Call trace: [ 9.233696] show_stack+0x24/0x38 (C) [ 9.233709] dump_stack_lvl+0x40/0x88 [ 9.233716] dump_stack+0x18/0x24 [ 9.233722] __might_resched+0x148/0x160 [ 9.233731] __might_sleep+0x38/0x98 [ 9.233736] mutex_lock+0x30/0xd8 [ 9.233749] lpi_config_set+0x2e8/0x3c8 [pinctrl_lpass_lpi] [ 9.233757] lpi_gpio_direction_output+0x58/0x90 [pinctrl_lpass_lpi] [ 9.233761] gpiod_direction_output_raw_commit+0x110/0x428 [ 9.233772] gpiod_direction_output_nonotify+0x234/0x358 [ 9.233779] gpiod_direction_output+0x38/0xd0 [ 9.233786] gpio_shared_proxy_direction_output+0xb8/0x2a8 [gpio_shared_proxy] [ 9.233792] gpiod_direction_output_raw_commit+0x110/0x428 [ 9.233799] gpiod_direction_output_nonotify+0x234/0x358 [ 9.233806] gpiod_configure_flags+0x2c0/0x580 [ 9.233812] gpiod_find_and_request+0x358/0x4f8 [ 9.233819] gpiod_get_index+0x7c/0x98 [ 9.233826] devm_gpiod_get+0x34/0xb0 [ 9.233829] reset_gpio_probe+0x58/0x128 [reset_gpio] [ 9.233836] auxiliary_bus_probe+0xb0/0xf0 [ 9.233845] really_probe+0x14c/0x450 [ 9.233853] __driver_probe_device+0xb0/0x188 [ 9.233858] driver_probe_device+0x4c/0x250 [ 9.233863] __driver_attach+0xf8/0x2a0 [ 9.233868] bus_for_each_dev+0xf8/0x158 [ 9.233872] driver_attach+0x30/0x48 [ 9.233876] bus_add_driver+0x158/0x2b8 [ 9.233880] driver_register+0x74/0x118 [ 9.233886] __auxiliary_driver_register+0x94/0xe8 [ 9.233893] init_module+0x34/0xfd0 [reset_gpio] [ 9.233898] do_one_initcall+0xec/0x300 [ 9.233903] do_init_module+0x64/0x260 [ 9.233910] load_module+0x16c4/0x1900 [ 9.233915] __arm64_sys_finit_module+0x24c/0x378 [ 9.233919] invoke_syscall+0x4c/0xe8 [ 9.233925] el0_svc_common+0x8c/0xf0 [ 9.233929] do_el0_svc+0x28/0x40 [ 9.233934] el0_svc+0x38/0x100 [ 9.233938] el0t_64_sync_handler+0x84/0x130 [ 9.233943] el0t_64_sync+0x17c/0x180
Mark the controller as sleeping.
--- drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +1 -1
@@ -484,7 +484,7 @@ int lpi_pinctrl_probe(struct platform_de pctrl->chip.base =-1 ; pctrl->chip.ngpio = data->npins; pctrl->chip.label =dev_name (dev); - pctrl->chip.can_sleep = false; + pctrl->chip.can_sleep = true;mutex_init (&pctrl->lock);
Greg Kroah-Hartman
maintainerPATCH 20/119 wifi: avoid kernel-infoleak from struct iw_point
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 21cbf883d073abbfe09e3924466aa5e0449e7261 upstream.
struct iw_point has a 32bit hole on 64bit arches.
struct iw_point {
void __user *pointer; /* Pointer to the data (in user space) */ __u16 length; /* number of fields or size in bytes */ __u16 flags; /* Optional params */
};
Make sure to zero the structure to avoid disclosing 32bits of kernel data to user space.
--- net/wireless/wext-core.c | 4 ++++ net/wireless/wext-priv.c | 4 ++++ 2 files changed, 8 insertions(+)
net/wireless/wext-core.c +4 -0
@@ -1103,6 +1103,10 @@ static int compat_standard_call(struct nreturn ioctl_standard_call (dev, iwr, cmd, info, handler); iwp_compat = (struct compat_iw_point *) &iwr->u.data; + +/* struct iw_point has a 32bit hole on 64bit arches. */ +memset (&iwp,0 ,sizeof (iwp)); + iwp.pointer =compat_ptr (iwp_compat->pointer); iwp.length = iwp_compat->length; iwp.flags = iwp_compat->flags;
net/wireless/wext-priv.c +4 -0
@@ -228,6 +228,10 @@ int compat_private_call(struct net_devicstruct iw_point iwp; iwp_compat = (struct compat_iw_point *) &iwr->u.data; + +/* struct iw_point has a 32bit hole on 64bit arches. */ +memset (&iwp,0 ,sizeof (iwp)); + iwp.pointer =compat_ptr (iwp_compat->pointer); iwp.length = iwp_compat->length; iwp.flags = iwp_compat->flags;
Greg Kroah-Hartman
maintainerPATCH 21/119 wifi: mac80211: restore non-chanctx injection behaviour
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit d594cc6f2c588810888df70c83a9654b6bc7942d upstream.
During the transition to use channel contexts throughout, the ability to do injection while in monitor mode concurrent with another interface was lost, since the (virtual) monitor won't have a chanctx assigned in this scenario.
It's harder to fix drivers that actually transitioned to using channel contexts themselves, such as mt76, but it's easy to do those that are (still) just using the emulation. Do that.
--- net/mac80211/tx.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/tx.c +2 -0
@@ -2395,6 +2395,8 @@ netdev_tx_t ieee80211_monitor_start_xmitif (chanctx_conf) chandef = &chanctx_conf->def; +else if (local->emulate_chanctx) + chandef = &local->hw.conf.chandef;else goto fail_rcu;
Greg Kroah-Hartman
maintainerPATCH 22/119 libceph: prevent potential out-of-bounds reads in handle_auth_done()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: ziming zhang <[email protected]>
commit 818156caffbf55cb4d368f9c3cac64e458fb49c9 upstream.
Perform an explicit bounds check on payload_len to avoid a possible out-of-bounds access in the callout.
[ idryomov: changelog ]
--- net/ceph/messenger_v2.c | 2 ++ 1 file changed, 2 insertions(+)
net/ceph/messenger_v2.c +2 -0
@@ -2405,7 +2405,9 @@ static int process_auth_done(struct cephceph_decode_64_safe (&p, end, global_id, bad);ceph_decode_32_safe (&p, end, con->v2.con_mode, bad); +ceph_decode_32_safe (&p, end, payload_len, bad); +ceph_decode_need (&p, end, payload_len, bad);dout ("%s con %p global_id %llu con_mode %d payload_len %d\n" , __func__, con, global_id, con->v2.con_mode, payload_len);
Greg Kroah-Hartman
maintainerPATCH 23/119 libceph: replace overzealous BUG_ON in osdmap_apply_incremental()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit e00c3f71b5cf75681dbd74ee3f982a99cb690c2b upstream.
If the osdmap is (maliciously) corrupted such that the incremental osdmap epoch is different from what is expected, there is no need to BUG. Instead, just declare the incremental osdmap to be invalid.
--- net/ceph/osdmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ceph/osdmap.c +3 -1
@@ -1979,11 +1979,13 @@ struct ceph_osdmap *osdmap_apply_increme sizeof(u64) + sizeof(u32), e_inval);ceph_decode_copy (p, &fsid,sizeof (fsid)); epoch =ceph_decode_32 (p); -BUG_ON (epoch != map->epoch+1 );ceph_decode_copy (p, &modified,sizeof (modified)); new_pool_max =ceph_decode_64 (p); new_flags =ceph_decode_32 (p); +if (epoch != map->epoch +1 ) + goto e_inval; +/* full map? */ ceph_decode_32_safe (p, end, len, e_inval);if (len >0 ) {
Greg Kroah-Hartman
maintainerPATCH 24/119 libceph: make free_choose_arg_map() resilient to partial allocation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tuo Li <[email protected]>
commit e3fe30e57649c551757a02e1cad073c47e1e075e upstream.
free_choose_arg_map() may dereference a NULL pointer if its caller fails after a partial allocation.
For example, in decode_choose_args(), if allocation of arg_map->args fails, execution jumps to the fail label and free_choose_arg_map() is called. Since arg_map->size is updated to a non-zero value before memory allocation, free_choose_arg_map() will iterate over arg_map->args and dereference a NULL pointer.
To prevent this potential NULL pointer dereference and make free_choose_arg_map() more resilient, add checks for pointers before iterating.
--- net/ceph/osdmap.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/ceph/osdmap.c +12 -8
@@ -241,22 +241,26 @@ static struct crush_choose_arg_map *allostatic void free_choose_arg_map (struct crush_choose_arg_map *arg_map) { -if (arg_map) { -int i, j; +int i, j; -WARN_ON (!RB_EMPTY_NODE (&arg_map->node)); +if (!arg_map) +return ; +WARN_ON (!RB_EMPTY_NODE (&arg_map->node)); + +if (arg_map->args) {for (i =0 ; i < arg_map->size; i++) {struct crush_choose_arg *arg = &arg_map->args[i]; - -for (j =0 ; j < arg->weight_set_size; j++) -kfree (arg->weight_set[j].weights); -kfree (arg->weight_set); +if (arg->weight_set) { +for (j =0 ; j < arg->weight_set_size; j++) +kfree (arg->weight_set[j].weights); +kfree (arg->weight_set); + }kfree (arg->ids); }kfree (arg_map->args); -kfree (arg_map); } +kfree (arg_map); } DEFINE_RB_FUNCS(choose_arg_map, struct crush_choose_arg_map, choose_args_index,
Greg Kroah-Hartman
maintainerPATCH 25/119 libceph: return the handler error from mon_handle_auth_done()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit e84b48d31b5008932c0a0902982809fbaa1d3b70 upstream.
Currently any error from ceph_auth_handle_reply_done() is propagated via finish_auth() but isn't returned from mon_handle_auth_done(). This results in higher layers learning that (despite the monitor considering us to be successfully authenticated) something went wrong in the authentication phase and reacting accordingly, but msgr2 still trying to proceed with establishing the session in the background. In the case of secure mode this can trigger a WARN in setup_crypto() and later lead to a NULL pointer dereference inside of prepare_auth_signature().
--- net/ceph/mon_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/mon_client.c +1 -1
@@ -1417,7 +1417,7 @@ static int mon_handle_auth_done(struct cif (!ret)finish_hunting (monc);mutex_unlock (&monc->mutex); -return 0 ; +return ret; } static int mon_handle_auth_bad_method(struct ceph_connection *con,
Greg Kroah-Hartman
maintainerPATCH 26/119 libceph: reset sparse-read state in osd_fault()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Edwards <[email protected]>
commit 11194b416ef95012c2cfe5f546d71af07b639e93 upstream.
When a fault occurs, the connection is abandoned, reestablished, and any pending operations are retried. The OSD client tracks the progress of a sparse-read reply using a separate state machine, largely independent of the messenger's state.
If a connection is lost mid-payload or the sparse-read state machine returns an error, the sparse-read state is not reset. The OSD client will then interpret the beginning of a new reply as the continuation of the old one. If this makes the sparse-read machinery enter a failure state, it may never recover, producing loops like:
libceph: [0] got 0 extents
libceph: data len 142248331 != extent len 0
libceph: osd0 (1)...:6801 socket error on read
libceph: data len 142248331 != extent len 0
libceph: osd0 (1)...:6801 socket error on read
Therefore, reset the sparse-read state in osd_fault(), ensuring retries start from a clean state.
--- net/ceph/osd_client.c | 3 +++ 1 file changed, 3 insertions(+)
net/ceph/osd_client.c +3 -0
@@ -4306,6 +4306,9 @@ static void osd_fault(struct ceph_connec goto out_unlock; } + osd->o_sparse_op_idx =-1 ; +ceph_init_sparse_read (&osd->o_sparse_read); +if (!reopen_osd (osd))kick_osd_requests (osd);maybe_request_map (osdc);
Greg Kroah-Hartman
maintainerPATCH 27/119 libceph: make calc_target() set t->paused, not just clear it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit c0fe2994f9a9d0a2ec9e42441ea5ba74b6a16176 upstream.
Currently calc_target() clears t->paused if the request shouldn't be paused anymore, but doesn't ever set t->paused even though it's able to determine when the request should be paused. Setting t->paused is left to __submit_request() which is fine for regular requests but doesn't work for linger requests -- since __submit_request() doesn't operate on linger requests, there is nowhere for lreq->t.paused to be set. One consequence of this is that watches don't get reestablished on paused -> unpaused transitions in cases where requests have been paused long enough for the (paused) unwatch request to time out and for the subsequent (re)watch request to enter the paused state. On top of the watch not getting reestablished, rbd_reregister_watch() gets stuck with rbd_dev->watch_mutex held:
rbd_register_watch
__rbd_register_watch
ceph_osdc_watch
linger_reg_commit_wait
It's waiting for lreq->reg_commit_wait to be completed, but for that to happen the respective request needs to end up on need_resend_linger list and be kicked when requests are unpaused. There is no chance for that if the request in question is never marked paused in the first place.
The fact that rbd_dev->watch_mutex remains taken out forever then prevents the image from getting unmapped -- "rbd unmap" would inevitably hang in D state on an attempt to grab the mutex.
--- net/ceph/osd_client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +9 -2
@@ -1611,6 +1611,7 @@ static enum calc_target_result calc_targstruct ceph_pg_pool_info *pi;struct ceph_pg pgid, last_pgid;struct ceph_osds up, acting; +bool should_be_paused;bool is_read = t->flags &CEPH_OSD_FLAG_READ ;bool is_write = t->flags &CEPH_OSD_FLAG_WRITE ;bool force_resend = false;
@@ -1679,10 +1680,16 @@ static enum calc_target_result calc_targ &last_pgid)) force_resend = true; -if (t->paused && !target_should_be_paused (osdc, t, pi)) { - t->paused = false; + should_be_paused =target_should_be_paused (osdc, t, pi); +if (t->paused && !should_be_paused) { unpaused = true; } +if (t->paused != should_be_paused) { +dout ("%s t %p paused %d -> %d\n" , __func__, t, t->paused, + should_be_paused); + t->paused = should_be_paused; + } + legacy_change =ceph_pg_compare (&t->pgid, &pgid) ||ceph_osds_changed (&t->acting, &acting, t->used_replica || any_change);
Greg Kroah-Hartman
maintainerPATCH 28/119 tls: Use __sk_dst_get() and dst_dev_rcu() in get_netdev_for_sock().
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit c65f27b9c3be2269918e1cbad6d8884741f835c5 upstream.
get_netdev_for_sock() is called during setsockopt(), so not under RCU.
Using sk_dst_get(sk)->dev could trigger UAF.
Let's use __sk_dst_get() and dst_dev_rcu().
Note that the only ->ndo_sk_get_lower_dev() user is bond_sk_get_lower_dev(), which uses RCU.
--- net/tls/tls_device.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
net/tls/tls_device.c +10 -8
@@ -123,17 +123,19 @@ static void tls_device_queue_ctx_destruc/* We assume that the socket is already connected */ static struct net_device *get_netdev_for_sock (struct sock *sk) { -struct dst_entry *dst =sk_dst_get (sk); -struct net_device *netdev =NULL ; +struct net_device *dev, *lowest_dev =NULL ; +struct dst_entry *dst; -if (likely (dst)) { - netdev =netdev_sk_get_lowest_dev (dst->dev, sk); -dev_hold (netdev); +rcu_read_lock (); + dst =__sk_dst_get (sk); + dev = dst ?dst_dev_rcu (dst) :NULL ; +if (likely (dev)) { + lowest_dev =netdev_sk_get_lowest_dev (dev, sk); +dev_hold (lowest_dev); } +rcu_read_unlock (); -dst_release (dst); - -return netdev; +return lowest_dev; }static void destroy_record (struct tls_record_info *record)
Greg Kroah-Hartman
maintainerPATCH 29/119 drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Wang <[email protected]>
commit 1313351e71181a4818afeb8dfe202e4162091ef6 upstream.
Move forcewake_get() into xe_gt_idle_enable_c6() to streamline the code and make it easier to use.
--- drivers/gpu/drm/xe/xe_gt_idle.c | 20 +++++++++++++------- drivers/gpu/drm/xe/xe_gt_idle.h | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 10 +--------- 3 files changed, 15 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/xe_gt_idle.c +13 -7
@@ -204,11 +204,8 @@ static void gt_idle_fini(void *arg)xe_gt_idle_disable_pg (gt); -if (gt_to_xe (gt)->info.skip_guc_pc) { -XE_WARN_ON (xe_force_wake_get (gt_to_fw (gt),XE_FW_GT )); +if (gt_to_xe (gt)->info.skip_guc_pc)xe_gt_idle_disable_c6 (gt); -xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); - }sysfs_remove_files (kobj, gt_idle_attrs);kobject_put (kobj);
@@ -266,14 +263,23 @@ void xe_gt_idle_enable_c6(struct xe_gt * RC_CTL_HW_ENABLE | RC_CTL_TO_MODE | RC_CTL_RC6_ENABLE); } -void xe_gt_idle_disable_c6 (struct xe_gt *gt) +int xe_gt_idle_disable_c6 (struct xe_gt *gt) { +unsigned int fw_ref; +xe_device_assert_mem_access (gt_to_xe (gt)); -xe_force_wake_assert_held (gt_to_fw (gt),XE_FW_GT );if (IS_SRIOV_VF (gt_to_xe (gt))) -return ; +return 0 ; + + fw_ref =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (!fw_ref) +return -ETIMEDOUT ;xe_mmio_write32 (gt,RC_CONTROL ,0 );xe_mmio_write32 (gt,RC_STATE ,0 ); + +xe_force_wake_put (gt_to_fw (gt), fw_ref); + +return 0 ; }
drivers/gpu/drm/xe/xe_gt_idle.h +1 -1
@@ -12,7 +12,7 @@ struct xe_gt;int xe_gt_idle_init (struct xe_gt_idle *gtidle);void xe_gt_idle_enable_c6 (struct xe_gt *gt); -void xe_gt_idle_disable_c6 (struct xe_gt *gt); +int xe_gt_idle_disable_c6 (struct xe_gt *gt);void xe_gt_idle_enable_pg (struct xe_gt *gt);void xe_gt_idle_disable_pg (struct xe_gt *gt);
drivers/gpu/drm/xe/xe_guc_pc.c +1 -9
@@ -1008,15 +1008,7 @@ int xe_guc_pc_gucrc_disable(struct xe_guif (ret)return ret; - ret =xe_force_wake_get (gt_to_fw (gt),XE_FORCEWAKE_ALL ); -if (ret) -return ret; - -xe_gt_idle_disable_c6 (gt); - -XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt),XE_FORCEWAKE_ALL )); - -return 0 ; +return xe_gt_idle_disable_c6 (gt); }/**
Greg Kroah-Hartman
maintainerPATCH 30/119 drm/xe: Ensure GT is in C0 during resumes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Wang <[email protected]>
commit 95d0883ac8105717f59c2dcdc0d8b9150f13aa12 upstream.
This patch ensures the gt will be awake for the entire duration of the resume sequences until GuCRC takes over and GT-C6 gets re-enabled.
Before suspending GT-C6 is kept enabled, but upon resume, GuCRC is not yet alive to properly control the exits and some cases of instability and corruption related to GT-C6 can be observed.
--- drivers/gpu/drm/xe/xe_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pm.c +7 -1
@@ -17,7 +17,7 @@#include "xe_device_sysfs.h" #include "xe_ggtt.h" #include "xe_gt.h" -#include "xe_guc.h" +#include "xe_gt_idle.h" #include "xe_irq.h" #include "xe_pcode.h" #include "xe_trace.h"
@@ -165,6 +165,9 @@ int xe_pm_resume(struct xe_device *xe)drm_dbg (&xe->drm,"Resuming device\n" );trace_xe_pm_resume (xe,__builtin_return_address (0 )); +for_each_gt (gt, xe, id) +xe_gt_idle_disable_c6 (gt); +for_each_tile (tile, xe, id)xe_wa_apply_tile_workarounds (tile);
@@ -451,6 +454,9 @@ int xe_pm_runtime_resume(struct xe_devicxe_rpm_lockmap_acquire (xe); +for_each_gt (gt, xe, id) +xe_gt_idle_disable_c6 (gt); +if (xe->d3cold.allowed) { err =xe_pcode_ready (xe, true);if (err)
Greg Kroah-Hartman
maintainerPATCH 31/119 csky: fix csky_cmpxchg_fixup not working
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Li <[email protected]>
[ Upstream commit 809ef03d6d21d5fea016bbf6babeec462e37e68c ]
In the csky_cmpxchg_fixup function, it is incorrect to use the global variable csky_cmpxchg_stw to determine the address where the exception occurred.The global variable csky_cmpxchg_stw stores the opcode at the time of the exception, while &csky_cmpxchg_stw shows the address where the exception occurred.
--- arch/csky/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/csky/mm/fault.c +2 -2
@@ -45,8 +45,8 @@ static inline void csky_cmpxchg_fixup(struct pt_regs *regs)if (trap_no (regs) !=VEC_TLBMODIFIED )return ; -if (instruction_pointer (regs) == csky_cmpxchg_stw) -instruction_pointer_set (regs, csky_cmpxchg_ldw); +if (instruction_pointer (regs) == (unsigned long )&csky_cmpxchg_stw) +instruction_pointer_set (regs, (unsigned long )&csky_cmpxchg_ldw); return; }#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 32/119 ARM: 9461/1: Disable HIGHPTE on PREEMPT_RT kernels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit fedadc4137234c3d00c4785eeed3e747fe9036ae ]
gup_pgd_range() is invoked with disabled interrupts and invokes __kmap_local_page_prot() via pte_offset_map(), gup_p4d_range(). With HIGHPTE enabled, __kmap_local_page_prot() invokes kmap_high_get() which uses a spinlock_t via lock_kmap_any(). This leads to an sleeping-while-atomic error on PREEMPT_RT because spinlock_t becomes a sleeping lock and must not be acquired in atomic context.
The loop in map_new_virtual() uses wait_queue_head_t for wake up which also is using a spinlock_t.
Since HIGHPTE is rarely needed at all, turn it off for PREEMPT_RT to allow the use of get_user_pages_fast().
[arnd: rework patch to turn off HIGHPTE instead of HAVE_PAST_GUP]
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -1229,7 +1229,7 @@ config HIGHMEM config HIGHPTE bool "Allocate 2nd-level pagetables from highmem" if EXPERT - depends on HIGHMEM + depends on HIGHMEM && !PREEMPT_RT default y help The VM uses one page of physical memory for each page table.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 33/119 alpha: dont reference obsolete termio struct for TC* constants
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam James <[email protected]>
[ Upstream commit 9aeed9041929812a10a6d693af050846942a1d16 ]
Similar in nature to ab107276607af90b13a5994997e19b7b9731e251. glibc-2.42 drops the legacy termio struct, but the ioctls.h header still defines some TC* constants in terms of termio (via sizeof). Hardcode the values instead.
This fixes building Python for example, which falls over like:
./Modules/termios.c:1119:16: error: invalid application of 'sizeof' to incomplete type 'struct termio'
--- arch/alpha/include/uapi/asm/ioctls.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/alpha/include/uapi/asm/ioctls.h +4 -4
@@ -23,10 +23,10 @@#define TCSETSW _IOW('t', 21, struct termios)#define TCSETSF _IOW('t', 22, struct termios) -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) +#define TCGETA 0x40127417 +#define TCSETA 0x80127418 +#define TCSETAW 0x80127419 +#define TCSETAF 0x8012741c#define TCSBRK _IO('t', 29)#define TCXONC _IO('t', 30)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 34/119 dm-snapshot: fix scheduling while atomic on real-time kernels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
[ Upstream commit 8581b19eb2c5ccf06c195d3b5468c3c9d17a5020 ]
There is reported 'scheduling while atomic' bug when using dm-snapshot on real-time kernels. The reason for the bug is that the hlist_bl code does preempt_disable() when taking the lock and the kernel attempts to take other spinlocks while holding the hlist_bl lock.
Fix this by converting a hlist_bl spinlock into a regular spinlock.
--- drivers/md/dm-exception-store.h | 2 +- drivers/md/dm-snap.c | 73 +++++++++++++++------------------ 2 files changed, 35 insertions(+), 40 deletions(-)
drivers/md/dm-exception-store.h +1 -1
@@ -29,7 +29,7 @@ typedef sector_t chunk_t;* chunk within the device. */ struct dm_exception { -struct hlist_bl_node hash_list; +struct hlist_node hash_list;chunk_t old_chunk;chunk_t new_chunk;
drivers/md/dm-snap.c +34 -39
182 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 35/119 NFSv4: ensure the open stateid seqid doesnt go backwards
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
[ Upstream commit 2e47c3cc64b44b0b06cd68c2801db92ff143f2b2 ]
We have observed an NFSv4 client receiving a LOCK reply with a status of NFS4ERR_OLD_STATEID and subsequently retrying the LOCK request with an earlier seqid value in the stateid. As this was for a new lockowner, that would imply that nfs_set_open_stateid_locked() had updated the open stateid seqid with an earlier value.
Looking at nfs_set_open_stateid_locked(), if the incoming seqid is out of sequence, the task will sleep on the state->waitq for up to 5 seconds. If the task waits for the full 5 seconds, then after finishing the wait it'll update the open stateid seqid with whatever value the incoming seqid has. If there are multiple waiters in this scenario, then the last one to perform said update may not be the one with the highest seqid.
Add a check to ensure that the seqid can only be incremented, and add a tracepoint to indicate when old seqids are skipped.
--- fs/nfs/nfs4proc.c | 13 +++++++++++-- fs/nfs/nfs4trace.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +11 -2
@@ -1753,8 +1753,17 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,if (nfs_stateid_is_sequential (state, stateid))break ; -if (status) -break ; +if (status) { +if (nfs4_stateid_match_other (stateid, &state->open_stateid) && + !nfs4_stateid_is_newer (stateid, &state->open_stateid)) { +trace_nfs4_open_stateid_update_skip (state->inode, + stateid, status); +return ; + }else { +break ; + } + } +/* Rely on seqids for serialisation with NFSv4.0 */ if (!nfs4_has_session (NFS_SERVER (state->inode)->nfs_client))break ;
fs/nfs/nfs4trace.h +1 -0
@@ -1278,6 +1278,7 @@ DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_delegreturn);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update_wait); +DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update_skip);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_close_stateid_update_wait); DECLARE_EVENT_CLASS(nfs4_getattr_event,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 36/119 ASoC: rockchip: Fix Wvoid-pointer-to-enum-cast warning (again)
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 57d508b5f718730f74b11e0dc9609ac7976802d1 ]
'version' is an enum, thus cast of pointer on 64-bit compile test with clang W=1 causes:
rockchip_pdm.c:583:17: error: cast to smaller integer type 'enum rk_pdm_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
This was already fixed in commit 49a4a8d12612 ("ASoC: rockchip: Fix Wvoid-pointer-to-enum-cast warning") but then got bad in commit 9958d85968ed ("ASoC: Use device_get_match_data()").
Discussion on LKML also pointed out that 'uintptr_t' is not the correct type and either 'kernel_ulong_t' or 'unsigned long' should be used, with several arguments towards the latter [1].
--- sound/soc/rockchip/rockchip_pdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/rockchip/rockchip_pdm.c +1 -1
@@ -580,7 +580,7 @@ static int rockchip_pdm_probe(struct platform_device *pdev)if (!pdm)return -ENOMEM ; - pdm->version = (enum rk_pdm_version )device_get_match_data (&pdev->dev); + pdm->version = (unsigned long )device_get_match_data (&pdev->dev);if (pdm->version ==RK_PDM_RK3308 ) { pdm->reset =devm_reset_control_get (&pdev->dev,"pdm-m" );if (IS_ERR (pdm->reset))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 37/119 NFS: Fix up the automount fs_context to use the correct cred
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit a2a8fc27dd668e7562b5326b5ed2f1604cb1e2e9 ]
When automounting, the fs_context should be fixed up to use the cred from the parent filesystem, since the operation is just extending the namespace. Authorisation to enter that namespace will already have been provided by the preceding lookup.
--- fs/nfs/namespace.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfs/namespace.c +5 -0
@@ -170,6 +170,11 @@ struct vfsmount *nfs_d_automount(struct path *path)if (!ctx->clone_data.fattr) goto out_fc; +if (fc->cred != server->cred) { +put_cred (fc->cred); + fc->cred =get_cred (server->cred); + } +if (fc->net_ns != client->cl_net) {put_net (fc->net_ns); fc->net_ns =get_net (client->cl_net);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 38/119 drm/amd/display: shrink struct members
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 7329417fc9ac128729c3a092b006c8f1fd0d04a6 ]
On a 32-bit ARM system, the audio_decoder struct ends up being too large for dp_retrain_link_dp_test.
link_dp_cts.c:157:1: error: the frame size of 1328 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
This is mitigated by shrinking the members of the struct and avoids having to deal with dynamic allocation.
feed_back_divider is assigned but otherwise unused. Remove both.
pixel_repetition looks like it should be a bool since it's only ever assigned to 1. But there are checks for 2 and 4. Reduce to uint8_t.
Remove ss_percentage_divider. Unused.
Shrink refresh_rate as it gets assigned to at most a 3 digit integer value.
--- .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 3 --- drivers/gpu/drm/amd/display/include/audio_types.h | 12 +++++------- 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +0 -3
@@ -1448,9 +1448,6 @@ static void build_audio_output( state->clk_mgr); } - audio_output->pll_info.feed_back_divider = - pipe_ctx->pll_settings.feedback_divider; - audio_output->pll_info.dto_source =translate_to_dto_source ( pipe_ctx->stream_res.tg->inst +1 );
drivers/gpu/drm/amd/display/include/audio_types.h +5 -7
@@ -47,15 +47,15 @@ struct audio_crtc_info {uint32_t h_total;uint32_t h_active;uint32_t v_active; -uint32_t pixel_repetition;uint32_t requested_pixel_clock_100Hz;/* in 100Hz */ uint32_t calculated_pixel_clock_100Hz;/* in 100Hz */ -uint32_t refresh_rate; +uint32_t dsc_bits_per_pixel; +uint32_t dsc_num_slices;enum dc_color_depth color_depth;enum dc_pixel_encoding pixel_encoding; +uint16_t refresh_rate; +uint8_t pixel_repetition;bool interlaced; -uint32_t dsc_bits_per_pixel; -uint32_t dsc_num_slices; };struct azalia_clock_info {uint32_t pixel_clock_in_10khz;
@@ -78,11 +78,9 @@ enum audio_dto_source {struct audio_pll_info {uint32_t audio_dto_source_clock_in_khz; -uint32_t feed_back_divider; +uint32_t ss_percentage;enum audio_dto_source dto_source;bool ss_enabled; -uint32_t ss_percentage; -uint32_t ss_percentage_divider; };struct audio_channel_associate_info {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 39/119 smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChenXiaoSong <[email protected]>
[ Upstream commit 9f99caa8950a76f560a90074e3a4b93cfa8b3d84 ]
This was reported by the KUnit tests in the later patches.
See MS-ERREF 2.3.1 STATUS_UNABLE_TO_FREE_VM. Keep it consistent with the value in the documentation.
--- fs/smb/client/nterr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/nterr.h +1 -1
@@ -70,7 +70,7 @@ extern const struct nt_err_code_struct nt_errs[];#define NT_STATUS_NO_MEMORY 0xC0000000 | 0x0017#define NT_STATUS_CONFLICTING_ADDRESSES 0xC0000000 | 0x0018#define NT_STATUS_NOT_MAPPED_VIEW 0xC0000000 | 0x0019 -#define NT_STATUS_UNABLE_TO_FREE_VM 0x80000000 | 0x001a +#define NT_STATUS_UNABLE_TO_FREE_VM 0xC0000000 | 0x001a#define NT_STATUS_UNABLE_TO_DELETE_SECTION 0xC0000000 | 0x001b#define NT_STATUS_INVALID_SYSTEM_SERVICE 0xC0000000 | 0x001c#define NT_STATUS_ILLEGAL_INSTRUCTION 0xC0000000 | 0x001d
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 40/119 smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChenXiaoSong <[email protected]>
[ Upstream commit b2b50fca34da5ec231008edba798ddf92986bd7f ]
This was reported by the KUnit tests in the later patches.
See MS-ERREF 2.3.1 STATUS_DEVICE_DOOR_OPEN. Keep it consistent with the value in the documentation.
--- fs/smb/client/nterr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/nterr.h +1 -1
@@ -44,7 +44,7 @@ extern const struct nt_err_code_struct nt_errs[];#define NT_STATUS_NO_DATA_DETECTED 0x8000001c#define NT_STATUS_STOPPED_ON_SYMLINK 0x8000002d#define NT_STATUS_DEVICE_REQUIRES_CLEANING 0x80000288 -#define NT_STATUS_DEVICE_DOOR_OPEN 0x80000288 +#define NT_STATUS_DEVICE_DOOR_OPEN 0x80000289#define NT_STATUS_UNSUCCESSFUL 0xC0000000 | 0x0001#define NT_STATUS_NOT_IMPLEMENTED 0xC0000000 | 0x0002#define NT_STATUS_INVALID_INFO_CLASS 0xC0000000 | 0x0003
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 41/119 smb/client: fix NT_STATUS_NO_DATA_DETECTED value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChenXiaoSong <[email protected]>
[ Upstream commit a1237c203f1757480dc2f3b930608ee00072d3cc ]
This was reported by the KUnit tests in the later patches.
See MS-ERREF 2.3.1 STATUS_NO_DATA_DETECTED. Keep it consistent with the value in the documentation.
--- fs/smb/client/nterr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/nterr.h +1 -1
@@ -41,7 +41,7 @@ extern const struct nt_err_code_struct nt_errs[];#define NT_STATUS_MEDIA_CHANGED 0x8000001c#define NT_STATUS_END_OF_MEDIA 0x8000001e#define NT_STATUS_MEDIA_CHECK 0x80000020 -#define NT_STATUS_NO_DATA_DETECTED 0x8000001c +#define NT_STATUS_NO_DATA_DETECTED 0x80000022#define NT_STATUS_STOPPED_ON_SYMLINK 0x8000002d#define NT_STATUS_DEVICE_REQUIRES_CLEANING 0x80000288#define NT_STATUS_DEVICE_DOOR_OPEN 0x80000289
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 42/119 scsi: ipr: Enable/disable IRQD_NO_BALANCING during reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Xiong <[email protected]>
[ Upstream commit 6ac3484fb13b2fc7f31cfc7f56093e7d0ce646a5 ]
A dynamic remove/add storage adapter test hits EEH on PowerPC:
EEH: [c00000000004f75c] __eeh_send_failure_event+0x7c/0x160
EEH: [c000000000048444] eeh_dev_check_failure.part.0+0x254/0x650
EEH: [c008000001650678] eeh_readl+0x60/0x90 [ipr]
EEH: [c00800000166746c] ipr_cancel_op+0x2b8/0x524 [ipr]
EEH: [c008000001656524] ipr_eh_abort+0x6c/0x130 [ipr]
EEH: [c000000000ab0d20] scmd_eh_abort_handler+0x140/0x440
EEH: [c00000000017e558] process_one_work+0x298/0x590
EEH: [c00000000017eef8] worker_thread+0xa8/0x620
EEH: [c00000000018be34] kthread+0x124/0x130
EEH: [c00000000000cd64] ret_from_kernel_thread+0x5c/0x64
A PCIe bus trace reveals that a vector of MSI-X is cleared to 0 by irqbalance daemon. If we disable irqbalance daemon, we won't see the issue.
With debug enabled in ipr driver:
[ 44.103071] ipr: Entering __ipr_remove [ 44.103083] ipr: Entering ipr_initiate_ioa_bringdown [ 44.103091] ipr: Entering ipr_reset_shutdown_ioa [ 44.103099] ipr: Leaving ipr_reset_shutdown_ioa [ 44.103105] ipr: Leaving ipr_initiate_ioa_bringdown [ 44.149918] ipr: Entering ipr_reset_ucode_download [ 44.149935] ipr: Entering ipr_reset_alert [ 44.150032] ipr: Entering ipr_reset_start_timer [ 44.150038] ipr: Leaving ipr_reset_alert [ 44.244343] scsi 1:2:3:0: alua: Detached [ 44.254300] ipr: Entering ipr_reset_start_bist [ 44.254320] ipr: Entering ipr_reset_start_timer [ 44.254325] ipr: Leaving ipr_reset_start_bist [ 44.364329] scsi 1:2:4:0: alua: Detached [ 45.134341] scsi 1:2:5:0: alua: Detached [ 45.860949] ipr: Entering ipr_reset_shutdown_ioa [ 45.860962] ipr: Leaving ipr_reset_shutdown_ioa [ 45.860966] ipr: Entering ipr_reset_alert [ 45.861028] ipr: Entering ipr_reset_start_timer [ 45.861035] ipr: Leaving ipr_reset_alert [ 45.964302] ipr: Entering ipr_reset_start_bist [ 45.964309] ipr: Entering ipr_reset_start_timer [ 45.964313] ipr: Leaving ipr_reset_start_bist [ 46.264301] ipr: Entering ipr_reset_bist_done [ 46.264309] ipr: Leaving ipr_reset_bist_done
During adapter reset, ipr device driver blocks config space access but can't block MMIO access for MSI-X entries. There is very small window:
irqbalance daemon kicks in during adapter reset before ipr driver calls pci_restore_state(pdev) to restore MSI-X table.
irqbalance daemon reads back all 0 for that MSI-X vector in __pci_read_msi_msg().
irqbalance daemon:
msi_domain_set_affinity()
->irq_chip_set_affinity_patent()
->xive_irq_set_affinity()
->irq_chip_compose_msi_msg()
->pseries_msi_compose_msg()
->__pci_read_msi_msg(): read all 0 since didn't call pci_restore_state
->irq_chip_write_msi_msg()
-> pci_write_msg_msi(): write 0 to the msix vector entryWhen ipr driver calls pci_restore_state(pdev) in ipr_reset_restore_cfg_space(), the MSI-X vector entry has been cleared by irqbalance daemon in pci_write_msg_msix().
pci_restore_state()
->__pci_restore_msix_state()
Below is the MSI-X table for ipr adapter after irqbalance daemon kicked in during adapter reset:
Dump MSIx table: index=0 address_lo=c800 address_hi=10000000 msg_data=0 Dump MSIx table: index=1 address_lo=c810 address_hi=10000000 msg_data=0 Dump MSIx table: index=2 address_lo=c820 address_hi=10000000 msg_data=0 Dump MSIx table: index=3 address_lo=c830 address_hi=10000000 msg_data=0 Dump MSIx table: index=4 address_lo=c840 address_hi=10000000 msg_data=0 Dump MSIx table: index=5 address_lo=c850 address_hi=10000000 msg_data=0 Dump MSIx table: index=6 address_lo=c860 address_hi=10000000 msg_data=0 Dump MSIx table: index=7 address_lo=c870 address_hi=10000000 msg_data=0 Dump MSIx table: index=8 address_lo=0 address_hi=0 msg_data=0 ---------> Hit EEH since msix vector of index=8 are 0
Dump MSIx table: index=9 address_lo=c890 address_hi=10000000 msg_data=0 Dump MSIx table: index=10 address_lo=c8a0 address_hi=10000000 msg_data=0 Dump MSIx table: index=11 address_lo=c8b0 address_hi=10000000 msg_data=0 Dump MSIx table: index=12 address_lo=c8c0 address_hi=10000000 msg_data=0 Dump MSIx table: index=13 address_lo=c8d0 address_hi=10000000 msg_data=0 Dump MSIx table: index=14 address_lo=c8e0 address_hi=10000000 msg_data=0 Dump MSIx table: index=15 address_lo=c8f0 address_hi=10000000 msg_data=0
[ 46.264312] ipr: Entering ipr_reset_restore_cfg_space [ 46.267439] ipr: Entering ipr_fail_all_ops [ 46.267447] ipr: Leaving ipr_fail_all_ops [ 46.267451] ipr: Leaving ipr_reset_restore_cfg_space [ 46.267454] ipr: Entering ipr_ioa_bringdown_done [ 46.267458] ipr: Leaving ipr_ioa_bringdown_done [ 46.267467] ipr: Entering ipr_worker_thread [ 46.267470] ipr: Leaving ipr_worker_thread
IRQ balancing is not required during adapter reset.
Enable "IRQ_NO_BALANCING" flag before starting adapter reset and disable it after calling pci_restore_state(). The irqbalance daemon is disabled for this short period of time (~2s).
--- drivers/scsi/ipr.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/scsi/ipr.c +27 -1
@@ -61,8 +61,8 @@#include <linux/hdreg.h> #include <linux/reboot.h> #include <linux/stringify.h> +#include <linux/irq.h> #include <asm/io.h> -#include <asm/irq.h> #include <asm/processor.h> #include <scsi/scsi.h> #include <scsi/scsi_host.h>
@@ -7843,6 +7843,30 @@ static int ipr_dump_mailbox_wait(struct ipr_cmnd *ipr_cmd)return IPR_RC_JOB_RETURN ; } +/** +* ipr_set_affinity_nobalance +* @ioa_cfg: ipr_ioa_cfg struct for an ipr device +* @flag: bool +* true: ensable "IRQ_NO_BALANCING" bit for msix interrupt +* false: disable "IRQ_NO_BALANCING" bit for msix interrupt +* Description: This function will be called to disable/enable +* "IRQ_NO_BALANCING" to avoid irqbalance daemon +* kicking in during adapter reset. +**/ +static void ipr_set_affinity_nobalance (struct ipr_ioa_cfg *ioa_cfg,bool flag) +{ +int irq, i; + +for (i =0 ; i < ioa_cfg->nvectors; i++) { + irq =pci_irq_vector (ioa_cfg->pdev, i); + +if (flag) +irq_set_status_flags (irq,IRQ_NO_BALANCING ); +else +irq_clear_status_flags (irq,IRQ_NO_BALANCING ); + } +} +/** * ipr_reset_restore_cfg_space - Restore PCI config space. * @ipr_cmd: ipr command struct
@@ -7867,6 +7891,7 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)return IPR_RC_JOB_CONTINUE ; } +ipr_set_affinity_nobalance (ioa_cfg, false);ipr_fail_all_ops (ioa_cfg);if (ioa_cfg->sis64) {
@@ -7946,6 +7971,7 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd) rc =pci_write_config_byte (ioa_cfg->pdev,PCI_BIST ,PCI_BIST_START );if (rc ==PCIBIOS_SUCCESSFUL ) { +ipr_set_affinity_nobalance (ioa_cfg, true); ipr_cmd->job_step = ipr_reset_bist_done;ipr_reset_start_timer (ipr_cmd,IPR_WAIT_FOR_BIST_TIMEOUT ); rc =IPR_RC_JOB_RETURN ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 43/119 scsi: ufs: core: Fix EH failure after W-LUN resume error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Kao <[email protected]>
[ Upstream commit b4bb6daf4ac4d4560044ecdd81e93aa2f6acbb06 ]
When a W-LUN resume fails, its parent devices in the SCSI hierarchy, including the scsi_target, may be runtime suspended. Subsequently, the error handler in ufshcd_recover_pm_error() fails to set the W-LUN device back to active because the parent target is not active. This results in the following errors:
google-ufshcd 3c2d0000.ufs: ufshcd_err_handler started; HBA state eh_fatal; ...
ufs_device_wlun 0:0:0:49488: START_STOP failed for power mode: 1, result 40000
ufs_device_wlun 0:0:0:49488: ufshcd_wl_runtime_resume failed: -5
...
ufs_device_wlun 0:0:0:49488: runtime PM trying to activate child device 0:0:0:49488 but parent (target0:0:0) is not active
Address this by:
1. Ensuring the W-LUN's parent scsi_target is runtime resumed before attempting to set the W-LUN to active within ufshcd_recover_pm_error().
2. Explicitly checking for power.runtime_error on the HBA and W-LUN devices before calling pm_runtime_set_active() to clear the error state.
3. Adding pm_runtime_get_sync(hba->dev) in ufshcd_err_handling_prepare() to ensure the HBA itself is active during error recovery, even if a child device resume failed.
These changes ensure the device power states are managed correctly during error recovery.
--- drivers/ufs/core/ufshcd.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/ufs/core/ufshcd.c +28 -8
@@ -6411,6 +6411,11 @@ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend)static void ufshcd_err_handling_prepare (struct ufs_hba *hba) { +/* +* A WLUN resume failure could potentially lead to the HBA being +* runtime suspended, so take an extra reference on hba->dev. +*/ +pm_runtime_get_sync (hba->dev);ufshcd_rpm_get_sync (hba);if (pm_runtime_status_suspended (&hba->ufs_device_wlun->sdev_gendev) || hba->is_sys_suspended) {
@@ -6451,6 +6456,7 @@ static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)if (ufshcd_is_clkscaling_supported (hba))ufshcd_clk_scaling_suspend (hba, false);ufshcd_rpm_put (hba); +pm_runtime_put (hba->dev); }static inline bool ufshcd_err_handling_should_stop (struct ufs_hba *hba)
@@ -6465,28 +6471,42 @@ static inline bool ufshcd_err_handling_should_stop(struct ufs_hba *hba)#ifdef CONFIG_PM static void ufshcd_recover_pm_error (struct ufs_hba *hba) { +struct scsi_target *starget = hba->ufs_device_wlun->sdev_target;struct Scsi_Host *shost = hba->host;struct scsi_device *sdev;struct request_queue *q; -int ret; +bool resume_sdev_queues = false; hba->is_sys_suspended = false; +/* -* Set RPM status of wlun device to RPM_ACTIVE, -* this also clears its runtime error. +* Ensure the parent's error status is cleared before proceeding +* to the child, as the parent must be active to activate the child. */ - ret =pm_runtime_set_active (&hba->ufs_device_wlun->sdev_gendev); +if (hba->dev->power.runtime_error) { +/* hba->dev has no functional parent thus simplily set RPM_ACTIVE */ +pm_runtime_set_active (hba->dev); + resume_sdev_queues = true; + } + +if (hba->ufs_device_wlun->sdev_gendev.power.runtime_error) { +/* +* starget, parent of wlun, might be suspended if wlun resume failed. +* Make sure parent is resumed before set child (wlun) active. +*/ +pm_runtime_get_sync (&starget->dev); +pm_runtime_set_active (&hba->ufs_device_wlun->sdev_gendev); +pm_runtime_put_sync (&starget->dev); + resume_sdev_queues = true; + } -/* hba device might have a runtime error otherwise */ -if (ret) - ret =pm_runtime_set_active (hba->dev);/* * If wlun device had runtime error, we also need to resume those * consumer scsi devices in case any of them has failed to be * resumed due to supplier runtime resume failure. This is to unblock * blk_queue_enter in case there are bios waiting inside it. */ -if (!ret) { +if (resume_sdev_queues) {shost_for_each_device (sdev, shost) { q = sdev->request_queue; if (q->dev && (q->rpm_status == RPM_SUSPENDED ||
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 44/119 scsi: Revert "scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit 278712d20bc8ec29d1ad6ef9bdae9000ef2c220c ]
This reverts commit ab2068a6fb84751836a84c26ca72b3beb349619d.
When probing the exp-attached sata device, libsas/libata will issue a hard reset in sas_probe_sata() -> ata_sas_async_probe(), then a broadcast event will be received after the disk probe fails, and this commit causes the probe will be re-executed on the disk, and a faulty disk may get into an indefinite loop of probe.
Therefore, revert this commit, although it can fix some temporary issues with disk probe failure.
--- drivers/scsi/libsas/sas_internal.h | 14 -------------- 1 file changed, 14 deletions(-)
drivers/scsi/libsas/sas_internal.h +0 -14
@@ -145,20 +145,6 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i func, dev->parent ?"exp-attached" :"direct-attached" , SAS_ADDR(dev->sas_addr), err); - -/* -* If the device probe failed, the expander phy attached address -* needs to be reset so that the phy will not be treated as flutter -* in the next revalidation -*/ -if (dev->parent && !dev_is_expander (dev->dev_type)) { -struct sas_phy *phy = dev->phy; -struct domain_device *parent = dev->parent; -struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number]; - -memset (ex_phy->attached_sas_addr,0 ,SAS_ADDR_SIZE ); - } -sas_unregister_dev (dev->port, dev); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 45/119 btrfs: fix qgroup_snapshot_quick_inherit() squota bug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
[ Upstream commit 7ee19a59a75e3d5b9ec00499b86af8e2a46fbe86 ]
qgroup_snapshot_quick_inherit() detects conditions where the snapshot destination would land in the same parent qgroup as the snapshot source subvolume. In this case we can avoid costly qgroup calculations and just add the nodesize of the new snapshot to the parent.
However, in the case of squotas this is actually a double count, and also an undercount for deeper qgroup nestings.
The following annotated script shows the issue:
btrfs quota enable --simple "$mnt"
# Create 2-level qgroup hierarchy
btrfs qgroup create 2/100 "$mnt" # Q2 (level 2) btrfs qgroup create 1/100 "$mnt" # Q1 (level 1) btrfs qgroup assign 1/100 2/100 "$mnt"
# Create base subvolume
btrfs subvolume create "$mnt/base" >/dev/null
base_id=$(btrfs subvolume show "$mnt/base" | grep 'Subvolume ID:' | awk '{print $3}')
# Create intermediate snapshot and add to Q1
btrfs subvolume snapshot "$mnt/base" "$mnt/intermediate" >/dev/null
inter_id=$(btrfs subvolume show "$mnt/intermediate" | grep 'Subvolume ID:' | awk '{print $3}')
btrfs qgroup assign "0/$inter_id" 1/100 "$mnt"
# Create working snapshot with --inherit (auto-adds to Q1)
# src=intermediate (in only Q1)
# dst=snap (inheriting only into Q1)
# This double counts the 16k nodesize of the snapshot in Q1, and
# undercounts it in Q2.
btrfs subvolume snapshot -i 1/100 "$mnt/intermediate" "$mnt/snap" >/dev/null
snap_id=$(btrfs subvolume show "$mnt/snap" | grep 'Subvolume ID:' | awk '{print $3}') # Fully complete snapshot creation
sync
# Delete working snapshot
# Q1 and Q2 will lose the full snap usage
btrfs subvolume delete "$mnt/snap" >/dev/null
# Delete intermediate and remove from Q1
# Q1 and Q2 will lose the full intermediate usage btrfs qgroup remove "0/$inter_id" 1/100 "$mnt" btrfs subvolume delete "$mnt/intermediate" >/dev/null
# Q1 should be at 0, but still has 16k. Q2 is "correct" at 0 (for now...)
# Trigger cleaner, wait for deletions
mount -o remount,sync=1 "$mnt"
btrfs subvolume sync "$mnt" "$snap_id"
btrfs subvolume sync "$mnt" "$inter_id"
# Remove Q1 from Q2
# Frees 16k more from Q2, underflowing it to 16EiB btrfs qgroup remove 1/100 2/100 "$mnt"
# And show the bad state:
btrfs qgroup show -pc "$mnt"
Qgroupid Referenced Exclusive Parent Child Path
-------- ---------- --------- ------ ----- ----
0/5 16.00KiB 16.00KiB - - <toplevel>
0/256 16.00KiB 16.00KiB - - base
1/100 16.00KiB 16.00KiB - - <0 member qgroups>
2/100 16.00EiB 16.00EiB - - <0 member qgroups>Fix this by simply not doing this quick inheritance with squotas.
I suspect that it is also wrong in normal qgroups to not recurse up the qgroup tree in the quick inherit case, though other consistency checks will likely fix it anyway.
--- fs/btrfs/qgroup.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/qgroup.c +3 -0
@@ -3298,6 +3298,9 @@ static int qgroup_snapshot_quick_inherit(struct btrfs_fs_info *fs_info,struct btrfs_qgroup_list *list;int nr_parents =0 ; +if (btrfs_qgroup_mode (fs_info) !=BTRFS_QGROUP_MODE_FULL ) +return 0 ; + src =find_qgroup_rb (fs_info, srcid);if (!src)return -ENOENT ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 46/119 btrfs: qgroup: update all parent qgroups when doing quick inherit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 68d4b3fa18d72b7f649e83012e7e08f1881f6b75 ]
[BUG]
There is a bug that if a subvolume has multi-level parent qgroups, and is able to do a quick inherit, only the direct parent qgroup got updated:
mkfs.btrfs -f -O quota $dev mount $dev $mnt btrfs subv create $mnt/subv1 btrfs qgroup create 1/100 $mnt btrfs qgroup create 2/100 $mnt btrfs qgroup assign 1/100 2/100 $mnt btrfs qgroup assign 0/256 1/100 $mnt btrfs qgroup show -p --sync $mnt
Qgroupid Referenced Exclusive Parent Path -------- ---------- --------- ------ ---- 0/5 16.00KiB 16.00KiB - <toplevel> 0/256 16.00KiB 16.00KiB 1/100 subv1 1/100 16.00KiB 16.00KiB 2/100 2/100<1 member qgroup> 2/100 16.00KiB 16.00KiB - <0 member qgroups>
btrfs subv snap -i 1/100 $mnt/subv1 $mnt/snap1 btrfs qgroup show -p --sync $mnt
Qgroupid Referenced Exclusive Parent Path -------- ---------- --------- ------ ---- 0/5 16.00KiB 16.00KiB - <toplevel> 0/256 16.00KiB 16.00KiB 1/100 subv1 0/257 16.00KiB 16.00KiB 1/100 snap1 1/100 32.00KiB 32.00KiB 2/100 2/100<1 member qgroup> 2/100 16.00KiB 16.00KiB - <0 member qgroups>
# Note that 2/100 is not updated, and qgroup numbers are inconsistent
umount $mnt
[CAUSE]
If the snapshot source subvolume belongs to a parent qgroup, and the new snapshot target is also added to the new same parent qgroup, we allow a quick update without marking qgroup inconsistent.
But that quick update only update the parent qgroup, without checking if there is any more parent qgroups.
[FIX]
Iterate through all parent qgroups during the quick inherit.
--- fs/btrfs/qgroup.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
fs/btrfs/qgroup.c +16 -2
@@ -3295,7 +3295,10 @@ static int qgroup_snapshot_quick_inherit(struct btrfs_fs_info *fs_info, {struct btrfs_qgroup *src;struct btrfs_qgroup *parent; +struct btrfs_qgroup *qgroup;struct btrfs_qgroup_list *list; +LIST_HEAD (qgroup_list); +const u32 nodesize = fs_info->nodesize;int nr_parents =0 ;if (btrfs_qgroup_mode (fs_info) !=BTRFS_QGROUP_MODE_FULL )
@@ -3335,8 +3338,19 @@ static int qgroup_snapshot_quick_inherit(struct btrfs_fs_info *fs_info,if (parent->excl != parent->rfer)return 1 ; - parent->excl += fs_info->nodesize; - parent->rfer += fs_info->nodesize; +qgroup_iterator_add (&qgroup_list, parent); +list_for_each_entry (qgroup, &qgroup_list, iterator) { + qgroup->rfer += nodesize; + qgroup->rfer_cmpr += nodesize; + qgroup->excl += nodesize; + qgroup->excl_cmpr += nodesize; +qgroup_dirty (fs_info, qgroup); + +/* Append parent qgroups to @qgroup_list. */ +list_for_each_entry (list, &qgroup->groups, next_group) +qgroup_iterator_add (&qgroup_list, list->group); + } +qgroup_iterator_clean (&qgroup_list);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 47/119 btrfs: tracepoints: use btrfs_root_id() to get the id of a root
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 0f987c099d22c3b8c7d94fd13f957792e46f79c9 ]
Instead of open coding btrfs_root_id() to get the ID of a root, use the helper in the trace points, which also makes the code less verbose.
Stable-dep-of: f157dd661339 ("btrfs: fix NULL dereference on root when tracing inode eviction")
--- include/trace/events/btrfs.h | 50 +++++++++++++++++------------------- 1 file changed, 23 insertions(+), 27 deletions(-)
include/trace/events/btrfs.h +23 -27
@@ -223,8 +223,7 @@ DECLARE_EVENT_CLASS(btrfs__inode, __entry->generation =BTRFS_I (inode)->generation; __entry->last_trans =BTRFS_I (inode)->last_trans; __entry->logged_trans =BTRFS_I (inode)->logged_trans; - __entry->root_objectid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (BTRFS_I (inode)->root); ), TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu "
@@ -296,7 +295,7 @@ TRACE_EVENT_CONDITION(btrfs_get_extent, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->ino =btrfs_ino (inode); __entry->start = map->start; __entry->len = map->len;
@@ -375,7 +374,7 @@ DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, ),TP_fast_assign_btrfs (bi->root->fs_info, - __entry->root_obj = bi->root->root_key.objectid; + __entry->root_obj = btrfs_root_id(bi->root); __entry->ino =btrfs_ino (bi); __entry->isize = bi->vfs_inode.i_size; __entry->disk_isize = bi->disk_i_size;
@@ -426,7 +425,7 @@ DECLARE_EVENT_CLASS(TP_fast_assign_btrfs ( bi->root->fs_info, - __entry->root_obj = bi->root->root_key.objectid; + __entry->root_obj = btrfs_root_id(bi->root); __entry->ino =btrfs_ino (bi); __entry->isize = bi->vfs_inode.i_size; __entry->disk_isize = bi->disk_i_size;
@@ -526,7 +525,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent, __entry->flags = ordered->flags; __entry->compress_type = ordered->compress_type; __entry->refs =refcount_read (&ordered->refs); - __entry->root_objectid = inode->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (inode->root); __entry->truncated_len = ordered->truncated_len; ),
@@ -663,7 +662,7 @@ TRACE_EVENT(btrfs_finish_ordered_extent, __entry->start = start; __entry->len = len; __entry->uptodate = uptodate; - __entry->root_objectid = inode->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (inode->root); ), TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu uptodate=%d",
@@ -704,8 +703,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage, __entry->for_reclaim = wbc->for_reclaim; __entry->range_cyclic = wbc->range_cyclic; __entry->writeback_index = inode->i_mapping->writeback_index; - __entry->root_objectid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (BTRFS_I (inode)->root); ), TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu "
@@ -749,7 +747,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook, __entry->start = start; __entry->end = end; __entry->uptodate = uptodate; - __entry->root_objectid = inode->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (inode->root); ), TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d",
@@ -779,8 +777,7 @@ TRACE_EVENT(btrfs_sync_file, __entry->ino =btrfs_ino (BTRFS_I (inode)); __entry->parent =btrfs_ino (BTRFS_I (d_inode (dentry->d_parent))); __entry->datasync = datasync; - __entry->root_objectid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (BTRFS_I (inode)->root); ), TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d",
@@ -1051,7 +1048,7 @@ DECLARE_EVENT_CLASS(btrfs__chunk, __entry->sub_stripes = map->sub_stripes; __entry->offset = offset; __entry->size = size; - __entry->root_objectid = fs_info->chunk_root->root_key.objectid; + __entry->root_objectid =btrfs_root_id (fs_info->chunk_root); ), TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
@@ -1096,7 +1093,7 @@ TRACE_EVENT(btrfs_cow_block, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->buf_start = buf->start; __entry->refs =atomic_read (&buf->refs); __entry->cow_start = cow->start;
@@ -1254,7 +1251,7 @@ TRACE_EVENT(find_free_extent, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->num_bytes = ffe_ctl->num_bytes; __entry->empty_size = ffe_ctl->empty_size; __entry->flags = ffe_ctl->flags;
@@ -1283,7 +1280,7 @@ TRACE_EVENT(find_free_extent_search_loop, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->num_bytes = ffe_ctl->num_bytes; __entry->empty_size = ffe_ctl->empty_size; __entry->flags = ffe_ctl->flags;
@@ -1317,7 +1314,7 @@ TRACE_EVENT(find_free_extent_have_block_group, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->num_bytes = ffe_ctl->num_bytes; __entry->empty_size = ffe_ctl->empty_size; __entry->flags = ffe_ctl->flags;
@@ -1671,8 +1668,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, ),TP_fast_assign_btrfs (btrfs_sb (inode->i_sb), - __entry->rootid = - BTRFS_I(inode)->root->root_key.objectid; + __entry->rootid = btrfs_root_id(BTRFS_I(inode)->root); __entry->ino =btrfs_ino (BTRFS_I (inode)); __entry->start = start; __entry->len = len;
@@ -1862,7 +1858,7 @@ TRACE_EVENT(qgroup_meta_reserve, ),TP_fast_assign_btrfs (root->fs_info, - __entry->refroot = root->root_key.objectid; + __entry->refroot = btrfs_root_id(root); __entry->diff = diff; __entry->type = type; ),
@@ -1884,7 +1880,7 @@ TRACE_EVENT(qgroup_meta_convert, ),TP_fast_assign_btrfs (root->fs_info, - __entry->refroot = root->root_key.objectid; + __entry->refroot = btrfs_root_id(root); __entry->diff = diff; ),
@@ -1908,7 +1904,7 @@ TRACE_EVENT(qgroup_meta_free_all_pertrans, ),TP_fast_assign_btrfs (root->fs_info, - __entry->refroot = root->root_key.objectid; + __entry->refroot = btrfs_root_id(root);spin_lock (&root->qgroup_meta_rsv_lock); __entry->diff = -(s64 )root->qgroup_meta_rsv_pertrans;spin_unlock (&root->qgroup_meta_rsv_lock);
@@ -1990,7 +1986,7 @@ TRACE_EVENT(btrfs_inode_mod_outstanding_extents, ),TP_fast_assign_btrfs (root->fs_info, - __entry->root_objectid = root->root_key.objectid; + __entry->root_objectid = btrfs_root_id(root); __entry->ino = ino; __entry->mod = mod; __entry->outstanding = outstanding;
@@ -2075,7 +2071,7 @@ TRACE_EVENT(btrfs_set_extent_bit, __entry->owner = tree->owner; __entry->ino = inode ?btrfs_ino (inode) :0 ; - __entry->rootid = inode ? inode->root->root_key.objectid :0 ; + __entry->rootid = inode ?btrfs_root_id (inode->root) :0 ; __entry->start = start; __entry->len = len; __entry->set_bits = set_bits;
@@ -2108,7 +2104,7 @@ TRACE_EVENT(btrfs_clear_extent_bit, __entry->owner = tree->owner; __entry->ino = inode ?btrfs_ino (inode) :0 ; - __entry->rootid = inode ? inode->root->root_key.objectid :0 ; + __entry->rootid = inode ?btrfs_root_id (inode->root) :0 ; __entry->start = start; __entry->len = len; __entry->clear_bits = clear_bits;
@@ -2142,7 +2138,7 @@ TRACE_EVENT(btrfs_convert_extent_bit, __entry->owner = tree->owner; __entry->ino = inode ?btrfs_ino (inode) :0 ; - __entry->rootid = inode ? inode->root->root_key.objectid :0 ; + __entry->rootid = inode ?btrfs_root_id (inode->root) :0 ; __entry->start = start; __entry->len = len; __entry->set_bits = set_bits;
@@ -2619,7 +2615,7 @@ TRACE_EVENT(btrfs_extent_map_shrinker_remove_em,TP_fast_assign_btrfs (inode->root->fs_info, __entry->ino = btrfs_ino(inode); - __entry->root_id = inode->root->root_key.objectid; + __entry->root_id =btrfs_root_id (inode->root); __entry->start = em->start; __entry->len = em->len; __entry->flags = em->flags;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 48/119 btrfs: fix NULL dereference on root when tracing inode eviction
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Sabaté Solà <[email protected]>
[ Upstream commit f157dd661339fc6f5f2b574fe2429c43bd309534 ]
When evicting an inode the first thing we do is to setup tracing for it, which implies fetching the root's id. But in btrfs_evict_inode() the root might be NULL, as implied in the next check that we do in btrfs_evict_inode().
Hence, we either should set the ->root_objectid to 0 in case the root is NULL, or we move tracing setup after checking that the root is not NULL. Setting the rootid to 0 at least gives us the possibility to trace this call even in the case when the root is NULL, so that's the solution taken here.
--- include/trace/events/btrfs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/trace/events/btrfs.h +2 -1
@@ -223,7 +223,8 @@ DECLARE_EVENT_CLASS(btrfs__inode, __entry->generation =BTRFS_I (inode)->generation; __entry->last_trans =BTRFS_I (inode)->last_trans; __entry->logged_trans =BTRFS_I (inode)->logged_trans; - __entry->root_objectid =btrfs_root_id (BTRFS_I (inode)->root); + __entry->root_objectid =BTRFS_I (inode)->root ? +btrfs_root_id (BTRFS_I (inode)->root) :0 ; ), TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu "
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 49/119 drm/amd/display: Respect users CONFIG_FRAME_WARN more for dml files
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
[ Upstream commit 820ccf8cb2b145ab9fc12651f7f80339614fa46c ]
Currently, there are several files in drm/amd/display that aim to have a higher -Wframe-larger-than value to avoid instances of that warning with a lower value from the user's configuration. However, with the way that it is currently implemented, it does not respect the user's request via CONFIG_FRAME_WARN for a higher stack frame limit, which can cause pain when new instances of the warning appear and break the build due to CONFIG_WERROR.
Adjust the logic to switch from a hard coded -Wframe-larger-than value to only using the value as a minimum clamp and deferring to the requested value from CONFIG_FRAME_WARN if it is higher.
Stable-dep-of: 70740454377f ("drm/amd/display: Apply e4479aecf658 to dml")
--- drivers/gpu/drm/amd/display/dc/dml/Makefile | 14 ++++++++----- drivers/gpu/drm/amd/display/dc/dml2/Makefile | 22 ++++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +9 -5
@@ -29,11 +29,15 @@ dml_ccflags := $(CC_FLAGS_FPU) dml_rcflags := $(CC_FLAGS_NO_FPU) ifneq ($(CONFIG_FRAME_WARN),0) -ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) -frame_warn_flag := -Wframe-larger-than=3072 -else -frame_warn_flag := -Wframe-larger-than=2048 -endif + ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) + frame_warn_limit := 3072 + else + frame_warn_limit := 2048 + endif + + ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y) + frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit) + endif endif CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +13 -9
@@ -28,15 +28,19 @@ dml2_ccflags := $(CC_FLAGS_FPU) dml2_rcflags := $(CC_FLAGS_NO_FPU) ifneq ($(CONFIG_FRAME_WARN),0) -ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) -ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) -frame_warn_flag := -Wframe-larger-than=4096 -else -frame_warn_flag := -Wframe-larger-than=3072 -endif -else -frame_warn_flag := -Wframe-larger-than=2048 -endif + ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) + ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) + frame_warn_limit := 4096 + else + frame_warn_limit := 3072 + endif + else + frame_warn_limit := 2048 + endif + + ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y) + frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit) + endif endif subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 50/119 drm/amd/display: Apply e4479aecf658 to dml
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
[ Upstream commit 70740454377f1ba3ff32f5df4acd965db99d055b ]
After an innocuous optimization change in clang-22, allmodconfig (which enables CONFIG_KASAN and CONFIG_WERROR) breaks with:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:1724:6: error: stack frame size (3144) exceeds limit (3072) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
1724 | void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
| ^
With clang-21, this function was already pretty close to the existing limit of 3072 bytes.
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:1724:6: error: stack frame size (2904) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
1724 | void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
| ^
A similar situation occurred in dml2, which was resolved by commit e4479aecf658 ("drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang") by increasing the limit for clang when compile testing with certain sanitizer enabled, so that allmodconfig (an easy testing target) continues to work.
Apply that same change to the dml folder to clear up the warning for allmodconfig, unbreaking the build.
--- drivers/gpu/drm/amd/display/dc/dml/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +5 -1
@@ -30,7 +30,11 @@ dml_rcflags := $(CC_FLAGS_NO_FPU) ifneq ($(CONFIG_FRAME_WARN),0) ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) - frame_warn_limit := 3072 + ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) + frame_warn_limit := 4096 + else + frame_warn_limit := 3072 + endif else frame_warn_limit := 2048 endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 51/119 arm64: dts: ti: k3-am62-lp-sk-nand: Rename pinctrls to fix schema warnings
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wadim Egorov <[email protected]>
[ Upstream commit cf5e8adebe77917a4cc95e43e461cdbd857591ce ]
Rename pinctrl nodes to comply with naming conventions required by pinctrl-single schema.
--- arch/arm64/boot/dts/ti/k3-am62-lp-sk-nand.dtso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62-lp-sk-nand.dtso +1 -1
@@ -14,7 +14,7 @@ }; &main_pmx0 { - gpmc0_pins_default: gpmc0-pins-default { + gpmc0_pins_default: gpmc0-default-pins { pinctrl-single,pins = < AM62X_IOPAD(0x003c, PIN_INPUT, 0) /* (K19) GPMC0_AD0 */ AM62X_IOPAD(0x0040, PIN_INPUT, 0) /* (L19) GPMC0_AD1 */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 52/119 crypto: qat - fix duplicate restarting msg during AER error
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshita Bhilwaria <[email protected]>
[ Upstream commit 961ac9d97be72267255f1ed841aabf6694b17454 ]
The restarting message from PF to VF is sent twice during AER error
handling: once from adf_error_detected() and again from adf_disable_sriov().
This causes userspace subservices to shutdown unexpectedly when they receive a duplicate restarting message after already being restarted.
Avoid calling adf_pf2vf_notify_restarting() and adf_pf2vf_wait_for_restarting_complete() from adf_error_detected() so that the restarting msg is sent only once from PF to VF.
--- drivers/crypto/intel/qat/qat_common/adf_aer.c | 2 -- 1 file changed, 2 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_aer.c +0 -2
@@ -41,8 +41,6 @@ static pci_ers_result_t adf_error_detected(struct pci_dev *pdev,adf_error_notifier (accel_dev);adf_pf2vf_notify_fatal_error (accel_dev);adf_dev_restarting_notify (accel_dev); -adf_pf2vf_notify_restarting (accel_dev); -adf_pf2vf_wait_for_restarting_complete (accel_dev);pci_clear_master (pdev);adf_dev_down (accel_dev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 53/119 arm64: dts: add off-on-delay-us for usdhc2 regulator
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Chen <[email protected]>
[ Upstream commit ca643894a37a25713029b36cfe7d1bae515cac08 ]
For SD card, according to the spec requirement, for sd card power reset operation, it need sd card supply voltage to be lower than 0.5v and keep over 1ms, otherwise, next time power back the sd card supply voltage to 3.3v, sd card can't support SD3.0 mode again.
To match such requirement on imx8qm-mek board, add 4.8ms delay between sd power off and power on.
--- arch/arm64/boot/dts/freescale/imx8qm-mek.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8qm-mek.dts +1 -0
@@ -132,6 +132,7 @@ reg_usdhc2_vmmc: usdhc2-vmmc { regulator-max-microvolt = <3000000>; gpio = <&lsio_gpio4 7 GPIO_ACTIVE_HIGH>; enable-active-high; + off-on-delay-us = <4800>; }; reg_fec2_supply: regulator-fec2-nvcc {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 54/119 ARM: dts: imx6q-ba16: fix RTC interrupt level
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Ray <[email protected]>
[ Upstream commit e6a4eedd49ce27c16a80506c66a04707e0ee0116 ]
RTC interrupt level should be set to "LOW". This was revealed by the introduction of commit:
f181987ef477 ("rtc: m41t80: use IRQ flags obtained from fwnode")
which changed the way IRQ type is obtained.
--- arch/arm/boot/dts/nxp/imx/imx6q-ba16.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nxp/imx/imx6q-ba16.dtsi +1 -1
@@ -335,7 +335,7 @@ rtc@32 { pinctrl-0 = <&pinctrl_rtc>; reg = <0x32>; interrupt-parent = <&gpio4>; - interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <10 IRQ_TYPE_LEVEL_LOW>; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 55/119 arm64: dts: imx8mp: Fix LAN8740Ai PHY reference clock on DH electronics i.MX8M Plus DHCOM
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit c63749a7ddc59ac6ec0b05abfa0a21af9f2c1d38 ]
Add missing 'clocks' property to LAN8740Ai PHY node, to allow the PHY driver to manage LAN8740Ai CLKIN reference clock supply. This fixes sporadic link bouncing caused by interruptions on the PHY reference clock, by letting the PHY driver manage the reference clock and assure there are no interruptions.
This follows the matching PHY driver recommendation described in commit bedd8d78aba3 ("net: phy: smsc: LAN8710/20: add phy refclk in support")
--- arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi +1 -0
@@ -113,6 +113,7 @@ mdio { ethphy0f: ethernet-phy@1 { /* SMSC LAN8740Ai */ compatible = "ethernet-phy-id0007.c110", "ethernet-phy-ieee802.3-c22"; + clocks = <&clk IMX8MP_CLK_ENET_QOS>; interrupt-parent = <&gpio3>; interrupts = <19 IRQ_TYPE_LEVEL_LOW>; pinctrl-0 = <&pinctrl_ethphy0>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 56/119 arm64: dts: imx8qm-ss-dma: correct the dma channels of lpuart
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sherry Sun <[email protected]>
[ Upstream commit a988caeed9d918452aa0a68de2c6e94d86aa43ba ]
The commit 616effc0272b5 ("arm64: dts: imx8: Fix lpuart DMA channel order") swap uart rx and tx channel at common imx8-ss-dma.dtsi. But miss update imx8qm-ss-dma.dtsi.
The commit 5a8e9b022e569 ("arm64: dts: imx8qm-ss-dma: Pass lpuart dma-names") just simple add dma-names as binding doc requirement.
Correct lpuart0 - lpuart3 dma rx and tx channels, and use defines for the FSL_EDMA_RX flag.
--- arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi +4 -4
@@ -168,25 +168,25 @@ &flexcan3 { &lpuart0 { compatible = "fsl,imx8qm-lpuart", "fsl,imx8qxp-lpuart"; - dmas = <&edma2 13 0 0>, <&edma2 12 0 1>; + dmas = <&edma2 12 0 FSL_EDMA_RX>, <&edma2 13 0 0>; dma-names = "rx","tx"; }; &lpuart1 { compatible = "fsl,imx8qm-lpuart", "fsl,imx8qxp-lpuart"; - dmas = <&edma2 15 0 0>, <&edma2 14 0 1>; + dmas = <&edma2 14 0 FSL_EDMA_RX>, <&edma2 15 0 0>; dma-names = "rx","tx"; }; &lpuart2 { compatible = "fsl,imx8qm-lpuart", "fsl,imx8qxp-lpuart"; - dmas = <&edma2 17 0 0>, <&edma2 16 0 1>; + dmas = <&edma2 16 0 FSL_EDMA_RX>, <&edma2 17 0 0>; dma-names = "rx","tx"; }; &lpuart3 { compatible = "fsl,imx8qm-lpuart", "fsl,imx8qxp-lpuart"; - dmas = <&edma2 19 0 0>, <&edma2 18 0 1>; + dmas = <&edma2 18 0 FSL_EDMA_RX>, <&edma2 19 0 0>; dma-names = "rx","tx"; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 57/119 arm64: dts: mba8mx: Fix Ethernet PHY IRQ support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 89e87d0dc87eb3654c9ae01afc4a18c1c6d1e523 ]
Ethernet PHY interrupt mode is level triggered. Adjust the mode accordingly.
--- arch/arm64/boot/dts/freescale/mba8mx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/mba8mx.dtsi +1 -1
@@ -186,7 +186,7 @@ ethphy0: ethernet-phy@e { reset-assert-us = <500000>; reset-deassert-us = <500>; interrupt-parent = <&expander2>; - interrupts = <6 IRQ_TYPE_EDGE_FALLING>; + interrupts = <6 IRQ_TYPE_LEVEL_LOW>; }; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 58/119 netfilter: nft_set_pipapo: fix range overlap detection
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 7711f4bb4b360d9c0ff84db1c0ec91e385625047 ]
set->klen has to be used, not sizeof(). The latter only compares a single register but a full check of the entire key is needed.
Example:
table ip t {
map s {
typeof iifname . ip saddr : verdict
flags interval
}
}nft add element t s '{ "lo" . 10.0.0.0/24 : drop }' # no error, expected nft add element t s '{ "lo" . 10.0.0.0/24 : drop }' # no error, expected nft add element t s '{ "lo" . 10.0.0.0/8 : drop }' # bug: no error
The 3rd 'add element' should be rejected via -ENOTEMPTY, not -EEXIST, so userspace / nft can report an error to the user.
The latter is only correct for the 2nd case (re-add of existing element).
As-is, userspace is told that the command was successful, but no elements were added.
After this patch, 3rd command gives:
Error: Could not process rule: File exists add element t s { "lo" . 127.0.0.0/8 . "lo" : drop }
^^^^^^^^^^^^^^^^^^^^^^^^^
--- net/netfilter/nft_set_pipapo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_set_pipapo.c +2 -2
@@ -1303,8 +1303,8 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,else dup_end = dup_key; -if (!memcmp (start, dup_key->data,sizeof (*dup_key->data)) && - !memcmp (end, dup_end->data,sizeof (*dup_end->data))) { +if (!memcmp (start, dup_key->data, set->klen) && + !memcmp (end, dup_end->data, set->klen)) { *elem_priv = &dup->priv;return -EEXIST ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 59/119 netfilter: nft_synproxy: avoid possible data-race on update operation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 36a3200575642846a96436d503d46544533bb943 ]
During nft_synproxy eval we are reading nf_synproxy_info struct which can be modified on update operation concurrently. As nf_synproxy_info struct fits in 32 bits, use READ_ONCE/WRITE_ONCE annotations.
--- net/netfilter/nft_synproxy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nft_synproxy.c +3 -3
@@ -48,7 +48,7 @@ static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,struct tcphdr *_tcph, struct synproxy_options *opts) { - struct nf_synproxy_info info = priv->info; + struct nf_synproxy_info info = READ_ONCE(priv->info);struct net *net =nft_net (pkt);struct synproxy_net *snet =synproxy_pernet (net);struct sk_buff *skb = pkt->skb;
@@ -79,7 +79,7 @@ static void nft_synproxy_eval_v6(const struct nft_synproxy *priv,struct tcphdr *_tcph, struct synproxy_options *opts) { - struct nf_synproxy_info info = priv->info; + struct nf_synproxy_info info = READ_ONCE(priv->info);struct net *net =nft_net (pkt);struct synproxy_net *snet =synproxy_pernet (net);struct sk_buff *skb = pkt->skb;
@@ -340,7 +340,7 @@ static void nft_synproxy_obj_update(struct nft_object *obj,struct nft_synproxy *newpriv =nft_obj_data (newobj);struct nft_synproxy *priv =nft_obj_data (obj); - priv->info = newpriv->info; +WRITE_ONCE (priv->info, newpriv->info); }static struct nft_object_type nft_synproxy_obj_type;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 60/119 gpio: pca953x: Add support for level-triggered interrupts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Potin Lai <[email protected]>
[ Upstream commit 417b0f8d08f878615de9481c6e8827fbc8b57ed2 ]
Adds support for level-triggered interrupts in the PCA953x GPIO expander driver. Previously, the driver only supported edge-triggered interrupts, which could lead to missed events in scenarios where an interrupt condition persists until it is explicitly cleared.
By enabling level-triggered interrupts, the driver can now detect and respond to sustained interrupt conditions more reliably.
Stable-dep-of: 014a17deb412 ("gpio: pca953x: handle short interrupt pulses on PCAL devices")
--- drivers/gpio/gpio-pca953x.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-)
drivers/gpio/gpio-pca953x.c +27 -5
@@ -215,6 +215,8 @@ struct pca953x_chip {DECLARE_BITMAP (irq_stat,MAX_LINE );DECLARE_BITMAP (irq_trig_raise,MAX_LINE );DECLARE_BITMAP (irq_trig_fall,MAX_LINE ); +DECLARE_BITMAP (irq_trig_level_high,MAX_LINE ); +DECLARE_BITMAP (irq_trig_level_low,MAX_LINE );#endif atomic_t wakeup_path;
@@ -773,6 +775,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)pca953x_read_regs (chip, chip->regs->direction, reg_direction);bitmap_or (irq_mask, chip->irq_trig_fall, chip->irq_trig_raise, gc->ngpio); +bitmap_or (irq_mask, irq_mask, chip->irq_trig_level_high, gc->ngpio); +bitmap_or (irq_mask, irq_mask, chip->irq_trig_level_low, gc->ngpio);bitmap_complement (reg_direction, reg_direction, gc->ngpio);bitmap_and (irq_mask, irq_mask, reg_direction, gc->ngpio);
@@ -790,13 +794,15 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)struct device *dev = &chip->client->dev;irq_hw_number_t hwirq =irqd_to_hwirq (d); -if (!(type &IRQ_TYPE_EDGE_BOTH )) { +if (!(type &IRQ_TYPE_SENSE_MASK )) {dev_err (dev,"irq %d: unsupported type %d\n" , d->irq, type);return -EINVAL ; }assign_bit (hwirq, chip->irq_trig_fall, type &IRQ_TYPE_EDGE_FALLING );assign_bit (hwirq, chip->irq_trig_raise, type &IRQ_TYPE_EDGE_RISING ); +assign_bit (hwirq, chip->irq_trig_level_low, type &IRQ_TYPE_LEVEL_LOW ); +assign_bit (hwirq, chip->irq_trig_level_high, type &IRQ_TYPE_LEVEL_HIGH );return 0 ; }
@@ -809,6 +815,8 @@ static void pca953x_irq_shutdown(struct irq_data *d)clear_bit (hwirq, chip->irq_trig_raise);clear_bit (hwirq, chip->irq_trig_fall); +clear_bit (hwirq, chip->irq_trig_level_low); +clear_bit (hwirq, chip->irq_trig_level_high); }static void pca953x_irq_print_chip (struct irq_data *data,struct seq_file *p)
@@ -839,6 +847,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinDECLARE_BITMAP (cur_stat,MAX_LINE );DECLARE_BITMAP (new_stat,MAX_LINE );DECLARE_BITMAP (trigger,MAX_LINE ); +DECLARE_BITMAP (edges,MAX_LINE );int ret; ret =pca953x_read_regs (chip, chip->regs->input, cur_stat);
@@ -856,13 +865,26 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinbitmap_copy (chip->irq_stat, new_stat, gc->ngpio); -if (bitmap_empty (trigger, gc->ngpio)) -return false; +if (bitmap_empty (chip->irq_trig_level_high, gc->ngpio) && +bitmap_empty (chip->irq_trig_level_low, gc->ngpio)) { +if (bitmap_empty (trigger, gc->ngpio)) +return false; + }bitmap_and (cur_stat, chip->irq_trig_fall, old_stat, gc->ngpio);bitmap_and (old_stat, chip->irq_trig_raise, new_stat, gc->ngpio); -bitmap_or (new_stat, old_stat, cur_stat, gc->ngpio); -bitmap_and (pending, new_stat, trigger, gc->ngpio); +bitmap_or (edges, old_stat, cur_stat, gc->ngpio); +bitmap_and (pending, edges, trigger, gc->ngpio); + +bitmap_and (cur_stat, new_stat, chip->irq_trig_level_high, gc->ngpio); +bitmap_and (cur_stat, cur_stat, chip->irq_mask, gc->ngpio); +bitmap_or (pending, pending, cur_stat, gc->ngpio); + +bitmap_complement (cur_stat, new_stat, gc->ngpio); +bitmap_and (cur_stat, cur_stat, reg_direction, gc->ngpio); +bitmap_and (old_stat, cur_stat, chip->irq_trig_level_low, gc->ngpio); +bitmap_and (old_stat, old_stat, chip->irq_mask, gc->ngpio); +bitmap_or (pending, pending, old_stat, gc->ngpio);return !bitmap_empty (pending, gc->ngpio); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 61/119 gpio: pca953x: handle short interrupt pulses on PCAL devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ernest Van Hoecke <[email protected]>
[ Upstream commit 014a17deb41201449f76df2b20c857a9c3294a7c ]
GPIO drivers with latch input support may miss short pulses on input pins even when input latching is enabled. The generic interrupt logic in the pca953x driver reports interrupts by comparing the current input value against the previously sampled one and only signals an event when a level change is observed between two reads.
For short pulses, the first edge is captured when the input register is read, but if the signal returns to its previous level before the read, the second edge is not observed. As a result, successive pulses can produce identical input values at read time and no level change is detected, causing interrupts to be missed. Below timing diagram shows this situation where the top signal is the input pin level and the bottom signal indicates the latched value.
─────┐ ┌──*───────────────┐ ┌──*─────────────────┐ ┌──*───
│ │ . │ │ . │ │ .
│ │ │ │ │ │ │ │ │
└──*──┘ │ └──*──┘ │ └──*──┘ │
Input │ │ │ │ │ │
▼ │ ▼ │ ▼ │
IRQ │ IRQ │ IRQ │
. . .
─────┐ .┌──────────────┐ .┌────────────────┐ .┌──
│ │ │ │ │ │
│ │ │ │ │ │
└────────*┘ └────────*┘ └────────*┘
Latched │ │ │
▼ ▼ ▼
READ 0 READ 0 READ 0
NO CHANGE NO CHANGEPCAL variants provide an interrupt status register that records which pins triggered an interrupt, but the status and input registers cannot be read atomically. The interrupt status is only cleared when the input port is read, and the input value must also be read to determine the triggering edge. If another interrupt occurs on a different line after the status register has been read but before the input register is sampled, that event will not be reflected in the earlier status snapshot, so relying solely on the interrupt status register is also insufficient.
Support for input latching and interrupt status handling was previously added by [1], but the interrupt status-based logic was reverted by [2] due to these issues. This patch addresses the original problem by combining both sources of information. Events indicated by the interrupt status register are merged with events detected through the existing level-change logic. As a result:
* short pulses, whose second edges are invisible, are detected via the interrupt status register, and
* interrupts that occur between the status and input reads are still caught by the generic level-change logic.
This significantly improves robustness on devices that signal interrupts as short pulses, while avoiding the issues that led to the earlier reversion. In practice, even if only the first edge of a pulse is observable, the interrupt is reliably detected.
This fixes missed interrupts from an Ilitek touch controller with its interrupt line connected to a PCAL6416A, where active-low pulses are approximately 200 us long.
[1] commit 44896beae605 ("gpio: pca953x: add PCAL9535 interrupt support for Galileo Gen2")
[2] commit d6179f6c6204 ("gpio: pca953x: Improve interrupt support")
--- drivers/gpio/gpio-pca953x.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pca953x.c +24 -1
@@ -846,14 +846,35 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinDECLARE_BITMAP (old_stat,MAX_LINE );DECLARE_BITMAP (cur_stat,MAX_LINE );DECLARE_BITMAP (new_stat,MAX_LINE ); +DECLARE_BITMAP (int_stat,MAX_LINE );DECLARE_BITMAP (trigger,MAX_LINE );DECLARE_BITMAP (edges,MAX_LINE );int ret; +if (chip->driver_data &PCA_PCAL ) { +/* Read INT_STAT before it is cleared by the input-port read. */ + ret =pca953x_read_regs (chip,PCAL953X_INT_STAT , int_stat); +if (ret) +return false; + } + ret =pca953x_read_regs (chip, chip->regs->input, cur_stat);if (ret)return false; +if (chip->driver_data &PCA_PCAL ) { +/* Detect short pulses via INT_STAT. */ +bitmap_and (trigger, int_stat, chip->irq_mask, gc->ngpio); + +/* Apply filter for rising/falling edge selection. */ +bitmap_replace (new_stat, chip->irq_trig_fall, chip->irq_trig_raise, + cur_stat, gc->ngpio); + +bitmap_and (int_stat, new_stat, trigger, gc->ngpio); + }else { +bitmap_zero (int_stat, gc->ngpio); + } +/* Remove output pins from the equation */ pca953x_read_regs (chip, chip->regs->direction, reg_direction);
@@ -867,7 +888,8 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinif (bitmap_empty (chip->irq_trig_level_high, gc->ngpio) &&bitmap_empty (chip->irq_trig_level_low, gc->ngpio)) { -if (bitmap_empty (trigger, gc->ngpio)) +if (bitmap_empty (trigger, gc->ngpio) && +bitmap_empty (int_stat, gc->ngpio))return false; }
@@ -875,6 +897,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinbitmap_and (old_stat, chip->irq_trig_raise, new_stat, gc->ngpio);bitmap_or (edges, old_stat, cur_stat, gc->ngpio);bitmap_and (pending, edges, trigger, gc->ngpio); +bitmap_or (pending, pending, int_stat, gc->ngpio);bitmap_and (cur_stat, new_stat, chip->irq_trig_level_high, gc->ngpio);bitmap_and (cur_stat, cur_stat, chip->irq_mask, gc->ngpio);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 62/119 netfilter: nf_tables: fix memory leak in nf_tables_newrule()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan <[email protected]>
[ Upstream commit d077e8119ddbb4fca67540f1a52453631a47f221 ]
In nf_tables_newrule(), if nft_use_inc() fails, the function jumps to the err_release_rule label without freeing the allocated flow, leading to a memory leak.
Fix this by adding a new label err_destroy_flow and jumping to it when nft_use_inc() fails. This ensures that the flow is properly released in this error case.
--- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +2 -1
@@ -4196,7 +4196,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,if (!nft_use_inc (&chain->use)) { err = -EMFILE ; - goto err_release_rule; + goto err_destroy_flow; }if (info->nlh->nlmsg_flags &NLM_F_REPLACE ) {
@@ -4246,6 +4246,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, err_destroy_flow_rule:nft_use_dec_restore (&chain->use); +err_destroy_flow:if (flow)nft_flow_rule_destroy (flow); err_release_rule:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 63/119 netfilter: nf_conncount: update last_gc only when GC has been performed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 7811ba452402d58628e68faedf38745b3d485e3c ]
Currently last_gc is being updated everytime a new connection is tracked, that means that it is updated even if a GC wasn't performed. With a sufficiently high packet rate, it is possible to always bypass the GC, causing the list to grow infinitely.
Update the last_gc value only when a GC has been actually performed.
--- net/netfilter/nf_conncount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conncount.c +1 -1
@@ -229,6 +229,7 @@ static int __nf_conncount_add(struct net *net,nf_ct_put (found_ct); } + list->last_gc = (u32 )jiffies; add_new_node:if (WARN_ON_ONCE (list->count >INT_MAX )) {
@@ -248,7 +249,6 @@ static int __nf_conncount_add(struct net *net, conn->jiffies32 = (u32 )jiffies;list_add_tail (&conn->node, &list->head); list->count++; - list->last_gc = (u32 )jiffies; out_put:if (refcounted)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 64/119 net: marvell: prestera: fix NULL dereference on devlink_alloc() failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit a428e0da1248c353557970848994f35fd3f005e2 ]
devlink_alloc() may return NULL on allocation failure, but prestera_devlink_alloc() unconditionally calls devlink_priv() on the returned pointer.
This leads to a NULL pointer dereference if devlink allocation fails. Add a check for a NULL devlink pointer and return NULL early to avoid the crash.
--- drivers/net/ethernet/marvell/prestera/prestera_devlink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/prestera/prestera_devlink.c +2 -0
@@ -387,6 +387,8 @@ struct prestera_switch *prestera_devlink_alloc(struct prestera_device *dev) dl =devlink_alloc (&prestera_dl_ops,sizeof (struct prestera_switch ), dev->dev); +if (!dl) +return NULL ;return devlink_priv (dl); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 65/119 bridge: fix C-VLAN preservation in 802.1ad vlan_tunnel egress
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Knecht <[email protected]>
[ Upstream commit 3128df6be147768fe536986fbb85db1d37806a9f ]
When using an 802.1ad bridge with vlan_tunnel, the C-VLAN tag is incorrectly stripped from frames during egress processing.
br_handle_egress_vlan_tunnel() uses skb_vlan_pop() to remove the S-VLAN from hwaccel before VXLAN encapsulation. However, skb_vlan_pop() also moves any "next" VLAN from the payload into hwaccel:
/* move next vlan tag to hw accel tag */
__skb_vlan_pop(skb, &vlan_tci);
__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);For QinQ frames where the C-VLAN sits in the payload, this moves it to hwaccel where it gets lost during VXLAN encapsulation.
Fix by calling __vlan_hwaccel_clear_tag() directly, which clears only the hwaccel S-VLAN and leaves the payload untouched.
This path is only taken when vlan_tunnel is enabled and tunnel_info is configured, so 802.1Q bridges are unaffected.
Tested with 802.1ad bridge + VXLAN vlan_tunnel, verified C-VLAN preserved in VXLAN payload via tcpdump.
--- net/bridge/br_vlan_tunnel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/bridge/br_vlan_tunnel.c +7 -4
@@ -189,7 +189,6 @@ int br_handle_egress_vlan_tunnel(struct sk_buff *skb,IP_TUNNEL_DECLARE_FLAGS (flags) = { };struct metadata_dst *tunnel_dst;__be64 tunnel_id; -int err;if (!vlan)return 0 ;
@@ -199,9 +198,13 @@ int br_handle_egress_vlan_tunnel(struct sk_buff *skb,return 0 ;skb_dst_drop (skb); - err =skb_vlan_pop (skb); -if (err) -return err; +/* For 802.1ad (QinQ), skb_vlan_pop() incorrectly moves the C-VLAN +* from payload to hwaccel after clearing S-VLAN. We only need to +* clear the hwaccel S-VLAN; the C-VLAN must stay in payload for +* correct VXLAN encapsulation. This is also correct for 802.1Q +* where no C-VLAN exists in payload. +*/ +__vlan_hwaccel_clear_tag (skb);if (BR_INPUT_SKB_CB (skb)->backup_nhid) {__set_bit (IP_TUNNEL_KEY_BIT , flags);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 66/119 net: mscc: ocelot: Fix crash when adding interface under a lag
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerry Wu <[email protected]>
[ Upstream commit 34f3ff52cb9fa7dbf04f5c734fcc4cb6ed5d1a95 ]
Commit 15faa1f67ab4 ("lan966x: Fix crash when adding interface under a lag") fixed a similar issue in the lan966x driver caused by a NULL pointer dereference. The ocelot_set_aggr_pgids() function in the ocelot driver has similar logic and is susceptible to the same crash.
This issue specifically affects the ocelot_vsc7514.c frontend, which leaves unused ports as NULL pointers. The felix_vsc9959.c frontend is unaffected as it uses the DSA framework which registers all ports.
Fix this by checking if the port pointer is valid before accessing it.
--- drivers/net/ethernet/mscc/ocelot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +4 -2
@@ -2307,14 +2307,16 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)/* Now, set PGIDs for each active LAG */ for (lag =0 ; lag < ocelot->num_phys_ports; lag++) { -struct net_device *bond = ocelot->ports[lag]->bond; +struct ocelot_port *ocelot_port = ocelot->ports[lag];int num_active_ports =0 ; +struct net_device *bond;unsigned long bond_mask;u8 aggr_idx[16 ]; -if (!bond || (visited &BIT (lag))) +if (!ocelot_port || !ocelot_port->bond || (visited &BIT (lag)))continue ; + bond = ocelot_port->bond; bond_mask =ocelot_get_bond_mask (ocelot, bond);for_each_set_bit (port, &bond_mask, ocelot->num_phys_ports) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 67/119 inet: ping: Fix icmp out counting
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: yuan.gao <[email protected]>
[ Upstream commit 4c0856c225b39b1def6c9a6bc56faca79550da13 ]
When the ping program uses an IPPROTO_ICMP socket to send ICMP_ECHO messages, ICMP_MIB_OUTMSGS is counted twice.
ping_v4_sendmsg
ping_v4_push_pending_frames
ip_push_pending_frames
ip_finish_skb
__ip_make_skb
icmp_out_count(net, icmp_type); // first count
icmp_out_count(sock_net(sk), user_icmph.type); // second count
However, when the ping program uses an IPPROTO_RAW socket, ICMP_MIB_OUTMSGS is counted correctly only once.
Therefore, the first count should be removed.
--- net/ipv4/ping.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv4/ping.c +1 -3
@@ -839,10 +839,8 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) out_free:if (free)kfree (ipc.opt); -if (!err) { -icmp_out_count (sock_net (sk), user_icmph.type); +if (!err)return len; - }return err; do_confirm:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 68/119 net: sock: fix hardened usercopy panic in sock_recv_errqueue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 2a71a1a8d0ed718b1c7a9ac61f07e5755c47ae20 ]
skbuff_fclone_cache was created without defining a usercopy region,
[1] unlike skbuff_head_cache which properly whitelists the cb[] field.
[2] This causes a usercopy BUG() when CONFIG_HARDENED_USERCOPY is enabled and the kernel attempts to copy sk_buff.cb data to userspace via sock_recv_errqueue() -> put_cmsg().
The crash occurs when: 1. TCP allocates an skb using alloc_skb_fclone()
(from skbuff_fclone_cache) [1]
2. The skb is cloned via skb_clone() using the pre-allocated fclone
[3] 3. The cloned skb is queued to sk_error_queue for timestamp reporting 4. Userspace reads the error queue via recvmsg(MSG_ERRQUEUE)
5. sock_recv_errqueue() calls put_cmsg() to copy serr->ee from skb->cb
[4] 6. __check_heap_object() fails because skbuff_fclone_cache has no usercopy whitelist [5]
When cloned skbs allocated from skbuff_fclone_cache are used in the socket error queue, accessing the sock_exterr_skb structure in skb->cb via put_cmsg() triggers a usercopy hardening violation:
[ 5.379589] usercopy: Kernel memory exposure attempt detected from SLUB object 'skbuff_fclone_cache' (offset 296, size 16)! [ 5.382796] kernel BUG at mm/usercopy.c:102! [ 5.383923] Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI [ 5.384903] CPU: 1 UID: 0 PID: 138 Comm: poc_put_cmsg Not tainted 6.12.57 #7 [ 5.384903] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [ 5.384903] RIP: 0010:usercopy_abort+0x6c/0x80 [ 5.384903] Code: 1a 86 51 48 c7 c2 40 15 1a 86 41 52 48 c7 c7 c0 15 1a 86 48 0f 45 d6 48 c7 c6 80 15 1a 86 48 89 c1 49 0f 45 f3 e8 84 27 88 ff <0f> 0b 490 [ 5.384903] RSP: 0018:ffffc900006f77a8 EFLAGS: 00010246 [ 5.384903] RAX: 000000000000006f RBX: ffff88800f0ad2a8 RCX: 1ffffffff0f72e74 [ 5.384903] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff87b973a0 [ 5.384903] RBP: 0000000000000010 R08: 0000000000000000 R09: fffffbfff0f72e74 [ 5.384903] R10: 0000000000000003 R11: 79706f6372657375 R12: 0000000000000001 [ 5.384903] R13: ffff88800f0ad2b8 R14: ffffea00003c2b40 R15: ffffea00003c2b00 [ 5.384903] FS: 0000000011bc4380(0000) GS:ffff8880bf100000(0000) knlGS:0000000000000000 [ 5.384903] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5.384903] CR2: 000056aa3b8e5fe4 CR3: 000000000ea26004 CR4: 0000000000770ef0 [ 5.384903] PKRU: 55555554 [ 5.384903] Call Trace: [ 5.384903] <TASK> [ 5.384903] __check_heap_object+0x9a/0xd0 [ 5.384903] __check_object_size+0x46c/0x690 [ 5.384903] put_cmsg+0x129/0x5e0 [ 5.384903] sock_recv_errqueue+0x22f/0x380 [ 5.384903] tls_sw_recvmsg+0x7ed/0x1960 [ 5.384903] ? srso_alias_return_thunk+0x5/0xfbef5 [ 5.384903] ? schedule+0x6d/0x270 [ 5.384903] ? srso_alias_return_thunk+0x5/0xfbef5 [ 5.384903] ? mutex_unlock+0x81/0xd0 [ 5.384903] ? __pfx_mutex_unlock+0x10/0x10 [ 5.384903] ? __pfx_tls_sw_recvmsg+0x10/0x10 [ 5.384903] ? _raw_spin_lock_irqsave+0x8f/0xf0 [ 5.384903] ? _raw_read_unlock_irqrestore+0x20/0x40 [ 5.384903] ? srso_alias_return_thunk+0x5/0xfbef5
The crash offset 296 corresponds to skb2->cb within skbuff_fclones:
- sizeof(struct sk_buff) = 232 - offsetof(struct sk_buff, cb) = 40 - offset of skb2.cb in fclones = 232 + 40 = 272 - crash offset 296 = 272 + 24 (inside sock_exterr_skb.ee)
This patch uses a local stack variable as a bounce buffer to avoid the hardened usercopy check failure.
[1] https://elixir.bootlin.com/linux/v6.12.62/source/net/ipv4/tcp.c#L885
[2] https://elixir.bootlin.com/linux/v6.12.62/source/net/core/skbuff.c#L5104
[3] https://elixir.bootlin.com/linux/v6.12.62/source/net/core/skbuff.c#L5566
[4] https://elixir.bootlin.com/linux/v6.12.62/source/net/core/skbuff.c#L5491
[5] https://elixir.bootlin.com/linux/v6.12.62/source/mm/slub.c#L5719
--- net/core/sock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/core/sock.c +4 -3
@@ -3769,7 +3769,7 @@ void sock_enable_timestamp(struct sock *sk, enum sock_flags flag)int sock_recv_errqueue (struct sock *sk,struct msghdr *msg,int len,int level,int type) { -struct sock_exterr_skb *serr; +struct sock_extended_err ee;struct sk_buff *skb;int copied, err;
@@ -3789,8 +3789,9 @@ int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len,sock_recv_timestamp (msg, sk, skb); - serr =SKB_EXT_ERR (skb); -put_cmsg (msg, level, type,sizeof (serr->ee), &serr->ee); +/* We must use a bounce buffer for CONFIG_HARDENED_USERCOPY=y */ + ee =SKB_EXT_ERR (skb)->ee; +put_cmsg (msg, level, type,sizeof (ee), &ee); msg->msg_flags |=MSG_ERRQUEUE ; err = copied;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 69/119 netdev: preserve NETIF_F_ALL_FOR_ALL across TSO updates
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Di Zhu <[email protected]>
[ Upstream commit 02d1e1a3f9239cdb3ecf2c6d365fb959d1bf39df ]
Directly increment the TSO features incurs a side effect: it will also directly clear the flags in NETIF_F_ALL_FOR_ALL on the master device, which can cause issues such as the inability to enable the nocache copy feature on the bonding driver.
The fix is to include NETIF_F_ALL_FOR_ALL in the update mask, thereby preventing it from being cleared.
--- include/linux/netdevice.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/netdevice.h +2 -1
@@ -4986,7 +4986,8 @@ netdev_features_t netdev_increment_features(netdev_features_t all,static inline netdev_features_t netdev_add_tso_features (netdev_features_t features,netdev_features_t mask) { -return netdev_increment_features (features,NETIF_F_ALL_TSO , mask); +return netdev_increment_features (features,NETIF_F_ALL_TSO | +NETIF_F_ALL_FOR_ALL , mask); }int __netdev_update_features (struct net_device *dev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 70/119 net/mlx5e: Dont print error message due to invalid module
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 144297e2a24e3e54aee1180ec21120ea38822b97 ]
Dumping module EEPROM on newer modules is supported through the netlink interface only.
Querying with old userspace ethtool (or other tools, such as 'lshw') which still uses the ioctl interface results in an error message that could flood dmesg (in addition to the expected error return value). The original message was added under the assumption that the driver should be able to handle all module types, but now that such flows are easily triggered from userspace, it doesn't serve its purpose.
Change the log level of the print in mlx5_query_module_eeprom() to debug.
--- drivers/net/ethernet/mellanox/mlx5/core/port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/port.c +2 -1
@@ -430,7 +430,8 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev,mlx5_qsfp_eeprom_params_set (&query.i2c_address, &query.page, &offset);break ;default : -mlx5_core_err (dev,"Module ID not recognized: 0x%x\n" , module_id); +mlx5_core_dbg (dev,"Module ID not recognized: 0x%x\n" , + module_id);return -EINVAL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 71/119 net: wwan: iosm: Fix memory leak in ipc_mux_deinit()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan <[email protected]>
[ Upstream commit 92e6e0a87f6860a4710f9494f8c704d498ae60f8 ]
Commit 1f52d7b62285 ("net: wwan: iosm: Enable M.2 7360 WWAN card support") allocated memory for pp_qlt in ipc_mux_init() but did not free it in ipc_mux_deinit(). This results in a memory leak when the driver is unloaded.
Free the allocated memory in ipc_mux_deinit() to fix the leak.
--- drivers/net/wwan/iosm/iosm_ipc_mux.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wwan/iosm/iosm_ipc_mux.c +6 -0
@@ -456,6 +456,7 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux)struct sk_buff_head *free_list;union mux_msg mux_msg;struct sk_buff *skb; +int i;if (!ipc_mux->initialized)return ;
@@ -479,5 +480,10 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux) ipc_mux->channel->dl_pipe.is_open = false; } +if (ipc_mux->protocol !=MUX_LITE ) { +for (i =0 ; i <IPC_MEM_MUX_IP_SESSION_ENTRIES ; i++) +kfree (ipc_mux->ul_adb.pp_qlt[i]); + } +kfree (ipc_mux); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 72/119 bnxt_en: Fix potential data corruption with HW GRO/LRO
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srijit Bose <[email protected]>
[ Upstream commit ffeafa65b2b26df2f5b5a6118d3174f17bd12ec5 ]
Fix the max number of bits passed to find_first_zero_bit() in bnxt_alloc_agg_idx(). We were incorrectly passing the number of long words. find_first_zero_bit() may fail to find a zero bit and cause a wrong ID to be used. If the wrong ID is already in use, this can cause data corruption. Sometimes an error like this can also be seen:
bnxt_en 0000:83:00.0 enp131s0np0: TPA end agg_buf 2 != expected agg_bufs 1
Fix it by passing the correct number of bits MAX_TPA_P5. Use DECLARE_BITMAP() to more cleanly define the bitmap. Add a sanity check to warn if a bit cannot be found and reset the ring [MChan].
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 ++++++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +--- 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -3
@@ -1412,9 +1412,11 @@ static u16 bnxt_alloc_agg_idx(struct bnxt_rx_ring_info *rxr, u16 agg_id)struct bnxt_tpa_idx_map *map = rxr->rx_tpa_idx_map;u16 idx = agg_id &MAX_TPA_P5_MASK ; -if (test_bit (idx, map->agg_idx_bmap)) - idx =find_first_zero_bit (map->agg_idx_bmap, -BNXT_AGG_IDX_BMAP_SIZE ); +if (test_bit (idx, map->agg_idx_bmap)) { + idx =find_first_zero_bit (map->agg_idx_bmap,MAX_TPA_P5 ); +if (idx >=MAX_TPA_P5 ) +return INVALID_HW_RING_ID ; + }__set_bit (idx, map->agg_idx_bmap); map->agg_id_tbl[agg_id] = idx;return idx;
@@ -1478,6 +1480,13 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,if (bp->flags &BNXT_FLAG_CHIP_P5_PLUS ) { agg_id =TPA_START_AGG_ID_P5 (tpa_start); agg_id =bnxt_alloc_agg_idx (rxr, agg_id); +if (unlikely (agg_id ==INVALID_HW_RING_ID )) { +netdev_warn (bp->dev,"Unable to allocate agg ID for ring %d, agg 0x%x\n" , + rxr->bnapi->index, +TPA_START_AGG_ID_P5 (tpa_start)); +bnxt_sched_reset_rxr (bp, rxr); +return ; + } }else { agg_id =TPA_START_AGG_ID (tpa_start); }
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -3
@@ -1070,11 +1070,9 @@ struct bnxt_tpa_info {struct rx_agg_cmp *agg_arr; }; -#define BNXT_AGG_IDX_BMAP_SIZE (MAX_TPA_P5 / BITS_PER_LONG) -struct bnxt_tpa_idx_map {u16 agg_id_tbl[1024 ]; -unsigned long agg_idx_bmap[BNXT_AGG_IDX_BMAP_SIZE ]; + DECLARE_BITMAP(agg_idx_bmap, MAX_TPA_P5); };struct bnxt_rx_ring_info {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 73/119 vsock: Make accept()ed sockets use custom setsockopt()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit ce5e612dd411de096aa041b9e9325ba1bec5f9f4 ]
SO_ZEROCOPY handling in vsock_connectible_setsockopt() does not get called on accept()ed sockets due to a missing flag. Flip it.
--- net/vmw_vsock/af_vsock.c | 4 ++++ 1 file changed, 4 insertions(+)
net/vmw_vsock/af_vsock.c +4 -0
@@ -1742,6 +1742,10 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, }else { newsock->state =SS_CONNECTED ;sock_graft (connected, newsock); + +set_bit (SOCK_CUSTOM_SOCKOPT , + &connected->sk_socket->flags); +if (vsock_msgzerocopy_allow (vconnected->transport))set_bit (SOCK_SUPPORT_ZC , &connected->sk_socket->flags);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 74/119 btrfs: only enforce free space tree if v1 cache is required for bs < ps cases
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 30bcf4e824aa37d305502f52e1527c7b1eabef3d ]
[BUG]
Since the introduction of btrfs bs < ps support, v1 cache was never on the plan due to its hard coded PAGE_SIZE usage, and the future plan to properly deprecate it.
However for bs < ps cases, even if 'nospace_cache,clear_cache' mount option is specified, it's never respected and free space tree is always enabled:
mkfs.btrfs -f -O ^bgt,fst $dev
mount $dev $mnt -o clear_cache,nospace_cache
umount $mnt
btrfs ins dump-super $dev
...
compat_ro_flags 0x3
( FREE_SPACE_TREE |
FREE_SPACE_TREE_VALID )
...
This means a different behavior compared to bs >= ps cases.
[CAUSE]
The forcing usage of v2 space cache is done inside btrfs_set_free_space_cache_settings(), however it never checks if we're even using space cache but always enabling v2 cache.
[FIX]
Instead unconditionally enable v2 cache, only forcing v2 cache if the old v1 cache is required.
Now v2 space cache can be properly disabled on bs < ps cases:
mkfs.btrfs -f -O ^bgt,fst $dev
mount $dev $mnt -o clear_cache,nospace_cache
umount $mnt
btrfs ins dump-super $dev
...
compat_ro_flags 0x0
...
--- fs/btrfs/super.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/btrfs/super.c +5 -7
@@ -722,14 +722,12 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,*/ void btrfs_set_free_space_cache_settings (struct btrfs_fs_info *fs_info) { -if (fs_info->sectorsize <PAGE_SIZE ) { +if (fs_info->sectorsize <PAGE_SIZE &&btrfs_test_opt (fs_info,SPACE_CACHE )) { +btrfs_info (fs_info, +"forcing free space tree for sector size %u with page size %lu" , + fs_info->sectorsize,PAGE_SIZE );btrfs_clear_opt (fs_info->mount_opt,SPACE_CACHE ); -if (!btrfs_test_opt (fs_info,FREE_SPACE_TREE )) { -btrfs_info (fs_info, -"forcing free space tree for sector size %u with page size %lu" , - fs_info->sectorsize,PAGE_SIZE ); -btrfs_set_opt (fs_info->mount_opt,FREE_SPACE_TREE ); - } +btrfs_set_opt (fs_info->mount_opt,FREE_SPACE_TREE ); }/*
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 75/119 riscv: pgtable: Cleanup useless VA_USER_XXX definitions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Ren (Alibaba DAMO Academy) <[email protected]>
[ Upstream commit 5e5be092ffadcab0093464ccd9e30f0c5cce16b9 ]
These marcos are not used after commit b5b4287accd7 ("riscv: mm: Use hint address in mmap if available"). Cleanup VA_USER_XXX definitions in asm/pgtable.h.
--- arch/riscv/include/asm/pgtable.h | 4 ---- 1 file changed, 4 deletions(-)
arch/riscv/include/asm/pgtable.h +0 -4
@@ -119,10 +119,6 @@#ifdef CONFIG_64BIT #include <asm/pgtable-64.h> -#define VA_USER_SV39 (UL(1) << (VA_BITS_SV39 - 1)) -#define VA_USER_SV48 (UL(1) << (VA_BITS_SV48 - 1)) -#define VA_USER_SV57 (UL(1) << (VA_BITS_SV57 - 1)) -#define MMAP_VA_BITS_64 ((VA_BITS >= VA_BITS_SV48) ? VA_BITS_SV48 : VA_BITS)#define MMAP_MIN_VA_BITS_64 (VA_BITS_SV39)#define MMAP_VA_BITS (is_compat_task() ? VA_BITS_SV32 : MMAP_VA_BITS_64)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 76/119 net: fix memory leak in skb_segment_list for GRO packets
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohammad Heib <[email protected]>
[ Upstream commit 238e03d0466239410b72294b79494e43d4fabe77 ]
When skb_segment_list() is called during packet forwarding, it handles packets that were aggregated by the GRO engine.
Historically, the segmentation logic in skb_segment_list assumes that individual segments are split from a parent SKB and may need to carry their own socket memory accounting. Accordingly, the code transfers truesize from the parent to the newly created segments.
Prior to commit ed4cccef64c1 ("gro: fix ownership transfer"), this truesize subtraction in skb_segment_list() was valid because fragments still carry a reference to the original socket.
However, commit ed4cccef64c1 ("gro: fix ownership transfer") changed this behavior by ensuring that fraglist entries are explicitly orphaned (skb->sk = NULL) to prevent illegal orphaning later in the stack. This change meant that the entire socket memory charge remained with the head SKB, but the corresponding accounting logic in skb_segment_list() was never updated.
As a result, the current code unconditionally adds each fragment's truesize to delta_truesize and subtracts it from the parent SKB. Since the fragments are no longer charged to the socket, this subtraction results in an effective under-count of memory when the head is freed. This causes sk_wmem_alloc to remain non-zero, preventing socket destruction and leading to a persistent memory leak.
The leak can be observed via KMEMLEAK when tearing down the networking environment:
unreferenced object 0xffff8881e6eb9100 (size 2048):
comm "ping", pid 6720, jiffies 4295492526 backtrace:
kmem_cache_alloc_noprof+0x5c6/0x800
sk_prot_alloc+0x5b/0x220
sk_alloc+0x35/0xa00
inet6_create.part.0+0x303/0x10d0
__sock_create+0x248/0x640
__sys_socket+0x11b/0x1d0Since skb_segment_list() is exclusively used for SKB_GSO_FRAGLIST packets constructed by GRO, the truesize adjustment is removed.
The call to skb_release_head_state() must be preserved. As documented in commit cf673ed0e057 ("net: fix fraglist segmentation reference count leak"), it is still required to correctly drop references to SKB extensions that may be overwritten during __copy_skb_header().
--- net/core/skbuff.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/core/skbuff.c +5 -3
@@ -4585,12 +4585,14 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, {struct sk_buff *list_skb =skb_shinfo (skb)->frag_list;unsigned int tnl_hlen =skb_tnl_header_len (skb); -unsigned int delta_truesize =0 ;unsigned int delta_len =0 ;struct sk_buff *tail =NULL ;struct sk_buff *nskb, *tmp;int len_diff, err; +/* Only skb_gro_receive_list generated skbs arrive here */ +DEBUG_NET_WARN_ON_ONCE (!(skb_shinfo (skb)->gso_type &SKB_GSO_FRAGLIST )); +skb_push (skb, -skb_network_offset (skb) + offset);/* Ensure the head is writeable before touching the shared info */
@@ -4604,8 +4606,9 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, nskb = list_skb; list_skb = list_skb->next; +DEBUG_NET_WARN_ON_ONCE (nskb->sk); + err =0 ; - delta_truesize += nskb->truesize;if (skb_shared (nskb)) { tmp =skb_clone (nskb,GFP_ATOMIC );if (tmp) {
@@ -4648,7 +4651,6 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, goto err_linearize; } - skb->truesize = skb->truesize - delta_truesize; skb->data_len = skb->data_len - delta_len; skb->len = skb->len - delta_len;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 77/119 idpf: keep the netdev when a reset fails
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit 083029bd8b445595222a3cd14076b880781c1765 ]
During a successful reset the driver would re-allocate vport resources while keeping the netdevs intact. However, in case of an error in the init task, the netdev of the failing vport will be unregistered, effectively removing the network interface:
[ 121.211076] idpf 0000:83:00.0: enabling device (0100 -> 0102) [ 121.221976] idpf 0000:83:00.0: Device HW Reset initiated [ 124.161229] idpf 0000:83:00.0 ens801f0: renamed from eth0 [ 124.163364] idpf 0000:83:00.0 ens801f0d1: renamed from eth1 [ 125.934656] idpf 0000:83:00.0 ens801f0d2: renamed from eth2 [ 128.218429] idpf 0000:83:00.0 ens801f0d3: renamed from eth3
ip -br a
ens801f0 UP ens801f0d1 UP ens801f0d2 UP ens801f0d3 UP
echo 1 > /sys/class/net/ens801f0/device/reset
[ 145.885537] idpf 0000:83:00.0: resetting [ 145.990280] idpf 0000:83:00.0: reset done [ 146.284766] idpf 0000:83:00.0: HW reset detected [ 146.296610] idpf 0000:83:00.0: Device HW Reset initiated [ 211.556719] idpf 0000:83:00.0: Transaction timed-out (op:526 cookie:7700 vc_op:526 salt:77 timeout:60000ms) [ 272.996705] idpf 0000:83:00.0: Transaction timed-out (op:502 cookie:7800 vc_op:502 salt:78 timeout:60000ms)
ip -br a
ens801f0d1 DOWN ens801f0d2 DOWN ens801f0d3 DOWN
Re-shuffle the logic in the error path of the init task to make sure the netdevs remain intact. This will allow the driver to attempt recovery via subsequent resets, provided the FW is still functional.
The main change is to make sure that idpf_decfg_netdev() is not called should the init task fail during a reset. The error handling is consolidated under unwind_vports, as the removed labels had the same cleanup logic split depending on the point of failure.
--- drivers/net/ethernet/intel/idpf/idpf_lib.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_lib.c +6 -11
@@ -1500,6 +1500,10 @@ void idpf_init_task(struct work_struct *work) goto unwind_vports; } + err =idpf_send_get_rx_ptype_msg (vport); +if (err) + goto unwind_vports; + index = vport->idx; vport_config = adapter->vport_config[index];
@@ -1512,15 +1516,11 @@ void idpf_init_task(struct work_struct *work) err =idpf_check_supported_desc_ids (vport);if (err) {dev_err (&pdev->dev,"failed to get required descriptor ids\n" ); - goto cfg_netdev_err; + goto unwind_vports; }if (idpf_cfg_netdev (vport)) - goto cfg_netdev_err; - - err =idpf_send_get_rx_ptype_msg (vport); -if (err) - goto handle_err; + goto unwind_vports;/* Once state is put into DOWN, driver is ready for dev_open */ np =netdev_priv (vport->netdev);
@@ -1558,11 +1558,6 @@ void idpf_init_task(struct work_struct *work)return ; -handle_err: -idpf_decfg_netdev (vport); -cfg_netdev_err: -idpf_vport_rel (vport); - adapter->vports[index] =NULL ; unwind_vports:if (default_vport) {for (index =0 ; index < adapter->max_vports; index++) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 78/119 idpf: fix memory leak in idpf_vport_rel()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit f6242b354605faff263ca45882b148200915a3f6 ]
Free vport->rx_ptype_lkup in idpf_vport_rel() to avoid leaking memory during a reset. Reported by kmemleak:
unreferenced object 0xff450acac838a000 (size 4096):
comm "kworker/u258:5", pid 7732, jiffies 4296830044 hex dump (first 32 bytes):
00 00 00 00 00 10 00 00 00 10 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 ................
backtrace (crc 3da81902):
__kmalloc_cache_noprof+0x469/0x7a0
idpf_send_get_rx_ptype_msg+0x90/0x570 [idpf]
idpf_init_task+0x1ec/0x8d0 [idpf]
process_one_work+0x226/0x6d0
worker_thread+0x19e/0x340
kthread+0x10f/0x250
ret_from_fork+0x251/0x2b0
ret_from_fork_asm+0x1a/0x30--- drivers/net/ethernet/intel/idpf/idpf_lib.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/idpf/idpf_lib.c +2 -0
@@ -968,6 +968,8 @@ static void idpf_vport_rel(struct idpf_vport *vport)kfree (adapter->vport_config[idx]->req_qs_chunks); adapter->vport_config[idx]->req_qs_chunks =NULL ; } +kfree (vport->rx_ptype_lkup); + vport->rx_ptype_lkup =NULL ;kfree (vport); adapter->num_alloc_vports--; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 79/119 idpf: cap maximum Rx buffer size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Hay <[email protected]>
[ Upstream commit 086efe0a1ecc36cffe46640ce12649a4cd3ff171 ]
The HW only supports a maximum Rx buffer size of 16K-128. On systems using large pages, the libeth logic can configure the buffer size to be larger than this. The upper bound is PAGE_SIZE while the lower bound is MTU rounded up to the nearest power of 2. For example, ARM systems with a 64K page size and an mtu of 9000 will set the Rx buffer size to 16K, which will cause the config Rx queues message to fail.
Initialize the bufq/fill queue buf_len field to the maximum supported size. This will trigger the libeth logic to cap the maximum Rx buffer size by reducing the upper bound.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 +++++--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +5 -3
@@ -655,9 +655,10 @@ static int idpf_rx_buf_alloc_singleq(struct idpf_rx_queue *rxq)static int idpf_rx_bufs_init_singleq (struct idpf_rx_queue *rxq) {struct libeth_fq fq = { - .count = rxq->desc_count, - .type =LIBETH_FQE_MTU , - .nid =idpf_q_vector_to_mem (rxq->q_vector), + .count = rxq->desc_count, + .type =LIBETH_FQE_MTU , + .buf_len =IDPF_RX_MAX_BUF_SZ , + .nid =idpf_q_vector_to_mem (rxq->q_vector), };int ret;
@@ -714,6 +715,7 @@ static int idpf_rx_bufs_init(struct idpf_buf_queue *bufq, .truesize = bufq->truesize, .count = bufq->desc_count, .type = type, + .buf_len = IDPF_RX_MAX_BUF_SZ, .hsplit = idpf_queue_has(HSPLIT_EN, bufq), .nid = idpf_q_vector_to_mem(bufq->q_vector), };
drivers/net/ethernet/intel/idpf/idpf_txrx.h +1 -0
@@ -96,6 +96,7 @@ do { \ idx =0 ; \ } while (0) +#define IDPF_RX_MAX_BUF_SZ (16384 - 128)#define IDPF_RX_BUF_STRIDE 32#define IDPF_RX_BUF_POST_STRIDE 16#define IDPF_LOW_WATERMARK 64
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 80/119 net: netdevsim: fix inconsistent carrier state after link/unlink
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yohei Kojima <[email protected]>
[ Upstream commit d83dddffe1904e4a576d11a541878850a8e64cd2 ]
This patch fixes the edge case behavior on ifup/ifdown and linking/unlinking two netdevsim interfaces:
1. unlink two interfaces netdevsim1 and netdevsim2
2. ifdown netdevsim1
3. ifup netdevsim1
4. link two interfaces netdevsim1 and netdevsim2
5. (Now two interfaces are linked in terms of netdevsim peer, but carrier state of the two interfaces remains DOWN.)
This inconsistent behavior is caused by the current implementation, which only cares about the "link, then ifup" order, not "ifup, then link" order. This patch fixes the inconsistency by calling netif_carrier_on() when two netdevsim interfaces are linked.
This patch fixes buggy behavior on NetworkManager-based systems which causes the netdevsim test to fail with the following error:
# timeout set to 600 # selftests: drivers/net/netdevsim: peer.sh # 2025/12/25 00:54:03 socat[9115] W address is opened in read-write mode but only supports read-only # 2025/12/25 00:56:17 socat[9115] W connect(7, AF=2 192.168.1.1:1234, 16): Connection timed out # 2025/12/25 00:56:17 socat[9115] E TCP:192.168.1.1:1234: Connection timed out # expected 3 bytes, got 0 # 2025/12/25 00:56:17 socat[9109] W exiting on signal 15 not ok 13 selftests: drivers/net/netdevsim: peer.sh # exit=1
This patch also solves timeout on TCP Fast Open (TFO) test in NetworkManager-based systems because it also depends on netdevsim's carrier consistency.
--- drivers/net/netdevsim/bus.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/netdevsim/bus.c +8 -0
@@ -314,6 +314,11 @@ static ssize_t link_device_store(const struct bus_type *bus, const char *buf, sircu_assign_pointer (nsim_a->peer, nsim_b);rcu_assign_pointer (nsim_b->peer, nsim_a); +if (netif_running (dev_a) &&netif_running (dev_b)) { +netif_carrier_on (dev_a); +netif_carrier_on (dev_b); + } + out_err:put_net (ns_b);put_net (ns_a);
@@ -363,6 +368,9 @@ static ssize_t unlink_device_store(const struct bus_type *bus, const char *buf,if (!peer) goto out_put_netns; +netif_carrier_off (dev); +netif_carrier_off (peer->netdev); + err =0 ;RCU_INIT_POINTER (nsim->peer,NULL );RCU_INIT_POINTER (peer->peer,NULL );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 81/119 HID: quirks: work around VID/PID conflict for appledisplay
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: René Rebe <[email protected]>
[ Upstream commit c7fabe4ad9219866c203164a214c474c95b36bf2 ]
For years I wondered why the Apple Cinema Display driver would not just work for me. Turns out the hidraw driver instantly takes it over. Fix by adding appledisplay VID/PIDs to hid_have_special_driver.
--- drivers/hid/hid-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hid/hid-quirks.c +9 -0
@@ -232,6 +232,15 @@ static const struct hid_device_id hid_quirks[] = {* used as a driver. See hid_scan_report(). */ static const struct hid_device_id hid_have_special_driver[] = { +#if IS_ENABLED(CONFIG_APPLEDISPLAY) + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x9218 ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x9219 ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x921c ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x921d ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x9222 ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x9226 ) }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE ,0x9236 ) }, +#endif #if IS_ENABLED(CONFIG_HID_A4TECH) {HID_USB_DEVICE (USB_VENDOR_ID_A4TECH ,USB_DEVICE_ID_A4TECH_WCP32PU ) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 82/119 net/sched: sch_qfq: Fix NULL deref when deactivating inactive aggregate in qfq_reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit c1d73b1480235731e35c81df70b08f4714a7d095 ]
qfq_class->leaf_qdisc->q.qlen > 0 does not imply that the class itself is active.
Two qfq_class objects may point to the same leaf_qdisc. This happens when:
1. one QFQ qdisc is attached to the dev as the root qdisc, and
2. another QFQ qdisc is temporarily referenced (e.g., via qdisc_get() / qdisc_put()) and is pending to be destroyed, as in function tc_new_tfilter.
When packets are enqueued through the root QFQ qdisc, the shared leaf_qdisc->q.qlen increases. At the same time, the second QFQ qdisc triggers qdisc_put and qdisc_destroy: the qdisc enters qfq_reset() with its own q->q.qlen == 0, but its class's leaf qdisc->q.qlen > 0. Therefore, the qfq_reset would wrongly deactivate an inactive aggregate and trigger a null-deref in qfq_deactivate_agg:
[ 0.903172] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 0.903571] #PF: supervisor write access in kernel mode [ 0.903860] #PF: error_code(0x0002) - not-present page [ 0.904177] PGD 10299b067 P4D 10299b067 PUD 10299c067 PMD 0 [ 0.904502] Oops: Oops: 0002 [#1] SMP NOPTI [ 0.904737] CPU: 0 UID: 0 PID: 135 Comm: exploit Not tainted 6.19.0-rc3+ #2 NONE [ 0.905157] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 [ 0.905754] RIP: 0010:qfq_deactivate_agg (include/linux/list.h:992 (discriminator 2) include/linux/list.h:1006 (discriminator 2) net/sched/sch_qfq.c:1367 (discriminator 2) net/sched/sch_qfq.c:1393 (discriminator 2)) [ 0.906046] Code: 0f 84 4d 01 00 00 48 89 70 18 8b 4b 10 48 c7 c2 ff ff ff ff 48 8b 78 08 48 d3 e2 48 21 f2 48 2b 13 48 8b 30 48 d3 ea 8b 4b 18 0
Code starting with the faulting instruction
===========================================
0: 0f 84 4d 01 00 00 je 0x153 6: 48 89 70 18 mov %rsi,0x18(%rax) a: 8b 4b 10 mov 0x10(%rbx),%ecx d: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 14: 48 8b 78 08 mov 0x8(%rax),%rdi 18: 48 d3 e2 shl %cl,%rdx 1b: 48 21 f2 and %rsi,%rdx 1e: 48 2b 13 sub (%rbx),%rdx 21: 48 8b 30 mov (%rax),%rsi 24: 48 d3 ea shr %cl,%rdx 27: 8b 4b 18 mov 0x18(%rbx),%ecx ... [ 0.907095] RSP: 0018:ffffc900004a39a0 EFLAGS: 00010246 [ 0.907368] RAX: ffff8881043a0880 RBX: ffff888102953340 RCX: 0000000000000000 [ 0.907723] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 0.908100] RBP: ffff888102952180 R08: 0000000000000000 R09: 0000000000000000 [ 0.908451] R10: ffff8881043a0000 R11: 0000000000000000 R12: ffff888102952000 [ 0.908804] R13: ffff888102952180 R14: ffff8881043a0ad8 R15: ffff8881043a0880 [ 0.909179] FS: 000000002a1a0380(0000) GS:ffff888196d8d000(0000) knlGS:0000000000000000 [ 0.909572] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.909857] CR2: 0000000000000000 CR3: 0000000102993002 CR4: 0000000000772ef0 [ 0.910247] PKRU: 55555554 [ 0.910391] Call Trace: [ 0.910527] <TASK> [ 0.910638] qfq_reset_qdisc (net/sched/sch_qfq.c:357 net/sched/sch_qfq.c:1485) [ 0.910826] qdisc_reset (include/linux/skbuff.h:2195 include/linux/skbuff.h:2501 include/linux/skbuff.h:3424 include/linux/skbuff.h:3430 net/sched/sch_generic.c:1036) [ 0.911040] __qdisc_destroy (net/sched/sch_generic.c:1076) [ 0.911236] tc_new_tfilter (net/sched/cls_api.c:2447) [ 0.911447] rtnetlink_rcv_msg (net/core/rtnetlink.c:6958) [ 0.911663] ? __pfx_rtnetlink_rcv_msg (net/core/rtnetlink.c:6861) [ 0.911894] netlink_rcv_skb (net/netlink/af_netlink.c:2550) [ 0.912100] netlink_unicast (net/netlink/af_netlink.c:1319 net/netlink/af_netlink.c:1344) [ 0.912296] ? __alloc_skb (net/core/skbuff.c:706) [ 0.912484] netlink_sendmsg (net/netlink/af_netlink.c:1894) [ 0.912682] sock_write_iter (net/socket.c:727 (discriminator 1) net/socket.c:742 (discriminator 1) net/socket.c:1195 (discriminator 1)) [ 0.912880] vfs_write (fs/read_write.c:593 fs/read_write.c:686) [ 0.913077] ksys_write (fs/read_write.c:738) [ 0.913252] do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1)) [ 0.913438] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:131) [ 0.913687] RIP: 0033:0x424c34 [ 0.913844] Code: 89 02 48 c7 c0 ff ff ff ff eb bd 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 80 3d 2d 44 09 00 00 74 13 b8 01 00 00 00 0f 05 9
Code starting with the faulting instruction
===========================================
0: 89 02 mov %eax,(%rdx) 2: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax 9: eb bd jmp 0xffffffffffffffc8 b: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 12: 00 00 00 15: 90 nop 16: f3 0f 1e fa endbr64 1a: 80 3d 2d 44 09 00 00 cmpb $0x0,0x9442d(%rip) # 0x9444e 21: 74 13 je 0x36 23: b8 01 00 00 00 mov $0x1,%eax 28: 0f 05 syscall 2a: 09 .byte 0x9 [ 0.914807] RSP: 002b:00007ffea1938b78 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 0.915197] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000424c34 [ 0.915556] RDX: 000000000000003c RSI: 000000002af378c0 RDI: 0000000000000003 [ 0.915912] RBP: 00007ffea1938bc0 R08: 00000000004b8820 R09: 0000000000000000 [ 0.916297] R10: 0000000000000001 R11: 0000000000000202 R12: 00007ffea1938d28 [ 0.916652] R13: 00007ffea1938d38 R14: 00000000004b3828 R15: 0000000000000001 [ 0.917039] </TASK> [ 0.917158] Modules linked in: [ 0.917316] CR2: 0000000000000000 [ 0.917484] ---[ end trace 0000000000000000 ]--- [ 0.917717] RIP: 0010:qfq_deactivate_agg (include/linux/list.h:992 (discriminator 2) include/linux/list.h:1006 (discriminator 2) net/sched/sch_qfq.c:1367 (discriminator 2) net/sched/sch_qfq.c:1393 (discriminator 2)) [ 0.917978] Code: 0f 84 4d 01 00 00 48 89 70 18 8b 4b 10 48 c7 c2 ff ff ff ff 48 8b 78 08 48 d3 e2 48 21 f2 48 2b 13 48 8b 30 48 d3 ea 8b 4b 18 0
Code starting with the faulting instruction
===========================================
0: 0f 84 4d 01 00 00 je 0x153 6: 48 89 70 18 mov %rsi,0x18(%rax) a: 8b 4b 10 mov 0x10(%rbx),%ecx d: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 14: 48 8b 78 08 mov 0x8(%rax),%rdi 18: 48 d3 e2 shl %cl,%rdx 1b: 48 21 f2 and %rsi,%rdx 1e: 48 2b 13 sub (%rbx),%rdx 21: 48 8b 30 mov (%rax),%rsi 24: 48 d3 ea shr %cl,%rdx 27: 8b 4b 18 mov 0x18(%rbx),%ecx ... [ 0.918902] RSP: 0018:ffffc900004a39a0 EFLAGS: 00010246 [ 0.919198] RAX: ffff8881043a0880 RBX: ffff888102953340 RCX: 0000000000000000 [ 0.919559] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 0.919908] RBP: ffff888102952180 R08: 0000000000000000 R09: 0000000000000000 [ 0.920289] R10: ffff8881043a0000 R11: 0000000000000000 R12: ffff888102952000 [ 0.920648] R13: ffff888102952180 R14: ffff8881043a0ad8 R15: ffff8881043a0880 [ 0.921014] FS: 000000002a1a0380(0000) GS:ffff888196d8d000(0000) knlGS:0000000000000000 [ 0.921424] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.921710] CR2: 0000000000000000 CR3: 0000000102993002 CR4: 0000000000772ef0 [ 0.922097] PKRU: 55555554 [ 0.922240] Kernel panic - not syncing: Fatal exception [ 0.922590] Kernel Offset: disabled
--- net/sched/sch_qfq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_qfq.c +1 -1
@@ -1484,7 +1484,7 @@ static void qfq_reset_qdisc(struct Qdisc *sch)for (i =0 ; i < q->clhash.hashsize; i++) {hlist_for_each_entry (cl, &q->clhash.hash[i], common.hnode) { -if (cl->qdisc->q.qlen >0 ) +if (cl_is_active (cl))qfq_deactivate_class (q, cl);qdisc_reset (cl->qdisc);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 83/119 net: usb: pegasus: fix memory leak in update_eth_regs_async()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petko Manolov <[email protected]>
[ Upstream commit afa27621a28af317523e0836dad430bec551eb54 ]
When asynchronously writing to the device registers and if usb_submit_urb() fail, the code fail to release allocated to this point resources.
--- drivers/net/usb/pegasus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/pegasus.c +2 -0
@@ -168,6 +168,8 @@ static int update_eth_regs_async(pegasus_t *pegasus)netif_device_detach (pegasus->net);netif_err (pegasus, drv, pegasus->net,"%s returned %d\n" , __func__, ret); +usb_free_urb (async_urb); +kfree (req); }return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 84/119 net: enetc: fix build warning when PAGE_SIZE is greater than 128K
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 4b5bdabb5449b652122e43f507f73789041d4abe ]
The max buffer size of ENETC RX BD is 0xFFFF bytes, so if the PAGE_SIZE is greater than 128K, ENETC_RXB_DMA_SIZE and ENETC_RXB_DMA_SIZE_XDP will be greater than 0xFFFF, thus causing a build warning.
This will not cause any practical issues because ENETC is currently only used on the ARM64 platform, and the max PAGE_SIZE is 64K. So this patch is only for fixing the build warning that occurs when compiling ENETC drivers for other platforms.
--- drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.h +2 -2
@@ -44,9 +44,9 @@ struct enetc_tx_swbd {#define ENETC_RXB_TRUESIZE (PAGE_SIZE >> 1)#define ENETC_RXB_PAD NET_SKB_PAD/* add extra space if needed */ #define ENETC_RXB_DMA_SIZE \ - (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD) + min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff)#define ENETC_RXB_DMA_SIZE_XDP \ - (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM) + min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff)struct enetc_rx_swbd {dma_addr_t dma;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 85/119 arp: do not assume dev_hard_header() does not change skb->head
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c92510f5e3f82ba11c95991824a41e59a9c5ed81 ]
arp_create() is the only dev_hard_header() caller making assumption about skb->head being unchanged.
A recent commit broke this assumption.
Initialize @arp pointer after dev_hard_header() call.
--- net/ipv4/arp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/arp.c +4 -3
@@ -564,7 +564,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,skb_reserve (skb, hlen);skb_reset_network_header (skb); - arp =skb_put (skb,arp_hdr_len (dev)); +skb_put (skb,arp_hdr_len (dev)); skb->dev = dev; skb->protocol =htons (ETH_P_ARP );if (!src_hw)
@@ -572,12 +572,13 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,if (!dest_hw) dest_hw = dev->broadcast; -/* -* Fill the device header for the ARP frame +/* Fill the device header for the ARP frame. +* Note: skb->head can be changed. */ if (dev_hard_header (skb, dev, ptype, dest_hw, src_hw, skb->len) <0 ) goto out; + arp =arp_hdr (skb);/* * Fill out the arp protocol part. *
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 86/119 erofs: dont bother with s_stack_depth increasing for now
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 072a7c7cdbea4f91df854ee2bb216256cd619f2a ]
Previously, commit d53cd891f0e4 ("erofs: limit the level of fs stacking for file-backed mounts") bumped s_stack_depth by one to avoid kernel stack overflow when stacking an unlimited number of EROFS on top of each other.
This fix breaks composefs mounts, which need EROFS+ovl^2 sometimes (and such setups are already used in production for quite a long time).
One way to fix this regression is to bump FILESYSTEM_MAX_STACK_DEPTH from 2 to 3, but proving that this is safe in general is a high bar.
After a long discussion on GitHub issues [1] about possible solutions, one conclusion is that there is no need to support nesting file-backed EROFS mounts on stacked filesystems, because there is always the option to use loopback devices as a fallback.
As a quick fix for the composefs regression for this cycle, instead of bumping s_stack_depth for file backed EROFS mounts, we disallow nesting file-backed EROFS over EROFS and over filesystems with s_stack_depth > 0.
This works for all known file-backed mount use cases (composefs, containerd, and Android APEX for some Android vendors), and the fix is self-contained.
Essentially, we are allowing one extra unaccounted fs stacking level of EROFS below stacking filesystems, but EROFS can only be used in the read path (i.e. overlayfs lower layers), which typically has much lower stack usage than the write path.
We can consider increasing FILESYSTEM_MAX_STACK_DEPTH later, after more stack usage analysis or using alternative approaches, such as splitting the s_stack_depth limitation according to different combinations of stacking.
--- fs/erofs/super.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
fs/erofs/super.c +12 -6
@@ -641,14 +641,20 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)* fs contexts (including its own) due to self-controlled RO * accesses/contexts and no side-effect changes that need to * context save & restore so it can reuse the current thread -* context. However, it still needs to bump `s_stack_depth` to -* avoid kernel stack overflow from nested filesystems. +* context. +* However, we still need to prevent kernel stack overflow due +* to filesystem nesting: just ensure that s_stack_depth is 0 +* to disallow mounting EROFS on stacked filesystems. +* Note: s_stack_depth is not incremented here for now, since +* EROFS is the only fs supporting file-backed mounts for now. +* It MUST change if another fs plans to support them, which +* may also require adjusting FILESYSTEM_MAX_STACK_DEPTH. */ if (erofs_is_fileio_mode (sbi)) { - sb->s_stack_depth = -file_inode (sbi->dif0.file)->i_sb->s_stack_depth +1 ; -if (sb->s_stack_depth >FILESYSTEM_MAX_STACK_DEPTH ) { -erofs_err (sb,"maximum fs stacking depth exceeded" ); + inode =file_inode (sbi->dif0.file); +if ((inode->i_sb->s_op == &erofs_sops && !sb->s_bdev) || + inode->i_sb->s_stack_depth) { +erofs_err (sb,"file-backed mounts cannot be applied to stacked fses" );return -ENOTBLK ; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 87/119 erofs: fix file-backed mounts no longer working on EROFS partitions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 7893cc12251f6f19e7689a4cf3ba803bddbd8437 ]
Sheng Yong reported [1] that Android APEX images didn't work with commit 072a7c7cdbea ("erofs: don't bother with s_stack_depth increasing for now") because "EROFS-formatted APEX file images can be stored within an EROFS-formatted Android system partition."
In response, I sent a quick fat-fingered [PATCH v3] to address the report. Unfortunately, the updated condition was incorrect:
if (erofs_is_fileio_mode(sbi)) {- sb->s_stack_depth =
- file_inode(sbi->dif0.file)->i_sb->s_stack_depth + 1;
- if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {
- erofs_err(sb, "maximum fs stacking depth exceeded");
+ inode = file_inode(sbi->dif0.file);
+ if ((inode->i_sb->s_op == &erofs_sops && !sb->s_bdev) ||
+ inode->i_sb->s_stack_depth) {
The condition !sb->s_bdev is always true for all file-backed EROFS mounts, making the check effectively a no-op.
The real fix tested and confirmed by Sheng Yong [2] at that time was [PATCH v3 RESEND], which correctly ensures the following EROFS^2 setup works:
EROFS (on a block device) + EROFS (file-backed mount)
But sadly I screwed it up again by upstreaming the outdated [PATCH v3].
This patch applies the same logic as the delta between the upstream [PATCH v3] and the real fix [PATCH v3 RESEND].
--- fs/erofs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/erofs/super.c +2 -1
@@ -652,7 +652,8 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)*/ if (erofs_is_fileio_mode (sbi)) { inode =file_inode (sbi->dif0.file); -if ((inode->i_sb->s_op == &erofs_sops && !sb->s_bdev) || +if ((inode->i_sb->s_op == &erofs_sops && + !inode->i_sb->s_bdev) || inode->i_sb->s_stack_depth) {erofs_err (sb,"file-backed mounts cannot be applied to stacked fses" );return -ENOTBLK ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 88/119 ALSA: ac97bus: Use guard() for mutex locks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit c07824a14d99c10edd4ec4c389d219af336ecf20 ]
Replace the manual mutex lock/unlock pairs with guard() for code simplification.
Only code refactoring, and no behavior change.
Stable-dep-of: 830988b6cf19 ("ALSA: ac97: fix a double free in snd_ac97_controller_register()")
--- sound/ac97/bus.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
sound/ac97/bus.c +9 -13
@@ -241,10 +241,9 @@ static ssize_t cold_reset_store(struct d {struct ac97_controller *ac97_ctrl; -mutex_lock (&ac97_controllers_mutex); +guard (mutex)(&ac97_controllers_mutex); ac97_ctrl =to_ac97_controller (dev); ac97_ctrl->ops->reset (ac97_ctrl); -mutex_unlock (&ac97_controllers_mutex);return len; }static DEVICE_ATTR_WO (cold_reset);
@@ -258,10 +257,9 @@ static ssize_t warm_reset_store(struct dif (!dev)return -ENODEV ; -mutex_lock (&ac97_controllers_mutex); +guard (mutex)(&ac97_controllers_mutex); ac97_ctrl =to_ac97_controller (dev); ac97_ctrl->ops->warm_reset (ac97_ctrl); -mutex_unlock (&ac97_controllers_mutex);return len; }static DEVICE_ATTR_WO (warm_reset);
@@ -284,10 +282,10 @@ static const struct attribute_group *ac9static void ac97_del_adapter (struct ac97_controller *ac97_ctrl) { -mutex_lock (&ac97_controllers_mutex); -ac97_ctrl_codecs_unregister (ac97_ctrl); -list_del (&ac97_ctrl->controllers); -mutex_unlock (&ac97_controllers_mutex); + scoped_guard(mutex, &ac97_controllers_mutex) { +ac97_ctrl_codecs_unregister (ac97_ctrl); +list_del (&ac97_ctrl->controllers); + }device_unregister (&ac97_ctrl->adap); }
@@ -311,7 +309,7 @@ static int ac97_add_adapter(struct ac97_ {int ret; -mutex_lock (&ac97_controllers_mutex); +guard (mutex)(&ac97_controllers_mutex); ret =idr_alloc (&ac97_adapter_idr, ac97_ctrl,0 ,0 ,GFP_KERNEL ); ac97_ctrl->nr = ret;if (ret >=0 ) {
@@ -322,13 +320,11 @@ static int ac97_add_adapter(struct ac97_if (ret)put_device (&ac97_ctrl->adap); } -if (!ret) +if (!ret) {list_add (&ac97_ctrl->controllers, &ac97_controllers); -mutex_unlock (&ac97_controllers_mutex); - -if (!ret)dev_dbg (&ac97_ctrl->adap,"adapter registered by %s\n" ,dev_name (ac97_ctrl->parent)); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 89/119 ALSA: ac97: fix a double free in snd_ac97_controller_register()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 830988b6cf197e6dcffdfe2008c5738e6c6c3c0f ]
If ac97_add_adapter() fails, put_device() is the correct way to drop the device reference. kfree() is not required.
Add kfree() if idr_alloc() fails and in ac97_adapter_release() to do the cleanup.
Found by code review.
--- sound/ac97/bus.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/ac97/bus.c +5 -5
@@ -298,6 +298,7 @@ static void ac97_adapter_release(structidr_remove (&ac97_adapter_idr, ac97_ctrl->nr);dev_dbg (&ac97_ctrl->adap,"adapter unregistered by %s\n" ,dev_name (ac97_ctrl->parent)); +kfree (ac97_ctrl); }static const struct device_type ac97_adapter_type = {
@@ -319,7 +320,9 @@ static int ac97_add_adapter(struct ac97_ ret =device_register (&ac97_ctrl->adap);if (ret)put_device (&ac97_ctrl->adap); - } + }else +kfree (ac97_ctrl); +if (!ret) {list_add (&ac97_ctrl->controllers, &ac97_controllers); dev_dbg(&ac97_ctrl->adap, "adapter registered by %s\n",
@@ -360,14 +363,11 @@ struct ac97_controller *snd_ac97_control ret =ac97_add_adapter (ac97_ctrl);if (ret) - goto err; +return ERR_PTR (ret);ac97_bus_reset (ac97_ctrl);ac97_bus_scan (ac97_ctrl);return ac97_ctrl; -err: -kfree (ac97_ctrl); -return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (snd_ac97_controller_register);
Greg Kroah-Hartman
maintainerPATCH 90/119 btrfs: fix error handling of submit_uncompressed_range()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit a7858d5c36cae52eaf3048490b05c0b19086073b ]
[BUG]
If we failed to compress the range, or cannot reserve a large enough data extent (e.g. too fragmented free space), we will fall back to submit_uncompressed_range().
But inside submit_uncompressed_range(), run_delalloc_cow() can also fail due to -ENOSPC or any other error.
In that case there are 3 bugs in the error handling:
1) Double freeing for the same ordered extent
This can lead to crash due to ordered extent double accounting
2) Start/end writeback without updating the subpage writeback bitmap
3) Unlock the folio without clear the subpage lock bitmap
Both bugs 2) and 3) will crash the kernel if the btrfs block size is smaller than folio size, as the next time the folio gets writeback/lock updates, subpage will find the bitmap already have the range set, triggering an ASSERT().
[CAUSE]
Bug 1) happens in the following call chain:
submit_uncompressed_range()
|- run_delalloc_cow() | |- cow_file_range() | |- btrfs_reserve_extent() | Failed with -ENOSPC or whatever error | |- btrfs_clean_up_ordered_extents() | |- btrfs_mark_ordered_io_finished() | Which cleans all the ordered extents in the async_extent range. | |- btrfs_mark_ordered_io_finished()
Which cleans the folio range.
The finished ordered extents may not be immediately removed from the ordered io tree, as they are removed inside a work queue.
So the second btrfs_mark_ordered_io_finished() may find the finished but not-yet-removed ordered extents, and double free them.
Furthermore, the second btrfs_mark_ordered_io_finished() is not subpage compatible, as it uses fixed folio_pos() with PAGE_SIZE, which can cover other ordered extents.
Bugs 2) and 3) are more straightforward, btrfs just calls folio_unlock(), folio_start_writeback() and folio_end_writeback(), other than the helpers which handle subpage cases.
[FIX]
For bug 1) since the first btrfs_cleanup_ordered_extents() call is handling the whole range, we should not do the second btrfs_mark_ordered_io_finished() call.
And for the first btrfs_cleanup_ordered_extents(), we no longer need to pass the @locked_page parameter, as we are already in the async extent context, thus will never rely on the error handling inside btrfs_run_delalloc_range().
So just let the btrfs_clean_up_ordered_extents() handle every folio equally.
For bug 2) we should not even call folio_start_writeback()/folio_end_writeback() anymore.
As the error handling protocol, cow_file_range() should clear dirty flag and start/finish the writeback for the whole range passed in.
For bug 3) just change the folio_unlock() to btrfs_folio_end_lock() helper.
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/inode.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
fs/btrfs/inode.c +4 -13
@@ -1159,19 +1159,10 @@ static void submit_uncompressed_range(st &wbc, false);wbc_detach_inode (&wbc);if (ret <0 ) { -btrfs_cleanup_ordered_extents (inode, locked_folio, - start, end - start +1 ); -if (locked_folio) { -const u64 page_start =folio_pos (locked_folio); - -folio_start_writeback (locked_folio); -folio_end_writeback (locked_folio); -btrfs_mark_ordered_io_finished (inode, locked_folio, - page_start,PAGE_SIZE , - !ret); -mapping_set_error (locked_folio->mapping, ret); -folio_unlock (locked_folio); - } +btrfs_cleanup_ordered_extents (inode,NULL , start, end - start +1 ); +if (locked_folio) +btrfs_folio_end_lock (inode->root->fs_info, locked_folio, + start, async_extent->ram_size); } }
Greg Kroah-Hartman
maintainerPATCH 91/119 btrfs: subpage: dump the involved bitmap when ASSERT() failed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 61d730731b47eeee42ad11fc71e145d269acab8d ]
For btrfs_folio_assert_not_dirty() and btrfs_folio_set_lock(), we call bitmap_test_range_all_zero() to ensure the involved range has no dirty/lock bit already set.
However with my recent enhanced delalloc range error handling, I was hitting the ASSERT() inside btrfs_folio_set_lock(), and it turns out that some error handling path is not properly updating the folio flags.
So add some extra dumping for the ASSERTs to dump the involved bitmap to help debug.
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/subpage.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-)
fs/btrfs/subpage.c +30 -11
@@ -652,6 +652,28 @@ IMPLEMENT_BTRFS_PAGE_OPS(ordered, folio_IMPLEMENT_BTRFS_PAGE_OPS (checked, folio_set_checked, folio_clear_checked, folio_test_checked); +#define GET_SUBPAGE_BITMAP (subpage, fs_info, name, dst) \ +{ \ + const int sectors_per_page = fs_info->sectors_per_page; \ + \ + ASSERT(sectors_per_page < BITS_PER_LONG); \ + *dst = bitmap_read(subpage->bitmaps, \ + sectors_per_page * btrfs_bitmap_nr_##name, \ + sectors_per_page); \ +} + +#define SUBPAGE_DUMP_BITMAP (fs_info, folio, name, start, len) \ +{ \ + const struct btrfs_subpage *subpage = folio_get_private(folio); \ + unsigned long bitmap; \ + \ + GET_SUBPAGE_BITMAP(subpage, fs_info, name, &bitmap); \ + btrfs_warn(fs_info, \ + "dumpping bitmap start=%llu len=%u folio=%llu " #name "_bitmap=%*pbl", \ + start, len, folio_pos(folio), \ + fs_info->sectors_per_page, &bitmap); \ +} +/* * Make sure not only the page dirty bit is cleared, but also subpage dirty bit * is cleared.
@@ -677,6 +699,10 @@ void btrfs_folio_assert_not_dirty(const subpage =folio_get_private (folio);ASSERT (subpage);spin_lock_irqsave (&subpage->lock, flags); +if (unlikely (!bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits))) { +SUBPAGE_DUMP_BITMAP (fs_info, folio, dirty, start, len); +ASSERT (bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits)); + }ASSERT (bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits));spin_unlock_irqrestore (&subpage->lock, flags); }
@@ -706,23 +732,16 @@ void btrfs_folio_set_lock(const struct b nbits = len >> fs_info->sectorsize_bits;spin_lock_irqsave (&subpage->lock, flags);/* Target range should not yet be locked. */ -ASSERT (bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits)); +if (unlikely (!bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits))) { +SUBPAGE_DUMP_BITMAP (fs_info, folio, locked, start, len); +ASSERT (bitmap_test_range_all_zero (subpage->bitmaps, start_bit, nbits)); + }bitmap_set (subpage->bitmaps, start_bit, nbits); ret =atomic_add_return (nbits, &subpage->nr_locked);ASSERT (ret <= fs_info->sectors_per_page);spin_unlock_irqrestore (&subpage->lock, flags); } -#define GET_SUBPAGE_BITMAP (subpage, fs_info, name, dst) \ -{ \ - const int sectors_per_page = fs_info->sectors_per_page; \ - \ - ASSERT(sectors_per_page < BITS_PER_LONG); \ - *dst = bitmap_read(subpage->bitmaps, \ - sectors_per_page * btrfs_bitmap_nr_##name, \ - sectors_per_page); \ -} -void __cold btrfs_subpage_dump_bitmap (const struct btrfs_fs_info *fs_info,struct folio *folio,u64 start,u32 len) {
Greg Kroah-Hartman
maintainerPATCH 92/119 btrfs: add extra error messages for delalloc range related errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 975a6a8855f45729a0fbfe2a8f2df2d3faef2a97 ]
All the error handling bugs I hit so far are all -ENOSPC from either:
- cow_file_range()
- run_delalloc_nocow()
- submit_uncompressed_range()
Previously when those functions failed, there was no error message at all, making the debugging much harder.
So here we introduce extra error messages for:
- cow_file_range()
- run_delalloc_nocow()
- submit_uncompressed_range()
- writepage_delalloc() when btrfs_run_delalloc_range() failed
- extent_writepage() when extent_writepage_io() failed
One example of the new debug error messages is the following one:
run fstests generic/750 at 2024-12-08 12:41:41
BTRFS: device fsid 461b25f5-e240-4543-8deb-e7c2bd01a6d3 devid 1 transid 8 /dev/mapper/test-scratch1 (253:4) scanned by mount (2436600) BTRFS info (device dm-4): first mount of filesystem 461b25f5-e240-4543-8deb-e7c2bd01a6d3
BTRFS info (device dm-4): using crc32c (crc32c-arm64) checksum algorithm
BTRFS info (device dm-4): forcing free space tree for sector size 4096 with page size 65536
BTRFS info (device dm-4): using free-space-tree
BTRFS warning (device dm-4): read-write for sector size 4096 with page size 65536 is experimental
BTRFS info (device dm-4): checking UUID tree
BTRFS error (device dm-4): cow_file_range failed, root=363 inode=412 start=503808 len=98304: -28
BTRFS error (device dm-4): run_delalloc_nocow failed, root=363 inode=412 start=503808 len=98304: -28
BTRFS error (device dm-4): failed to run delalloc range, root=363 ino=412 folio=458752 submit_bitmap=11-15 start=503808 len=98304: -28
Which shows an error from cow_file_range() which is called inside a nocow write attempt, along with the extra bitmap from writepage_delalloc().
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/extent_io.c | 15 +++++++++++++++ fs/btrfs/inode.c | 12 ++++++++++++ 2 files changed, 27 insertions(+)
fs/btrfs/extent_io.c +15 -0
@@ -1322,6 +1322,15 @@ static noinline_for_stack int writepage_ wbc);if (ret >=0 ) last_finished_delalloc_end = found_start + found_len; +if (unlikely (ret <0 )) +btrfs_err_rl (fs_info, +"failed to run delalloc range, root=%lld ino=%llu folio=%llu submit_bitmap=%*pbl start=%llu len=%u: %d" , +btrfs_root_id (inode->root), +btrfs_ino (inode), +folio_pos (folio), + fs_info->sectors_per_page, + &bio_ctrl->submit_bitmap, + found_start, found_len, ret); }else {/* * We've hit an error during previous delalloc range,
@@ -1621,6 +1630,12 @@ static int extent_writepage(struct folio PAGE_SIZE, bio_ctrl, i_size);if (ret ==1 )return 0 ; +if (ret <0 ) +btrfs_err_rl (fs_info, +"failed to submit blocks, root=%lld inode=%llu folio=%llu submit_bitmap=%*pbl: %d" , +btrfs_root_id (inode->root),btrfs_ino (inode), +folio_pos (folio), fs_info->sectors_per_page, + &bio_ctrl->submit_bitmap, ret); bio_ctrl->wbc->nr_to_write--;
fs/btrfs/inode.c +12 -0
@@ -1163,6 +1163,10 @@ static void submit_uncompressed_range(stif (locked_folio)btrfs_folio_end_lock (inode->root->fs_info, locked_folio, start, async_extent->ram_size); +btrfs_err_rl (inode->root->fs_info, +"%s failed, root=%llu inode=%llu start=%llu len=%llu: %d" , + __func__,btrfs_root_id (inode->root), +btrfs_ino (inode), start, async_extent->ram_size, ret); } }
@@ -1623,6 +1627,10 @@ out_unlock: &cached, clear_bits, page_ops);btrfs_qgroup_free_data (inode,NULL , start, end - start +1 ,NULL ); } +btrfs_err_rl (fs_info, +"%s failed, root=%llu inode=%llu start=%llu len=%llu: %d" , + __func__,btrfs_root_id (inode->root), +btrfs_ino (inode), orig_start, end +1 - orig_start, ret);return ret; }
@@ -2373,6 +2381,10 @@ error:btrfs_qgroup_free_data (inode,NULL , cur_offset, end - cur_offset +1 ,NULL ); }btrfs_free_path (path); +btrfs_err_rl (fs_info, +"%s failed, root=%llu inode=%llu start=%llu len=%llu: %d" , + __func__,btrfs_root_id (inode->root), +btrfs_ino (inode), start, end +1 - start, ret);return ret; }
Greg Kroah-Hartman
maintainerPATCH 93/119 btrfs: remove btrfs_fs_info::sectors_per_page
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 619611e87fcca1fdaa67c2bf6b030863ab90216e ]
For the future large folio support, our filemap can have folios with different sizes, thus we can no longer rely on a fixed blocks_per_page value.
To prepare for that future, here we do:
- Remove btrfs_fs_info::sectors_per_page
- Introduce a helper, btrfs_blocks_per_folio()
Which uses the folio size to calculate the number of blocks for each folio.
- Migrate the existing btrfs_fs_info::sectors_per_page to use that helper
There are some exceptions:
* Metadata nodesize < page size support
In the future, even if we support large folios, we will only allocate a folio that matches our nodesize.
Thus we won't have a folio covering multiple metadata unless nodesize < page size.
* Existing subpage bitmap dump
We use a single unsigned long to store the bitmap.
That means until we change the bitmap dumping code, our upper limit for folio size will only be 256K (4K block size, 64 bit unsigned long).
* btrfs_is_subpage() check
This will be migrated into a future patch.
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/disk-io.c | 1 fs/btrfs/extent_io.c | 26 +++++++----- fs/btrfs/fs.h | 7 ++- fs/btrfs/subpage.c | 104 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 84 insertions(+), 54 deletions(-)
fs/btrfs/disk-io.c +0 -1
@@ -3320,7 +3320,6 @@ int __cold open_ctree(struct super_block fs_info->nodesize = nodesize; fs_info->sectorsize = sectorsize; fs_info->sectorsize_bits =ilog2 (sectorsize); - fs_info->sectors_per_page = (PAGE_SIZE >> fs_info->sectorsize_bits); fs_info->csums_per_leaf =BTRFS_MAX_ITEM_SIZE (fs_info) / fs_info->csum_size; fs_info->stripesize = stripesize;
fs/btrfs/extent_io.c +15 -11
@@ -1182,7 +1182,7 @@ static bool find_next_delalloc_bitmap(st {struct btrfs_fs_info *fs_info =folio_to_fs_info (folio);const u64 folio_start =folio_pos (folio); -const unsigned int bitmap_size = fs_info->sectors_per_page; +const unsigned int bitmap_size =btrfs_blocks_per_folio (fs_info, folio);unsigned int start_bit;unsigned int first_zero;unsigned int first_set;
@@ -1224,6 +1224,7 @@ static noinline_for_stack int writepage_const bool is_subpage =btrfs_is_subpage (fs_info, folio->mapping);const u64 page_start =folio_pos (folio);const u64 page_end = page_start +folio_size (folio) -1 ; +const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);unsigned long delalloc_bitmap =0 ;/* * Save the last found delalloc end. As the delalloc end can go beyond
@@ -1249,13 +1250,13 @@ static noinline_for_stack int writepage_/* Save the dirty bitmap as our submission bitmap will be a subset of it. */ if (btrfs_is_subpage (fs_info, inode->vfs_inode.i_mapping)) { -ASSERT (fs_info->sectors_per_page >1 ); +ASSERT (blocks_per_folio >1 );btrfs_get_subpage_dirty_bitmap (fs_info, folio, &bio_ctrl->submit_bitmap); }else { bio_ctrl->submit_bitmap =1 ; } -for_each_set_bit (bit, &bio_ctrl->submit_bitmap, fs_info->sectors_per_page) { +for_each_set_bit (bit, &bio_ctrl->submit_bitmap, blocks_per_folio) {u64 start = page_start + (bit << fs_info->sectorsize_bits);btrfs_folio_set_lock (fs_info, folio, start, fs_info->sectorsize);
@@ -1328,7 +1329,7 @@ static noinline_for_stack int writepage_btrfs_root_id (inode->root),btrfs_ino (inode),folio_pos (folio), - fs_info->sectors_per_page, + blocks_per_folio, &bio_ctrl->submit_bitmap, found_start, found_len, ret); }else {
@@ -1373,7 +1374,7 @@ static noinline_for_stack int writepage_unsigned int bitmap_size =min ( (last_finished_delalloc_end - page_start) >> fs_info->sectorsize_bits, - fs_info->sectors_per_page); + blocks_per_folio);for_each_set_bit (bit, &bio_ctrl->submit_bitmap, bitmap_size) btrfs_mark_ordered_io_finished(inode, folio,
@@ -1397,7 +1398,7 @@ out:* If all ranges are submitted asynchronously, we just need to account * for them here. */ -if (bitmap_empty (&bio_ctrl->submit_bitmap, fs_info->sectors_per_page)) { +if (bitmap_empty (&bio_ctrl->submit_bitmap, blocks_per_folio)) { wbc->nr_to_write -= delalloc_to_write;return 1 ; }
@@ -1498,6 +1499,7 @@ static noinline_for_stack int extent_wribool submitted_io = false;int found_error =0 ;const u64 folio_start =folio_pos (folio); +const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);u64 cur;int bit;int ret =0 ;
@@ -1516,11 +1518,11 @@ static noinline_for_stack int extent_wrifor (cur = start; cur < start + len; cur += fs_info->sectorsize)set_bit ((cur - folio_start) >> fs_info->sectorsize_bits, &range_bitmap);bitmap_and (&bio_ctrl->submit_bitmap, &bio_ctrl->submit_bitmap, &range_bitmap, - fs_info->sectors_per_page); + blocks_per_folio); bio_ctrl->end_io_func = end_bbio_data_write; -for_each_set_bit (bit, &bio_ctrl->submit_bitmap, fs_info->sectors_per_page) { +for_each_set_bit (bit, &bio_ctrl->submit_bitmap, blocks_per_folio) { cur =folio_pos (folio) + (bit << fs_info->sectorsize_bits);if (cur >= i_size) {
@@ -1595,6 +1597,7 @@ static int extent_writepage(struct foliosize_t pg_offset;loff_t i_size =i_size_read (&inode->vfs_inode);unsigned long end_index = i_size >>PAGE_SHIFT ; +const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);trace_extent_writepage (folio, &inode->vfs_inode, bio_ctrl->wbc);
@@ -1634,7 +1637,7 @@ static int extent_writepage(struct foliobtrfs_err_rl (fs_info,"failed to submit blocks, root=%lld inode=%llu folio=%llu submit_bitmap=%*pbl: %d" ,btrfs_root_id (inode->root),btrfs_ino (inode), -folio_pos (folio), fs_info->sectors_per_page, +folio_pos (folio), blocks_per_folio, &bio_ctrl->submit_bitmap, ret); bio_ctrl->wbc->nr_to_write--;
@@ -1929,9 +1932,10 @@ static int submit_eb_subpage(struct foliu64 folio_start =folio_pos (folio);int bit_start =0 ;int sectors_per_node = fs_info->nodesize >> fs_info->sectorsize_bits; +const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);/* Lock and write each dirty extent buffers in the range */ -while (bit_start < fs_info->sectors_per_page) { +while (bit_start < blocks_per_folio) {struct btrfs_subpage *subpage =folio_get_private (folio);struct extent_buffer *eb;unsigned long flags;
@@ -1947,7 +1951,7 @@ static int submit_eb_subpage(struct folibreak ; }spin_lock_irqsave (&subpage->lock, flags); -if (!test_bit (bit_start + btrfs_bitmap_nr_dirty * fs_info->sectors_per_page, +if (!test_bit (bit_start + btrfs_bitmap_nr_dirty * blocks_per_folio, subpage->bitmaps)) {spin_unlock_irqrestore (&subpage->lock, flags);spin_unlock (&folio->mapping->i_private_lock);
fs/btrfs/fs.h +6 -1
@@ -708,7 +708,6 @@ struct btrfs_fs_info {* running. */ refcount_t scrub_workers_refcnt; -u32 sectors_per_page;struct workqueue_struct *scrub_workers;struct btrfs_discard_ctl discard_ctl;
@@ -976,6 +975,12 @@ static inline u32 count_max_extents(consreturn div_u64 (size + fs_info->max_extent_size -1 , fs_info->max_extent_size); } +static inline unsigned int btrfs_blocks_per_folio (const struct btrfs_fs_info *fs_info, +const struct folio *folio) +{ +return folio_size (folio) >> fs_info->sectorsize_bits; +} +bool btrfs_exclop_start (struct btrfs_fs_info *fs_info,enum btrfs_exclusive_operation type); bool btrfs_exclop_start_try_lock(struct btrfs_fs_info *fs_info,
fs/btrfs/subpage.c +63 -41
229 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 94/119 btrfs: truncate ordered extent when skipping writeback past i_size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 18de34daa7c62c830be533aace6b7c271e8e95cf ]
While running test case btrfs/192 from fstests with support for large folios (needs CONFIG_BTRFS_EXPERIMENTAL=y) I ended up getting very sporadic btrfs check failures reporting that csum items were missing. Looking into the issue it turned out that btrfs check searches for csum items of a file extent item with a range that spans beyond the i_size of a file and we don't have any, because the kernel's writeback code skips submitting bios for ranges beyond eof. It's not expected however to find a file extent item that crosses the rounded up (by the sector size) i_size value, but there is a short time window where we can end up with a transaction commit leaving this small inconsistency between the i_size and the last file extent item.
Example btrfs check output when this happens:
$ btrfs check /dev/sdc Opening filesystem to check... Checking filesystem on /dev/sdc UUID: 69642c61-5efb-4367-aa31-cdfd4067f713 [1/8] checking log skipped (none written) [2/8] checking root items [3/8] checking extents [4/8] checking free space tree [5/8] checking fs roots root 5 inode 332 errors 1000, some csum missing ERROR: errors found in fs roots (...)
Looking at a tree dump of the fs tree (root 5) for inode 332 we have:
$ btrfs inspect-internal dump-tree -t 5 /dev/sdc
(...)
item 28 key (332 INODE_ITEM 0) itemoff 2006 itemsize 160
generation 17 transid 19 size 610969 nbytes 86016
block group 0 mode 100666 links 1 uid 0 gid 0 rdev 0
sequence 11 flags 0x0(none)
atime 1759851068.391327881 (2025-10-07 16:31:08)
ctime 1759851068.410098267 (2025-10-07 16:31:08)
mtime 1759851068.410098267 (2025-10-07 16:31:08)
otime 1759851068.391327881 (2025-10-07 16:31:08)
item 29 key (332 INODE_REF 340) itemoff 1993 itemsize 13
index 2 namelen 3 name: f1f
item 30 key (332 EXTENT_DATA 589824) itemoff 1940 itemsize 53
generation 19 type 1 (regular)
extent data disk byte 21745664 nr 65536
extent data offset 0 nr 65536 ram 65536
extent compression 0 (none)
(...)We can see that the file extent item for file offset 589824 has a length of 64K and its number of bytes is 64K. Looking at the inode item we see that its i_size is 610969 bytes which falls within the range of that file extent item [589824, 655360[.
Looking into the csum tree:
$ btrfs inspect-internal dump-tree /dev/sdc
(...)
item 15 key (EXTENT_CSUM EXTENT_CSUM 21565440) itemoff 991 itemsize 200
range start 21565440 end 21770240 length 204800
item 16 key (EXTENT_CSUM EXTENT_CSUM 1104576512) itemoff 983 itemsize 8
range start 1104576512 end 1104584704 length 8192
(..)We see that the csum item number 15 covers the first 24K of the file extent item - it ends at offset 21770240 and the extent's disk_bytenr is 21745664, so we have:
21770240 - 21745664 = 24K
We see that the next csum item (number 16) is completely outside the range, so the remaining 40K of the extent doesn't have csum items in the tree.
If we round up the i_size to the sector size, we get:
round_up(610969, 4096) = 614400
If we subtract from that the file offset for the extent item we get:
614400 - 589824 = 24K
So the missing 40K corresponds to the end of the file extent item's range minus the rounded up i_size:
655360 - 614400 = 40K
Normally we don't expect a file extent item to span over the rounded up i_size of an inode, since when truncating, doing hole punching and other operations that trim a file extent item, the number of bytes is adjusted.
There is however a short time window where the kernel can end up, temporarily,persisting an inode with an i_size that falls in the middle of the last file extent item and the file extent item was not yet trimmed (its number of bytes reduced so that it doesn't cross i_size rounded up by the sector size).
The steps (in the kernel) that lead to such scenario are the following:
1) We have inode I as an empty file, no allocated extents, i_size is 0;
2) A buffered write is done for file range [589824, 655360[ (length of 64K) and the i_size is updated to 655360. Note that we got a single large folio for the range (64K);
3) A truncate operation starts that reduces the inode's i_size down to 610969 bytes. The truncate sets the inode's new i_size at btrfs_setsize() by calling truncate_setsize() and before calling btrfs_truncate();
4) At btrfs_truncate() we trigger writeback for the range starting at 610304 (which is the new i_size rounded down to the sector size) and ending at (u64)-1;
5) During the writeback, at extent_write_cache_pages(), we get from the call to filemap_get_folios_tag(), the 64K folio that starts at file offset 589824 since it contains the start offset of the writeback range (610304);
6) At writepage_delalloc() we find the whole range of the folio is dirty
and therefore we run delalloc for that 64K range ([589824, 655360[),
reserving a 64K extent, creating an ordered extent, etc; 7) At extent_writepage_io() we submit IO only for subrange [589824, 614400[ because the inode's i_size is 610969 bytes (rounded up by sector size is 614400). There, in the while loop we intentionally skip IO beyond i_size to avoid any unnecessay work and just call btrfs_mark_ordered_io_finished() for the range [614400, 655360[ (which has a 40K length);
8) Once the IO finishes we finish the ordered extent by ending up at btrfs_finish_one_ordered(), join transaction N, insert a file extent item in the inode's subvolume tree for file offset 589824 with a number of bytes of 64K, and update the inode's delayed inode item or directly the inode item with a call to btrfs_update_inode_fallback(), which results in storing the new i_size of 610969 bytes;
9) Transaction N is committed either by the transaction kthread or some other task committed it (in response to a sync or fsync for example).
At this point we have inode I persisted with an i_size of 610969 bytes and file extent item that starts at file offset 589824 and has a number of bytes of 64K, ending at an offset of 655360 which is beyond the i_size rounded up to the sector size (614400).
--> So after a crash or power failure here, the btrfs check program
reports that error about missing checksum items for this inode, as it tries to lookup for checksums covering the whole range of the extent;
10) Only after transaction N is committed that at btrfs_truncate() the call to btrfs_start_transaction() starts a new transaction, N + 1, instead of joining transaction N. And it's with transaction N + 1 that it calls btrfs_truncate_inode_items() which updates the file extent item at file offset 589824 to reduce its number of bytes from 64K down to 24K, so that the file extent item's range ends at the i_size rounded up to the sector size (614400 bytes).
Fix this by truncating the ordered extent at extent_writepage_io() when we skip writeback because the current offset in the folio is beyond i_size. This ensures we don't ever persist a file extent item with a number of bytes beyond the rounded up (by sector size) value of the i_size.
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/extent_io.c | 21 +++++++++++++++++++-- fs/btrfs/ordered-data.c | 5 +++-- 2 files changed, 22 insertions(+), 4 deletions(-)
fs/btrfs/extent_io.c +19 -2
@@ -1499,13 +1499,13 @@ static noinline_for_stack int extent_wribool submitted_io = false;int found_error =0 ;const u64 folio_start =folio_pos (folio); +const u64 folio_end = folio_start +folio_size (folio);const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);u64 cur;int bit;int ret =0 ; -ASSERT (start >= folio_start && - start + len <= folio_start +folio_size (folio)); +ASSERT (start >= folio_start && start + len <= folio_end); ret =btrfs_writepage_cow_fixup (folio);if (ret) {
@@ -1526,6 +1526,23 @@ static noinline_for_stack int extent_wri cur =folio_pos (folio) + (bit << fs_info->sectorsize_bits);if (cur >= i_size) { +struct btrfs_ordered_extent *ordered; +unsigned long flags; + + ordered =btrfs_lookup_first_ordered_range (inode, cur, + folio_end - cur); +/* +* We have just run delalloc before getting here, so +* there must be an ordered extent. +*/ +ASSERT (ordered !=NULL ); +spin_lock_irqsave (&inode->ordered_tree_lock, flags); +set_bit (BTRFS_ORDERED_TRUNCATED , &ordered->flags); + ordered->truncated_len =min (ordered->truncated_len, + cur - ordered->file_offset); +spin_unlock_irqrestore (&inode->ordered_tree_lock, flags); +btrfs_put_ordered_extent (ordered); +btrfs_mark_ordered_io_finished (inode, folio, cur, start + len - cur, true);/*
fs/btrfs/ordered-data.c +3 -2
@@ -1080,8 +1080,9 @@ struct btrfs_ordered_extent *btrfs_lookustruct rb_node *prev;struct rb_node *next;struct btrfs_ordered_extent *entry =NULL ; +unsigned long flags; -spin_lock_irq (&inode->ordered_tree_lock); +spin_lock_irqsave (&inode->ordered_tree_lock, flags); node = inode->ordered_tree.rb_node;/* * Here we don't want to use tree_search() which will use tree->last
@@ -1136,7 +1137,7 @@ out:trace_btrfs_ordered_extent_lookup_first_range (inode, entry); } -spin_unlock_irq (&inode->ordered_tree_lock); +spin_unlock_irqrestore (&inode->ordered_tree_lock, flags);return entry; }
Greg Kroah-Hartman
maintainerPATCH 95/119 btrfs: use variable for end offset in extent_writepage_io()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 46a23908598f4b8e61483f04ea9f471b2affc58a ]
Instead of repeating the expression "start + len" multiple times, store it in a variable and use it where needed.
Stable-dep-of: e9e3b22ddfa7 ("btrfs: fix beyond-EOF write handling")
--- fs/btrfs/extent_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/extent_io.c +5 -5
@@ -1498,6 +1498,7 @@ static noinline_for_stack int extent_wriunsigned long range_bitmap =0 ;bool submitted_io = false;int found_error =0 ; +const u64 end = start + len;const u64 folio_start =folio_pos (folio);const u64 folio_end = folio_start +folio_size (folio);const unsigned int blocks_per_folio =btrfs_blocks_per_folio (fs_info, folio);
@@ -1505,7 +1506,7 @@ static noinline_for_stack int extent_wriint bit;int ret =0 ; -ASSERT (start >= folio_start && start + len <= folio_end); +ASSERT (start >= folio_start && end <= folio_end); ret =btrfs_writepage_cow_fixup (folio);if (ret) {
@@ -1515,7 +1516,7 @@ static noinline_for_stack int extent_wrireturn 1 ; } -for (cur = start; cur < start + len; cur += fs_info->sectorsize) +for (cur = start; cur < end; cur += fs_info->sectorsize)set_bit ((cur - folio_start) >> fs_info->sectorsize_bits, &range_bitmap);bitmap_and (&bio_ctrl->submit_bitmap, &bio_ctrl->submit_bitmap, &range_bitmap, blocks_per_folio);
@@ -1544,7 +1545,7 @@ static noinline_for_stack int extent_wribtrfs_put_ordered_extent (ordered);btrfs_mark_ordered_io_finished (inode, folio, cur, - start + len - cur, true); + end - cur, true);/* * This range is beyond i_size, thus we don't need to * bother writing back.
@@ -1553,8 +1554,7 @@ static noinline_for_stack int extent_wri* writeback the sectors with subpage dirty bits, * causing writeback without ordered extent. */ -btrfs_folio_clear_dirty (fs_info, folio, cur, - start + len - cur); +btrfs_folio_clear_dirty (fs_info, folio, cur, end - cur);break ; } ret =submit_one_sector (inode, folio, cur, bio_ctrl, i_size);
Greg Kroah-Hartman
maintainerPATCH 96/119 btrfs: fix beyond-EOF write handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit e9e3b22ddfa760762b696ac6417c8d6edd182e49 ]
[BUG]
For the following write sequence with 64K page size and 4K fs block size, it will lead to file extent items to be inserted without any data checksum:
mkfs.btrfs -s 4k -f $dev > /dev/null
mount $dev $mnt
xfs_io -f -c "pwrite 0 16k" -c "pwrite 32k 4k" -c pwrite "60k 64K" \
-c "truncate 16k" $mnt/foobar
umount $mntThis will result the following 2 file extent items to be inserted (extra trace point added to insert_ordered_extent_file_extent()):
btrfs_finish_one_ordered: root=5 ino=257 file_off=61440 num_bytes=4096 csum_bytes=0
btrfs_finish_one_ordered: root=5 ino=257 file_off=0 num_bytes=16384 csum_bytes=16384
Note for file offset 60K, we're inserting a file extent without any data checksum.
Also note that range [32K, 36K) didn't reach insert_ordered_extent_file_extent(), which is the correct behavior as that OE is fully truncated, should not result any file extent.
Although file extent at 60K will be later dropped by btrfs_truncate(), if the transaction got committed after file extent inserted but before the file extent dropping, we will have a small window where we have a file extent beyond EOF and without any data checksum.
That will cause "btrfs check" to report error.
[CAUSE]
The sequence happens like this:
- Buffered write dirtied the page cache and updated isize
Now the inode size is 64K, with the following page cache layout:
0 16K 32K 48K 64K |/////////////| |//| |//|
- Truncate the inode to 16K
Which will trigger writeback through:
btrfs_setsize()
|- truncate_setsize()
| Now the inode size is set to 16K
|
|- btrfs_truncate()
|- btrfs_wait_ordered_range() for [16K, u64(-1)]
|- btrfs_fdatawrite_range() for [16K, u64(-1)}
|- extent_writepage() for folio 0
|- writepage_delalloc()
| Generated OE for [0, 16K), [32K, 36K] and [60K, 64K)
|
|- extent_writepage_io() Then inside extent_writepage_io(), the dirty fs blocks are handled differently:
- Submit write for range [0, 16K)
As they are still inside the inode size (16K).
- Mark OE [32K, 36K) as truncated
Since we only call btrfs_lookup_first_ordered_range() once, which returned the first OE after file offset 16K.
- Mark all OEs inside range [16K, 64K) as finished Which will mark OE ranges [32K, 36K) and [60K, 64K) as finished.
For OE [32K, 36K) since it's already marked as truncated, and its truncated length is 0, no file extent will be inserted.
For OE [60K, 64K) it has never been submitted thus has no data checksum, and we insert the file extent as usual.
This is the root cause of file extent at 60K to be inserted without any data checksum.
- Clear dirty flags for range [16K, 64K)
It is the function btrfs_folio_clear_dirty() which searches and clears any dirty blocks inside that range.
[FIX]
The bug itself was introduced a long time ago, way before subpage and large folio support.
At that time, fs block size must match page size, thus the range [cur, end) is just one fs block.
But later with subpage and large folios, the same range [cur, end) can have multiple blocks and ordered extents.
Later commit 18de34daa7c6 ("btrfs: truncate ordered extent when skipping writeback past i_size") was fixing a bug related to subpage/large folios, but it's still utilizing the old range [cur, end), meaning only the first OE will be marked as truncated.
The proper fix here is to make EOF handling block-by-block, not trying to handle the whole range to @end.
By this we always locate and truncate the OE for every dirty block.
--- fs/btrfs/extent_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/extent_io.c +4 -4
@@ -1531,7 +1531,7 @@ static noinline_for_stack int extent_wriunsigned long flags; ordered =btrfs_lookup_first_ordered_range (inode, cur, - folio_end - cur); + fs_info->sectorsize);/* * We have just run delalloc before getting here, so * there must be an ordered extent.
@@ -1545,7 +1545,7 @@ static noinline_for_stack int extent_wribtrfs_put_ordered_extent (ordered);btrfs_mark_ordered_io_finished (inode, folio, cur, - end - cur, true); + fs_info->sectorsize, true);/* * This range is beyond i_size, thus we don't need to * bother writing back.
@@ -1554,8 +1554,8 @@ static noinline_for_stack int extent_wri* writeback the sectors with subpage dirty bits, * causing writeback without ordered extent. */ -btrfs_folio_clear_dirty (fs_info, folio, cur, end - cur); -break ; +btrfs_folio_clear_dirty (fs_info, folio, cur, fs_info->sectorsize); +continue ; } ret =submit_one_sector (inode, folio, cur, bio_ctrl, i_size);if (unlikely (ret <0 )) {
Greg Kroah-Hartman
maintainerPATCH 97/119 bpf: Fix an issue in bpf_prog_test_run_xdp when page size greater than 4K
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 4fc012daf9c074772421c904357abf586336b1ca ]
The bpf selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow failed on arm64 with 64KB page:
xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL
In bpf_prog_test_run_xdp(), the xdp->frame_sz is set to 4K, but later on when constructing frags, with 64K page size, the frag data_len could be more than 4K. This will cause problems in bpf_xdp_frags_increase_tail().
To fix the failure, the xdp->frame_sz is set to be PAGE_SIZE so kernel can test different page size properly. With the kernel change, the user space and bpf prog needs adjustment. Currently, the MAX_SKB_FRAGS default value is 17, so for 4K page, the maximum packet size will be less than 68K. To test 64K page, a bigger maximum packet size than 68K is desired. So two different functions are implemented for subtest xdp_adjust_frags_tail_grow. Depending on different page size, different data input/output sizes are used to adapt with different page size.
Stable-dep-of: e558cca21779 ("bpf, test_run: Subtract size of xdp_frame from allowed metadata size")
--- net/bpf/test_run.c | 2 +- .../bpf/prog_tests/xdp_adjust_tail.c | 96 +++++++++++++++++-- .../bpf/progs/test_xdp_adjust_tail_grow.c | 8 +- 3 files changed, 97 insertions(+), 9 deletions(-)
net/bpf/test_run.c +1 -1
@@ -1248,7 +1248,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, headroom -= ctx->data; } - max_data_sz =4096 - headroom - tailroom; + max_data_sz =PAGE_SIZE - headroom - tailroom;if (size > max_data_sz) {/* disallow live data mode for jumbo frames */ if (do_live)
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c +89 -7
133 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_grow.c +7 -1
@@ -17,7 +17,9 @@ int _xdp_adjust_tail_grow(struct xdp_md *xdp)/* Data length determine test case */ if (data_len ==54 ) {/* sizeof(pkt_v4) */ - offset =4096 ;/* test too large offset */ + offset =4096 ;/* test too large offset, 4k page size */ + }else if (data_len ==53 ) {/* sizeof(pkt_v4) - 1 */ + offset =65536 ;/* test too large offset, 64k page size */ }else if (data_len ==74 ) {/* sizeof(pkt_v6) */ offset =40 ; }else if (data_len ==64 ) {
@@ -29,6 +31,10 @@ int _xdp_adjust_tail_grow(struct xdp_md *xdp) offset =10 ; }else if (data_len ==9001 ) { offset =4096 ; + }else if (data_len ==90000 ) { + offset =10 ;/* test a small offset, 64k page size */ + }else if (data_len ==90001 ) { + offset =65536 ;/* test too large offset, 64k page size */ }else {return XDP_ABORTED ;/* No matching test */ }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 98/119 bpf: Make variables in bpf_prog_test_run_xdp less confusing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amery Hung <[email protected]>
[ Upstream commit 7eb83bff02ad5e82e8c456c58717ef181c220870 ]
Change the variable naming in bpf_prog_test_run_xdp() to make the overall logic less confusing. As different modes were added to the function over the time, some variables got overloaded, making it hard to understand and changing the code becomes error-prone.
Replace "size" with "linear_sz" where it refers to the size of metadata and data. If "size" refers to input data size, use test.data_size_in directly.
Replace "max_data_sz" with "max_linear_sz" to better reflect the fact that it is the maximum size of metadata and data (i.e., linear_sz). Also, xdp_rxq.frags_size is always PAGE_SIZE, so just set it directly instead of subtracting headroom and tailroom and adding them back.
Stable-dep-of: e558cca21779 ("bpf, test_run: Subtract size of xdp_frame from allowed metadata size")
--- net/bpf/test_run.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
net/bpf/test_run.c +13 -13
@@ -1200,9 +1200,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, {bool do_live = (kattr->test.flags &BPF_F_TEST_XDP_LIVE_FRAMES );u32 tailroom =SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); +u32 retval =0 , duration, max_linear_sz, size; +u32 linear_sz = kattr->test.data_size_in;u32 batch_size = kattr->test.batch_size; -u32 retval =0 , duration, max_data_sz; -u32 size = kattr->test.data_size_in;u32 headroom =XDP_PACKET_HEADROOM ;u32 repeat = kattr->test.repeat;struct netdev_rx_queue *rxqueue;
@@ -1239,7 +1239,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,if (ctx) {/* There can't be user provided data before the meta data */ -if (ctx->data_meta || ctx->data_end != size || +if (ctx->data_meta || ctx->data_end != kattr->test.data_size_in || ctx->data > ctx->data_end ||unlikely (xdp_metalen_invalid (ctx->data)) || (do_live && (kattr->test.data_out || kattr->test.ctx_out)))
@@ -1248,30 +1248,30 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, headroom -= ctx->data; } - max_data_sz =PAGE_SIZE - headroom - tailroom; -if (size > max_data_sz) { -/* disallow live data mode for jumbo frames */ -if (do_live) - goto free_ctx; - size = max_data_sz; - } + max_linear_sz =PAGE_SIZE - headroom - tailroom; + linear_sz =min_t (u32, linear_sz, max_linear_sz); + +/* disallow live data mode for jumbo frames */ +if (do_live && kattr->test.data_size_in > linear_sz) + goto free_ctx; - data =bpf_test_init (kattr, size, max_data_sz, headroom, tailroom); + data =bpf_test_init (kattr, linear_sz, max_linear_sz, headroom, tailroom);if (IS_ERR (data)) { ret =PTR_ERR (data); goto free_ctx; } rxqueue =__netif_get_rx_queue (current->nsproxy->net_ns->loopback_dev,0 ); - rxqueue->xdp_rxq.frag_size = headroom + max_data_sz + tailroom; + rxqueue->xdp_rxq.frag_size =PAGE_SIZE ;xdp_init_buff (&xdp, rxqueue->xdp_rxq.frag_size, &rxqueue->xdp_rxq); -xdp_prepare_buff (&xdp, data, headroom, size, true); +xdp_prepare_buff (&xdp, data, headroom, linear_sz, true); sinfo =xdp_get_shared_info_from_buff (&xdp); ret =xdp_convert_md_to_buff (ctx, &xdp);if (ret) goto free_data; + size = linear_sz;if (unlikely (kattr->test.data_size_in > size)) {void __user *data_in =u64_to_user_ptr (kattr->test.data_in);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 99/119 bpf: Support specifying linear xdp packet data size for BPF_PROG_TEST_RUN
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amery Hung <[email protected]>
[ Upstream commit fe9544ed1a2e9217b2c5285c3a4ac0dc5a38bd7b ]
To test bpf_xdp_pull_data(), an xdp packet containing fragments as well as free linear data area after xdp->data_end needs to be created. However, bpf_prog_test_run_xdp() always fills the linear area with data_in before creating fragments, leaving no space to pull data. This patch will allow users to specify the linear data size through ctx->data_end.
Currently, ctx_in->data_end must match data_size_in and will not be the final ctx->data_end seen by xdp programs. This is because ctx->data_end is populated according to the xdp_buff passed to test_run. The linear data area available in an xdp_buff, max_linear_sz, is alawys filled up before copying data_in into fragments.
This patch will allow users to specify the size of data that goes into the linear area. When ctx_in->data_end is different from data_size_in, only ctx_in->data_end bytes of data will be put into the linear area when creating the xdp_buff.
While ctx_in->data_end will be allowed to be different from data_size_in, it cannot be larger than the data_size_in as there will be no data to copy from user space. If it is larger than the maximum linear data area size, the layout suggested by the user will not be honored. Data beyond max_linear_sz bytes will still be copied into fragments.
Finally, since it is possible for a NIC to produce a xdp_buff with empty linear data area, allow it when calling bpf_test_init() from bpf_prog_test_run_xdp() so that we can test XDP kfuncs with such xdp_buff. This is done by moving lower-bound check to callers as most of them already do except bpf_prog_test_run_skb(). The change also fixes a bug that allows passing an xdp_buff with data < ETH_HLEN. This can happen when ctx is used and metadata is at least ETH_HLEN.
Stable-dep-of: e558cca21779 ("bpf, test_run: Subtract size of xdp_frame from allowed metadata size")
--- net/bpf/test_run.c | 15 ++++++++++++--- .../bpf/prog_tests/xdp_context_test_run.c | 4 +--- 2 files changed, 13 insertions(+), 6 deletions(-)
net/bpf/test_run.c +12 -3
@@ -660,7 +660,7 @@ static void *bpf_test_init(const union bpf_attr *kattr, u32 user_size,void __user *data_in =u64_to_user_ptr (kattr->test.data_in);void *data; -if (user_size <ETH_HLEN || user_size >PAGE_SIZE - headroom - tailroom) +if (user_size >PAGE_SIZE - headroom - tailroom)return ERR_PTR (-EINVAL ); size =SKB_DATA_ALIGN (size);
@@ -995,6 +995,9 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr, kattr->test.cpu || kattr->test.batch_size)return -EINVAL ; +if (size <ETH_HLEN ) +return -EINVAL ; + data =bpf_test_init (kattr, kattr->test.data_size_in, size,NET_SKB_PAD +NET_IP_ALIGN ,SKB_DATA_ALIGN (sizeof (struct skb_shared_info )));
@@ -1200,7 +1203,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, {bool do_live = (kattr->test.flags &BPF_F_TEST_XDP_LIVE_FRAMES );u32 tailroom =SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); -u32 retval =0 , duration, max_linear_sz, size; +u32 retval =0 , meta_sz =0 , duration, max_linear_sz, size;u32 linear_sz = kattr->test.data_size_in;u32 batch_size = kattr->test.batch_size;u32 headroom =XDP_PACKET_HEADROOM ;
@@ -1239,13 +1242,16 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,if (ctx) {/* There can't be user provided data before the meta data */ -if (ctx->data_meta || ctx->data_end != kattr->test.data_size_in || +if (ctx->data_meta || ctx->data_end > kattr->test.data_size_in || ctx->data > ctx->data_end ||unlikely (xdp_metalen_invalid (ctx->data)) || (do_live && (kattr->test.data_out || kattr->test.ctx_out))) goto free_ctx;/* Meta data is allocated from the headroom */ headroom -= ctx->data; + + meta_sz = ctx->data; + linear_sz = ctx->data_end; } max_linear_sz =PAGE_SIZE - headroom - tailroom;
@@ -1255,6 +1261,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,if (do_live && kattr->test.data_size_in > linear_sz) goto free_ctx; +if (kattr->test.data_size_in - meta_sz <ETH_HLEN ) +return -EINVAL ; + data =bpf_test_init (kattr, linear_sz, max_linear_sz, headroom, tailroom);if (IS_ERR (data)) { ret =PTR_ERR (data);
tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c +1 -3
@@ -80,9 +80,7 @@ void test_xdp_context_test_run(void)/* Meta data must be 255 bytes or smaller */ test_xdp_context_error (prog_fd, opts,0 ,256 ,sizeof (data),0 ,0 ,0 ); -/* Total size of data must match data_end - data_meta */ -test_xdp_context_error (prog_fd, opts,0 ,sizeof (__u32), -sizeof (data) -1 ,0 ,0 ,0 ); +/* Total size of data must be data_end - data_meta or larger */ test_xdp_context_error (prog_fd, opts,0 ,sizeof (__u32),sizeof (data) +1 ,0 ,0 ,0 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 100/119 bpf, test_run: Subtract size of xdp_frame from allowed metadata size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit e558cca217790286e799a8baacd1610bda31b261 ]
The xdp_frame structure takes up part of the XDP frame headroom, limiting the size of the metadata. However, in bpf_test_run, we don't take this into account, which makes it possible for userspace to supply a metadata size that is too large (taking up the entire headroom).
If userspace supplies such a large metadata size in live packet mode, the xdp_update_frame_from_buff() call in xdp_test_run_init_page() call will fail, after which packet transmission proceeds with an uninitialised frame structure, leading to the usual Bad Stuff.
The commit in the Fixes tag fixed a related bug where the second check in xdp_update_frame_from_buff() could fail, but did not add any additional constraints on the metadata size. Complete the fix by adding an additional check on the metadata size. Reorder the checks slightly to make the logic clearer and add a comment.
--- net/bpf/test_run.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
net/bpf/test_run.c +13 -5
@@ -1230,8 +1230,6 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, batch_size =NAPI_POLL_WEIGHT ; else if (batch_size > TEST_XDP_MAX_BATCH) return -E2BIG; - - headroom +=sizeof (struct xdp_page_head ); }else if (batch_size) {return -EINVAL ; }
@@ -1244,16 +1242,26 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,/* There can't be user provided data before the meta data */ if (ctx->data_meta || ctx->data_end > kattr->test.data_size_in || ctx->data > ctx->data_end || -unlikely (xdp_metalen_invalid (ctx->data)) || (do_live && (kattr->test.data_out || kattr->test.ctx_out))) goto free_ctx; -/* Meta data is allocated from the headroom */ - headroom -= ctx->data; meta_sz = ctx->data; +if (xdp_metalen_invalid (meta_sz) || meta_sz > headroom -sizeof (struct xdp_frame )) + goto free_ctx; + +/* Meta data is allocated from the headroom */ + headroom -= meta_sz; linear_sz = ctx->data_end; } +/* The xdp_page_head structure takes up space in each page, limiting the +* size of the packet data; add the extra size to headroom here to make +* sure it's accounted in the length checks below, but not in the +* metadata size check above. +*/ +if (do_live) + headroom +=sizeof (struct xdp_page_head ); + max_linear_sz =PAGE_SIZE - headroom - tailroom; linear_sz =min_t (u32, linear_sz, max_linear_sz);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 101/119 bpf: Fix reference count leak in bpf_prog_test_run_xdp()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit ec69daabe45256f98ac86c651b8ad1b2574489a7 ]
syzbot is reporting
unregister_netdevice: waiting for sit0 to become free. Usage count = 2
problem. A debug printk() patch found that a refcount is obtained at xdp_convert_md_to_buff() from bpf_prog_test_run_xdp().
According to commit ec94670fcb3b ("bpf: Support specifying ingress via xdp_md context in BPF_PROG_TEST_RUN"), the refcount obtained by xdp_convert_md_to_buff() will be released by xdp_convert_buff_to_md().
Therefore, we can consider that the error handling path introduced by commit 1c1949982524 ("bpf: introduce frags support to bpf_prog_test_run_xdp()") forgot to call xdp_convert_buff_to_md().
--- net/bpf/test_run.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/bpf/test_run.c +4 -3
@@ -1299,13 +1299,13 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,if (sinfo->nr_frags ==MAX_SKB_FRAGS ) { ret = -ENOMEM ; - goto out; + goto out_put_dev; } page =alloc_page (GFP_KERNEL );if (!page) { ret = -ENOMEM ; - goto out; + goto out_put_dev; } frag = &sinfo->frags[sinfo->nr_frags++];
@@ -1317,7 +1317,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,if (copy_from_user (page_address (page), data_in + size, data_len)) { ret = -EFAULT ; - goto out; + goto out_put_dev; } sinfo->xdp_frags_size += data_len; size += data_len;
@@ -1332,6 +1332,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, ret =bpf_test_run_xdp_live (prog, &xdp, repeat, batch_size, &duration); else ret =bpf_test_run (prog, &xdp, repeat, &retval, &duration, true); +out_put_dev:/* We convert the xdp_buff back to an xdp_md before checking the return * code so the reference count of any held netdevice will be decremented * even if the test run failed.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 102/119 net: sfp: extend Potron XGSPON quirk to cover additional EEPROM variant
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcus Hughes <[email protected]>
[ Upstream commit 71cfa7c893a05d09e7dc14713b27a8309fd4a2db ]
Some Potron SFP+ XGSPON ONU sticks are shipped with different EEPROM vendor ID and vendor name strings, but are otherwise functionally identical to the existing "Potron SFP+ XGSPON ONU Stick" handled by sfp_quirk_potron().
These modules, including units distributed under the "Better Internet" branding, use the same UART pin assignment and require the same TX_FAULT/LOS behaviour and boot delay. Re-use the existing Potron quirk for this EEPROM variant.
--- drivers/net/phy/sfp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/sfp.c +2 -0
@@ -491,6 +491,8 @@ static const struct sfp_quirk sfp_quirks[] = {SFP_QUIRK ("ALCATELLUCENT" ,"3FE46541AA" , sfp_quirk_2500basex, sfp_fixup_nokia), +SFP_QUIRK_F ("BIDB" ,"X-ONU-SFPP" , sfp_fixup_potron), +// FLYPRO SFP-10GT-CS-30M uses Rollball protocol to talk to the PHY. SFP_QUIRK_F("FLYPRO", "SFP-10GT-CS-30M", sfp_fixup_rollball),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 103/119 powercap: fix race condition in register_control_type()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumeet Pawnikar <[email protected]>
[ Upstream commit 7bda1910c4bccd4b8d4726620bb3d6bbfb62286e ]
The device becomes visible to userspace via device_register() even before it fully initialized by idr_init(). If userspace or another thread tries to register a zone immediately after device_register(), the control_type_valid() will fail because the control_type is not yet in the list. The IDR is not yet initialized, so this race condition causes zone registration failure.
Move idr_init() and list addition before device_register() fix the race condition.
--- drivers/powercap/powercap_sys.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/powercap/powercap_sys.c +11 -5
@@ -625,17 +625,23 @@ struct powercap_control_type *powercap_register_control_type(INIT_LIST_HEAD (&control_type->node); control_type->dev.class = &powercap_class;dev_set_name (&control_type->dev,"%s" , name); - result =device_register (&control_type->dev); -if (result) { -put_device (&control_type->dev); -return ERR_PTR (result); - }idr_init (&control_type->idr);mutex_lock (&powercap_cntrl_list_lock);list_add_tail (&control_type->node, &powercap_cntrl_list);mutex_unlock (&powercap_cntrl_list_lock); + result =device_register (&control_type->dev); +if (result) { +mutex_lock (&powercap_cntrl_list_lock); +list_del (&control_type->node); +mutex_unlock (&powercap_cntrl_list_lock); + +idr_destroy (&control_type->idr); +put_device (&control_type->dev); +return ERR_PTR (result); + } +return control_type; }EXPORT_SYMBOL_GPL (powercap_register_control_type);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 104/119 powercap: fix sscanf() error return value handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumeet Pawnikar <[email protected]>
[ Upstream commit efc4c35b741af973de90f6826bf35d3b3ac36bf1 ]
Fix inconsistent error handling for sscanf() return value check.
Implicit boolean conversion is used instead of explicit return value checks. The code checks if (!sscanf(...)) which is incorrect because:
1. sscanf returns the number of successfully parsed items
2. On success, it returns 1 (one item passed)
3. On failure, it returns 0 or EOF
4. The check 'if (!sscanf(...))' is wrong because it treats success (1) as failure
All occurrences of sscanf() now uses explicit return value check. With this behavior it returns '-EINVAL' when parsing fails (returns 0 or EOF), and continues when parsing succeeds (returns 1).
--- drivers/powercap/powercap_sys.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/powercap/powercap_sys.c +3 -3
@@ -68,7 +68,7 @@ static ssize_t show_constraint_##_attr(struct device *dev, \int id; \struct powercap_zone_constraint *pconst;\ \ -if (!sscanf (dev_attr->attr.name,"constraint_%d_" , &id)) \ +if (sscanf (dev_attr->attr.name,"constraint_%d_" , &id) !=1 ) \return -EINVAL ; \if (id >= power_zone->const_id_cnt) \return -EINVAL ; \
@@ -93,7 +93,7 @@ static ssize_t store_constraint_##_attr(struct device *dev,\int id; \struct powercap_zone_constraint *pconst;\ \ -if (!sscanf (dev_attr->attr.name,"constraint_%d_" , &id)) \ +if (sscanf (dev_attr->attr.name,"constraint_%d_" , &id) !=1 ) \return -EINVAL ; \if (id >= power_zone->const_id_cnt) \return -EINVAL ; \
@@ -162,7 +162,7 @@ static ssize_t show_constraint_name(struct device *dev,ssize_t len = -ENODATA ;struct powercap_zone_constraint *pconst; -if (!sscanf (dev_attr->attr.name,"constraint_%d_" , &id)) +if (sscanf (dev_attr->attr.name,"constraint_%d_" , &id) !=1 )return -EINVAL ;if (id >= power_zone->const_id_cnt)return -EINVAL ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 105/119 netfilter: nf_tables: avoid chain re-validation if possible
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 8e1a1bc4f5a42747c08130b8242ebebd1210b32f ]
Hamza Mahfooz reports cpu soft lock-ups innft_chain_validate():
watchdog: BUG: soft lockup - CPU#1 stuck for 27s! [iptables-nft-re:37547] [..] RIP: 0010:nft_chain_validate+0xcb/0x110 [nf_tables] [..] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_immediate_validate+0x36/0x50 [nf_tables] nft_chain_validate+0xc9/0x110 [nf_tables] nft_table_validate+0x6b/0xb0 [nf_tables] nf_tables_validate+0x8b/0xa0 [nf_tables] nf_tables_commit+0x1df/0x1eb0 [nf_tables]
[..]
Currently nf_tables will traverse the entire table (chain graph), starting from the entry points (base chains), exploring all possible paths (chain jumps). But there are cases where we could avoid revalidation.
Consider:
1 input -> j2 -> j3 2 input -> j2 -> j3 3 input -> j1 -> j2 -> j3
Then the second rule does not need to revalidate j2, and, by extension j3, because this was already checked during validation of the first rule. We need to validate it only for rule 3.
This is needed because chain loop detection also ensures we do not exceed the jump stack: Just because we know that j2 is cycle free, its last jump might now exceed the allowed stack size. We also need to update all reachable chains with the new largest observed call depth.
Care has to be taken to revalidate even if the chain depth won't be an
issue: chain validation also ensures that expressions are not called from invalid base chains. For example, the masquerade expression can only be called from NAT postrouting base chains.
Therefore we also need to keep record of the base chain context (type, hooknum) and revalidate if the chain becomes reachable from a different hook location.
--- include/net/netfilter/nf_tables.h | 34 +++++++++++---- net/netfilter/nf_tables_api.c | 69 +++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 12 deletions(-)
include/net/netfilter/nf_tables.h +26 -8
@@ -1093,6 +1093,29 @@ struct nft_rule_blob { __attribute__((aligned(__alignof__(struct nft_rule_dp)))); }; +enum nft_chain_types { +NFT_CHAIN_T_DEFAULT =0 , +NFT_CHAIN_T_ROUTE , +NFT_CHAIN_T_NAT , +NFT_CHAIN_T_MAX +}; + +/** +* struct nft_chain_validate_state - validation state +* +* If a chain is encountered again during table validation it is +* possible to avoid revalidation provided the calling context is +* compatible. This structure stores relevant calling context of +* previous validations. +* +* @hook_mask: the hook numbers and locations the chain is linked to +* @depth: the deepest call chain level the chain is linked to +*/ +struct nft_chain_validate_state { +u8 hook_mask[NFT_CHAIN_T_MAX ]; +u8 depth; +}; +/** * struct nft_chain - nf_tables chain *
@@ -1111,6 +1134,7 @@ struct nft_rule_blob {* @udlen: user data length * @udata: user data in the chain * @blob_next: rule blob pointer to the next in the chain +* @vstate: validation state */ struct nft_chain {struct nft_rule_blob __rcu *blob_gen_0;
@@ -1130,9 +1154,10 @@ struct nft_chain {/* Only used during control plane commit phase: */ struct nft_rule_blob *blob_next; +struct nft_chain_validate_state vstate; }; -int nft_chain_validate (const struct nft_ctx *ctx,const struct nft_chain *chain); +int nft_chain_validate (const struct nft_ctx *ctx,struct nft_chain *chain);int nft_setelem_validate (const struct nft_ctx *ctx,struct nft_set *set,const struct nft_set_iter *iter,struct nft_elem_priv *elem_priv);
@@ -1140,13 +1165,6 @@ int nft_set_catchall_validate(const struct nft_ctx *ctx, struct nft_set *set);int nf_tables_bind_chain (const struct nft_ctx *ctx,struct nft_chain *chain);void nf_tables_unbind_chain (const struct nft_ctx *ctx,struct nft_chain *chain); -enum nft_chain_types { -NFT_CHAIN_T_DEFAULT =0 , -NFT_CHAIN_T_ROUTE , -NFT_CHAIN_T_NAT , -NFT_CHAIN_T_MAX -}; -/** * struct nft_chain_type - nf_tables chain type info *
net/netfilter/nf_tables_api.c +65 -4
117 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 106/119 ata: libata-core: Disable LPM on ST2000DM008-2FR102
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit ba624ba88d9f5c3e2ace9bb6697dbeb05b2dbc44 ]
According to a user report, the ST2000DM008-2FR102 has problems with LPM.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -4064,6 +4064,9 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = { {"ST3320[68]13AS" ,"SD1[5-9]" ,ATA_QUIRK_NONCQ | ATA_QUIRK_FIRMWARE_WARN }, +/* Seagate disks with LPM issues */ + { "ST2000DM008-2FR102", NULL, ATA_QUIRK_NOLPM }, +/* drives which fail FPDMA_AA activation (some may freeze afterwards) the ST disks also have LPM issues */ { "ST1000LM024 HN-M101MBB", NULL, ATA_QUIRK_BROKEN_FPDMA_AA |
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 107/119 drm/amd/display: Fix DP no audio issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charlene Liu <[email protected]>
[ Upstream commit 3886b198bd6e49c801fe9552fcfbfc387a49fbbc ]
[why]
need to enable APG_CLOCK_ENABLE enable first also need to wake up az from D3 before access az block
--- drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +4 -4
@@ -1096,13 +1096,13 @@ void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx)if (dc->current_state->res_ctx.pipe_ctx[i].stream_res.audio !=NULL ) num_audio++; } +if (num_audio >=1 && clk_mgr->funcs->enable_pme_wa) { +/*wake AZ from D3 first before access az endpoint*/ + clk_mgr->funcs->enable_pme_wa (clk_mgr); + } pipe_ctx->stream_res.audio->funcs->az_enable (pipe_ctx->stream_res.audio); -if (num_audio >=1 && clk_mgr->funcs->enable_pme_wa) -/*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ - clk_mgr->funcs->enable_pme_wa (clk_mgr); - link_hwss->enable_audio_packet (pipe_ctx);if (pipe_ctx->stream_res.audio)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 108/119 spi: mt65xx: Use IRQF_ONESHOT with threaded IRQ
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fei Shao <[email protected]>
[ Upstream commit 8c04b77f87e6e321ae6acd28ce1de5553916153f ]
This driver is migrated to use threaded IRQ since commit 5972eb05ca32 ("spi: spi-mt65xx: Use threaded interrupt for non-SPIMEM transfer"), and we almost always want to disable the interrupt line to avoid excess interrupts while the threaded handler is processing SPI transfer. Use IRQF_ONESHOT for that purpose.
In practice, we see MediaTek devices show SPI transfer timeout errors when communicating with ChromeOS EC in certain scenarios, and with IRQF_ONESHOT, the issue goes away.
--- drivers/spi/spi-mt65xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-mt65xx.c +1 -1
@@ -1266,7 +1266,7 @@ static int mtk_spi_probe(struct platform_device *pdev) ret =devm_request_threaded_irq (dev, irq, mtk_spi_interrupt, mtk_spi_interrupt_thread, -IRQF_TRIGGER_NONE ,dev_name (dev), host); +IRQF_ONESHOT ,dev_name (dev), host);if (ret)return dev_err_probe (dev, ret,"failed to register irq\n" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 109/119 drm/amdkfd: Fix improper NULL termination of queue restore SMI event string
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Kocoloski <[email protected]>
[ Upstream commit 969faea4e9d01787c58bab4d945f7ad82dad222d ]
Pass character "0" rather than NULL terminator to properly format queue restoration SMI events. Currently, the NULL terminator precedes the newline character that is intended to delineate separate events in the SMI event buffer, which can break userspace parsers.
--- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +1 -1
@@ -312,7 +312,7 @@ void kfd_smi_event_queue_restore(struct kfd_node *node, pid_t pid) {kfd_smi_event_add (pid, node,KFD_SMI_EVENT_QUEUE_RESTORE ,KFD_EVENT_FMT_QUEUE_RESTORE (ktime_get_boottime_ns (), pid, - node->id,0 )); + node->id,'0' )); }void kfd_smi_event_queue_restore_rescheduled (struct mm_struct *mm)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 110/119 can: j1939: make j1939_session_activate() fail if device is no longer registered
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 5d5602236f5db19e8b337a2cd87a90ace5ea776d ]
syzbot is still reporting
unregister_netdevice: waiting for vcan0 to become free. Usage count = 2
even after commit 93a27b5891b8 ("can: j1939: add missing calls in NETDEV_UNREGISTER notification handler") was added. A debug printk() patch found that j1939_session_activate() can succeed even after j1939_cancel_active_session() from j1939_netdev_notify(NETDEV_UNREGISTER) has completed.
Since j1939_cancel_active_session() is processed with the session list lock held, checking ndev->reg_state in j1939_session_activate() with the session list lock held can reliably close the race window.
--- net/can/j1939/transport.c | 2 ++ 1 file changed, 2 insertions(+)
net/can/j1939/transport.c +2 -0
@@ -1571,6 +1571,8 @@ int j1939_session_activate(struct j1939_session *session)if (active) {j1939_session_put (active); ret = -EAGAIN ; + }else if (priv->ndev->reg_state !=NETREG_REGISTERED ) { + ret = -ENODEV ; }else {WARN_ON_ONCE (session->state !=J1939_SESSION_NEW ); list_add_tail(&session->active_session_list_entry,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 111/119 ALSA: usb-audio: Update for native DSD support quirks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jussi Laako <[email protected]>
[ Upstream commit da3a7efff64ec0d63af4499eea3a46a2e13b5797 ]
Maintenance patch for native DSD support.
Add set of missing device and vendor quirks; TEAC, Esoteric, Luxman and Musical Fidelity.
--- sound/usb/quirks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/quirks.c +10 -0
@@ -2225,6 +2225,12 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x0644 ,0x806b ,/* TEAC UD-701 */ QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY |QUIRK_FLAG_IFACE_DELAY ), +DEVICE_FLG (0x0644 ,0x807d ,/* TEAC UD-507 */ +QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY | +QUIRK_FLAG_IFACE_DELAY ), +DEVICE_FLG (0x0644 ,0x806c ,/* Esoteric XD */ +QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY | +QUIRK_FLAG_IFACE_DELAY ),DEVICE_FLG (0x06f8 ,0xb000 ,/* Hercules DJ Console (Windows Edition) */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x06f8, 0xd002, /* Hercules DJ Console (Macintosh Edition) */
@@ -2377,6 +2383,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x30be ,0x0101 ,/* Schiit Hel */ QUIRK_FLAG_IGNORE_CTL_ERROR ), +DEVICE_FLG (0x3255 ,0x0000 ,/* Luxman D-10X */ +QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY ),DEVICE_FLG (0x339b ,0x3a07 ,/* Synaptics HONOR USB-C HEADSET */ QUIRK_FLAG_MIXER_MIN_MUTE ), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
@@ -2420,6 +2428,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_DSD_RAW),VENDOR_FLG (0x2622 ,/* IAG Limited devices */ QUIRK_FLAG_DSD_RAW ), +VENDOR_FLG (0x2772 ,/* Musical Fidelity devices */ +QUIRK_FLAG_DSD_RAW ),VENDOR_FLG (0x278b ,/* Rotel? */ QUIRK_FLAG_DSD_RAW ), VENDOR_FLG(0x292b, /* Gustard/Ess based devices */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 112/119 ASoC: amd: yc: Add quirk for Honor MagicBook X16 2025
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Elantsev <[email protected]>
[ Upstream commit e2cb8ef0372665854fca6fa7b30b20dd35acffeb ]
Add a DMI quirk for the Honor MagicBook X16 2025 laptop fixing the issue where the internal microphone was not detected.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -654,6 +654,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 C7UCX"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "HONOR"), + DMI_MATCH(DMI_PRODUCT_NAME, "GOH-X"), + } + }, {} };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 113/119 ALSA: hda/realtek: enable woofer speakers on Medion NM14LNL
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Vehmanen <[email protected]>
[ Upstream commit e64826e5e367ad45539ab245b92f009ee165025c ]
The ALC233 codec on these Medion NM14LNL (SPRCHRGD 14 S2) systems requires a quirk to enable all speakers.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -11350,6 +11350,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1d72 ,0x1901 ,"RedmiBook 14" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1d72 ,0x1945 ,"Redmi G" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1d72 ,0x1947 ,"RedmiBook Air" ,ALC255_FIXUP_XIAOMI_HEADSET_MIC ), +SND_PCI_QUIRK (0x1e39 ,0xca14 ,"MEDION NM14LNL" ,ALC233_FIXUP_MEDION_MTL_SPK ),SND_PCI_QUIRK (0x1ee7 ,0x2078 ,"HONOR BRB-X M1010" ,ALC2XX_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1f66 ,0x0105 ,"Ayaneo Portable Game Player" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 114/119 ASoC: fsl_sai: Add missing registers to cache default
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 90ed688792a6b7012b3e8a2f858bc3fe7454d0eb ]
Drivers does cache sync during runtime resume, setting all writable registers. Not all writable registers are set in cache default, resulting in the erorr message:
fsl-sai 30c30000.sai: using zero-initialized flat cache, this may cause unexpected behavior
Fix this by adding missing writable register defaults.
--- sound/soc/fsl/fsl_sai.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/fsl/fsl_sai.c +3 -0
@@ -1041,6 +1041,7 @@ static struct reg_default fsl_sai_reg_defaults_ofs0[] = { {FSL_SAI_TDR6, 0}, {FSL_SAI_TDR7, 0}, {FSL_SAI_TMR, 0}, + {FSL_SAI_TTCTL, 0}, {FSL_SAI_RCR1(0), 0}, {FSL_SAI_RCR2(0), 0}, {FSL_SAI_RCR3(0), 0},
@@ -1064,12 +1065,14 @@ static struct reg_default fsl_sai_reg_defaults_ofs8[] = { {FSL_SAI_TDR6, 0}, {FSL_SAI_TDR7, 0}, {FSL_SAI_TMR, 0}, + {FSL_SAI_TTCTL, 0}, {FSL_SAI_RCR1(8), 0}, {FSL_SAI_RCR2(8), 0}, {FSL_SAI_RCR3(8), 0}, {FSL_SAI_RCR4(8), 0}, {FSL_SAI_RCR5(8), 0}, {FSL_SAI_RMR, 0}, + {FSL_SAI_RTCTL, 0}, {FSL_SAI_MCTL, 0}, {FSL_SAI_MDIV, 0}, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 115/119 scsi: sg: Fix occasional bogus elapsed time that exceeds timeout
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Rábek <[email protected]>
[ Upstream commit 0e1677654259a2f3ccf728de1edde922a3c4ba57 ]
A race condition was found in sg_proc_debug_helper(). It was observed on a system using an IBM LTO-9 SAS Tape Drive (ULTRIUM-TD9) and monitoring /proc/scsi/sg/debug every second. A very large elapsed time would sometimes appear. This is caused by two race conditions.
We reproduced the issue with an IBM ULTRIUM-HH9 tape drive on an x86_64 architecture. A patched kernel was built, and the race condition could not be observed anymore after the application of this patch. A reproducer C program utilising the scsi_debug module was also built by Changhui Zhong and can be viewed here:
https://github.com/MichaelRabek/linux-tests/blob/master/drivers/scsi/sg/sg_race_trigger.c
The first race happens between the reading of hp->duration in sg_proc_debug_helper() and request completion in sg_rq_end_io(). The hp->duration member variable may hold either of two types of information:
#1 - The start time of the request. This value is present while
the request is not yet finished.
#2 - The total execution time of the request (end_time - start_time).
If sg_proc_debug_helper() executes *after* the value of hp->duration was changed from #1 to #2, but *before* srp->done is set to 1 in sg_rq_end_io(), a fresh timestamp is taken in the else branch, and the elapsed time (value type #2) is subtracted from a timestamp, which cannot yield a valid elapsed time (which is a type #2 value as well).
To fix this issue, the value of hp->duration must change under the protection of the sfp->rq_list_lock in sg_rq_end_io(). Since sg_proc_debug_helper() takes this read lock, the change to srp->done and srp->header.duration will happen atomically from the perspective of sg_proc_debug_helper() and the race condition is thus eliminated.
The second race condition happens between sg_proc_debug_helper() and sg_new_write(). Even though hp->duration is set to the current time stamp in sg_add_request() under the write lock's protection, it gets overwritten by a call to get_sg_io_hdr(), which calls copy_from_user() to copy struct sg_io_hdr from userspace into kernel space. hp->duration is set to the start time again in sg_common_write(). If sg_proc_debug_helper() is called between these two calls, an arbitrary value set by userspace (usually zero) is used to compute the elapsed time.
To fix this issue, hp->duration must be set to the current timestamp again after get_sg_io_hdr() returns successfully. A small race window still exists between get_sg_io_hdr() and setting hp->duration, but this window is only a few instructions wide and does not result in observable issues in practice, as confirmed by testing.
Additionally, we fix the format specifier from %d to %u for printing unsigned int values in sg_proc_debug_helper().
--- drivers/scsi/sg.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/scsi/sg.c +13 -7
@@ -731,6 +731,8 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,sg_remove_request (sfp, srp);return -EFAULT ; } + hp->duration =jiffies_to_msecs (jiffies); +if (hp->interface_id !='S' ) {sg_remove_request (sfp, srp);return -ENOSYS ;
@@ -815,7 +817,6 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,return -ENODEV ; } - hp->duration =jiffies_to_msecs (jiffies);if (hp->interface_id !='\0' &&/* v3 (or later) interface */ (SG_FLAG_Q_AT_TAIL & hp->flags)) at_head =0 ;
@@ -1339,9 +1340,6 @@ sg_rq_end_io(struct request *rq, blk_status_t status)"sg_cmd_done: pack_id=%d, res=0x%x\n" , srp->header.pack_id, result)); srp->header.resid = resid; - ms =jiffies_to_msecs (jiffies); - srp->header.duration = (ms > srp->header.duration) ? - (ms - srp->header.duration) :0 ;if (0 != result) {struct scsi_sense_hdr sshdr;
@@ -1390,6 +1388,9 @@ sg_rq_end_io(struct request *rq, blk_status_t status) done =0 ; } srp->done = done; + ms =jiffies_to_msecs (jiffies); + srp->header.duration = (ms > srp->header.duration) ? + (ms - srp->header.duration) :0 ;write_unlock_irqrestore (&sfp->rq_list_lock, iflags);if (likely (done)) {
@@ -2535,6 +2536,7 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)const sg_io_hdr_t *hp;const char * cp;unsigned int ms; +unsigned int duration; k =0 ;list_for_each_entry (fp, &sdp->sfds, sfd_siblings) {
@@ -2572,13 +2574,17 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)seq_printf (s," id=%d blen=%d" , srp->header.pack_id, blen);if (srp->done) -seq_printf (s," dur=%d" , hp->duration); +seq_printf (s," dur=%u" , hp->duration);else { ms =jiffies_to_msecs (jiffies); -seq_printf (s," t_o/elap=%d/%d" , + duration =READ_ONCE (hp->duration); +if (duration) + duration = (ms > duration ? + ms - duration :0 ); +seq_printf (s," t_o/elap=%u/%u" , (new_interface ? hp->timeout :jiffies_to_msecs (fp->timeout)), - (ms > hp->duration ? ms - hp->duration :0 )); + duration); }seq_printf (s,"ms sgat=%d op=0x%02x\n" , usg, (int ) srp->data.cmd_opcode);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 116/119 spi: cadence-quadspi: Prevent lost complete() call during indirect read
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Litwin <[email protected]>
[ Upstream commit d67396c9d697041b385d70ff2fd59cb07ae167e8 ]
A race condition exists between the read loop and IRQ complete() call. An interrupt could call the complete() between the inner loop and reinit_completion(), potentially losing the completion event and causing an unnecessary timeout. Moving reinit_completion() before the loop prevents this. A premature signal will only result in a spurious wakeup and another wait cycle, which is preferable to waiting for a timeout.
--- drivers/spi/spi-cadence-quadspi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +9 -1
@@ -758,6 +758,7 @@ static int cqspi_indirect_read_execute(struct cqspi_flash_pdata *f_pdata,readl (reg_base +CQSPI_REG_INDIRECTRD );/* Flush posted write. */ while (remaining >0 ) { + ret =0 ;if (use_irq && !wait_for_completion_timeout (&cqspi->transfer_complete,msecs_to_jiffies (CQSPI_READ_TIMEOUT_MS )))
@@ -770,6 +771,14 @@ static int cqspi_indirect_read_execute(struct cqspi_flash_pdata *f_pdata,if (cqspi->slow_sram)writel (0x0 , reg_base +CQSPI_REG_IRQMASK ); +/* +* Prevent lost interrupt and race condition by reinitializing early. +* A spurious wakeup and another wait cycle can occur here, +* which is preferable to waiting until timeout if interrupt is lost. +*/ +if (use_irq) +reinit_completion (&cqspi->transfer_complete); + bytes_to_read =cqspi_get_rd_sram_level (cqspi);if (ret && bytes_to_read ==0 ) {
@@ -802,7 +811,6 @@ static int cqspi_indirect_read_execute(struct cqspi_flash_pdata *f_pdata, }if (use_irq && remaining >0 ) { -reinit_completion (&cqspi->transfer_complete);if (cqspi->slow_sram)writel (CQSPI_REG_IRQ_WATERMARK , reg_base +CQSPI_REG_IRQMASK ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 117/119 tpm2-sessions: Fix out of range indexing in name_size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit 6e9722e9a7bfe1bbad649937c811076acf86e1fd upstream.
'name_size' does not have any range checks, and it just directly indexes with TPM_ALG_ID, which could lead into memory corruption at worst.
Address the issue by only processing known values and returning -EINVAL for unrecognized values.
Make also 'tpm_buf_append_name' and 'tpm_buf_fill_hmac_session' fallible so that errors are detected before causing any spurious TPM traffic.
End also the authorization session on failure in both of the functions, as the session state would be then by definition corrupted.
--- drivers/char/tpm/tpm2-cmd.c | 23 +++++- drivers/char/tpm/tpm2-sessions.c | 114 ++++++++++++++++++++---------- include/linux/tpm.h | 13 ++- security/keys/trusted-keys/trusted_tpm2.c | 29 ++++++- 4 files changed, 126 insertions(+), 53 deletions(-)
drivers/char/tpm/tpm2-cmd.c +19 -4
@@ -253,7 +253,11 @@ int tpm2_pcr_extend(struct tpm_chip *chi }if (!disable_pcr_integrity) { -tpm_buf_append_name (chip, &buf, pcr_idx,NULL ); + rc =tpm_buf_append_name (chip, &buf, pcr_idx,NULL ); +if (rc) { +tpm_buf_destroy (&buf); +return rc; + }tpm_buf_append_hmac_session (chip, &buf,0 ,NULL ,0 ); }else {tpm_buf_append_handle (chip, &buf, pcr_idx);
@@ -268,8 +272,14 @@ int tpm2_pcr_extend(struct tpm_chip *chi chip->allocated_banks[i].digest_size); } -if (!disable_pcr_integrity) -tpm_buf_fill_hmac_session (chip, &buf); +if (!disable_pcr_integrity) { + rc =tpm_buf_fill_hmac_session (chip, &buf); +if (rc) { +tpm_buf_destroy (&buf); +return rc; + } + } + rc =tpm_transmit_cmd (chip, &buf,0 ,"attempting extend a PCR value" );if (!disable_pcr_integrity) rc =tpm_buf_check_hmac_response (chip, &buf, rc);
@@ -327,7 +337,12 @@ int tpm2_get_random(struct tpm_chip *chi | TPM2_SA_CONTINUE_SESSION, NULL, 0);tpm_buf_append_u16 (&buf, num_bytes); -tpm_buf_fill_hmac_session (chip, &buf); + err =tpm_buf_fill_hmac_session (chip, &buf); +if (err) { +tpm_buf_destroy (&buf); +return err; + } + err = tpm_transmit_cmd(chip, &buf, offsetof(struct tpm2_get_random_out, buffer),
drivers/char/tpm/tpm2-sessions.c +76 -38
200 lines not on this page · raw message
include/linux/tpm.h +8 -5
@@ -523,8 +523,8 @@ static inline struct tpm2_auth *tpm2_chi#endif } -void tpm_buf_append_name (struct tpm_chip *chip,struct tpm_buf *buf, -u32 handle,u8 *name); +int tpm_buf_append_name (struct tpm_chip *chip,struct tpm_buf *buf, +u32 handle,u8 *name);void tpm_buf_append_hmac_session (struct tpm_chip *chip,struct tpm_buf *buf,u8 attributes,u8 *passphrase,int passphraselen);
@@ -557,7 +557,7 @@ static inline void tpm_buf_append_hmac_s#ifdef CONFIG_TCG_TPM2_HMAC int tpm2_start_auth_session (struct tpm_chip *chip); -void tpm_buf_fill_hmac_session (struct tpm_chip *chip,struct tpm_buf *buf); +int tpm_buf_fill_hmac_session (struct tpm_chip *chip,struct tpm_buf *buf);int tpm_buf_check_hmac_response (struct tpm_chip *chip,struct tpm_buf *buf,int rc);void tpm2_end_auth_session (struct tpm_chip *chip);
@@ -571,10 +571,13 @@ static inline int tpm2_start_auth_sessiostatic inline void tpm2_end_auth_session (struct tpm_chip *chip) { } -static inline void tpm_buf_fill_hmac_session (struct tpm_chip *chip, -struct tpm_buf *buf) + +static inline int tpm_buf_fill_hmac_session (struct tpm_chip *chip, +struct tpm_buf *buf) { +return 0 ; } +static inline int tpm_buf_check_hmac_response (struct tpm_chip *chip,struct tpm_buf *buf,int rc)
security/keys/trusted-keys/trusted_tpm2.c +23 -6
@@ -283,7 +283,10 @@ int tpm2_seal_trusted(struct tpm_chip *c goto out_put; } -tpm_buf_append_name (chip, &buf, options->keyhandle,NULL ); + rc =tpm_buf_append_name (chip, &buf, options->keyhandle,NULL ); +if (rc) + goto out; +tpm_buf_append_hmac_session (chip, &buf,TPM2_SA_DECRYPT , options->keyauth,TPM_DIGEST_SIZE );
@@ -331,7 +334,10 @@ int tpm2_seal_trusted(struct tpm_chip *c goto out; } -tpm_buf_fill_hmac_session (chip, &buf); + rc =tpm_buf_fill_hmac_session (chip, &buf); +if (rc) + goto out; + rc =tpm_transmit_cmd (chip, &buf,4 ,"sealing data" ); rc =tpm_buf_check_hmac_response (chip, &buf, rc);if (rc)
@@ -448,7 +454,10 @@ static int tpm2_load_cmd(struct tpm_chipreturn rc; } -tpm_buf_append_name (chip, &buf, options->keyhandle,NULL ); + rc =tpm_buf_append_name (chip, &buf, options->keyhandle,NULL ); +if (rc) + goto out; +tpm_buf_append_hmac_session (chip, &buf,0 , options->keyauth,TPM_DIGEST_SIZE );
@@ -460,7 +469,10 @@ static int tpm2_load_cmd(struct tpm_chip goto out; } -tpm_buf_fill_hmac_session (chip, &buf); + rc =tpm_buf_fill_hmac_session (chip, &buf); +if (rc) + goto out; + rc =tpm_transmit_cmd (chip, &buf,4 ,"loading blob" ); rc =tpm_buf_check_hmac_response (chip, &buf, rc);if (!rc)
@@ -508,7 +520,9 @@ static int tpm2_unseal_cmd(struct tpm_chreturn rc; } -tpm_buf_append_name (chip, &buf, blob_handle,NULL ); + rc =tpm_buf_append_name (chip, &buf, options->keyhandle,NULL ); +if (rc) + goto out;if (!options->policyhandle) { tpm_buf_append_hmac_session(chip, &buf, TPM2_SA_ENCRYPT,
@@ -533,7 +547,10 @@ static int tpm2_unseal_cmd(struct tpm_ch NULL, 0); } -tpm_buf_fill_hmac_session (chip, &buf); + rc =tpm_buf_fill_hmac_session (chip, &buf); +if (rc) + goto out; + rc =tpm_transmit_cmd (chip, &buf,6 ,"unsealing" ); rc =tpm_buf_check_hmac_response (chip, &buf, rc);if (rc >0 )
Greg Kroah-Hartman
maintainerPATCH 118/119 ALSA: hda: intel-dsp-config: Prefer legacy driver as fallback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 161a0c617ab172bbcda7ce61803addeb2124dbff upstream.
When config table entries don't match with the device to be probed, currently we fall back to SND_INTEL_DSP_DRIVER_ANY, which means to allow any drivers to bind with it.
This was set so with the assumption (or hope) that all controller drivers should cover the devices generally, but in practice, this caused a problem as reported recently. Namely, when a specific kconfig for SOF isn't set for the modern Intel chips like Alderlake, a wrong driver (AVS) got probed and failed. This is because we have entries like:
#if IS_ENABLED(CONFIG_SND_SOC_SOF_ALDERLAKE)
/* Alder Lake / Raptor Lake */
{
.flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_S,
},
....
#endif
so this entry is effective only when CONFIG_SND_SOC_SOF_ALDERLAKE is set. If not set, there is no matching entry, hence it returns SND_INTEL_DSP_DRIVER_ANY as fallback. OTOH, if the kconfig is set, it explicitly falls back to SND_INTEL_DSP_DRIVER_LEGACY when no DMIC or SoundWire is found -- that was the working scenario. That being said, the current setup may be broken for modern Intel chips that are supposed to work with either SOF or legacy driver when the corresponding kconfig were missing.
For addressing the problem above, this patch changes the fallback driver to the legacy driver, i.e. return SND_INTEL_DSP_DRIVER_LEGACY type as much as possible. When CONFIG_SND_HDA_INTEL is also disabled, the fallback is set to SND_INTEL_DSP_DRIVER_ANY type, just to be sure.
--- sound/hda/intel-dsp-config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/hda/intel-dsp-config.c +2 -1
@@ -676,7 +676,8 @@ int snd_intel_dsp_driver_probe(struct pc/* find the configuration for the specific device */ cfg =snd_intel_dsp_find_config (pci, config_table,ARRAY_SIZE (config_table));if (!cfg) -return SND_INTEL_DSP_DRIVER_ANY ; +return IS_ENABLED (CONFIG_SND_HDA_INTEL ) ? +SND_INTEL_DSP_DRIVER_LEGACY :SND_INTEL_DSP_DRIVER_ANY ;if (cfg->flags &FLAG_SOF ) { if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE &&
Greg Kroah-Hartman
maintainerPATCH 119/119 bpf: test_run: Fix ctx leak in bpf_prog_test_run_xdp error path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shardul Bankar <[email protected]>
commit 7f9ee5fc97e14682e36fe22ae2654c07e4998b82 upstream.
Fix a memory leak in bpf_prog_test_run_xdp() where the context buffer allocated by bpf_ctx_init() is not freed when the function returns early due to a data size check.
On the failing path:
ctx = bpf_ctx_init(...);
if (kattr->test.data_size_in - meta_sz < ETH_HLEN)
return -EINVAL;
The early return bypasses the cleanup label that kfree()s ctx, leading to a leak detectable by kmemleak under fuzzing. Change the return to jump to the existing free_ctx label.
--- net/bpf/test_run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpf/test_run.c +1 -1
@@ -1270,7 +1270,7 @@ int bpf_prog_test_run_xdp(struct bpf_pro goto free_ctx;if (kattr->test.data_size_in - meta_sz <ETH_HLEN ) -return -EINVAL ; + goto free_ctx; data =bpf_test_init (kattr, linear_sz, max_linear_sz, headroom, tailroom);if (IS_ERR (data)) {
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.12.66-rc1-g4c3a44fdb97c #1 SMP PREEMPT_DYNAMIC Thu Jan 15 18:02:40 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
6.12.66-rc1 built and run on my x86_64 test system (AMD Ryzen 9 9900X, System76 thelio-mira-r4-n3). No errors or regressions.
Thanks,
Slade
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Compiled and tested on
- Verdin AM62
- Verdin iMX8MP
Francesco
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
120 tests: 120 pass, 0 failLinux version: 6.12.66-rc1-g4c3a44fdb97c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Am 15.01.2026 um 17:46 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.12.66-rc1 on x86 and arm64 Azure VM.
Thanks,
Hardik
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.66-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Builds successfully. Boots and works on qemu and Dell XPS 15 9520 w/ Intel Core i7-12600H
Thanks,
Brett
Quoted 8 lines · On Thu, 15 Jan 2026 17:46:55 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.12.66 release. There are 119 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 17 Jan 2026 16:41:26 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
Thanks!
Cheers,
Miguel
hello
Compiled and booted 6.12.66-rc1+
dmesg -l err shows error. File attached.
As per dmidecode command.
Version: AMD Ryzen 3 3250U with Radeon Graphics
Processor Information
Socket Designation: FP5
Type: Central Processor
Family: Zen
Manufacturer: Advanced Micro Devices, Inc.
ID: 81 0F 81 00 FF FB 8B 17
Signature: Family 23, Model 24, Stepping 1
--
software engineer
rajagiri school of engineering and technology
[ 23.536409] ee1004 3-0050: probe with driver ee1004 failed with error -5