6.1.127-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 6.1.127-rc1 review
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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 Thu, 23 Jan 2025 17:45:02 +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.1.127-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.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.1.127-rc1
Wang Liang <[email protected]>
net: fix data-races around sk->sk_forward_alloc
Juergen Gross <[email protected]>
x86/xen: fix SLS mitigation in xen_hypercall_iret()
Youzhong Yang <[email protected]>
nfsd: add list_head nf_gc to struct nfsd_file
Gao Xiang <[email protected]>
erofs: handle NONHEAD !delta[1] lclusters gracefully
Gao Xiang <[email protected]>
erofs: tidy up EROFS on-disk naming
Kang Yang <[email protected]>
wifi: ath10k: avoid NULL pointer error during sdio remove
Greg Kroah-Hartman <[email protected]>
Revert "regmap: detach regmap from dev on regmap_exit"
Suraj Sonawane <[email protected]>
scsi: sg: Fix slab-use-after-free read in sg_release()
Zhu Yanjun <[email protected]>
RDMA/rxe: Fix the qp flush warnings in req
Greg Kroah-Hartman <[email protected]>
Revert "drm/amdgpu: rework resume handling for display (v2)"
Yu Kuai <[email protected]>
block: fix uaf for flush rq while iterating tags
Vitaly Prosyak <[email protected]>
drm/amdgpu: fix usage slab after free
Srinivasan Shanmugam <[email protected]>
drm/amd/display: Fix out-of-bounds access in 'dcn21_link_encoder_create'
Javier Carrasco <[email protected]>
iio: adc: rockchip_saradc: fix information leak in triggered buffer
Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: fix spi burst write not supported
Terry Tritton <[email protected]>
Revert "PCI: Use preserve_config in place of pci_flags"
Ville Syrjälä <[email protected]>
drm/i915/fb: Relax clear color alignment to 64 bytes
Koichiro Den <[email protected]>
hrtimers: Handle CPU state correctly on hotplug
Tomas Krcka <[email protected]>
irqchip/gic-v3-its: Don't enable interrupts in its_irq_set_vcpu_affinity()
Yogesh Lal <[email protected]>
irqchip/gic-v3: Handle CPU_PM_ENTER_FAILED correctly
Joe Hattori <[email protected]>
irqchip: Plug a OF node reference leak in platform_irqchip_probe()
Xiaolei Wang <[email protected]>
pmdomain: imx8mp-blk-ctrl: add missing loop break condition
Zhongqiu Han <[email protected]>
gpiolib: cdev: Fix use after free in lineinfo_changed_notify
Rik van Riel <[email protected]>
fs/proc: fix softlockup in __read_vmcore (part 2)
Marco Nelissen <[email protected]>
filemap: avoid truncating 64-bit offset to 32 bits
Stefano Garzarella <[email protected]>
vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]
Stefano Garzarella <[email protected]>
vsock: reset socket state when de-assigning the transport
Stefano Garzarella <[email protected]>
vsock/virtio: cancel close work in the destructor
Stefano Garzarella <[email protected]>
vsock/virtio: discard packets if the transport changes
Heiner Kallweit <[email protected]>
net: ethernet: xgbe: re-add aneg to supported features in PHY quirks
Paolo Abeni <[email protected]>
selftests: mptcp: avoid spurious errors on disconnect
Paolo Abeni <[email protected]>
mptcp: be sure to send ack when mptcp-level window re-opens
Kairui Song <[email protected]>
zram: fix potential UAF of zram table
Stefan Binding <[email protected]>
ALSA: hda/realtek: Add support for Ayaneo System using CS35L41 HDA
Juergen Gross <[email protected]>
x86/asm: Make serialize() always_inline
Oleg Nesterov <[email protected]>
poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Marco Nelissen <[email protected]>
iomap: avoid avoid truncating 64-bit offset to 32 bits
Hans de Goede <[email protected]>
ACPI: resource: acpi_dev_irq_override(): Check DMI match last
Jakub Kicinski <[email protected]>
selftests: tc-testing: reduce rshift value
Manivannan Sadhasivam <[email protected]>
scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
Max Kellermann <[email protected]>
cachefiles: Parse the "secctx" immediately
David Howells <[email protected]>
kheaders: Ignore silly-rename files
Zhang Kunbo <[email protected]>
fs: fix missing declaration of init_files
Leo Stone <[email protected]>
hfs: Sanity check the root record
Lizhi Xu <[email protected]>
mac802154: check local interfaces before deleting sdata list
Luis Chamberlain <[email protected]>
nvmet: propagate npwg topology
Wolfram Sang <[email protected]>
i2c: rcar: fix NACK handling when being a target
Wolfram Sang <[email protected]>
i2c: mux: demux-pinctrl: check initial mux selection, too
Pratyush Yadav <[email protected]>
Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data"
David Lechner <[email protected]>
hwmon: (tmp513) Fix division of negative numbers
Maíra Canal <[email protected]>
drm/v3d: Ensure job pointer is set to NULL after job completion
Mark Zhang <[email protected]>
net/mlx5: Clear port select structure when fail to create
Patrisious Haddad <[email protected]>
net/mlx5: Fix RDMA TX steering prio
Sean Anderson <[email protected]>
net: xilinx: axienet: Fix IRQ coalescing packet count overflow
Dan Carpenter <[email protected]>
nfp: bpf: prevent integer overflow in nfp_bpf_event_output()
Kuniyuki Iwashima <[email protected]>
gtp: Destroy device along with udp socket's netns dismantle.
Kuniyuki Iwashima <[email protected]>
gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp().
Eric Dumazet <[email protected]>
gtp: use exit_batch_rtnl() method
Eric Dumazet <[email protected]>
net: add exit_batch_rtnl() method
Artem Chernyshev <[email protected]>
pktgen: Avoid out-of-bounds access in get_imix_entries
Ilya Maximets <[email protected]>
openvswitch: fix lockup on tx to unregistering netdev with carrier
Michal Luczaj <[email protected]>
bpf: Fix bpf_sk_select_reuseport() memory leak
Sudheer Kumar Doredla <[email protected]>
net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()
-------------
Diffstat:
Makefile | 4 +- arch/x86/include/asm/special_insns.h | 2 +- arch/x86/xen/xen-asm.S | 2 +- block/blk-sysfs.c | 6 +- block/genhd.c | 9 +- drivers/acpi/resource.c | 6 +- drivers/base/regmap/regmap.c | 12 -- drivers/block/zram/zram_drv.c | 1 + drivers/gpio/gpiolib-cdev.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 +------ drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 6 +- .../gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- drivers/gpu/drm/i915/display/intel_fb.c | 2 +- drivers/gpu/drm/v3d/v3d_irq.c | 4 + drivers/hwmon/tmp513.c | 7 +- drivers/i2c/busses/i2c-rcar.c | 20 ++- drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 +- drivers/iio/adc/rockchip_saradc.c | 2 + drivers/iio/imu/inv_icm42600/inv_icm42600.h | 1 + drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 18 ++- drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 3 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 +- drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/irqchip/irq-gic-v3.c | 2 +- drivers/irqchip/irqchip.c | 4 +- drivers/mtd/spi-nor/core.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 19 +-- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 1 + .../net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 4 +- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 3 +- drivers/net/ethernet/ti/cpsw_ale.c | 14 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 + drivers/net/gtp.c | 42 +++--- drivers/net/wireless/ath/ath10k/sdio.c | 4 +- drivers/nvme/target/io-cmd-bdev.c | 2 +- drivers/pci/controller/pci-host-common.c | 4 + drivers/pci/probe.c | 20 +-- drivers/scsi/sg.c | 2 +- drivers/soc/imx/imx8mp-blk-ctrl.c | 2 +- drivers/ufs/core/ufshcd.c | 9 +- fs/cachefiles/daemon.c | 14 +- fs/cachefiles/internal.h | 3 +- fs/cachefiles/security.c | 6 +- fs/erofs/erofs_fs.h | 143 +++++++++------------ fs/erofs/zmap.c | 133 ++++++++++--------- fs/file.c | 1 + fs/hfs/super.c | 4 +- fs/iomap/buffered-io.c | 2 +- fs/nfsd/filecache.c | 18 +-- fs/nfsd/filecache.h | 1 + fs/proc/vmcore.c | 2 + include/linux/hrtimer.h | 1 + include/linux/poll.h | 10 +- include/net/net_namespace.h | 3 + kernel/cpu.c | 2 +- kernel/gen_kheaders.sh | 1 + kernel/time/hrtimer.c | 11 +- mm/filemap.c | 2 +- net/core/filter.c | 30 +++-- net/core/net_namespace.c | 31 ++++- net/core/pktgen.c | 6 +- net/dccp/ipv6.c | 2 +- net/ipv6/tcp_ipv6.c | 4 +- net/mac802154/iface.c | 4 + net/mptcp/options.c | 6 +- net/openvswitch/actions.c | 4 +- net/vmw_vsock/af_vsock.c | 18 +++ net/vmw_vsock/virtio_transport_common.c | 38 ++++-- sound/pci/hda/patch_realtek.c | 1 + tools/testing/selftests/net/mptcp/mptcp_connect.c | 43 +++++-- .../tc-testing/tc-tests/filters/flow.json | 4 +- 71 files changed, 477 insertions(+), 379 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/64 net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudheer Kumar Doredla <[email protected]>
[ Upstream commit 03d120f27d050336f7e7d21879891542c4741f81 ]
CPSW ALE has 75-bit ALE entries stored across three 32-bit words. The cpsw_ale_get_field() and cpsw_ale_set_field() functions support ALE field entries spanning up to two words at the most.
The cpsw_ale_get_field() and cpsw_ale_set_field() functions work as expected when ALE field spanned across word1 and word2, but fails when ALE field spanned across word2 and word3.
For example, while reading the ALE field spanned across word2 and word3 (i.e. bits 62 to 64), the word3 data shifted to an incorrect position due to the index becoming zero while flipping.
The same issue occurred when setting an ALE entry.
This issue has not been seen in practice but will be an issue in the future if the driver supports accessing ALE fields spanning word2 and word3
Fix the methods to handle getting/setting fields spanning up to two words.
--- drivers/net/ethernet/ti/cpsw_ale.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/ti/cpsw_ale.c +7 -7
@@ -106,15 +106,15 @@ struct cpsw_ale_dev_id {static inline int cpsw_ale_get_field (u32 *ale_entry,u32 start,u32 bits) { -int idx, idx2; +int idx, idx2, index;u32 hi_val =0 ; idx = start /32 ; idx2 = (start + bits -1 ) /32 ;/* Check if bits to be fetched exceed a word */ if (idx != idx2) { - idx2 =2 - idx2;/* flip */ - hi_val = ale_entry[idx2] << ((idx2 *32 ) - start); + index =2 - idx2;/* flip */ + hi_val = ale_entry[index] << ((idx2 *32 ) - start); } start -= idx *32 ; idx =2 - idx;/* flip */
@@ -124,16 +124,16 @@ static inline int cpsw_ale_get_field(u32 *ale_entry, u32 start, u32 bits)static inline void cpsw_ale_set_field (u32 *ale_entry,u32 start,u32 bits,u32 value) { -int idx, idx2; +int idx, idx2, index; value &=BITMASK (bits); idx = start /32 ; idx2 = (start + bits -1 ) /32 ;/* Check if bits to be set exceed a word */ if (idx != idx2) { - idx2 =2 - idx2;/* flip */ - ale_entry[idx2] &= ~(BITMASK (bits + start - (idx2 *32 ))); - ale_entry[idx2] |= (value >> ((idx2 *32 ) - start)); + index =2 - idx2;/* flip */ + ale_entry[index] &= ~(BITMASK (bits + start - (idx2 *32 ))); + ale_entry[index] |= (value >> ((idx2 *32 ) - start)); } start -= idx *32 ; idx =2 - idx;/* flip */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 2/64 bpf: Fix bpf_sk_select_reuseport() memory leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit b3af60928ab9129befa65e6df0310d27300942bf ]
As pointed out in the original comment, lookup in sockmap can return a TCP ESTABLISHED socket. Such TCP socket may have had SO_ATTACH_REUSEPORT_EBPF set before it was ESTABLISHED. In other words, a non-NULL sk_reuseport_cb does not imply a non-refcounted socket.
Drop sk's reference in both error paths.
unreferenced object 0xffff888101911800 (size 2048):
comm "test_progs", pid 44109, jiffies 4297131437 hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 9336483b):
__kmalloc_noprof+0x3bf/0x560
__reuseport_alloc+0x1d/0x40
reuseport_alloc+0xca/0x150
reuseport_attach_prog+0x87/0x140
sk_reuseport_attach_bpf+0xc8/0x100
sk_setsockopt+0x1181/0x1990
do_sock_setsockopt+0x12b/0x160
__sys_setsockopt+0x7b/0xc0
__x64_sys_setsockopt+0x1b/0x30
do_syscall_64+0x93/0x180
entry_SYSCALL_64_after_hwframe+0x76/0x7e--- net/core/filter.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
net/core/filter.c +18 -12
@@ -11109,6 +11109,7 @@ BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,bool is_sockarray = map->map_type ==BPF_MAP_TYPE_REUSEPORT_SOCKARRAY ;struct sock_reuseport *reuse;struct sock *selected_sk; +int err; selected_sk = map->ops->map_lookup_elem (map, key);if (!selected_sk)
@@ -11116,10 +11117,6 @@ BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern, reuse =rcu_dereference (selected_sk->sk_reuseport_cb);if (!reuse) { -/* Lookup in sock_map can return TCP ESTABLISHED sockets. */ -if (sk_is_refcounted (selected_sk)) -sock_put (selected_sk); -/* reuseport_array has only sk with non NULL sk_reuseport_cb. * The only (!reuse) case here is - the sk has already been * unhashed (e.g. by close()), so treat it as -ENOENT.
@@ -11127,24 +11124,33 @@ BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,* Other maps (e.g. sock_map) do not provide this guarantee and * the sk may never be in the reuseport group to begin with. */ -return is_sockarray ? -ENOENT : -EINVAL ; + err = is_sockarray ? -ENOENT : -EINVAL ; + goto error; }if (unlikely (reuse->reuseport_id != reuse_kern->reuseport_id)) {struct sock *sk = reuse_kern->sk; -if (sk->sk_protocol != selected_sk->sk_protocol) -return -EPROTOTYPE ; -else if (sk->sk_family != selected_sk->sk_family) -return -EAFNOSUPPORT ; - -/* Catch all. Likely bound to a different sockaddr. */ -return -EBADFD ; +if (sk->sk_protocol != selected_sk->sk_protocol) { + err = -EPROTOTYPE ; + }else if (sk->sk_family != selected_sk->sk_family) { + err = -EAFNOSUPPORT ; + }else { +/* Catch all. Likely bound to a different sockaddr. */ + err = -EBADFD ; + } + goto error; } reuse_kern->selected_sk = selected_sk;return 0 ; +error: +/* Lookup in sock_map can return TCP ESTABLISHED sockets. */ +if (sk_is_refcounted (selected_sk)) +sock_put (selected_sk); + +return err; }static const struct bpf_func_proto sk_select_reuseport_proto = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/64 openvswitch: fix lockup on tx to unregistering netdev with carrier
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 47e55e4b410f7d552e43011baa5be1aab4093990 ]
Commit in a fixes tag attempted to fix the issue in the following sequence of calls:
do_output
-> ovs_vport_send
-> dev_queue_xmit
-> __dev_queue_xmit
-> netdev_core_pick_tx
-> skb_tx_hashWhen device is unregistering, the 'dev->real_num_tx_queues' goes to zero and the 'while (unlikely(hash >= qcount))' loop inside the 'skb_tx_hash' becomes infinite, locking up the core forever.
But unfortunately, checking just the carrier status is not enough to fix the issue, because some devices may still be in unregistering state while reporting carrier status OK.
One example of such device is a net/dummy. It sets carrier ON on start, but it doesn't implement .ndo_stop to set the carrier off. And it makes sense, because dummy doesn't really have a carrier. Therefore, while this device is unregistering, it's still easy to hit the infinite loop in the skb_tx_hash() from the OVS datapath. There might be other drivers that do the same, but dummy by itself is important for the OVS ecosystem, because it is frequently used as a packet sink for tcpdump while debugging OVS deployments. And when the issue is hit, the only way to recover is to reboot.
Fix that by also checking if the device is running. The running state is handled by the net core during unregistering, so it covers unregistering case better, and we don't really need to send packets to devices that are not running anyway.
While only checking the running state might be enough, the carrier check is preserved. The running and the carrier states seem disjoined throughout the code and different drivers. And other core functions like __dev_direct_xmit() check both before attempting to transmit a packet. So, it seems safer to check both flags in OVS as well.
--- net/openvswitch/actions.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/openvswitch/actions.c +3 -1
@@ -913,7 +913,9 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, {struct vport *vport =ovs_vport_rcu (dp, out_port); -if (likely (vport &&netif_carrier_ok (vport->dev))) { +if (likely (vport && +netif_running (vport->dev) && +netif_carrier_ok (vport->dev))) {u16 mru =OVS_CB (skb)->mru;u32 cutlen =OVS_CB (skb)->cutlen;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/64 pktgen: Avoid out-of-bounds access in get_imix_entries
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Chernyshev <[email protected]>
[ Upstream commit 76201b5979768500bca362871db66d77cb4c225e ]
Passing a sufficient amount of imix entries leads to invalid access to the pkt_dev->imix_entries array because of the incorrect boundary check.
UBSAN: array-index-out-of-bounds in net/core/pktgen.c:874:24 index 20 is out of range for type 'imix_pkt [20]' CPU: 2 PID: 1210 Comm: bash Not tainted 6.10.0-rc1 #121 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: <TASK> dump_stack_lvl lib/dump_stack.c:117 __ubsan_handle_out_of_bounds lib/ubsan.c:429 get_imix_entries net/core/pktgen.c:874 pktgen_if_write net/core/pktgen.c:1063 pde_write fs/proc/inode.c:334 proc_reg_write fs/proc/inode.c:346 vfs_write fs/read_write.c:593 ksys_write fs/read_write.c:644 do_syscall_64 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe arch/x86/entry/entry_64.S:130
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/core/pktgen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/pktgen.c +3 -3
@@ -850,6 +850,9 @@ static ssize_t get_imix_entries(const char __user *buffer,unsigned long weight;unsigned long size; +if (pkt_dev->n_imix_entries >=MAX_IMIX_ENTRIES ) +return -E2BIG ; + len =num_arg (&buffer[i], max_digits, &size);if (len <0 )return len;
@@ -879,9 +882,6 @@ static ssize_t get_imix_entries(const char __user *buffer, i++; pkt_dev->n_imix_entries++; - -if (pkt_dev->n_imix_entries >MAX_IMIX_ENTRIES ) -return -E2BIG ; }while (c ==' ' );return i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/64 net: add exit_batch_rtnl() method
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit fd4f101edbd9f99567ab2adb1f2169579ede7c13 ]
Many (struct pernet_operations)->exit_batch() methods have to acquire rtnl.
In presence of rtnl mutex pressure, this makes cleanup_net() very slow.
This patch adds a new exit_batch_rtnl() method to reduce number of rtnl acquisitions from cleanup_net().
exit_batch_rtnl() handlers are called while rtnl is locked, and devices to be killed can be queued in a list provided as their second argument.
A single unregister_netdevice_many() is called right before rtnl is released.
exit_batch_rtnl() handlers are called before ->exit() and ->exit_batch() handlers.
Stable-dep-of: 46841c7053e6 ("gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp().")
--- include/net/net_namespace.h | 3 +++ net/core/net_namespace.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-)
include/net/net_namespace.h +3 -0
@@ -426,6 +426,9 @@ struct pernet_operations {void (*pre_exit)(struct net *net);void (*exit)(struct net *net);void (*exit_batch)(struct list_head *net_exit_list); +/* Following method is called with RTNL held. */ +void (*exit_batch_rtnl)(struct list_head *net_exit_list, +struct list_head *dev_kill_list);unsigned int *id;size_t size; };
net/core/net_namespace.c +30 -1
@@ -314,8 +314,9 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns) {/* Must be called with pernet_ops_rwsem held */ const struct pernet_operations *ops, *saved_ops; -int error =0 ;LIST_HEAD (net_exit_list); +LIST_HEAD (dev_kill_list); +int error =0 ;refcount_set (&net->ns.count,1 );ref_tracker_dir_init (&net->refcnt_tracker,128 );
@@ -353,6 +354,15 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)synchronize_rcu (); + ops = saved_ops; +rtnl_lock (); +list_for_each_entry_continue_reverse (ops, &pernet_list, list) { +if (ops->exit_batch_rtnl) + ops->exit_batch_rtnl (&net_exit_list, &dev_kill_list); + } +unregister_netdevice_many (&dev_kill_list); +rtnl_unlock (); + ops = saved_ops;list_for_each_entry_continue_reverse (ops, &pernet_list, list)ops_exit_list (ops, &net_exit_list);
@@ -576,6 +586,7 @@ static void cleanup_net(struct work_struct *work)struct net *net, *tmp, *last;struct llist_node *net_kill_list;LIST_HEAD (net_exit_list); +LIST_HEAD (dev_kill_list);/* Atomically snapshot the list of namespaces to cleanup */ net_kill_list =llist_del_all (&cleanup_list);
@@ -616,6 +627,14 @@ static void cleanup_net(struct work_struct *work)*/ synchronize_rcu (); +rtnl_lock (); +list_for_each_entry_reverse (ops, &pernet_list, list) { +if (ops->exit_batch_rtnl) + ops->exit_batch_rtnl (&net_exit_list, &dev_kill_list); + } +unregister_netdevice_many (&dev_kill_list); +rtnl_unlock (); +/* Run all of the network namespace exit methods */ list_for_each_entry_reverse (ops, &pernet_list, list)ops_exit_list (ops, &net_exit_list);
@@ -1159,7 +1178,17 @@ static void free_exit_list(struct pernet_operations *ops, struct list_head *net_ {ops_pre_exit_list (ops, net_exit_list);synchronize_rcu (); + +if (ops->exit_batch_rtnl) { +LIST_HEAD (dev_kill_list); + +rtnl_lock (); + ops->exit_batch_rtnl (net_exit_list, &dev_kill_list); +unregister_netdevice_many (&dev_kill_list); +rtnl_unlock (); + }ops_exit_list (ops, net_exit_list); +ops_free_list (ops, net_exit_list); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/64 gtp: use exit_batch_rtnl() method
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6eedda01b2bfdcf427b37759e053dc27232f3af1 ]
exit_batch_rtnl() is called while RTNL is held,
and devices to be unregistered can be queued in the dev_kill_list.
This saves one rtnl_lock()/rtnl_unlock() pair per netns and one unregister_netdevice_many() call per netns.
Stable-dep-of: 46841c7053e6 ("gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp().")
--- drivers/net/gtp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/gtp.c +10 -10
@@ -1883,23 +1883,23 @@ static int __net_init gtp_net_init(struct net *net)return 0 ; } -static void __net_exit gtp_net_exit(struct net *net) +static void __net_exit gtp_net_exit_batch_rtnl(struct list_head *net_list, +struct list_head *dev_to_kill) { -struct gtp_net *gn =net_generic (net, gtp_net_id); -struct gtp_dev *gtp; -LIST_HEAD (list); +struct net *net; -rtnl_lock (); -list_for_each_entry (gtp, &gn->gtp_dev_list, list) -gtp_dellink (gtp->dev, &list); +list_for_each_entry (net, net_list, exit_list) { +struct gtp_net *gn =net_generic (net, gtp_net_id); +struct gtp_dev *gtp; -unregister_netdevice_many (&list); -rtnl_unlock (); +list_for_each_entry (gtp, &gn->gtp_dev_list, list) +gtp_dellink (gtp->dev, dev_to_kill); + } }static struct pernet_operations gtp_net_ops = { .init = gtp_net_init, - .exit = gtp_net_exit, + .exit_batch_rtnl = gtp_net_exit_batch_rtnl, .id = >p_net_id, .size =sizeof (struct gtp_net ), };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/64 gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 46841c7053e6d25fb33e0534ef023833bf03e382 ]
gtp_newlink() links the gtp device to a list in dev_net(dev).
However, even after the gtp device is moved to another netns, it stays on the list but should be invisible.
Let's use for_each_netdev_rcu() for netdev traversal in gtp_genl_dump_pdp().
Note that gtp_dev_list is no longer used under RCU, so list helpers are converted to the non-RCU variant.
--- drivers/net/gtp.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/net/gtp.c +11 -8
@@ -1095,7 +1095,7 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev, } gn =net_generic (dev_net (dev), gtp_net_id); -list_add_rcu (>p->list, &gn->gtp_dev_list); +list_add (>p->list, &gn->gtp_dev_list); dev->priv_destructor = gtp_destructor;netdev_dbg (dev,"registered new GTP interface\n" );
@@ -1121,7 +1121,7 @@ static void gtp_dellink(struct net_device *dev, struct list_head *head)hlist_for_each_entry_safe (pctx, next, >p->tid_hash[i], hlist_tid)pdp_context_delete (pctx); -list_del_rcu (>p->list); +list_del (>p->list);unregister_netdevice_queue (dev, head); }
@@ -1689,16 +1689,19 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2 ], *gtp;int i, j, bucket = cb->args[0 ], skip = cb->args[1 ];struct net *net =sock_net (skb->sk); +struct net_device *dev;struct pdp_ctx *pctx; -struct gtp_net *gn; - - gn =net_generic (net, gtp_net_id);if (cb->args[4 ])return 0 ;rcu_read_lock (); -list_for_each_entry_rcu (gtp, &gn->gtp_dev_list, list) { +for_each_netdev_rcu (net, dev) { +if (dev->rtnl_link_ops != >p_link_ops) +continue ; + + gtp =netdev_priv (dev); +if (last_gtp && last_gtp != gtp)continue ;else
@@ -1890,9 +1893,9 @@ static void __net_exit gtp_net_exit_batch_rtnl(struct list_head *net_list,list_for_each_entry (net, net_list, exit_list) {struct gtp_net *gn =net_generic (net, gtp_net_id); -struct gtp_dev *gtp; +struct gtp_dev *gtp, *gtp_next; -list_for_each_entry (gtp, &gn->gtp_dev_list, list) +list_for_each_entry_safe (gtp, gtp_next, &gn->gtp_dev_list, list)gtp_dellink (gtp->dev, dev_to_kill); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/64 gtp: Destroy device along with udp sockets netns dismantle.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit eb28fd76c0a08a47b470677c6cef9dd1c60e92d1 ]
gtp_newlink() links the device to a list in dev_net(dev) instead of src_net, where a udp tunnel socket is created.
Even when src_net is removed, the device stays alive on dev_net(dev). Then, removing src_net triggers the splat below. [0]
In this example, gtp0 is created in ns2, and the udp socket is created in ns1.
ip netns add ns1
ip netns add ns2
ip -n ns1 link add netns ns2 name gtp0 type gtp role sgsn ip netns del ns1
Let's link the device to the socket's netns instead.
Now, gtp_net_exit_batch_rtnl() needs another netdev iteration to remove all gtp devices in the netns.
[0]:ref_tracker: net notrefcnt@000000003d6e7d05 has 1/2 users at
sk_alloc (./include/net/net_namespace.h:345 net/core/sock.c:2236)
inet_create (net/ipv4/af_inet.c:326 net/ipv4/af_inet.c:252)
__sock_create (net/socket.c:1558)
udp_sock_create4 (net/ipv4/udp_tunnel_core.c:18)
gtp_create_sock (./include/net/udp_tunnel.h:59 drivers/net/gtp.c:1423)
gtp_create_sockets (drivers/net/gtp.c:1447)
gtp_newlink (drivers/net/gtp.c:1507)
rtnl_newlink (net/core/rtnetlink.c:3786 net/core/rtnetlink.c:3897 net/core/rtnetlink.c:4012)
rtnetlink_rcv_msg (net/core/rtnetlink.c:6922)
netlink_rcv_skb (net/netlink/af_netlink.c:2542)
netlink_unicast (net/netlink/af_netlink.c:1321 net/netlink/af_netlink.c:1347)
netlink_sendmsg (net/netlink/af_netlink.c:1891)
____sys_sendmsg (net/socket.c:711 net/socket.c:726 net/socket.c:2583)
___sys_sendmsg (net/socket.c:2639)
__sys_sendmsg (net/socket.c:2669)
do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)
WARNING: CPU: 1 PID: 60 at lib/ref_tracker.c:179 ref_tracker_dir_exit (lib/ref_tracker.c:179)
Modules linked in:
CPU: 1 UID: 0 PID: 60 Comm: kworker/u16:2 Not tainted 6.13.0-rc5-00147-g4c1224501e9d #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Workqueue: netns cleanup_net
RIP: 0010:ref_tracker_dir_exit (lib/ref_tracker.c:179)
Code: 00 00 00 fc ff df 4d 8b 26 49 bd 00 01 00 00 00 00 ad de 4c 39 f5 0f 85 df 00 00 00 48 8b 74 24 08 48 89 df e8 a5 cc 12 02 90 <0f> 0b 90 48 8d 6b 44 be 04 00 00 00 48 89 ef e8 80 de 67 ff 48 89
RSP: 0018:ff11000009a07b60 EFLAGS: 00010286
RAX: 0000000000002bd3 RBX: ff1100000f4e1aa0 RCX: 1ffffffff0e40ac6
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8423ee3c
RBP: ff1100000f4e1af0 R08: 0000000000000001 R09: fffffbfff0e395ae
R10: 0000000000000001 R11: 0000000000036001 R12: ff1100000f4e1af0
R13: dead000000000100 R14: ff1100000f4e1af0 R15: dffffc0000000000
FS: 0000000000000000(0000) GS:ff1100006ce80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f9b2464bd98 CR3: 0000000005286005 CR4: 0000000000771ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
? __warn (kernel/panic.c:748)
? ref_tracker_dir_exit (lib/ref_tracker.c:179)
? report_bug (lib/bug.c:201 lib/bug.c:219)
? handle_bug (arch/x86/kernel/traps.c:285)
? exc_invalid_op (arch/x86/kernel/traps.c:309 (discriminator 1))
? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621)
? _raw_spin_unlock_irqrestore (./arch/x86/include/asm/irqflags.h:42 ./arch/x86/include/asm/irqflags.h:97 ./arch/x86/include/asm/irqflags.h:155 ./include/linux/spinlock_api_smp.h:151 kernel/locking/spinlock.c:194)
? ref_tracker_dir_exit (lib/ref_tracker.c:179)
? __pfx_ref_tracker_dir_exit (lib/ref_tracker.c:158)
? kfree (mm/slub.c:4613 mm/slub.c:4761)
net_free (net/core/net_namespace.c:476 net/core/net_namespace.c:467)
cleanup_net (net/core/net_namespace.c:664 (discriminator 3))
process_one_work (kernel/workqueue.c:3229)
worker_thread (kernel/workqueue.c:3304 kernel/workqueue.c:3391)
kthread (kernel/kthread.c:389)
ret_from_fork (arch/x86/kernel/process.c:147)
ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
</TASK>--- drivers/net/gtp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/gtp.c +6 -1
@@ -1094,7 +1094,7 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev, goto out_encap; } - gn =net_generic (dev_net (dev), gtp_net_id); + gn =net_generic (src_net, gtp_net_id);list_add (>p->list, &gn->gtp_dev_list); dev->priv_destructor = gtp_destructor;
@@ -1894,6 +1894,11 @@ static void __net_exit gtp_net_exit_batch_rtnl(struct list_head *net_list,list_for_each_entry (net, net_list, exit_list) {struct gtp_net *gn =net_generic (net, gtp_net_id);struct gtp_dev *gtp, *gtp_next; +struct net_device *dev; + +for_each_netdev (net, dev) +if (dev->rtnl_link_ops == >p_link_ops) +gtp_dellink (dev, dev_to_kill);list_for_each_entry_safe (gtp, gtp_next, &gn->gtp_dev_list, list)gtp_dellink (gtp->dev, dev_to_kill);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/64 nfp: bpf: prevent integer overflow in nfp_bpf_event_output()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 16ebb6f5b6295c9688749862a39a4889c56227f8 ]
The "sizeof(struct cmsg_bpf_event) + pkt_size + data_size" math could potentially have an integer wrapping bug on 32bit systems. Check for this and return an error.
--- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/bpf/offload.c +2 -1
@@ -458,7 +458,8 @@ int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data, map_id_full =be64_to_cpu (cbe->map_ptr); map_id = map_id_full; -if (len <sizeof (struct cmsg_bpf_event ) + pkt_size + data_size) +if (size_add (pkt_size, data_size) >INT_MAX || + len <sizeof (struct cmsg_bpf_event ) + pkt_size + data_size)return -EINVAL ;if (cbe->hdr.ver !=NFP_CCM_ABI_VERSION )return -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/64 net: xilinx: axienet: Fix IRQ coalescing packet count overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
[ Upstream commit c17ff476f53afb30f90bb3c2af77de069c81a622 ]
If coalesce_count is greater than 255 it will not fit in the register and will overflow. This can be reproduced by running
# ethtool -C ethX rx-frames 256
which will result in a timeout of 0us instead. Fix this by checking for invalid values and reporting an error.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +6 -0
@@ -1570,6 +1570,12 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,return -EFAULT ; } +if (ecoalesce->rx_max_coalesced_frames >255 || + ecoalesce->tx_max_coalesced_frames >255 ) { +NL_SET_ERR_MSG (extack,"frames must be less than 256" ); +return -EINVAL ; + } +if (ecoalesce->rx_max_coalesced_frames) lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;if (ecoalesce->rx_coalesce_usecs)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/64 net/mlx5: Fix RDMA TX steering prio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit c08d3e62b2e73e14da318a1d20b52d0486a28ee0 ]
User added steering rules at RDMA_TX were being added to the first prio, which is the counters prio.
Fix that so that they are correctly added to the BYPASS_PRIO instead.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -0
@@ -2421,6 +2421,7 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,break ;case MLX5_FLOW_NAMESPACE_RDMA_TX : root_ns = steering->rdma_tx_root_ns; + prio =RDMA_TX_BYPASS_PRIO ;break ;case MLX5_FLOW_NAMESPACE_RDMA_RX_COUNTERS : root_ns = steering->rdma_rx_root_ns;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/64 net/mlx5: Clear port select structure when fail to create
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Zhang <[email protected]>
[ Upstream commit 5641e82cb55b4ecbc6366a499300917d2f3e6790 ]
Clear the port select structure on error so no stale values left after definers are destroyed. That's because the mlx5_lag_destroy_definers() always try to destroy all lag definers in the tt_map, so in the flow below lag definers get double-destroyed and cause kernel crash:
mlx5_lag_port_sel_create()
mlx5_lag_create_definers()
mlx5_lag_create_definer() <- Failed on tt 1
mlx5_lag_destroy_definers() <- definers[tt=0] gets destroyed
mlx5_lag_port_sel_create()
mlx5_lag_create_definers()
mlx5_lag_create_definer() <- Failed on tt 0
mlx5_lag_destroy_definers() <- definers[tt=0] gets double-destroyed
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 64k pages, 48-bit VAs, pgdp=0000000112ce2e00 [0000000000000008] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: iptable_raw bonding ip_gre ip6_gre gre ip6_tunnel tunnel6 geneve ip6_udp_tunnel udp_tunnel ipip tunnel4 ip_tunnel rdma_ucm(OE) rdma_cm(OE) iw_cm(OE) ib_ipoib(OE) ib_cm(OE) ib_umad(OE) mlx5_ib(OE) ib_uverbs(OE) mlx5_fwctl(OE) fwctl(OE) mlx5_core(OE) mlxdevm(OE) ib_core(OE) mlxfw(OE) memtrack(OE) mlx_compat(OE) openvswitch nsh nf_conncount psample xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter bridge stp llc netconsole overlay efi_pstore sch_fq_codel zram ip_tables crct10dif_ce qemu_fw_cfg fuse ipv6 crc_ccitt [last unloaded: mlx_compat(OE)] CPU: 3 UID: 0 PID: 217 Comm: kworker/u53:2 Tainted: G OE 6.11.0+ #2 Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 Workqueue: mlx5_lag mlx5_do_bond_work [mlx5_core] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : mlx5_del_flow_rules+0x24/0x2c0 [mlx5_core] lr : mlx5_lag_destroy_definer+0x54/0x100 [mlx5_core] sp : ffff800085fafb00 x29: ffff800085fafb00 x28: ffff0000da0c8000 x27: 0000000000000000 x26: ffff0000da0c8000 x25: ffff0000da0c8000 x24: ffff0000da0c8000 x23: ffff0000c31f81a0 x22: 0400000000000000 x21: ffff0000da0c8000 x20: 0000000000000000 x19: 0000000000000001 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffff8b0c9350 x14: 0000000000000000 x13: ffff800081390d18 x12: ffff800081dc3cc0 x11: 0000000000000001 x10: 0000000000000b10 x9 : ffff80007ab7304c x8 : ffff0000d00711f0 x7 : 0000000000000004 x6 : 0000000000000190 x5 : ffff00027edb3010 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff0000d39b8000 x1 : ffff0000d39b8000 x0 : 0400000000000000 Call trace: mlx5_del_flow_rules+0x24/0x2c0 [mlx5_core] mlx5_lag_destroy_definer+0x54/0x100 [mlx5_core] mlx5_lag_destroy_definers+0xa0/0x108 [mlx5_core] mlx5_lag_port_sel_create+0x2d4/0x6f8 [mlx5_core] mlx5_activate_lag+0x60c/0x6f8 [mlx5_core] mlx5_do_bond_work+0x284/0x5c8 [mlx5_core] process_one_work+0x170/0x3e0 worker_thread+0x2d8/0x3e0 kthread+0x11c/0x128 ret_from_fork+0x10/0x20 Code: a9025bf5 aa0003f6 a90363f7 f90023f9 (f9400400) ---[ end trace 0000000000000000 ]---
--- drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c +3 -1
@@ -540,7 +540,7 @@ int mlx5_lag_port_sel_create(struct mlx5_lag *ldev,set_tt_map (port_sel, hash_type); err =mlx5_lag_create_definers (ldev, hash_type, ports);if (err) -return err; + goto clear_port_sel;if (port_sel->tunnel) { err =mlx5_lag_create_inner_ttc_table (ldev);
@@ -559,6 +559,8 @@ int mlx5_lag_port_sel_create(struct mlx5_lag *ldev,mlx5_destroy_ttc_table (port_sel->inner.ttc); destroy_definers:mlx5_lag_destroy_definers (ldev); +clear_port_sel: +memset (port_sel,0 ,sizeof (*port_sel));return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/64 drm/v3d: Ensure job pointer is set to NULL after job completion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit e4b5ccd392b92300a2b341705cc4805681094e49 ]
After a job completes, the corresponding pointer in the device must be set to NULL. Failing to do so triggers a warning when unloading the driver, as it appears the job is still active. To prevent this, assign the job pointer to NULL after completing the job, indicating the job has finished.
--- drivers/gpu/drm/v3d/v3d_irq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/v3d/v3d_irq.c +4 -0
@@ -103,6 +103,7 @@ v3d_irq(int irq, void *arg)trace_v3d_bcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base); + v3d->bin_job =NULL ; status =IRQ_HANDLED ; }
@@ -112,6 +113,7 @@ v3d_irq(int irq, void *arg)trace_v3d_rcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base); + v3d->render_job =NULL ; status =IRQ_HANDLED ; }
@@ -121,6 +123,7 @@ v3d_irq(int irq, void *arg)trace_v3d_csd_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base); + v3d->csd_job =NULL ; status =IRQ_HANDLED ; }
@@ -157,6 +160,7 @@ v3d_hub_irq(int irq, void *arg)trace_v3d_tfu_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base); + v3d->tfu_job =NULL ; status =IRQ_HANDLED ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/64 hwmon: (tmp513) Fix division of negative numbers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
[ Upstream commit e2c68cea431d65292b592c9f8446c918d45fcf78 ]
Fix several issues with division of negative numbers in the tmp513 driver.
The docs on the DIV_ROUND_CLOSEST macro explain that dividing a negative value by an unsigned type is undefined behavior. The driver was doing this in several places, i.e. data->shunt_uohms has type of u32. The actual "undefined" behavior is that it converts both values to unsigned before doing the division, for example:
int ret = DIV_ROUND_CLOSEST(-100, 3U);
results in ret == 1431655732 instead of -33.
Furthermore the MILLI macro has a type of unsigned long. Multiplying a signed long by an unsigned long results in an unsigned long.
So, we need to cast both MILLI and data data->shunt_uohms to long when using the DIV_ROUND_CLOSEST macro.
--- drivers/hwmon/tmp513.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hwmon/tmp513.c +4 -3
@@ -203,7 +203,8 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos, *val =sign_extend32 (regval, reg ==TMP51X_SHUNT_CURRENT_RESULT ?16 -tmp51x_get_pga_shift (data) :15 ); - *val =DIV_ROUND_CLOSEST (*val *10 *MILLI , data->shunt_uohms); + *val =DIV_ROUND_CLOSEST (*val *10 * (long )MILLI , (long )data->shunt_uohms); +break ;case TMP51X_BUS_VOLTAGE_RESULT :case TMP51X_BUS_VOLTAGE_H_LIMIT :
@@ -219,7 +220,7 @@ static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,case TMP51X_BUS_CURRENT_RESULT :// Current = (ShuntVoltage * CalibrationRegister) / 4096 *val =sign_extend32 (regval,15 ) * (long )data->curr_lsb_ua; - *val =DIV_ROUND_CLOSEST (*val,MILLI ); + *val =DIV_ROUND_CLOSEST (*val, (long )MILLI );break ;case TMP51X_LOCAL_TEMP_RESULT :case TMP51X_REMOTE_TEMP_RESULT_1 :
@@ -259,7 +260,7 @@ static int tmp51x_set_value(struct tmp51x_data *data, u8 reg, long val)* The user enter current value and we convert it to * voltage. 1lsb = 10uV */ - val =DIV_ROUND_CLOSEST (val * data->shunt_uohms,10 *MILLI ); + val =DIV_ROUND_CLOSEST (val * (long )data->shunt_uohms,10 * (long )MILLI ); max_val =U16_MAX >>tmp51x_get_pga_shift (data); regval =clamp_val (val, -max_val, max_val);break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/64 Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
[ Upstream commit d15638bf76ad47874ecb5dc386f0945fc0b2a875 ]
This reverts commit 98d1fb94ce75f39febd456d6d3cbbe58b6678795.
The commit uses data nbits instead of addr nbits for dummy phase. This causes a regression for all boards where spi-tx-bus-width is smaller than spi-rx-bus-width. It is a common pattern for boards to have spi-tx-bus-width == 1 and spi-rx-bus-width > 1. The regression causes all reads with a dummy phase to become unavailable for such boards, leading to a usually slower 0-dummy-cycle read being selected.
Most controllers' supports_op hooks call spi_mem_default_supports_op(). In spi_mem_default_supports_op(), spi_mem_check_buswidth() is called to check if the buswidths for the op can actually be supported by the board's wiring. This wiring information comes from (among other things) the spi-{tx,rx}-bus-width DT properties. Based on these properties, SPI_TX_* or SPI_RX_* flags are set by of_spi_parse_dt(). spi_mem_check_buswidth() then uses these flags to make the decision whether an op can be supported by the board's wiring (in a way, indirectly checking against spi-{rx,tx}-bus-width).
Now the tricky bit here is that spi_mem_check_buswidth() does:
if (op->dummy.nbytes && spi_check_buswidth_req(mem, op->dummy.buswidth, true)) return false;
The true argument to spi_check_buswidth_req() means the op is treated as a TX op. For a board that has say 1-bit TX and 4-bit RX, a 4-bit dummy TX is considered as unsupported, and the op gets rejected.
The commit being reverted uses the data buswidth for dummy buswidth. So for reads, the RX buswidth gets used for the dummy phase, uncovering this issue. In reality, a dummy phase is neither RX nor TX. As the name suggests, these are just dummy cycles that send or receive no data, and thus don't really need to have any buswidth at all.
Ideally, dummy phases should not be checked against the board's wiring capabilities at all, and should only be sanity-checked for having a sane buswidth value. Since we are now at rc7 and such a change might introduce many unexpected bugs, revert the commit for now. It can be sent out later along with the spi_mem_check_buswidth() fix.
--- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +1 -1
@@ -90,7 +90,7 @@ void spi_nor_spimem_setup_op(const struct spi_nor *nor, op->addr.buswidth =spi_nor_get_protocol_addr_nbits (proto);if (op->dummy.nbytes) - op->dummy.buswidth =spi_nor_get_protocol_data_nbits (proto); + op->dummy.buswidth =spi_nor_get_protocol_addr_nbits (proto);if (op->data.nbytes) op->data.buswidth =spi_nor_get_protocol_data_nbits (proto);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/64 i2c: mux: demux-pinctrl: check initial mux selection, too
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit ca89f73394daf92779ddaa37b42956f4953f3941 ]
When misconfigured, the initial setup of the current mux channel can fail, too. It must be checked as well.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +3 -1
@@ -261,7 +261,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)pm_runtime_no_callbacks (&pdev->dev);/* switch to first parent as active master */ -i2c_demux_activate_master (priv,0 ); + err =i2c_demux_activate_master (priv,0 ); +if (err) + goto err_rollback; err =device_create_file (&pdev->dev, &dev_attr_available_masters);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/64 i2c: rcar: fix NACK handling when being a target
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 093f70c134f70e4632b295240f07d2b50b74e247 ]
When this controller is a target, the NACK handling had two issues. First, the return value from the backend was not checked on the initial WRITE_REQUESTED. So, the driver missed to send a NACK in this case. Also, the NACK always arrives one byte late on the bus, even in the WRITE_RECEIVED case. This seems to be a HW issue. We should then not rely on the backend to correctly NACK the superfluous byte as well. Fix both issues by introducing a flag which gets set whenever the backend requests a NACK and keep sending it until we get a STOP condition.
--- drivers/i2c/busses/i2c-rcar.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-rcar.c +15 -5
@@ -110,6 +110,8 @@#define ID_P_PM_BLOCKED BIT(31)#define ID_P_MASK GENMASK(31, 28) +#define ID_SLAVE_NACK BIT(0) +enum rcar_i2c_type {I2C_RCAR_GEN1 ,I2C_RCAR_GEN2 ,
@@ -143,6 +145,7 @@ struct rcar_i2c_priv {int irq;struct i2c_client *host_notify_client; +u8 slave_flags; };#define rcar_i2c_priv_to_dev (p) ((p)->adap.dev.parent)
@@ -597,6 +600,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) {u32 ssr_raw, ssr_filtered;u8 value; +int ret; ssr_raw =rcar_i2c_read (priv,ICSSR ) &0xff ; ssr_filtered = ssr_raw &rcar_i2c_read (priv,ICSIER );
@@ -612,7 +616,10 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)rcar_i2c_write (priv,ICRXTX , value);rcar_i2c_write (priv,ICSIER ,SDE |SSR |SAR ); }else { -i2c_slave_event (priv->slave,I2C_SLAVE_WRITE_REQUESTED , &value); + ret =i2c_slave_event (priv->slave,I2C_SLAVE_WRITE_REQUESTED , &value); +if (ret) + priv->slave_flags |=ID_SLAVE_NACK ; +rcar_i2c_read (priv,ICRXTX );/* dummy read */ rcar_i2c_write (priv,ICSIER ,SDR |SSR |SAR ); }
@@ -625,18 +632,21 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)if (ssr_filtered &SSR ) {i2c_slave_event (priv->slave,I2C_SLAVE_STOP , &value);rcar_i2c_write (priv,ICSCR ,SIE |SDBS );/* clear our NACK */ + priv->slave_flags &= ~ID_SLAVE_NACK ;rcar_i2c_write (priv,ICSIER ,SAR );rcar_i2c_write (priv,ICSSR , ~SSR &0xff ); }/* master wants to write to us */ if (ssr_filtered &SDR ) { -int ret; - value =rcar_i2c_read (priv,ICRXTX ); ret =i2c_slave_event (priv->slave,I2C_SLAVE_WRITE_RECEIVED , &value); -/* Send NACK in case of error */ -rcar_i2c_write (priv,ICSCR ,SIE |SDBS | (ret <0 ?FNA :0 )); +if (ret) + priv->slave_flags |=ID_SLAVE_NACK ; + +/* Send NACK in case of error, but it will come 1 byte late :( */ +rcar_i2c_write (priv,ICSCR ,SIE |SDBS | + (priv->slave_flags &ID_SLAVE_NACK ?FNA :0 ));rcar_i2c_write (priv,ICSSR , ~SDR &0xff ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/64 nvmet: propagate npwg topology
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Chamberlain <[email protected]>
[ Upstream commit b579d6fdc3a9149bb4d2b3133cc0767130ed13e6 ]
Ensure we propagate npwg to the target as well instead of assuming its the same logical blocks per physical block.
This ensures devices with large IUs information properly propagated on the target.
--- drivers/nvme/target/io-cmd-bdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/io-cmd-bdev.c +1 -1
@@ -36,7 +36,7 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)*/ id->nsfeat |=1 <<4 ;/* NPWG = Namespace Preferred Write Granularity. 0's based */ - id->npwg = lpp0b; + id->npwg =to0based (bdev_io_min (bdev) /bdev_logical_block_size (bdev));/* NPWA = Namespace Preferred Write Alignment. 0's based */ id->npwa = id->npwg;/* NPDG = Namespace Preferred Deallocate Granularity. 0's based */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/64 mac802154: check local interfaces before deleting sdata list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
[ Upstream commit eb09fbeb48709fe66c0d708aed81e910a577a30a ]
syzkaller reported a corrupted list in ieee802154_if_remove. [1]
Remove an IEEE 802.15.4 network interface after unregister an IEEE 802.15.4 hardware device from the system.
CPU0 CPU1
==== ====genl_family_rcv_msg_doit ieee802154_unregister_hwieee802154_del_iface ieee802154_remove_interfacesrdev_del_virtual_intf_deprecated list_del(&sdata->list)ieee802154_if_removelist_del_rcu
The net device has been unregistered, since the rcu grace period, unregistration must be run before ieee802154_if_remove.
To avoid this issue, add a check for local->interfaces before deleting sdata list.
[1]
kernel BUG at lib/list_debug.c:58!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 0 UID: 0 PID: 6277 Comm: syz-executor157 Not tainted 6.12.0-rc6-syzkaller-00005-g557329bcecc2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:__list_del_entry_valid_or_report+0xf4/0x140 lib/list_debug.c:56 Code: e8 a1 7e 00 07 90 0f 0b 48 c7 c7 e0 37 60 8c 4c 89 fe e8 8f 7e 00 07 90 0f 0b 48 c7 c7 40 38 60 8c 4c 89 fe e8 7d 7e 00 07 90 <0f> 0b 48 c7 c7 a0 38 60 8c 4c 89 fe e8 6b 7e 00 07 90 0f 0b 48 c7 RSP: 0018:ffffc9000490f3d0 EFLAGS: 00010246 RAX: 000000000000004e RBX: dead000000000122 RCX: d211eee56bb28d00 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffff88805b278dd8 R08: ffffffff8174a12c R09: 1ffffffff2852f0d R10: dffffc0000000000 R11: fffffbfff2852f0e R12: dffffc0000000000 R13: dffffc0000000000 R14: dead000000000100 R15: ffff88805b278cc0 FS: 0000555572f94380(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000056262e4a3000 CR3: 0000000078496000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del_rcu include/linux/rculist.h:157 [inline] ieee802154_if_remove+0x86/0x1e0 net/mac802154/iface.c:687 rdev_del_virtual_intf_deprecated net/ieee802154/rdev-ops.h:24 [inline] ieee802154_del_iface+0x2c0/0x5c0 net/ieee802154/nl-phy.c:323 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2551 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:744 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2607 ___sys_sendmsg net/socket.c:2661 [inline] __sys_sendmsg+0x292/0x380 net/socket.c:2690 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/mac802154/iface.c | 4 ++++ 1 file changed, 4 insertions(+)
net/mac802154/iface.c +4 -0
@@ -689,6 +689,10 @@ void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata)ASSERT_RTNL ();mutex_lock (&sdata->local->iflist_mtx); +if (list_empty (&sdata->local->interfaces)) { +mutex_unlock (&sdata->local->iflist_mtx); +return ; + }list_del_rcu (&sdata->list);mutex_unlock (&sdata->local->iflist_mtx);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/64 hfs: Sanity check the root record
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Stone <[email protected]>
[ Upstream commit b905bafdea21a75d75a96855edd9e0b6051eee30 ]
In the syzbot reproducer, the hfs_cat_rec for the root dir has type HFS_CDR_FIL after being read with hfs_bnode_read() in hfs_super_fill(). This indicates it should be used as an hfs_cat_file, which is 102 bytes. Only the first 70 bytes of that struct are initialized, however, because the entrylength passed into hfs_bnode_read() is still the length of a directory record. This causes uninitialized values to be used later on, when the hfs_cat_rec union is treated as the larger hfs_cat_file struct.
Add a check to make sure the retrieved record has the correct type for the root directory (HFS_CDR_DIR), and make sure we load the correct number of bytes for a directory record.
--- fs/hfs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/hfs/super.c +3 -1
@@ -418,11 +418,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) goto bail_no_root; res =hfs_cat_find_brec (sb,HFS_ROOT_CNID , &fd);if (!res) { -if (fd.entrylength >sizeof (rec) || fd.entrylength <0 ) { +if (fd.entrylength !=sizeof (rec.dir)) { res = -EIO ; goto bail_hfs_find; }hfs_bnode_read (fd.bnode, &rec, fd.entryoffset, fd.entrylength); +if (rec.type !=HFS_CDR_DIR ) + res = -EIO ; }if (res) goto bail_hfs_find;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/64 fs: fix missing declaration of init_files
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Kunbo <[email protected]>
[ Upstream commit 2b2fc0be98a828cf33a88a28e9745e8599fb05cf ]
fs/file.c should include include/linux/init_task.h for
declaration of init_files. This fixes the sparse warning:
fs/file.c:501:21: warning: symbol 'init_files' was not declared. Should it be static?
--- fs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/file.c +1 -0
@@ -21,6 +21,7 @@#include <linux/rcupdate.h> #include <linux/close_range.h> #include <net/sock.h> +#include <linux/init_task.h> #include "internal.h"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/64 kheaders: Ignore silly-rename files
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 973b710b8821c3401ad7a25360c89e94b26884ac ]
Tell tar to ignore silly-rename files (".__afs*" and ".nfs*") when building the header archive. These occur when a file that is open is unlinked locally, but hasn't yet been closed. Such files are visible to the user via the getdents() syscall and so programs may want to do things with them.
During the kernel build, such files may be made during the processing of header files and the cleanup may get deferred by fput() which may result in tar seeing these files when it reads the directory, but they may have disappeared by the time it tries to open them, causing tar to fail with an error. Further, we don't want to include them in the tarball if they still exist.
With CONFIG_HEADERS_INSTALL=y, something like the following may be seen:
find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory
tar: ./include/linux/greybus/.__afs3C95: File removed before we read it
The find warning doesn't seem to cause a problem.
Fix this by telling tar when called from in gen_kheaders.sh to exclude such files. This only affects afs and nfs; cifs uses the Windows Hidden attribute to prevent the file from being seen.
--- kernel/gen_kheaders.sh | 1 + 1 file changed, 1 insertion(+)
kernel/gen_kheaders.sh +1 -0
@@ -82,6 +82,7 @@ find $cpio_dir -type f -print0 | # Create archive and try to normalize metadata for reproducibility. tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ + --exclude=".__afs*" --exclude=".nfs*" \ --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/64 cachefiles: Parse the "secctx" immediately
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Kellermann <[email protected]>
[ Upstream commit e5a8b6446c0d370716f193771ccacf3260a57534 ]
Instead of storing an opaque string, call security_secctx_to_secid() right in the "secctx" command handler and store only the numeric "secid". This eliminates an unnecessary string allocation and allows the daemon to receive errors when writing the "secctx" command instead of postponing the error to the "bind" command handler. For example, if the kernel was built without CONFIG_SECURITY, "bind" will return EOPNOTSUPP, but the daemon doesn't know why. With this patch, the "secctx" will instead return EOPNOTSUPP which is the right context for this error.
This patch adds a boolean flag have_secid because I'm not sure if we can safely assume that zero is the special secid value for "not set". This appears to be true for SELinux, Smack and AppArmor, but since this attribute is not documented, I'm unable to derive a stable guarantee for that.
--- fs/cachefiles/daemon.c | 14 +++++++------- fs/cachefiles/internal.h | 3 ++- fs/cachefiles/security.c | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-)
fs/cachefiles/daemon.c +7 -7
@@ -15,6 +15,7 @@#include <linux/namei.h> #include <linux/poll.h> #include <linux/mount.h> +#include <linux/security.h> #include <linux/statfs.h> #include <linux/ctype.h> #include <linux/string.h>
@@ -576,7 +577,7 @@ static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args)*/ static int cachefiles_daemon_secctx (struct cachefiles_cache *cache,char *args) { -char *secctx; +int err;_enter (",%s" , args);
@@ -585,16 +586,16 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args)return -EINVAL ; } -if (cache->secctx) { +if (cache->have_secid) {pr_err ("Second security context specified\n" );return -EINVAL ; } - secctx =kstrdup (args,GFP_KERNEL ); -if (!secctx) -return -ENOMEM ; + err =security_secctx_to_secid (args,strlen (args), &cache->secid); +if (err) +return err; - cache->secctx = secctx; + cache->have_secid = true;return 0 ; }
@@ -820,7 +821,6 @@ static void cachefiles_daemon_unbind(struct cachefiles_cache *cache)put_cred (cache->cache_cred);kfree (cache->rootdirname); -kfree (cache->secctx);kfree (cache->tag);_leave ("" );
fs/cachefiles/internal.h +2 -1
@@ -122,7 +122,6 @@ struct cachefiles_cache {#define CACHEFILES_STATE_CHANGED 3/* T if state changed (poll trigger) */ #define CACHEFILES_ONDEMAND_MODE 4/* T if in on-demand read mode */ char *rootdirname;/* name of cache root directory */ -char *secctx;/* LSM security context */ char *tag;/* cache binding tag */ refcount_t unbind_pincount;/* refcount to do daemon unbind */ struct xarray reqs;/* xarray of pending on-demand requests */
@@ -130,6 +129,8 @@ struct cachefiles_cache {struct xarray ondemand_ids;/* xarray for ondemand_id allocation */ u32 ondemand_id_next;u32 msg_id_next; +u32 secid;/* LSM security id */ +bool have_secid;/* whether "secid" was set */ };static inline bool cachefiles_in_ondemand_mode (struct cachefiles_cache *cache)
fs/cachefiles/security.c +3 -3
@@ -18,7 +18,7 @@ int cachefiles_get_security_ID(struct cachefiles_cache *cache)struct cred *new;int ret; -_enter ("{%s}" , cache->secctx); +_enter ("{%u}" , cache->have_secid ? cache->secid :0 ); new =prepare_kernel_cred (current);if (!new) {
@@ -26,8 +26,8 @@ int cachefiles_get_security_ID(struct cachefiles_cache *cache) goto error; } -if (cache->secctx) { - ret =set_security_override_from_ctx (new, cache->secctx); +if (cache->have_secid) { + ret =set_security_override (new, cache->secid);if (ret <0 ) {put_cred (new); pr_err("Security denies permission to nominate security context: error %d\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/64 scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit bb9850704c043e48c86cc9df90ee102e8a338229 ]
Otherwise, the default levels will override the levels set by the host controller drivers.
--- drivers/ufs/core/ufshcd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/ufs/core/ufshcd.c +6 -3
@@ -9879,14 +9879,17 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) }/* -* Set the default power management level for runtime and system PM. +* Set the default power management level for runtime and system PM if +* not set by the host controller drivers. * Default power saving mode is to keep UFS link in Hibern8 state * and UFS device in sleep state. */ - hba->rpm_lvl =ufs_get_desired_pm_lvl_for_dev_link_state ( +if (!hba->rpm_lvl) + hba->rpm_lvl =ufs_get_desired_pm_lvl_for_dev_link_state (UFS_SLEEP_PWR_MODE ,UIC_LINK_HIBERN8_STATE ); - hba->spm_lvl =ufs_get_desired_pm_lvl_for_dev_link_state ( +if (!hba->spm_lvl) + hba->spm_lvl =ufs_get_desired_pm_lvl_for_dev_link_state (UFS_SLEEP_PWR_MODE ,UIC_LINK_HIBERN8_STATE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/64 selftests: tc-testing: reduce rshift value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit e95274dfe86490ec2a5633035c24b2de6722841f ]
After previous change rshift >= 32 is no longer allowed. Modify the test to use 31, the test doesn't seem to send any traffic so the exact value shouldn't matter.
--- tools/testing/selftests/tc-testing/tc-tests/filters/flow.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/tc-testing/tc-tests/filters/flow.json +2 -2
@@ -78,10 +78,10 @@ "setup": [ "$TC qdisc add dev $DEV1 ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 prio 1 protocol ip flow map key dst rshift 0xff", + "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 prio 1 protocol ip flow map key dst rshift 0x1f", "expExitCode": "0", "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 1 flow", - "matchPattern": "filter parent ffff: protocol ip pref 1 flow chain [0-9]+ handle 0x1 map keys dst rshift 255 baseclass", + "matchPattern": "filter parent ffff: protocol ip pref 1 flow chain [0-9]+ handle 0x1 map keys dst rshift 31 baseclass", "matchCount": "1", "teardown": [ "$TC qdisc del dev $DEV1 ingress"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 26/64 ACPI: resource: acpi_dev_irq_override(): Check DMI match last
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit cd4a7b2e6a2437a5502910c08128ea3bad55a80b ]
acpi_dev_irq_override() gets called approx. 30 times during boot (15 legacy IRQs * 2 override_table entries). Of these 30 calls at max 1 will match the non DMI checks done by acpi_dev_irq_override(). The dmi_check_system() check is by far the most expensive check done by acpi_dev_irq_override(), make this call the last check done by acpi_dev_irq_override() so that it will be called at max 1 time instead of 30 times.
--- drivers/acpi/resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/resource.c +3 -3
@@ -663,11 +663,11 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,for (i =0 ; i <ARRAY_SIZE (override_table); i++) {const struct irq_override_cmp *entry = &override_table[i]; -if (dmi_check_system (entry->system) && - entry->irq == gsi && +if (entry->irq == gsi && entry->triggering == triggering && entry->polarity == polarity && - entry->shareable == shareable) + entry->shareable == shareable && +dmi_check_system (entry->system))return entry->override; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/64 iomap: avoid avoid truncating 64-bit offset to 32 bits
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Nelissen <[email protected]>
[ Upstream commit c13094b894de289514d84b8db56d1f2931a0bade ]
on 32-bit kernels, iomap_write_delalloc_scan() was inadvertently using a 32-bit position due to folio_next_index() returning an unsigned long. This could lead to an infinite loop when writing to an xfs filesystem.
--- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iomap/buffered-io.c +1 -1
@@ -907,7 +907,7 @@ static int iomap_write_delalloc_scan(struct inode *inode, }/* move offset to start of next folio in range */ - start_byte =folio_next_index (folio) <<PAGE_SHIFT ; + start_byte =folio_pos (folio) +folio_size (folio);folio_unlock (folio);folio_put (folio); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/64 poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit cacd9ae4bf801ff4125d8961bb9a3ba955e51680 ]
As the comment above waitqueue_active() explains, it can only be used if both waker and waiter have mb()'s that pair with each other. However __pollwait() is broken in this respect.
This is not pipe-specific, but let's look at pipe_poll() for example:
poll_wait(...); // -> __pollwait() -> add_wait_queue() LOAD(pipe->head); LOAD(pipe->head);
In theory these LOAD()'s can leak into the critical section inside add_wait_queue() and can happen before list_add(entry, wq_head), in this case pipe_poll() can race with wakeup_pipe_readers/writers which do
smp_mb(); if (waitqueue_active(wq_head)) wake_up_interruptible(wq_head);
There are more __pollwait()-like functions (grep init_poll_funcptr), and it seems that at least ep_ptable_queue_proc() has the same problem, so the patch adds smp_mb() into poll_wait().
--- include/linux/poll.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
include/linux/poll.h +9 -1
@@ -41,8 +41,16 @@ typedef struct poll_table_struct {static inline void poll_wait (struct file * filp,wait_queue_head_t * wait_address,poll_table *p) { -if (p && p->_qproc && wait_address) +if (p && p->_qproc && wait_address) { p->_qproc (filp, wait_address, p); +/* +* This memory barrier is paired in the wq_has_sleeper(). +* See the comment above prepare_to_wait(), we need to +* ensure that subsequent tests in this thread can't be +* reordered with __add_wait_queue() in _qproc() paths. +*/ +smp_mb (); + } }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/64 x86/asm: Make serialize() always_inline
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit ae02ae16b76160f0aeeae2c5fb9b15226d00a4ef ]
In order to allow serialize() to be used from noinstr code, make it __always_inline.
--- arch/x86/include/asm/special_insns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/special_insns.h +1 -1
@@ -225,7 +225,7 @@ static inline void clwb(volatile void *__p)#define nop () asm volatile ("nop") -static inline void serialize (void ) +static __always_inline void serialize(void) {/* Instruction opcode for SERIALIZE; supported in binutils >= 2.35. */ asmvolatile (".byte 0xf, 0x1, 0xe8" :::"memory" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 30/64 ALSA: hda/realtek: Add support for Ayaneo System using CS35L41 HDA
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
commit de5afaddd5a7af6b9c48900741b410ca03e453ae upstream.
Add support for Ayaneo Portable Game System.
System use 2 CS35L41 Amps with HDA, using Internal boost, with I2C
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10242,6 +10242,7 @@ static const struct snd_pci_quirk alc269SND_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 (0x1f66 ,0x0105 ,"Ayaneo Portable Game Player" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x2782 ,0x0214 ,"VAIO VJFE-CL" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x2782 ,0x0228 ,"Infinix ZERO BOOK 13" ,ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13 ), SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
Greg Kroah-Hartman
maintainerPATCH 31/64 zram: fix potential UAF of zram table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
commit 212fe1c0df4a150fb6298db2cfff267ceaba5402 upstream.
If zram_meta_alloc failed early, it frees allocated zram->table without setting it NULL. Which will potentially cause zram_meta_free to access the table if user reset an failed and uninitialized device.
--- drivers/block/zram/zram_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/zram/zram_drv.c +1 -0
@@ -1192,6 +1192,7 @@ static bool zram_meta_alloc(struct zram zram->mem_pool =zs_create_pool (zram->disk->disk_name);if (!zram->mem_pool) {vfree (zram->table); + zram->table =NULL ;return false; }
Greg Kroah-Hartman
maintainerPATCH 32/64 mptcp: be sure to send ack when mptcp-level window re-opens
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 2ca06a2f65310aeef30bb69b7405437a14766e4d upstream.
mptcp_cleanup_rbuf() is responsible to send acks when the user-space reads enough data to update the receive windows significantly.
It tries hard to avoid acquiring the subflow sockets locks by checking conditions similar to the ones implemented at the TCP level.
To avoid too much code duplication - the MPTCP protocol can't reuse the TCP helpers as part of the relevant status is maintained into the msk socket - and multiple costly window size computation, mptcp_cleanup_rbuf uses a rough estimate for the most recently advertised window size:
the MPTCP receive free space, as recorded as at last-ack time.
Unfortunately the above does not allow mptcp_cleanup_rbuf() to detect a zero to non-zero win change in some corner cases, skipping the tcp_cleanup_rbuf call and leaving the peer stuck.
After commit ea66758c1795 ("tcp: allow MPTCP to update the announced window"), MPTCP has actually cheap access to the announced window value. Use it in mptcp_cleanup_rbuf() for a more accurate ack generation.
--- net/mptcp/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mptcp/options.c +4 -2
@@ -605,7 +605,6 @@ static bool mptcp_established_options_ds } opts->ext_copy.use_ack =1 ; opts->suboptions =OPTION_MPTCP_DSS ; -WRITE_ONCE (msk->old_wspace,__mptcp_space ((struct sock *)msk));/* Add kind/length/subtype/flag overhead if mapping is not populated */ if (dss_size ==0 )
@@ -1265,7 +1264,7 @@ static void mptcp_set_rwin(struct tcp_so }MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_RCVWNDCONFLICT ); } -return ; + goto update_wspace; }if (rcv_wnd_new != rcv_wnd_old) {
@@ -1290,6 +1289,9 @@ raise_win: th->window =htons (new_win);MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_RCVWNDSHARED ); } + +update_wspace: +WRITE_ONCE (msk->old_wspace, tp->rcv_wnd); }__sum16 __mptcp_make_csum (u64 data_seq,u32 subflow_seq,u16 data_len,__wsum sum)
Greg Kroah-Hartman
maintainerPATCH 33/64 selftests: mptcp: avoid spurious errors on disconnect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 218cc166321fb3cc8786677ffe0d09a78778a910 upstream.
The disconnect test-case generates spurious errors:
INFO: disconnect
INFO: extra options: -I 3 -i /tmp/tmp.r43niviyoI
01 ns1 MPTCP -> ns1 (10.0.1.1:10000 ) MPTCP (duration 140ms) [FAIL]
file received by server does not match (in, out):
Unexpected revents: POLLERR/POLLNVAL(19)
-rw-r--r-- 1 root root 10028676 Jan 10 10:47 /tmp/tmp.r43niviyoI.disconnect Trailing bytes are:
��\����R���!8��u2��5N%
-rw------- 1 root root 9992290 Jan 10 10:47 /tmp/tmp.Os4UbnWbI1 Trailing bytes are:
��\����R���!8��u2��5N%
02 ns1 MPTCP -> ns1 (dead:beef:1::1:10001) MPTCP (duration 206ms) [ OK ]
03 ns1 MPTCP -> ns1 (dead:beef:1::1:10002) TCP (duration 31ms) [ OK ]
04 ns1 TCP -> ns1 (dead:beef:1::1:10003) MPTCP (duration 26ms) [ OK ]
[FAIL] Tests of the full disconnection have failed
Time: 2 seconds
The root cause is actually in the user-space bits: the test program currently disconnects as soon as all the pending data has been spooled, generating an FASTCLOSE. If such option reaches the peer before the latter has reached the closed status, the msk socket will report an error to the user-space, as per protocol specification, causing the above failure.
Address the issue explicitly waiting for all the relevant sockets to reach a closed status before performing the disconnect.
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 43 ++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +32 -11
@@ -25,6 +25,8 @@#include <sys/types.h> #include <sys/mman.h> +#include <arpa/inet.h> +#include <netdb.h> #include <netinet/in.h>
@@ -1131,23 +1133,42 @@ static void parse_setsock_options(constexit (1 ); } -void xdisconnect (int fd,int addrlen) +void xdisconnect (int fd) { -struct sockaddr_storage empty; +socklen_t addrlen =sizeof (struct sockaddr_storage ); +struct sockaddr_storage addr, empty;int msec_sleep =10 ; -int queued =1 ; -int i; +void *raw_addr; +int i, cmdlen; +char cmd[128 ]; + +/* get the local address and convert it to string */ +if (getsockname (fd, (struct sockaddr *)&addr, &addrlen) <0 ) +xerror ("getsockname" ); + +if (addr.ss_family ==AF_INET ) + raw_addr = &(((struct sockaddr_in *)&addr)->sin_addr); +else if (addr.ss_family ==AF_INET6 ) + raw_addr = &(((struct sockaddr_in6 *)&addr)->sin6_addr); +else +xerror ("bad family" ); + +strcpy (cmd,"ss -M | grep -q " ); + cmdlen =strlen (cmd); +if (!inet_ntop (addr.ss_family, raw_addr, &cmd[cmdlen], +sizeof (cmd) - cmdlen)) +xerror ("inet_ntop" );shutdown (fd,SHUT_WR ); -/* while until the pending data is completely flushed, the later +/* +* wait until the pending data is completely flushed and all +* the MPTCP sockets reached the closed status. * disconnect will bypass/ignore/drop any pending data. */ for (i =0 ; ; i += msec_sleep) { -if (ioctl (fd,SIOCOUTQ , &queued) <0 ) -xerror ("can't query out socket queue: %d" , errno); - -if (!queued) +/* closed socket are not listed by 'ss' */ +if (system (cmd) !=0 )break ;if (i > poll_timeout)
@@ -1195,9 +1216,9 @@ again:return ret;if (cfg_truncate >0 ) { -xdisconnect (fd, peer->ai_addrlen); +xdisconnect (fd); }else if (--cfg_repeat >0 ) { -xdisconnect (fd, peer->ai_addrlen); +xdisconnect (fd);/* the socket could be unblocking at this point, we need the * connect to be blocking
Greg Kroah-Hartman
maintainerPATCH 34/64 net: ethernet: xgbe: re-add aneg to supported features in PHY quirks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
commit 6be7aca91009865d8c2b73589270224a6b6e67ab upstream.
In 4.19, before the switch to linkmode bitmaps, PHY_GBIT_FEATURES included feature bits for aneg and TP/MII ports.
SUPPORTED_TP | \ SUPPORTED_MII) SUPPORTED_10baseT_Full) SUPPORTED_100baseT_Full) SUPPORTED_1000baseT_Full) PHY_100BT_FEATURES | \ PHY_DEFAULT_FEATURES) PHY_1000BT_FEATURES)
Referenced commit expanded PHY_GBIT_FEATURES, silently removing PHY_DEFAULT_FEATURES. The removed part can be re-added by using the new PHY_GBIT_FEATURES definition.
Not clear to me is why nobody seems to have noticed this issue.
I stumbled across this when checking what it takes to make phy_10_100_features_array et al private to phylib.
--- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -17
@@ -856,7 +856,6 @@ static void xgbe_phy_free_phy_device(strstatic bool xgbe_phy_finisar_phy_quirks (struct xgbe_prv_data *pdata) { -__ETHTOOL_DECLARE_LINK_MODE_MASK (supported) = {0 , };struct xgbe_phy_data *phy_data = pdata->phy_data;unsigned int phy_id = phy_data->phydev->phy_id;
@@ -878,14 +877,7 @@ static bool xgbe_phy_finisar_phy_quirks(phy_write (phy_data->phydev,0x04 ,0x0d01 );phy_write (phy_data->phydev,0x00 ,0x9140 ); -linkmode_set_bit_array (phy_10_100_features_array, -ARRAY_SIZE (phy_10_100_features_array), - supported); -linkmode_set_bit_array (phy_gbit_features_array, -ARRAY_SIZE (phy_gbit_features_array), - supported); - -linkmode_copy (phy_data->phydev->supported, supported); +linkmode_copy (phy_data->phydev->supported,PHY_GBIT_FEATURES );phy_support_asym_pause (phy_data->phydev);
@@ -897,7 +889,6 @@ static bool xgbe_phy_finisar_phy_quirks(static bool xgbe_phy_belfuse_phy_quirks (struct xgbe_prv_data *pdata) { -__ETHTOOL_DECLARE_LINK_MODE_MASK (supported) = {0 , };struct xgbe_phy_data *phy_data = pdata->phy_data;struct xgbe_sfp_eeprom *sfp_eeprom = &phy_data->sfp_eeprom;unsigned int phy_id = phy_data->phydev->phy_id;
@@ -961,13 +952,7 @@ static bool xgbe_phy_belfuse_phy_quirks( reg =phy_read (phy_data->phydev,0x00 );phy_write (phy_data->phydev,0x00 , reg & ~0x00800 ); -linkmode_set_bit_array (phy_10_100_features_array, -ARRAY_SIZE (phy_10_100_features_array), - supported); -linkmode_set_bit_array (phy_gbit_features_array, -ARRAY_SIZE (phy_gbit_features_array), - supported); -linkmode_copy (phy_data->phydev->supported, supported); +linkmode_copy (phy_data->phydev->supported,PHY_GBIT_FEATURES );phy_support_asym_pause (phy_data->phydev); netif_dbg(pdata, drv, pdata->netdev,
Greg Kroah-Hartman
maintainerPATCH 35/64 vsock/virtio: discard packets if the transport changes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit 2cb7c756f605ec02ffe562fb26828e4bcc5fdfc1 upstream.
If the socket has been de-assigned or assigned to another transport, we must discard any packets received because they are not expected and would cause issues when we access vsk->transport.
A possible scenario is described by Hyunwoo Kim in the attached link, where after a first connect() interrupted by a signal, and a second connect() failed, we can find vsk->transport at NULL, leading to a NULL pointer dereference.
--- net/vmw_vsock/virtio_transport_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +5 -2
@@ -1334,8 +1334,11 @@ void virtio_transport_recv_pkt(struct vilock_sock (sk); -/* Check if sk has been closed before lock_sock */ -if (sock_flag (sk,SOCK_DONE )) { +/* Check if sk has been closed or assigned to another transport before +* lock_sock (note: listener sockets are not assigned to any transport) +*/ +if (sock_flag (sk,SOCK_DONE ) || + (sk->sk_state !=TCP_LISTEN && vsk->transport != &t->transport)) { (void )virtio_transport_reset_no_sock (t, skb);release_sock (sk);sock_put (sk);
Greg Kroah-Hartman
maintainerPATCH 36/64 vsock/virtio: cancel close work in the destructor
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit df137da9d6d166e87e40980e36eb8e0bc90483ef upstream.
During virtio_transport_release() we can schedule a delayed work to perform the closing of the socket before destruction.
The destructor is called either when the socket is really destroyed (reference counter to zero), or it can also be called when we are de-assigning the transport.
In the former case, we are sure the delayed work has completed, because it holds a reference until it completes, so the destructor will definitely be called after the delayed work is finished.
But in the latter case, the destructor is called by AF_VSOCK core, just after the release(), so there may still be delayed work scheduled.
Refactor the code, moving the code to delete the close work already in the do_close() to a new function. Invoke it during destruction to make sure we don't leave any pending work.
--- net/vmw_vsock/virtio_transport_common.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
net/vmw_vsock/virtio_transport_common.c +21 -8
@@ -26,6 +26,9 @@/* Threshold for detecting small packets to copy */ #define GOOD_COPY_LEN 128 +static void virtio_transport_cancel_close_work (struct vsock_sock *vsk, +bool cancel_timeout); +static const struct virtio_transport *virtio_transport_get_ops (struct vsock_sock *vsk) {
@@ -826,6 +829,8 @@ void virtio_transport_destruct(struct vs {struct virtio_vsock_sock *vvs = vsk->trans; +virtio_transport_cancel_close_work (vsk, true); +kfree (vvs); vsk->trans =NULL ; }
@@ -910,17 +915,11 @@ static void virtio_transport_wait_close( } } -static void virtio_transport_do_close (struct vsock_sock *vsk, -bool cancel_timeout) +static void virtio_transport_cancel_close_work (struct vsock_sock *vsk, +bool cancel_timeout) {struct sock *sk =sk_vsock (vsk); -sock_set_flag (sk,SOCK_DONE ); - vsk->peer_shutdown =SHUTDOWN_MASK ; -if (vsock_stream_has_data (vsk) <=0 ) - sk->sk_state =TCP_CLOSING ; - sk->sk_state_change (sk); -if (vsk->close_work_scheduled && (!cancel_timeout ||cancel_delayed_work (&vsk->close_work))) { vsk->close_work_scheduled = false;
@@ -932,6 +931,20 @@ static void virtio_transport_do_close(st } } +static void virtio_transport_do_close (struct vsock_sock *vsk, +bool cancel_timeout) +{ +struct sock *sk =sk_vsock (vsk); + +sock_set_flag (sk,SOCK_DONE ); + vsk->peer_shutdown =SHUTDOWN_MASK ; +if (vsock_stream_has_data (vsk) <=0 ) + sk->sk_state =TCP_CLOSING ; + sk->sk_state_change (sk); + +virtio_transport_cancel_close_work (vsk, cancel_timeout); +} +static void virtio_transport_close_timeout (struct work_struct *work) { struct vsock_sock *vsk =
Greg Kroah-Hartman
maintainerPATCH 37/64 vsock: reset socket state when de-assigning the transport
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit a24009bc9be60242651a21702609381b5092459e upstream.
Transport's release() and destruct() are called when de-assigning the vsock transport. These callbacks can touch some socket state like sock flags, sk_state, and peer_shutdown.
Since we are reassigning the socket to a new transport during vsock_connect(), let's reset these fields to have a clean state with the new transport.
--- net/vmw_vsock/af_vsock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/vmw_vsock/af_vsock.c +9 -0
@@ -485,6 +485,15 @@ int vsock_assign_transport(struct vsock_*/ vsk->transport->release (vsk);vsock_deassign_transport (vsk); + +/* transport's release() and destruct() can touch some socket +* state, since we are reassigning the socket to a new transport +* during vsock_connect(), let's reset these fields to have a +* clean state. +*/ +sock_reset_flag (sk,SOCK_DONE ); + sk->sk_state =TCP_CLOSE ; + vsk->peer_shutdown =0 ; }/* We increase the module refcnt to prevent the transport unloading
Greg Kroah-Hartman
maintainerPATCH 38/64 vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit 91751e248256efc111e52e15115840c35d85abaf upstream.
Recent reports have shown how we sometimes call vsock_*_has_data() when a vsock socket has been de-assigned from a transport (see attached links), but we shouldn't.
Previous commits should have solved the real problems, but we may have more in the future, so to avoid null-ptr-deref, we can return 0 (no space, no data available) but with a warning.
This way the code should continue to run in a nearly consistent state and have a warning that allows us to debug future problems.
--- net/vmw_vsock/af_vsock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/vmw_vsock/af_vsock.c +9 -0
@@ -873,6 +873,9 @@ EXPORT_SYMBOL_GPL(vsock_create_connecteds64 vsock_stream_has_data (struct vsock_sock *vsk) { +if (WARN_ON (!vsk->transport)) +return 0 ; +return vsk->transport->stream_has_data (vsk); }EXPORT_SYMBOL_GPL (vsock_stream_has_data);
@@ -881,6 +884,9 @@ static s64 vsock_connectible_has_data(st {struct sock *sk =sk_vsock (vsk); +if (WARN_ON (!vsk->transport)) +return 0 ; +if (sk->sk_type ==SOCK_SEQPACKET )return vsk->transport->seqpacket_has_data (vsk);else
@@ -889,6 +895,9 @@ static s64 vsock_connectible_has_data(sts64 vsock_stream_has_space (struct vsock_sock *vsk) { +if (WARN_ON (!vsk->transport)) +return 0 ; +return vsk->transport->stream_has_space (vsk); }EXPORT_SYMBOL_GPL (vsock_stream_has_space);
Greg Kroah-Hartman
maintainerPATCH 39/64 filemap: avoid truncating 64-bit offset to 32 bits
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Nelissen <[email protected]>
commit f505e6c91e7a22d10316665a86d79f84d9f0ba76 upstream.
On 32-bit kernels, folio_seek_hole_data() was inadvertently truncating a 64-bit value to 32 bits, leading to a possible infinite loop when writing to an xfs filesystem.
--- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/filemap.c +1 -1
@@ -2938,7 +2938,7 @@ static inline loff_t folio_seek_hole_datif (ops->is_partially_uptodate (folio, offset, bsz) == seek_data)break ; - start = (start + bsz) & ~(bsz -1 ); + start = (start + bsz) & ~((u64 )bsz -1 ); offset += bsz; }while (offset <folio_size (folio)); unlock:
Greg Kroah-Hartman
maintainerPATCH 40/64 fs/proc: fix softlockup in __read_vmcore (part 2)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
commit cbc5dde0a461240046e8a41c43d7c3b76d5db952 upstream.
Since commit 5cbcb62dddf5 ("fs/proc: fix softlockup in __read_vmcore") the number of softlockups in __read_vmcore at kdump time have gone down, but they still happen sometimes.
In a memory constrained environment like the kdump image, a softlockup is not just a harmless message, but it can interfere with things like RCU freeing memory, causing the crashdump to get stuck.
The second loop in __read_vmcore has a lot more opportunities for natural sleep points, like scheduling out while waiting for a data write to happen, but apparently that is not always enough.
Add a cond_resched() to the second loop in __read_vmcore to (hopefully) get rid of the softlockups.
--- fs/proc/vmcore.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
@@ -404,6 +404,8 @@ static ssize_t __read_vmcore(struct iov_if (!iov_iter_count (iter))return acc; } + +cond_resched (); }return acc;
Greg Kroah-Hartman
maintainerPATCH 41/64 gpiolib: cdev: Fix use after free in lineinfo_changed_notify
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
commit 02f6b0e1ec7e0e7d059dddc893645816552039da upstream.
The use-after-free issue occurs as follows: when the GPIO chip device file is being closed by invoking gpio_chrdev_release(), watched_lines is freed by bitmap_free(), but the unregistration of lineinfo_changed_nb notifier chain failed due to waiting write rwsem. Additionally, one of the GPIO chip's lines is also in the release process and holds the notifier chain's read rwsem. Consequently, a race condition leads to the use-after-free of watched_lines.
Here is the typical stack when issue happened:
[free]gpio_chrdev_release()
--> bitmap_free(cdev->watched_lines) <-- freed
--> blocking_notifier_chain_unregister()
--> down_write(&nh->rwsem) <-- waiting rwsem
--> __down_write_common()
--> rwsem_down_write_slowpath()
--> schedule_preempt_disabled()
--> schedule()[use]st54spi_gpio_dev_release()
--> gpio_free()
--> gpiod_free()
--> gpiod_free_commit()
--> gpiod_line_state_notify()
--> blocking_notifier_call_chain()
--> down_read(&nh->rwsem); <-- held rwsem
--> notifier_call_chain()
--> lineinfo_changed_notify()
--> test_bit(xxxx, cdev->watched_lines) <-- use after freeThe side effect of the use-after-free issue is that a GPIO line event is being generated for userspace where it shouldn't. However, since the chrdev is being closed, userspace won't have the chance to read that event anyway.
To fix the issue, call the bitmap_free() function after the unregistration of lineinfo_changed_nb notifier chain.
--- drivers/gpio/gpiolib-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-cdev.c +1 -1
@@ -2860,9 +2860,9 @@ static int gpio_chrdev_release(struct instruct gpio_chardev_data *cdev = file->private_data;struct gpio_device *gdev = cdev->gdev; -bitmap_free (cdev->watched_lines);blocking_notifier_chain_unregister (&gdev->notifier, &cdev->lineinfo_changed_nb); +bitmap_free (cdev->watched_lines);put_device (&gdev->dev);kfree (cdev);
Greg Kroah-Hartman
maintainerPATCH 42/64 pmdomain: imx8mp-blk-ctrl: add missing loop break condition
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
commit 726efa92e02b460811e8bc6990dd742f03b645ea upstream.
Currently imx8mp_blk_ctrl_remove() will continue the for loop until an out-of-bounds exception occurs.
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : dev_pm_domain_detach+0x8/0x48 lr : imx8mp_blk_ctrl_shutdown+0x58/0x90
sp : ffffffc084f8bbf0
x29: ffffffc084f8bbf0 x28: ffffff80daf32ac0 x27: 0000000000000000
x26: ffffffc081658d78 x25: 0000000000000001 x24: ffffffc08201b028
x23: ffffff80d0db9490 x22: ffffffc082340a78 x21: 00000000000005b0
x20: ffffff80d19bc180 x19: 000000000000000a x18: ffffffffffffffff
x17: ffffffc080a39e08 x16: ffffffc080a39c98 x15: 4f435f464f006c72
x14: 0000000000000004 x13: ffffff80d0172110 x12: 0000000000000000
x11: ffffff80d0537740 x10: ffffff80d05376c0 x9 : ffffffc0808ed2d8 x8 : ffffffc084f8bab0 x7 : 0000000000000000 x6 : 0000000000000000 x5 : ffffff80d19b9420 x4 : fffffffe03466e60 x3 : 0000000080800077 x2 : 0000000000000000 x1 : 0000000000000001 x0 : 0000000000000000
Call trace: dev_pm_domain_detach+0x8/0x48 platform_shutdown+0x2c/0x48 device_shutdown+0x158/0x268 kernel_restart_prepare+0x40/0x58 kernel_kexec+0x58/0xe8 __do_sys_reboot+0x198/0x258 __arm64_sys_reboot+0x2c/0x40 invoke_syscall+0x5c/0x138 el0_svc_common.constprop.0+0x48/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x38/0xc8 el0t_64_sync_handler+0x120/0x130 el0t_64_sync+0x190/0x198 Code: 8128c2d0 ffffffc0 aa1e03e9 d503201f
--- drivers/soc/imx/imx8mp-blk-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/imx/imx8mp-blk-ctrl.c +1 -1
@@ -659,7 +659,7 @@ static int imx8mp_blk_ctrl_remove(structof_genpd_del_provider (pdev->dev.of_node); -for (i =0 ; bc->onecell_data.num_domains; i++) { +for (i =0 ; i < bc->onecell_data.num_domains; i++) {struct imx8mp_blk_ctrl_domain *domain = &bc->domains[i];pm_genpd_remove (&domain->genpd);
Greg Kroah-Hartman
maintainerPATCH 43/64 irqchip: Plug a OF node reference leak in platform_irqchip_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
commit 9322d1915f9d976ee48c09d800fbd5169bc2ddcc upstream.
platform_irqchip_probe() leaks a OF node when irq_init_cb() fails. Fix it by declaring par_np with the __free(device_node) cleanup construct.
This bug was found by an experimental static analysis tool that I am developing.
--- drivers/irqchip/irqchip.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/irqchip/irqchip.c +1 -3
@@ -35,11 +35,10 @@ void __init irqchip_init(void)int platform_irqchip_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -struct device_node *par_np =of_irq_find_parent (np); + struct device_node *par_np __free(device_node) = of_irq_find_parent(np);of_irq_init_cb_t irq_init_cb =of_device_get_match_data (&pdev->dev);if (!irq_init_cb) { -of_node_put (par_np);return -EINVAL ; }
@@ -55,7 +54,6 @@ int platform_irqchip_probe(struct platfo* interrupt controller can check for specific domains as necessary. */ if (par_np && !irq_find_matching_host (par_np,DOMAIN_BUS_ANY )) { -of_node_put (par_np);return -EPROBE_DEFER ; }
Greg Kroah-Hartman
maintainerPATCH 44/64 irqchip/gic-v3: Handle CPU_PM_ENTER_FAILED correctly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Lal <[email protected]>
commit 0d62a49ab55c99e8deb4593b8d9f923de1ab5c18 upstream.
When a CPU attempts to enter low power mode, it disables the redistributor and Group 1 interrupts and reinitializes the system registers upon wakeup.
If the transition into low power mode fails, then the CPU_PM framework invokes the PM notifier callback with CPU_PM_ENTER_FAILED to allow the drivers to undo the state changes.
The GIC V3 driver ignores CPU_PM_ENTER_FAILED, which leaves the GIC in disabled state.
Handle CPU_PM_ENTER_FAILED in the same way as CPU_PM_EXIT to restore normal operation.
[ tglx: Massage change log, add Fixes tag ]
--- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -1424,7 +1424,7 @@ static int gic_retrigger(struct irq_datastatic int gic_cpu_pm_notifier (struct notifier_block *self,unsigned long cmd,void *v) { -if (cmd ==CPU_PM_EXIT ) { +if (cmd ==CPU_PM_EXIT || cmd ==CPU_PM_ENTER_FAILED ) {if (gic_dist_security_disabled ())gic_enable_redist (true);gic_cpu_sys_reg_init ();
Greg Kroah-Hartman
maintainerPATCH 45/64 irqchip/gic-v3-its: Dont enable interrupts in its_irq_set_vcpu_affinity()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Krcka <[email protected]>
commit 35cb2c6ce7da545f3b5cb1e6473ad7c3a6f08310 upstream.
The following call-chain leads to enabling interrupts in a nested interrupt disabled section:
irq_set_vcpu_affinity()
irq_get_desc_lock()
raw_spin_lock_irqsave() <--- Disable interrupts
its_irq_set_vcpu_affinity()
guard(raw_spinlock_irq) <--- Enables interrupts when leaving the guard()
irq_put_desc_unlock() <--- Warns because interrupts are enabled
This was broken in commit b97e8a2f7130, which replaced the original raw_spin_[un]lock() pair with guard(raw_spinlock_irq).
Fix the issue by using guard(raw_spinlock).
[ tglx: Massaged change log ]
--- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -1967,7 +1967,7 @@ static int its_irq_set_vcpu_affinity(strif (!is_v4 (its_dev->its))return -EINVAL ; -guard (raw_spinlock_irq)(&its_dev->event_map.vlpi_lock); +guard (raw_spinlock)(&its_dev->event_map.vlpi_lock);/* Unmap request? */ if (!info)
Greg Kroah-Hartman
maintainerPATCH 46/64 hrtimers: Handle CPU state correctly on hotplug
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
commit 2f8dea1692eef2b7ba6a256246ed82c365fdc686 upstream.
Consider a scenario where a CPU transitions from CPUHP_ONLINE to halfway through a CPU hotunplug down to CPUHP_HRTIMERS_PREPARE, and then back to CPUHP_ONLINE:
Since hrtimers_prepare_cpu() does not run, cpu_base.hres_active remains set to 1 throughout. However, during a CPU unplug operation, the tick and the clockevents are shut down at CPUHP_AP_TICK_DYING. On return to the online state, for instance CFS incorrectly assumes that the hrtick is already active, and the chance of the clockevent device to transition to oneshot mode is also lost forever for the CPU, unless it goes back to a lower state than CPUHP_HRTIMERS_PREPARE once.
This round-trip reveals another issue; cpu_base.online is not set to 1 after the transition, which appears as a WARN_ON_ONCE in enqueue_hrtimer().
Aside of that, the bulk of the per CPU state is not reset either, which means there are dangling pointers in the worst case.
Address this by adding a corresponding startup() callback, which resets the stale per CPU state and sets the online flag.
[ tglx: Make the new callback unconditionally available, remove the online
modification in the prepare() callback and clear the remaining state in the starting callback instead of the prepare callback ]
--- include/linux/hrtimer.h | 1 + kernel/cpu.c | 2 +- kernel/time/hrtimer.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-)
include/linux/hrtimer.h +1 -0
@@ -532,6 +532,7 @@ extern void __init hrtimers_init(void);extern void sysrq_timer_list_show (void );int hrtimers_prepare_cpu (unsigned int cpu); +int hrtimers_cpu_starting (unsigned int cpu);#ifdef CONFIG_HOTPLUG_CPU int hrtimers_cpu_dying (unsigned int cpu);#else
kernel/cpu.c +1 -1
@@ -1824,7 +1824,7 @@ static struct cpuhp_step cpuhp_hp_states }, [CPUHP_AP_HRTIMERS_DYING] = { .name = "hrtimers:dying", - .startup.single = NULL, + .startup.single = hrtimers_cpu_starting, .teardown.single = hrtimers_cpu_dying, },
kernel/time/hrtimer.c +10 -1
@@ -2177,6 +2177,15 @@ int hrtimers_prepare_cpu(unsigned int cp } cpu_base->cpu = cpu; +hrtimer_cpu_base_init_expiry_lock (cpu_base); +return 0 ; +} + +int hrtimers_cpu_starting (unsigned int cpu) +{ +struct hrtimer_cpu_base *cpu_base =this_cpu_ptr (&hrtimer_bases); + +/* Clear out any left over state from a CPU down operation */ cpu_base->active_bases =0 ; cpu_base->hres_active =0 ; cpu_base->hang_detected =0 ;
@@ -2185,7 +2194,6 @@ int hrtimers_prepare_cpu(unsigned int cp cpu_base->expires_next =KTIME_MAX ; cpu_base->softirq_expires_next =KTIME_MAX ; cpu_base->online =1 ; -hrtimer_cpu_base_init_expiry_lock (cpu_base);return 0 ; }
@@ -2263,6 +2271,7 @@ int hrtimers_cpu_dying(unsigned int dyinvoid __init hrtimers_init (void ) {hrtimers_prepare_cpu (smp_processor_id ()); +hrtimers_cpu_starting (smp_processor_id ());open_softirq (HRTIMER_SOFTIRQ , hrtimer_run_softirq); }
Greg Kroah-Hartman
maintainerPATCH 47/64 drm/i915/fb: Relax clear color alignment to 64 bytes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit 1a5401ec3018c101c456cdbda2eaef9482db6786 upstream.
Mesa changed its clear color alignment from 4k to 64 bytes without informing the kernel side about the change. This is now likely to cause framebuffer creation to fail.
The only thing we do with the clear color buffer in i915 is:
1. map a single page
2. read out bytes 16-23 from said page
3. unmap the page
So the only requirement we really have is that those 8 bytes are all contained within one page. Thus we can deal with the Mesa regression by reducing the alignment requiment from 4k to the same 64 bytes in the kernel. We could even go as low as 32 bytes, but IIRC 64 bytes is the hardware requirement on the 3D engine side so matching that seems sensible.
Note that the Mesa alignment chages were partially undone so the regression itself was already fixed on userspace side.
--- drivers/gpu/drm/i915/display/intel_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_fb.c +1 -1
@@ -1571,7 +1571,7 @@ int intel_fill_fb_info(struct drm_i915_p* arithmetic related to alignment and offset calculation. */ if (is_gen12_ccs_cc_plane (&fb->base, i)) { -if (IS_ALIGNED (fb->base.offsets[i],PAGE_SIZE )) +if (IS_ALIGNED (fb->base.offsets[i],64 ))continue ;else return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 48/64 Revert "PCI: Use preserve_config in place of pci_flags"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Tritton <[email protected]>
This reverts commit f858b0fab28d8bc2d0f0e8cd4afc3216f347cfcc which is commit 7246a4520b4bf1494d7d030166a11b5226f6d508 upstream.
This patch causes a regression in cuttlefish/crossvm boot on arm64.
The patch was part of a series that when applied will not cause a regression but this patch was backported to the 6.1 branch by itself.
The other patches do not apply cleanly to the 6.1 branch.
--- drivers/pci/controller/pci-host-common.c | 4 ++++ drivers/pci/probe.c | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/pci/controller/pci-host-common.c +4 -0
@@ -73,6 +73,10 @@ int pci_host_common_probe(struct platforif (IS_ERR (cfg))return PTR_ERR (cfg); +/* Do not reassign resources if probe only */ +if (!pci_has_flag (PCI_PROBE_ONLY )) +pci_add_flags (PCI_REASSIGN_ALL_BUS ); + bridge->sysdata = cfg; bridge->ops = (struct pci_ops *)&ops->pci_ops; bridge->msi_domain = true;
drivers/pci/probe.c +11 -9
@@ -3082,18 +3082,20 @@ int pci_host_probe(struct pci_host_bridg bus = bridge->bus; -/* If we must preserve the resource configuration, claim now */ -if (bridge->preserve_config) -pci_bus_claim_resources (bus); -/* -* Assign whatever was left unassigned. If we didn't claim above, -* this will reassign everything. +* We insert PCI resources into the iomem_resource and +* ioport_resource trees in either pci_bus_claim_resources() +* or pci_bus_assign_resources(). */ -pci_assign_unassigned_root_bus_resources (bus); +if (pci_has_flag (PCI_PROBE_ONLY )) { +pci_bus_claim_resources (bus); + }else { +pci_bus_size_bridges (bus); +pci_bus_assign_resources (bus); -list_for_each_entry (child, &bus->children, node) -pcie_bus_configure_settings (child); +list_for_each_entry (child, &bus->children, node) +pcie_bus_configure_settings (child); + }pci_bus_add_devices (bus);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 49/64 iio: imu: inv_icm42600: fix spi burst write not supported
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <[email protected]>
commit c0f866de4ce447bca3191b9cefac60c4b36a7922 upstream.
Burst write with SPI is not working for all icm42600 chips. It was only used for setting user offsets with regmap_bulk_write.
Add specific SPI regmap config for using only single write with SPI.
--- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 1 + drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 11 +++++++++++ drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600.h +1 -0
@@ -360,6 +360,7 @@ struct inv_icm42600_state {typedef int (*inv_icm42600_bus_setup )(struct inv_icm42600_state *);extern const struct regmap_config inv_icm42600_regmap_config; +extern const struct regmap_config inv_icm42600_spi_regmap_config;extern const struct dev_pm_ops inv_icm42600_pm_ops; const struct iio_mount_matrix *
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +11 -0
@@ -43,6 +43,17 @@ const struct regmap_config inv_icm42600_ };EXPORT_SYMBOL_GPL (inv_icm42600_regmap_config); +/* define specific regmap for SPI not supporting burst write */ +const struct regmap_config inv_icm42600_spi_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =0x4FFF , + .ranges = inv_icm42600_regmap_ranges, + .num_ranges =ARRAY_SIZE (inv_icm42600_regmap_ranges), + .use_single_write = true, +}; +EXPORT_SYMBOL_NS_GPL (inv_icm42600_spi_regmap_config,IIO_ICM42600 ); +struct inv_icm42600_hw {uint8_t whoami;const char *name;
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c +2 -1
@@ -59,7 +59,8 @@ static int inv_icm42600_probe(struct spireturn -EINVAL ; chip = (uintptr_t )match; - regmap =devm_regmap_init_spi (spi, &inv_icm42600_regmap_config); +/* use SPI specific regmap */ + regmap =devm_regmap_init_spi (spi, &inv_icm42600_spi_regmap_config);if (IS_ERR (regmap))return PTR_ERR (regmap);
Greg Kroah-Hartman
maintainerPATCH 50/64 iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <[email protected]>
commit 65a60a590142c54a3f3be11ff162db2d5b0e1e06 upstream.
Currently suspending while sensors are one will result in timestamping continuing without gap at resume. It can work with monotonic clock but not with other clocks. Fix that by resetting timestamping.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +6 -1
@@ -720,6 +720,8 @@ out_unlock:static int __maybe_unused inv_icm42600_resume (struct device *dev) {struct inv_icm42600_state *st =dev_get_drvdata (dev); +struct inv_icm42600_timestamp *gyro_ts =iio_priv (st->indio_gyro); +struct inv_icm42600_timestamp *accel_ts =iio_priv (st->indio_accel);int ret;mutex_lock (&st->lock);
@@ -740,9 +742,12 @@ static int __maybe_unused inv_icm42600_r goto out_unlock;/* restore FIFO data streaming */ -if (st->fifo.on) +if (st->fifo.on) { +inv_icm42600_timestamp_reset (gyro_ts); +inv_icm42600_timestamp_reset (accel_ts); ret =regmap_write (st->map,INV_ICM42600_REG_FIFO_CONFIG ,INV_ICM42600_FIFO_CONFIG_STREAM ); + } out_unlock:mutex_unlock (&st->lock);
Greg Kroah-Hartman
maintainerPATCH 51/64 iio: adc: rockchip_saradc: fix information leak in triggered buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 38724591364e1e3b278b4053f102b49ea06ee17c upstream.
The 'data' local struct is used to push data to user space from a triggered buffer, but it does not set values for inactive channels, as it only uses iio_for_each_active_channel() to assign new values.
Initialize the struct to zero before using it to avoid pushing uninitialized information to userspace.
--- drivers/iio/adc/rockchip_saradc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/rockchip_saradc.c +2 -0
@@ -270,6 +270,8 @@ static irqreturn_t rockchip_saradc_triggint ret;int i, j =0 ; +memset (&data,0 ,sizeof (data)); +mutex_lock (&i_dev->mlock);for_each_set_bit (i, i_dev->active_scan_mask, i_dev->masklength) {
Greg Kroah-Hartman
maintainerPATCH 52/64 drm/amd/display: Fix out-of-bounds access in dcn21_link_encoder_create
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
commit 63de35a8fcfca59ae8750d469a7eb220c7557baf upstream.
An issue was identified in the dcn21_link_encoder_create function where an out-of-bounds access could occur when the hpd_source index was used to reference the link_enc_hpd_regs array. This array has a fixed size and the index was not being checked against the array's bounds before accessing it.
This fix adds a conditional check to ensure that the hpd_source index is within the valid range of the link_enc_hpd_regs array. If the index is out of bounds, the function now returns NULL to prevent undefined behavior.
References:
[ 65.920507] ------------[ cut here ]------------ [ 65.920510] UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29 [ 65.920519] index 7 is out of range for type 'dcn10_link_enc_hpd_registers [5]' [ 65.920523] CPU: 3 PID: 1178 Comm: modprobe Tainted: G OE 6.8.0-cleanershaderfeatureresetasdntipmi200nv2132 #13 [ 65.920525] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS WMJ0429N_Weekly_20_04_2 04/29/2020 [ 65.920527] Call Trace: [ 65.920529] <TASK> [ 65.920532] dump_stack_lvl+0x48/0x70 [ 65.920541] dump_stack+0x10/0x20 [ 65.920543] __ubsan_handle_out_of_bounds+0xa2/0xe0 [ 65.920549] dcn21_link_encoder_create+0xd9/0x140 [amdgpu] [ 65.921009] link_create+0x6d3/0xed0 [amdgpu] [ 65.921355] create_links+0x18a/0x4e0 [amdgpu] [ 65.921679] dc_create+0x360/0x720 [amdgpu] [ 65.921999] ? dmi_matches+0xa0/0x220 [ 65.922004] amdgpu_dm_init+0x2b6/0x2c90 [amdgpu] [ 65.922342] ? console_unlock+0x77/0x120 [ 65.922348] ? dev_printk_emit+0x86/0xb0 [ 65.922354] dm_hw_init+0x15/0x40 [amdgpu] [ 65.922686] amdgpu_device_init+0x26a8/0x33a0 [amdgpu] [ 65.922921] amdgpu_driver_load_kms+0x1b/0xa0 [amdgpu] [ 65.923087] amdgpu_pci_probe+0x1b7/0x630 [amdgpu] [ 65.923087] local_pci_probe+0x4b/0xb0 [ 65.923087] pci_device_probe+0xc8/0x280 [ 65.923087] really_probe+0x187/0x300 [ 65.923087] __driver_probe_device+0x85/0x130 [ 65.923087] driver_probe_device+0x24/0x110 [ 65.923087] __driver_attach+0xac/0x1d0 [ 65.923087] ? __pfx___driver_attach+0x10/0x10 [ 65.923087] bus_for_each_dev+0x7d/0xd0 [ 65.923087] driver_attach+0x1e/0x30 [ 65.923087] bus_add_driver+0xf2/0x200 [ 65.923087] driver_register+0x64/0x130 [ 65.923087] ? __pfx_amdgpu_init+0x10/0x10 [amdgpu] [ 65.923087] __pci_register_driver+0x61/0x70 [ 65.923087] amdgpu_init+0x7d/0xff0 [amdgpu] [ 65.923087] do_one_initcall+0x49/0x310 [ 65.923087] ? kmalloc_trace+0x136/0x360 [ 65.923087] do_init_module+0x6a/0x270 [ 65.923087] load_module+0x1fce/0x23a0 [ 65.923087] init_module_from_file+0x9c/0xe0 [ 65.923087] ? init_module_from_file+0x9c/0xe0 [ 65.923087] idempotent_init_module+0x179/0x230 [ 65.923087] __x64_sys_finit_module+0x5d/0xa0 [ 65.923087] do_syscall_64+0x76/0x120 [ 65.923087] entry_SYSCALL_64_after_hwframe+0x6e/0x76 [ 65.923087] RIP: 0033:0x7f2d80f1e88d [ 65.923087] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 b5 0f 00 f7 d8 64 89 01 48 [ 65.923087] RSP: 002b:00007ffc7bc1aa78 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 65.923087] RAX: ffffffffffffffda RBX: 0000564c9c1db130 RCX: 00007f2d80f1e88d [ 65.923087] RDX: 0000000000000000 RSI: 0000564c9c1e5480 RDI: 000000000000000f [ 65.923087] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000002 [ 65.923087] R10: 000000000000000f R11: 0000000000000246 R12: 0000564c9c1e5480 [ 65.923087] R13: 0000564c9c1db260 R14: 0000000000000000 R15: 0000564c9c1e54b0 [ 65.923087] </TASK> [ 65.923927] ---[ end trace ]---
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -1
@@ -1340,7 +1340,7 @@ static struct link_encoder *dcn21_link_ekzalloc (sizeof (struct dcn21_link_encoder ),GFP_KERNEL );int link_regs_id; -if (!enc21) +if (!enc21 || enc_init_data->hpd_source >=ARRAY_SIZE (link_enc_hpd_regs))return NULL ; link_regs_id =
Greg Kroah-Hartman
maintainerPATCH 53/64 drm/amdgpu: fix usage slab after free
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Prosyak <[email protected]>
commit b61badd20b443eabe132314669bb51a263982e5c upstream.
[ +0.000021] BUG: KASAN: slab-use-after-free in drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched] [ +0.000027] Read of size 8 at addr ffff8881b8605f88 by task amd_pci_unplug/2147
[ +0.000023] CPU: 6 PID: 2147 Comm: amd_pci_unplug Not tainted 6.10.0+ #1 [ +0.000016] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020 [ +0.000016] Call Trace: [ +0.000008] <TASK> [ +0.000009] dump_stack_lvl+0x76/0xa0 [ +0.000017] print_report+0xce/0x5f0 [ +0.000017] ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched] [ +0.000019] ? srso_return_thunk+0x5/0x5f [ +0.000015] ? kasan_complete_mode_report_info+0x72/0x200 [ +0.000016] ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched] [ +0.000019] kasan_report+0xbe/0x110 [ +0.000015] ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched] [ +0.000023] __asan_report_load8_noabort+0x14/0x30 [ +0.000014] drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched] [ +0.000020] ? srso_return_thunk+0x5/0x5f [ +0.000013] ? __kasan_check_write+0x14/0x30 [ +0.000016] ? __pfx_drm_sched_entity_flush+0x10/0x10 [gpu_sched] [ +0.000020] ? srso_return_thunk+0x5/0x5f [ +0.000013] ? __kasan_check_write+0x14/0x30 [ +0.000013] ? srso_return_thunk+0x5/0x5f [ +0.000013] ? enable_work+0x124/0x220 [ +0.000015] ? __pfx_enable_work+0x10/0x10 [ +0.000013] ? srso_return_thunk+0x5/0x5f [ +0.000014] ? free_large_kmalloc+0x85/0xf0 [ +0.000016] drm_sched_entity_destroy+0x18/0x30 [gpu_sched] [ +0.000020] amdgpu_vce_sw_fini+0x55/0x170 [amdgpu] [ +0.000735] ? __kasan_check_read+0x11/0x20 [ +0.000016] vce_v4_0_sw_fini+0x80/0x110 [amdgpu] [ +0.000726] amdgpu_device_fini_sw+0x331/0xfc0 [amdgpu] [ +0.000679] ? mutex_unlock+0x80/0xe0 [ +0.000017] ? __pfx_amdgpu_device_fini_sw+0x10/0x10 [amdgpu] [ +0.000662] ? srso_return_thunk+0x5/0x5f [ +0.000014] ? __kasan_check_write+0x14/0x30 [ +0.000013] ? srso_return_thunk+0x5/0x5f [ +0.000013] ? mutex_unlock+0x80/0xe0 [ +0.000016] amdgpu_driver_release_kms+0x16/0x80 [amdgpu] [ +0.000663] drm_minor_release+0xc9/0x140 [drm] [ +0.000081] drm_release+0x1fd/0x390 [drm] [ +0.000082] __fput+0x36c/0xad0 [ +0.000018] __fput_sync+0x3c/0x50 [ +0.000014] __x64_sys_close+0x7d/0xe0 [ +0.000014] x64_sys_call+0x1bc6/0x2680 [ +0.000014] do_syscall_64+0x70/0x130 [ +0.000014] ? srso_return_thunk+0x5/0x5f [ +0.000014] ? irqentry_exit_to_user_mode+0x60/0x190 [ +0.000015] ? srso_return_thunk+0x5/0x5f [ +0.000014] ? irqentry_exit+0x43/0x50 [ +0.000012] ? srso_return_thunk+0x5/0x5f [ +0.000013] ? exc_page_fault+0x7c/0x110 [ +0.000015] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ +0.000014] RIP: 0033:0x7ffff7b14f67 [ +0.000013] Code: ff e8 0d 16 02 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 73 ba f7 ff [ +0.000026] RSP: 002b:00007fffffffe378 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 [ +0.000019] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffff7b14f67 [ +0.000014] RDX: 0000000000000000 RSI: 00007ffff7f6f47a RDI: 0000000000000003 [ +0.000014] RBP: 00007fffffffe3a0 R08: 0000555555569890 R09: 0000000000000000 [ +0.000014] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffffffe5c8 [ +0.000013] R13: 00005555555552a9 R14: 0000555555557d48 R15: 00007ffff7ffd040 [ +0.000020] </TASK>
[ +0.000016] Allocated by task 383 on cpu 7 at 26.880319s: [ +0.000014] kasan_save_stack+0x28/0x60 [ +0.000008] kasan_save_track+0x18/0x70 [ +0.000007] kasan_save_alloc_info+0x38/0x60 [ +0.000007] __kasan_kmalloc+0xc1/0xd0 [ +0.000007] kmalloc_trace_noprof+0x180/0x380 [ +0.000007] drm_sched_init+0x411/0xec0 [gpu_sched] [ +0.000012] amdgpu_device_init+0x695f/0xa610 [amdgpu] [ +0.000658] amdgpu_driver_load_kms+0x1a/0x120 [amdgpu] [ +0.000662] amdgpu_pci_probe+0x361/0xf30 [amdgpu] [ +0.000651] local_pci_probe+0xe7/0x1b0 [ +0.000009] pci_device_probe+0x248/0x890 [ +0.000008] really_probe+0x1fd/0x950 [ +0.000008] __driver_probe_device+0x307/0x410 [ +0.000007] driver_probe_device+0x4e/0x150 [ +0.000007] __driver_attach+0x223/0x510 [ +0.000006] bus_for_each_dev+0x102/0x1a0 [ +0.000007] driver_attach+0x3d/0x60 [ +0.000006] bus_add_driver+0x2ac/0x5f0 [ +0.000006] driver_register+0x13d/0x490 [ +0.000008] __pci_register_driver+0x1ee/0x2b0 [ +0.000007] llc_sap_close+0xb0/0x160 [llc] [ +0.000009] do_one_initcall+0x9c/0x3e0 [ +0.000008] do_init_module+0x241/0x760 [ +0.000008] load_module+0x51ac/0x6c30 [ +0.000006] __do_sys_init_module+0x234/0x270 [ +0.000007] __x64_sys_init_module+0x73/0xc0 [ +0.000006] x64_sys_call+0xe3/0x2680 [ +0.000006] do_syscall_64+0x70/0x130 [ +0.000007] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000015] Freed by task 2147 on cpu 6 at 160.507651s: [ +0.000013] kasan_save_stack+0x28/0x60 [ +0.000007] kasan_save_track+0x18/0x70 [ +0.000007] kasan_save_free_info+0x3b/0x60 [ +0.000007] poison_slab_object+0x115/0x1c0 [ +0.000007] __kasan_slab_free+0x34/0x60 [ +0.000007] kfree+0xfa/0x2f0 [ +0.000007] drm_sched_fini+0x19d/0x410 [gpu_sched] [ +0.000012] amdgpu_fence_driver_sw_fini+0xc4/0x2f0 [amdgpu] [ +0.000662] amdgpu_device_fini_sw+0x77/0xfc0 [amdgpu] [ +0.000653] amdgpu_driver_release_kms+0x16/0x80 [amdgpu] [ +0.000655] drm_minor_release+0xc9/0x140 [drm] [ +0.000071] drm_release+0x1fd/0x390 [drm] [ +0.000071] __fput+0x36c/0xad0 [ +0.000008] __fput_sync+0x3c/0x50 [ +0.000007] __x64_sys_close+0x7d/0xe0 [ +0.000007] x64_sys_call+0x1bc6/0x2680 [ +0.000007] do_syscall_64+0x70/0x130 [ +0.000007] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000014] The buggy address belongs to the object at ffff8881b8605f80
which belongs to the cache kmalloc-64 of size 64
[ +0.000020] The buggy address is located 8 bytes inside of
freed 64-byte region [ffff8881b8605f80, ffff8881b8605fc0)
[ +0.000028] The buggy address belongs to the physical page: [ +0.000011] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b8605 [ +0.000008] anon flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff) [ +0.000007] page_type: 0xffffefff(slab) [ +0.000009] raw: 0017ffffc0000000 ffff8881000428c0 0000000000000000 dead000000000001 [ +0.000006] raw: 0000000000000000 0000000000200020 00000001ffffefff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected
[ +0.000012] Memory state around the buggy address: [ +0.000011] ffff8881b8605e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ +0.000015] ffff8881b8605f00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc [ +0.000015] >ffff8881b8605f80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ +0.000013] ^ [ +0.000011] ffff8881b8606000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc [ +0.000014] ffff8881b8606080: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb [ +0.000013] ==================================================================
The issue reproduced on VG20 during the IGT pci_unplug test.
The root cause of the issue is that the function drm_sched_fini is called before drm_sched_entity_kill. In drm_sched_fini, the drm_sched_rq structure is freed, but this structure is later accessed by each entity within the run queue, leading to invalid memory access.
To resolve this, the order of cleanup calls is updated:
Before:
amdgpu_fence_driver_sw_fini
amdgpu_device_ip_fini
After:
amdgpu_device_ip_fini
amdgpu_fence_driver_sw_fini
This updated order ensures that all entities in the IPs are cleaned up first, followed by proper cleanup of the schedulers.
Additional Investigation:
During debugging, another issue was identified in the amdgpu_vce_sw_fini function. The vce.vcpu_bo buffer must be freed only as the final step in the cleanup process to prevent any premature access during earlier cleanup stages.
v2: Using Christian suggestion call drm_sched_entity_destroy before drm_sched_fini.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -4131,8 +4131,8 @@ void amdgpu_device_fini_sw(struct amdgpuint idx;bool px; -amdgpu_fence_driver_sw_fini (adev);amdgpu_device_ip_fini (adev); +amdgpu_fence_driver_sw_fini (adev);release_firmware (adev->firmware.gpu_info_fw); adev->firmware.gpu_info_fw =NULL ; adev->accel_working = false;
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +3 -3
@@ -220,15 +220,15 @@ int amdgpu_vce_sw_fini(struct amdgpu_devdrm_sched_entity_destroy (&adev->vce.entity); -amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, - (void **)&adev->vce.cpu_addr); -for (i =0 ; i < adev->vce.num_rings; i++)amdgpu_ring_fini (&adev->vce.ring[i]);release_firmware (adev->vce.fw);mutex_destroy (&adev->vce.idle_mutex); +amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, + (void **)&adev->vce.cpu_addr); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 54/64 block: fix uaf for flush rq while iterating tags
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 3802f73bd80766d70f319658f334754164075bc3 upstream.
blk_mq_clear_flush_rq_mapping() is not called during scsi probe, by checking blk_queue_init_done(). However, QUEUE_FLAG_INIT_DONE is cleared in del_gendisk by commit aec89dc5d421 ("block: keep q_usage_counter in atomic mode after del_gendisk"), hence for disk like scsi, following blk_mq_destroy_queue() will not clear flush rq from tags->rqs[] as well, cause following uaf that is found by our syzkaller for v6.6:
==================================================================
BUG: KASAN: slab-use-after-free in blk_mq_find_and_get_req+0x16e/0x1a0 block/blk-mq-tag.c:261 Read of size 4 at addr ffff88811c969c20 by task kworker/1:2H/224909 CPU: 1 PID: 224909 Comm: kworker/1:2H Not tainted 6.6.0-ga836a5060850 #32 Workqueue: kblockd blk_mq_timeout_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x91/0xf0 lib/dump_stack.c:106 print_address_description.constprop.0+0x66/0x300 mm/kasan/report.c:364 print_report+0x3e/0x70 mm/kasan/report.c:475 kasan_report+0xb8/0xf0 mm/kasan/report.c:588 blk_mq_find_and_get_req+0x16e/0x1a0 block/blk-mq-tag.c:261 bt_iter block/blk-mq-tag.c:288 [inline] __sbitmap_for_each_set include/linux/sbitmap.h:295 [inline] sbitmap_for_each_set include/linux/sbitmap.h:316 [inline] bt_for_each+0x455/0x790 block/blk-mq-tag.c:325 blk_mq_queue_tag_busy_iter+0x320/0x740 block/blk-mq-tag.c:534 blk_mq_timeout_work+0x1a3/0x7b0 block/blk-mq.c:1673 process_one_work+0x7c4/0x1450 kernel/workqueue.c:2631 process_scheduled_works kernel/workqueue.c:2704 [inline] worker_thread+0x804/0xe40 kernel/workqueue.c:2785 kthread+0x346/0x450 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:293 Allocated by task 942: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc mm/kasan/common.c:383 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:198 [inline] __do_kmalloc_node mm/slab_common.c:1007 [inline] __kmalloc_node+0x69/0x170 mm/slab_common.c:1014 kmalloc_node include/linux/slab.h:620 [inline] kzalloc_node include/linux/slab.h:732 [inline] blk_alloc_flush_queue+0x144/0x2f0 block/blk-flush.c:499 blk_mq_alloc_hctx+0x601/0x940 block/blk-mq.c:3788 blk_mq_alloc_and_init_hctx+0x27f/0x330 block/blk-mq.c:4261 blk_mq_realloc_hw_ctxs+0x488/0x5e0 block/blk-mq.c:4294 blk_mq_init_allocated_queue+0x188/0x860 block/blk-mq.c:4350 blk_mq_init_queue_data block/blk-mq.c:4166 [inline] blk_mq_init_queue+0x8d/0x100 block/blk-mq.c:4176 scsi_alloc_sdev+0x843/0xd50 drivers/scsi/scsi_scan.c:335 scsi_probe_and_add_lun+0x77c/0xde0 drivers/scsi/scsi_scan.c:1189 __scsi_scan_target+0x1fc/0x5a0 drivers/scsi/scsi_scan.c:1727 scsi_scan_channel drivers/scsi/scsi_scan.c:1815 [inline] scsi_scan_channel+0x14b/0x1e0 drivers/scsi/scsi_scan.c:1791 scsi_scan_host_selected+0x2fe/0x400 drivers/scsi/scsi_scan.c:1844 scsi_scan+0x3a0/0x3f0 drivers/scsi/scsi_sysfs.c:151 store_scan+0x2a/0x60 drivers/scsi/scsi_sysfs.c:191 dev_attr_store+0x5c/0x90 drivers/base/core.c:2388 sysfs_kf_write+0x11c/0x170 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3fc/0x610 fs/kernfs/file.c:338 call_write_iter include/linux/fs.h:2083 [inline] new_sync_write+0x1b4/0x2d0 fs/read_write.c:493 vfs_write+0x76c/0xb00 fs/read_write.c:586 ksys_write+0x127/0x250 fs/read_write.c:639 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x70/0x120 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x78/0xe2 Freed by task 244687: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x50 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] __kasan_slab_free+0x12a/0x1b0 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1815 [inline] slab_free_freelist_hook mm/slub.c:1841 [inline] slab_free mm/slub.c:3807 [inline] __kmem_cache_free+0xe4/0x520 mm/slub.c:3820 blk_free_flush_queue+0x40/0x60 block/blk-flush.c:520 blk_mq_hw_sysfs_release+0x4a/0x170 block/blk-mq-sysfs.c:37 kobject_cleanup+0x136/0x410 lib/kobject.c:689 kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x119/0x140 lib/kobject.c:737 blk_mq_release+0x24f/0x3f0 block/blk-mq.c:4144 blk_free_queue block/blk-core.c:298 [inline] blk_put_queue+0xe2/0x180 block/blk-core.c:314 blkg_free_workfn+0x376/0x6e0 block/blk-cgroup.c:144 process_one_work+0x7c4/0x1450 kernel/workqueue.c:2631 process_scheduled_works kernel/workqueue.c:2704 [inline] worker_thread+0x804/0xe40 kernel/workqueue.c:2785 kthread+0x346/0x450 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:293
Other than blk_mq_clear_flush_rq_mapping(), the flag is only used in blk_register_queue() from initialization path, hence it's safe not to clear the flag in del_gendisk. And since QUEUE_FLAG_REGISTERED already make sure that queue should only be registered once, there is no need to test the flag as well.
Depends-on: commit aec89dc5d421 ("block: keep q_usage_counter in atomic mode after del_gendisk")
--- block/blk-sysfs.c | 6 ++---- block/genhd.c | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-)
block/blk-sysfs.c +2 -4
@@ -858,10 +858,8 @@ unlock:* faster to shut down and is made fully functional here as * request_queues for non-existent devices never get registered. */ -if (!blk_queue_init_done (q)) { -blk_queue_flag_set (QUEUE_FLAG_INIT_DONE , q); -percpu_ref_switch_to_percpu (&q->q_usage_counter); - } +blk_queue_flag_set (QUEUE_FLAG_INIT_DONE , q); +percpu_ref_switch_to_percpu (&q->q_usage_counter);return ret;
block/genhd.c +3 -6
@@ -685,13 +685,10 @@ void del_gendisk(struct gendisk *disk)* If the disk does not own the queue, allow using passthrough requests * again. Else leave the queue frozen to fail all I/O. */ -if (!test_bit (GD_OWNS_QUEUE , &disk->state)) { -blk_queue_flag_clear (QUEUE_FLAG_INIT_DONE , q); +if (!test_bit (GD_OWNS_QUEUE , &disk->state))__blk_mq_unfreeze_queue (q, true); - }else { -if (queue_is_mq (q)) -blk_mq_exit_queue (q); - } +else if (queue_is_mq (q)) +blk_mq_exit_queue (q); }EXPORT_SYMBOL (del_gendisk);
Greg Kroah-Hartman
maintainerPATCH 55/64 Revert "drm/amdgpu: rework resume handling for display (v2)"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit c807ab3a861f656bc39471a20a16b36632ac6b04 which is commit 73dae652dcac776296890da215ee7dec357a1032 upstream.
The original patch 73dae652dcac (drm/amdgpu: rework resume handling for display (v2)), was only targeted at kernels 6.11 and newer. It did not apply cleanly to 6.12 so I backported it and it backport landed as 99a02eab8251 ("drm/amdgpu: rework resume handling for display (v2)"), however there was a bug in the backport that was subsequently fixed in 063d380ca28e ("drm/amdgpu: fix backport of commit 73dae652dcac"). None of this was intended for kernels older than 6.11, however the original backport eventually landed in 6.6, 6.1, and 5.15.
Please revert the change from kernels 6.6, 6.1, and 5.15.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 45 +---------------------------- 1 file changed, 2 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -43
@@ -3242,7 +3242,7 @@ static int amdgpu_device_ip_resume_phase* * @adev: amdgpu_device pointer * -* Second resume function for hardware IPs. The list of all the hardware +* First resume function for hardware IPs. The list of all the hardware * IPs that make up the asic is walked and the resume callbacks are run for * all blocks except COMMON, GMC, and IH. resume puts the hardware into a * functional state after a suspend and updates the software state as
@@ -3260,7 +3260,6 @@ static int amdgpu_device_ip_resume_phaseif (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_COMMON || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_GMC || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_IH || - adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_DCE || adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_PSP )continue ; r = adev->ip_blocks[i].version->funcs->resume (adev);
@@ -3285,36 +3284,6 @@ static int amdgpu_device_ip_resume_phase }/** -* amdgpu_device_ip_resume_phase3 - run resume for hardware IPs -* -* @adev: amdgpu_device pointer -* -* Third resume function for hardware IPs. The list of all the hardware -* IPs that make up the asic is walked and the resume callbacks are run for -* all DCE. resume puts the hardware into a functional state after a suspend -* and updates the software state as necessary. This function is also used -* for restoring the GPU after a GPU reset. -* -* Returns 0 on success, negative error code on failure. -*/ -static int amdgpu_device_ip_resume_phase3 (struct amdgpu_device *adev) -{ -int i, r; - -for (i =0 ; i < adev->num_ip_blocks; i++) { -if (!adev->ip_blocks[i].status.valid || adev->ip_blocks[i].status.hw) -continue ; -if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_DCE ) { - r = adev->ip_blocks[i].version->funcs->resume (adev); -if (r) -return r; - } - } - -return 0 ; -} - -/** * amdgpu_device_ip_resume - run resume for hardware IPs * * @adev: amdgpu_device pointer
@@ -3344,13 +3313,6 @@ static int amdgpu_device_ip_resume(struc r =amdgpu_device_ip_resume_phase2 (adev); -if (r) -return r; - -amdgpu_fence_driver_hw_init (adev); - - r =amdgpu_device_ip_resume_phase3 (adev); -return r; }
@@ -4349,6 +4311,7 @@ int amdgpu_device_resume(struct drm_devidev_err (adev->dev,"amdgpu_device_ip_resume failed (%d).\n" , r);return r; } +amdgpu_fence_driver_hw_init (adev); r =amdgpu_device_ip_late_init (adev);if (r)
@@ -5102,10 +5065,6 @@ int amdgpu_do_asic_reset(struct list_heaif (r) goto out; - r =amdgpu_device_ip_resume_phase3 (tmp_adev); -if (r) - goto out; -if (vram_lost)amdgpu_device_fill_reset_magic (tmp_adev);
Greg Kroah-Hartman
maintainerPATCH 56/64 RDMA/rxe: Fix the qp flush warnings in req
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
commit ea4c990fa9e19ffef0648e40c566b94ba5ab31be upstream.
When the qp is in error state, the status of WQEs in the queue should be set to error. Or else the following will appear.
[ 920.617269] WARNING: CPU: 1 PID: 21 at drivers/infiniband/sw/rxe/rxe_comp.c:756 rxe_completer+0x989/0xcc0 [rdma_rxe] [ 920.617744] Modules linked in: rnbd_client(O) rtrs_client(O) rtrs_core(O) rdma_ucm rdma_cm iw_cm ib_cm crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel ib_uverbs ib_core loop brd null_blk ipv6 [ 920.618516] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G O 6.1.113-storage+ #65 [ 920.618986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 [ 920.619396] RIP: 0010:rxe_completer+0x989/0xcc0 [rdma_rxe] [ 920.619658] Code: 0f b6 84 24 3a 02 00 00 41 89 84 24 44 04 00 00 e9 2a f7 ff ff 39 ca bb 03 00 00 00 b8 0e 00 00 00 48 0f 45 d8 e9 15 f7 ff ff <0f> 0b e9 cb f8 ff ff 41 bf f5 ff ff ff e9 08 f8 ff ff 49 8d bc 24 [ 920.620482] RSP: 0018:ffff97b7c00bbc38 EFLAGS: 00010246 [ 920.620817] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000008 [ 920.621183] RDX: ffff960dc396ebc0 RSI: 0000000000005400 RDI: ffff960dc4e2fbac [ 920.621548] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffffac406450 [ 920.621884] R10: ffffffffac4060c0 R11: 0000000000000001 R12: ffff960dc4e2f800 [ 920.622254] R13: ffff960dc4e2f928 R14: ffff97b7c029c580 R15: 0000000000000000 [ 920.622609] FS: 0000000000000000(0000) GS:ffff960ef7d00000(0000) knlGS:0000000000000000 [ 920.622979] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 920.623245] CR2: 00007fa056965e90 CR3: 00000001107f1000 CR4: 00000000000006e0 [ 920.623680] Call Trace: [ 920.623815] <TASK> [ 920.623933] ? __warn+0x79/0xc0 [ 920.624116] ? rxe_completer+0x989/0xcc0 [rdma_rxe] [ 920.624356] ? report_bug+0xfb/0x150 [ 920.624594] ? handle_bug+0x3c/0x60 [ 920.624796] ? exc_invalid_op+0x14/0x70 [ 920.624976] ? asm_exc_invalid_op+0x16/0x20 [ 920.625203] ? rxe_completer+0x989/0xcc0 [rdma_rxe] [ 920.625474] ? rxe_completer+0x329/0xcc0 [rdma_rxe] [ 920.625749] rxe_do_task+0x80/0x110 [rdma_rxe] [ 920.626037] rxe_requester+0x625/0xde0 [rdma_rxe] [ 920.626310] ? rxe_cq_post+0xe2/0x180 [rdma_rxe] [ 920.626583] ? do_complete+0x18d/0x220 [rdma_rxe] [ 920.626812] ? rxe_completer+0x1a3/0xcc0 [rdma_rxe] [ 920.627050] rxe_do_task+0x80/0x110 [rdma_rxe] [ 920.627285] tasklet_action_common.constprop.0+0xa4/0x120 [ 920.627522] handle_softirqs+0xc2/0x250 [ 920.627728] ? sort_range+0x20/0x20 [ 920.627942] run_ksoftirqd+0x1f/0x30 [ 920.628158] smpboot_thread_fn+0xc7/0x1b0 [ 920.628334] kthread+0xd6/0x100 [ 920.628504] ? kthread_complete_and_exit+0x20/0x20 [ 920.628709] ret_from_fork+0x1f/0x30 [ 920.628892] </TASK>
--- drivers/infiniband/sw/rxe/rxe_req.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +4 -2
@@ -643,13 +643,15 @@ int rxe_requester(void *arg)if (unlikely (qp->req.state ==QP_STATE_ERROR )) { wqe =req_next_wqe (qp); -if (wqe) +if (wqe) {/* * Generate an error completion for error qp state */ + wqe->status =IB_WC_WR_FLUSH_ERR ; goto err; -else + }else { goto exit; + } }if (unlikely (qp->req.state ==QP_STATE_RESET )) {
Greg Kroah-Hartman
maintainerPATCH 57/64 scsi: sg: Fix slab-use-after-free read in sg_release()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suraj Sonawane <[email protected]>
commit f10593ad9bc36921f623361c9e3dd96bd52d85ee upstream.
Fix a use-after-free bug in sg_release(), detected by syzbot with KASAN:
BUG: KASAN: slab-use-after-free in lock_release+0x151/0xa30 kernel/locking/lockdep.c:5838 __mutex_unlock_slowpath+0xe2/0x750 kernel/locking/mutex.c:912 sg_release+0x1f4/0x2e0 drivers/scsi/sg.c:407
In sg_release(), the function kref_put(&sfp->f_ref, sg_remove_sfp) is called before releasing the open_rel_lock mutex. The kref_put() call may decrement the reference count of sfp to zero, triggering its cleanup through sg_remove_sfp(). This cleanup includes scheduling deferred work via sg_remove_sfp_usercontext(), which ultimately frees sfp.
After kref_put(), sg_release() continues to unlock open_rel_lock and may reference sfp or sdp. If sfp has already been freed, this results in a slab-use-after-free error.
Move the kref_put(&sfp->f_ref, sg_remove_sfp) call after unlocking the open_rel_lock mutex. This ensures:
- No references to sfp or sdp occur after the reference count is decremented.
- Cleanup functions such as sg_remove_sfp() and sg_remove_sfp_usercontext() can safely execute without impacting the mutex handling in sg_release().
The fix has been tested and validated by syzbot. This patch closes the bug reported at the following syzkaller link and ensures proper sequencing of resource cleanup and mutex operations, eliminating the risk of use-after-free errors in sg_release().
--- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sg.c +1 -1
@@ -390,7 +390,6 @@ sg_release(struct inode *inode, struct fmutex_lock (&sdp->open_rel_lock);scsi_autopm_put_device (sdp->device); -kref_put (&sfp->f_ref, sg_remove_sfp); sdp->open_cnt--;/* possibly many open()s waiting on exlude clearing, start many;
@@ -402,6 +401,7 @@ sg_release(struct inode *inode, struct fwake_up_interruptible (&sdp->open_wait); }mutex_unlock (&sdp->open_rel_lock); +kref_put (&sfp->f_ref, sg_remove_sfp);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 58/64 Revert "regmap: detach regmap from dev on regmap_exit"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 48dc44f3c1afa29390cb2fbc8badad1b1111cea4 which is commit 3061e170381af96d1e66799d34264e6414d428a7 upstream.
It was backported incorrectly, a fixed version will be applied later.
--- drivers/base/regmap/regmap.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/base/regmap/regmap.c +0 -12
@@ -652,17 +652,6 @@ int regmap_attach_dev(struct device *dev }EXPORT_SYMBOL_GPL (regmap_attach_dev); -static int dev_get_regmap_match (struct device *dev,void *res,void *data); - -static int regmap_detach_dev (struct device *dev,struct regmap *map) -{ -if (!dev) -return 0 ; - -return devres_release (dev, dev_get_regmap_release, - dev_get_regmap_match, (void *)map->name); -} -static enum regmap_endian regmap_get_reg_endian (const struct regmap_bus *bus,const struct regmap_config *config) {
@@ -1513,7 +1502,6 @@ int regmap_reinit_cache(struct regmap *m {int ret; -regmap_detach_dev (map->dev, map);regcache_exit (map);regmap_debugfs_exit (map);
Greg Kroah-Hartman
maintainerPATCH 59/64 wifi: ath10k: avoid NULL pointer error during sdio remove
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <[email protected]>
commit 95c38953cb1ecf40399a676a1f85dfe2b5780a9a upstream.
When running 'rmmod ath10k', ath10k_sdio_remove() will free sdio workqueue by destroy_workqueue(). But if CONFIG_INIT_ON_FREE_DEFAULT_ON is set to yes, kernel panic will happen:
Call trace: destroy_workqueue+0x1c/0x258 ath10k_sdio_remove+0x84/0x94 sdio_bus_remove+0x50/0x16c device_release_driver_internal+0x188/0x25c device_driver_detach+0x20/0x2c
This is because during 'rmmod ath10k', ath10k_sdio_remove() will call ath10k_core_destroy() before destroy_workqueue(). wiphy_dev_release() will finally be called in ath10k_core_destroy(). This function will free struct cfg80211_registered_device *rdev and all its members, including wiphy, dev and the pointer of sdio workqueue. Then the pointer of sdio workqueue will be set to NULL due to CONFIG_INIT_ON_FREE_DEFAULT_ON.
After device release, destroy_workqueue() will use NULL pointer then the kernel panic happen.
Call trace:
ath10k_sdio_remove
->ath10k_core_unregister
……
->ath10k_core_stop
->ath10k_hif_stop
->ath10k_sdio_irq_disable
->ath10k_hif_power_down
->del_timer_sync(&ar_sdio->sleep_timer)
->ath10k_core_destroy
->ath10k_mac_destroy
->ieee80211_free_hw
->wiphy_free
……
->wiphy_dev_release->destroy_workqueue
Need to call destroy_workqueue() before ath10k_core_destroy(), free the work queue buffer first and then free pointer of work queue by ath10k_core_destroy(). This order matches the error path order in ath10k_sdio_probe().
No work will be queued on sdio workqueue between it is destroyed and ath10k_core_destroy() is called. Based on the call_stack above, the reason is:
Only ath10k_sdio_sleep_timer_handler(), ath10k_sdio_hif_tx_sg() and ath10k_sdio_irq_disable() will queue work on sdio workqueue. Sleep timer will be deleted before ath10k_core_destroy() in ath10k_hif_power_down().ath10k_sdio_irq_disable() only be called in ath10k_hif_stop(). ath10k_core_unregister() will call ath10k_hif_power_down() to stop hif bus, so ath10k_sdio_hif_tx_sg() won't be called anymore.
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00189
--- drivers/net/wireless/ath/ath10k/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/sdio.c +2 -2
@@ -2647,9 +2647,9 @@ static void ath10k_sdio_remove(struct sdnetif_napi_del (&ar->napi); -ath10k_core_destroy (ar); -destroy_workqueue (ar_sdio->workqueue); + +ath10k_core_destroy (ar); }static const struct sdio_device_id ath10k_sdio_devices[] = {
Greg Kroah-Hartman
maintainerPATCH 60/64 erofs: tidy up EROFS on-disk naming
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit 1c7f49a76773bcf95d3c840cff6cd449114ddf56 upstream.
- Get rid of all "vle" (variable-length extents) expressions since they only expand overall name lengths unnecessarily;
- Rename COMPRESSION_LEGACY to COMPRESSED_FULL;
- Move on-disk directory definitions ahead of compression;
- Drop unused extended attribute definitions;
- Move inode ondisk union i_u out as union erofs_inode_i_u.
No actual logical change.
--- fs/erofs/erofs_fs.h | 145 ++++++++++++++++++++++------------------------------ fs/erofs/zmap.c | 116 ++++++++++++++++++++--------------------- 2 files changed, 119 insertions(+), 142 deletions(-)
fs/erofs/erofs_fs.h +62 -83
@@ -82,32 +82,27 @@ struct erofs_super_block { };/* -* erofs inode datalayout (i_format in on-disk inode): +* EROFS inode datalayout (i_format in on-disk inode): * 0 - uncompressed flat inode without tail-packing inline data: -* inode, [xattrs], ... | ... | no-holed data * 1 - compressed inode with non-compact indexes: -* inode, [xattrs], [map_header], extents ... | ... * 2 - uncompressed flat inode with tail-packing inline data: -* inode, [xattrs], tailpacking data, ... | ... | no-holed data * 3 - compressed inode with compact indexes: -* inode, [xattrs], map_header, extents ... | ... * 4 - chunk-based inode with (optional) multi-device support: -* inode, [xattrs], chunk indexes ... | ... * 5~7 - reserved */ enum {EROFS_INODE_FLAT_PLAIN =0 , -EROFS_INODE_FLAT_COMPRESSION_LEGACY =1 , +EROFS_INODE_COMPRESSED_FULL =1 ,EROFS_INODE_FLAT_INLINE =2 , -EROFS_INODE_FLAT_COMPRESSION =3 , +EROFS_INODE_COMPRESSED_COMPACT =3 ,EROFS_INODE_CHUNK_BASED =4 ,EROFS_INODE_DATALAYOUT_MAX };static inline bool erofs_inode_is_data_compressed (unsigned int datamode) { -return datamode ==EROFS_INODE_FLAT_COMPRESSION || - datamode ==EROFS_INODE_FLAT_COMPRESSION_LEGACY ; +return datamode ==EROFS_INODE_COMPRESSED_COMPACT || + datamode ==EROFS_INODE_COMPRESSED_FULL ; }/* bit definitions of inode i_format */
@@ -128,11 +123,30 @@ static inline bool erofs_inode_is_data_c#define EROFS_CHUNK_FORMAT_ALL \ (EROFS_CHUNK_FORMAT_BLKBITS_MASK | EROFS_CHUNK_FORMAT_INDEXES) +/* 32-byte on-disk inode */ +#define EROFS_INODE_LAYOUT_COMPACT 0 +/* 64-byte on-disk inode */ +#define EROFS_INODE_LAYOUT_EXTENDED 1 +struct erofs_inode_chunk_info {__le16 format;/* chunk blkbits, etc. */ __le16 reserved; }; +union erofs_inode_i_u { +/* total compressed blocks for compressed inodes */ +__le32 compressed_blocks; + +/* block address for uncompressed flat inodes */ +__le32 raw_blkaddr; + +/* for device files, used to indicate old/new device # */ +__le32 rdev; + +/* for chunk-based files, it contains the summary info */ +struct erofs_inode_chunk_info c; +}; +/* 32-byte reduced form of an ondisk inode */ struct erofs_inode_compact {__le16 i_format;/* inode format hints */
@@ -143,29 +157,14 @@ struct erofs_inode_compact {__le16 i_nlink;__le32 i_size;__le32 i_reserved; -union { -/* total compressed blocks for compressed inodes */ -__le32 compressed_blocks; -/* block address for uncompressed flat inodes */ -__le32 raw_blkaddr; - -/* for device files, used to indicate old/new device # */ -__le32 rdev; - -/* for chunk-based files, it contains the summary info */ -struct erofs_inode_chunk_info c; - } i_u; -__le32 i_ino;/* only used for 32-bit stat compatibility */ +union erofs_inode_i_u i_u; + +__le32 i_ino;/* only used for 32-bit stat compatibility */ __le16 i_uid;__le16 i_gid;__le32 i_reserved2; }; -/* 32-byte on-disk inode */ -#define EROFS_INODE_LAYOUT_COMPACT 0 -/* 64-byte on-disk inode */ -#define EROFS_INODE_LAYOUT_EXTENDED 1 -/* 64-byte complete form of an ondisk inode */ struct erofs_inode_extended {__le16 i_format;/* inode format hints */
@@ -175,22 +174,9 @@ struct erofs_inode_extended {__le16 i_mode;__le16 i_reserved;__le64 i_size; -union { -/* total compressed blocks for compressed inodes */ -__le32 compressed_blocks; -/* block address for uncompressed flat inodes */ -__le32 raw_blkaddr; - -/* for device files, used to indicate old/new device # */ -__le32 rdev; - -/* for chunk-based files, it contains the summary info */ -struct erofs_inode_chunk_info c; - } i_u; - -/* only used for 32-bit stat compatibility */ -__le32 i_ino; +union erofs_inode_i_u i_u; +__le32 i_ino;/* only used for 32-bit stat compatibility */ __le32 i_uid;__le32 i_gid;__le64 i_mtime;
@@ -199,10 +185,6 @@ struct erofs_inode_extended {__u8 i_reserved2[16 ]; }; -#define EROFS_MAX_SHARED_XATTRS (128) -/* h_shared_count between 129 ... 255 are special # */ -#define EROFS_SHARED_XATTR_EXTENT (255) -/* * inline xattrs (n == i_xattr_icount): * erofs_xattr_ibody_header(1) + (n - 1) * 4 bytes
@@ -268,6 +250,22 @@ struct erofs_inode_chunk_index {__le32 blkaddr;/* start block address of this inode chunk */ }; +/* dirent sorts in alphabet order, thus we can do binary search */ +struct erofs_dirent { +__le64 nid;/* node number */ +__le16 nameoff;/* start offset of file name */ +__u8 file_type;/* file type */ +__u8 reserved;/* reserved */ +} __packed; + +/* +* EROFS file types should match generic FT_* types and +* it seems no need to add BUILD_BUG_ONs since potential +* unmatchness will break other fses as well... +*/ + +#define EROFS_NAME_LEN 255 +/* maximum supported size of a physical compression cluster */ #define Z_EROFS_PCLUSTER_MAX_SIZE (1024 * 1024)
@@ -337,10 +335,8 @@ struct z_erofs_map_header {__u8 h_clusterbits; }; -#define Z_EROFS_VLE_LEGACY_HEADER_PADDING 8 -/* -* Fixed-sized output compression on-disk logical cluster type: +* On-disk logical cluster type: * 0 - literal (uncompressed) lcluster * 1,3 - compressed lcluster (for HEAD lclusters) * 2 - compressed lcluster (for NONHEAD lclusters)
@@ -364,27 +360,27 @@ struct z_erofs_map_header {* di_u.delta[1] = distance to the next HEAD lcluster */ enum { -Z_EROFS_VLE_CLUSTER_TYPE_PLAIN =0 , -Z_EROFS_VLE_CLUSTER_TYPE_HEAD1 =1 , -Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD =2 , -Z_EROFS_VLE_CLUSTER_TYPE_HEAD2 =3 , -Z_EROFS_VLE_CLUSTER_TYPE_MAX +Z_EROFS_LCLUSTER_TYPE_PLAIN =0 , +Z_EROFS_LCLUSTER_TYPE_HEAD1 =1 , +Z_EROFS_LCLUSTER_TYPE_NONHEAD =2 , +Z_EROFS_LCLUSTER_TYPE_HEAD2 =3 , +Z_EROFS_LCLUSTER_TYPE_MAX }; -#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS 2 -#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0 +#define Z_EROFS_LI_LCLUSTER_TYPE_BITS 2 +#define Z_EROFS_LI_LCLUSTER_TYPE_BIT 0/* (noncompact only, HEAD) This pcluster refers to partial decompressed data */ -#define Z_EROFS_VLE_DI_PARTIAL_REF (1 << 15) +#define Z_EROFS_LI_PARTIAL_REF (1 << 15)/* * D0_CBLKCNT will be marked _only_ at the 1st non-head lcluster to store the * compressed block count of a compressed extent (in logical clusters, aka. * block count of a pcluster). */ -#define Z_EROFS_VLE_DI_D0_CBLKCNT (1 << 11) +#define Z_EROFS_LI_D0_CBLKCNT (1 << 11) -struct z_erofs_vle_decompressed_index { +struct z_erofs_lcluster_index {__le16 di_advise;/* where to decompress in the head lcluster */ __le16 di_clusterofs;
@@ -401,25 +397,8 @@ struct z_erofs_vle_decompressed_index { } di_u; }; -#define Z_EROFS_VLE_LEGACY_INDEX_ALIGN (size) \ - (round_up(size, sizeof(struct z_erofs_vle_decompressed_index)) + \ - sizeof(struct z_erofs_map_header) + Z_EROFS_VLE_LEGACY_HEADER_PADDING) - -/* dirent sorts in alphabet order, thus we can do binary search */ -struct erofs_dirent { -__le64 nid;/* node number */ -__le16 nameoff;/* start offset of file name */ -__u8 file_type;/* file type */ -__u8 reserved;/* reserved */ -} __packed; - -/* -* EROFS file types should match generic FT_* types and -* it seems no need to add BUILD_BUG_ONs since potential -* unmatchness will break other fses as well... -*/ - -#define EROFS_NAME_LEN 255 +#define Z_EROFS_FULL_INDEX_ALIGN (end) \ + (ALIGN(end, 8) + sizeof(struct z_erofs_map_header) + 8)/* check the EROFS on-disk layout strictly at compile time */ static inline void erofs_check_ondisk_layout_definitions (void )
@@ -436,15 +415,15 @@ static inline void erofs_check_ondisk_laBUILD_BUG_ON (sizeof (struct erofs_inode_chunk_info ) !=4 );BUILD_BUG_ON (sizeof (struct erofs_inode_chunk_index ) !=8 );BUILD_BUG_ON (sizeof (struct z_erofs_map_header ) !=8 ); -BUILD_BUG_ON (sizeof (struct z_erofs_vle_decompressed_index ) !=8 ); +BUILD_BUG_ON (sizeof (struct z_erofs_lcluster_index ) !=8 );BUILD_BUG_ON (sizeof (struct erofs_dirent ) !=12 );/* keep in sync between 2 index structures for better extendibility */ BUILD_BUG_ON (sizeof (struct erofs_inode_chunk_index ) != -sizeof (struct z_erofs_vle_decompressed_index )); +sizeof (struct z_erofs_lcluster_index ));BUILD_BUG_ON (sizeof (struct erofs_deviceslot ) !=128 ); -BUILD_BUG_ON (BIT (Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS ) < -Z_EROFS_VLE_CLUSTER_TYPE_MAX -1 ); +BUILD_BUG_ON (BIT (Z_EROFS_LI_LCLUSTER_TYPE_BITS ) < +Z_EROFS_LCLUSTER_TYPE_MAX -1 );/* exclude old compiler versions like gcc 7.5.0 */ BUILD_BUG_ON (__builtin_constant_p (fmh) ? fmh !=cpu_to_le64 (1ULL <<63 ) :0 );
fs/erofs/zmap.c +57 -59
290 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 61/64 erofs: handle NONHEAD !delta[1] lclusters gracefully
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit 0bc8061ffc733a0a246b8689b2d32a3e9204f43c upstream.
syzbot reported a WARNING in iomap_iter_done:
iomap_fiemap+0x73b/0x9b0 fs/iomap/fiemap.c:80 ioctl_fiemap fs/ioctl.c:220 [inline]
Generally, NONHEAD lclusters won't have delta[1]==0, except for crafted images and filesystems created by pre-1.0 mkfs versions.
Previously, it would immediately bail out if delta[1]==0, which led to inadequate decompressed lengths (thus FIEMAP is impacted). Treat it as delta[1]=1 to work around these legacy mkfs versions.
lclusterbits > 14 is illegal for compact indexes, error out too.
--- fs/erofs/zmap.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
fs/erofs/zmap.c +9 -8
@@ -256,7 +256,7 @@ static int compacted_load_cluster_from_dunsigned int amortizedshift;erofs_off_t pos; -if (lcn >= totalidx) +if (lcn >= totalidx || vi->z_logical_clusterbits >14 )return -EINVAL ; m->lcn = lcn;
@@ -441,7 +441,7 @@ static int z_erofs_get_extent_decompressu64 lcn = m->lcn, headlcn = map->m_la >> lclusterbits;int err; - do { +while (1 ) {/* handle the last EOF pcluster (no next HEAD lcluster) */ if ((lcn << lclusterbits) >= inode->i_size) { map->m_llen = inode->i_size - map->m_la;
@@ -453,14 +453,16 @@ static int z_erofs_get_extent_decompressreturn err;if (m->type ==Z_EROFS_LCLUSTER_TYPE_NONHEAD ) { -DBG_BUGON (!m->delta[1 ] && - m->clusterofs !=1 << lclusterbits); +/* work around invalid d1 generated by pre-1.0 mkfs */ +if (unlikely (!m->delta[1 ])) { + m->delta[1 ] =1 ; +DBG_BUGON (1 ); + } }else if (m->type ==Z_EROFS_LCLUSTER_TYPE_PLAIN || m->type ==Z_EROFS_LCLUSTER_TYPE_HEAD1 || m->type ==Z_EROFS_LCLUSTER_TYPE_HEAD2 ) { -/* go on until the next HEAD lcluster */ if (lcn != headlcn) -break ; +break ;/* ends at the next HEAD lcluster */ m->delta[1 ] =1 ; }else { erofs_err(inode->i_sb, "unknown type %u @ lcn %llu of nid %llu",
@@ -469,8 +471,7 @@ static int z_erofs_get_extent_decompressreturn -EOPNOTSUPP ; } lcn += m->delta[1 ]; - }while (m->delta[1 ]); - + } map->m_llen = (lcn << lclusterbits) + m->clusterofs - map->m_la;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 62/64 nfsd: add list_head nf_gc to struct nfsd_file
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youzhong Yang <[email protected]>
commit 8e6e2ffa6569a205f1805cbaeca143b556581da6 upstream.
nfsd_file_put() in one thread can race with another thread doing garbage collection (running nfsd_file_gc() -> list_lru_walk() -> nfsd_file_lru_cb()):
* In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
* nfsd_file_lru_add() returns true (with NFSD_FILE_REFERENCED bit set)
* garbage collector kicks in, nfsd_file_lru_cb() clears REFERENCED bit and returns LRU_ROTATE.
* garbage collector kicks in again, nfsd_file_lru_cb() now decrements nf->nf_ref to 0, runs nfsd_file_unhash(), removes it from the LRU and adds to the dispose list [list_lru_isolate_move(lru, &nf->nf_lru, head)]
* nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))]. The 'nf' has been added to the 'dispose' list by nfsd_file_lru_cb(), so nfsd_file_lru_remove(nf) simply treats it as part of the LRU and removes it, which leads to its removal from the 'dispose' list.
* At this moment, 'nf' is unhashed with its nf_ref being 0, and not on the LRU.
nfsd_file_put() continues its execution [if (refcount_dec_and_test(&nf->nf_ref))],
as nf->nf_ref is already 0, nf->nf_ref is set to REFCOUNT_SATURATED, and the 'nf'
gets no chance of being freed.nfsd_file_put() can also race with nfsd_file_cond_queue():
* In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
* nfsd_file_lru_add() sets REFERENCED bit and returns true.
* Some userland application runs 'exportfs -f' or something like that, which triggers
__nfsd_file_cache_purge() -> nfsd_file_cond_queue().
* In nfsd_file_cond_queue(), it runs [if (!nfsd_file_unhash(nf))], unhash is done
successfully.
* nfsd_file_cond_queue() runs [if (!nfsd_file_get(nf))], now nf->nf_ref goes to 2.
* nfsd_file_cond_queue() runs [if (nfsd_file_lru_remove(nf))], it succeeds.
* nfsd_file_cond_queue() runs [if (refcount_sub_and_test(decrement, &nf->nf_ref))]
(with "decrement" being 2), so the nf->nf_ref goes to 0, the 'nf' is added to the
dispose list [list_add(&nf->nf_lru, dispose)]
* nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove
the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))], although the 'nf' is not
in the LRU, but it is linked in the 'dispose' list, nfsd_file_lru_remove() simply
treats it as part of the LRU and removes it. This leads to its removal from
the 'dispose' list!
* Now nf->ref is 0, unhashed. nfsd_file_put() continues its execution and set
nf->nf_ref to REFCOUNT_SATURATED.As shown in the above analysis, using nf_lru for both the LRU list and dispose list can cause the leaks. This patch adds a new list_head nf_gc in struct nfsd_file, and uses it for the dispose list. This does not fix the nfsd_file leaking issue completely.
--- fs/nfsd/filecache.c | 18 ++++++++++-------- fs/nfsd/filecache.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-)
fs/nfsd/filecache.c +10 -8
@@ -219,6 +219,7 @@ nfsd_file_alloc(struct net *net, structreturn NULL ;INIT_LIST_HEAD (&nf->nf_lru); +INIT_LIST_HEAD (&nf->nf_gc); nf->nf_birthtime =ktime_get (); nf->nf_file =NULL ; nf->nf_cred =get_current_cred ();
@@ -396,8 +397,8 @@ nfsd_file_dispose_list(struct list_headstruct nfsd_file *nf;while (!list_empty (dispose)) { - nf = list_first_entry(dispose, struct nfsd_file, nf_lru); -list_del_init (&nf->nf_lru); + nf = list_first_entry(dispose, struct nfsd_file, nf_gc); +list_del_init (&nf->nf_gc);nfsd_file_free (nf); } }
@@ -414,12 +415,12 @@ nfsd_file_dispose_list_delayed(struct li {while (!list_empty (dispose)) {struct nfsd_file *nf =list_first_entry (dispose, - struct nfsd_file, nf_lru); + struct nfsd_file, nf_gc);struct nfsd_net *nn =net_generic (nf->nf_net, nfsd_net_id);struct nfsd_fcache_disposal *l = nn->fcache_disposal;spin_lock (&l->lock); -list_move_tail (&nf->nf_lru, &l->freeme); +list_move_tail (&nf->nf_gc, &l->freeme);spin_unlock (&l->lock);queue_work (nfsd_filecache_wq, &l->work); }
@@ -476,7 +477,8 @@ nfsd_file_lru_cb(struct list_head *item,/* Refcount went to zero. Unhash it and queue it to the dispose list */ nfsd_file_unhash (nf); -list_lru_isolate_move (lru, &nf->nf_lru, head); +list_lru_isolate (lru, &nf->nf_lru); +list_add (&nf->nf_gc, head);this_cpu_inc (nfsd_file_evictions);trace_nfsd_file_gc_disposed (nf);return LRU_REMOVED ;
@@ -555,7 +557,7 @@ nfsd_file_cond_queue(struct nfsd_file *n/* If refcount goes to 0, then put on the dispose list */ if (refcount_sub_and_test (decrement, &nf->nf_ref)) { -list_add (&nf->nf_lru, dispose); +list_add (&nf->nf_gc, dispose);trace_nfsd_file_closing (nf); } }
@@ -631,8 +633,8 @@ nfsd_file_close_inode_sync(struct inodenfsd_file_queue_for_close (inode, &dispose);while (!list_empty (&dispose)) { - nf = list_first_entry(&dispose, struct nfsd_file, nf_lru); -list_del_init (&nf->nf_lru); + nf = list_first_entry(&dispose, struct nfsd_file, nf_gc); +list_del_init (&nf->nf_gc);nfsd_file_free (nf); }flush_delayed_fput ();
fs/nfsd/filecache.h +1 -0
@@ -44,6 +44,7 @@ struct nfsd_file {struct nfsd_file_mark *nf_mark;struct list_head nf_lru; +struct list_head nf_gc;struct rcu_head nf_rcu;ktime_t nf_birthtime; };
Greg Kroah-Hartman
maintainerPATCH 63/64 x86/xen: fix SLS mitigation in xen_hypercall_iret()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
The backport of upstream patch a2796dff62d6 ("x86/xen: don't do PV iret hypercall through hypercall page") missed to adapt the SLS mitigation config check from CONFIG_MITIGATION_SLS to CONFIG_SLS.
--- arch/x86/xen/xen-asm.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/xen-asm.S +1 -1
@@ -221,7 +221,7 @@ SYM_CODE_END(xen_early_idt_handler_array push %rax mov $__HYPERVISOR_iret, %eax syscall /* Do the IRET. */ -#ifdef CONFIG_MITIGATION_SLS +#ifdef CONFIG_SLS int3 #endif .endm
Greg Kroah-Hartman
maintainerPATCH 64/64 net: fix data-races around sk->sk_forward_alloc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
commit 073d89808c065ac4c672c0a613a71b27a80691cb upstream.
Syzkaller reported this warning:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 16 at net/ipv4/af_inet.c:156 inet_sock_destruct+0x1c5/0x1e0 Modules linked in: CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.12.0-rc5 #26 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:inet_sock_destruct+0x1c5/0x1e0 Code: 24 12 4c 89 e2 5b 48 c7 c7 98 ec bb 82 41 5c e9 d1 18 17 ff 4c 89 e6 5b 48 c7 c7 d0 ec bb 82 41 5c e9 bf 18 17 ff 0f 0b eb 83 <0f> 0b eb 97 0f 0b eb 87 0f 0b e9 68 ff ff ff 66 66 2e 0f 1f 84 00 RSP: 0018:ffffc9000008bd90 EFLAGS: 00010206 RAX: 0000000000000300 RBX: ffff88810b172a90 RCX: 0000000000000007 RDX: 0000000000000002 RSI: 0000000000000300 RDI: ffff88810b172a00 RBP: ffff88810b172a00 R08: ffff888104273c00 R09: 0000000000100007 R10: 0000000000020000 R11: 0000000000000006 R12: ffff88810b172a00 R13: 0000000000000004 R14: 0000000000000000 R15: ffff888237c31f78 FS: 0000000000000000(0000) GS:ffff888237c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc63fecac8 CR3: 000000000342e000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? __warn+0x88/0x130 ? inet_sock_destruct+0x1c5/0x1e0 ? report_bug+0x18e/0x1a0 ? handle_bug+0x53/0x90 ? exc_invalid_op+0x18/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? inet_sock_destruct+0x1c5/0x1e0 __sk_destruct+0x2a/0x200 rcu_do_batch+0x1aa/0x530 ? rcu_do_batch+0x13b/0x530 rcu_core+0x159/0x2f0 handle_softirqs+0xd3/0x2b0 ? __pfx_smpboot_thread_fn+0x10/0x10 run_ksoftirqd+0x25/0x30 smpboot_thread_fn+0xdd/0x1d0 kthread+0xd3/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> ---[ end trace 0000000000000000 ]---
Its possible that two threads call tcp_v6_do_rcv()/sk_forward_alloc_add() concurrently when sk->sk_state == TCP_LISTEN with sk->sk_lock unlocked, which triggers a data-race around sk->sk_forward_alloc:tcp_v6_rcv
tcp_v6_do_rcv
skb_clone_and_charge_r
sk_rmem_schedule
__sk_mem_schedule
sk_forward_alloc_add()
skb_set_owner_r
sk_mem_charge
sk_forward_alloc_add()
__kfree_skb
skb_release_all
skb_release_head_state
sock_rfree
sk_mem_uncharge
sk_forward_alloc_add()
sk_mem_reclaim
// set local var reclaimable
__sk_mem_reclaim
sk_forward_alloc_add()In this syzkaller testcase, two threads calltcp_v6_do_rcv() with skb->truesize=768, the sk_forward_alloc changes like this:
(cpu 1) | (cpu 2) | sk_forward_alloc
... | ... | 0
__sk_mem_schedule() | | +4096 = 4096
| __sk_mem_schedule() | +4096 = 8192
sk_mem_charge() | | -768 = 7424
| sk_mem_charge() | -768 = 6656
... | ... |
sk_mem_uncharge() | | +768 = 7424
reclaimable=7424 | |
| sk_mem_uncharge() | +768 = 8192
| reclaimable=8192 |
__sk_mem_reclaim() | | -4096 = 4096
| __sk_mem_reclaim() | -8192 = -4096 != 0The skb_clone_and_charge_r() should not be called in tcp_v6_do_rcv() when sk->sk_state is TCP_LISTEN, it happens later in tcp_v6_syn_recv_sock(). Fix the same issue in dccp_v6_do_rcv().
--- net/dccp/ipv6.c | 2 +- net/ipv6/tcp_ipv6.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
net/dccp/ipv6.c +1 -1
@@ -615,7 +615,7 @@ static int dccp_v6_do_rcv(struct sock *sby tcp. Feel free to propose better solution. --ANK (980728) */ -if (np->rxopt.all) +if (np->rxopt.all && sk->sk_state !=DCCP_LISTEN ) opt_skb =skb_clone_and_charge_r (skb, sk);if (sk->sk_state ==DCCP_OPEN ) {/* Fast path */
net/ipv6/tcp_ipv6.c +1 -3
@@ -1463,7 +1463,7 @@ int tcp_v6_do_rcv(struct sock *sk, strucby tcp. Feel free to propose better solution. --ANK (980728) */ -if (np->rxopt.all) +if (np->rxopt.all && sk->sk_state !=TCP_LISTEN ) opt_skb =skb_clone_and_charge_r (skb, sk); reason =SKB_DROP_REASON_NOT_SPECIFIED ;
@@ -1502,8 +1502,6 @@ int tcp_v6_do_rcv(struct sock *sk, strucif (nsk != sk) {if (tcp_child_process (sk, nsk, skb)) goto reset; -if (opt_skb) -__kfree_skb (opt_skb);return 0 ; } }else
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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 Thu, 23 Jan 2025 17:45:02 +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.1.127-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.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
Am 21.01.2025 um 18:51 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
On my 2-socket Ivy Bridge Xeon E5-2697 v2 server, I get a build error:
CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn303.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn31.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn314.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn315.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn316.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn32.o LD [M] drivers/gpu/drm/amd/amdgpu/amdgpu.o AR drivers/gpu/built-in.a AR drivers/built-in.a AR built-in.a AR vmlinux.a LD vmlinux.o
OBJCOPY modules.builtin.modinfo
GEN modules.builtin
GEN .vmlinux.objs
MODPOST Module.symvers
ERROR: modpost: module inv-icm42600-spi uses symbol inv_icm42600_spi_regmap_config from namespace IIO_ICM42600, but does not import it. make[1]: *** [scripts/Makefile.modpost:127: Module.symvers] Fehler 1
make: *** [Makefile:1961: modpost] Fehler 2
root@linus:/usr/src/linux-stable-rc#
I have attached my .config file.
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,
Quoted 32 lines · Peter Schneider
Am 21.01.2025 um 18:51 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
On my 2-socket Ivy Bridge Xeon E5-2697 v2 server, I get a build error:
CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn303.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn31.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn314.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn315.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn316.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn32.o LD [M] drivers/gpu/drm/amd/amdgpu/amdgpu.o AR drivers/gpu/built-in.a AR drivers/built-in.a AR built-in.a AR vmlinux.a LD vmlinux.oOBJCOPY modules.builtin.modinfo
GEN modules.builtin
GEN .vmlinux.objs
MODPOST Module.symvers
ERROR: modpost: module inv-icm42600-spi uses symbolinv_icm42600_spi_regmap_configfrom namespaceIIO_ICM42600, but does not import it.
make[1]: *** [scripts/Makefile.modpost:127: Module.symvers] Fehler 1
make: *** [Makefile:1961: modpost] Fehler 2 root@linus:/usr/src/linux-stable-rc#
Quoted 1 line
I have attached my .config file.
Reverting c0f866de4ce447bca3191b9cefac60c4b36a7922 would solve the problem, but then maybe the other icm42600 related commits are incorrect? Guess it's a missing prequisite for that commit missing in 6.1.y.
Can confirm the failure as well in a test build for Debian.
Regards,
Salvatore
Greg Kroah-Hartman
maintainerQuoted 35 lines · Salvatore Bonaccorso
Hi,
Quoted 32 lines · Peter Schneider
Am 21.01.2025 um 18:51 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
On my 2-socket Ivy Bridge Xeon E5-2697 v2 server, I get a build error:
CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn303.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn31.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn314.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn315.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn316.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn32.o LD [M] drivers/gpu/drm/amd/amdgpu/amdgpu.o AR drivers/gpu/built-in.a AR drivers/built-in.a AR built-in.a AR vmlinux.a LD vmlinux.oOBJCOPY modules.builtin.modinfo
GEN modules.builtin
GEN .vmlinux.objs
MODPOST Module.symvers
ERROR: modpost: module inv-icm42600-spi uses symbolinv_icm42600_spi_regmap_configfrom namespaceIIO_ICM42600, but does not import it.
make[1]: *** [scripts/Makefile.modpost:127: Module.symvers] Fehler 1
make: *** [Makefile:1961: modpost] Fehler 2 root@linus:/usr/src/linux-stable-rc#
Quoted 8 lines
Quoted 1 line
I have attached my .config file.
Reverting
c0f866de4ce447bca3191b9cefac60c4b36a7922would solve the problem, but then maybe the other icm42600 related commits are incorrect? Guess it's a missing prequisite for that commit missing in 6.1.y.Can confirm the failure as well in a test build for Debian.
Ok, let me go fix this up, it's due to the namespace symbol stuff not being in 6.1.y, I'll hand edit the offending commit and push out a -rc2.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 43 lines · Greg Kroah-Hartman
Quoted 42 lines · Salvatore Bonaccorso
Hi,
Quoted 32 lines · Peter Schneider
Am 21.01.2025 um 18:51 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
On my 2-socket Ivy Bridge Xeon E5-2697 v2 server, I get a build error:
CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn303.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn31.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn314.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn315.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn316.o CC [M] drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn32.o LD [M] drivers/gpu/drm/amd/amdgpu/amdgpu.o AR drivers/gpu/built-in.a AR drivers/built-in.a AR built-in.a AR vmlinux.a LD vmlinux.oOBJCOPY modules.builtin.modinfo
GEN modules.builtin
GEN .vmlinux.objs
MODPOST Module.symvers
ERROR: modpost: module inv-icm42600-spi uses symbolinv_icm42600_spi_regmap_configfrom namespaceIIO_ICM42600, but does not import it.
make[1]: *** [scripts/Makefile.modpost:127: Module.symvers] Fehler 1
make: *** [Makefile:1961: modpost] Fehler 2 root@linus:/usr/src/linux-stable-rc#Quoted 1 line
I have attached my .config file.
Reverting
c0f866de4ce447bca3191b9cefac60c4b36a7922would solve the problem, but then maybe the other icm42600 related commits are incorrect? Guess it's a missing prequisite for that commit missing in 6.1.y.
Quoted 4 lines
Quoted 1 line
Can confirm the failure as well in a test build for Debian.
Ok, let me go fix this up, it's due to the namespace symbol stuff not being in 6.1.y, I'll hand edit the offending commit and push out a -rc2.
Same issue should be present in the 5.15-rc release, I'll go fix it up there too. Odd it didn't get caught in my build testing...
greg k-h
Quoted 30 lines · Peter Schneider
Am 21.01.2025 um 18:51 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
On my 2-socket Ivy Bridge Xeon E5-2697 v2 server, I get a build error:
CC [M]
drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn303.o
CC [M]drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn31.o
CC [M]drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn314.o
CC [M]drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn315.o
CC [M]drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn316.o
CC [M]drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn32.o
LD [M]drivers/gpu/drm/amd/amdgpu/amdgpu.o
ARdrivers/gpu/built-in.a
ARdrivers/built-in.a
AR built-in.a
AR vmlinux.a
LD vmlinux.o
OBJCOPY modules.builtin.modinfo
GEN modules.builtin
GEN .vmlinux.objs
MODPOST Module.symvers
ERROR: modpost: module inv-icm42600-spi uses symbolinv_icm42600_spi_regmap_configfrom namespaceIIO_ICM42600, but does not import it. make[1]: *** [scripts/Makefile.modpost:127: Module.symvers] Fehler 1
make: *** [Makefile:1961: modpost] Fehler 2
root@linus:/usr/src/linux-stable-rc#
Quoted 6 lines
I have attached my .config file.
Beste Grüße,
Peter Schneider
Seeing this on RISC-V also. Commit 9737085ba4040357da943b5eb975ce8444283b62 "iio: imu: inv_icm42600: fix spi burst write not supported" is the culprit.
The line:
EXPORT_SYMBOL_NS_GPL(inv_icm42600_spi_regmap_config, IIO_ICM42600);
should probably be:
EXPORT_SYMBOL_GPL(inv_icm42600_spi_regmap_config);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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 Thu, 23 Jan 2025 17:45:02 +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.1.127-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hello,
Quoted 4 lines · On Tue, 21 Jan 2025 18:51:59 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.1.127 release. There are 64 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.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/damonitor/damon-tests/tree/next/corr
[2] ad6747190c53 ("Linux 6.1.127-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: sysfs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh # SKIP
ok 12 selftests: damon-tests: build_m68k.sh # SKIP
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
The kernel, bpf tool, amd kselftest tool builds fine for v6.1.127-rc1 on x86 and arm64 Azure VM.
Thanks,
Hardik