6.16.1-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 536/627 md: make rdev_addable usable for rcu mode
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
[ Upstream commit 13017b427118f4311471ee47df74872372ca8482 ]
Our testcase trigger panic:
BUG: kernel NULL pointer dereference, address: 00000000000000e0 ... Oops: Oops: 0000 [#1] SMP NOPTI CPU: 2 UID: 0 PID: 85 Comm: kworker/2:1 Not tainted 6.16.0+ #94 PREEMPT(none) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 Workqueue: md_misc md_start_sync RIP: 0010:rdev_addable+0x4d/0xf0 ... Call Trace: <TASK> md_start_sync+0x329/0x480 process_one_work+0x226/0x6d0 worker_thread+0x19e/0x340 kthread+0x10f/0x250 ret_from_fork+0x14d/0x180 ret_from_fork_asm+0x1a/0x30 </TASK> Modules linked in: raid10 CR2: 00000000000000e0 ---[ end trace 0000000000000000 ]--- RIP: 0010:rdev_addable+0x4d/0xf0
md_spares_need_change in md_start_sync will call rdev_addable which protected by rcu_read_lock/rcu_read_unlock. This rcu context will help protect rdev won't be released, but rdev->mddev will be set to NULL before we call synchronize_rcu in md_kick_rdev_from_array. Fix this by using READ_ONCE and check does rdev->mddev still alive.
--- drivers/md/md.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/md/md.c +7 -1
@@ -9418,6 +9418,12 @@ static bool rdev_is_spare(struct md_rdev *rdev)static bool rdev_addable (struct md_rdev *rdev) { +struct mddev *mddev; + + mddev =READ_ONCE (rdev->mddev); +if (!mddev) +return false; +/* rdev is already used, don't add it again. */ if (test_bit (Candidate, &rdev->flags) || rdev->raid_disk >=0 ||test_bit (Faulty, &rdev->flags))
@@ -9428,7 +9434,7 @@ static bool rdev_addable(struct md_rdev *rdev)return true;/* Allow to add if array is read-write. */ -if (md_is_rdwr (rdev->mddev)) +if (md_is_rdwr (mddev))return true;/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 537/627 sunrpc: fix client side handling of tls alerts
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit cc5d59081fa26506d02de2127ab822f40d88bc5a ]
A security exploit was discovered in NFS over TLS in tls_alert_recv due to its assumption that there is valid data in the msghdr's iterator's kvec.
Instead, this patch proposes the rework how control messages are setup and used by sock_recvmsg().
If no control message structure is setup, kTLS layer will read and process TLS data record types. As soon as it encounters a TLS control message, it would return an error. At that point, NFS can setup a kvec backed control buffer and read in the control message such as a TLS alert. Scott found that a msg iterator can advance the kvec pointer as a part of the copy process thus we need to revert the iterator before calling into the tls_alert_recv.
--- net/sunrpc/xprtsock.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
net/sunrpc/xprtsock.c +30 -10
@@ -358,7 +358,7 @@ xs_alloc_sparse_pages(struct xdr_buf *buf, size_t want, gfp_t gfp)static int xs_sock_process_cmsg (struct socket *sock,struct msghdr *msg, -struct cmsghdr *cmsg,int ret) +unsigned int *msg_flags,struct cmsghdr *cmsg,int ret) {u8 content_type =tls_get_record_type (sock->sk, cmsg);u8 level, description;
@@ -371,7 +371,7 @@ xs_sock_process_cmsg(struct socket *sock, struct msghdr *msg,* record, even though there might be more frames * waiting to be decrypted. */ - msg->msg_flags &= ~MSG_EOR ; + *msg_flags &= ~MSG_EOR ;break ;case TLS_RECORD_TYPE_ALERT :tls_alert_recv (sock->sk, msg, &level, &description);
@@ -386,19 +386,33 @@ xs_sock_process_cmsg(struct socket *sock, struct msghdr *msg, }static int -xs_sock_recv_cmsg (struct socket *sock,struct msghdr *msg,int flags) +xs_sock_recv_cmsg (struct socket *sock,unsigned int *msg_flags,int flags) {union {struct cmsghdr cmsg;u8 buf[CMSG_SPACE (sizeof (u8))]; } u; +u8 alert[2 ]; +struct kvec alert_kvec = { + .iov_base = alert, + .iov_len =sizeof (alert), + }; +struct msghdr msg = { + .msg_flags = *msg_flags, + .msg_control = &u, + .msg_controllen =sizeof (u), + };int ret; - msg->msg_control = &u; - msg->msg_controllen =sizeof (u); - ret =sock_recvmsg (sock, msg, flags); -if (msg->msg_controllen !=sizeof (u)) - ret =xs_sock_process_cmsg (sock, msg, &u.cmsg, ret); +iov_iter_kvec (&msg.msg_iter,ITER_DEST , &alert_kvec,1 , + alert_kvec.iov_len); + ret =sock_recvmsg (sock, &msg, flags); +if (ret >0 && +tls_get_record_type (sock->sk, &u.cmsg) ==TLS_RECORD_TYPE_ALERT ) { +iov_iter_revert (&msg.msg_iter, ret); + ret =xs_sock_process_cmsg (sock, &msg, msg_flags, &u.cmsg, + -EAGAIN ); + }return ret; }
@@ -408,7 +422,13 @@ xs_sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags, size_t seek)ssize_t ret;if (seek !=0 )iov_iter_advance (&msg->msg_iter, seek); - ret =xs_sock_recv_cmsg (sock, msg, flags); + ret =sock_recvmsg (sock, msg, flags); +/* Handle TLS inband control message lazily */ +if (msg->msg_flags &MSG_CTRUNC ) { + msg->msg_flags &= ~(MSG_CTRUNC |MSG_EOR ); +if (ret ==0 || ret == -EIO ) + ret =xs_sock_recv_cmsg (sock, &msg->msg_flags, flags); + }return ret >0 ? ret + seek : ret; }
@@ -434,7 +454,7 @@ xs_read_discard(struct socket *sock, struct msghdr *msg, int flags, size_t count) {iov_iter_discard (&msg->msg_iter,ITER_DEST , count); -return xs_sock_recv_cmsg (sock, msg, flags); +return xs_sock_recvmsg (sock, msg, flags,0 ); }#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 538/627 drm/xe/pf: Disable PF restart worker on device removal
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit c286ce6b01f633806b4db3e4ec8e0162928299cd ]
We can't let restart worker run once device is removed, since other data that it might want to access could be already released. Explicitly disable worker as part of device cleanup action.
--- drivers/gpu/drm/xe/xe_gt_sriov_pf.c | 32 ++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_sriov_pf.c +31 -1
@@ -47,9 +47,16 @@ static int pf_alloc_metadata(struct xe_gt *gt)static void pf_init_workers (struct xe_gt *gt) { +xe_gt_assert (gt,IS_SRIOV_PF (gt_to_xe (gt)));INIT_WORK (>->sriov.pf.workers.restart, pf_worker_restart_func); } +static void pf_fini_workers (struct xe_gt *gt) +{ +xe_gt_assert (gt,IS_SRIOV_PF (gt_to_xe (gt))); +disable_work_sync (>->sriov.pf.workers.restart); +} +/** * xe_gt_sriov_pf_init_early - Prepare SR-IOV PF data structures on PF. * @gt: the &xe_gt to initialize
@@ -79,6 +86,21 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)return 0 ; } +static void pf_fini_action (void *arg) +{ +struct xe_gt *gt = arg; + +pf_fini_workers (gt); +} + +static int pf_init_late (struct xe_gt *gt) +{ +struct xe_device *xe =gt_to_xe (gt); + +xe_gt_assert (gt,IS_SRIOV_PF (xe)); +return devm_add_action_or_reset (xe->drm.dev, pf_fini_action, gt); +} +/** * xe_gt_sriov_pf_init - Prepare SR-IOV PF data structures on PF. * @gt: the &xe_gt to initialize
@@ -95,7 +117,15 @@ int xe_gt_sriov_pf_init(struct xe_gt *gt)if (err)return err; -return xe_gt_sriov_pf_migration_init (gt); + err =xe_gt_sriov_pf_migration_init (gt); +if (err) +return err; + + err =pf_init_late (gt); +if (err) +return err; + +return 0 ; }static bool pf_needs_enable_ggtt_guest_update (struct xe_device *xe)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 539/627 x86/irq: Plug vector setup race
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit ce0b5eedcb753697d43f61dd2e27d68eb5d3150f ]
Hogan reported a vector setup race, which overwrites the interrupt descriptor in the per CPU vector array resulting in a disfunctional device.
CPU0 CPU1
interrupt is raised in APIC IRR but not handled
free_irq()
per_cpu(vector_irq, CPU1)[vector] = VECTOR_SHUTDOWN;
request_irq() common_interrupt() d = this_cpu_read(vector_irq[vector]);
per_cpu(vector_irq, CPU1)[vector] = desc;
if (d == VECTOR_SHUTDOWN)
this_cpu_write(vector_irq[vector], VECTOR_UNUSED);free_irq() cannot observe the pending vector in the CPU1 APIC as there is no way to query the remote CPUs APIC IRR.
This requires that request_irq() uses the same vector/CPU as the one which was freed, but this also can be triggered by a spurious interrupt.
Interestingly enough this problem managed to be hidden for more than a decade.
Prevent this by reevaluating vector_irq under the vector lock, which is held by the interrupt activation code when vector_irq is updated.
To avoid ifdeffery or IS_ENABLED() nonsense, move the [un]lock_vector_lock() declarations out under the CONFIG_IRQ_DOMAIN_HIERARCHY guard as it's only provided when CONFIG_X86_LOCAL_APIC=y.
The current CONFIG_IRQ_DOMAIN_HIERARCHY guard is selected by CONFIG_X86_LOCAL_APIC, but can also be selected by other parts of the Kconfig system, which makes 32-bit UP builds with CONFIG_X86_LOCAL_APIC=n fail.
Can we just get rid of this !APIC nonsense once and forever?
--- arch/x86/include/asm/hw_irq.h | 12 ++++--- arch/x86/kernel/irq.c | 63 ++++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 20 deletions(-)
arch/x86/include/asm/hw_irq.h +7 -5
@@ -92,8 +92,6 @@ struct irq_cfg {extern struct irq_cfg *irq_cfg (unsigned int irq);extern struct irq_cfg *irqd_cfg (struct irq_data *irq_data); -extern void lock_vector_lock (void ); -extern void unlock_vector_lock (void );#ifdef CONFIG_SMP extern void vector_schedule_cleanup (struct irq_cfg *);extern void irq_complete_move (struct irq_cfg *cfg);
@@ -101,12 +99,16 @@ extern void irq_complete_move(struct irq_cfg *cfg);static inline void vector_schedule_cleanup (struct irq_cfg *c) { }static inline void irq_complete_move (struct irq_cfg *c) { }#endif -extern void apic_ack_edge (struct irq_data *data); -#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */ +#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ + +#ifdef CONFIG_X86_LOCAL_APIC +extern void lock_vector_lock (void ); +extern void unlock_vector_lock (void ); +#else static inline void lock_vector_lock (void ) {}static inline void unlock_vector_lock (void ) {} -#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ +#endif /* Statistics */ extern atomic_t irq_err_count;
arch/x86/kernel/irq.c +48 -15
81 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 540/627 eth: fbnic: unlink NAPIs from queues on error to open
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 4b31bcb025cb497da2b01f87173108ff32d350d2 ]
CI hit a UaF in fbnic in the AF_XDP portion of the queues.py test. The UaF is in the __sk_mark_napi_id_once() call in xsk_bind(), NAPI has been freed. Looks like the device failed to open earlier, and we lack clearing the NAPI pointer from the queue.
--- drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +3 -1
@@ -33,7 +33,7 @@ int __fbnic_open(struct fbnic_net *fbn)dev_warn (fbd->dev,"Error %d sending host ownership message to the firmware\n" , err); - goto free_resources; + goto err_reset_queues; } err =fbnic_time_start (fbn);
@@ -57,6 +57,8 @@ int __fbnic_open(struct fbnic_net *fbn)fbnic_time_stop (fbn); release_ownership:fbnic_fw_xmit_ownership_msg (fbn->fbd, false); +err_reset_queues: +fbnic_reset_netif_queues (fbn); free_resources:fbnic_free_resources (fbn); free_napi_vectors:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 541/627 ipa: fix compile-testing with qcom-mdt=m
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 2df158047d532d0e2a6b39953656c738872151a3 ]
There are multiple drivers that use the qualcomm mdt loader, but they have conflicting ideas of how to deal with that dependency when compile-testing for non-qualcomm targets:
IPA only enables the MDT loader when the kernel config includes ARCH_QCOM, but the newly added ath12k support always enables it, which leads to a link failure with the combination of IPA=y and ATH12K=m:
aarch64-linux-ld: drivers/net/ipa/ipa_main.o: in function `ipa_firmware_load':
ipa_main.c:(.text.unlikely+0x134): undefined reference to `qcom_mdt_load
The ATH12K method seems more reliable here, so change IPA over to do the same thing.
--- drivers/net/ipa/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/Kconfig +1 -1
@@ -5,7 +5,7 @@ config QCOM_IPA depends on INTERCONNECT depends on QCOM_RPROC_COMMON || (QCOM_RPROC_COMMON=n && COMPILE_TEST) depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n - select QCOM_MDT_LOADER if ARCH_QCOM + select QCOM_MDT_LOADER select QCOM_SCM select QCOM_QMI_HELPERS help
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 542/627 net: devmem: fix DMA direction on unmapping
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit fa516c0d8bf90da9d5b168757162205aafe5d0e1 ]
Looks like we always unmap the DMA_BUF with DMA_FROM_DEVICE direction. While at it unexport __net_devmem_dmabuf_binding_free(), it's internal.
Found by code inspection.
--- net/core/devmem.c | 6 +++--- net/core/devmem.h | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
net/core/devmem.c +3 -3
@@ -70,14 +70,13 @@ void __net_devmem_dmabuf_binding_free(struct work_struct *wq)gen_pool_destroy (binding->chunk_pool);dma_buf_unmap_attachment_unlocked (binding->attachment, binding->sgt, -DMA_FROM_DEVICE ); + binding->direction);dma_buf_detach (binding->dmabuf, binding->attachment);dma_buf_put (binding->dmabuf);xa_destroy (&binding->bound_rxqs);kvfree (binding->tx_vec);kfree (binding); } -EXPORT_SYMBOL (__net_devmem_dmabuf_binding_free);struct net_iov *net_devmem_alloc_dmabuf (struct net_devmem_dmabuf_binding *binding)
@@ -208,6 +207,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,mutex_init (&binding->lock); binding->dmabuf = dmabuf; + binding->direction = direction; binding->attachment =dma_buf_attach (binding->dmabuf, dev->dev.parent);if (IS_ERR (binding->attachment)) {
@@ -312,7 +312,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,kvfree (binding->tx_vec); err_unmap:dma_buf_unmap_attachment_unlocked (binding->attachment, binding->sgt, -DMA_FROM_DEVICE ); + direction); err_detach:dma_buf_detach (dmabuf, binding->attachment); err_free_binding:
net/core/devmem.h +3 -4
@@ -56,6 +56,9 @@ struct net_devmem_dmabuf_binding {*/ u32 id; +/* DMA direction, FROM_DEVICE for Rx binding, TO_DEVICE for Tx. */ +enum dma_data_direction direction; +/* Array of net_iov pointers for this binding, sorted by virtual * address. This array is convenient to map the virtual addresses to * net_iovs in the TX path.
@@ -165,10 +168,6 @@ static inline void net_devmem_put_net_iov(struct net_iov *niov) { } -static inline void __net_devmem_dmabuf_binding_free (struct work_struct *wq) -{ -} -static inline struct net_devmem_dmabuf_binding * net_devmem_bind_dmabuf(struct net_device *dev, enum dma_data_direction direction,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 543/627 net: airoha: npu: Add missing MODULE_FIRMWARE macros
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 4e7e471e2e3f9085fe1dbe821c4dd904a917c66a ]
Introduce missing MODULE_FIRMWARE definitions for firmware autoload.
--- drivers/net/ethernet/airoha/airoha_npu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/airoha/airoha_npu.c +2 -0
@@ -586,6 +586,8 @@ static struct platform_driver airoha_npu_driver = { };module_platform_driver (airoha_npu_driver); +MODULE_FIRMWARE (NPU_EN7581_FIRMWARE_DATA ); +MODULE_FIRMWARE (NPU_EN7581_FIRMWARE_RV32 );MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Lorenzo Bianconi <[email protected]>" );MODULE_DESCRIPTION ("Airoha Network Processor Unit driver" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 544/627 benet: fix BUG when creating VFs
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 5a40f8af2ba1b9bdf46e2db10e8c9710538fbc63 ]
benet crashes as soon as SRIOV VFs are created:
kernel BUG at mm/vmalloc.c:3457!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 4 UID: 0 PID: 7408 Comm: test.sh Kdump: loaded Not tainted 6.16.0+ #1 PREEMPT(voluntary) [...] RIP: 0010:vunmap+0x5f/0x70 [...] Call Trace: <TASK> __iommu_dma_free+0xe8/0x1c0 be_cmd_set_mac_list+0x3fe/0x640 [be2net] be_cmd_set_mac+0xaf/0x110 [be2net] be_vf_eth_addr_config+0x19f/0x330 [be2net] be_vf_setup+0x4f7/0x990 [be2net] be_pci_sriov_configure+0x3a1/0x470 [be2net] sriov_numvfs_store+0x20b/0x380 kernfs_fop_write_iter+0x354/0x530 vfs_write+0x9b9/0xf60 ksys_write+0xf3/0x1d0 do_syscall_64+0x8c/0x3d0
be_cmd_set_mac_list() calls dma_free_coherent() under a spin_lock_bh. Fix it by freeing only after the lock has been released.
--- drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_cmds.c +1 -1
@@ -3856,8 +3856,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, status =be_mcc_notify_wait (adapter); err: -dma_free_coherent (&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma);spin_unlock_bh (&adapter->mcc_lock); +dma_free_coherent (&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma);return status; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 545/627 Revert "net: mdio_bus: Use devm for getting reset GPIO"
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 175811b8f05f0da3e19b7d3124666649ddde3802 ]
This reverts commit 3b98c9352511db627b606477fc7944b2fa53a165.
Russell says:
Using devm_*() [here] is completely wrong, because this is called from mdiobus_register_device(). This is not the probe function for the device, and thus there is no code to trigger the release of the resource on unregistration.
Moreover, when the mdiodev is eventually probed, if the driver fails or the driver is unbound, the GPIO will be released, but a reference will be left behind.
Using devm* with a struct device that is *not* currently being probed is fundamentally wrong - an abuse of devm.
--- drivers/net/phy/mdio_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/mdio_bus.c +2 -2
@@ -36,8 +36,8 @@static int mdiobus_register_gpiod (struct mdio_device *mdiodev) {/* Deassert the optional reset signal */ - mdiodev->reset_gpio =devm_gpiod_get_optional (&mdiodev->dev, -"reset" ,GPIOD_OUT_LOW ); + mdiodev->reset_gpio =gpiod_get_optional (&mdiodev->dev, +"reset" ,GPIOD_OUT_LOW );if (IS_ERR (mdiodev->reset_gpio))return PTR_ERR (mdiodev->reset_gpio);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 546/627 net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maher Azzouzi <[email protected]>
[ Upstream commit ffd2dc4c6c49ff4f1e5d34e454a6a55608104c17 ]
TCA_MQPRIO_TC_ENTRY_INDEX is validated using NLA_POLICY_MAX(NLA_U32, TC_QOPT_MAX_QUEUE), which allows the value TC_QOPT_MAX_QUEUE (16). This leads to a 4-byte out-of-bounds stack write in the fp[] array, which only has room for 16 elements (0–15).
Fix this by changing the policy to allow only up to TC_QOPT_MAX_QUEUE - 1.
--- net/sched/sch_mqprio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_mqprio.c +1 -1
@@ -152,7 +152,7 @@ static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt,static const struct nla_policy mqprio_tc_entry_policy[TCA_MQPRIO_TC_ENTRY_MAX +1 ] = { [TCA_MQPRIO_TC_ENTRY_INDEX ] =NLA_POLICY_MAX (NLA_U32 , -TC_QOPT_MAX_QUEUE ), +TC_QOPT_MAX_QUEUE -1 ), [TCA_MQPRIO_TC_ENTRY_FP ] =NLA_POLICY_RANGE (NLA_U32 ,TC_FP_EXPRESS ,TC_FP_PREEMPTIBLE ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 547/627 s390/mm: Allocate page table with PAGE_SIZE granularity
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumanth Korikkar <[email protected]>
[ Upstream commit daa8af80d283ee9a7d42dd6f164a65036665b9d4 ]
Make vmem_pte_alloc() consistent by always allocating page table of PAGE_SIZE granularity, regardless of whether page_table_alloc() (with slab) or memblock_alloc() is used. This ensures page table can be fully freed when the corresponding page table entries are removed.
--- arch/s390/mm/vmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/s390/mm/vmem.c +2 -3
@@ -64,13 +64,12 @@ void *vmem_crst_alloc(unsigned long val)pte_t __ref *vmem_pte_alloc (void ) { -unsigned long size =PTRS_PER_PTE *sizeof (pte_t);pte_t *pte;if (slab_is_available ()) - pte = (pte_t *)page_table_alloc (&init_mm); + pte = (pte_t *)page_table_alloc (&init_mm);else - pte = (pte_t *)memblock_alloc (size, size); + pte = (pte_t *)memblock_alloc (PAGE_SIZE ,PAGE_SIZE );if (!pte)return NULL ;memset64 ((u64 *)pte, _PAGE_INVALID,PTRS_PER_PTE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 548/627 eth: fbnic: remove the debugging trick of super high page bias
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit e407fceeaf1b2959892b4fc9b584843d3f2bfc05 ]
Alex added page bias of LONG_MAX, which is admittedly quite a clever way of catching overflows of the pp ref count. The page pool code was "optimized" to leave the ref at 1 for freed pages so it can't catch basic bugs by itself any more. (Something we should probably address under DEBUG_NET...)
Unfortunately for fbnic since commit f7dc3248dcfb ("skbuff: Optimization of SKB coalescing for page pool") core _may_ actually take two extra pp refcounts, if one of them is returned before driver gives up the bias the ret < 0 check in page_pool_unref_netmem() will trigger.
While at it add a FBNIC_ to the name of the driver constant.
--- drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 4 ++-- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +2 -2
@@ -661,8 +661,8 @@ static void fbnic_page_pool_init(struct fbnic_ring *ring, unsigned int idx, {struct fbnic_rx_buf *rx_buf = &ring->rx_buf[idx]; -page_pool_fragment_page (page,PAGECNT_BIAS_MAX ); - rx_buf->pagecnt_bias =PAGECNT_BIAS_MAX ; +page_pool_fragment_page (page,FBNIC_PAGECNT_BIAS_MAX ); + rx_buf->pagecnt_bias =FBNIC_PAGECNT_BIAS_MAX ; rx_buf->page = page; }
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h +2 -4
@@ -91,10 +91,8 @@ struct fbnic_queue_stats {struct u64_stats_sync syncp; }; -/* Pagecnt bias is long max to reserve the last bit to catch overflow -* cases where if we overcharge the bias it will flip over to be negative. -*/ -#define PAGECNT_BIAS_MAX LONG_MAX +#define FBNIC_PAGECNT_BIAS_MAX PAGE_SIZE +struct fbnic_rx_buf {struct page *page;long pagecnt_bias;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 549/627 eth: fbnic: Fix tx_dropped reporting
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohsin Bashir <[email protected]>
[ Upstream commit 2972395d8fad7f4efc8555348f2f988d4941d797 ]
Correctly copy the tx_dropped stats from the fbd->hw_stats to the rtnl_link_stats64 struct.
--- drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +4 -4
@@ -422,16 +422,16 @@ static void fbnic_get_stats64(struct net_device *dev, tx_packets = stats->packets; tx_dropped = stats->dropped; - stats64->tx_bytes = tx_bytes; - stats64->tx_packets = tx_packets; - stats64->tx_dropped = tx_dropped; -/* Record drops from Tx HW Datapath */ tx_dropped += fbd->hw_stats.tmi.drop.frames.value + fbd->hw_stats.tti.cm_drop.frames.value + fbd->hw_stats.tti.frame_drop.frames.value + fbd->hw_stats.tti.tbi_drop.frames.value; + stats64->tx_bytes = tx_bytes; + stats64->tx_packets = tx_packets; + stats64->tx_dropped = tx_dropped; +for (i =0 ; i < fbn->num_tx_queues; i++) {struct fbnic_ring *txr = fbn->tx[i];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 550/627 eth: fbnic: Lock the tx_dropped update
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohsin Bashir <[email protected]>
[ Upstream commit 53abd9c86fd086d8448ceec4e9ffbd65b6c17a37 ]
Wrap copying of drop stats on TX path from fbd->hw_stats by the hw_stats_lock. Currently, it is being performed outside the lock and another thread accessing fbd->hw_stats can lead to inconsistencies.
--- drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +2 -0
@@ -423,10 +423,12 @@ static void fbnic_get_stats64(struct net_device *dev, tx_dropped = stats->dropped;/* Record drops from Tx HW Datapath */ +spin_lock (&fbd->hw_stats_lock); tx_dropped += fbd->hw_stats.tmi.drop.frames.value + fbd->hw_stats.tti.cm_drop.frames.value + fbd->hw_stats.tti.frame_drop.frames.value + fbd->hw_stats.tti.tbi_drop.frames.value; +spin_unlock (&fbd->hw_stats_lock); stats64->tx_bytes = tx_bytes; stats64->tx_packets = tx_packets;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 551/627 NFS/localio: nfs_close_local_fh() fix check for file closed
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit e144d53cf21fb9d02626c669533788c6bdc61ce3 ]
If the struct nfs_file_localio is closed, its list entry will be empty, but the nfs_uuid->files list might still contain other entries.
--- fs/nfs_common/nfslocalio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs_common/nfslocalio.c +1 -1
@@ -314,7 +314,7 @@ void nfs_close_local_fh(struct nfs_file_localio *nfl)rcu_read_unlock ();return ; } -if (list_empty (&nfs_uuid->files)) { +if (list_empty (&nfl->list)) {/* nfs_uuid_put() has started closing files, wait for it * to finished */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 552/627 NFS/localio: nfs_uuid_put() fix races with nfs_open/close_local_fh()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit fdd015de767977f21892329af5e12276eb80375f ]
In order for the wait in nfs_uuid_put() to be safe, it is necessary to ensure that nfs_uuid_add_file() doesn't add a new entry once the nfs_uuid->net has been NULLed out.
Also fix up the wake_up_var_locked() / wait_var_event_spinlock() to both use the nfs_uuid address, since nfl, and &nfl->uuid could be used elsewhere.
--- fs/nfs_common/nfslocalio.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
fs/nfs_common/nfslocalio.c +15 -8
@@ -177,7 +177,7 @@ static bool nfs_uuid_put(nfs_uuid_t *nfs_uuid)/* nfs_close_local_fh() is doing the * close and we must wait. until it unlinks */ - wait_var_event_spinlock(nfl, + wait_var_event_spinlock(nfs_uuid, list_first_entry_or_null( &nfs_uuid->files, struct nfs_file_localio,
@@ -243,15 +243,20 @@ void nfs_localio_invalidate_clients(struct list_head *nn_local_clients, }EXPORT_SYMBOL_GPL (nfs_localio_invalidate_clients); -static void nfs_uuid_add_file (nfs_uuid_t *nfs_uuid,struct nfs_file_localio *nfl) +static int nfs_uuid_add_file (nfs_uuid_t *nfs_uuid,struct nfs_file_localio *nfl) { +int ret =0 ; +/* Add nfl to nfs_uuid->files if it isn't already */ spin_lock (&nfs_uuid->lock); -if (list_empty (&nfl->list)) { +if (rcu_access_pointer (nfs_uuid->net) ==NULL ) { + ret = -ENXIO ; + }else if (list_empty (&nfl->list)) {rcu_assign_pointer (nfl->nfs_uuid, nfs_uuid);list_add_tail (&nfl->list, &nfs_uuid->files); }spin_unlock (&nfs_uuid->lock); +return ret; }/*
@@ -285,11 +290,13 @@ struct nfsd_file *nfs_open_local_fh(nfs_uuid_t *uuid, }rcu_read_unlock ();/* We have an implied reference to net thanks to nfsd_net_try_get */ - localio = nfs_to->nfsd_open_local_fh (net, uuid->dom, rpc_clnt, - cred, nfs_fh, pnf, fmode); + localio = nfs_to->nfsd_open_local_fh (net, uuid->dom, rpc_clnt, cred, + nfs_fh, pnf, fmode); +if (!IS_ERR (localio) &&nfs_uuid_add_file (uuid, nfl) <0 ) { +/* Delete the cached file when racing with nfs_uuid_put() */ +nfs_to_nfsd_file_put_local (pnf); + }nfs_to_nfsd_net_put (net); -if (!IS_ERR (localio)) -nfs_uuid_add_file (uuid, nfl);return localio; }
@@ -338,7 +345,7 @@ void nfs_close_local_fh(struct nfs_file_localio *nfl)*/ spin_lock (&nfs_uuid->lock);list_del_init (&nfl->list); -wake_up_var_locked (&nfl->nfs_uuid, &nfs_uuid->lock); +wake_up_var_locked (nfs_uuid, &nfs_uuid->lock);spin_unlock (&nfs_uuid->lock); }EXPORT_SYMBOL_GPL (nfs_close_local_fh);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 553/627 NFS/localio: nfs_uuid_put() fix the wake up after unlinking the file
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 4ec752ce6debd5a0e7e0febf6bcf780ccda6ab5e ]
Use store_release_wake_up() instead of wake_up_var_locked(), because the waiter cannot retake the nfs_uuid->lock.
--- fs/nfs_common/nfslocalio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs_common/nfslocalio.c +1 -2
@@ -198,8 +198,7 @@ static bool nfs_uuid_put(nfs_uuid_t *nfs_uuid)/* Now we can allow racing nfs_close_local_fh() to * skip the locking. */ -RCU_INIT_POINTER (nfl->nfs_uuid,NULL ); -wake_up_var_locked (&nfl->nfs_uuid, &nfs_uuid->lock); +store_release_wake_up (&nfl->nfs_uuid,RCU_INITIALIZER (NULL )); }/* Remove client from nn->local_clients */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 554/627 net: ti: icssg-prueth: Fix skb handling for XDP_PASS
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meghana Malladi <[email protected]>
[ Upstream commit d942fe13f72bec92f6c689fbd74c5ec38228c16a ]
emac_rx_packet() is a common function for handling traffic for both xdp and non-xdp use cases. Use common logic for handling skb with or without xdp to prevent any incorrect packet processing. This patch fixes ping working with XDP_PASS for icssg driver.
--- drivers/net/ethernet/ti/icssg/icssg_common.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ethernet/ti/icssg/icssg_common.c +8 -7
@@ -706,9 +706,9 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, u32 *xdp_state)struct page_pool *pool;struct sk_buff *skb;struct xdp_buff xdp; +int headroom, ret;u32 *psdata;void *pa; -int ret; *xdp_state =0 ; pool = rx_chn->pg_pool;
@@ -757,22 +757,23 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, u32 *xdp_state)xdp_prepare_buff (&xdp, pa,PRUETH_HEADROOM , pkt_len, false); *xdp_state =emac_run_xdp (emac, &xdp, page, &pkt_len); -if (*xdp_state ==ICSSG_XDP_PASS ) - skb =xdp_build_skb_from_buff (&xdp); -else +if (*xdp_state !=ICSSG_XDP_PASS ) goto requeue; + headroom = xdp.data - xdp.data_hard_start; + pkt_len = xdp.data_end - xdp.data; }else { -/* prepare skb and send to n/w stack */ - skb =napi_build_skb (pa,PAGE_SIZE ); + headroom =PRUETH_HEADROOM ; } +/* prepare skb and send to n/w stack */ + skb =napi_build_skb (pa,PAGE_SIZE );if (!skb) { ndev->stats.rx_dropped++;page_pool_recycle_direct (pool, page); goto requeue; } -skb_reserve (skb,PRUETH_HEADROOM ); +skb_reserve (skb, headroom);skb_put (skb, pkt_len); skb->dev = ndev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 555/627 irqchip: Build IMX_MU_MSI only on ARM
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 3b6a18f0da8720d612d8a682ea5c55870da068e0 ]
Compile-testing IMX_MU_MSI on x86 without PCI_MSI support results in a build failure:
drivers/gpio/gpio-sprd.c:8:include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type drivers/iommu/iommufd/viommu.c:4:include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
Tighten the dependency further to only allow compile testing on Arm. This could be refined further to allow certain x86 configs.
This was submitted before to address a different build failure, which was fixed differently, but the problem has now returned in a different form.
--- drivers/irqchip/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/Kconfig +1 -0
@@ -539,6 +539,7 @@ config IMX_MU_MSI tristate "i.MX MU used as MSI controller" depends on OF && HAS_IOMEM depends on ARCH_MXC || COMPILE_TEST + depends on ARM || ARM64 default m if ARCH_MXC select IRQ_DOMAIN select IRQ_DOMAIN_HIERARCHY
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 556/627 ASoC: SOF: Intel: hda-sdw-bpt: fix SND_SOF_SOF_HDA_SDW_BPT dependencies
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 614d416dd8aee2675fb591c598308a901a660db8 ]
The hda-sdw-bpt code links against the soundwire driver, but that fails when trying to link from built-in code into loadable module:
x86_64-linux-ld: vmlinux.o: in function `intel_ace2x_bpt_close_stream.isra.0':
intel_ace2x.c:(.text+0x137a531): undefined reference to `hda_sdw_bpt_close'
x86_64-linux-ld: vmlinux.o: in function `intel_ace2x_bpt_send_async':
intel_ace2x.c:(.text+0x137aa45): undefined reference to `hda_sdw_bpt_open'
x86_64-linux-ld: intel_ace2x.c:(.text+0x137ab67): undefined reference to `hda_sdw_bpt_close'
x86_64-linux-ld: intel_ace2x.c:(.text+0x137ac30): undefined reference to `hda_sdw_bpt_send_async'
x86_64-linux-ld: vmlinux.o: in function `intel_ace2x_bpt_wait':
intel_ace2x.c:(.text+0x137aced): undefined reference to `hda_sdw_bpt_wait'
Ensure that both SOUNDWIRE_INTEL and SND_SOF_SOF_HDA_SDW_BPT are selected at the same time by SND_SOC_SOF_INTEL_LNL, and that this happens even if SND_SOC_SOF_INTEL_SOUNDWIRE is a loadable module but SND_SOC_SOF_INTEL_LNL is built-in.
This follows the same logic as commit c5a61db9bf89 ("ASoC: SOF: fix intel-soundwire link failure").
--- sound/soc/sof/intel/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sof/intel/Kconfig +2 -1
@@ -266,9 +266,10 @@ config SND_SOC_SOF_METEORLAKE config SND_SOC_SOF_INTEL_LNL tristate + select SOUNDWIRE_INTEL if SND_SOC_SOF_INTEL_SOUNDWIRE != n select SND_SOC_SOF_HDA_GENERIC select SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE - select SND_SOF_SOF_HDA_SDW_BPT if SND_SOC_SOF_INTEL_SOUNDWIRE + select SND_SOF_SOF_HDA_SDW_BPT if SND_SOC_SOF_INTEL_SOUNDWIRE != n select SND_SOC_SOF_IPC4 select SND_SOC_SOF_INTEL_MTL
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 557/627 ALSA: hda/ca0132: Fix missing error handling in ca0132_alt_select_out()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 9f320dfb0ffc555aa2eac8331dee0c2c16f67633 ]
There are a couple of cases where the error is ignored or the error code isn't propagated in ca0132_alt_select_out(). Fix those.
--- sound/pci/hda/patch_ca0132.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +4 -1
@@ -4802,7 +4802,8 @@ static int ca0132_alt_select_out(struct hda_codec *codec)if (err <0 ) goto exit; -if (ca0132_alt_select_out_quirk_set (codec) <0 ) + err =ca0132_alt_select_out_quirk_set (codec); +if (err <0 ) goto exit;switch (spec->cur_out_type) {
@@ -4892,6 +4893,8 @@ static int ca0132_alt_select_out(struct hda_codec *codec) spec->bass_redirection_val); else err =ca0132_alt_surround_set_bass_redirection (codec,0 ); +if (err <0 ) + goto exit;/* Unmute DSP now that we're done with output selection. */ err = dspio_set_uint_param(codec, 0x96,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 558/627 s390/boot: Fix startup debugging log
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Zaslonko <[email protected]>
[ Upstream commit e29409faec87ffd2de2ed20b6109f303f129281b ]
Fix 'kernel image' end address for kaslr case.
--- arch/s390/boot/startup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/boot/startup.c +1 -1
@@ -384,7 +384,7 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size) kernel_start =round_down (kernel_end - kernel_size,THREAD_SIZE );boot_debug ("Randomization range: 0x%016lx-0x%016lx\n" , vmax - kaslr_len, vmax);boot_debug ("kernel image: 0x%016lx-0x%016lx (kaslr)\n" , kernel_start, - kernel_size + kernel_size); + kernel_start + kernel_size); }else if (vmax < __NO_KASLR_END_KERNEL || vsize > __NO_KASLR_END_KERNEL) { kernel_start =round_down (vmax - kernel_size,THREAD_SIZE ); boot_debug("kernel image: 0x%016lx-0x%016lx (constrained)\n", kernel_start,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 559/627 smb: server: remove separate empty_recvmsg_queue
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 01027a62b508c48c762096f347de925eedcbd008 ]
There's no need to maintain two lists, we can just have a single list of receive buffers, which are free to use.
--- fs/smb/server/transport_rdma.c | 60 +++++----------------------------- 1 file changed, 8 insertions(+), 52 deletions(-)
fs/smb/server/transport_rdma.c +8 -52
@@ -129,9 +129,6 @@ struct smb_direct_transport {spinlock_t recvmsg_queue_lock;struct list_head recvmsg_queue; -spinlock_t empty_recvmsg_queue_lock; -struct list_head empty_recvmsg_queue; -int send_credit_target;atomic_t send_credits;spinlock_t lock_new_recv_credits;
@@ -276,32 +273,6 @@ static void put_recvmsg(struct smb_direct_transport *t,spin_unlock (&t->recvmsg_queue_lock); } -static struct -smb_direct_recvmsg *get_empty_recvmsg (struct smb_direct_transport *t) -{ -struct smb_direct_recvmsg *recvmsg =NULL ; - -spin_lock (&t->empty_recvmsg_queue_lock); -if (!list_empty (&t->empty_recvmsg_queue)) { - recvmsg =list_first_entry (&t->empty_recvmsg_queue, - struct smb_direct_recvmsg, list); -list_del (&recvmsg->list); - } -spin_unlock (&t->empty_recvmsg_queue_lock); -return recvmsg; -} - -static void put_empty_recvmsg (struct smb_direct_transport *t, -struct smb_direct_recvmsg *recvmsg) -{ -ib_dma_unmap_single (t->cm_id->device, recvmsg->sge.addr, - recvmsg->sge.length,DMA_FROM_DEVICE ); - -spin_lock (&t->empty_recvmsg_queue_lock); -list_add_tail (&recvmsg->list, &t->empty_recvmsg_queue); -spin_unlock (&t->empty_recvmsg_queue_lock); -} -static void enqueue_reassembly (struct smb_direct_transport *t,struct smb_direct_recvmsg *recvmsg,int data_length)
@@ -386,9 +357,6 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id)spin_lock_init (&t->recvmsg_queue_lock);INIT_LIST_HEAD (&t->recvmsg_queue); -spin_lock_init (&t->empty_recvmsg_queue_lock); -INIT_LIST_HEAD (&t->empty_recvmsg_queue); -init_waitqueue_head (&t->wait_send_pending);atomic_set (&t->send_pending,0 );
@@ -554,7 +522,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) wc->opcode);smb_direct_disconnect_rdma_connection (t); } -put_empty_recvmsg (t, recvmsg); +put_recvmsg (t, recvmsg);return ; }
@@ -568,7 +536,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)switch (recvmsg->type) {case SMB_DIRECT_MSG_NEGOTIATE_REQ :if (wc->byte_len <sizeof (struct smb_direct_negotiate_req )) { -put_empty_recvmsg (t, recvmsg); +put_recvmsg (t, recvmsg);return ; } t->negotiation_requested = true;
@@ -585,7 +553,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (wc->byte_len < offsetof(struct smb_direct_data_transfer , padding)) { -put_empty_recvmsg (t, recvmsg); +put_recvmsg (t, recvmsg);return ; }
@@ -593,7 +561,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (data_length) {if (wc->byte_len <sizeof (struct smb_direct_data_transfer ) + (u64 )data_length) { -put_empty_recvmsg (t, recvmsg); +put_recvmsg (t, recvmsg);return ; }
@@ -613,7 +581,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) avail_recvmsg_count = t->count_avail_recvmsg;spin_unlock (&t->receive_credit_lock); }else { -put_empty_recvmsg (t, recvmsg); +put_recvmsg (t, recvmsg);spin_lock (&t->receive_credit_lock); receive_credits = --(t->recv_credits);
@@ -811,7 +779,6 @@ static void smb_direct_post_recv_credits(struct work_struct *work)struct smb_direct_recvmsg *recvmsg;int receive_credits, credits =0 ;int ret; -int use_free =1 ;spin_lock (&t->receive_credit_lock); receive_credits = t->recv_credits;
@@ -819,18 +786,9 @@ static void smb_direct_post_recv_credits(struct work_struct *work)if (receive_credits < t->recv_credit_target) {while (true) { -if (use_free) - recvmsg =get_free_recvmsg (t); -else - recvmsg =get_empty_recvmsg (t); -if (!recvmsg) { -if (use_free) { - use_free =0 ; -continue ; - }else { -break ; - } - } + recvmsg =get_free_recvmsg (t); +if (!recvmsg) +break ; recvmsg->type =SMB_DIRECT_MSG_DATA_TRANSFER ; recvmsg->first_segment = false;
@@ -1806,8 +1764,6 @@ static void smb_direct_destroy_pools(struct smb_direct_transport *t)while ((recvmsg =get_free_recvmsg (t)))mempool_free (recvmsg, t->recvmsg_mempool); -while ((recvmsg =get_empty_recvmsg (t))) -mempool_free (recvmsg, t->recvmsg_mempool);mempool_destroy (t->recvmsg_mempool); t->recvmsg_mempool =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 560/627 smb: server: make sure we call ib_dma_unmap_single() only if we called ib_dma_map_single already
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit afb4108c92898350e66b9a009692230bcdd2ac73 ]
In case of failures either ib_dma_map_single() might not be called yet or ib_dma_unmap_single() was already called.
We should make sure put_recvmsg() only calls ib_dma_unmap_single() if needed.
--- fs/smb/server/transport_rdma.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/smb/server/transport_rdma.c +9 -2
@@ -265,8 +265,13 @@ smb_direct_recvmsg *get_free_recvmsg(struct smb_direct_transport *t)static void put_recvmsg (struct smb_direct_transport *t,struct smb_direct_recvmsg *recvmsg) { -ib_dma_unmap_single (t->cm_id->device, recvmsg->sge.addr, - recvmsg->sge.length,DMA_FROM_DEVICE ); +if (likely (recvmsg->sge.length !=0 )) { +ib_dma_unmap_single (t->cm_id->device, + recvmsg->sge.addr, + recvmsg->sge.length, +DMA_FROM_DEVICE ); + recvmsg->sge.length =0 ; + }spin_lock (&t->recvmsg_queue_lock);list_add (&recvmsg->list, &t->recvmsg_queue);
@@ -638,6 +643,7 @@ static int smb_direct_post_recv(struct smb_direct_transport *t,ib_dma_unmap_single (t->cm_id->device, recvmsg->sge.addr, recvmsg->sge.length,DMA_FROM_DEVICE ); + recvmsg->sge.length =0 ;smb_direct_disconnect_rdma_connection (t);return ret; }
@@ -1819,6 +1825,7 @@ static int smb_direct_create_pools(struct smb_direct_transport *t)if (!recvmsg) goto err; recvmsg->transport = t; + recvmsg->sge.length =0 ;list_add (&recvmsg->list, &t->recvmsg_queue); } t->count_avail_recvmsg = t->recv_credit_max;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 561/627 smb: server: let recv_done() consistently call put_recvmsg/smb_direct_disconnect_rdma_connection
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit cfe76fdbb9729c650f3505d9cfb2f70ddda2dbdc ]
We should call put_recvmsg() before smb_direct_disconnect_rdma_connection() in order to call it before waking up the callers.
In all error cases we should call smb_direct_disconnect_rdma_connection() in order to avoid stale connections.
--- fs/smb/server/transport_rdma.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
fs/smb/server/transport_rdma.c +13 -5
@@ -521,13 +521,13 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) t = recvmsg->transport;if (wc->status !=IB_WC_SUCCESS || wc->opcode !=IB_WC_RECV ) { +put_recvmsg (t, recvmsg);if (wc->status !=IB_WC_WR_FLUSH_ERR ) {pr_err ("Recv error. status='%s (%d)' opcode=%d\n" ,ib_wc_status_msg (wc->status), wc->status, wc->opcode);smb_direct_disconnect_rdma_connection (t); } -put_recvmsg (t, recvmsg);return ; }
@@ -542,6 +542,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)case SMB_DIRECT_MSG_NEGOTIATE_REQ :if (wc->byte_len <sizeof (struct smb_direct_negotiate_req )) {put_recvmsg (t, recvmsg); +smb_direct_disconnect_rdma_connection (t);return ; } t->negotiation_requested = true;
@@ -549,7 +550,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) t->status =SMB_DIRECT_CS_CONNECTED ;enqueue_reassembly (t, recvmsg,0 );wake_up_interruptible (&t->wait_status); -break ; +return ;case SMB_DIRECT_MSG_DATA_TRANSFER : {struct smb_direct_data_transfer *data_transfer = (struct smb_direct_data_transfer *)recvmsg->packet;
@@ -559,6 +560,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (wc->byte_len < offsetof(struct smb_direct_data_transfer , padding)) {put_recvmsg (t, recvmsg); +smb_direct_disconnect_rdma_connection (t);return ; }
@@ -567,6 +569,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (wc->byte_len <sizeof (struct smb_direct_data_transfer ) + (u64 )data_length) {put_recvmsg (t, recvmsg); +smb_direct_disconnect_rdma_connection (t);return ; }
@@ -609,11 +612,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (is_receive_credit_post_required (receive_credits, avail_recvmsg_count))mod_delayed_work (smb_direct_wq, &t->post_recv_credits_work,0 ); -break ; +return ; } -default : -break ; } + +/* +* This is an internal error! +*/ +WARN_ON_ONCE (recvmsg->type !=SMB_DIRECT_MSG_DATA_TRANSFER ); +put_recvmsg (t, recvmsg); +smb_direct_disconnect_rdma_connection (t); } static int smb_direct_post_recv(struct smb_direct_transport *t,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 562/627 smb: server: let recv_done() avoid touching data_transfer after cleanup/move
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit a6c015b7ac2d8c5233337e5793f50d04fac17669 ]
Calling enqueue_reassembly() and wake_up_interruptible(&t->wait_reassembly_queue) or put_receive_buffer() means the recvmsg/data_transfer pointer might get re-used by another thread, which means these should be
the last operations before calling return.
--- fs/smb/server/transport_rdma.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/smb/server/transport_rdma.c +7 -5
@@ -581,16 +581,11 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)else t->full_packet_received = true; -enqueue_reassembly (t, recvmsg, (int )data_length); -wake_up_interruptible (&t->wait_reassembly_queue); -spin_lock (&t->receive_credit_lock); receive_credits = --(t->recv_credits); avail_recvmsg_count = t->count_avail_recvmsg;spin_unlock (&t->receive_credit_lock); }else { -put_recvmsg (t, recvmsg); -spin_lock (&t->receive_credit_lock); receive_credits = --(t->recv_credits); avail_recvmsg_count = ++(t->count_avail_recvmsg);
@@ -612,6 +607,13 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (is_receive_credit_post_required (receive_credits, avail_recvmsg_count))mod_delayed_work (smb_direct_wq, &t->post_recv_credits_work,0 ); + +if (data_length) { +enqueue_reassembly (t, recvmsg, (int )data_length); +wake_up_interruptible (&t->wait_reassembly_queue); + }else +put_recvmsg (t, recvmsg); +return ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 563/627 smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 5349ae5e05fa37409fd48a1eb483b199c32c889b ]
We should call ib_dma_unmap_single() and mempool_free() before calling smbd_disconnect_rdma_connection().
And smbd_disconnect_rdma_connection() needs to be the last function to call as all other state might already be gone after it returns.
--- fs/smb/client/smbdirect.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/smb/client/smbdirect.c +8 -6
@@ -281,18 +281,20 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)log_rdma_send (INFO ,"smbd_request 0x%p completed wc->status=%d\n" , request, wc->status); -if (wc->status !=IB_WC_SUCCESS || wc->opcode !=IB_WC_SEND ) { -log_rdma_send (ERR ,"wc->status=%d wc->opcode=%d\n" , - wc->status, wc->opcode); -smbd_disconnect_rdma_connection (request->info); - } -for (i =0 ; i < request->num_sge; i++)ib_dma_unmap_single (sc->ib.dev, request->sge[i].addr, request->sge[i].length,DMA_TO_DEVICE ); +if (wc->status !=IB_WC_SUCCESS || wc->opcode !=IB_WC_SEND ) { +log_rdma_send (ERR ,"wc->status=%d wc->opcode=%d\n" , + wc->status, wc->opcode); +mempool_free (request, info->request_mempool); +smbd_disconnect_rdma_connection (info); +return ; + } +if (atomic_dec_and_test (&request->info->send_pending))wake_up (&request->info->wait_send_pending);
Signature · 1 line
2.39.5
Re: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Hi Greg,
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 7 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]
This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.
The same applies to all other branches (6.15, 6.12, 6.6, ...)
metze
Greg Kroah-Hartman
maintainerRe: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Quoted 9 lines · Stefan Metzmacher
Hi Greg,
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 6 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
Quoted 7 lines
Quoted 1 line
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.The same applies to all other branches (6.15, 6.12, 6.6, ...)
Thanks, now queued up.
greg k-h
Re: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Am 13.08.25 um 09:59 schrieb Greg Kroah-Hartman:
Quoted 12 lines · Stefan Metzmacher
Quoted 11 lines
Hi Greg,
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 7 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]
Quoted 7 lines
Quoted 5 lines
This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.The same applies to all other branches (6.15, 6.12, 6.6, ...)
Thanks, now queued up.
Even if it's not upstream yet?
I thought the policy is that upstream is required first...
It's only here
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=shortlog;h=refs/heads/for-next
as
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=8b2b8a6a5827848250c0caf075b23256bab4ac88
But that commit hash can change on rebase.
metze
Greg Kroah-Hartman
maintainerRe: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Quoted 24 lines · Stefan Metzmacher
Am 13.08.25 um 09:59 schrieb Greg Kroah-Hartman:
Quoted 12 lines · Stefan Metzmacher
Quoted 11 lines
Hi Greg,
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 7 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]Quoted 7 lines
Quoted 5 lines
This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.The same applies to all other branches (6.15, 6.12, 6.6, ...)
Thanks, now queued up.
Even if it's not upstream yet?
I thought the policy is that upstream is required first...
Quoted 6 lines
It's only here
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=shortlog;h=refs/heads/for-next
as
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=8b2b8a6a5827848250c0caf075b23256bab4ac88But that commit hash can change on rebase.
Ah, I thought since this was in linux-next it would not rebase. Having public trees that rebase is dangerous...
Anyway, I'll go drop both of these now, please let us know when you want these added back.
thanks,
greg k-h
Re: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Hi Greg,
Quoted 25 lines
Quoted 25 lines
Quoted 9 lines
Quoted 9 lines
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 7 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]Quoted 7 lines
Quoted 5 lines
This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.The same applies to all other branches (6.15, 6.12, 6.6, ...)
Thanks, now queued up.
Even if it's not upstream yet?
I thought the policy is that upstream is required first...It's only here
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=shortlog;h=refs/heads/for-next
as
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=8b2b8a6a5827848250c0caf075b23256bab4ac88
Quoted 7 lines
Quoted 1 line
But that commit hash can change on rebase.
Ah, I thought since this was in linux-next it would not rebase. Having public trees that rebase is dangerous...
Anyway, I'll go drop both of these now, please let us know when you want these added back.
It landed as 8c48e1c7520321cc87ff651e96093e2f412785fb, so 5349ae5e05fa37409fd48a1eb483b199c32c889b can be backported with 8c48e1c7520321cc87ff651e96093e2f412785fb being the fixup.
Thanks!
metze
Greg Kroah-Hartman
maintainerRe: [PATCH 6.16 563/627] smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
Quoted 32 lines · Stefan Metzmacher
Hi Greg,
Quoted 30 lines
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Am 12.08.25 um 19:34 schrieb Greg Kroah-Hartman:
Quoted 7 lines
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit
5349ae5e05fa37409fd48a1eb483b199c32c889b]Quoted 7 lines
Quoted 5 lines
This needs this patch
https://lore.kernel.org/linux-cifs/[email protected]/T/#u
as follow up fix that is not yet upstream.The same applies to all other branches (6.15, 6.12, 6.6, ...)
Thanks, now queued up.
Even if it's not upstream yet?
I thought the policy is that upstream is required first...Quoted 6 lines
It's only here
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=shortlog;h=refs/heads/for-next
as
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=8b2b8a6a5827848250c0caf075b23256bab4ac88But that commit hash can change on rebase.
Ah, I thought since this was in linux-next it would not rebase. Having public trees that rebase is dangerous...
Quoted 6 lines
Quoted 2 lines
Anyway, I'll go drop both of these now, please let us know when you want these added back.
It landed as
8c48e1c7520321cc87ff651e96093e2f412785fb, so5349ae5e05fa37409fd48a1eb483b199c32c889bcan be backported with8c48e1c7520321cc87ff651e96093e2f412785fbbeing the fixup.
Now queued up, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 564/627 smb: client: remove separate empty_packet_queue
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 24b6afc36db748467e853e166a385df07e443859 ]
There's no need to maintain two lists, we can just have a single list of receive buffers, which are free to use.
It just added unneeded complexity and resulted in ib_dma_unmap_single() not being called from recv_done() for empty keepalive packets.
--- fs/smb/client/cifs_debug.c | 6 ++-- fs/smb/client/smbdirect.c | 62 +++----------------------------------- fs/smb/client/smbdirect.h | 4 --- 3 files changed, 7 insertions(+), 65 deletions(-)
fs/smb/client/cifs_debug.c +2 -4
@@ -432,10 +432,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) server->smbd_conn->receive_credit_target);seq_printf (m,"\nPending send_pending: %x " ,atomic_read (&server->smbd_conn->send_pending)); -seq_printf (m,"\nReceive buffers count_receive_queue: %x " -"count_empty_packet_queue: %x" , - server->smbd_conn->count_receive_queue, - server->smbd_conn->count_empty_packet_queue); +seq_printf (m,"\nReceive buffers count_receive_queue: %x " , + server->smbd_conn->count_receive_queue); seq_printf(m, "\nMR responder_resources: %x " "max_frmr_depth: %x mr_type: %x", server->smbd_conn->responder_resources,
fs/smb/client/smbdirect.c +5 -57
122 lines not on this page · raw message
fs/smb/client/smbdirect.h +0 -4
@@ -110,10 +110,6 @@ struct smbd_connection {int count_receive_queue;spinlock_t receive_queue_lock; -struct list_head empty_packet_queue; -int count_empty_packet_queue; -spinlock_t empty_packet_queue_lock; -wait_queue_head_t wait_receive_queues;/* Reassembly queue */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 565/627 smb: client: make sure we call ib_dma_unmap_single() only if we called ib_dma_map_single already
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 047682c370b6f18fec818b57b0ed8b501bdb79f8 ]
In case of failures either ib_dma_map_single() might not be called yet or ib_dma_unmap_single() was already called.
We should make sure put_receive_buffer() only calls ib_dma_unmap_single() if needed.
--- fs/smb/client/smbdirect.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/smb/client/smbdirect.c +9 -2
@@ -1057,6 +1057,7 @@ static int smbd_post_recv(if (rc) {ib_dma_unmap_single (sc->ib.dev, response->sge.addr, response->sge.length,DMA_FROM_DEVICE ); + response->sge.length =0 ;smbd_disconnect_rdma_connection (info);log_rdma_recv (ERR ,"ib_post_recv failed rc=%d\n" , rc); }
@@ -1186,8 +1187,13 @@ static void put_receive_buffer(struct smbdirect_socket *sc = &info->socket;unsigned long flags; -ib_dma_unmap_single (sc->ib.dev, response->sge.addr, - response->sge.length,DMA_FROM_DEVICE ); +if (likely (response->sge.length !=0 )) { +ib_dma_unmap_single (sc->ib.dev, + response->sge.addr, + response->sge.length, +DMA_FROM_DEVICE ); + response->sge.length =0 ; + }spin_lock_irqsave (&info->receive_queue_lock, flags);list_add_tail (&response->list, &info->receive_queue);
@@ -1221,6 +1227,7 @@ static int allocate_receive_buffers(struct smbd_connection *info, int num_buf) goto allocate_failed; response->info = info; + response->sge.length =0 ;list_add_tail (&response->list, &info->receive_queue); info->count_receive_queue++; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 566/627 smb: client: let recv_done() cleanup before notifying the callers.
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit bdd7afc6dca5e0ebbb75583484aa6ea9e03fbb13 ]
We should call put_receive_buffer() before waking up the callers.
For the internal error case of response->type being unexpected, we now also call smbd_disconnect_rdma_connection() instead of not waking up the callers at all.
Note that the SMBD_TRANSFER_DATA case still has problems, which will be addressed in the next commit in order to make it easier to review this one.
--- fs/smb/client/smbdirect.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/smb/client/smbdirect.c +8 -6
@@ -454,7 +454,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)if (wc->status !=IB_WC_SUCCESS || wc->opcode !=IB_WC_RECV ) {log_rdma_recv (INFO ,"wc->status=%d opcode=%d\n" , wc->status, wc->opcode); -smbd_disconnect_rdma_connection (info); goto error; }
@@ -471,8 +470,9 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) info->full_packet_received = true; info->negotiate_done =process_negotiation_response (response, wc->byte_len); +put_receive_buffer (info, response);complete (&info->negotiate_completion); -break ; +return ;/* SMBD data transfer packet */ case SMBD_TRANSFER_DATA :
@@ -529,14 +529,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) }return ; - -default : -log_rdma_recv (ERR , -"unexpected response type=%d\n" , response->type); } +/* +* This is an internal error! +*/ +log_rdma_recv (ERR ,"unexpected response type=%d\n" , response->type); +WARN_ON_ONCE (response->type !=SMBD_TRANSFER_DATA ); error:put_receive_buffer (info, response); +smbd_disconnect_rdma_connection (info); } static struct rdma_cm_id *smbd_create_id(
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 567/627 smb: client: let recv_done() avoid touching data_transfer after cleanup/move
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 24eff17887cb45c25a427e662dda352973c5c171 ]
Calling enqueue_reassembly() and wake_up_interruptible(&info->wait_reassembly_queue) or put_receive_buffer() means the response/data_transfer pointer might get re-used by another thread, which means these should be
the last operations before calling return.
--- fs/smb/client/smbdirect.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
fs/smb/client/smbdirect.c +11 -14
@@ -479,10 +479,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) data_transfer =smbd_response_payload (response); data_length =le32_to_cpu (data_transfer->data_length); -/* -* If this is a packet with data playload place the data in -* reassembly queue and wake up the reading thread -*/ if (data_length) {if (info->full_packet_received) response->first_segment = true;
@@ -491,16 +487,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) info->full_packet_received = false; else info->full_packet_received = true; - -enqueue_reassembly ( - info, - response, - data_length); - }else -put_receive_buffer (info, response); - -if (data_length) -wake_up_interruptible (&info->wait_reassembly_queue); + }atomic_dec (&info->receive_credits); info->receive_credit_target =
@@ -528,6 +515,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) info->keep_alive_requested =KEEP_ALIVE_PENDING ; } +/* +* If this is a packet with data playload place the data in +* reassembly queue and wake up the reading thread +*/ +if (data_length) { +enqueue_reassembly (info, response, data_length); +wake_up_interruptible (&info->wait_reassembly_queue); + }else +put_receive_buffer (info, response); +return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 568/627 nvmet: exit debugfs after discovery subsystem exits
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
[ Upstream commit 80f21806b8e34ae1e24c0fc6a0f0dfd9b055e130 ]
Commit 528589947c180 ("nvmet: initialize discovery subsys after debugfs is initialized") changed nvmet_init() to initialize nvme discovery after "nvmet" debugfs directory is initialized. The change broke nvmet_exit() because discovery subsystem now depends on debugfs. Debugfs should be destroyed after discovery subsystem. Fix nvmet_exit() to do that.
--- drivers/nvme/target/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
@@ -1994,8 +1994,8 @@ static int __init nvmet_init(void) static void __exit nvmet_exit(void) {nvmet_exit_configfs (); -nvmet_exit_debugfs ();nvmet_exit_discovery (); +nvmet_exit_debugfs ();ida_destroy (&cntlid_ida);destroy_workqueue (nvmet_wq);destroy_workqueue (buffered_io_wq);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 569/627 pptp: fix pptp_xmit() error path
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ae633388cae349886f1a3cfb27aa092854b24c1b ]
I accidentally added a bug in pptp_xmit() that syzbot caught for us.
Only call ip_rt_put() if a route has been allocated.
BUG: unable to handle page fault for address: ffffffffffffffdb PGD df3b067 P4D df3b067 PUD df3d067 PMD 0 Oops: Oops: 0002 [#1] SMP KASAN PTI CPU: 1 UID: 0 PID: 6346 Comm: syz.0.336 Not tainted 6.16.0-next-20250804-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 RIP: 0010:arch_atomic_add_return arch/x86/include/asm/atomic.h:85 [inline] RIP: 0010:raw_atomic_sub_return_release include/linux/atomic/atomic-arch-fallback.h:846 [inline] RIP: 0010:atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:327 [inline] RIP: 0010:__rcuref_put include/linux/rcuref.h:109 [inline] RIP: 0010:rcuref_put+0x172/0x210 include/linux/rcuref.h:173 Call Trace: <TASK> dst_release+0x24/0x1b0 net/core/dst.c:167 ip_rt_put include/net/route.h:285 [inline] pptp_xmit+0x14b/0x1a90 drivers/net/ppp/pptp.c:267 __ppp_channel_push+0xf2/0x1c0 drivers/net/ppp/ppp_generic.c:2166 ppp_channel_push+0x123/0x660 drivers/net/ppp/ppp_generic.c:2198 ppp_write+0x2b0/0x400 drivers/net/ppp/ppp_generic.c:544 vfs_write+0x27b/0xb30 fs/read_write.c:684 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/net/ppp/pptp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ppp/pptp.c +4 -3
@@ -159,17 +159,17 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)int len;unsigned char *data;__u32 seq_recv; -struct rtable *rt =NULL ; +struct rtable *rt;struct net_device *tdev;struct iphdr *iph;int max_headroom;if (sk_pppox (po)->sk_state &PPPOX_DEAD ) - goto tx_error; + goto tx_drop; rt =pptp_route_output (po, &fl4);if (IS_ERR (rt)) - goto tx_error; + goto tx_drop; tdev = rt->dst.dev;
@@ -265,6 +265,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) tx_error:ip_rt_put (rt); +tx_drop:kfree_skb (skb);return 1 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 570/627 smb: client: return an error if rdma_connect does not return within 5 seconds
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 03537826f77f1c829d0593d211b38b9c876c1722 ]
This matches the timeout for tcp connections.
--- fs/smb/client/smbdirect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/smb/client/smbdirect.c +4 -2
@@ -1636,8 +1636,10 @@ static struct smbd_connection *_smbd_get_connection( goto rdma_connect_failed; } -wait_event_interruptible ( - info->conn_wait, sc->status !=SMBDIRECT_SOCKET_CONNECTING ); +wait_event_interruptible_timeout ( + info->conn_wait, + sc->status !=SMBDIRECT_SOCKET_CONNECTING , +msecs_to_jiffies (RDMA_RESOLVE_TIMEOUT ));if (sc->status !=SMBDIRECT_SOCKET_CONNECTED ) {log_rdma_event (ERR ,"rdma_connect failed port=%d\n" , port);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 571/627 tools/power turbostat: Fix bogus SysWatt for forked program
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit 44207567fa64e995d4f2ec2d45af4c947cb1a465 ]
Similar to delta_cpu(), delta_platform() is called in turbostat main loop. This ensures accurate SysWatt readings in periodic monitoring mode
$ sudo turbostat -S -q --show power -i 1 CoreTmp PkgTmp PkgWatt CorWatt GFXWatt RAMWatt PKG_% RAM_% SysWatt 60 61 6.21 1.13 0.16 0.00 0.00 0.00 13.07 58 61 6.00 1.07 0.18 0.00 0.00 0.00 12.75 58 61 5.74 1.05 0.17 0.00 0.00 0.00 12.22 58 60 6.27 1.11 0.24 0.00 0.00 0.00 13.55
However, delta_platform() is missing for forked program and causes bogus SysWatt reporting,
$ sudo turbostat -S -q --show power sleep 1 1.004736 sec CoreTmp PkgTmp PkgWatt CorWatt GFXWatt RAMWatt PKG_% RAM_% SysWatt 57 58 6.05 1.02 0.16 0.00 0.00 0.00 0.03
Add missing delta_platform() for forked program.
--- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+)
tools/power/x86/turbostat/turbostat.c +1 -0
@@ -9816,6 +9816,7 @@ int fork_it(char **argv)timersub (&tv_odd, &tv_even, &tv_delta);if (for_all_cpus_2 (delta_cpu,ODD_COUNTERS ,EVEN_COUNTERS ))fprintf (outf,"%s: Counter reset detected\n" , progname); +delta_platform (&platform_counters_odd, &platform_counters_even);compute_average (EVEN_COUNTERS );format_all_counters (EVEN_COUNTERS );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 572/627 tools/power turbostat: Fix DMR support
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
[ Upstream commit 3a088b07c4f10bf577f4a2392111704195a794ba ]
Together with the RAPL MSRs, there are more MSRs gone on DMR, including PLR (Perf Limit Reasons), and IRTL (Package cstate Interrupt Response Time Limit) MSRs. The configurable TDP info should also be retrieved from TPMI based Intel Speed Select Technology feature.
Remove the access of these MSRs for DMR. Improve the DMR platform feature table to make it more readable at the same time.
--- tools/power/x86/turbostat/turbostat.c | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-)
tools/power/x86/turbostat/turbostat.c +15 -14
@@ -840,20 +840,21 @@ static const struct platform_features spr_features = { };static const struct platform_features dmr_features = { - .has_msr_misc_feature_control = spr_features.has_msr_misc_feature_control, - .has_msr_misc_pwr_mgmt = spr_features.has_msr_misc_pwr_mgmt, - .has_nhm_msrs = spr_features.has_nhm_msrs, - .has_config_tdp = spr_features.has_config_tdp, - .bclk_freq = spr_features.bclk_freq, - .supported_cstates = spr_features.supported_cstates, - .cst_limit = spr_features.cst_limit, - .has_msr_core_c1_res = spr_features.has_msr_core_c1_res, - .has_msr_module_c6_res_ms =1 ,/* DMR has Dual Core Module and MC6 MSR */ - .has_irtl_msrs = spr_features.has_irtl_msrs, - .has_cst_prewake_bit = spr_features.has_cst_prewake_bit, - .has_fixed_rapl_psys_unit = spr_features.has_fixed_rapl_psys_unit, - .trl_msrs = spr_features.trl_msrs, - .rapl_msrs =0 ,/* DMR does not have RAPL MSRs */ + .has_msr_misc_feature_control = spr_features.has_msr_misc_feature_control, + .has_msr_misc_pwr_mgmt = spr_features.has_msr_misc_pwr_mgmt, + .has_nhm_msrs = spr_features.has_nhm_msrs, + .bclk_freq = spr_features.bclk_freq, + .supported_cstates = spr_features.supported_cstates, + .cst_limit = spr_features.cst_limit, + .has_msr_core_c1_res = spr_features.has_msr_core_c1_res, + .has_cst_prewake_bit = spr_features.has_cst_prewake_bit, + .has_fixed_rapl_psys_unit = spr_features.has_fixed_rapl_psys_unit, + .trl_msrs = spr_features.trl_msrs, + .has_msr_module_c6_res_ms =1 ,/* DMR has Dual-Core-Module and MC6 MSR */ + .rapl_msrs =0 ,/* DMR does not have RAPL MSRs */ + .plr_msrs =0 ,/* DMR does not have PLR MSRs */ + .has_irtl_msrs =0 ,/* DMR does not have IRTL MSRs */ + .has_config_tdp =0 ,/* DMR does not have CTDP MSRs */ };static const struct platform_features srf_features = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 573/627 nfsd: dont set the ctime on delegated atime updates
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit f9a348e0de19226fc3c7e81de7677d3fa2c4b2d8 upstream.
Clients will typically precede a DELEGRETURN for a delegation with delegated timestamp with a SETATTR to set the timestamps on the server to match what the client has.
knfsd implements this by using the nfsd_setattr() infrastructure, which will set ATTR_CTIME on any update that goes to notify_change(). This is problematic as it means that the client will get a spurious ctime update when updating the atime.
POSIX unfortunately doesn't phrase it succinctly, but updating the atime due to reads should not update the ctime. In this case, the client is sending a SETATTR to update the atime on the server to match its latest value. The ctime should not be advanced in this case as that would incorrectly indicate a change to the inode.
Fix this by not implicitly setting ATTR_CTIME when ATTR_DELEG is set in __nfsd_setattr(). The decoder for FATTR4_WORD2_TIME_DELEG_MODIFY already sets ATTR_CTIME, so this is sufficient to make it skip setting the ctime on atime-only updates.
--- fs/nfsd/vfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/nfsd/vfs.c +9 -1
@@ -470,7 +470,15 @@ static int __nfsd_setattr(struct dentryif (!iap->ia_valid)return 0 ; - iap->ia_valid |=ATTR_CTIME ; +/* +* If ATTR_DELEG is set, then this is an update from a client that +* holds a delegation. If this is an update for only the atime, the +* ctime should not be changed. If the update contains the mtime +* too, then ATTR_CTIME should already be set. +*/ +if (!(iap->ia_valid &ATTR_DELEG )) + iap->ia_valid |=ATTR_CTIME ; +return notify_change (&nop_mnt_idmap, dentry, iap,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 574/627 nfsd: avoid ref leak in nfsd_open_local_fh()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit e5a73150776f18547ee685c9f6bfafe549714899 upstream.
If two calls to nfsd_open_local_fh() race and both successfully call nfsd_file_acquire_local(), they will both get an extra reference to the net to accompany the file reference stored in *pnf.
One of them will fail to store (using xchg()) the file reference in *pnf and will drop that reference but WON'T drop the accompanying reference to the net. This leak means that when the nfs server is shut down it will hang in nfsd_shutdown_net() waiting for &nn->nfsd_net_free_done.
This patch adds the missing nfsd_net_put().
--- fs/nfsd/localio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/localio.c +3 -2
@@ -103,10 +103,11 @@ nfsd_open_local_fh(struct net *net, struif (nfsd_file_get (new) ==NULL ) goto again;/* -* Drop the ref we were going to install and the -* one we were going to return. +* Drop the ref we were going to install (both file and +* net) and the one we were going to return (only file). */ nfsd_file_put (localio); +nfsd_net_put (net);nfsd_file_put (localio); localio = new; }
Greg Kroah-Hartman
maintainerPATCH 575/627 sunrpc: fix handling of server side tls alerts
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit bee47cb026e762841f3faece47b51f985e215edb upstream.
Scott Mayhew discovered a security exploit in NFS over TLS in tls_alert_recv() due to its assumption it can read data from the msg iterator's kvec..
kTLS implementation splits TLS non-data record payload between the control message buffer (which includes the type such as TLS aler or TLS cipher change) and the rest of the payload (say TLS alert's level/description) which goes into the msg payload buffer.
This patch proposes to rework how control messages are setup and used by sock_recvmsg().
If no control message structure is setup, kTLS layer will read and process TLS data record types. As soon as it encounters a TLS control message, it would return an error. At that point, NFS can setup a kvec backed msg buffer and read in the control message such as a TLS alert. Msg iterator can advance the kvec pointer as a part of the copy process thus we need to revert the iterator before calling into the tls_alert_recv.
--- net/sunrpc/svcsock.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)
net/sunrpc/svcsock.c +35 -8
@@ -257,20 +257,47 @@ svc_tcp_sock_process_cmsg(struct socket }static int -svc_tcp_sock_recv_cmsg (struct svc_sock *svsk,struct msghdr *msg) +svc_tcp_sock_recv_cmsg (struct socket *sock,unsigned int *msg_flags) {union {struct cmsghdr cmsg;u8 buf[CMSG_SPACE (sizeof (u8))]; } u; -struct socket *sock = svsk->sk_sock; +u8 alert[2 ]; +struct kvec alert_kvec = { + .iov_base = alert, + .iov_len =sizeof (alert), + }; +struct msghdr msg = { + .msg_flags = *msg_flags, + .msg_control = &u, + .msg_controllen =sizeof (u), + }; +int ret; + +iov_iter_kvec (&msg.msg_iter,ITER_DEST , &alert_kvec,1 , + alert_kvec.iov_len); + ret =sock_recvmsg (sock, &msg,MSG_DONTWAIT ); +if (ret >0 && +tls_get_record_type (sock->sk, &u.cmsg) ==TLS_RECORD_TYPE_ALERT ) { +iov_iter_revert (&msg.msg_iter, ret); + ret =svc_tcp_sock_process_cmsg (sock, &msg, &u.cmsg, -EAGAIN ); + } +return ret; +} + +static int +svc_tcp_sock_recvmsg (struct svc_sock *svsk,struct msghdr *msg) +{int ret; +struct socket *sock = svsk->sk_sock; - msg->msg_control = &u; - msg->msg_controllen =sizeof (u); ret =sock_recvmsg (sock, msg,MSG_DONTWAIT ); -if (unlikely (msg->msg_controllen !=sizeof (u))) - ret =svc_tcp_sock_process_cmsg (sock, msg, &u.cmsg, ret); +if (msg->msg_flags &MSG_CTRUNC ) { + msg->msg_flags &= ~(MSG_CTRUNC |MSG_EOR ); +if (ret ==0 || ret == -EIO ) + ret =svc_tcp_sock_recv_cmsg (sock, &msg->msg_flags); + }return ret; }
@@ -321,7 +348,7 @@ static ssize_t svc_tcp_read_msg(struct siov_iter_advance (&msg.msg_iter, seek); buflen -= seek; } - len =svc_tcp_sock_recv_cmsg (svsk, &msg); + len =svc_tcp_sock_recvmsg (svsk, &msg);if (len >0 )svc_flush_bvec (bvec, len, seek);
@@ -1018,7 +1045,7 @@ static ssize_t svc_tcp_read_marker(struc iov.iov_base = ((char *)&svsk->sk_marker) + svsk->sk_tcplen; iov.iov_len = want;iov_iter_kvec (&msg.msg_iter,ITER_DEST , &iov,1 , want); - len =svc_tcp_sock_recv_cmsg (svsk, &msg); + len =svc_tcp_sock_recvmsg (svsk, &msg);if (len <0 )return len; svsk->sk_tcplen += len;
Greg Kroah-Hartman
maintainerPATCH 576/627 perf/core: Preserve AUX buffer allocation failure result
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 54473e0ef849f44e5ee43e6d6746c27030c3825b upstream.
A recent overhaul sets the return value to 0 unconditionally after the allocations, which causes reference count leaks and corrupts the user->vm accounting.
Preserve the AUX buffer allocation failure return value, so that the subsequent code works correctly.
--- kernel/events/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/events/core.c +1 -2
@@ -7115,6 +7115,7 @@ static int perf_mmap(struct file *file,perf_event_update_time (event);perf_event_init_userpage (event);perf_event_update_userpage (event); + ret =0 ; }else { ret =rb_alloc_aux (rb, event, vma->vm_pgoff, nr_pages, event->attr.aux_watermark, flags);
@@ -7122,8 +7123,6 @@ static int perf_mmap(struct file *file, rb->aux_mmap_locked = extra; } - ret =0 ; - unlock:if (!ret) {atomic_long_add (user_extra, &user->locked_vm);
Greg Kroah-Hartman
maintainerPATCH 577/627 perf/core: Dont leak AUX buffer refcount on allocation failure
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 5468c0fbccbb9d156522c50832244a8b722374fb upstream.
Failure of the AUX buffer allocation leaks the reference count.
Set the reference count to 1 only when the allocation succeeds.
--- kernel/events/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/events/core.c +4 -3
@@ -7051,8 +7051,6 @@ static int perf_mmap(struct file *file, ret =0 ; goto unlock; } - -atomic_set (&rb->aux_mmap_count,1 ); } user_lock_limit = sysctl_perf_event_mlock >> (PAGE_SHIFT -10 );
@@ -7119,8 +7117,10 @@ static int perf_mmap(struct file *file, }else { ret =rb_alloc_aux (rb, event, vma->vm_pgoff, nr_pages, event->attr.aux_watermark, flags); -if (!ret) +if (!ret) { +atomic_set (&rb->aux_mmap_count,1 ); rb->aux_mmap_locked = extra; + } } unlock:
@@ -7130,6 +7130,7 @@ unlock:atomic_inc (&event->mmap_count); }else if (rb) { +/* AUX allocation failed */ atomic_dec (&rb->mmap_count); } aux_unlock:
Greg Kroah-Hartman
maintainerPATCH 578/627 perf/core: Exit early on perf_mmap() fail
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 07091aade394f690e7b655578140ef84d0e8d7b0 upstream.
When perf_mmap() fails to allocate a buffer, it still invokes the event_mapped() callback of the related event. On X86 this might increase the perf_rdpmc_allowed reference counter. But nothing undoes this as perf_mmap_close() is never called in this case, which causes another reference count leak.
Return early on failure to prevent that.
--- kernel/events/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/events/core.c +4 -2
@@ -7138,6 +7138,9 @@ aux_unlock:mutex_unlock (aux_mutex);mutex_unlock (&event->mmap_mutex); +if (ret) +return ret; +/* * Since pinned accounting is per vm we cannot allow fork() to copy our * vma.
@@ -7145,8 +7148,7 @@ aux_unlock:vm_flags_set (vma,VM_DONTCOPY |VM_DONTEXPAND |VM_DONTDUMP ); vma->vm_ops = &perf_mmap_vmops; -if (!ret) - ret =map_range (rb, vma); + ret =map_range (rb, vma); mapped =get_mapped (event, event_mapped);if (mapped)
Greg Kroah-Hartman
maintainerPATCH 579/627 perf/core: Handle buffer mapping fail correctly in perf_mmap()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit f74b9f4ba63ffdf597aaaa6cad7e284cb8e04820 upstream.
After successful allocation of a buffer or a successful attachment to an existing buffer perf_mmap() tries to map the buffer read only into the page table. If that fails, the already set up page table entries are zapped, but the other perf specific side effects of that failure are not handled. The calling code just cleans up the VMA and does not invoke perf_mmap_close().
This leaks reference counts, corrupts user->vm accounting and also results in an unbalanced invocation of event::event_mapped().
Cure this by moving the event::event_mapped() invocation before the map_range() call so that on map_range() failure perf_mmap_close() can be invoked without causing an unbalanced event::event_unmapped() call.
perf_mmap_close() undoes the reference counts and eventually frees buffers.
--- kernel/events/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/events/core.c +10 -2
@@ -7148,12 +7148,20 @@ aux_unlock:vm_flags_set (vma,VM_DONTCOPY |VM_DONTEXPAND |VM_DONTDUMP ); vma->vm_ops = &perf_mmap_vmops; - ret =map_range (rb, vma); - mapped =get_mapped (event, event_mapped);if (mapped)mapped (event, vma->vm_mm); +/* +* Try to map it into the page table. On fail, invoke +* perf_mmap_close() to undo the above, as the callsite expects +* full cleanup in this case and therefore does not invoke +* vmops::close(). +*/ + ret =map_range (rb, vma); +if (ret) +perf_mmap_close (vma); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 580/627 perf/core: Prevent VMA split of buffer mappings
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit b024d7b56c77191cde544f838debb7f8451cd0d6 upstream.
The perf mmap code is careful about mmap()'ing the user page with the ringbuffer and additionally the auxiliary buffer, when the event supports it. Once the first mapping is established, subsequent mapping have to use the same offset and the same size in both cases. The reference counting for the ringbuffer and the auxiliary buffer depends on this being correct.
Though perf does not prevent that a related mapping is split via mmap(2), munmap(2) or mremap(2). A split of a VMA results in perf_mmap_open() calls, which take reference counts, but then the subsequent perf_mmap_close() calls are not longer fulfilling the offset and size checks. This leads to reference count leaks.
As perf already has the requirement for subsequent mappings to match the initial mapping, the obvious consequence is that VMA splits, caused by resizing of a mapping or partial unmapping, have to be prevented.
Implement the vm_operations_struct::may_split() callback and return unconditionally -EINVAL.
That ensures that the mapping offsets and sizes cannot be changed after the fact. Remapping to a different fixed address with the same size is still possible as it takes the references for the new mapping and drops those of the old mapping.
--- kernel/events/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kernel/events/core.c +10 -0
@@ -6842,10 +6842,20 @@ static vm_fault_t perf_mmap_pfn_mkwrite(return vmf->pgoff ==0 ?0 :VM_FAULT_SIGBUS ; } +static int perf_mmap_may_split (struct vm_area_struct *vma,unsigned long addr) +{ +/* +* Forbid splitting perf mappings to prevent refcount leaks due to +* the resulting non-matching offsets and sizes. See open()/close(). +*/ +return -EINVAL ; +} +static const struct vm_operations_struct perf_mmap_vmops = { .open = perf_mmap_open, .close = perf_mmap_close,/* non mergeable */ .pfn_mkwrite = perf_mmap_pfn_mkwrite, + .may_split = perf_mmap_may_split, };static int map_range (struct perf_buffer *rb,struct vm_area_struct *vma)
Greg Kroah-Hartman
maintainerPATCH 581/627 selftests/perf_events: Add a mmap() correctness test
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes <[email protected]>
commit 084d2ac4030c5919e85bba1f4af26e33491469cb upstream.
Exercise various mmap(), munmap() and mremap() invocations, which might cause a perf buffer mapping to be split or truncated.
To avoid hard coding the perf event and having dependencies on architectures and configuration options, scan through event types in sysfs and try to open them. On success, try to mmap() and if that succeeds try to mmap() the AUX buffer.
In case that no AUX buffer supporting event is found, only test the base buffer mapping. If no mappable event is found or permissions are not sufficient, skip the tests.
Reserve a PROT_NONE region for both rb and aux tests to allow testing the case where mremap unmaps beyond the end of a mapped VMA to prevent it from unmapping unrelated mappings.
--- tools/testing/selftests/perf_events/.gitignore | 1 tools/testing/selftests/perf_events/Makefile | 2 tools/testing/selftests/perf_events/mmap.c | 236 +++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/perf_events/mmap.c
tools/testing/selftests/perf_events/.gitignore +1 -0
@@ -2,3 +2,4 @@ sigtrap_threads remove_on_exec watermark_signal +mmap
tools/testing/selftests/perf_events/Makefile +1 -1
@@ -2,5 +2,5 @@ CFLAGS += -Wl,-no-as-needed -Wall $(KHDR_INCLUDES) LDFLAGS += -lpthread -TEST_GEN_PROGS := sigtrap_threads remove_on_exec watermark_signal +TEST_GEN_PROGS := sigtrap_threads remove_on_exec watermark_signal mmap include ../lib.mk
tools/testing/selftests/perf_events/mmap.c new file +236 -0
236 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 582/627 net/packet: fix a race in packet_set_ring() and packet_notifier()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quang Le <[email protected]>
commit 01d3c8417b9c1b884a8a981a3b886da556512f36 upstream.
When packet_set_ring() releases po->bind_lock, another thread can run packet_notifier() and process an NETDEV_UP event.
This race and the fix are both similar to that of commit 15fe076edea7 ("net/packet: fix a race in packet_bind() and packet_notifier()").
There too the packet_notifier NETDEV_UP event managed to run while a po->bind_lock critical section had to be temporarily released. And the fix was similarly to temporarily set po->num to zero to keep the socket unhooked until the lock is retaken.
The po->bind_lock in packet_set_ring and packet_notifier precede the introduction of git history.
--- net/packet/af_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/packet/af_packet.c +6 -6
@@ -4573,10 +4573,10 @@ static int packet_set_ring(struct sock *spin_lock (&po->bind_lock); was_running =packet_sock_flag (po,PACKET_SOCK_RUNNING ); num = po->num; -if (was_running) { -WRITE_ONCE (po->num,0 ); +WRITE_ONCE (po->num,0 ); +if (was_running)__unregister_prot_hook (sk, false); - } +spin_unlock (&po->bind_lock);synchronize_net ();
@@ -4608,10 +4608,10 @@ static int packet_set_ring(struct sock *mutex_unlock (&po->pg_vec_lock);spin_lock (&po->bind_lock); -if (was_running) { -WRITE_ONCE (po->num, num); +WRITE_ONCE (po->num, num); +if (was_running)register_prot_hook (sk); - } +spin_unlock (&po->bind_lock);if (pg_vec && (po->tp_version >TPACKET_V2 )) {/* Because we don't support block-based V3 on tx-ring */
Greg Kroah-Hartman
maintainerPATCH 583/627 vsock: Do not allow binding to VMADDR_PORT_ANY
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Budimir Markovic <[email protected]>
commit aba0c94f61ec05315fa7815d21aefa4c87f6a9f4 upstream.
It is possible for a vsock to autobind to VMADDR_PORT_ANY. This can cause a use-after-free when a connection is made to the bound socket. The socket returned by accept() also has port VMADDR_PORT_ANY but is not on the list of unbound sockets. Binding it will result in an extra refcount decrement similar to the one fixed in fcdd2242c023 (vsock: Keep the binding until socket destruction).
Modify the check in __vsock_bind_connectible() to also prevent binding to VMADDR_PORT_ANY.
--- net/vmw_vsock/af_vsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +2 -1
@@ -689,7 +689,8 @@ static int __vsock_bind_connectible(struunsigned int i;for (i =0 ; i <MAX_PORT_RETRIES ; i++) { -if (port <=LAST_RESERVED_PORT ) +if (port ==VMADDR_PORT_ANY || + port <=LAST_RESERVED_PORT ) port =LAST_RESERVED_PORT +1 ; new_addr.svm_port = port++;
Greg Kroah-Hartman
maintainerPATCH 584/627 ksmbd: fix null pointer dereference error in generate_encryptionkey
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 9b493ab6f35178afd8d619800df9071992f715de upstream.
If client send two session setups with krb5 authenticate to ksmbd, null pointer dereference error in generate_encryptionkey could happen. sess->Preauth_HashValue is set to NULL if session is valid. So this patch skip generate encryption key if session is valid.
--- fs/smb/server/smb2pdu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +16 -2
@@ -1621,11 +1621,24 @@ static int krb5_authenticate(struct ksmb rsp->SecurityBufferLength =cpu_to_le16 (out_len); -if ((conn->sign || server_conf.enforced_signing) || +/* +* If session state is SMB2_SESSION_VALID, We can assume +* that it is reauthentication. And the user/password +* has been verified, so return it here. +*/ +if (sess->state ==SMB2_SESSION_VALID ) { +if (conn->binding) + goto binding_session; +return 0 ; + } + +if ((rsp->SessionFlags !=SMB2_SESSION_FLAG_IS_GUEST_LE && + (conn->sign || server_conf.enforced_signing)) || (req->SecurityMode &SMB2_NEGOTIATE_SIGNING_REQUIRED )) sess->sign = true; -if (smb3_encryption_negotiated (conn)) { +if (smb3_encryption_negotiated (conn) && + !(req->Flags &SMB2_SESSION_REQ_FLAG_BINDING )) { retval = conn->ops->generate_encryptionkey (conn, sess);if (retval) { ksmbd_debug(SMB,
@@ -1638,6 +1651,7 @@ static int krb5_authenticate(struct ksmb sess->sign = false; } +binding_session:if (conn->dialect >=SMB30_PROT_ID ) { chann =lookup_chann_list (sess, conn);if (!chann) {
Greg Kroah-Hartman
maintainerPATCH 585/627 ksmbd: fix Preauh_HashValue race condition
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 44a3059c4c8cc635a1fb2afd692d0730ca1ba4b6 upstream.
If client send multiple session setup requests to ksmbd, Preauh_HashValue race condition could happen.
There is no need to free sess->Preauh_HashValue at session setup phase. It can be freed together with session at connection termination phase.
--- fs/smb/server/smb2pdu.c | 4 ---- 1 file changed, 4 deletions(-)
fs/smb/server/smb2pdu.c +0 -4
@@ -1847,8 +1847,6 @@ int smb2_sess_setup(struct ksmbd_work *wksmbd_conn_set_good (conn); sess->state =SMB2_SESSION_VALID ; } -kfree (sess->Preauth_HashValue); - sess->Preauth_HashValue =NULL ; }else if (conn->preferred_auth_mech ==KSMBD_AUTH_NTLMSSP ) {if (negblob->MessageType == NtLmNegotiate) { rc =ntlm_negotiate (work, negblob, negblob_len, rsp);
@@ -1875,8 +1873,6 @@ int smb2_sess_setup(struct ksmbd_work *wkfree (preauth_sess); } } -kfree (sess->Preauth_HashValue); - sess->Preauth_HashValue =NULL ; }else {pr_info_ratelimited ("Unknown NTLMSSP message type : 0x%x\n" ,le32_to_cpu (negblob->MessageType));
Greg Kroah-Hartman
maintainerPATCH 586/627 ksmbd: fix corrupted mtime and ctime in smb2_open
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 4f8ff9486fd94b9d6a4932f2aefb9f2fc3bd0cf6 upstream.
If STATX_BASIC_STATS flags are not given as an argument to vfs_getattr, It can not get ctime and mtime in kstat.
This causes a problem showing mtime and ctime outdated from cifs.ko.
File: /xfstest.test/foo
Size: 4096 Blocks: 8 IO Block: 1048576 regular file
Device: 0,65 Inode: 2033391 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:cifs_t:s0
Access: 2025-07-23 22:15:30.136051900 +0100
Modify: 1970-01-01 01:00:00.000000000 +0100
Change: 1970-01-01 01:00:00.000000000 +0100
Birth: 2025-07-23 22:15:30.136051900 +0100
--- fs/smb/server/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/vfs.c +2 -1
@@ -548,7 +548,8 @@ int ksmbd_vfs_getattr(const struct path {int err; - err =vfs_getattr (path, stat,STATX_BTIME ,AT_STATX_SYNC_AS_STAT ); + err =vfs_getattr (path, stat,STATX_BASIC_STATS |STATX_BTIME , +AT_STATX_SYNC_AS_STAT );if (err)pr_err ("getattr failed, err %d\n" , err);return err;
Greg Kroah-Hartman
maintainerPATCH 587/627 smb: client: fix netns refcount leak after net_passive changes
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Zhaolong <[email protected]>
commit 59b33fab4ca4d7dacc03367082777627e05d0323 upstream.
After commit 5c70eb5c593d ("net: better track kernel sockets lifetime"), kernel sockets now use net_passive reference counting. However, commit 95d2b9f693ff ("Revert "smb: client: fix TCP timers deadlock after rmmod"") restored the manual socket refcount manipulation without adapting to this new mechanism, causing a memory leak.
The issue can be reproduced by[1]:
1. Creating a network namespace
2. Mounting and Unmounting CIFS within the namespace
3. Deleting the namespace
Some memory leaks may appear after a period of time following step 3.
unreferenced object 0xffff9951419f6b00 (size 256):
comm "ip", pid 447, jiffies 4294692389 (age 14.730s) hex dump (first 32 bytes):
1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 80 77 c2 44 51 99 ff ff .........w.DQ...
backtrace:
__kmem_cache_alloc_node+0x30e/0x3d0
__kmalloc+0x52/0x120
net_alloc_generic+0x1d/0x30
copy_net_ns+0x86/0x200
create_new_namespaces+0x117/0x300
unshare_nsproxy_namespaces+0x60/0xa0
ksys_unshare+0x148/0x360
__x64_sys_unshare+0x12/0x20
do_syscall_64+0x59/0x110
entry_SYSCALL_64_after_hwframe+0x78/0xe2...
unreferenced object 0xffff9951442e7500 (size 32):
comm "mount.cifs", pid 475, jiffies 4294693782 (age 13.343s) hex dump (first 32 bytes):
40 c5 38 46 51 99 ff ff 18 01 96 42 51 99 ff ff @.8FQ......BQ...
01 00 00 00 6f 00 c5 07 6f 00 d8 07 00 00 00 00 ....o...o.......
backtrace:
__kmem_cache_alloc_node+0x30e/0x3d0
kmalloc_trace+0x2a/0x90
ref_tracker_alloc+0x8e/0x1d0
sk_alloc+0x18c/0x1c0
inet_create+0xf1/0x370
__sock_create+0xd7/0x1e0
generic_ip_connect+0x1d4/0x5a0 [cifs]
cifs_get_tcp_session+0x5d0/0x8a0 [cifs]
cifs_mount_get_session+0x47/0x1b0 [cifs]
dfs_mount_share+0xfa/0xa10 [cifs]
cifs_mount+0x68/0x2b0 [cifs]
cifs_smb3_do_mount+0x10b/0x760 [cifs]
smb3_get_tree+0x112/0x2e0 [cifs]
vfs_get_tree+0x29/0xf0
path_mount+0x2d4/0xa00
__se_sys_mount+0x165/0x1d0Root cause:
When creating kernel sockets, sk_alloc() calls net_passive_inc() for sockets with sk_net_refcnt=0. The CIFS code manually converts kernel sockets to user sockets by setting sk_net_refcnt=1, but doesn't call the corresponding net_passive_dec(). This creates an imbalance in the net_passive counter, which prevents the network namespace from being destroyed when its last user reference is dropped. As a result, the entire namespace and all its associated resources remain allocated.
Timeline of patches leading to this issue:
- commit ef7134c7fc48 ("smb: client: Fix use-after-free of network namespace.") in v6.12 fixed the original netns UAF by manually managing socket refcounts
- commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after rmmod") in v6.13 attempted to use kernel sockets but introduced TCP timer issues
- commit 5c70eb5c593d ("net: better track kernel sockets lifetime") in v6.14-rc5 introduced the net_passive mechanism with sk_net_refcnt_upgrade() for proper socket conversion
- commit 95d2b9f693ff ("Revert "smb: client: fix TCP timers deadlock after rmmod"") in v6.15-rc3 reverted to manual refcount management without adapting to the new net_passive changes
Fix this by using sk_net_refcnt_upgrade() which properly handles the net_passive counter when converting kernel sockets to user sockets.
--- fs/smb/client/connect.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/smb/client/connect.c +3 -6
@@ -3362,18 +3362,15 @@ generic_ip_connect(struct TCP_Server_Infstruct net *net =cifs_net_ns (server);struct sock *sk; - rc =__sock_create (net, sfamily,SOCK_STREAM , -IPPROTO_TCP , &server->ssocket,1 ); + rc =sock_create_kern (net, sfamily,SOCK_STREAM , +IPPROTO_TCP , &server->ssocket);if (rc <0 ) {cifs_server_dbg (VFS ,"Error %d creating socket\n" , rc);return rc; } sk = server->ssocket->sk; -__netns_tracker_free (net, &sk->ns_tracker, false); - sk->sk_net_refcnt =1 ; -get_net_track (net, &sk->ns_tracker,GFP_KERNEL ); -sock_inuse_add (net,1 ); +sk_net_refcnt_upgrade (sk);/* BB other socket options to set KEEPALIVE, NODELAY? */ cifs_dbg (FYI ,"Socket created\n" );
Greg Kroah-Hartman
maintainerPATCH 588/627 smb: client: set symlink type as native for POSIX mounts
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
commit a967e758f8e9d8ce5ef096743393df5e6e51644b upstream.
SMB3.1.1 POSIX mounts require symlinks to be created natively with IO_REPARSE_TAG_SYMLINK reparse point.
--- fs/smb/client/cifsfs.c | 2 +- fs/smb/client/fs_context.c | 18 ------------------ fs/smb/client/fs_context.h | 18 +++++++++++++++++- fs/smb/client/link.c | 11 +++-------- fs/smb/client/reparse.c | 2 +- 5 files changed, 22 insertions(+), 29 deletions(-)
fs/smb/client/cifsfs.c +1 -1
@@ -723,7 +723,7 @@ cifs_show_options(struct seq_file *s, stelse seq_puts (s,",nativesocket" );seq_show_option (s,"symlink" , -cifs_symlink_type_str (get_cifs_symlink_type (cifs_sb))); +cifs_symlink_type_str (cifs_symlink_type (cifs_sb)));seq_printf (s,",rsize=%u" , cifs_sb->ctx->rsize);seq_printf (s,",wsize=%u" , cifs_sb->ctx->wsize);
fs/smb/client/fs_context.c +0 -18
@@ -1851,24 +1851,6 @@ static int smb3_fs_context_parse_param(sreturn -EINVAL ; } -enum cifs_symlink_type get_cifs_symlink_type (struct cifs_sb_info *cifs_sb) -{ -if (cifs_sb->ctx->symlink_type ==CIFS_SYMLINK_TYPE_DEFAULT ) { -if (cifs_sb->ctx->mfsymlinks) -return CIFS_SYMLINK_TYPE_MFSYMLINKS ; -else if (cifs_sb->ctx->sfu_emul) -return CIFS_SYMLINK_TYPE_SFU ; -else if (cifs_sb->ctx->linux_ext && !cifs_sb->ctx->no_linux_ext) -return CIFS_SYMLINK_TYPE_UNIX ; -else if (cifs_sb->ctx->reparse_type !=CIFS_REPARSE_TYPE_NONE ) -return CIFS_SYMLINK_TYPE_NATIVE ; -else -return CIFS_SYMLINK_TYPE_NONE ; - }else { -return cifs_sb->ctx->symlink_type; - } -} -int smb3_init_fs_context (struct fs_context *fc) {struct smb3_fs_context *ctx;
fs/smb/client/fs_context.h +17 -1
@@ -341,7 +341,23 @@ struct smb3_fs_context {extern const struct fs_parameter_spec smb3_fs_parameters[]; -extern enum cifs_symlink_type get_cifs_symlink_type (struct cifs_sb_info *cifs_sb); +static inline enum cifs_symlink_type cifs_symlink_type (struct cifs_sb_info *cifs_sb) +{ +bool posix =cifs_sb_master_tcon (cifs_sb)->posix_extensions; + +if (cifs_sb->ctx->symlink_type !=CIFS_SYMLINK_TYPE_DEFAULT ) +return cifs_sb->ctx->symlink_type; + +if (cifs_sb->ctx->mfsymlinks) +return CIFS_SYMLINK_TYPE_MFSYMLINKS ; +else if (cifs_sb->ctx->sfu_emul) +return CIFS_SYMLINK_TYPE_SFU ; +else if (cifs_sb->ctx->linux_ext && !cifs_sb->ctx->no_linux_ext) +return posix ?CIFS_SYMLINK_TYPE_NATIVE :CIFS_SYMLINK_TYPE_UNIX ; +else if (cifs_sb->ctx->reparse_type !=CIFS_REPARSE_TYPE_NONE ) +return CIFS_SYMLINK_TYPE_NATIVE ; +return CIFS_SYMLINK_TYPE_NONE ; +}extern int smb3_init_fs_context (struct fs_context *fc);extern void smb3_cleanup_fs_context_contents (struct smb3_fs_context *ctx);
fs/smb/client/link.c +3 -8
@@ -606,14 +606,7 @@ cifs_symlink(struct mnt_idmap *idmap, st/* BB what if DFS and this volume is on different share? BB */ rc = -EOPNOTSUPP ; -switch (get_cifs_symlink_type (cifs_sb)) { -case CIFS_SYMLINK_TYPE_DEFAULT : -/* should not happen, get_cifs_symlink_type() resolves the default */ -break ; - -case CIFS_SYMLINK_TYPE_NONE : -break ; - +switch (cifs_symlink_type (cifs_sb)) {case CIFS_SYMLINK_TYPE_UNIX :#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY if (pTcon->unix_ext) {
@@ -653,6 +646,8 @@ cifs_symlink(struct mnt_idmap *idmap, st goto symlink_exit; }break ; +default : +break ; }if (rc ==0 ) {
fs/smb/client/reparse.c +1 -1
@@ -38,7 +38,7 @@ int smb2_create_reparse_symlink(const un struct dentry *dentry, struct cifs_tcon *tcon, const char *full_path, const char *symname) { - switch (get_cifs_symlink_type(CIFS_SB(inode->i_sb))) { + switch (cifs_symlink_type(CIFS_SB(inode->i_sb))) { case CIFS_SYMLINK_TYPE_NATIVE: return create_native_symlink(xid, inode, dentry, tcon, full_path, symname);case CIFS_SYMLINK_TYPE_NFS :
Greg Kroah-Hartman
maintainerPATCH 589/627 smb: client: default to nonativesocket under POSIX mounts
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
commit 6b445309eec2bc0594f3e24c7777aeef891d386e upstream.
SMB3.1.1 POSIX mounts require sockets to be created with NFS reparse points.
--- fs/smb/client/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/smb/client/fs_context.c +1 -0
@@ -1674,6 +1674,7 @@ static int smb3_fs_context_parse_param(spr_warn_once ("conflicting posix mount options specified\n" ); ctx->linux_ext =1 ; ctx->no_linux_ext =0 ; + ctx->nonativesocket =1 ;/* POSIX mounts use NFS style reparse points */ }break ;case Opt_nocase:
Greg Kroah-Hartman
maintainerPATCH 590/627 ksmbd: limit repeated connections from clients with the same IP
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit e6bb9193974059ddbb0ce7763fa3882bd60d4dc3 upstream.
Repeated connections from clients with the same IP address may exhaust the max connections and prevent other normal client connections. This patch limit repeated connections from clients with the same IP.
--- fs/smb/server/connection.h | 1 + fs/smb/server/transport_tcp.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
fs/smb/server/connection.h +1 -0
@@ -46,6 +46,7 @@ struct ksmbd_conn {struct mutex srv_mutex;int status;unsigned int cli_cap; +__be32 inet_addr;char *request_buf;struct ksmbd_transport *transport;struct nls_table *local_nls;
fs/smb/server/transport_tcp.c +17 -0
@@ -87,6 +87,7 @@ static struct tcp_transport *alloc_transreturn NULL ; } + conn->inet_addr =inet_sk (client_sk->sk)->inet_daddr; conn->transport =KSMBD_TRANS (t);KSMBD_TRANS (t)->conn = conn;KSMBD_TRANS (t)->ops = &ksmbd_tcp_transport_ops;
@@ -230,6 +231,8 @@ static int ksmbd_kthread_fn(void *p) {struct socket *client_sk =NULL ;struct interface *iface = (struct interface *)p; +struct inet_sock *csk_inet; +struct ksmbd_conn *conn;int ret;while (!kthread_should_stop ()) {
@@ -248,6 +251,20 @@ static int ksmbd_kthread_fn(void *p)continue ; } +/* +* Limits repeated connections from clients with the same IP. +*/ + csk_inet =inet_sk (client_sk->sk); +down_read (&conn_list_lock); +list_for_each_entry (conn, &conn_list, conns_list) +if (csk_inet->inet_daddr == conn->inet_addr) { + ret = -EAGAIN ; +break ; + } +up_read (&conn_list_lock); +if (ret == -EAGAIN ) +continue ; +if (server_conf.max_connections &&atomic_inc_return (&active_num_conn) >= server_conf.max_connections) { pr_info_ratelimited("Limit the maximum number of connections(%u)\n",
Greg Kroah-Hartman
maintainerPATCH 591/627 smb: server: Fix extension string in ksmbd_extract_shortname()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 8e7d178d06e8937454b6d2f2811fa6a15656a214 upstream.
In ksmbd_extract_shortname(), strscpy() is incorrectly called with the length of the source string (excluding the NUL terminator) rather than the size of the destination buffer. This results in "__" being copied to 'extension' rather than "___" (two underscores instead of three).
Use the destination buffer size instead to ensure that the string "___" (three underscores) is copied correctly.
--- fs/smb/server/smb_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/smb_common.c +1 -1
@@ -515,7 +515,7 @@ int ksmbd_extract_shortname(struct ksmbd p =strrchr (longname,'.' );if (p == longname) {/*name starts with a dot*/ -strscpy (extension,"___" ,strlen ("___" )); +strscpy (extension,"___" ,sizeof (extension)); }else {if (p) { p++;
Greg Kroah-Hartman
maintainerPATCH 592/627 USB: serial: option: add Foxconn T99W709
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slark Xiao <[email protected]>
commit ad1244e1ce18f8c1a5ebad8074bfcf10eacb0311 upstream.
T99W709 is designed based on MTK T300(5G redcap) chip. There are 7 serial ports to be enumerated: AP_LOG, GNSS, AP_META, AT, MD_META, NPT, DBG. RSVD(5) for ADB port.
test evidence as below:
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 7 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e15f Rev=00.01 S: Manufacturer=MediaTek Inc. S: Product=USB DATA CARD S: SerialNumber=355511220000399 C: #Ifs=10 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs I: If#=0x6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -2346,6 +2346,8 @@ static const struct usb_device_id option .driver_info = RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe145, 0xff), /* Foxconn T99W651 RNDIS */ .driver_info = RSVD(5) | RSVD(6) }, + { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe15f, 0xff), /* Foxconn T99W709 */ + .driver_info = RSVD(5) }, { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe167, 0xff), /* Foxconn T99W640 MBIM */ .driver_info = RSVD(3) }, { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
Greg Kroah-Hartman
maintainerPATCH 593/627 Bluetooth: btusb: Add USB ID 3625:010b for TP-LINK Archer TX10UB Nano
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zenm Chen <[email protected]>
commit d9da920233ec85af8b9c87154f2721a7dc4623f5 upstream.
Add USB ID 3625:010b for TP-LINK Archer TX10UB Nano which is based on a Realtek RTL8851BU chip.
The information in /sys/kernel/debug/usb/devices about the Bluetooth device is listed as the below:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 9 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=3625 ProdID=010b Rev= 0.00
S: Manufacturer=Realtek
S: Product=802.11ax WLAN Adapter
S: SerialNumber=00e04c000001
C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 8 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8851bu
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -516,6 +516,10 @@ static const struct usb_device_id quirks { USB_DEVICE(0x0bda, 0xb850), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3600), .driver_info = BTUSB_REALTEK }, + /* Realtek 8851BU Bluetooth devices */ + { USB_DEVICE(0x3625, 0x010b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + /* Realtek 8852AE Bluetooth devices */ { USB_DEVICE(0x0bda, 0x2852), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH },
Greg Kroah-Hartman
maintainerPATCH 594/627 net: usbnet: Avoid potential RCU stall on LINK_CHANGE event
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ernberg <[email protected]>
commit 0d9cfc9b8cb17dbc29a98792d36ec39a1cf1395f upstream.
The Gemalto Cinterion PLS83-W modem (cdc_ether) is emitting confusing link up and down events when the WWAN interface is activated on the modem-side.
Interrupt URBs will in consecutive polls grab:
* Link Connected
* Link Disconnected
* Link Connected
Where the last Connected is then a stable link state.
When the system is under load this may cause the unlink_urbs() work in __handle_link_change() to not complete before the next usbnet_link_change() call turns the carrier on again, allowing rx_submit() to queue new SKBs.
In that event the URB queue is filled faster than it can drain, ending up in a RCU stall:
rcu: INFO: rcu_sched detected expedited stalls on CPUs/tasks: { 0-.... } 33108 jiffies s: 201 root: 0x1/.
rcu: blocking rcu_node structures (internal RCU debug):
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0
Call trace:
arch_local_irq_enable+0x4/0x8
local_bh_enable+0x18/0x20
__netdev_alloc_skb+0x18c/0x1cc
rx_submit+0x68/0x1f8 [usbnet]
rx_alloc_submit+0x4c/0x74 [usbnet]
usbnet_bh+0x1d8/0x218 [usbnet]
usbnet_bh_tasklet+0x10/0x18 [usbnet]
tasklet_action_common+0xa8/0x110
tasklet_action+0x2c/0x34
handle_softirqs+0x2cc/0x3a0
__do_softirq+0x10/0x18
____do_softirq+0xc/0x14
call_on_irq_stack+0x24/0x34
do_softirq_own_stack+0x18/0x20
__irq_exit_rcu+0xa8/0xb8
irq_exit_rcu+0xc/0x30
el1_interrupt+0x34/0x48
el1h_64_irq_handler+0x14/0x1c
el1h_64_irq+0x68/0x6c
_raw_spin_unlock_irqrestore+0x38/0x48
xhci_urb_dequeue+0x1ac/0x45c [xhci_hcd]
unlink1+0xd4/0xdc [usbcore]
usb_hcd_unlink_urb+0x70/0xb0 [usbcore]
usb_unlink_urb+0x24/0x44 [usbcore]
unlink_urbs.constprop.0.isra.0+0x64/0xa8 [usbnet]
__handle_link_change+0x34/0x70 [usbnet]
usbnet_deferred_kevent+0x1c0/0x320 [usbnet]
process_scheduled_works+0x2d0/0x48c
worker_thread+0x150/0x1dc
kthread+0xd8/0xe8
ret_from_fork+0x10/0x20Get around the problem by delaying the carrier on to the scheduled work.
This needs a new flag to keep track of the necessary action.
The carrier ok check cannot be removed as it remains required for the LINK_RESET event flow.
--- drivers/net/usb/usbnet.c | 11 ++++++++--- include/linux/usb/usbnet.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/usb/usbnet.c +8 -3
@@ -1122,6 +1122,9 @@ static void __handle_link_change(struct* tx queue is stopped by netcore after link becomes off */ }else { +if (test_and_clear_bit (EVENT_LINK_CARRIER_ON , &dev->flags)) +netif_carrier_on (dev->net); +/* submitting URBs for reading packets */ tasklet_schedule (&dev->bh); }
@@ -2009,10 +2012,12 @@ EXPORT_SYMBOL(usbnet_manage_power);void usbnet_link_change (struct usbnet *dev,bool link,bool need_reset) {/* update link after link is reseted */ -if (link && !need_reset) -netif_carrier_on (dev->net); -else +if (link && !need_reset) { +set_bit (EVENT_LINK_CARRIER_ON , &dev->flags); + }else { +clear_bit (EVENT_LINK_CARRIER_ON , &dev->flags);netif_carrier_off (dev->net); + }if (need_reset && link)usbnet_defer_kevent (dev,EVENT_LINK_RESET );
include/linux/usb/usbnet.h +1 -0
@@ -76,6 +76,7 @@ struct usbnet {# define EVENT_LINK_CHANGE 11# define EVENT_SET_RX_MODE 12# define EVENT_NO_IP_ALIGN 13 +# define EVENT_LINK_CARRIER_ON 14/* This one is special, as it indicates that the device is going away * there are cyclic dependencies between tasklet, timer and bh * that must be broken
Greg Kroah-Hartman
maintainerPATCH 595/627 net: usbnet: Fix the wrong netif_carrier_on() call
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ammar Faizi <[email protected]>
commit 8466d393700f9ccef68134d3349f4e0a087679b9 upstream.
The commit referenced in the Fixes tag causes usbnet to malfunction (identified via git bisect). Post-commit, my external RJ45 LAN cable fails to connect. Linus also reported the same issue after pulling that commit.
The code has a logic error: netif_carrier_on() is only called when the link is already on. Fix this by moving the netif_carrier_on() call outside the if-statement entirely. This ensures it is always called when EVENT_LINK_CARRIER_ON is set and properly clears it regardless of the link state.
--- drivers/net/usb/usbnet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/usb/usbnet.c +3 -3
@@ -1113,6 +1113,9 @@ static void __handle_link_change(structif (!test_bit (EVENT_DEV_OPEN , &dev->flags))return ; +if (test_and_clear_bit (EVENT_LINK_CARRIER_ON , &dev->flags)) +netif_carrier_on (dev->net); +if (!netif_carrier_ok (dev->net)) {/* kill URBs for reading packets to save bus bandwidth */ unlink_urbs (dev, &dev->rxq);
@@ -1122,9 +1125,6 @@ static void __handle_link_change(struct* tx queue is stopped by netcore after link becomes off */ }else { -if (test_and_clear_bit (EVENT_LINK_CARRIER_ON , &dev->flags)) -netif_carrier_on (dev->net); -/* submitting URBs for reading packets */ tasklet_schedule (&dev->bh); }
Greg Kroah-Hartman
maintainerPATCH 596/627 x86/sev: Evict cache lines during SNP memory validation
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Lendacky <[email protected]>
Commit 7b306dfa326f70114312b320d083b21fa9481e1e upstream.
An SNP cache coherency vulnerability requires a cache line eviction mitigation when validating memory after a page state change to private. The specific mitigation is to touch the first and last byte of each 4K page that is being validated. There is no need to perform the mitigation when performing a page state change to shared and rescinding validation.
CPUID bit Fn8000001F_EBX[31] defines the COHERENCY_SFW_NO CPUID bit that, when set, indicates that the software mitigation for this vulnerability is not needed.
Implement the mitigation and invoke it when validating memory (making it private) and the COHERENCY_SFW_NO bit is not set, indicating the SNP guest is vulnerable.
--- arch/x86/boot/cpuflags.c | 13 +++++++++++++ arch/x86/boot/startup/sev-shared.c | 7 +++++++ arch/x86/coco/sev/core.c | 21 +++++++++++++++++++++ arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/sev.h | 19 +++++++++++++++++++ arch/x86/kernel/cpu/scattered.c | 1 + 6 files changed, 62 insertions(+)
arch/x86/boot/cpuflags.c +13 -0
@@ -106,5 +106,18 @@ void get_cpuflags(void)cpuid (0x80000001 , &ignored, &ignored, &cpu.flags[6 ], &cpu.flags[1 ]); } + +if (max_amd_level >=0x8000001f ) { +u32 ebx; + +/* +* The X86_FEATURE_COHERENCY_SFW_NO feature bit is in +* the virtualization flags entry (word 8) and set by +* scattered.c, so the bit needs to be explicitly set. +*/ +cpuid (0x8000001f , &ignored, &ebx, &ignored, &ignored); +if (ebx &BIT (31 )) +set_bit (X86_FEATURE_COHERENCY_SFW_NO , cpu.flags); + } } }
arch/x86/boot/startup/sev-shared.c +7 -0
@@ -810,6 +810,13 @@ static void __head pvalidate_4k_page(unsif (ret)sev_es_terminate (SEV_TERM_SET_LINUX ,GHCB_TERM_PVALIDATE ); } + +/* +* If validating memory (making it private) and affected by the +* cache-coherency vulnerability, perform the cache eviction mitigation. +*/ +if (validate && !has_cpuflag (X86_FEATURE_COHERENCY_SFW_NO )) +sev_evict_cache ((void *)vaddr,1 ); }/*
arch/x86/coco/sev/core.c +21 -0
@@ -358,10 +358,31 @@ static void svsm_pval_pages(struct snp_pstatic void pvalidate_pages (struct snp_psc_desc *desc) { +struct psc_entry *e; +unsigned int i; +if (snp_vmpl)svsm_pval_pages (desc);else pval_pages (desc); + +/* +* If not affected by the cache-coherency vulnerability there is no need +* to perform the cache eviction mitigation. +*/ +if (cpu_feature_enabled (X86_FEATURE_COHERENCY_SFW_NO )) +return ; + +for (i =0 ; i <= desc->hdr.end_entry; i++) { + e = &desc->entries[i]; + +/* +* If validating memory (making it private) perform the cache +* eviction mitigation. +*/ +if (e->operation ==SNP_PAGE_STATE_PRIVATE ) +sev_evict_cache (pfn_to_kaddr (e->gfn), e->pagesize ?512 :1 ); + } }static int vmgexit_psc (struct ghcb *ghcb,struct snp_psc_desc *desc)
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -218,6 +218,7 @@#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1)/* "flexpriority" Intel FlexPriority */ #define X86_FEATURE_EPT ( 8*32+ 2)/* "ept" Intel Extended Page Table */ #define X86_FEATURE_VPID ( 8*32+ 3)/* "vpid" Intel Virtual Processor ID */ +#define X86_FEATURE_COHERENCY_SFW_NO ( 8*32+ 4)/* SNP cache coherency software work around not needed */ #define X86_FEATURE_VMMCALL ( 8*32+15)/* "vmmcall" Prefer VMMCALL to VMCALL */ #define X86_FEATURE_XENPV ( 8*32+16)/* Xen paravirtual guest */
arch/x86/include/asm/sev.h +19 -0
@@ -621,6 +621,24 @@ int rmp_make_shared(u64 pfn, enum pg_levvoid snp_leak_pages (u64 pfn,unsigned int npages);void kdump_sev_callback (void );void snp_fixup_e820_tables (void ); + +static inline void sev_evict_cache (void *va,int npages) +{ +volatile u8 val__always_unused ; +u8 *bytes = va; +int page_idx; + +/* +* For SEV guests, a read from the first/last cache-lines of a 4K page +* using the guest key is sufficient to cause a flush of all cache-lines +* associated with that 4K page without incurring all the overhead of a +* full CLFLUSH sequence. +*/ +for (page_idx =0 ; page_idx < npages; page_idx++) { + val = bytes[page_idx *PAGE_SIZE ]; + val = bytes[page_idx *PAGE_SIZE +PAGE_SIZE -1 ]; + } +}#else static inline bool snp_probe_rmptable_info (void ) {return false; }static inline int snp_rmptable_init (void ) {return -ENOSYS ; }
@@ -636,6 +654,7 @@ static inline int rmp_make_shared(u64 pfstatic inline void snp_leak_pages (u64 pfn,unsigned int npages) {}static inline void kdump_sev_callback (void ) { }static inline void snp_fixup_e820_tables (void ) {} +static inline void sev_evict_cache (void *va,int npages) {}#endif #endif
arch/x86/kernel/cpu/scattered.c +1 -0
@@ -48,6 +48,7 @@ static const struct cpuid_bit cpuid_bits { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_AMD_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, + { X86_FEATURE_COHERENCY_SFW_NO, CPUID_EBX, 31, 0x8000001f, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, { X86_FEATURE_TSA_SQ_NO, CPUID_ECX, 1, 0x80000021, 0 },
Greg Kroah-Hartman
maintainerPATCH 597/627 ALSA: intel_hdmi: Fix off-by-one error in __hdmi_lpe_audio_probe()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 8cbe564974248ee980562be02f2b1912769562c7 upstream.
In __hdmi_lpe_audio_probe(), strscpy() is incorrectly called with the length of the source string (excluding the NUL terminator) rather than the size of the destination buffer. This results in one character less being copied from 'card->shortname' to 'pcm->name'.
Use the destination buffer size instead to ensure the card name is copied correctly.
--- sound/x86/intel_hdmi_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/x86/intel_hdmi_audio.c +1 -1
@@ -1768,7 +1768,7 @@ static int __hdmi_lpe_audio_probe(struct/* setup private data which can be retrieved when required */ pcm->private_data = ctx; pcm->info_flags =0 ; -strscpy (pcm->name, card->shortname,strlen (card->shortname)); +strscpy (pcm->name, card->shortname,sizeof (pcm->name));/* setup the ops for playback */ snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &had_pcm_ops);
Greg Kroah-Hartman
maintainerPATCH 598/627 ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geoffrey D. Bennett <[email protected]>
commit 8a15ca0ca51399b652b1bbb23b590b220cf03d62 upstream.
During communication with Focusrite Scarlett Gen 2/3/4 USB audio interfaces, -EPROTO is sometimes returned from scarlett2_usb_tx(), snd_usb_ctl_msg() which can cause initialisation and control operations to fail intermittently.
This patch adds up to 5 retries in scarlett2_usb(), with a delay starting at 5ms and doubling each time. This follows the same approach as the fix for usb_set_interface() in endpoint.c (commit f406005e162b ("ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface()")), which resolved similar -EPROTO issues during device initialisation, and is the same approach as in fcp.c:fcp_usb().
--- sound/usb/mixer_scarlett2.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/usb/mixer_scarlett2.c +7 -0
@@ -2351,6 +2351,8 @@ static int scarlett2_usb(struct scarlett2_usb_packet *req, *resp =NULL ;size_t req_buf_size =struct_size (req, data, req_size);size_t resp_buf_size =struct_size (resp, data, resp_size); +int retries =0 ; +const int max_retries =5 ;int err; req =kmalloc (req_buf_size,GFP_KERNEL );
@@ -2374,10 +2376,15 @@ static int scarlett2_usb(if (req_size)memcpy (req->data, req_data, req_size); +retry: err =scarlett2_usb_tx (dev, private->bInterfaceNumber, req, req_buf_size);if (err != req_buf_size) { +if (err == -EPROTO && ++retries <= max_retries) { +msleep (5 * (1 << (retries -1 ))); + goto retry; + } usb_audio_err( mixer->chip, "%s USB request result cmd %x was %d\n",
Greg Kroah-Hartman
maintainerPATCH 599/627 ALSA: hda/realtek - Fix mute LED for HP Victus 16-r1xxx
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edip Hazuri <[email protected]>
commit bd7814a4c0fd883894bdf9fe5eda24c9df826e4c upstream.
The mute led on this laptop is using ALC245 but requires a quirk to work This patch enables the existing quirk for the device.
Tested on Victus 16-r1xxx Laptop. The LED behaviour works as intended.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10874,6 +10874,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8c91 ,"HP EliteBook 660" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8c96 ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8c97 ,"HP ZBook" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x8c99 ,"HP Victus 16-r1xxx (MB 8C99)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8c9c ,"HP Victus 16-s1xxx (MB 8C9C)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8ca1 ,"HP ZBook Power" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 600/627 ALSA: hda/realtek - Fix mute LED for HP Victus 16-s0xxx
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edip Hazuri <[email protected]>
commit 956048a3cd9d2575032e2c7ca62803677357ae18 upstream.
The mute led on this laptop is using ALC245 but requires a quirk to work This patch enables the existing quirk for the device.
Tested on Victus 16-S0063NT Laptop. The LED behaviour works as intended.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10822,6 +10822,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8bbe ,"HP Victus 16-r0xxx (MB 8BBE)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8bc8 ,"HP Victus 15-fa1xxx" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8bcd ,"HP Omen 16-xd0xxx" ,ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT ), +SND_PCI_QUIRK (0x103c ,0x8bd4 ,"HP Victus 16-s0xxx (MB 8BD4)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8bdd ,"HP Envy 17" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8bde ,"HP Envy 17" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 601/627 ALSA: hda/realtek - Fix mute LED for HP Victus 16-d1xxx (MB 8A26)
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edip Hazuri <[email protected]>
commit a9dec0963187d05725369156a5e0e14cd3487bfb upstream.
My friend have Victus 16-d1xxx with board ID 8A26, the existing quirk for Victus 16-d1xxx wasn't working because of different board ID
Tested on Victus 16-d1015nt Laptop. The LED behaviour works as intended.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10764,6 +10764,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8a0f ,"HP Pavilion 14-ec1xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8a20 ,"HP Laptop 15s-fq5xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x8a25 ,"HP Victus 16-d1xxx (MB 8A25)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ), +SND_PCI_QUIRK (0x103c ,0x8a26 ,"HP Victus 16-d1xxx (MB 8A26)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8a28 ,"HP Envy 13" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8a29 ,"HP Envy 15" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 602/627 platform/x86/intel/pmt: fix a crashlog NULL pointer access
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael J. Ruhl <[email protected]>
commit 54d5cd4719c5e87f33d271c9ac2e393147d934f8 upstream.
Usage of the intel_pmt_read() for binary sysfs, requires a pcidev. The current use of the endpoint value is only valid for telemetry endpoint usage.
Without the ep, the crashlog usage causes the following NULL pointer exception:
BUG: kernel NULL pointer dereference, address: 0000000000000000 Oops: Oops: 0000 [#1] SMP NOPTI RIP: 0010:intel_pmt_read+0x3b/0x70 [pmt_class] Code: Call Trace: <TASK> ? sysfs_kf_bin_read+0xc0/0xe0 kernfs_fop_read_iter+0xac/0x1a0 vfs_read+0x26d/0x350 ksys_read+0x6b/0xe0 __x64_sys_read+0x1d/0x30 x64_sys_call+0x1bc8/0x1d70 do_syscall_64+0x6d/0x110
Augment struct intel_pmt_entry with a pointer to the pcidev to avoid the NULL pointer exception.
--- drivers/platform/x86/intel/pmt/class.c | 3 ++- drivers/platform/x86/intel/pmt/class.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmt/class.c +2 -1
@@ -97,7 +97,7 @@ intel_pmt_read(struct file *filp, structif (count > entry->size - off) count = entry->size - off; - count =pmt_telem_read_mmio (entry->ep->pcidev, entry->cb, entry->header.guid, buf, + count =pmt_telem_read_mmio (entry->pcidev, entry->cb, entry->header.guid, buf, entry->base, off, count);return count;
@@ -252,6 +252,7 @@ static int intel_pmt_populate_entry(strureturn -EINVAL ; } + entry->pcidev = pci_dev; entry->guid = header->guid; entry->size = header->size; entry->cb = ivdev->priv_data;
drivers/platform/x86/intel/pmt/class.h +1 -0
@@ -39,6 +39,7 @@ struct intel_pmt_header {struct intel_pmt_entry {struct telem_endpoint *ep; +struct pci_dev *pcidev;struct intel_pmt_header header;struct bin_attribute pmt_bin_attr;struct kobject *kobj;
Greg Kroah-Hartman
maintainerPATCH 603/627 x86/fpu: Delay instruction pointer fixup until after warning
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
commit 1cec9ac2d071cfd2da562241aab0ef701355762a upstream.
Right now, if XRSTOR fails a console message like this is be printed:
Bad FPU state detected at restore_fpregs_from_fpstate+0x9a/0x170, reinitializing FPU registers.
However, the text location (...+0x9a in this case) is the instruction *AFTER* the XRSTOR. The highlighted instruction in the "Code:" dump also points one instruction late.
The reason is that the "fixup" moves RIP up to pass the bad XRSTOR and keep on running after returning from the #GP handler. But it does this fixup before warning.
The resulting warning output is nonsensical because it looks like the non-FPU-related instruction is #GP'ing.
Do not fix up RIP until after printing the warning. Do this by using the more generic and standard ex_handler_default().
--- arch/x86/mm/extable.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/mm/extable.c +2 -3
@@ -122,13 +122,12 @@ static bool ex_handler_sgx(const structstatic bool ex_handler_fprestore (const struct exception_table_entry *fixup,struct pt_regs *regs) { - regs->ip =ex_fixup_addr (fixup); -WARN_ONCE (1 ,"Bad FPU state detected at %pB, reinitializing FPU registers." , (void *)instruction_pointer (regs));fpu_reset_from_exception_fixup (); -return true; + +return ex_handler_default (fixup, regs); }/*
Greg Kroah-Hartman
maintainerPATCH 604/627 KVM: x86: Convert vcpu_run()s immediate exit param into a generic bitmap
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 2478b1b220c49d25cb1c3f061ec4f9b351d9a131 upstream.
Convert kvm_x86_ops.vcpu_run()'s "force_immediate_exit" boolean parameter into an a generic bitmap so that similar "take action" information can be passed to vendor code without creating a pile of boolean parameters.
This will allow dropping kvm_x86_ops.set_dr6() in favor of a new flag, and will also allow for adding similar functionality for re-loading debugctl in the active VMCS.
Opportunistically massage the TDX WARN and comment to prepare for adding more run_flags, all of which are expected to be mutually exclusive with TDX, i.e. should be WARNed on.
No functional change intended.
--- arch/x86/include/asm/kvm_host.h | 6 +++++- arch/x86/kvm/svm/svm.c | 4 ++-- arch/x86/kvm/vmx/main.c | 6 +++--- arch/x86/kvm/vmx/tdx.c | 18 +++++++++--------- arch/x86/kvm/vmx/vmx.c | 3 ++- arch/x86/kvm/vmx/x86_ops.h | 4 ++-- arch/x86/kvm/x86.c | 11 ++++++++--- 7 files changed, 31 insertions(+), 21 deletions(-)
arch/x86/include/asm/kvm_host.h +5 -1
@@ -1680,6 +1680,10 @@ static inline u16 kvm_lapic_irq_dest_modreturn dest_mode_logical ?APIC_DEST_LOGICAL :APIC_DEST_PHYSICAL ; } +enum kvm_x86_run_flags { +KVM_RUN_FORCE_IMMEDIATE_EXIT =BIT (0 ), +}; +struct kvm_x86_ops {const char *name;
@@ -1761,7 +1765,7 @@ struct kvm_x86_ops {int (*vcpu_pre_run)(struct kvm_vcpu *vcpu);enum exit_fastpath_completion (*vcpu_run)(struct kvm_vcpu *vcpu, -bool force_immediate_exit); +u64 run_flags);int (*handle_exit)(struct kvm_vcpu *vcpu,enum exit_fastpath_completion exit_fastpath);int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
arch/x86/kvm/svm/svm.c +2 -2
@@ -4389,9 +4389,9 @@ static noinstr void svm_vcpu_enter_exit(guest_state_exit_irqoff (); } -static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, -bool force_immediate_exit) +static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) { +bool force_immediate_exit = run_flags &KVM_RUN_FORCE_IMMEDIATE_EXIT ;struct vcpu_svm *svm =to_svm (vcpu);bool spec_ctrl_intercepted =msr_write_intercepted (vcpu,MSR_IA32_SPEC_CTRL );
arch/x86/kvm/vmx/main.c +3 -3
@@ -175,12 +175,12 @@ static int vt_vcpu_pre_run(struct kvm_vcreturn vmx_vcpu_pre_run (vcpu); } -static fastpath_t vt_vcpu_run (struct kvm_vcpu *vcpu,bool force_immediate_exit) +static fastpath_t vt_vcpu_run (struct kvm_vcpu *vcpu,u64 run_flags) {if (is_td_vcpu (vcpu)) -return tdx_vcpu_run (vcpu, force_immediate_exit); +return tdx_vcpu_run (vcpu, run_flags); -return vmx_vcpu_run (vcpu, force_immediate_exit); +return vmx_vcpu_run (vcpu, run_flags); } static int vt_handle_exit(struct kvm_vcpu *vcpu,
arch/x86/kvm/vmx/tdx.c +9 -9
@@ -1025,20 +1025,20 @@ static void tdx_load_host_xsave_state(st DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI | \ DEBUGCTLMSR_FREEZE_IN_SMM) -fastpath_t tdx_vcpu_run (struct kvm_vcpu *vcpu,bool force_immediate_exit) +fastpath_t tdx_vcpu_run (struct kvm_vcpu *vcpu,u64 run_flags) {struct vcpu_tdx *tdx =to_tdx (vcpu);struct vcpu_vt *vt =to_vt (vcpu);/* -* force_immediate_exit requires vCPU entering for events injection with -* an immediately exit followed. But The TDX module doesn't guarantee -* entry, it's already possible for KVM to _think_ it completely entry -* to the guest without actually having done so. -* Since KVM never needs to force an immediate exit for TDX, and can't -* do direct injection, just warn on force_immediate_exit. +* WARN if KVM wants to force an immediate exit, as the TDX module does +* not guarantee entry into the guest, i.e. it's possible for KVM to +* _think_ it completed entry to the guest and forced an immediate exit +* without actually having done so. Luckily, KVM never needs to force +* an immediate exit for TDX (KVM can't do direct event injection, so +* just WARN and continue on. */ -WARN_ON_ONCE (force_immediate_exit); +WARN_ON_ONCE (run_flags);/* * Wait until retry of SEPT-zap-related SEAMCALL completes before
@@ -1048,7 +1048,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpuif (unlikely (READ_ONCE (to_kvm_tdx (vcpu->kvm)->wait_for_sept_zap)))return EXIT_FASTPATH_EXIT_HANDLED ; -trace_kvm_entry (vcpu, force_immediate_exit); +trace_kvm_entry (vcpu, run_flags &KVM_RUN_FORCE_IMMEDIATE_EXIT );if (pi_test_on (&vt->pi_desc)) { apic->send_IPI_self (POSTED_INTR_VECTOR );
arch/x86/kvm/vmx/vmx.c +2 -1
@@ -7323,8 +7323,9 @@ out:guest_state_exit_irqoff (); } -fastpath_t vmx_vcpu_run (struct kvm_vcpu *vcpu,bool force_immediate_exit) +fastpath_t vmx_vcpu_run (struct kvm_vcpu *vcpu,u64 run_flags) { +bool force_immediate_exit = run_flags &KVM_RUN_FORCE_IMMEDIATE_EXIT ;struct vcpu_vmx *vmx =to_vmx (vcpu);unsigned long cr3, cr4;
arch/x86/kvm/vmx/x86_ops.h +2 -2
@@ -21,7 +21,7 @@ void vmx_vm_destroy(struct kvm *kvm);int vmx_vcpu_precreate (struct kvm *kvm);int vmx_vcpu_create (struct kvm_vcpu *vcpu);int vmx_vcpu_pre_run (struct kvm_vcpu *vcpu); -fastpath_t vmx_vcpu_run (struct kvm_vcpu *vcpu,bool force_immediate_exit); +fastpath_t vmx_vcpu_run (struct kvm_vcpu *vcpu,u64 run_flags);void vmx_vcpu_free (struct kvm_vcpu *vcpu);void vmx_vcpu_reset (struct kvm_vcpu *vcpu,bool init_event);void vmx_vcpu_load (struct kvm_vcpu *vcpu,int cpu);
@@ -133,7 +133,7 @@ void tdx_vcpu_reset(struct kvm_vcpu *vcpvoid tdx_vcpu_free (struct kvm_vcpu *vcpu);void tdx_vcpu_load (struct kvm_vcpu *vcpu,int cpu);int tdx_vcpu_pre_run (struct kvm_vcpu *vcpu); -fastpath_t tdx_vcpu_run (struct kvm_vcpu *vcpu,bool force_immediate_exit); +fastpath_t tdx_vcpu_run (struct kvm_vcpu *vcpu,u64 run_flags);void tdx_prepare_switch_to_guest (struct kvm_vcpu *vcpu);void tdx_vcpu_put (struct kvm_vcpu *vcpu);bool tdx_protected_apic_has_interrupt (struct kvm_vcpu *vcpu);
arch/x86/kvm/x86.c +8 -3
@@ -10785,6 +10785,7 @@ static int vcpu_enter_guest(struct kvm_vdm_request_for_irq_injection (vcpu) &&kvm_cpu_accept_dm_intr (vcpu);fastpath_t exit_fastpath; +u64 run_flags;bool req_immediate_exit = false;
@@ -11029,8 +11030,11 @@ static int vcpu_enter_guest(struct kvm_v goto cancel_injection; } -if (req_immediate_exit) + run_flags =0 ; +if (req_immediate_exit) { + run_flags |=KVM_RUN_FORCE_IMMEDIATE_EXIT ;kvm_make_request (KVM_REQ_EVENT , vcpu); + }fpregs_assert_state_consistent ();if (test_thread_flag (TIF_NEED_FPU_LOAD ))
@@ -11067,8 +11071,7 @@ static int vcpu_enter_guest(struct kvm_vWARN_ON_ONCE ((kvm_vcpu_apicv_activated (vcpu) !=kvm_vcpu_apicv_active (vcpu)) && (kvm_get_apic_mode (vcpu) !=LAPIC_MODE_DISABLED )); - exit_fastpath =kvm_x86_call (vcpu_run)(vcpu, - req_immediate_exit); + exit_fastpath =kvm_x86_call (vcpu_run)(vcpu, run_flags);if (likely (exit_fastpath !=EXIT_FASTPATH_REENTER_GUEST ))break ;
@@ -11080,6 +11083,8 @@ static int vcpu_enter_guest(struct kvm_vbreak ; } + run_flags =0 ; +/* Note, VM-Exits that go down the "slow" path are accounted below. */ ++vcpu->stat.exits; }
Greg Kroah-Hartman
maintainerPATCH 605/627 KVM: x86: Drop kvm_x86_ops.set_dr6() in favor of a new KVM_RUN flag
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 80c64c7afea1da6a93ebe88d3d29d8a60377ef80 upstream.
Instruct vendor code to load the guest's DR6 into hardware via a new KVM_RUN flag, and remove kvm_x86_ops.set_dr6(), whose sole purpose was to load vcpu->arch.dr6 into hardware when DR6 can be read/written directly by the guest.
Note, TDX already WARNs on any run_flag being set, i.e. will yell if KVM thinks DR6 needs to be reloaded. TDX vCPUs force KVM_DEBUGREG_AUTO_SWITCH and never clear the flag, i.e. should never observe KVM_RUN_LOAD_GUEST_DR6.
--- arch/x86/include/asm/kvm-x86-ops.h | 1 - arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/svm/svm.c | 12 +++++++----- arch/x86/kvm/vmx/main.c | 9 --------- arch/x86/kvm/vmx/vmx.c | 9 +++------ arch/x86/kvm/x86.c | 2 +- 6 files changed, 12 insertions(+), 23 deletions(-)
arch/x86/include/asm/kvm-x86-ops.h +0 -1
@@ -49,7 +49,6 @@ KVM_X86_OP(set_idt) KVM_X86_OP(get_gdt) KVM_X86_OP(set_gdt) KVM_X86_OP(sync_dirty_debug_regs) -KVM_X86_OP(set_dr6) KVM_X86_OP(set_dr7) KVM_X86_OP(cache_reg) KVM_X86_OP(get_rflags)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -1682,6 +1682,7 @@ static inline u16 kvm_lapic_irq_dest_modenum kvm_x86_run_flags {KVM_RUN_FORCE_IMMEDIATE_EXIT =BIT (0 ), +KVM_RUN_LOAD_GUEST_DR6 =BIT (1 ), };struct kvm_x86_ops {
@@ -1734,7 +1735,6 @@ struct kvm_x86_ops {void (*get_gdt)(struct kvm_vcpu *vcpu,struct desc_ptr *dt);void (*set_gdt)(struct kvm_vcpu *vcpu,struct desc_ptr *dt);void (*sync_dirty_debug_regs)(struct kvm_vcpu *vcpu); -void (*set_dr6)(struct kvm_vcpu *vcpu,unsigned long value);void (*set_dr7)(struct kvm_vcpu *vcpu,unsigned long value);void (*cache_reg)(struct kvm_vcpu *vcpu,enum kvm_reg reg);unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
arch/x86/kvm/svm/svm.c +7 -5
@@ -4438,10 +4438,13 @@ static __no_kcsan fastpath_t svm_vcpu_rusvm_hv_update_vp_id (svm->vmcb, vcpu);/* -* Run with all-zero DR6 unless needed, so that we can get the exact cause -* of a #DB. -*/ -if (likely (!(vcpu->arch.switch_db_regs &KVM_DEBUGREG_WONT_EXIT ))) +* Run with all-zero DR6 unless the guest can write DR6 freely, so that +* KVM can get the exact cause of a #DB. Note, loading guest DR6 from +* KVM's snapshot is only necessary when DR accesses won't exit. +*/ +if (unlikely (run_flags &KVM_RUN_LOAD_GUEST_DR6 )) +svm_set_dr6 (vcpu, vcpu->arch.dr6); +else if (likely (!(vcpu->arch.switch_db_regs &KVM_DEBUGREG_WONT_EXIT )))svm_set_dr6 (vcpu,DR6_ACTIVE_LOW );clgi ();
@@ -5252,7 +5255,6 @@ static struct kvm_x86_ops svm_x86_ops __ .set_idt = svm_set_idt, .get_gdt = svm_get_gdt, .set_gdt = svm_set_gdt, - .set_dr6 = svm_set_dr6, .set_dr7 = svm_set_dr7, .sync_dirty_debug_regs = svm_sync_dirty_debug_regs, .cache_reg = svm_cache_reg,
arch/x86/kvm/vmx/main.c +0 -9
@@ -489,14 +489,6 @@ static void vt_set_gdt(struct kvm_vcpu *vmx_set_gdt (vcpu, dt); } -static void vt_set_dr6 (struct kvm_vcpu *vcpu,unsigned long val) -{ -if (is_td_vcpu (vcpu)) -return ; - -vmx_set_dr6 (vcpu, val); -} -static void vt_set_dr7 (struct kvm_vcpu *vcpu,unsigned long val) {if (is_td_vcpu (vcpu))
@@ -943,7 +935,6 @@ struct kvm_x86_ops vt_x86_ops __initdata .set_idt = vt_op(set_idt), .get_gdt = vt_op(get_gdt), .set_gdt = vt_op(set_gdt), - .set_dr6 = vt_op(set_dr6), .set_dr7 = vt_op(set_dr7), .sync_dirty_debug_regs = vt_op(sync_dirty_debug_regs), .cache_reg = vt_op(cache_reg),
arch/x86/kvm/vmx/vmx.c +3 -6
@@ -5606,12 +5606,6 @@ void vmx_sync_dirty_debug_regs(struct kvset_debugreg (DR6_RESERVED ,6 ); } -void vmx_set_dr6 (struct kvm_vcpu *vcpu,unsigned long val) -{ -lockdep_assert_irqs_disabled (); -set_debugreg (vcpu->arch.dr6,6 ); -} -void vmx_set_dr7 (struct kvm_vcpu *vcpu,unsigned long val) {vmcs_writel (GUEST_DR7 , val);
@@ -7370,6 +7364,9 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpuvmcs_writel (GUEST_RIP , vcpu->arch.regs[VCPU_REGS_RIP ]); vcpu->arch.regs_dirty =0 ; +if (run_flags &KVM_RUN_LOAD_GUEST_DR6 ) +set_debugreg (vcpu->arch.dr6,6 ); +/* * Refresh vmcs.HOST_CR3 if necessary. This must be done immediately * prior to VM-Enter, as the kernel may load a new ASID (PCID) any time
arch/x86/kvm/x86.c +1 -1
@@ -11052,7 +11052,7 @@ static int vcpu_enter_guest(struct kvm_vset_debugreg (vcpu->arch.eff_db[3 ],3 );/* When KVM_DEBUGREG_WONT_EXIT, dr6 is accessible in guest. */ if (unlikely (vcpu->arch.switch_db_regs &KVM_DEBUGREG_WONT_EXIT )) -kvm_x86_call (set_dr6)(vcpu, vcpu->arch.dr6); + run_flags |=KVM_RUN_LOAD_GUEST_DR6 ; }else if (unlikely (hw_breakpoint_active ())) {set_debugreg (DR7_FIXED_1 ,7 ); }
Greg Kroah-Hartman
maintainerPATCH 606/627 KVM: VMX: Allow guest to set DEBUGCTL.RTM_DEBUG if RTM is supported
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 17ec2f965344ee3fd6620bef7ef68792f4ac3af0 upstream.
Let the guest set DEBUGCTL.RTM_DEBUG if RTM is supported according to the guest CPUID model, as debug support is supposed to be available if RTM is supported, and there are no known downsides to letting the guest debug RTM aborts.
Note, there are no known bug reports related to RTM_DEBUG, the primary motivation is to reduce the probability of breaking existing guests when a future change adds a missing consistency check on vmcs12.GUEST_DEBUGCTL (KVM currently lets L2 run with whatever hardware supports; whoops).
Note #2, KVM already emulates DR6.RTM, and doesn't restrict access to DR7.RTM.
--- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kvm/vmx/vmx.c | 4 ++++ 2 files changed, 5 insertions(+)
arch/x86/include/asm/msr-index.h +1 -0
@@ -419,6 +419,7 @@#define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI (1UL << 12)#define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14#define DEBUGCTLMSR_FREEZE_IN_SMM (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT) +#define DEBUGCTLMSR_RTM_DEBUG BIT(15)#define MSR_PEBS_FRONTEND 0x000003f7
arch/x86/kvm/vmx/vmx.c +4 -0
@@ -2186,6 +2186,10 @@ static u64 vmx_get_supported_debugctl(st (host_initiated || intel_pmu_lbr_is_enabled(vcpu))) debugctl |=DEBUGCTLMSR_LBR |DEBUGCTLMSR_FREEZE_LBRS_ON_PMI ; +if (boot_cpu_has (X86_FEATURE_RTM ) && + (host_initiated ||guest_cpu_cap_has (vcpu,X86_FEATURE_RTM ))) + debugctl |=DEBUGCTLMSR_RTM_DEBUG ; +return debugctl; }
Greg Kroah-Hartman
maintainerPATCH 607/627 KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit c6e35dff58d348c1a9489e9b3b62b3721e62631d upstream.
Mark Brown reports that since we commit to making exceptions visible without the vcpu being loaded, the external abort selftest fails.
Upon investigation, it turns out that the code that makes registers affected by an exception visible to the guest is completely broken on VHE, as we don't check whether the system registers are loaded on the CPU at this point. We managed to get away with this so far, but that's obviously as bad as it gets,
Add the required checksm and document the absolute need to check for the SYSREGS_ON_CPU flag before calling into any of the __vcpu_write_sys_reg_to_cpu()__vcpu_read_sys_reg_from_cpu() helpers.
--- arch/arm64/include/asm/kvm_host.h | 4 ++++ arch/arm64/kvm/hyp/exception.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm64/include/asm/kvm_host.h +4 -0
@@ -1149,6 +1149,8 @@ static inline bool __vcpu_read_sys_reg_f* System registers listed in the switch are not saved on every * exit from the guest but are only saved on vcpu_put. * +* SYSREGS_ON_CPU *MUST* be checked before using this helper. +* * Note that MPIDR_EL1 for the guest is set by KVM via VMPIDR_EL2 but * should never be listed below, because the guest cannot modify its * own MPIDR_EL1 and MPIDR_EL1 is accessed for VCPU A from VCPU B's
@@ -1200,6 +1202,8 @@ static inline bool __vcpu_write_sys_reg_* System registers listed in the switch are not restored on every * entry to the guest but are only restored on vcpu_load. * +* SYSREGS_ON_CPU *MUST* be checked before using this helper. +* * Note that MPIDR_EL1 for the guest is set by KVM via VMPIDR_EL2 but * should never be listed below, because the MPIDR should only be set * once, before running the VCPU, and never changed later.
arch/arm64/kvm/hyp/exception.c +4 -2
@@ -26,7 +26,8 @@ static inline u64 __vcpu_read_sys_reg(coif (unlikely (vcpu_has_nv (vcpu)))return vcpu_read_sys_reg (vcpu, reg); -else if (__vcpu_read_sys_reg_from_cpu (reg, &val)) +else if (vcpu_get_flag (vcpu,SYSREGS_ON_CPU ) && +__vcpu_read_sys_reg_from_cpu (reg, &val))return val;return __vcpu_sys_reg (vcpu, reg);
@@ -36,7 +37,8 @@ static inline void __vcpu_write_sys_reg( {if (unlikely (vcpu_has_nv (vcpu)))vcpu_write_sys_reg (vcpu, val, reg); -else if (!__vcpu_write_sys_reg_to_cpu (val, reg)) +else if (!vcpu_get_flag (vcpu,SYSREGS_ON_CPU ) || + !__vcpu_write_sys_reg_to_cpu (val, reg))__vcpu_assign_sys_reg (vcpu, reg, val); }
Greg Kroah-Hartman
maintainerPATCH 608/627 KVM: arm64: Filter out HCR_EL2 bits when running in hypervisor context
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 303084ad12767db64c84ba8fcd0450aec38c8534 upstream.
Most HCR_EL2 bits are not supposed to affect EL2 at all, but only the guest. However, we gladly merge these bits with the host's HCR_EL2 configuration, irrespective of entering L1 or L2.
This leads to some funky behaviour, such as L1 trying to inject a virtual SError for L2, and getting a taste of its own medecine. Not quite what the architecture anticipated.
In the end, the only bits that matter are those we have defined as invariants, either because we've made them RESx (E2H, HCD...), or that we actively refuse to merge because the mess with KVM's own logic.
Use the sanitisation infrastructure to get the RES1 bits, and let things rip in a safer way.
--- arch/arm64/kvm/hyp/vhe/switch.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm64/kvm/hyp/vhe/switch.c +12 -2
@@ -48,8 +48,7 @@ DEFINE_PER_CPU(unsigned long, kvm_hyp_vestatic u64 __compute_hcr (struct kvm_vcpu *vcpu) { -u64 guest_hcr =__vcpu_sys_reg (vcpu,HCR_EL2 ); -u64 hcr = vcpu->arch.hcr_el2; +u64 guest_hcr, hcr = vcpu->arch.hcr_el2;if (!vcpu_has_nv (vcpu))return hcr;
@@ -68,10 +67,21 @@ static u64 __compute_hcr(struct kvm_vcpuif (!vcpu_el2_e2h_is_set (vcpu)) hcr |=HCR_NV1 ; +/* +* Nothing in HCR_EL2 should impact running in hypervisor +* context, apart from bits we have defined as RESx (E2H, +* HCD and co), or that cannot be set directly (the EXCLUDE +* bits). Given that we OR the guest's view with the host's, +* we can use the 0 value as the starting point, and only +* use the config-driven RES1 bits. +*/ + guest_hcr =kvm_vcpu_apply_reg_masks (vcpu,HCR_EL2 ,0 ); +write_sysreg_s (vcpu->arch.ctxt.vncr_array,SYS_VNCR_EL2 ); }else {host_data_clear_flag (VCPU_IN_HYP_CONTEXT ); + guest_hcr =__vcpu_sys_reg (vcpu,HCR_EL2 );if (guest_hcr &HCR_NV ) {u64 va =__fix_to_virt (vncr_fixmap (smp_processor_id ()));
Greg Kroah-Hartman
maintainerPATCH 609/627 zloop: fix KASAN use-after-free of tag set
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
commit 765761851d89c772f482494d452e266795460278 upstream.
When a zoned loop device, or zloop device, is removed, KASAN enabled kernel reports "BUG KASAN use-after-free" in blk_mq_free_tag_set(). The BUG happens because zloop_ctl_remove() calls put_disk(), which invokes zloop_free_disk(). The zloop_free_disk() frees the memory allocated for the zlo pointer. However, after the memory is freed, zloop_ctl_remove() calls blk_mq_free_tag_set(&zlo->tag_set), which accesses the freed zlo. Hence the KASAN use-after-free.
zloop_ctl_remove()
put_disk(zlo->disk)
put_device()
kobject_put()
...
zloop_free_disk()
kvfree(zlo) blk_mq_free_tag_set(&zlo->tag_set)
To avoid the BUG, move the call to blk_mq_free_tag_set(&zlo->tag_set) from zloop_ctl_remove() into zloop_free_disk(). This ensures that the tag_set is freed before the call to kvfree(zlo).
--- drivers/block/zloop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/zloop.c +2 -1
@@ -700,6 +700,8 @@ static void zloop_free_disk(struct gendisk *disk)struct zloop_device *zlo = disk->private_data;unsigned int i; +blk_mq_free_tag_set (&zlo->tag_set); +for (i =0 ; i < zlo->nr_zones; i++) {struct zloop_zone *zone = &zlo->zones[i];
@@ -1080,7 +1082,6 @@ static int zloop_ctl_remove(struct zloop_options *opts)del_gendisk (zlo->disk);put_disk (zlo->disk); -blk_mq_free_tag_set (&zlo->tag_set);pr_info ("Removed device %d\n" , opts->id);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 610/627 s390/mm: Remove possible false-positive warning in pte_free_defer()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit 5647f61ad9171e8f025558ed6dc5702c56a33ba3 upstream.
Commit 8211dad627981 ("s390: add pte_free_defer() for pgtables sharing page") added a warning to pte_free_defer(), on our request. It was meant to warn if this would ever be reached for KVM guest mappings, because the page table would be freed w/o a gmap_unlink(). THP mappings are not allowed for KVM guests on s390, so this should never happen.
However, it is possible that the warning is triggered in a valid case as false-positive.
s390_enable_sie() takes the mmap_lock, marks all VMAs as VM_NOHUGEPAGE and splits possibly existing THP guest mappings. mm->context.has_pgste is set to 1 before that, to prevent races with the mm_has_pgste() check in MADV_HUGEPAGE.
khugepaged drops the mmap_lock for file mappings and might run in parallel, before a vma is marked VM_NOHUGEPAGE, but after mm->context.has_pgste was set to 1. If it finds file mappings to collapse, it will eventually call pte_free_defer(). This will trigger the warning, but it is a valid case because gmap is not yet set up, and the THP mappings will be split again.
Therefore, remove the warning and the comment.
--- arch/s390/mm/pgalloc.c | 5 ----- 1 file changed, 5 deletions(-)
arch/s390/mm/pgalloc.c +0 -5
@@ -173,11 +173,6 @@ void pte_free_defer(struct mm_struct *mmstruct ptdesc *ptdesc =virt_to_ptdesc (pgtable); call_rcu(&ptdesc->pt_rcu_head, pte_free_now); -/* -* THPs are not allowed for KVM guests. Warn if pgste ever reaches here. -* Turn to the generic pte_free_defer() version once gmap is removed. -*/ - WARN_ON_ONCE(mm_has_pgste(mm)); }#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Greg Kroah-Hartman
maintainerPATCH 611/627 MIPS: mm: tlb-r4k: Uniquify TLB entries on init
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
commit 35ad7e181541aa5757f9f316768d3e64403ec843 upstream.
Hardware or bootloader will initialize TLB entries to any value, which may collide with kernel's UNIQUE_ENTRYHI value. On MIPS microAptiv/M5150 family of cores this will trigger machine check exception and cause boot failure. On M5150 simulation this could happen 7 times out of 1000 boots.
Replace local_flush_tlb_all() with r4k_tlb_uniquify() which probes each TLB ENTRIHI unique value for collisions before it's written, and in case of collision try a different ASID.
--- arch/mips/mm/tlb-r4k.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-)
arch/mips/mm/tlb-r4k.c +55 -1
@@ -508,6 +508,60 @@ static int __init set_ntlb(char *str)__setup ("ntlb=" , set_ntlb); +/* Initialise all TLB entries with unique values */ +static void r4k_tlb_uniquify (void ) +{ +int entry =num_wired_entries (); + +htw_stop (); +write_c0_entrylo0 (0 ); +write_c0_entrylo1 (0 ); + +while (entry < current_cpu_data.tlbsize) { +unsigned long asid_mask =cpu_asid_mask (¤t_cpu_data); +unsigned long asid =0 ; +int idx; + +/* Skip wired MMID to make ginvt_mmid work */ +if (cpu_has_mmid) + asid =MMID_KERNEL_WIRED +1 ; + +/* Check for match before using UNIQUE_ENTRYHI */ +do { +if (cpu_has_mmid) { +write_c0_memorymapid (asid); +write_c0_entryhi (UNIQUE_ENTRYHI (entry)); + }else { +write_c0_entryhi (UNIQUE_ENTRYHI (entry) | asid); + } +mtc0_tlbw_hazard (); +tlb_probe (); +tlb_probe_hazard (); + idx =read_c0_index (); +/* No match or match is on current entry */ +if (idx <0 || idx == entry) +break ; +/* +* If we hit a match, we need to try again with +* a different ASID. +*/ + asid++; + }while (asid < asid_mask); + +if (idx >=0 && idx != entry) +panic ("Unable to uniquify TLB entry %d" , idx); + +write_c0_index (entry); +mtc0_tlbw_hazard (); +tlb_write_indexed (); + entry++; + } + +tlbw_use_hazard (); +htw_start (); +flush_micro_tlb (); +} +/* * Configure TLB (for init or after a CPU has been powered off). */
@@ -547,7 +601,7 @@ static void r4k_tlb_configure(void) temp_tlb_entry = current_cpu_data.tlbsize -1 ;/* From this point on the ARC firmware is dead. */ -local_flush_tlb_all (); +r4k_tlb_uniquify ();/* Did I tell you that ARC SUCKS? */ }
Greg Kroah-Hartman
maintainerPATCH 612/627 mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 188cb385bbf04d486df3e52f28c47b3961f5f0c0 upstream.
When pmd_to_hmm_pfn_flags() is unused, it prevents kernel builds with clang, make W=1 and CONFIG_TRANSPARENT_HUGEPAGE=n:
mm/hmm.c:186:29: warning: unused function 'pmd_to_hmm_pfn_flags' [-Wunused-function]
Fix this by moving the function to the respective existing ifdeffery for its the only user.
See also:
6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")
--- mm/hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hmm.c +1 -1
@@ -183,6 +183,7 @@ static inline unsigned long hmm_pfn_flagreturn order <<HMM_PFN_ORDER_SHIFT ; } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE static inline unsigned long pmd_to_hmm_pfn_flags (struct hmm_range *range,pmd_t pmd) {
@@ -193,7 +194,6 @@ static inline unsigned long pmd_to_hmm_phmm_pfn_flags_order (PMD_SHIFT -PAGE_SHIFT ); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE static int hmm_vma_handle_pmd (struct mm_walk *walk,unsigned long addr,unsigned long end,unsigned long hmm_pfns[],pmd_t pmd)
Greg Kroah-Hartman
maintainerPATCH 613/627 mm: swap: correctly use maxpages in swapon syscall to avoid potential deadloop
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
commit 255116c5b0fa2145ede28c2f7b248df5e73834d1 upstream.
We use maxpages from read_swap_header() to initialize swap_info_struct, however the maxpages might be reduced in setup_swap_extents() and the si->max is assigned with the reduced maxpages from the setup_swap_extents().
Obviously, this could lead to memory waste as we allocated memory based on larger maxpages, besides, this could lead to a potential deadloop as following:
1) When calling setup_clusters() with larger maxpages, unavailable pages within range [si->max, larger maxpages) are not accounted with inc_cluster_info_page(). As a result, these pages are assumed available but can not be allocated. The cluster contains these pages can be moved to frag_clusters list after it's all available pages were allocated.
2) When the cluster mentioned in 1) is the only cluster in frag_clusters list, cluster_alloc_swap_entry() assume order 0 allocation will never failed and will enter a deadloop by keep trying to allocate page from the only cluster in frag_clusters which contains no actually available page.
Call setup_swap_extents() to get the final maxpages before swap_info_struct initialization to fix the issue.
After this change, span will include badblocks and will become large value which I think is correct value:
In summary, there are two kinds of swapfile_activate operations.
1. Filesystem style: Treat all blocks logical continuity and find usable physical extents in logical range. In this way, si->pages will be actual usable physical blocks and span will be "1 + highest_block - lowest_block".
2. Block device style: Treat all blocks physically continue and only one single extent is added. In this way, si->pages will be si->max and span will be "si->pages - 1". Actually, si->pages and si->max is only used in block device style and span value is set with si->pages. As a result, span value in block device style will become a larger value as you mentioned.
I think larger value is correct based on:
1. Span value in filesystem style is "1 + highest_block - lowest_block" which is the range cover all possible phisical blocks including the badblocks.
2. For block device style, si->pages is the actual usable block number and is already in pr_info. The original span value before this patch is also refer to usable block number which is redundant in pr_info.
--- mm/swapfile.c | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-)
mm/swapfile.c +26 -27
@@ -3141,43 +3141,30 @@ static unsigned long read_swap_header(streturn maxpages; } -static int setup_swap_map_and_extents (struct swap_info_struct *si, -union swap_header *swap_header, -unsigned char *swap_map, -unsigned long maxpages, -sector_t *span) +static int setup_swap_map (struct swap_info_struct *si, +union swap_header *swap_header, +unsigned char *swap_map, +unsigned long maxpages) { -unsigned int nr_good_pages;unsigned long i; -int nr_extents; - - nr_good_pages = maxpages -1 ;/* omit header page */ + swap_map[0 ] =SWAP_MAP_BAD ;/* omit header page */ for (i =0 ; i < swap_header->info.nr_badpages; i++) {unsigned int page_nr = swap_header->info.badpages[i];if (page_nr ==0 || page_nr > swap_header->info.last_page)return -EINVAL ;if (page_nr < maxpages) { swap_map[page_nr] =SWAP_MAP_BAD ; - nr_good_pages--; + si->pages--; } } -if (nr_good_pages) { - swap_map[0 ] =SWAP_MAP_BAD ; - si->max = maxpages; - si->pages = nr_good_pages; - nr_extents =setup_swap_extents (si, span); -if (nr_extents <0 ) -return nr_extents; - nr_good_pages = si->pages; - } -if (!nr_good_pages) { +if (!si->pages) {pr_warn ("Empty swap-file\n" );return -EINVAL ; } -return nr_extents; +return 0 ; }#define SWAP_CLUSTER_INFO_COLS \
@@ -3217,7 +3204,7 @@ static struct swap_cluster_info *setup_c* Mark unusable pages as unavailable. The clusters aren't * marked free yet, so no list operations are involved yet. * -* See setup_swap_map_and_extents(): header page, bad pages, +* See setup_swap_map(): header page, bad pages, * and the EOF part of the last cluster. */ inc_cluster_info_page (si, cluster_info,0 );
@@ -3363,6 +3350,21 @@ SYSCALL_DEFINE2(swapon, const char __use goto bad_swap_unlock_inode; } + si->max = maxpages; + si->pages = maxpages -1 ; + nr_extents =setup_swap_extents (si, &span); +if (nr_extents <0 ) { + error = nr_extents; + goto bad_swap_unlock_inode; + } +if (si->pages != si->max -1 ) { +pr_err ("swap:%u != (max:%u - 1)\n" , si->pages, si->max); + error = -EINVAL ; + goto bad_swap_unlock_inode; + } + + maxpages = si->max; +/* OK, set up the swap map and apply the bad block list */ swap_map =vzalloc (maxpages);if (!swap_map) {
@@ -3374,12 +3376,9 @@ SYSCALL_DEFINE2(swapon, const char __useif (error) goto bad_swap_unlock_inode; - nr_extents =setup_swap_map_and_extents (si, swap_header, swap_map, - maxpages, &span); -if (unlikely (nr_extents <0 )) { - error = nr_extents; + error =setup_swap_map (si, swap_header, swap_map, maxpages); +if (error) goto bad_swap_unlock_inode; - }/* * Use kvmalloc_array instead of bitmap_zalloc as the allocation order might
Greg Kroah-Hartman
maintainerPATCH 614/627 mm: swap: fix potential buffer overflow in setup_clusters()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
commit 152c1339dc13ad46f1b136e8693de15980750835 upstream.
In setup_swap_map(), we only ensure badpages are in range (0, last_page]. As maxpages might be < last_page, setup_clusters() will encounter a buffer overflow when a badpage is >= maxpages.
Only call inc_cluster_info_page() for badpage which is < maxpages to fix the issue.
--- mm/swapfile.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/swapfile.c +7 -3
@@ -3208,9 +3208,13 @@ static struct swap_cluster_info *setup_c* and the EOF part of the last cluster. */ inc_cluster_info_page (si, cluster_info,0 ); -for (i =0 ; i < swap_header->info.nr_badpages; i++) -inc_cluster_info_page (si, cluster_info, - swap_header->info.badpages[i]); +for (i =0 ; i < swap_header->info.nr_badpages; i++) { +unsigned int page_nr = swap_header->info.badpages[i]; + +if (page_nr >= maxpages) +continue ; +inc_cluster_info_page (si, cluster_info, page_nr); + }for (i = maxpages; i <round_up (maxpages,SWAPFILE_CLUSTER ); i++)inc_cluster_info_page (si, cluster_info, i);
Greg Kroah-Hartman
maintainerPATCH 615/627 mm: swap: move nr_swap_pages counter decrement from folio_alloc_swap() to swap_range_alloc()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
commit 4f78252da887ee7e9d1875dd6e07d9baa936c04f upstream.
Patch series "Some randome fixes and cleanups to swapfile".
Patch 0-3 are some random fixes. Patch 4 is a cleanup. More details can be found in respective patches.
This patch (of 4):
When folio_alloc_swap() encounters a failure in either mem_cgroup_try_charge_swap() or add_to_swap_cache(), nr_swap_pages counter is not decremented for allocated entry. However, the following put_swap_folio() will increase nr_swap_pages counter unpairly and lead to an imbalance.
Move nr_swap_pages decrement from folio_alloc_swap() to swap_range_alloc() to pair the nr_swap_pages counting.
--- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
@@ -1115,6 +1115,7 @@ static void swap_range_alloc(struct swapif (vm_swap_full ())schedule_work (&si->reclaim_work); } +atomic_long_sub (nr_entries, &nr_swap_pages); } static void swap_range_free(struct swap_info_struct *si, unsigned long offset,
@@ -1313,7 +1314,6 @@ int folio_alloc_swap(struct folio *folioif (add_to_swap_cache (folio, entry, gfp | __GFP_NOMEMALLOC,NULL )) goto out_free; -atomic_long_sub (size, &nr_swap_pages);return 0 ; out_free:
Greg Kroah-Hartman
maintainerPATCH 616/627 mm: shmem: fix the shmem large folio allocation for the i915 driver
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baolin Wang <[email protected]>
commit 8d58d65621118fdca3ed6a0b3d658ba7e0e5153c upstream.
After commit acd7ccb284b8 ("mm: shmem: add large folio support for tmpfs"), we extend the 'huge=' option to allow any sized large folios for tmpfs, which means tmpfs will allow getting a highest order hint based on the size of write() and fallocate() paths, and then will try each allowable large order.
However, when the i915 driver allocates shmem memory, it doesn't provide hint information about the size of the large folio to be allocated, resulting in the inability to allocate PMD-sized shmem, which in turn affects GPU performance.
Patryk added:
: In my tests, the performance drop ranges from a few percent up to 13% : in Unigine Superposition under heavy memory usage on the CPU Core Ultra : 155H with the Xe 128 EU GPU. Other users have reported performance : impact up to 30% on certain workloads. Please find more in the : regressions reports:
: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14645
: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13845
:
: I believe the change should be backported to all active kernel branches : after version 6.12.
To fix this issue, we can use the inode's size as a write size hint in shmem_read_folio_gfp() to help allocate PMD-sized large folios.
--- mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/shmem.c +2 -2
@@ -5928,8 +5928,8 @@ struct folio *shmem_read_folio_gfp(strucstruct folio *folio;int error; - error =shmem_get_folio_gfp (inode, index,0 , &folio,SGP_CACHE , - gfp,NULL ,NULL ); + error =shmem_get_folio_gfp (inode, index,i_size_read (inode), + &folio,SGP_CACHE , gfp,NULL ,NULL );if (error)return ERR_PTR (error);
Greg Kroah-Hartman
maintainerPATCH 617/627 usb: gadget: uvc: Initialize frame-based format color matching descriptor
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akash Kumar <[email protected]>
commit 323a80a1a5ace319a722909c006d5bdb2a35d273 upstream.
Fix NULL pointer crash in uvcg_framebased_make due to uninitialized color matching descriptor for frame-based format which was added in commit f5e7bdd34aca ("usb: gadget: uvc: Allow creating new color matching descriptors") that added handling for uncompressed and mjpeg format.
Crash is seen when userspace configuration (via configfs) does not explicitly define the color matching descriptor. If color_matching is not found, config_group_find_item() returns NULL. The code then jumps to out_put_cm, where it calls config_item_put(color_matching);. If color_matching is NULL, this will dereference a null pointer, leading to a crash.
[ 2.746440] Unable to handle kernel NULL pointer dereference at virtual address 000000000000008c [ 2.756273] Mem abort info: [ 2.760080] ESR = 0x0000000096000005 [ 2.764872] EC = 0x25: DABT (current EL), IL = 32 bits [ 2.771068] SET = 0, FnV = 0 [ 2.771069] EA = 0, S1PTW = 0 [ 2.771070] FSC = 0x05: level 1 translation fault [ 2.771071] Data abort info: [ 2.771072] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 [ 2.771073] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 2.771074] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 2.771075] user pgtable: 4k pages, 39-bit VAs, pgdp=00000000a3e59000 [ 2.771077] [000000000000008c] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 [ 2.771081] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP [ 2.771084] Dumping ftrace buffer: [ 2.771085] (ftrace buffer empty) [ 2.771138] CPU: 7 PID: 486 Comm: ln Tainted: G W E 6.6.58-android15 [ 2.771139] Hardware name: Qualcomm Technologies, Inc. SunP QRD HDK (DT) [ 2.771140] pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 2.771141] pc : __uvcg_fill_strm+0x198/0x2cc [ 2.771145] lr : __uvcg_iter_strm_cls+0xc8/0x17c [ 2.771146] sp : ffffffc08140bbb0 [ 2.771146] x29: ffffffc08140bbb0 x28: ffffff803bc81380 x27: ffffff8023bbd250 [ 2.771147] x26: ffffff8023bbd250 x25: ffffff803c361348 x24: ffffff803d8e6768 [ 2.771148] x23: 0000000000000004 x22: 0000000000000003 x21: ffffffc08140bc48 [ 2.771149] x20: 0000000000000000 x19: ffffffc08140bc48 x18: ffffffe9f8cf4a00 [ 2.771150] x17: 000000001bf64ec3 x16: 000000001bf64ec3 x15: ffffff8023bbd250 [ 2.771151] x14: 000000000000000f x13: 004c4b40000f4240 x12: 000a2c2a00051615 [ 2.771152] x11: 000000000000004f x10: ffffffe9f76b40ec x9 : ffffffe9f7e389d0 [ 2.771153] x8 : ffffff803d0d31ce x7 : 000f4240000a2c2a x6 : 0005161500028b0a [ 2.771154] x5 : ffffff803d0d31ce x4 : 0000000000000003 x3 : 0000000000000000 [ 2.771155] x2 : ffffffc08140bc50 x1 : ffffffc08140bc48 x0 : 0000000000000000 [ 2.771156] Call trace: [ 2.771157] __uvcg_fill_strm+0x198/0x2cc [ 2.771157] __uvcg_iter_strm_cls+0xc8/0x17c [ 2.771158] uvcg_streaming_class_allow_link+0x240/0x290 [ 2.771159] configfs_symlink+0x1f8/0x630 [ 2.771161] vfs_symlink+0x114/0x1a0 [ 2.771163] do_symlinkat+0x94/0x28c [ 2.771164] __arm64_sys_symlinkat+0x54/0x70 [ 2.771164] invoke_syscall+0x58/0x114 [ 2.771166] el0_svc_common+0x80/0xe0 [ 2.771168] do_el0_svc+0x1c/0x28 [ 2.771169] el0_svc+0x3c/0x70 [ 2.771172] el0t_64_sync_handler+0x68/0xbc [ 2.771173] el0t_64_sync+0x1a8/0x1ac
Initialize color matching descriptor for frame-based format to prevent NULL pointer crash by mirroring the handling done for uncompressed and mjpeg formats.
--- drivers/usb/gadget/function/uvc_configfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/usb/gadget/function/uvc_configfs.c +10 -0
@@ -2916,8 +2916,15 @@ static struct config_group *uvcg_frameba'H' ,'2' ,'6' ,'4' ,0x00 ,0x00 ,0x10 ,0x00 ,0x80 ,0x00 ,0x00 ,0xaa ,0x00 ,0x38 ,0x9b ,0x71 }; +struct uvcg_color_matching *color_match; +struct config_item *streaming;struct uvcg_framebased *h; + streaming = group->cg_item.ci_parent; + color_match =uvcg_format_get_default_color_match (streaming); +if (!color_match) +return ERR_PTR (-EINVAL ); + h =kzalloc (sizeof (*h),GFP_KERNEL );if (!h)return ERR_PTR (-ENOMEM );
@@ -2936,6 +2943,9 @@ static struct config_group *uvcg_framebaINIT_LIST_HEAD (&h->fmt.frames); h->fmt.type =UVCG_FRAMEBASED ; + + h->fmt.color_matching = color_match; + color_match->refcnt++;config_group_init_type_name (&h->fmt.group, name, &uvcg_framebased_type);
Greg Kroah-Hartman
maintainerPATCH 618/627 perf/arm-ni: Set initial IRQ affinity
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit c872d7c837382517c51a76dfdcf550332cfab231 upstream.
While we do request our IRQs with the right flags to stop their affinity changing unexpectedly, we forgot to actually set it to start with. Oops.
--- drivers/perf/arm-ni.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/perf/arm-ni.c +2 -0
@@ -544,6 +544,8 @@ static int arm_ni_init_cd(struct arm_nireturn err; cd->cpu =cpumask_local_spread (0 ,dev_to_node (ni->dev)); +irq_set_affinity (cd->irq,cpumask_of (cd->cpu)); + cd->pmu = (struct pmu ) { .module =THIS_MODULE , .parent = ni->dev,
Greg Kroah-Hartman
maintainerPATCH 619/627 media: ti: j721e-csi2rx: fix list_del corruption
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julien Massot <[email protected]>
commit ae42c6fe531425ef2f47e82f96851427d24bbf6b upstream.
If ti_csi2rx_start_dma() fails in ti_csi2rx_dma_callback(), the buffer is marked done with VB2_BUF_STATE_ERROR but is not removed from the DMA queue. This causes the same buffer to be retried in the next iteration, resulting in a double list_del() and eventual list corruption.
Fix this by removing the buffer from the queue before calling vb2_buffer_done() on error.
This resolves a crash due to list_del corruption:
[ 37.811243] j721e-csi2rx 30102000.ticsi2rx: Failed to queue the next buffer for DMA [ 37.832187] slab kmalloc-2k start ffff00000255b000 pointer offset 1064 size 2048 [ 37.839761] list_del corruption. next->prev should be ffff00000255bc28, but was ffff00000255d428. (next=ffff00000255b428) [ 37.850799] ------------[ cut here ]------------ [ 37.855424] kernel BUG at lib/list_debug.c:65! [ 37.859876] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 37.866061] Modules linked in: i2c_dev usb_f_rndis u_ether libcomposite dwc3 udc_core usb_common aes_ce_blk aes_ce_cipher ghash_ce gf128mul sha1_ce cpufreq_dt dwc3_am62 phy_gmii_sel sa2ul [ 37.882830] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.16.0-rc3+ #28 VOLUNTARY [ 37.890851] Hardware name: Bosch STLA-GSRV2-B0 (DT) [ 37.895737] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 37.902703] pc : __list_del_entry_valid_or_report+0xdc/0x114 [ 37.908390] lr : __list_del_entry_valid_or_report+0xdc/0x114 [ 37.914059] sp : ffff800080003db0 [ 37.917375] x29: ffff800080003db0 x28: 0000000000000007 x27: ffff800080e50000 [ 37.924521] x26: 0000000000000000 x25: ffff0000016abb50 x24: dead000000000122 [ 37.931666] x23: ffff0000016abb78 x22: ffff0000016ab080 x21: ffff800080003de0 [ 37.938810] x20: ffff00000255bc00 x19: ffff00000255b800 x18: 000000000000000a [ 37.945956] x17: 20747562202c3832 x16: 6362353532303030 x15: 0720072007200720 [ 37.953101] x14: 0720072007200720 x13: 0720072007200720 x12: 00000000ffffffea [ 37.960248] x11: ffff800080003b18 x10: 00000000ffffefff x9 : ffff800080f5b568 [ 37.967396] x8 : ffff800080f5b5c0 x7 : 0000000000017fe8 x6 : c0000000ffffefff [ 37.974542] x5 : ffff00000fea6688 x4 : 0000000000000000 x3 : 0000000000000000 [ 37.981686] x2 : 0000000000000000 x1 : ffff800080ef2b40 x0 : 000000000000006d [ 37.988832] Call trace: [ 37.991281] __list_del_entry_valid_or_report+0xdc/0x114 (P) [ 37.996959] ti_csi2rx_dma_callback+0x84/0x1c4 [ 38.001419] udma_vchan_complete+0x1e0/0x344 [ 38.005705] tasklet_action_common+0x118/0x310 [ 38.010163] tasklet_action+0x30/0x3c [ 38.013832] handle_softirqs+0x10c/0x2e0 [ 38.017761] __do_softirq+0x14/0x20 [ 38.021256] ____do_softirq+0x10/0x20 [ 38.024931] call_on_irq_stack+0x24/0x60 [ 38.028873] do_softirq_own_stack+0x1c/0x40 [ 38.033064] __irq_exit_rcu+0x130/0x15c [ 38.036909] irq_exit_rcu+0x10/0x20 [ 38.040403] el1_interrupt+0x38/0x60 [ 38.043987] el1h_64_irq_handler+0x18/0x24 [ 38.048091] el1h_64_irq+0x6c/0x70 [ 38.051501] default_idle_call+0x34/0xe0 (P) [ 38.055783] do_idle+0x1f8/0x250 [ 38.059021] cpu_startup_entry+0x34/0x3c [ 38.062951] rest_init+0xb4/0xc0 [ 38.066186] console_on_rootfs+0x0/0x6c [ 38.070031] __primary_switched+0x88/0x90 [ 38.074059] Code: b00037e0 91378000 f9400462 97e9bf49 (d4210000) [ 38.080168] ---[ end trace 0000000000000000 ]--- [ 38.084795] Kernel panic - not syncing: Oops - BUG: Fatal exception in interrupt [ 38.092197] SMP: stopping secondary CPUs [ 38.096139] Kernel Offset: disabled [ 38.099631] CPU features: 0x0000,00002000,02000801,0400420b [ 38.105202] Memory Limit: none [ 38.108260] ---[ end Kernel panic - not syncing: Oops - BUG: Fatal exception in interrupt ]---
--- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +1 -0
@@ -619,6 +619,7 @@ static void ti_csi2rx_dma_callback(voidif (ti_csi2rx_start_dma (csi, buf)) {dev_err (csi->dev,"Failed to queue the next buffer for DMA\n" ); +list_del (&buf->list);vb2_buffer_done (&buf->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }else {list_move_tail (&buf->list, &dma->submitted);
Greg Kroah-Hartman
maintainerPATCH 620/627 HID: apple: validate feature-report field count to prevent NULL pointer dereference
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
commit 1bb3363da862e0464ec050eea2fb5472a36ad86b upstream.
A malicious HID device with quirk APPLE_MAGIC_BACKLIGHT can trigger a NULL pointer dereference whilst the power feature-report is toggled and sent to the device in apple_magic_backlight_report_set(). The power feature-report is expected to have two data fields, but if the descriptor declares one field then accessing field[1] and dereferencing it in apple_magic_backlight_report_set() becomes invalid
since field[1] will be NULL.
An example of a minimal descriptor which can cause the crash is something like the following where the report with ID 3 (power report) only references a single 1-byte field. When hid core parses the descriptor it will encounter the final feature tag, allocate a hid_report (all members of field[] will be zeroed out), create field structure and populate it, increasing the maxfield to 1. The subsequent field[1] access and dereference causes the crash.
Usage Page (Vendor Defined 0xFF00)
Usage (0x0F)
Collection (Application)
Report ID (1)
Usage (0x01)
Logical Minimum (0)
Logical Maximum (255)
Report Size (8)
Report Count (1)
Feature (Data,Var,Abs)
Usage (0x02)
Logical Maximum (32767)
Report Size (16)
Report Count (1)
Feature (Data,Var,Abs)
Report ID (3)
Usage (0x03)
Logical Minimum (0)
Logical Maximum (1)
Report Size (8)
Report Count (1)
Feature (Data,Var,Abs)
End Collection
Here we see the KASAN splat when the kernel dereferences the NULL pointer and crashes:
[ 15.164723] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] SMP KASAN NOPTI [ 15.165691] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] [ 15.165691] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.15.0 #31 PREEMPT(voluntary) [ 15.165691] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 15.165691] RIP: 0010:apple_magic_backlight_report_set+0xbf/0x210 [ 15.165691] Call Trace: [ 15.165691] <TASK> [ 15.165691] apple_probe+0x571/0xa20 [ 15.165691] hid_device_probe+0x2e2/0x6f0 [ 15.165691] really_probe+0x1ca/0x5c0 [ 15.165691] __driver_probe_device+0x24f/0x310 [ 15.165691] driver_probe_device+0x4a/0xd0 [ 15.165691] __device_attach_driver+0x169/0x220 [ 15.165691] bus_for_each_drv+0x118/0x1b0 [ 15.165691] __device_attach+0x1d5/0x380 [ 15.165691] device_initial_probe+0x12/0x20 [ 15.165691] bus_probe_device+0x13d/0x180 [ 15.165691] device_add+0xd87/0x1510 [...]
To fix this issue we should validate the number of fields that the backlight and power reports have and if they do not have the required number of fields then bail.
--- drivers/hid/hid-apple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-apple.c +2 -1
@@ -890,7 +890,8 @@ static int apple_magic_backlight_init(st backlight->brightness = report_enum->report_id_hash[APPLE_MAGIC_REPORT_ID_BRIGHTNESS ]; backlight->power = report_enum->report_id_hash[APPLE_MAGIC_REPORT_ID_POWER ]; -if (!backlight->brightness || !backlight->power) +if (!backlight->brightness || backlight->brightness->maxfield <2 || + !backlight->power || backlight->power->maxfield <2 )return -ENODEV ; backlight->cdev.name =":white:" LED_FUNCTION_KBD_BACKLIGHT ;
Greg Kroah-Hartman
maintainerPATCH 621/627 USB: gadget: f_hid: Fix memory leak in hidg_bind error path
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuhao Jiang <[email protected]>
commit 62783c30d78aecf9810dae46fd4d11420ad38b74 upstream.
In hidg_bind(), if alloc_workqueue() fails after usb_assign_descriptors() has successfully allocated the USB descriptors, the current error handling does not call usb_free_all_descriptors() to free the allocated descriptors, resulting in a memory leak.
Restructure the error handling by adding proper cleanup labels:
- fail_free_all: cleans up workqueue and descriptors
- fail_free_descs: cleans up descriptors only
- fail: original cleanup for earlier failures
This ensures that allocated resources are properly freed in reverse order of their allocation, preventing the memory leak when alloc_workqueue() fails.
--- drivers/usb/gadget/function/f_hid.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_hid.c +4 -3
@@ -1278,18 +1278,19 @@ static int hidg_bind(struct usb_configurif (!hidg->workqueue) { status = -ENOMEM ; - goto fail; + goto fail_free_descs; }/* create char device */ cdev_init (&hidg->cdev, &f_hidg_fops); status =cdev_device_add (&hidg->cdev, &hidg->dev);if (status) - goto fail_free_descs; + goto fail_free_all;return 0 ; -fail_free_descs: +fail_free_all:destroy_workqueue (hidg->workqueue); +fail_free_descs:usb_free_all_descriptors (f); fail:ERROR (f->config->cdev,"hidg_bind FAILED\n" );
Greg Kroah-Hartman
maintainerPATCH 622/627 HID: core: Harden s32ton() against conversion to 0 bits
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit a6b87bfc2ab5bccb7ad953693c85d9062aef3fdd upstream.
Testing by the syzbot fuzzer showed that the HID core gets a shift-out-of-bounds exception when it tries to convert a 32-bit quantity to a 0-bit quantity. Ideally this should never occur, but there are buggy devices and some might have a report field with size set to zero; we shouldn't reject the report or the device just because of that.
Instead, harden the s32ton() routine so that it returns a reasonable result instead of crashing when it is called with the number of bits set to 0 -- the same as what snto32() does.
--- drivers/hid/hid-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hid/hid-core.c +5 -1
@@ -66,8 +66,12 @@ static s32 snto32(__u32 value, unsignedstatic u32 s32ton (__s32 value,unsigned int n) { -s32 a = value >> (n -1 ); +s32 a; +if (!value || !n) +return 0 ; + + a = value >> (n -1 );if (a && a !=-1 )return value <0 ?1 << (n -1 ) : (1 << (n -1 )) -1 ;return value & ((1 << n) -1 );
Greg Kroah-Hartman
maintainerPATCH 623/627 HID: magicmouse: avoid setting up battery timer when not needed
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Garg <[email protected]>
commit 9bdc30e35cbc1aa78ccf01040354209f1e11ca22 upstream.
Currently, the battery timer is set up for all devices using hid-magicmouse, irrespective of whether they actually need it or not.
The current implementation requires the battery timer for Magic Mouse 2 and Magic Trackpad 2 when connected via USB only. Add checks to ensure that the battery timer is only set up when they are connected via USB.
--- drivers/hid/hid-magicmouse.c | 62 +++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 23 deletions(-)
drivers/hid/hid-magicmouse.c +39 -23
@@ -791,17 +791,31 @@ static void magicmouse_enable_mt_work(sthid_err (msc->hdev,"unable to request touch data (%d)\n" , ret); } +static bool is_usb_magicmouse2 (__u32 vendor,__u32 product) +{ +if (vendor !=USB_VENDOR_ID_APPLE ) +return false; +return product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2_USBC ; +} + +static bool is_usb_magictrackpad2 (__u32 vendor,__u32 product) +{ +if (vendor !=USB_VENDOR_ID_APPLE ) +return false; +return product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || + product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC ; +} +static int magicmouse_fetch_battery (struct hid_device *hdev) {#ifdef CONFIG_HID_BATTERY_STRENGTH struct hid_report_enum *report_enum;struct hid_report *report; -if (!hdev->battery || hdev->vendor !=USB_VENDOR_ID_APPLE || - (hdev->product !=USB_DEVICE_ID_APPLE_MAGICMOUSE2 && - hdev->product !=USB_DEVICE_ID_APPLE_MAGICMOUSE2_USBC && - hdev->product !=USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && - hdev->product !=USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC )) +if (!hdev->battery || + (!is_usb_magicmouse2 (hdev->vendor, hdev->product) && + !is_usb_magictrackpad2 (hdev->vendor, hdev->product)))return -1 ; report_enum = &hdev->report_enum[hdev->battery_report_type];
@@ -863,17 +877,17 @@ static int magicmouse_probe(struct hid_dreturn ret; } -timer_setup (&msc->battery_timer, magicmouse_battery_timer_tick,0 ); -mod_timer (&msc->battery_timer, - jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); -magicmouse_fetch_battery (hdev); - -if (id->vendor ==USB_VENDOR_ID_APPLE && - (id->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || - id->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2_USBC || - ((id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || - id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC ) && - hdev->type !=HID_TYPE_USBMOUSE ))) +if (is_usb_magicmouse2 (id->vendor, id->product) || +is_usb_magictrackpad2 (id->vendor, id->product)) { +timer_setup (&msc->battery_timer, magicmouse_battery_timer_tick,0 ); +mod_timer (&msc->battery_timer, + jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); +magicmouse_fetch_battery (hdev); + } + +if (is_usb_magicmouse2 (id->vendor, id->product) || + (is_usb_magictrackpad2 (id->vendor, id->product) && + hdev->type !=HID_TYPE_USBMOUSE ))return 0 ;if (!msc->input) {
@@ -936,7 +950,10 @@ static int magicmouse_probe(struct hid_dreturn 0 ; err_stop_hw: -timer_delete_sync (&msc->battery_timer); +if (is_usb_magicmouse2 (id->vendor, id->product) || +is_usb_magictrackpad2 (id->vendor, id->product)) +timer_delete_sync (&msc->battery_timer); +hid_hw_stop (hdev);return ret; }
@@ -947,7 +964,9 @@ static void magicmouse_remove(struct hidif (msc) {cancel_delayed_work_sync (&msc->work); -timer_delete_sync (&msc->battery_timer); +if (is_usb_magicmouse2 (hdev->vendor, hdev->product) || +is_usb_magictrackpad2 (hdev->vendor, hdev->product)) +timer_delete_sync (&msc->battery_timer); }hid_hw_stop (hdev);
@@ -964,11 +983,8 @@ static const __u8 *magicmouse_report_fix* 0x05, 0x01, // Usage Page (Generic Desktop) 0 * 0x09, 0x02, // Usage (Mouse) 2 */ -if (hdev->vendor ==USB_VENDOR_ID_APPLE && - (hdev->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || - hdev->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2_USBC || - hdev->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 || - hdev->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC ) && +if ((is_usb_magicmouse2 (hdev->vendor, hdev->product) || +is_usb_magictrackpad2 (hdev->vendor, hdev->product)) && *rsize ==83 && rdesc[46 ] ==0x84 && rdesc[58 ] ==0x85 ) {hid_info (hdev,"fixing up magicmouse battery report descriptor\n" );
Greg Kroah-Hartman
maintainerPATCH 624/627 HID: apple: avoid setting up battery timer for devices without battery
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Garg <[email protected]>
commit c061046fe9ce3ff31fb9a807144a2630ad349c17 upstream.
Currently, the battery timer is set up for all devices using hid-apple, irrespective of whether they actually have a battery or not.
APPLE_RDESC_BATTERY is a quirk that indicates the device has a battery and needs the battery timer. This patch checks for this quirk before setting up the timer, ensuring that only devices with a battery will have the timer set up.
--- drivers/hid/hid-apple.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/hid/hid-apple.c +11 -6
@@ -934,10 +934,12 @@ static int apple_probe(struct hid_devicereturn ret; } -timer_setup (&asc->battery_timer, apple_battery_timer_tick,0 ); -mod_timer (&asc->battery_timer, - jiffies +msecs_to_jiffies (APPLE_BATTERY_TIMEOUT_MS )); -apple_fetch_battery (hdev); +if (quirks &APPLE_RDESC_BATTERY ) { +timer_setup (&asc->battery_timer, apple_battery_timer_tick,0 ); +mod_timer (&asc->battery_timer, + jiffies +msecs_to_jiffies (APPLE_BATTERY_TIMEOUT_MS )); +apple_fetch_battery (hdev); + }if (quirks &APPLE_BACKLIGHT_CTL )apple_backlight_init (hdev);
@@ -951,7 +953,9 @@ static int apple_probe(struct hid_devicereturn 0 ; out_err: -timer_delete_sync (&asc->battery_timer); +if (quirks &APPLE_RDESC_BATTERY ) +timer_delete_sync (&asc->battery_timer); +hid_hw_stop (hdev);return ret; }
@@ -960,7 +964,8 @@ static void apple_remove(struct hid_devi {struct apple_sc *asc =hid_get_drvdata (hdev); -timer_delete_sync (&asc->battery_timer); +if (asc->quirks &APPLE_RDESC_BATTERY ) +timer_delete_sync (&asc->battery_timer);hid_hw_stop (hdev); }
Greg Kroah-Hartman
maintainerPATCH 625/627 usb: gadget : fix use-after-free in composite_dev_cleanup()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Xue <[email protected]>
commit 151c0aa896c47a4459e07fee7d4843f44c1bb18e upstream.
1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():
if kmalloc fails, the pointer cdev->os_desc_req will be freed but not set to NULL. Then it will return a failure to the upper-level function.
2. in func configfs_composite_bind() -> composite_dev_cleanup():
it will checks whether cdev->os_desc_req is NULL. If it is not NULL, it will attempt to use it.This will lead to a use-after-free issue.
BUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0 Read of size 8 at addr 0000004827837a00 by task init/1 CPU: 10 PID: 1 Comm: init Tainted: G O 5.10.97-oh #1 kasan_report+0x188/0x1cc __asan_load8+0xb4/0xbc composite_dev_cleanup+0xf4/0x2c0 configfs_composite_bind+0x210/0x7ac udc_bind_to_driver+0xb4/0x1ec usb_gadget_probe_driver+0xec/0x21c gadget_dev_desc_UDC_store+0x264/0x27c
--- drivers/usb/gadget/composite.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/gadget/composite.c +5 -0
@@ -2489,6 +2489,11 @@ int composite_os_desc_req_prepare(structif (!cdev->os_desc_req->buf) { ret = -ENOMEM ;usb_ep_free_request (ep0, cdev->os_desc_req); +/* +* Set os_desc_req to NULL so that composite_dev_cleanup() +* will not try to free it again. +*/ + cdev->os_desc_req =NULL ; goto end; } cdev->os_desc_req->context = cdev;
Greg Kroah-Hartman
maintainerPATCH 626/627 wifi: ath12k: install pairwise key first
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
commit 66e865f9dc78d00e6d1c8c6624cb0c9004e5aafb upstream.
As station, WCN7850 firmware requires pairwise key to be installed before group key. Currently host does not care about this, so it is up to kernel or userspace to decide which one will be installed first. In case above requirement is not met, WCN7850 firmware's EAPOL station machine is messed up, and finally connection fails [1].
Reorder key install for station interface in that case: this is done by caching group key first; Later when pairwise key arrives, both can be installed in required order.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00217-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.h | 4 + drivers/net/wireless/ath/ath12k/mac.c | 76 +++++++++++++++++++++++++++++---- drivers/net/wireless/ath/ath12k/wmi.h | 1 3 files changed, 74 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +4 -0
@@ -345,6 +345,10 @@ struct ath12k_link_vif {bool is_sta_assoc_link;struct ath12k_reg_tpc_power_info reg_tpc_info; + +bool group_key_valid; +struct wmi_vdev_install_key_arg group_key; +bool pairwise_key_done; };struct ath12k_vif {
drivers/net/wireless/ath/ath12k/mac.c +69 -7
109 lines not on this page · raw message
drivers/net/wireless/ath/ath12k/wmi.h +1 -0
@@ -3760,6 +3760,7 @@ struct wmi_vdev_install_key_arg {u32 key_idx;u32 key_flags;u32 key_cipher; +u32 ieee80211_key_cipher;u32 key_len;u32 key_txmic_len;u32 key_rxmic_len;
Greg Kroah-Hartman
maintainerPATCH 627/627 mm: fix a UAF when vma->mm is freed after vma->vm_refcnt got dropped
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suren Baghdasaryan <[email protected]>
commit 9bbffee67ffd16360179327b57f3b1245579ef08 upstream.
By inducing delays in the right places, Jann Horn created a reproducer for a hard to hit UAF issue that became possible after VMAs were allowed to be recycled by adding SLAB_TYPESAFE_BY_RCU to their cache.
Race description is borrowed from Jann's discovery report:lock_vma_under_rcu() looks up a VMA locklessly with mas_walk() under rcu_read_lock(). At that point, the VMA may be concurrently freed, and it can be recycled by another process. vma_start_read() then increments the vma->vm_refcnt (if it is in an acceptable range), and if this succeeds, vma_start_read() can return a recycled VMA.
In this scenario where the VMA has been recycled, lock_vma_under_rcu() will then detect the mismatching ->vm_mm pointer and drop the VMA through vma_end_read(), which calls vma_refcount_put(). vma_refcount_put() drops the refcount and then calls rcuwait_wake_up() using a copy of vma->vm_mm. This is wrong: It implicitly assumes that the caller is keeping the VMA's mm alive, but in this scenario the caller has no relation to the VMA's mm, so the rcuwait_wake_up() can cause UAF.
The diagram depicting the race:
T1 T2 T3 == == ==
lock_vma_under_rcu
mas_walk
<VMA gets removed from mm>
mmap
<the same VMA is reallocated>
vma_start_read
__refcount_inc_not_zero_limited_acquire
munmap
__vma_enter_locked
refcount_add_not_zero
vma_end_read
vma_refcount_put
__refcount_dec_and_test
rcuwait_wait_event
<finish operation>
rcuwait_wake_up [UAF]
Note that rcuwait_wait_event() in T3 does not block because refcount was already dropped by T1. At this point T3 can exit and free the mm causing UAF in T1.
To avoid this we move vma->vm_mm verification into vma_start_read() and grab vma->vm_mm to stabilize it before vma_refcount_put() operation.
--- include/linux/mmap_lock.h | 30 ++++++++++++++++++++++++++++++ mm/mmap_lock.c | 3 +-- 2 files changed, 31 insertions(+), 2 deletions(-)
include/linux/mmap_lock.h +30 -0
@@ -12,6 +12,7 @@ extern int rcuwait_wake_up(struct rcuwai#include <linux/tracepoint-defs.h> #include <linux/types.h> #include <linux/cleanup.h> +#include <linux/sched/mm.h> #define MMAP_LOCK_INITIALIZER (name) \ .mmap_lock = __RWSEM_INITIALIZER((name).mmap_lock),
@@ -154,6 +155,10 @@ static inline void vma_refcount_put(stru* reused and attached to a different mm before we lock it. * Returns the vma on success, NULL on failure to lock and EAGAIN if vma got * detached. +* +* WARNING! The vma passed to this function cannot be used if the function +* fails to lock it because in certain cases RCU lock is dropped and then +* reacquired. Once RCU lock is dropped the vma can be concurently freed. */ static inline struct vm_area_struct *vma_start_read (struct mm_struct *mm,struct vm_area_struct *vma)
@@ -183,6 +188,31 @@ static inline struct vm_area_struct *vma }rwsem_acquire_read (&vma->vmlock_dep_map,0 ,1 , _RET_IP_); + +/* +* If vma got attached to another mm from under us, that mm is not +* stable and can be freed in the narrow window after vma->vm_refcnt +* is dropped and before rcuwait_wake_up(mm) is called. Grab it before +* releasing vma->vm_refcnt. +*/ +if (unlikely (vma->vm_mm != mm)) { +/* Use a copy of vm_mm in case vma is freed after we drop vm_refcnt */ +struct mm_struct *other_mm = vma->vm_mm; + +/* +* __mmdrop() is a heavy operation and we don't need RCU +* protection here. Release RCU lock during these operations. +* We reinstate the RCU read lock as the caller expects it to +* be held when this function returns even on error. +*/ +rcu_read_unlock (); +mmgrab (other_mm); +vma_refcount_put (vma); +mmdrop (other_mm); +rcu_read_lock (); +return NULL ; + } +/* * Overflow of vm_lock_seq/mm_lock_seq might produce false locked result. * False unlocked result is impossible because we modify and check
mm/mmap_lock.c +1 -2
@@ -164,8 +164,7 @@ retry:*/ /* Check if the vma we locked is the right one. */ -if (unlikely (vma->vm_mm != mm || - address < vma->vm_start || address >= vma->vm_end)) +if (unlikely (address < vma->vm_start || address >= vma->vm_end)) goto inval_end_read;rcu_read_unlock ();
# Librecast Test Results
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.16.1-rc1-gcd8771110407 #36 SMP PREEMPT_DYNAMIC Tue Aug 12 18:48:08 -00 2025 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.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 12.08.2025 um 19:24 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.16.1 release. There are 627 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. Built with GCC 14.2 on Debian Trixie. No dmesg oddities or regressions found. I did not see any of the Python warning messages here which I did see in the 6.1.148-rc1 build.
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]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
Cross-builds for ia64/hp-sim and runs fine in Ski ([1]).
[1]: https://github.com/linux-ia64/linux-stable-rc/actions/runs/16933719330#summary-47986210868
Cheers,
Frank
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
6.16.1-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
[ 0.000000] Linux version 6.16.1-rc1rv-gcd8771110407
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 15.1.1 20250729, GNU ld (GNU Binutils) 2.45.0) #1 SMP PREEMPT_DYNAMIC Wed Aug 13 12:10:19 JST 2025
Thanks
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
LKFT found three regressions on stable-rc 6.16.1-rc1.
Short version:
1) Pef build regressions on x86_64 and i386
2) LTP syscalls failures with 64k Page size on qemu-arm64
3) Kernel warning at fs/jbd2/transaction.c start_this_handle x86, qemu-arm64
Long story:
1)
The perf gcc-13 build failed on x86_64 and i386.
Build regression: qemu-arm64 ARM64_64K_PAGES ltp syscalls swap fsync fallocate failed.
Quoted 2 lines
Ian Rogers <[email protected]>
perf topdown: Use attribute to see an event is a topdown metic or slots
Build error:
arch/x86/tests/topdown.c: In function 'event_cb':arch/x86/tests/topdown.c:53:25: error: implicit declaration of function 'pr_debug' [-Werror=implicit-function-declaration]
53 | pr_debug("Broken topdown information
for '%s'\n", evsel__name(evsel));
| ^~~~~~~~cc1: all warnings being treated as errors
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with CONFIG_ARM64_64K_PAGES=y build configuration.
Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
- ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
- sync_file_range02
- syncfs01
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.
Regression Analysis:
- New regression? yes
- Reproducibility? yes
Test regression: qemu-arm64 ARM64_64K_PAGES ltp syscalls swap fsync fallocate failed.
swapoff01:
libswap.c:198: TINFO: create a swapfile size of 1 megabytes (MB) tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported libswap.c:218: TFAIL: mkswap on ext2/ext3/ext4 failed swapoff01.c:44: TINFO: create a swapfile with 65536 block numbers swapoff01.c:44: TCONF: Insufficient disk space to create swap file
swapoff02:
libswap.c:198: TINFO: create a swapfile size of 1 megabytes (MB) tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported libswap.c:218: TFAIL: mkswap on ext2/ext3/ext4 failed swapoff02.c:88: TINFO: create a swapfile size of 1 megabytes (MB)
swapon01:
libswap.c:198: TINFO: create a swapfile size of 1 megabytes (MB) tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
libswap.c:218: TFAIL: mkswap on ext2/ext3/ext4 failed swapon01.c:39: TINFO: create a swapfile size of 128 megabytes (MB) tst_cmd.c:111: TBROK: 'mkswap' exited with a non-zero code 1 at tst_cmd.c:111
swapon02:
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
libswap.c:218: TFAIL: mkswap on ext2/ext3/ext4 failed swapon02.c:52: TINFO: create a swapfile size of 1 megabytes (MB) tst_cmd.c:111: TBROK: 'mkswap' exited with a non-zero code 1 at tst_cmd.c:111
swapon03:
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
libswap.c:218: TFAIL: mkswap on ext2/ext3/ext4 failed tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' swapon03.c:51: TINFO: create a swapfile size of 1 megabytes (MB) tst_cmd.c:111: TBROK: 'mkswap' exited with a non-zero code 1 at tst_cmd.c:111
sync01:
sync01.c:49: TFAIL: Synced 11403264, expected 33554432
syncfs01:
syncfs01.c:53: TFAIL: Synced 4096, expected 33554432
sync_file_range02:
sync_file_range02.c:60: TFAIL: sync_file_range() failed: ENOSPC (28)
fdatasync03:
fdatasync03.c:43: TFAIL: fdatasync(fd) failed: ENOSPC (28)
fsync01:
tst_test.c:1888: TINFO: === Testing on ext4 ===
tst_test.c:1217: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025)
tst_test.c:1229: TINFO: Mounting /dev/loop0 to /tmp/LTP_fsyX4HNML/mntpoint fstyp=ext4 flags=0
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync01.c:28: TFAIL: fsync failed: ENOSPC (28)
fsync04:
tst_test.c:1229: TINFO: Mounting /dev/loop0 to /tmp/LTP_fsydyQA53/mnt_point fstyp=ext4 flags=0 fsync04.c:43: TFAIL: fsync(fd) failed: ENOSPC (28)
fallocate04:
fallocate04.c:198: TFAIL: fallocate failed: ENOSPC (28)
fallocate05:
tst_fill_fs.c:53: TBROK: fsync(4) failed: ENOSPC (28)
ioctl_fiemap01
tst_test.c:1217: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025)
tst_test.c:1229: TINFO: Mounting /dev/loop0 to /tmp/LTP_iocjRR3ot/mntpoint fstyp=ext4 flags=0
ioctl_fiemap01.c:74: TPASS: ioctl(fd, FS_IOC_FIEMAP, fiemap) : EBADR (53) ioctl_fiemap01.c:77: TPASS: ioctl(fd, FS_IOC_FIEMAP, fiemap) passed ioctl_fiemap01.c:79: TPASS: Expect: Empty file should have 0 extends mapped ioctl_fiemap01.c:86: TFAIL: ioctl(fd, FS_IOC_FIEMAP, fiemap) failed: ENOSPC (28) ioctl_fiemap01.c:41: TFAIL: Expect: extent fm_mapped_extents is 1 ioctl_fiemap01.c:50: TFAIL: (extent->fe_flags & fe_mask) (0) != fe_flags (1) ioctl_fiemap01.c:51: TPASS: Expect: fe_physical > 1 ioctl_fiemap01.c:52: TFAIL: extent->fe_length (4702687395951105107) != fe_length (1024)
ioctl_fiemap01.c:96: TFAIL: ioctl(fd, FS_IOC_FIEMAP, fiemap) failed: ENOSPC (28) ioctl_fiemap01.c:41: TFAIL: Expect: extent fm_mapped_extents is 3 ioctl_fiemap01.c:50: TPASS: (extent->fe_flags & fe_mask) == fe_flags (0) ioctl_fiemap01.c:51: TPASS: Expect: fe_physical > 1 ioctl_fiemap01.c:52: TFAIL: extent->fe_length (4702687395951105107) != fe_length (1024)
ioctl_fiemap01.c:50: TPASS: (extent->fe_flags & fe_mask) == fe_flags (0) ioctl_fiemap01.c:51: TPASS: Expect: fe_physical > 1 ioctl_fiemap01.c:52: TFAIL: extent->fe_length (5136714152143953955) != fe_length (1024)
ioctl_fiemap01.c:50: TFAIL: (extent->fe_flags & fe_mask) (0) != fe_flags (1) ioctl_fiemap01.c:51: TPASS: Expect: fe_physical > 1 ioctl_fiemap01.c:52: TFAIL: extent->fe_length (8387236464277024288) != fe_length (1024)
Links,
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29470711/suite/ltp-syscalls/tests/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29470720/suite/ltp-syscalls/tests/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29470711/suite/ltp-syscalls/test/sync01/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29470720/suite/ltp-syscalls/test/fdatasync03/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29470711/suite/ltp-syscalls/test/swapon01/details/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.16.y/build/v6.16-628-gcd8771110407/testrun/29471488/suite/ltp-syscalls/tests/
3)
Test regression: stable-rc 6.16.1-rc1 WARNING fs jbd2 transaction.c start_this_handle
Kernel warning noticed on this stable-rc 6.16.1-rc1 this regression was reported last month on the Linux next,
- https://lore.kernel.org/all/CA+G9fYsyYQ3ZL4xaSg1-Tt5Evto7Zd+hgNWZEa9cQLbahA1+xg@mail.gmail.com/
Kernel warnings:
------------[ cut here ]------------ [ 34.805150] WARNING: CPU: 1 PID: 627 at fs/jbd2/transaction.c:334 start_this_handle (fs/jbd2/transaction.c:334 (discriminator 1)) [ 34.807683] Modules linked in: btrfs blake2b_generic xor xor_neon raid6_pq zstd_compress sm3_ce sha3_ce sha512_ce fuse drm backlight ip_tables x_tables [ 34.809152] CPU: 1 UID: 0 PID: 627 Comm: io_control01 Not tainted 6.16.1-rc1 #1 PREEMPT [ 34.809652] Hardware name: linux,dummy-virt (DT) [ 34.809961] pstate: 63402009 (nZCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) [ 34.810205] pc : start_this_handle (fs/jbd2/transaction.c:334 (discriminator 1)) [ 34.810395] lr : start_this_handle (fs/jbd2/transaction.c:334 (discriminator 1)) [ 34.810798] sp : ffff800080e2f7e0 [ 34.810962] x29: ffff800080e2f820 x28: fff00000c4b43000 x27: ffffa9c145dca000 [ 34.811259] x26: 0000000000000658 x25: 0000000000000629 x24: 0000000000000002 [ 34.811507] x23: 0000000000000629 x22: 0000000000000c40 x21: 0000000000000008 [ 34.811750] x20: fff00000d0800348 x19: fff00000d0800348 x18: 0000000000000000 [ 34.811992] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 34.812234] x14: 0000000000000000 x13: 00000000ffffffff x12: 0000000000000000 [ 34.812858] x11: 0000000000000000 x10: ffffa9c1456a8c08 x9 : ffffa9c142b54b84 [ 34.813572] x8 : ffff800080e2f408 x7 : 0000000000000000 x6 : 0000000000000001 [ 34.814462] x5 : ffffa9c145629000 x4 : ffffa9c1456293d0 x3 : 0000000000000000 [ 34.815093] x2 : 0000000000000000 x1 : fff00000c4fd0000 x0 : 0000000000000050 [ 34.815812] Call trace: [ 34.816213] start_this_handle (fs/jbd2/transaction.c:334 (discriminator 1)) (P) [ 34.816719] jbd2__journal_start (fs/jbd2/transaction.c:501) [ 34.817124] __ext4_journal_start_sb (fs/ext4/ext4_jbd2.c:117) [ 34.817687] ext4_do_writepages (fs/ext4/ext4_jbd2.h:242 fs/ext4/inode.c:2847) [ 34.818109] ext4_writepages (fs/ext4/inode.c:2954) [ 34.818549] do_writepages (mm/page-writeback.c:2636) [ 34.818983] filemap_fdatawrite_wbc (mm/filemap.c:386 mm/filemap.c:376) [ 34.819520] __filemap_fdatawrite_range (mm/filemap.c:420) [ 34.819942] file_write_and_wait_range (mm/filemap.c:794) [ 34.820349] ext4_sync_file (fs/ext4/fsync.c:154) [ 34.820486] vfs_fsync_range (fs/sync.c:188) [ 34.820624] do_fsync (fs/sync.c:201 fs/sync.c:212) [ 34.820743] __arm64_sys_fsync (fs/sync.c:215) [ 34.820882] invoke_syscall.constprop.0 (arch/arm64/include/asm/syscall.h:61 arch/arm64/kernel/syscall.c:54) [ 34.821046] do_el0_svc (include/linux/thread_info.h:135 (discriminator 2) arch/arm64/kernel/syscall.c:140 (discriminator 2) arch/arm64/kernel/syscall.c:151 (discriminator 2)) [ 34.821172] el0_svc (arch/arm64/include/asm/irqflags.h:82
(discriminator 1) arch/arm64/include/asm/irqflags.h:123 (discriminator
1) arch/arm64/include/asm/irqflags.h:136 (discriminator 1) arch/arm64/kernel/entry-common.c:165 (discriminator 1) arch/arm64/kernel/entry-common.c:178 (discriminator 1) arch/arm64/kernel/entry-common.c:768 (discriminator 1))
[ 34.821307] el0t_64_sync_handler (arch/arm64/kernel/entry-common.c:787) [ 34.821460] el0t_64_sync (arch/arm64/kernel/entry.S:600) [ 34.821712] ---[ end trace 0000000000000000 ]---
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 12 lines · Naresh Kamboju
Long story:
1)
The perf gcc-13 build failed onx86_64and i386.Build regression: qemu-arm64
ARM64_64K_PAGESltp syscalls swap fsync fallocate failed.Quoted 2 lines
Ian Rogers <[email protected]>
perf topdown: Use attribute to see an event is a topdown metic or slotsBuild error:
Quoted 7 lines
arch/x86/tests/topdown.c: In function 'event_cb':arch/x86/tests/topdown.c:53:25: error: implicit declaration of function 'pr_debug' [-Werror=implicit-function-declaration]
53 | pr_debug("Broken topdown informationfor '%s'\n", evsel__name(evsel)); | ^~~~~~~~cc1: all warnings being treated as errors
Already fixed.
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yes
Regression from 6.16? Or just from 6.15.y?
Quoted 9 lines
3)
Test regression: stable-rc 6.16.1-rc1 WARNING fs jbd2
transaction.cstart_this_handleKernel warning noticed on this stable-rc 6.16.1-rc1 this regression was reported last month on the Linux next,
- https://lore.kernel.org/all/CA+G9fYsyYQ3ZL4xaSg1-Tt5Evto7Zd+hgNWZEa9cQLbahA1+xg@mail.gmail.com/
Ok, no real regression here if this was already in 6.16.
Doesn't look like it got fixed in 6.17-rc1 either :(
thanks,
greg k-h
Hi Greg,
Quoted 27 lines
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01
Quoted 8 lines
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yesRegression from 6.16? Or just from 6.15.y?
Based on available data, the issue is not present in v6.16 or v6.15.
Anders, bisected this regression and found,
ext4: correct the reserved credits for extent conversion
[ Upstream commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 ]
Report lore link,
https://lore.kernel.org/stable/CA+G9fYtBnCSa2zkaCn-oZKYz8jz5FZj0HS7DjSfMeamq3AXqNg@mail.gmail.com/
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 40 lines · Naresh Kamboju
Hi Greg,
Quoted 27 lines
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01Quoted 8 lines
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yesRegression from 6.16? Or just from 6.15.y?
Based on available data, the issue is not present in v6.16 or v6.15.
Quoted 8 lines
Anders, bisected this regression and found,
ext4: correct the reserved credits for extent conversion
[ Upstream commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 ]Report lore link,
https://lore.kernel.org/stable/CA+G9fYtBnCSa2zkaCn-oZKYz8jz5FZj0HS7DjSfMeamq3AXqNg@mail.gmail.com/
Great, and that's also affecting 6.17-rc1 so we are "bug compatible"? :)
thanks
greg k-h
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Naresh Kamboju
Hi Greg,
Quoted 27 lines
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01Quoted 8 lines
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yesRegression from 6.16? Or just from 6.15.y?
Based on available data, the issue is not present in v6.16 or v6.15.
Anders, bisected this regression and found,
ext4: correct the reserved credits for extent conversion
[ Upstream commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 ]
Quoted 6 lines
Quoted 3 lines
Report lore link,
https://lore.kernel.org/stable/CA+G9fYtBnCSa2zkaCn-oZKYz8jz5FZj0HS7DjSfMeamq3AXqNg@mail.gmail.com/
Great, and that's also affecting 6.17-rc1 so we are "bug compatible"? :)
Lol.
regards,
dan carpenter
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Naresh Kamboju
Hi Greg,
Quoted 27 lines
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01Quoted 8 lines
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yesRegression from 6.16? Or just from 6.15.y?
Based on available data, the issue is not present in v6.16 or v6.15.
Anders, bisected this regression and found,
ext4: correct the reserved credits for extent conversion
[ Upstream commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 ]
Quoted 7 lines
Quoted 3 lines
Report lore link,
https://lore.kernel.org/stable/CA+G9fYtBnCSa2zkaCn-oZKYz8jz5FZj0HS7DjSfMeamq3AXqNg@mail.gmail.com/
Great, and that's also affecting 6.17-rc1 so we are "bug compatible"? :)
Hi,
This issue has already fixed in 6.17-rc1 through this series:
https://lore.kernel.org/linux-ext4/[email protected]/
To fix this issue in 6.16, it's necessary to backport the whole series instead of just pick 5137d6c8906b ("ext4: fix insufficient credits calculation in ext4_meta_trans_blocks()") and 95ad8ee45cdb {"ext4: correct the reserved credits for extent conversion"). Otherwise, this will make the problem more likely to occur.
Thanks,
Yi.
Greg Kroah-Hartman
maintainerQuoted 59 lines · Zhang Yi
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Naresh Kamboju
Hi Greg,
Quoted 27 lines
Quoted 27 lines
2)
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01Quoted 8 lines
Quoted 6 lines
Reproducibility:
- 64K config above listed test fails
- 4K config above listed test pass.Regression Analysis:
- New regression? yesRegression from 6.16? Or just from 6.15.y?
Based on available data, the issue is not present in v6.16 or v6.15.
Anders, bisected this regression and found,
ext4: correct the reserved credits for extent conversion
[ Upstream commit 95ad8ee45cdbc321c135a2db895d48b374ef0f87 ]Quoted 7 lines
Quoted 3 lines
Report lore link,
https://lore.kernel.org/stable/CA+G9fYtBnCSa2zkaCn-oZKYz8jz5FZj0HS7DjSfMeamq3AXqNg@mail.gmail.com/
Great, and that's also affecting 6.17-rc1 so we are "bug compatible"? :)
Hi,
This issue has already fixed in 6.17-rc1 through this series:
Quoted 8 lines
https://lore.kernel.org/linux-ext4/[email protected]/
To fix this issue in 6.16, it's necessary to backport the whole series instead of just pick
5137d6c8906b("ext4: fix insufficient credits calculation inext4_meta_trans_blocks()") and95ad8ee45cdb{"ext4: correct the reserved credits for extent conversion"). Otherwise, this will make the problem more likely to occur.
Thanks, I'll just postpone this one for now.
greg k-h
Hello,
Thanks for the report!
Quoted 21 lines · Greg Kroah-Hartman
Quoted 12 lines · Naresh Kamboju
Long story:
1)
The perf gcc-13 build failed onx86_64and i386.Build regression: qemu-arm64
ARM64_64K_PAGESltp syscalls swap fsync fallocate failed.Quoted 2 lines
Ian Rogers <[email protected]>
perf topdown: Use attribute to see an event is a topdown metic or slotsBuild error:
Quoted 7 lines
arch/x86/tests/topdown.c: In function 'event_cb':arch/x86/tests/topdown.c:53:25: error: implicit declaration of function 'pr_debug' [-Werror=implicit-function-declaration]
53 | pr_debug("Broken topdown informationfor '%s'\n", evsel__name(evsel)); | ^~~~~~~~cc1: all warnings being treated as errors
Quoted 1 line
Already fixed.
Are you sure? I'm not seeing the fix. Can you share the commit id?
I don't see the failure on my machine with gcc 14 but I also cannot find what's the fix.
Thanks,
Namhyung
Greg Kroah-Hartman
maintainerQuoted 26 lines · Namhyung Kim
Hello,
Thanks for the report!
Quoted 21 lines · Greg Kroah-Hartman
Quoted 19 lines · Naresh Kamboju
Long story:
1)
The perf gcc-13 build failed onx86_64and i386.Build regression: qemu-arm64
ARM64_64K_PAGESltp syscalls swap fsync fallocate failed.Quoted 2 lines
Ian Rogers <[email protected]>
perf topdown: Use attribute to see an event is a topdown metic or slotsBuild error:
arch/x86/tests/topdown.c: In function 'event_cb':arch/x86/tests/topdown.c:53:25: error: implicit declaration of function 'pr_debug' [-Werror=implicit-function-declaration]
53 | pr_debug("Broken topdown informationfor '%s'\n", evsel__name(evsel)); | ^~~~~~~~cc1: all warnings being treated as errors
Quoted 3 lines
Quoted 1 line
Already fixed.
Are you sure? I'm not seeing the fix. Can you share the commit id?
I dropped the offending perf patch:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=4199b872a5585e025f62886724f4f9ae80e014ae
Did that not work for you?
thanks,
greg k-h
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Namhyung Kim
Hello,
Thanks for the report!
Quoted 21 lines · Greg Kroah-Hartman
Quoted 19 lines · Naresh Kamboju
Long story:
1)
The perf gcc-13 build failed onx86_64and i386.Build regression: qemu-arm64
ARM64_64K_PAGESltp syscalls swap fsync fallocate failed.Quoted 2 lines
Ian Rogers <[email protected]>
perf topdown: Use attribute to see an event is a topdown metic or slotsBuild error:
arch/x86/tests/topdown.c: In function 'event_cb':arch/x86/tests/topdown.c:53:25: error: implicit declaration of function 'pr_debug' [-Werror=implicit-function-declaration]
53 | pr_debug("Broken topdown informationfor '%s'\n", evsel__name(evsel)); | ^~~~~~~~cc1: all warnings being treated as errors
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Already fixed.
Are you sure? I'm not seeing the fix. Can you share the commit id?
I dropped the offending perf patch:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=4199b872a5585e025f62886724f4f9ae80e014aeDid that not work for you?
Oh sorry, I misunderstood you. I thought you have a fix.
Thanks,
Namhyung
Quoted 12 lines · Naresh Kamboju
On Tue, 12 Aug 2025 at 23:57, Greg Kroah-Hartman
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
Quoted 14 lines
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01
I'm also seeing epoll_ctl04 failing on Raspberry Pi 4, there's a bisect still running but I suspect given the error message:
epoll_ctl04.c:59: TFAIL: epoll_ctl(..., EPOLL_CTL_ADD, ...) with number of nesting is 5 expected EINVAL: ELOOP (40)
that it might be:
# bad: [b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] eventpoll: Fix semi-unbounded recursion
which already got tested, or something adjacent.
Quoted 14 lines · Mark Brown
Quoted 12 lines · Naresh Kamboju
On Tue, 12 Aug 2025 at 23:57, Greg Kroah-Hartman
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
Quoted 14 lines
Quoted 6 lines
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01Quoted 8 lines
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01
These test failures are not seen on Linus tree v6.16 or v6.15.
Quoted 3 lines
I'm also seeing
epoll_ctl04failing on Raspberry Pi 4, there's a bisect still running but I suspect given the error message:
Right !
LTP syscalls epoll_ctl04 test is failing on Linux mainline as well with this error on LKFT CI system on several platforms.
Quoted 8 lines
epoll_ctl04.c:59: TFAIL:
epoll_ctl(..., EPOLL_CTL_ADD, ...)with number of nesting is 5 expected EINVAL: ELOOP (40)that it might be:
# bad: [
b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] eventpoll: Fix semi-unbounded recursionwhich already got tested, or something adjacent.
A patch has been proposed to update the LTP test case to align with recent changes in the Linux kernel code.
[LTP] [PATCH] syscalls/epoll_ctl04: add ELOOP to expected errnos
- Naresh
Greg Kroah-Hartman
maintainerQuoted 47 lines · Naresh Kamboju
Quoted 14 lines · Mark Brown
Quoted 12 lines · Naresh Kamboju
On Tue, 12 Aug 2025 at 23:57, Greg Kroah-Hartman
The following list of LTP syscalls failure noticed on qemu-arm64 with stable-rc 6.16.1-rc1 with
CONFIG_ARM64_64K_PAGES=ybuild configuration.Most failures report ENOSPC (28) or mkswap errors, which may be related to disk space handling in the 64K page configuration on qemu-arm64.
The issue is reproducible on multiple runs.
* qemu-arm64, ltp-syscalls - 64K page size test failures list,
Quoted 14 lines
Quoted 6 lines
- fallocate04
- fallocate05
- fdatasync03
- fsync01
- fsync04
-ioctl_fiemap01Quoted 8 lines
- swapoff01
- swapoff02
- swapon01
- swapon02
- swapon03
- sync01
-sync_file_range02
- syncfs01These test failures are not seen on Linus tree v6.16 or v6.15.
Quoted 3 lines
I'm also seeing
epoll_ctl04failing on Raspberry Pi 4, there's a bisect still running but I suspect given the error message:Right !
LTP syscallsepoll_ctl04test is failing on Linux mainline as well with this error on LKFT CI system on several platforms.Quoted 7 lines
epoll_ctl04.c:59: TFAIL:
epoll_ctl(..., EPOLL_CTL_ADD, ...)with number of nesting is 5 expected EINVAL: ELOOP (40)that it might be:
# bad: [
b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] eventpoll: Fix semi-unbounded recursion
Quoted 8 lines
Quoted 1 line
which already got tested, or something adjacent.
A patch has been proposed to update the LTP test case to align with recent changes in the Linux kernel code.
[LTP] [PATCH] syscalls/epoll_ctl04: add ELOOP to expected errnos
Great, thanks for letting us know that this is just a test-case issue.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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.
As mentioned elsewhere I'm seeing failures in epoll_ctl04 from LTP:
epoll_ctl04.c:59: TFAIL: epoll_ctl(..., EPOLL_CTL_ADD, ...) with number of nesting is 5 expected EINVAL: ELOOP (40)
these bisect down to "eventpoll: Fix semi-unbounded recursion". Bisect log and links to full console logs:
# bad: [cd8771110407dfe976259483baaae2c6e62a4146] Linux 6.16.1-rc1
# good: [038d61fd642278bab63ee8ef722c50d10ab01e8f] Linux 6.16
git bisect start 'cd8771110407dfe976259483baaae2c6e62a4146' '038d61fd642278bab63ee8ef722c50d10ab01e8f'
# test job: [cd8771110407dfe976259483baaae2c6e62a4146] https://lava.sirena.org.uk/scheduler/job/1664129 # bad: [cd8771110407dfe976259483baaae2c6e62a4146] Linux 6.16.1-rc1 git bisect bad cd8771110407dfe976259483baaae2c6e62a4146 # test job: [7ee553aeaf6d124298f393ec5eaa219b0968e16f] https://lava.sirena.org.uk/scheduler/job/1666114 # bad: [7ee553aeaf6d124298f393ec5eaa219b0968e16f] media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check git bisect bad 7ee553aeaf6d124298f393ec5eaa219b0968e16f # test job: [716cab0f18aa38d77b92073dab931186c770054f] https://lava.sirena.org.uk/scheduler/job/1666908 # bad: [716cab0f18aa38d77b92073dab931186c770054f] wifi: ath12k: Avoid accessing uninitialized arvif->ar during beacon miss git bisect bad 716cab0f18aa38d77b92073dab931186c770054f # test job: [7fac9c079ff503f261ffb49bdd7f283803beca93] https://lava.sirena.org.uk/scheduler/job/1667071 # bad: [7fac9c079ff503f261ffb49bdd7f283803beca93] ASoC: SDCA: Add missing default in switch in entity_pde_event() git bisect bad 7fac9c079ff503f261ffb49bdd7f283803beca93 # test job: [1da0a31f7c952ad518d3a91df9a9109ba3c02d73] https://lava.sirena.org.uk/scheduler/job/1667175 # bad: [1da0a31f7c952ad518d3a91df9a9109ba3c02d73] selftests: Fix errno checking in syscall_user_dispatch test git bisect bad 1da0a31f7c952ad518d3a91df9a9109ba3c02d73 # test job: [53cd2297915f5c3be56ddad54be5cefb9cbc2fb9] https://lava.sirena.org.uk/scheduler/job/1667249 # good: [53cd2297915f5c3be56ddad54be5cefb9cbc2fb9] ublk: validate ublk server pid git bisect good 53cd2297915f5c3be56ddad54be5cefb9cbc2fb9 # test job: [8aca40e2c98c5eae8da96e84caaaaec97152dbed] https://lava.sirena.org.uk/scheduler/job/1667289 # bad: [8aca40e2c98c5eae8da96e84caaaaec97152dbed] block: restore two stage elevator switch while running nr_hw_queue update git bisect bad 8aca40e2c98c5eae8da96e84caaaaec97152dbed # test job: [9fccd15a5cdcd1d2376f96fdba97ff82d26ea8ba] https://lava.sirena.org.uk/scheduler/job/1667364 # good: [9fccd15a5cdcd1d2376f96fdba97ff82d26ea8ba] io_uring: fix breakage in EXPERT menu git bisect good 9fccd15a5cdcd1d2376f96fdba97ff82d26ea8ba # test job: [b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] https://lava.sirena.org.uk/scheduler/job/1667417 # bad: [b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] eventpoll: Fix semi-unbounded recursion git bisect bad b47ce23d38c737a2f84af2b18c5e6b6e09e4932d # test job: [cac4afc0cefeb0b4d066867aebe0b7cb6806b9ae] https://lava.sirena.org.uk/scheduler/job/1667503 # good: [cac4afc0cefeb0b4d066867aebe0b7cb6806b9ae] btrfs: remove partial support for lowest level from btrfs_search_forward() git bisect good cac4afc0cefeb0b4d066867aebe0b7cb6806b9ae # first bad commit: [b47ce23d38c737a2f84af2b18c5e6b6e09e4932d] eventpoll: Fix semi-unbounded recursion
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.16:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
120 tests: 119 pass, 1 failLinux version: 6.16.1-rc1-gcd8771110407
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Test failures: tegra194-p2972-0000: boot.py
Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +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.16.1-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.16.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Hi,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +0000. Anything received after that time might be too late.
While testing I noticed two new warnings compared to previous tests with stable series:
[ 0.000000] x86 CPU feature dependency check failure: CPU0 has '18*32+31' enabled but '18*32+26' disabled. Kernel might be fine, but no guarantees. [...] [ 60.281912] sched: DL replenish lagged too much
Need to investigate more.
Regards,
Salvatore
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +0000. Anything received after that time might be too late.
Tested on the following hardware:
* a ThinkPad E14 Gen 3 with a AMD Ryzen 5 5500U CPU
* a Framework Laptop with a Ryzen AI 5 340
* a Framework Desktop
Quoted 8 lines · On Tue, 12 Aug 2025 19:24:55 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.16.1 release. There are 627 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, 14 Aug 2025 17:32:40 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
Thanks!
Cheers,
Miguel