7.0.9-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 164/201 drm/amdkfd: Make all TLB-flushes heavy-weight
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
commit 9b4e3495d1bd2469bf94b74930c153c2d534ddb7 upstream.
With only one sequence number we cannot track the need for legacy vs heavy-weight flushes reliably. Always use heavy-weight.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 +++--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 +++--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -2
@@ -1360,7 +1360,7 @@ static int kfd_ioctl_map_memory_to_gpu(s peer_pdd =kfd_process_device_data_by_id (p, devices_arr[i]);if (WARN_ON_ONCE (!peer_pdd))continue ; -kfd_flush_tlb (peer_pdd,TLB_FLUSH_LEGACY ); +kfd_flush_tlb (peer_pdd); }kfree (devices_arr);
@@ -1455,7 +1455,7 @@ static int kfd_ioctl_unmap_memory_from_gif (WARN_ON_ONCE (!peer_pdd))continue ;if (flush_tlb) -kfd_flush_tlb (peer_pdd,TLB_FLUSH_HEAVYWEIGHT ); +kfd_flush_tlb (peer_pdd);/* Remove dma mapping after tlb flush to avoid IO_PAGE_FAULT */ err =amdgpu_amdkfd_gpuvm_dmaunmap_mem (mem, peer_pdd->drm_priv);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -3
@@ -572,7 +572,7 @@ static int allocate_vmid(struct device_q qpd->vmid, qpd->page_table_base);/* invalidate the VM context after pasid and vmid mapping is set up */ -kfd_flush_tlb (qpd_to_pdd (qpd),TLB_FLUSH_LEGACY ); +kfd_flush_tlb (qpd_to_pdd (qpd));if (dqm->dev->kfd2kgd->set_scratch_backing_va) dqm->dev->kfd2kgd->set_scratch_backing_va(dqm->dev->adev,
@@ -610,7 +610,7 @@ static void deallocate_vmid(struct devicif (flush_texture_cache_nocpsch (q->device, qpd))dev_err (dev,"Failed to flush TC\n" ); -kfd_flush_tlb (qpd_to_pdd (qpd),TLB_FLUSH_LEGACY ); +kfd_flush_tlb (qpd_to_pdd (qpd));/* Release the vmid mapping */ set_pasid_vmid_mapping (dqm,0 , qpd->vmid);
@@ -1284,7 +1284,7 @@ static int restore_process_queues_nocpsc dqm->dev->adev, qpd->vmid, qpd->page_table_base); -kfd_flush_tlb (pdd,TLB_FLUSH_LEGACY ); +kfd_flush_tlb (pdd); }/* Take a safe reference to the mm_struct, which may otherwise
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +3 -3
@@ -1554,13 +1554,13 @@ void kfd_signal_reset_event(struct kfd_nvoid kfd_signal_poison_consumed_event (struct kfd_node *dev,u32 pasid);void kfd_signal_process_terminate_event (struct kfd_process *p); -static inline void kfd_flush_tlb (struct kfd_process_device *pdd, -enum TLB_FLUSH_TYPE type) +static inline void kfd_flush_tlb (struct kfd_process_device *pdd) {struct amdgpu_device *adev = pdd->dev->adev;struct amdgpu_vm *vm =drm_priv_to_vm (pdd->drm_priv); -amdgpu_vm_flush_compute_tlb (adev, vm, type, pdd->dev->xcc_mask); +amdgpu_vm_flush_compute_tlb (adev, vm,TLB_FLUSH_HEAVYWEIGHT , + pdd->dev->xcc_mask); }static inline bool kfd_flush_tlb_after_unmap (struct kfd_dev *dev)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +2 -2
@@ -1415,7 +1415,7 @@ svm_range_unmap_from_gpus(struct svm_ranif (r)break ; } -kfd_flush_tlb (pdd,TLB_FLUSH_HEAVYWEIGHT ); +kfd_flush_tlb (pdd); }return r;
@@ -1557,7 +1557,7 @@ svm_range_map_to_gpus(struct svm_range * } } -kfd_flush_tlb (pdd,TLB_FLUSH_LEGACY ); +kfd_flush_tlb (pdd); }return r;
Greg Kroah-Hartman
maintainerPATCH 165/201 drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: John B. Moore <[email protected]>
commit 78d2e624fa073c14970aa097adcf3ea31c157a66 upstream.
sdma_v4_0_ring_emit_fence() contains two BUG_ON(addr & 0x3) assertions that verify fence writeback addresses are dword-aligned. These assertions can be reached from unprivileged userspace via crafted DRM_IOCTL_AMDGPU_CS submissions, causing a fatal kernel panic in a scheduler worker thread.
Replace both BUG_ON() calls with WARN_ON() to log the condition without crashing the kernel. A misaligned fence address at this point indicates a driver bug, but crashing the kernel is never the correct response when the assertion is reachable from userspace.
The CS IOCTL path is the correct place to filter invalid submissions; the ring emission callback is too late to do anything about it.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
@@ -890,7 +890,7 @@ static void sdma_v4_0_ring_emit_fence(st/* write the fence */ amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_FENCE ));/* zero in first two bits */ -BUG_ON (addr &0x3 ); +WARN_ON (addr &0x3 );amdgpu_ring_write (ring,lower_32_bits (addr));amdgpu_ring_write (ring,upper_32_bits (addr));amdgpu_ring_write (ring,lower_32_bits (seq));
@@ -900,7 +900,7 @@ static void sdma_v4_0_ring_emit_fence(st addr +=4 ;amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_FENCE ));/* zero in first two bits */ -BUG_ON (addr &0x3 ); +WARN_ON (addr &0x3 );amdgpu_ring_write (ring,lower_32_bits (addr));amdgpu_ring_write (ring,upper_32_bits (addr));amdgpu_ring_write (ring,upper_32_bits (seq));
Greg Kroah-Hartman
maintainerPATCH 166/201 drm/amdgpu/pm: add missing revision check for CI
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 2a561b361b7681509710f3cfc3d95d54c87ac69f upstream.
The ci_populate_all_memory_levels() workaround only applies to revision 0 SKUs.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +3 -2
@@ -1326,8 +1326,9 @@ static int ci_populate_all_memory_levels dev_id = adev->pdev->device; -if ((dpm_table->mclk_table.count >=2 ) - && ((dev_id ==0x67B0 ) || (dev_id ==0x67B1 ))) { +if ((dpm_table->mclk_table.count >=2 ) && + ((dev_id ==0x67B0 ) || (dev_id ==0x67B1 )) && + (adev->pdev->revision ==0 )) { smu_data->smc_state_table.MemoryLevel[1 ].MinVddci = smu_data->smc_state_table.MemoryLevel[0 ].MinVddci; smu_data->smc_state_table.MemoryLevel[1].MinMvdd =
Greg Kroah-Hartman
maintainerPATCH 167/201 drm/amdgpu/pm: align Hawaii mclk workaround with radeon
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 1987c79b4fe5789dfa14423e78b5c25f6acf3e9d upstream.
Align the hawaii mclk workaround with radeon and windows.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +4 -4
@@ -1329,10 +1329,10 @@ static int ci_populate_all_memory_levelsif ((dpm_table->mclk_table.count >=2 ) && ((dev_id ==0x67B0 ) || (dev_id ==0x67B1 )) && (adev->pdev->revision ==0 )) { - smu_data->smc_state_table.MemoryLevel[1 ].MinVddci = - smu_data->smc_state_table.MemoryLevel[0 ].MinVddci; - smu_data->smc_state_table.MemoryLevel[1 ].MinMvdd = - smu_data->smc_state_table.MemoryLevel[0 ].MinMvdd; + smu_data->smc_state_table.MemoryLevel[1 ].MinVddc = + smu_data->smc_state_table.MemoryLevel[0 ].MinVddc; + smu_data->smc_state_table.MemoryLevel[1 ].MinVddcPhases = + smu_data->smc_state_table.MemoryLevel[0 ].MinVddcPhases; } smu_data->smc_state_table.MemoryLevel[0 ].ActivityLevel =0x1F ;CONVERT_FROM_HOST_TO_SMC_US (smu_data->smc_state_table.MemoryLevel[0 ].ActivityLevel);
Greg Kroah-Hartman
maintainerPATCH 168/201 arm64: dts: qcom: kodiak: Fix PCIe1 PHY ref clock voting
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Chaitanya Chundru <[email protected]>
commit 30e8b6d42e8988eaaf0c2efd8c3797cb3884faea upstream.
GCC_PCIE_CLKREF_EN controls a repeater that provides the reference clock only to the PCIe0 PHY. PCIe1 PHY receives its refclk directly from the CXO source.
If the PCIe1 driver in HLOS votes for or against GCC_PCIE_CLKREF_EN, it will inadvertently modify the refclk to PCIe0 as well. Since PCIe0 is managed by WPSS while PCIe1 is managed in HLOS, there is no mechanism to coordinate these votes. As a result, HLOS may disable this repeater during suspend and cut off the PCIe0 PHY refclk while PCIe0 is still active.
Replace the unused GCC_PCIE_CLKREF_EN clock entry with RPMH_CXO_CLK to reflect the actual hardware wiring and prevent unintended changes to PCIe0 clocking.
--- arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/kodiak.dtsi +1 -1
@@ -2445,7 +2445,7 @@ reg = <0 0x01c0e000 0 0x1000>; clocks = <&gcc GCC_PCIE_1_AUX_CLK>, <&gcc GCC_PCIE_1_CFG_AHB_CLK>, - <&gcc GCC_PCIE_CLKREF_EN>, + <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_PCIE1_PHY_RCHNG_CLK>, <&gcc GCC_PCIE_1_PIPE_CLK>; clock-names = "aux",
Greg Kroah-Hartman
maintainerPATCH 169/201 arm64: dts: qcom: lemans: Correct QUP interrupt numbers
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viken Dadhaniya <[email protected]>
commit c5b22c88cc09b180e3a23010b29f4d02ec117a44 upstream.
Fix GIC_SPI interrupt numbers for QUPv3 SE6 nodes on Lemans SoC. Using incorrect interrupt lines can prevent IRQs from triggering and break I2C, SPI, and UART operation.
--- arch/arm64/boot/dts/qcom/lemans.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/lemans.dtsi +4 -4
@@ -1512,7 +1512,7 @@ reg = <0x0 0x898000 0x0 0x4000>; #address-cells = <1>; #size-cells = <0>; - interrupts = <GIC_SPI 834 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 833 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GCC_QUPV3_WRAP2_S6_CLK>; clock-names = "se"; pinctrl-0 = <&qup_i2c20_default>;
@@ -1539,7 +1539,7 @@ reg = <0x0 0x898000 0x0 0x4000>; #address-cells = <1>; #size-cells = <0>; - interrupts = <GIC_SPI 834 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 833 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GCC_QUPV3_WRAP2_S6_CLK>; clock-names = "se"; pinctrl-0 = <&qup_spi20_default>;
@@ -1564,7 +1564,7 @@ uart20: serial@898000 { compatible = "qcom,geni-uart"; reg = <0x0 0x00898000 0x0 0x4000>; - interrupts = <GIC_SPI 834 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 833 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GCC_QUPV3_WRAP2_S6_CLK>; clock-names = "se"; pinctrl-0 = <&qup_uart20_default>;
@@ -2510,7 +2510,7 @@ reg = <0x0 0xa98000 0x0 0x4000>; #address-cells = <1>; #size-cells = <0>; - interrupts = <GIC_SPI 836 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 835 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GCC_QUPV3_WRAP1_S6_CLK>; clock-names = "se"; pinctrl-0 = <&qup_i2c13_default>;
Greg Kroah-Hartman
maintainerPATCH 170/201 arm64: dts: ti: k3-am62a7-sk: Fix pin name in comment from M19 to N22
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
commit 6ee0792d83d5c690205c350825a4c30746c0e0a2 upstream.
The pin for GPMC0_CLK.GPIO0_31 at address 0x000F407C is N22 and not M19. Hence, fix the pin name in the comment to avoid confusion.
--- arch/arm64/boot/dts/ti/k3-am62a7-sk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62a7-sk.dts +1 -1
@@ -398,7 +398,7 @@ vddshv_sdio_pins_default: vddshv-sdio-default-pins { pinctrl-single,pins = < - AM62AX_IOPAD(0x07c, PIN_OUTPUT, 7) /* (M19) GPMC0_CLK.GPIO0_31 */ + AM62AX_IOPAD(0x07c, PIN_OUTPUT, 7) /* (N22) GPMC0_CLK.GPIO0_31 */ >; };
Greg Kroah-Hartman
maintainerPATCH 171/201 arm64: dts: ti: k3-am69-aquila-dev: Fix DP regulator enable GPIO
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Franz Schnyder <[email protected]>
commit 222191225e69711089ecade3b98d79757d51e907 upstream.
Correct the DP regulator enable GPIO to index 21.
The 3.3V DP regulator was not being enabled by the assigned GPIO, as it is routed to GPIO index 21 and not 37, which was causing instability with displays connected over DP or via an active DP-to-HDMI adapter.
--- arch/arm64/boot/dts/ti/k3-am69-aquila-dev.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am69-aquila-dev.dts +1 -1
@@ -33,7 +33,7 @@ reg_3v3_dp: regulator-3v3-dp { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gpio_21_dp>; /* Aquila GPIO_21_DP (AQUILA B57) */ - gpio = <&main_gpio0 37 GPIO_ACTIVE_HIGH>; + gpio = <&main_gpio0 21 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-max-microvolt = <3300000>; regulator-min-microvolt = <3300000>;
Signature · 1 line
2.54.0
Greg Kroah-Hartman
maintainerPATCH 172/201 sctp: revalidate list cursor after sctp_sendmsg_to_asoc() in SCTP_SENDALL
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Morris <[email protected]>
commit abb5f36771cc4c05899b34000829a787572a8817 upstream.
The SCTP_SENDALL path in sctp_sendmsg() iterates ep->asocs with list_for_each_entry_safe(), which caches the next entry in @tmp before the loop body runs. The body calls sctp_sendmsg_to_asoc(), which may drop the socket lock inside sctp_wait_for_sndbuf().
While the lock is dropped, another thread can SCTP_SOCKOPT_PEELOFF the association cached in @tmp, migrating it to a new endpoint via sctp_sock_migrate() (list_del_init() + list_add_tail() to newep->asocs), and optionally close the new socket which frees the association via kfree_rcu(). The cached @tmp can also be freed by a network ABORT for that association, processed in softirq while the lock is dropped.
sctp_wait_for_sndbuf() revalidates @asoc (the current entry) on re-lock via the "sk != asoc->base.sk" and "asoc->base.dead" checks, but nothing revalidates @tmp. After a successful return, the iterator advances to the stale @tmp, yielding either a use-after-free (if the peeled socket was closed) or a list-walk onto the new endpoint's list head (type confusion of &newep->asocs as a struct sctp_association *).
Both are reachable from CapEff=0; the type-confusion path gives controlled indirect call via the outqueue.sched->init_sid pointer.
Fix by re-deriving @tmp from @asoc after sctp_sendmsg_to_asoc() returns. @asoc is known to still be on ep->asocs at that point: the only callers that list_del an association from ep->asocs are sctp_association_free() (which sets asoc->base.dead) and sctp_assoc_migrate() (which changes asoc->base.sk), and sctp_wait_for_sndbuf() checks both under the lock before any successful return; a tripped check propagates as err < 0 and the loop bails before the re-derive.
The SCTP_ABORT path in sctp_sendmsg_check_sflags() returns 0 and the loop hits 'continue' before sctp_sendmsg_to_asoc() is ever called, so the @tmp cached by list_for_each_entry_safe() still covers the lock-held free that ba59fb027307 ("sctp: walk the list of asoc safely") was added for.
--- net/sctp/socket.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/sctp/socket.c +9 -0
@@ -1986,6 +1986,15 @@ static int sctp_sendmsg(struct sock *sk, goto out_unlock;iov_iter_revert (&msg->msg_iter, err); + +/* sctp_sendmsg_to_asoc() may have released the socket +* lock (sctp_wait_for_sndbuf), during which other +* associations on ep->asocs could have been peeled +* off or freed. @asoc itself is revalidated by the +* base.dead and base.sk checks in sctp_wait_for_sndbuf, +* so re-derive the cached cursor from it. +*/ + tmp =list_next_entry (asoc, asocs); } goto out_unlock;
Greg Kroah-Hartman
maintainerPATCH 173/201 batman-adv: fix integer overflow on buff_pos
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyes Bourennani <[email protected]>
commit 0799e5943611006b346b8813c7daf7dd5aa26bfd upstream.
Fixing an integer overflow present in batadv_iv_ogm_send_to_if. The size check is done using the int type in batadv_iv_ogm_aggr_packet whereas the buff_pos variable uses the s16 type. This could lead to an out-of-bound read.
--- net/batman-adv/bat_iv_ogm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +1 -1
@@ -335,7 +335,7 @@ static void batadv_iv_ogm_send_to_if(strstruct batadv_priv *bat_priv =netdev_priv (hard_iface->mesh_iface);const char *fwd_str;u8 packet_num; -s16 buff_pos; +int buff_pos;struct batadv_ogm_packet *batadv_ogm_packet;struct sk_buff *skb;u8 *packet_pos;
Greg Kroah-Hartman
maintainerPATCH 174/201 batman-adv: reject new tp_meter sessions during teardown
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiexun Wang <[email protected]>
commit 3243543592425beec83d453793e9d27caa0d8e66 upstream.
Prevent tp_meter from starting new sender or receiver sessions after mesh_state has left BATADV_MESH_ACTIVE.
--- net/batman-adv/tp_meter.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
net/batman-adv/tp_meter.c +16 -1
@@ -947,6 +947,13 @@ void batadv_tp_start(struct batadv_priv/* look for an already existing test towards this node */ spin_lock_bh (&bat_priv->tp_list_lock); +if (atomic_read (&bat_priv->mesh_state) !=BATADV_MESH_ACTIVE ) { +spin_unlock_bh (&bat_priv->tp_list_lock); +batadv_tp_batctl_error_notify (BATADV_TP_REASON_DST_UNREACHABLE , + dst, bat_priv, session_cookie); +return ; + } + tp_vars =batadv_tp_list_find (bat_priv, dst);if (tp_vars) {spin_unlock_bh (&bat_priv->tp_list_lock);
@@ -1329,9 +1336,12 @@ static struct batadv_tp_vars * batadv_tp_init_recv(struct batadv_priv *bat_priv, const struct batadv_icmp_tp_packet *icmp) { - struct batadv_tp_vars *tp_vars; + struct batadv_tp_vars *tp_vars = NULL;spin_lock_bh (&bat_priv->tp_list_lock); +if (atomic_read (&bat_priv->mesh_state) !=BATADV_MESH_ACTIVE ) + goto out_unlock; + tp_vars =batadv_tp_list_find_session (bat_priv, icmp->orig, icmp->session);if (tp_vars)
@@ -1464,6 +1474,9 @@ void batadv_tp_meter_recv(struct batadv_ {struct batadv_icmp_tp_packet *icmp; +if (atomic_read (&bat_priv->mesh_state) !=BATADV_MESH_ACTIVE ) + goto out; + icmp = (struct batadv_icmp_tp_packet *)skb->data;switch (icmp->subtype) {
@@ -1478,6 +1491,8 @@ void batadv_tp_meter_recv(struct batadv_"Received unknown TP Metric packet type %u\n" , icmp->subtype); } + +out:consume_skb (skb); }
Greg Kroah-Hartman
maintainerPATCH 175/201 batman-adv: stop tp_meter sessions during mesh teardown
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiexun Wang <[email protected]>
commit 3d3cf6a7314aca4df0a6dde28ce784a2a30d0166 upstream.
TP meter sessions remain linked on bat_priv->tp_list after the netlink request has already finished. When the mesh interface is removed, batadv_mesh_free() currently tears down the mesh without first draining these sessions.
A running sender thread or a late incoming tp_meter packet can then keep processing against a mesh instance which is already shutting down. Synchronize tp_meter with the mesh lifetime by stopping all active sessions from batadv_mesh_free() and waiting for sender threads to exit before teardown continues.
--- net/batman-adv/main.c | 1 net/batman-adv/tp_meter.c | 94 +++++++++++++++++++++++++++++++++++++--------- net/batman-adv/tp_meter.h | 1 net/batman-adv/types.h | 4 + 4 files changed, 82 insertions(+), 18 deletions(-)
net/batman-adv/main.c +1 -0
@@ -249,6 +249,7 @@ void batadv_mesh_free(struct net_deviceatomic_set (&bat_priv->mesh_state,BATADV_MESH_DEACTIVATING );batadv_purge_outstanding_packets (bat_priv,NULL ); +batadv_tp_stop_all (bat_priv);batadv_gw_node_free (bat_priv);
net/batman-adv/tp_meter.c +76 -18
145 lines not on this page · raw message
net/batman-adv/tp_meter.h +1 -0
@@ -17,6 +17,7 @@ void batadv_tp_start(struct batadv_priv u32 test_length, u32 *cookie);void batadv_tp_stop (struct batadv_priv *bat_priv,const u8 *dst,u8 return_value); +void batadv_tp_stop_all (struct batadv_priv *bat_priv);void batadv_tp_meter_recv (struct batadv_priv *bat_priv,struct sk_buff *skb);#endif /* _NET_BATMAN_ADV_TP_METER_H_ */
net/batman-adv/types.h +4 -0
@@ -14,6 +14,7 @@#include <linux/average.h> #include <linux/bitops.h> #include <linux/compiler.h> +#include <linux/completion.h> #include <linux/if.h> #include <linux/if_ether.h> #include <linux/kref.h>
@@ -1328,6 +1329,9 @@ struct batadv_tp_vars {/** @finish_work: work item for the finishing procedure */ struct delayed_work finish_work; +/** @finished: completion signaled when a sender thread exits */ +struct completion finished; +/** @test_length: test length in milliseconds */ u32 test_length;
Greg Kroah-Hartman
maintainerPATCH 176/201 batman-adv: stop caching unowned originator pointers in BAT IV
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiexun Wang <[email protected]>
commit f03e8583532941b07761c5429de7d50766fa3110 upstream.
BAT IV keeps the last-hop neighbor address in each neigh_node, but some paths also cache an originator pointer derived from a temporary lookup. That pointer is not owned by the neigh_node and may no longer refer to a live originator entry after purge handling runs.
Stop storing the auxiliary originator pointer in the BAT IV neighbor state. When BAT IV needs the neighbor originator data, resolve it from the stored neighbor address and drop the reference again after use.
--- net/batman-adv/bat_iv_ogm.c | 83 +++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 24 deletions(-)
net/batman-adv/bat_iv_ogm.c +59 -24
@@ -173,19 +173,12 @@ free_orig_node_hash:static struct batadv_neigh_node *batadv_iv_ogm_neigh_new (struct batadv_hard_iface *hard_iface,const u8 *neigh_addr, -struct batadv_orig_node *orig_node, -struct batadv_orig_node *orig_neigh) +struct batadv_orig_node *orig_node) {struct batadv_neigh_node *neigh_node; neigh_node =batadv_neigh_node_get_or_create (orig_node, hard_iface, neigh_addr); -if (!neigh_node) - goto out; - - neigh_node->orig_node = orig_neigh; - -out:return neigh_node; }
@@ -907,6 +900,31 @@ static u8 batadv_iv_orig_ifinfo_sum(stru }/** +* batadv_iv_ogm_neigh_ifinfo_sum() - Get bcast_own sum for a last-hop neighbor +* @bat_priv: the bat priv with all the mesh interface information +* @neigh_node: last-hop neighbor of an originator +* +* Return: Number of replied (rebroadcasted) OGMs for the originator currently +* announced by the neighbor. Returns 0 if the neighbor's originator entry is +* not available anymore. +*/ +static u8 batadv_iv_ogm_neigh_ifinfo_sum (struct batadv_priv *bat_priv, +const struct batadv_neigh_node *neigh_node) +{ +struct batadv_orig_node *orig_neigh; +u8 sum; + + orig_neigh =batadv_orig_hash_find (bat_priv, neigh_node->addr); +if (!orig_neigh) +return 0 ; + + sum =batadv_iv_orig_ifinfo_sum (orig_neigh, neigh_node->if_incoming); +batadv_orig_node_put (orig_neigh); + +return sum; +} + +/** * batadv_iv_ogm_orig_update() - use OGM to update corresponding data in an * originator * @bat_priv: the bat priv with all the mesh interface information
@@ -975,17 +993,9 @@ batadv_iv_ogm_orig_update(struct batadv_ }if (!neigh_node) { -struct batadv_orig_node *orig_tmp; - - orig_tmp =batadv_iv_ogm_orig_get (bat_priv, ethhdr->h_source); -if (!orig_tmp) - goto unlock; - neigh_node =batadv_iv_ogm_neigh_new (if_incoming, ethhdr->h_source, - orig_node, orig_tmp); - -batadv_orig_node_put (orig_tmp); + orig_node);if (!neigh_node) goto unlock; }else {
@@ -1037,10 +1047,9 @@ batadv_iv_ogm_orig_update(struct batadv_*/ if (router_ifinfo && neigh_ifinfo->bat_iv.tq_avg == router_ifinfo->bat_iv.tq_avg) { - sum_orig =batadv_iv_orig_ifinfo_sum (router->orig_node, - router->if_incoming); - sum_neigh =batadv_iv_orig_ifinfo_sum (neigh_node->orig_node, - neigh_node->if_incoming); + sum_orig =batadv_iv_ogm_neigh_ifinfo_sum (bat_priv, router); + sum_neigh =batadv_iv_ogm_neigh_ifinfo_sum (bat_priv, + neigh_node);if (sum_orig >= sum_neigh) goto out; }
@@ -1106,7 +1115,6 @@ static bool batadv_iv_ogm_calc_tq(structif (!neigh_node) neigh_node =batadv_iv_ogm_neigh_new (if_incoming, orig_neigh_node->orig, - orig_neigh_node, orig_neigh_node);if (!neigh_node)
@@ -1303,6 +1311,32 @@ out: }/** +* batadv_orig_to_direct_router() - get direct next hop neighbor to an orig address +* @bat_priv: the bat priv with all the mesh interface information +* @orig_addr: the originator MAC address to search the best next hop router for +* @if_outgoing: the interface where the OGM should be sent to +* +* Return: A neighbor node which is the best router towards the given originator +* address. Bonding candidates are ignored. +*/ +static struct batadv_neigh_node * +batadv_orig_to_direct_router (struct batadv_priv *bat_priv,u8 *orig_addr, +struct batadv_hard_iface *if_outgoing) +{ +struct batadv_neigh_node *neigh_node; +struct batadv_orig_node *orig_node; + + orig_node =batadv_orig_hash_find (bat_priv, orig_addr); +if (!orig_node) +return NULL ; + + neigh_node =batadv_orig_router_get (orig_node, if_outgoing); +batadv_orig_node_put (orig_node); + +return neigh_node; +} + +/** * batadv_iv_ogm_process_per_outif() - process a batman iv OGM for an outgoing * interface * @skb: the skb containing the OGM
@@ -1372,8 +1406,9 @@ batadv_iv_ogm_process_per_outif(const st router =batadv_orig_router_get (orig_node, if_outgoing);if (router) { - router_router =batadv_orig_router_get (router->orig_node, - if_outgoing); + router_router =batadv_orig_to_direct_router (bat_priv, + router->addr, + if_outgoing); router_ifinfo =batadv_neigh_ifinfo_get (router, if_outgoing); }
Greg Kroah-Hartman
maintainerPATCH 177/201 batman-adv: tp_meter: fix tp_num leak on kmalloc failure
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit ce425dd05d0fe7594930a0fb103634f35ac47bb6 upstream.
When batadv_tp_start() or batadv_tp_init_recv() fail to allocate a new tp_vars object, the previously incremented bat_priv->tp_num counter is never decremented. This causes tp_num to drift upward on each allocation failure. Since only BATADV_TP_MAX_NUM sessions can be started and the count is never reduced for these failed allocations, it causes to an exhaustion of throughput meter sessions. In worst case, no new throughput meter session can be started until the mesh interface is removed.
The error handling must decrement tp_num releasing the lock and aborting the creation of an throughput meter session
--- net/batman-adv/tp_meter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/tp_meter.c +4 -1
@@ -994,6 +994,7 @@ void batadv_tp_start(struct batadv_priv tp_vars =kmalloc_obj (*tp_vars,GFP_ATOMIC );if (!tp_vars) { +atomic_dec (&bat_priv->tp_num);spin_unlock_bh (&bat_priv->tp_list_lock); batadv_dbg(BATADV_DBG_TP_METER, bat_priv, "Meter: %s cannot allocate list elements\n",
@@ -1366,8 +1367,10 @@ batadv_tp_init_recv(struct batadv_priv * } tp_vars =kmalloc_obj (*tp_vars,GFP_ATOMIC ); -if (!tp_vars) +if (!tp_vars) { +atomic_dec (&bat_priv->tp_num); goto out_unlock; + }ether_addr_copy (tp_vars->other_end, icmp->orig); tp_vars->role =BATADV_TP_RECEIVER ;
Greg Kroah-Hartman
maintainerPATCH 178/201 batman-adv: bla: prevent use-after-free when deleting claims
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 4ae1709a314060a196981b344610d023ea841e57 upstream.
When batadv_bla_del_backbone_claims() removes all claims for a backbone, it does this by dropping the link entry in the hash list. This list entry itself was one of the references which need to be dropped at the same time via batadv_claim_put().
But the batadv_claim_put() must not be done before the last access to the claim object in this function. Otherwise the claim might be freed already by the batadv_claim_release() function before the list entry was dropped.
--- net/batman-adv/bridge_loop_avoidance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bridge_loop_avoidance.c +1 -1
@@ -318,8 +318,8 @@ batadv_bla_del_backbone_claims(struct baif (claim->backbone_gw != backbone_gw)continue ; -batadv_claim_put (claim);hlist_del_rcu (&claim->hash_entry); +batadv_claim_put (claim); }spin_unlock_bh (list_lock); }
Greg Kroah-Hartman
maintainerPATCH 179/201 batman-adv: bla: only purge non-released claims
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit cf6b604011591865ae39ac82de8978c1120d17af upstream.
When batadv_bla_purge_claims() goes through the list of claims, it is only traversing the hash list with an rcu_read_lock(). Due to a potential parallel batadv_claim_put(), it can happen that it encounters a claim which was actually in the process of being released+freed by batadv_claim_release(). In this case, backbone_gw is set to NULL before the delayed RCU kfree is started. Calling batadv_bla_claim_get_backbone_gw() is then no longer allowed because it would cause a NULL-ptr derefence.
To avoid this, only claims with a valid reference counter must be purged. All others are already taken care of.
--- net/batman-adv/bridge_loop_avoidance.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/batman-adv/bridge_loop_avoidance.c +8 -0
@@ -1288,6 +1288,13 @@ static void batadv_bla_purge_claims(strurcu_read_lock ();hlist_for_each_entry_rcu (claim, head, hash_entry) { +/* only purge claims not currently in the process of being released. +* Such claims could otherwise have a NULL-ptr backbone_gw set because +* they already went through batadv_claim_release() +*/ +if (!kref_get_unless_zero (&claim->refcount)) +continue ; + backbone_gw =batadv_bla_claim_get_backbone_gw (claim);if (now) goto purge_now;
@@ -1313,6 +1320,7 @@ purge_now: claim->addr, claim->vid); skip:batadv_backbone_gw_put (backbone_gw); +batadv_claim_put (claim); }rcu_read_unlock (); }
Greg Kroah-Hartman
maintainerPATCH 180/201 batman-adv: bla: put backbone reference on failed claim hash insert
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit ba9d20ee9076dac32c371116bacbe72480eb356c upstream.
When batadv_bla_add_claim() fails to insert a new claim into the hash, it leaked a reference to the backbone_gw for which the claim was intended. Call batadv_backbone_gw_put() on the error path to release the reference and avoid leaking the backbone_gw object.
--- net/batman-adv/bridge_loop_avoidance.c | 1 + 1 file changed, 1 insertion(+)
net/batman-adv/bridge_loop_avoidance.c +1 -0
@@ -723,6 +723,7 @@ static void batadv_bla_add_claim(structif (unlikely (hash_added !=0 )) {/* only local changes happened. */ +batadv_backbone_gw_put (backbone_gw);kfree (claim);return ; }
Greg Kroah-Hartman
maintainerPATCH 181/201 sched_ext: Use HK_TYPE_DOMAIN_BOOT to detect isolcpus= domain isolation
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
commit 6ae315d37924435516d697ea7dde0b799a5928e0 upstream.
scx_enable() refuses to attach a BPF scheduler when isolcpus=domain is in effect by comparing housekeeping_cpumask(HK_TYPE_DOMAIN) against cpu_possible_mask.
Since commit 27c3a5967f05 ("sched/isolation: Convert housekeeping cpumasks to rcu pointers"), HK_TYPE_DOMAIN's cpumask is RCU protected and dereferencing it requires either RCU read lock, the cpu_hotplug write lock, or the cpuset lock; scx_enable() holds none of these, so booting with isolcpus=domain and attaching any BPF scheduler triggers the following lockdep splat:
=============================
WARNING: suspicious RCU usage
-----------------------------
kernel/sched/isolation.c:60 suspicious rcu_dereference_check() usage!
1 lock held by scx_flash/281:
#0: ffffffff8379fce0 (update_mutex){+.+.}-{4:4}, at:
bpf_struct_ops_link_create+0x134/0x1c0 Call Trace: dump_stack_lvl+0x6f/0xb0 lockdep_rcu_suspicious.cold+0x37/0x70 housekeeping_cpumask+0xcd/0xe0 scx_enable.isra.0+0x17/0x120 bpf_scx_reg+0x5e/0x80 bpf_struct_ops_link_create+0x151/0x1c0 __sys_bpf+0x1e4b/0x33c0 __x64_sys_bpf+0x21/0x30 do_syscall_64+0x117/0xf80 entry_SYSCALL_64_after_hwframe+0x77/0x7f
In addition, commit 03ff73510169 ("cpuset: Update HK_TYPE_DOMAIN cpumask from cpuset") made HK_TYPE_DOMAIN include cpuset isolated partitions as well, which means the current check also rejects BPF schedulers when a cpuset partition is active. That contradicts the original intent of commit 9f391f94a173 ("sched_ext: Disallow loading BPF scheduler if isolcpus= domain isolation is in effect"), which explicitly noted that cpuset partitions are honored through per-task cpumasks and should not be rejected.
Switch to housekeeping_enabled(HK_TYPE_DOMAIN_BOOT), which reads only the housekeeping flag bit (no RCU dereference) and reflects exactly the boot-time isolcpus= configuration that the error message refers to.
--- kernel/sched/ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/ext.c +1 -2
@@ -5331,8 +5331,7 @@ static int scx_enable(struct sched_ext_ostatic DEFINE_MUTEX (helper_mutex);struct scx_enable_cmd cmd; -if (!cpumask_equal (housekeeping_cpumask (HK_TYPE_DOMAIN ), - cpu_possible_mask)) { +if (housekeeping_enabled (HK_TYPE_DOMAIN_BOOT )) {pr_err ("sched_ext: Not compatible with \"isolcpus=\" domain isolation\n" );return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 182/201 usb: typec: tcpm: reset internal port states on soft reset AMS
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Sunil Dhamne <[email protected]>
commit 2909f0d4994fb4306bf116df5ccee797791fce2c upstream.
Reset internal port states (such as vdm_sm_running and explicit_contract) on soft reset AMS as the port needs to negotiate a new contract. The consequence of leaving the states in as-is cond are as follows:
* port is in SRC power role and an explicit contract is negotiated with the port partner (in sink role)
* port partner sends a Soft Reset AMS while VDM State Machine is running
* port accepts the Soft Reset request and the port advertises src caps
* port partner sends a Request message but since the explicit_contract and vdm_sm_running are true from previous negotiation, the port ends up sending Soft Reset instead of Accept msg.
Stub Log:
[ 203.653942] AMS DISCOVER_IDENTITY start [ 203.653947] PD TX, header: 0x176f [ 203.655901] PD TX complete, status: 0 [ 203.657470] PD RX, header: 0x124f [1] [ 203.657477] Rx VDM cmd 0xff008081 type 2 cmd 1 len 1 [ 203.657482] AMS DISCOVER_IDENTITY finished [ 203.657484] cc:=4 [ 204.155698] PD RX, header: 0x144f [1] [ 204.155718] Rx VDM cmd 0xeeee8001 type 0 cmd 1 len 1 [ 204.155741] PD TX, header: 0x196f [ 204.157622] PD TX complete, status: 0 [ 204.160060] PD RX, header: 0x4d [1] [ 204.160066] state change SRC_READY -> SOFT_RESET [rev2 SOFT_RESET_AMS] [ 204.160076] PD TX, header: 0x163 [ 204.162486] PD TX complete, status: 0 [ 204.162832] AMS SOFT_RESET_AMS finished [ 204.162840] cc:=4 [ 204.162891] AMS POWER_NEGOTIATION start [ 204.162896] state change SOFT_RESET -> AMS_START [rev2 POWER_NEGOTIATION] [ 204.162908] state change AMS_START -> SRC_SEND_CAPABILITIES [rev2 POWER_NEGOTIATION] [ 204.162913] PD TX, header: 0x1361 [ 204.165529] PD TX complete, status: 0 [ 204.165571] pending state change SRC_SEND_CAPABILITIES -> SRC_SEND_CAPABILITIES_TIMEOUT @ 60 ms [rev2 POWER_NEGOTIATION] [ 204.166996] PD RX, header: 0x1242 [1] [ 204.167009] state change SRC_SEND_CAPABILITIES -> SRC_SOFT_RESET_WAIT_SNK_TX [rev2 POWER_NEGOTIATION] [ 204.167019] AMS POWER_NEGOTIATION finished [ 204.167020] cc:=4 [ 204.167083] AMS SOFT_RESET_AMS start [ 204.167086] state change SRC_SOFT_RESET_WAIT_SNK_TX -> SOFT_RESET_SEND [rev2 SOFT_RESET_AMS] [ 204.167092] PD TX, header: 0x16d [ 204.168824] PD TX complete, status: 0 [ 204.168854] pending state change SOFT_RESET_SEND -> HARD_RESET_SEND @ 60 ms [rev2 SOFT_RESET_AMS] [ 204.171876] PD RX, header: 0x43 [1] [ 204.171879] AMS SOFT_RESET_AMS finished
This causes COMMON.PROC.PD.11.2 check failure for TEST.PD.VDM.SRC.2_Rev2Src test on the PD compliance tester.
--- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +2 -0
@@ -5539,6 +5539,8 @@ static void run_state_machine(struct tcpusb_power_delivery_unregister_capabilities (port->partner_source_caps); port->partner_source_caps =NULL ;tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP ); + port->vdm_sm_running = false; + port->explicit_contract = false;tcpm_ams_finish (port);if (port->pwr_role ==TYPEC_SOURCE ) { port->upcoming_state =SRC_SEND_CAPABILITIES ;
Greg Kroah-Hartman
maintainerPATCH 183/201 io_uring/zcrx: use guards for locking
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 898ad80d1207cbdb22b21bafb6de4adfd7627bd0 upstream.
Convert last several places using manual locking to guards to simplify the code.
--- io_uring/zcrx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
io_uring/zcrx.c +7 -8
@@ -586,9 +586,8 @@ static void io_zcrx_return_niov_freelist {struct io_zcrx_area *area =io_zcrx_iov_to_area (niov); -spin_lock_bh (&area->freelist_lock); +guard (spinlock_bh)(&area->freelist_lock); area->freelist[area->free_count++] =net_iov_idx (niov); -spin_unlock_bh (&area->freelist_lock); }static void io_zcrx_return_niov (struct net_iov *niov)
@@ -1029,7 +1028,8 @@ static void io_zcrx_refill_slow(struct p {struct io_zcrx_area *area = ifq->area; -spin_lock_bh (&area->freelist_lock); +guard (spinlock_bh)(&area->freelist_lock); +while (area->free_count && pp->alloc.count <PP_ALLOC_CACHE_REFILL ) {struct net_iov *niov =__io_zcrx_get_free_niov (area);netmem_ref netmem =net_iov_to_netmem (niov);
@@ -1038,7 +1038,6 @@ static void io_zcrx_refill_slow(struct pio_zcrx_sync_for_device (pp, niov);net_mp_netmem_place_in_cache (pp, netmem); } -spin_unlock_bh (&area->freelist_lock); }static netmem_ref io_pp_zc_alloc_netmems (struct page_pool *pp,gfp_t gfp)
@@ -1264,10 +1263,10 @@ static struct net_iov *io_alloc_fallbackif (area->mem.is_dmabuf)return NULL ; -spin_lock_bh (&area->freelist_lock); -if (area->free_count) - niov =__io_zcrx_get_free_niov (area); -spin_unlock_bh (&area->freelist_lock); + scoped_guard(spinlock_bh, &area->freelist_lock) { +if (area->free_count) + niov =__io_zcrx_get_free_niov (area); + }if (niov)page_pool_fragment_netmem (net_iov_to_netmem (niov),1 );
Greg Kroah-Hartman
maintainerPATCH 184/201 io_uring/zcrx: warn on freelist violations
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 770594e78c3964cf23cf5287f849437cdde9b7d0 upstream.
The freelist is appropriately sized to always be able to take a free niov, but let's be more defensive and check the invariant with a warning. That should help to catch any double-free issues.
--- io_uring/zcrx.c | 2 ++ 1 file changed, 2 insertions(+)
io_uring/zcrx.c +2 -0
@@ -587,6 +587,8 @@ static void io_zcrx_return_niov_freeliststruct io_zcrx_area *area =io_zcrx_iov_to_area (niov);guard (spinlock_bh)(&area->freelist_lock); +if (WARN_ON_ONCE (area->free_count >= area->nia.num_niovs)) +return ; area->freelist[area->free_count++] =net_iov_idx (niov); }
Greg Kroah-Hartman
maintainerPATCH 185/201 kho: fix error handling in kho_add_subtree()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 9ec95329894864170a1a7685b9a11b739393131a ]
Fix two error handling issues in kho_add_subtree(), where it doesn't handle the error path correctly.
1. If fdt_setprop() fails after the subnode has been created, the subnode is not removed. This leaves an incomplete node in the FDT (missing "preserved-data" or "blob-size" properties).
2. The fdt_setprop() return value (an FDT error code) is stored directly in err and returned to the caller, which expects -errno.
Fix both by storing fdt_setprop() results in fdt_err, jumping to a new out_del_node label that removes the subnode on failure, and only setting err = 0 on the success path, otherwise returning -ENOMEM (instead of FDT_ERR_ errors that would come from fdt_setprop).
No user-visible changes. This patch fixes error handling in the KHO (Kexec HandOver) subsystem, which is used to preserve data across kexec reboots. The fix only affects a rare failure path during kexec preparation — specifically when the kernel runs out of space in the Flattened Device Tree buffer while registering preserved memory regions.
In the unlikely event that this error path was triggered, the old code would leave a malformed node in the device tree and return an incorrect error code to the calling subsystem, which could lead to confusing log messages or incorrect recovery decisions. With this fix, the incomplete node is properly cleaned up and the appropriate errno value is propagated, this error code is not returned to the user.
--- kernel/liveupdate/kexec_handover.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/liveupdate/kexec_handover.c +9 -4
@@ -757,13 +757,18 @@ int kho_add_subtree(const char *name, vo goto out_pack; } - err =fdt_setprop (root_fdt, off,KHO_FDT_SUB_TREE_PROP_NAME , - &phys,sizeof (phys)); -if (err <0 ) - goto out_pack; + fdt_err =fdt_setprop (root_fdt, off,KHO_FDT_SUB_TREE_PROP_NAME , + &phys,sizeof (phys)); +if (fdt_err <0 ) + goto out_del_node;WARN_ON_ONCE (kho_debugfs_fdt_add (&kho_out.dbg, name, fdt, false)); + err =0 ; + goto out_pack; + +out_del_node: +fdt_del_node (root_fdt, off); out_pack:fdt_pack (root_fdt);
Greg Kroah-Hartman
maintainerPATCH 186/201 EDAC/versalnet: Refactor memory controller initialization and cleanup
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shubhrajyoti Datta <[email protected]>
[ Upstream commit 62a9fc50e8d947601ea3484e732b1a65a0a54b96 ]
Simplify the initialization and cleanup flow for Versal Net DDRMC controllers in the EDAC driver by carving out the single controller init into a separate function which allows for a much better and more readable error handling and unwinding.
[ bp:
- do the kzalloc allocations first
- "publish" the structures only after they've been initialized properly so that you don't need to unwind unnecessarily when it fails later
- remove_versalnet() is now trivial
]
Stable-dep-of: 8cf5dd235eff ("EDAC/versalnet: Fix device name memory leak")
--- drivers/edac/versalnet_edac.c | 174 +++++++++++++++++++++++------------------- 1 file changed, 97 insertions(+), 77 deletions(-)
drivers/edac/versalnet_edac.c +97 -77
@@ -70,6 +70,8 @@#define XDDR5_BUS_WIDTH_32 1#define XDDR5_BUS_WIDTH_16 2 +#define MC_NAME_LEN 32 +/** * struct ecc_error_info - ECC error log information. * @burstpos: Burst position.
@@ -760,7 +762,17 @@ static void versal_edac_release(struct dkfree (dev); } -static int init_versalnet (struct mc_priv *priv,struct platform_device *pdev) +static void remove_one_mc (struct mc_priv *priv,int i) +{ +struct mem_ctl_info *mci; + + mci = priv->mci[i]; +device_unregister (mci->pdev); +edac_mc_del_mc (mci->pdev); +edac_mc_free (mci); +} + +static int init_one_mc (struct mc_priv *priv,struct platform_device *pdev,int i) {u32 num_chans, rank, dwidth, config;struct edac_mc_layer layers[2 ];
@@ -768,102 +780,110 @@ static int init_versalnet(struct mc_privstruct device *dev;enum dev_type dt;char *name; -int rc, i; +int rc; -for (i =0 ; i <NUM_CONTROLLERS ; i++) { - config = priv->adec[CONF + i *ADEC_NUM ]; - num_chans =FIELD_GET (MC5_NUM_CHANS_MASK , config); - rank =1 <<FIELD_GET (MC5_RANK_MASK , config); - dwidth =FIELD_GET (MC5_BUS_WIDTH_MASK , config); - -switch (dwidth) { -case XDDR5_BUS_WIDTH_16 : - dt =DEV_X16 ; -break ; -case XDDR5_BUS_WIDTH_32 : - dt =DEV_X32 ; -break ; -case XDDR5_BUS_WIDTH_64 : - dt =DEV_X64 ; -break ; -default : - dt =DEV_UNKNOWN ; - } + config = priv->adec[CONF + i *ADEC_NUM ]; + num_chans =FIELD_GET (MC5_NUM_CHANS_MASK , config); + rank =1 <<FIELD_GET (MC5_RANK_MASK , config); + dwidth =FIELD_GET (MC5_BUS_WIDTH_MASK , config); + +switch (dwidth) { +case XDDR5_BUS_WIDTH_16 : + dt =DEV_X16 ; +break ; +case XDDR5_BUS_WIDTH_32 : + dt =DEV_X32 ; +break ; +case XDDR5_BUS_WIDTH_64 : + dt =DEV_X64 ; +break ; +default : + dt =DEV_UNKNOWN ; + } -if (dt ==DEV_UNKNOWN ) -continue ; +if (dt ==DEV_UNKNOWN ) +return 0 ; -/* Find the first enabled device and register that one. */ - layers[0 ].type =EDAC_MC_LAYER_CHIP_SELECT ; - layers[0 ].size = rank; - layers[0 ].is_virt_csrow = true; - layers[1 ].type =EDAC_MC_LAYER_CHANNEL ; - layers[1 ].size = num_chans; - layers[1 ].is_virt_csrow = false; - - rc = -ENOMEM ; - mci =edac_mc_alloc (i,ARRAY_SIZE (layers), layers, -sizeof (struct mc_priv )); -if (!mci) { -edac_printk (KERN_ERR ,EDAC_MC ,"Failed memory allocation for MC%d\n" , i); - goto err_alloc; - } +/* Find the first enabled device and register that one. */ + layers[0 ].type =EDAC_MC_LAYER_CHIP_SELECT ; + layers[0 ].size = rank; + layers[0 ].is_virt_csrow = true; + layers[1 ].type =EDAC_MC_LAYER_CHANNEL ; + layers[1 ].size = num_chans; + layers[1 ].is_virt_csrow = false; - priv->mci[i] = mci; - priv->dwidth = dt; + rc = -ENOMEM ; + name =kzalloc (MC_NAME_LEN ,GFP_KERNEL ); +if (!name) +return rc; - dev =kzalloc_obj (*dev); - dev->release = versal_edac_release; - name =kmalloc (32 ,GFP_KERNEL ); -sprintf (name,"versal-net-ddrmc5-edac-%d" , i); - dev->init_name = name; - rc =device_register (dev); -if (rc) - goto err_alloc; + dev =kzalloc (sizeof (*dev),GFP_KERNEL ); +if (!dev) + goto err_name_free; - mci->pdev = dev; + mci =edac_mc_alloc (i,ARRAY_SIZE (layers), layers,sizeof (struct mc_priv )); +if (!mci) { +edac_printk (KERN_ERR ,EDAC_MC ,"Failed memory allocation for MC%d\n" , i); + goto err_dev_free; + } -platform_set_drvdata (pdev, priv); +sprintf (name,"versal-net-ddrmc5-edac-%d" , i); -mc_init (mci, dev); - rc =edac_mc_add_mc (mci); -if (rc) { -edac_printk (KERN_ERR ,EDAC_MC ,"Failed to register MC%d with EDAC core\n" , i); - goto err_alloc; - } - } -return 0 ; + dev->init_name = name; + dev->release = versal_edac_release; -err_alloc: -while (i--) { - mci = priv->mci[i]; -if (!mci) -continue ; - -if (mci->pdev) { -device_unregister (mci->pdev); -edac_mc_del_mc (mci->pdev); - } + rc =device_register (dev); +if (rc) + goto err_mc_free; -edac_mc_free (mci); + mci->pdev = dev; +mc_init (mci, dev); + + rc =edac_mc_add_mc (mci); +if (rc) { +edac_printk (KERN_ERR ,EDAC_MC ,"Failed to register MC%d with EDAC core\n" , i); + goto err_unreg; } + priv->mci[i] = mci; + priv->dwidth = dt; + +platform_set_drvdata (pdev, priv); + +return 0 ; + +err_unreg: +device_unregister (mci->pdev); +err_mc_free: +edac_mc_free (mci); +err_dev_free: +kfree (dev); +err_name_free: +kfree (name); +return rc; } -static void remove_versalnet (struct mc_priv *priv) +static int init_versalnet (struct mc_priv *priv,struct platform_device *pdev) { -struct mem_ctl_info *mci; -int i; +int rc, i;for (i =0 ; i <NUM_CONTROLLERS ; i++) { -device_unregister (priv->mci[i]->pdev); - mci =edac_mc_del_mc (priv->mci[i]->pdev); -if (!mci) -return ; + rc =init_one_mc (priv, pdev, i); +if (rc) { +while (i--) +remove_one_mc (priv, i); -edac_mc_free (mci); +return rc; + } } +return 0 ; +} + +static void remove_versalnet (struct mc_priv *priv) +{ +for (int i =0 ; i <NUM_CONTROLLERS ; i++) +remove_one_mc (priv, i); }static int mc_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 187/201 EDAC/versalnet: Fix device name memory leak
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prasanna Kumar T S M <[email protected]>
[ Upstream commit 8cf5dd235eff6008cb04c3d8064d2acfa90616f1 ]
The device name allocated via kzalloc() in init_one_mc() is assigned to dev->init_name but never freed on the normal removal path. device_register() copies init_name and then sets dev->init_name to NULL, so the name pointer becomes unreachable from the device. Thus leaking memory.
Use a stack-local char array instead of using kzalloc() for name.
--- drivers/edac/versalnet_edac.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/edac/versalnet_edac.c +2 -8
@@ -777,9 +777,9 @@ static int init_one_mc(struct mc_priv *pu32 num_chans, rank, dwidth, config;struct edac_mc_layer layers[2 ];struct mem_ctl_info *mci; +char name[MC_NAME_LEN ];struct device *dev;enum dev_type dt; -char *name;int rc; config = priv->adec[CONF + i *ADEC_NUM ];
@@ -813,13 +813,9 @@ static int init_one_mc(struct mc_priv *p layers[1 ].is_virt_csrow = false; rc = -ENOMEM ; - name =kzalloc (MC_NAME_LEN ,GFP_KERNEL ); -if (!name) -return rc; - dev =kzalloc (sizeof (*dev),GFP_KERNEL );if (!dev) - goto err_name_free; +return rc; mci =edac_mc_alloc (i,ARRAY_SIZE (layers), layers,sizeof (struct mc_priv ));if (!mci) {
@@ -858,8 +854,6 @@ err_mc_free:edac_mc_free (mci); err_dev_free:kfree (dev); -err_name_free: -kfree (name);return rc; }
Greg Kroah-Hartman
maintainerPATCH 188/201 spi: uniphier: Simplify clock handling with devm_clk_get_enabled()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit fdca270f8f87cae2eb5b619234b9dd11a863ce6b ]
Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for the clock. This removes the need for explicit clock enable and disable calls, as the managed API automatically handles clock disabling on device removal or probe failure.
Remove the now-unnecessary clk_disable_unprepare() calls from the probe error path and the remove callback. Adjust error labels accordingly.
Stable-dep-of: 0245435f7772 ("spi: uniphier: fix controller deregistration")
--- drivers/spi/spi-uniphier.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/spi/spi-uniphier.c +4 -14
@@ -666,28 +666,24 @@ static int uniphier_spi_probe(struct pla } priv->base_dma_addr = res->start; - priv->clk =devm_clk_get (&pdev->dev,NULL ); + priv->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (priv->clk)) {dev_err (&pdev->dev,"failed to get clock\n" ); ret =PTR_ERR (priv->clk); goto out_host_put; } - ret =clk_prepare_enable (priv->clk); -if (ret) - goto out_host_put; - irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = irq; - goto out_disable_clk; + goto out_host_put; } ret =devm_request_irq (&pdev->dev, irq, uniphier_spi_handler,0 ,"uniphier-spi" , priv);if (ret) {dev_err (&pdev->dev,"failed to request IRQ\n" ); - goto out_disable_clk; + goto out_host_put; }init_completion (&priv->xfer_done);
@@ -716,7 +712,7 @@ static int uniphier_spi_probe(struct plaif (IS_ERR_OR_NULL (host->dma_tx)) {if (PTR_ERR (host->dma_tx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto out_disable_clk; + goto out_host_put; } host->dma_tx =NULL ; dma_tx_burst =INT_MAX ;
@@ -766,9 +762,6 @@ out_release_dma: host->dma_tx =NULL ; } -out_disable_clk: -clk_disable_unprepare (priv->clk); - out_host_put:spi_controller_put (host);return ret;
@@ -777,14 +770,11 @@ out_host_put:static void uniphier_spi_remove (struct platform_device *pdev) {struct spi_controller *host =platform_get_drvdata (pdev); -struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);if (host->dma_tx)dma_release_channel (host->dma_tx);if (host->dma_rx)dma_release_channel (host->dma_rx); - -clk_disable_unprepare (priv->clk); }static const struct of_device_id uniphier_spi_match[] = {
Greg Kroah-Hartman
maintainerPATCH 189/201 spi: uniphier: fix controller deregistration
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 0245435f777264ac45945ed2f325dd095a41d1af ]
Make sure to deregister the controller before releasing underlying resources like DMA during driver unbind.
Note that clocks were also disabled before the recent commit fdca270f8f87 ("spi: uniphier: Simplify clock handling with devm_clk_get_enabled()").
--- drivers/spi/spi-uniphier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-uniphier.c +7 -1
@@ -746,7 +746,7 @@ static int uniphier_spi_probe(struct pla host->max_dma_len =min (dma_tx_burst, dma_rx_burst); - ret =devm_spi_register_controller (&pdev->dev, host); + ret =spi_register_controller (host);if (ret) goto out_release_dma;
@@ -771,10 +771,16 @@ static void uniphier_spi_remove(struct p {struct spi_controller *host =platform_get_drvdata (pdev); +spi_controller_get (host); + +spi_unregister_controller (host); +if (host->dma_tx)dma_release_channel (host->dma_tx);if (host->dma_rx)dma_release_channel (host->dma_rx); + +spi_controller_put (host); }static const struct of_device_id uniphier_spi_match[] = {
Greg Kroah-Hartman
maintainerPATCH 190/201 cgroup: Increment nr_dying_subsys_* from rmdir context
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Malat <[email protected]>
[ Upstream commit 13e786b64bd3fd81c7eb22aa32bf8305c32f2ccf ]
Incrementing nr_dying_subsys_* in offline_css(), which is executed by cgroup_offline_wq worker, leads to a race where user can see the value to be 0 if he reads cgroup.stat after calling rmdir and before the worker executes. This makes the user wrongly expect resources released by the removed cgroup to be available for a new assignment.
Increment nr_dying_subsys_* from kill_css(), which is called from the cgroup_rmdir() context.
Stable-dep-of: 93618edf7538 ("cgroup: Defer css percpu_ref kill on rmdir until cgroup is depopulated")
--- kernel/cgroup/cgroup.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
kernel/cgroup/cgroup.c +12 -10
@@ -5768,16 +5768,6 @@ static void offline_css(struct cgroup_suRCU_INIT_POINTER (css->cgroup->subsys[ss->id],NULL );wake_up_all (&css->cgroup->offline_waitq); - - css->cgroup->nr_dying_subsys[ss->id]++; -/* -* Parent css and cgroup cannot be freed until after the freeing -* of child css, see css_free_rwork_fn(). -*/ -while ((css = css->parent)) { - css->nr_descendants--; - css->cgroup->nr_dying_subsys[ss->id]++; - } }/**
@@ -6089,6 +6079,8 @@ static void css_killed_ref_fn(struct per*/ static void kill_css (struct cgroup_subsys_state *css) { +struct cgroup_subsys *ss = css->ss; +lockdep_assert_held (&cgroup_mutex);if (css->flags &CSS_DYING )
@@ -6125,6 +6117,16 @@ static void kill_css(struct cgroup_subsy* css is confirmed to be seen as killed on all CPUs. */ percpu_ref_kill_and_confirm (&css->refcnt, css_killed_ref_fn); + + css->cgroup->nr_dying_subsys[ss->id]++; +/* +* Parent css and cgroup cannot be freed until after the freeing +* of child css, see css_free_rwork_fn(). +*/ +while ((css = css->parent)) { + css->nr_descendants--; + css->cgroup->nr_dying_subsys[ss->id]++; + } }/**
Greg Kroah-Hartman
maintainerPATCH 191/201 cgroup: Defer css percpu_ref kill on rmdir until cgroup is depopulated
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
[ Upstream commit 93618edf753838a727dbff63c7c291dee22d656b ]
A chain of commits going back to v7.0 reworked rmdir to satisfy the controller invariant that a subsystem's ->css_offline() must not run while tasks are still doing kernel-side work in the cgroup.
[1] d245698d727a ("cgroup: Defer task cgroup unlink until after the task is done switching out")
[2] a72f73c4dd9b ("cgroup: Don't expose dead tasks in cgroup")
[3] 1b164b876c36 ("cgroup: Wait for dying tasks to leave on rmdir")
[4] 4c56a8ac6869 ("cgroup: Fix cgroup_drain_dying() testing the wrong condition")
[5] 13e786b64bd3 ("cgroup: Increment nr_dying_subsys_* from rmdir context")
[1] moved task cset unlink from do_exit() to finish_task_switch() so a task's cset link drops only after the task has fully stopped scheduling. That made tasks past exit_signals() linger on cset->tasks until their final context switch, which led to a series of problems as what userspace expected to see after rmdir diverged from what the kernel needs to wait for. [2]-[5] tried to bridge that divergence: [2] filtered the exiting tasks from cgroup.procs; [3] had rmdir(2) sleep in TASK_UNINTERRUPTIBLE for them; [4] fixed the wait's condition; [5] made nr_dying_subsys_* visible synchronously.
The cgroup_drain_dying() wait in [3] turned out to be a dead end. When the rmdir caller is also the reaper of a zombie that pins a pidns teardown (e.g. host PID 1 systemd reaping orphan pids that were re-parented to it during the same teardown), rmdir blocks in TASK_UNINTERRUPTIBLE waiting for those pids to free, the pids can't free because PID 1 is the reaper and it's stuck in rmdir, and the system A-A deadlocks. No internal lock ordering breaks this; the wait itself is the bug.
The css killing side that drove the original reorder, however, can be made cleanly asynchronous: ->css_offline() is already async, run from css_killed_work_fn() driven by percpu_ref_kill_and_confirm(). The fix is to make that chain start only after all tasks have left the cgroup. rmdir's user-visible side then returns as soon as cgroup.procs and friends are empty, while ->css_offline() still runs only after the cgroup is fully drained.
Verified by the original reproducer (pidns teardown + zombie reaper, runs under vng) which hangs vanilla and succeeds here, and by per-commit deterministic repros for [2], [3], [4], [5] with a boot parameter that widens the post-exit_signals() window so each state is reliably reachable. Some stress tests on top of that.
cgroup_apply_control_disable() has the same shape of pre-existing race:
when a controller is disabled via subtree_control, kill_css() ran synchronously while tasks past exit_signals() could still be linked to the cgroup's csets, and ->css_offline() could fire before they drained. This patch preserves the existing synchronous behavior at that call site (kill_css_sync() + kill_css_finish() back-to-back) and a follow-up patch will defer kill_css_finish() there using a per-css trigger.
This seems like the right approach and I don't see problems with it. The changes are somewhat invasive but not excessively so, so backporting to -stable should be okay. If something does turn out to be wrong, the fallback is to revert the entire chain ([1]-[5]) and rework in the development branch instead.
v2: Pin cgrp across the deferred destroy work with explicit
cgroup_get()/cgroup_put() around queue_work() and the work_fn. v1 wasn't actually broken (ordered cgroup_offline_wq + queue_work order in cgroup_task_dead() saved it) but the explicit ref removes the dependency on those non-obvious invariants. Also note the pre-existing cgroup_apply_control_disable() race in the description; a follow-up will defer kill_css_finish() there.
--- include/linux/cgroup-defs.h | 4 kernel/cgroup/cgroup.c | 250 ++++++++++++++++++++------------------------ 2 files changed, 119 insertions(+), 135 deletions(-)
include/linux/cgroup-defs.h +2 -2
@@ -609,8 +609,8 @@ struct cgroup {/* used to wait for offlining of csses */ wait_queue_head_t offline_waitq; -/* used by cgroup_rmdir() to wait for dying tasks to leave */ -wait_queue_head_t dying_populated_waitq; +/* defers killing csses after removal until cgroup is depopulated */ +struct work_struct finish_destroy_work;/* used to schedule release agent */ struct work_struct release_agent_work;
kernel/cgroup/cgroup.c +117 -133
368 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 192/201 sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit da2d81b4118a74e65d2335e221a38d665902a98c upstream.
bypass_lb_cpu() transfers tasks between per-CPU bypass DSQs without migrating them - task_cpu() only updates when the donee later consumes the task via move_remote_task_to_local_dsq(). If the LB timer fires again before consumption and the new DSQ becomes a donor, @p is still on the previous CPU and task_rq(@p) != donor_rq. @p can't be moved without its own rq locked.
Skip such tasks.
--- kernel/sched/ext.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/sched/ext.c +9 -0
@@ -4010,6 +4010,15 @@ resume:if (cpumask_empty (donee_mask))break ; +/* +* If an earlier pass placed @p on @donor_dsq from a different +* CPU and the donee hasn't consumed it yet, @p is still on the +* previous CPU and task_rq(@p) != @rq. @p can't be moved +* without its rq locked. Skip. +*/ +if (task_rq (p) != rq) +continue ; + donee =cpumask_any_and_distribute (donee_mask, p->cpus_ptr);if (donee >= nr_cpu_ids)continue ;
Greg Kroah-Hartman
maintainerPATCH 193/201 perf build: fix "argument list too long" in second location
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Mayer <[email protected]>
commit 97ab89686a9e5d087042dbe73604a32b3de72653 upstream
Turns out that displaying "RM $^" via quiet_cmd_rm can also upset the shell and cause it to display "argument list too long".
Trying to quote $^ doesn't help.
In the end, *not* displaying the (potentially long) list of files is probably the right thing to do for a "quiet" message, anyway. Instead, let's display a count of how many files were removed. There is always V=1 if more detail is required.
TEST linux/tools/perf/pmu-events/metric_test.log RM ...634 orphan file(s)... LD linux/tools/perf/util/perf-util-in.o
Also move the comment regarding xargs before the rule, so it doesn't show up in the build output.
--- tools/perf/pmu-events/Build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/pmu-events/Build +2 -2
@@ -211,10 +211,10 @@ ifneq ($(strip $(ORPHAN_FILES)),) # Message for $(call echo-cmd,rm). Generally cleaning files isn't part # of a build step. -quiet_cmd_rm = RM $^ +quiet_cmd_rm = RM ...$(words $^) orphan file(s)... +# The list of files can be long. Use xargs to prevent issues. prune_orphans: $(ORPHAN_FILES) - # The list of files can be long. Use xargs to prevent issues. $(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f JEVENTS_DEPS += prune_orphans
Greg Kroah-Hartman
maintainerPATCH 194/201 mm/vma: do not try to unmap a VMA if mmap_prepare() invoked from mmap()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes <[email protected]>
[ Upstream commit 619eab23e1ce7c97e54bfc5a417306d94b3f6f13 ]
The mmap_prepare hook functionality includes the ability to invoke mmap_prepare() from the mmap() hook of existing 'stacked' drivers, that is ones which are capable of calling the mmap hooks of other drivers/file systems (e.g. overlayfs, shm).
As part of the mmap_prepare action functionality, we deal with errors by unmapping the VMA should one arise. This works in the usual mmap_prepare case, as we invoke this action at the last moment, when the VMA is established in the maple tree.
However, the mmap() hook passes a not-fully-established VMA pointer to the caller (which is the motivation behind the mmap_prepare() work), which is detached.
So attempting to unmap a VMA in this state will be problematic, with the most obvious symptom being a warning in vma_mark_detached(), because the VMA is already detached.
It's also unncessary - the mmap() handler will clean up the VMA on error.
So to fix this issue, this patch propagates whether or not an mmap action is being completed via the compatibility layer or directly.
If the former, then we do not attempt VMA cleanup, if the latter, then we do.
This patch also updates the userland VMA tests to reflect the change.
--- include/linux/mm.h | 2 - mm/util.c | 51 +++++++++++++++++++++----------------- mm/vma.c | 3 -- tools/testing/vma/include/dup.h | 41 ++++++++++++++---------------- tools/testing/vma/include/stubs.h | 3 +- 5 files changed, 53 insertions(+), 47 deletions(-)
include/linux/mm.h +1 -1
@@ -4080,7 +4080,7 @@ static inline void mmap_action_ioremap_fint mmap_action_prepare (struct vm_area_desc *desc);int mmap_action_complete (struct vm_area_struct *vma, -struct mmap_action *action); +struct mmap_action *action,bool is_compat);/* Look up the first VMA which exactly match the interval vm_start ... vm_end */ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
mm/util.c +29 -22
99 lines not on this page · raw message
mm/vma.c +1 -2
@@ -2708,7 +2708,7 @@ static int call_action_complete(struct m {int err; - err =mmap_action_complete (vma, action); + err =mmap_action_complete (vma, action,/*is_compat=*/ false);/* If we held the file rmap we need to release it. */ if (map->hold_file_rmap_lock) {
@@ -2778,7 +2778,6 @@ static unsigned long __mmap_region(strucif (have_mmap_prepare && allocated_new) { error =call_action_complete (&map, &desc.action, vma); -if (error)return error; }
tools/testing/vma/include/dup.h +20 -21
80 lines not on this page · raw message
tools/testing/vma/include/stubs.h +2 -1
@@ -87,7 +87,8 @@ static inline int mmap_action_prepare(st }static inline int mmap_action_complete (struct vm_area_struct *vma, -struct mmap_action *action) +struct mmap_action *action, +bool is_compat) {return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 195/201 vsock: fix buffer size clamping order
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Norbert Szetei <[email protected]>
commit d114bfdc9b76bf93b881e195b7ec957c14227bab upstream.
In vsock_update_buffer_size(), the buffer size was being clamped to the maximum first, and then to the minimum. If a user sets a minimum buffer size larger than the maximum, the minimum check overrides the maximum check, inverting the constraint.
This breaks the intended socket memory boundaries by allowing the vsk->buffer_size to grow beyond the configured vsk->buffer_max_size.
Fix this by checking the minimum first, and then the maximum. This ensures the buffer size never exceeds the buffer_max_size.
--- net/vmw_vsock/af_vsock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/vmw_vsock/af_vsock.c +3 -3
@@ -1951,12 +1951,12 @@ static void vsock_update_buffer_size(strconst struct vsock_transport *transport, u64 val) { - if (val > vsk->buffer_max_size) - val = vsk->buffer_max_size; - if (val < vsk->buffer_min_size) val = vsk->buffer_min_size; +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; +if (val != vsk->buffer_size && transport && transport->notify_buffer_size) transport->notify_buffer_size (vsk, &val);
Greg Kroah-Hartman
maintainerPATCH 196/201 vsock/virtio: fix length and offset in tap skb for split packets
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit 5f344d809e015fba3709e5219428c00b8ac5d7df upstream.
virtio_transport_build_skb() builds a new skb to be delivered to the vsockmon tap device. To build the new skb, it uses the original skb data length as payload length, but as the comment notes, the original packet stored in the skb may have been split in multiple packets, so we need to use the length in the header, which is correctly updated before the packet is delivered to the tap, and the offset for the data.
This was also similar to what we did before commit 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") where we probably missed something during the skb conversion.
Also update the comment above, which was left stale by the skb conversion and still mentioned a buffer pointer that no longer exists.
--- net/vmw_vsock/virtio_transport_common.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/vmw_vsock/virtio_transport_common.c +6 -5
@@ -169,12 +169,12 @@ static struct sk_buff *virtio_transport_struct sk_buff *skb;size_t payload_len; -/* A packet could be split to fit the RX buffer, so we can retrieve -* the payload length from the header and the buffer pointer taking -* care of the offset in the original packet. +/* A packet could be split to fit the RX buffer, so we use +* the payload length from the header, which has been updated +* by the sender to reflect the fragment size. */ pkt_hdr =virtio_vsock_hdr (pkt); - payload_len = pkt->len; + payload_len =le32_to_cpu (pkt_hdr->len); skb =alloc_skb (sizeof (*hdr) +sizeof (*pkt_hdr) + payload_len,GFP_ATOMIC );
@@ -222,7 +222,8 @@ static struct sk_buff *virtio_transport_virtio_transport_copy_nonlinear_skb (pkt, data, payload_len); }else { -skb_put_data (skb, pkt->data, payload_len); +skb_put_data (skb, pkt->data +VIRTIO_VSOCK_SKB_CB (pkt)->offset, + payload_len); } }
Greg Kroah-Hartman
maintainerPATCH 197/201 vsock/virtio: fix empty payload in tap skb for non-linear buffers
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit 3a3e3d90cbc79600544536723911657730759af3 upstream.
For non-linear skbs, virtio_transport_build_skb() goes through virtio_transport_copy_nonlinear_skb() to copy the original payload in the new skb to be delivered to the vsockmon tap device. This manually initializes an iov_iter but does not set iov_iter.count. Since the iov_iter is zero-initialized, the copy length is zero and no payload is actually copied to the monitor interface, leaving data un-initialized.
Fix this by removing the linear vs non-linear split and using skb_copy_datagram_iter() with iov_iter_kvec() for all cases, as vhost-vsock already does. This handles both linear and non-linear skbs, properly initializes the iov_iter, and removes the now unused virtio_transport_copy_nonlinear_skb().
While touching this code, let's also check the return value of skb_copy_datagram_iter(), even though it's unlikely to fail.
--- net/vmw_vsock/virtio_transport_common.c | 40 +++++++++----------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
net/vmw_vsock/virtio_transport_common.c +12 -28
@@ -139,27 +139,6 @@ static void virtio_transport_init_hdr(st hdr->fwd_cnt =cpu_to_le32 (0 ); } -static void virtio_transport_copy_nonlinear_skb (const struct sk_buff *skb, -void *dst, -size_t len) -{ -struct iov_iter iov_iter = {0 }; -struct kvec kvec; -size_t to_copy; - - kvec.iov_base = dst; - kvec.iov_len = len; - - iov_iter.iter_type =ITER_KVEC ; - iov_iter.kvec = &kvec; - iov_iter.nr_segs =1 ; - - to_copy =min_t (size_t, len, skb->len); - -skb_copy_datagram_iter (skb,VIRTIO_VSOCK_SKB_CB (skb)->offset, - &iov_iter, to_copy); -} -/* Packet capture */ static struct sk_buff *virtio_transport_build_skb (void *opaque) {
@@ -217,13 +196,18 @@ static struct sk_buff *virtio_transport_skb_put_data (skb, pkt_hdr,sizeof (*pkt_hdr));if (payload_len) { -if (skb_is_nonlinear (pkt)) { -void *data =skb_put (skb, payload_len); - -virtio_transport_copy_nonlinear_skb (pkt, data, payload_len); - }else { -skb_put_data (skb, pkt->data +VIRTIO_VSOCK_SKB_CB (pkt)->offset, - payload_len); +struct iov_iter iov_iter; +struct kvec kvec; +void *data =skb_put (skb, payload_len); + + kvec.iov_base = data; + kvec.iov_len = payload_len; +iov_iter_kvec (&iov_iter,ITER_DEST , &kvec,1 , payload_len); + +if (skb_copy_datagram_iter (pkt,VIRTIO_VSOCK_SKB_CB (pkt)->offset, + &iov_iter, payload_len)) { +kfree_skb (skb); +return NULL ; } }
Greg Kroah-Hartman
maintainerPATCH 198/201 vsock/virtio: fix potential unbounded skb queue
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 upstream.
virtio_transport_inc_rx_pkt() checks vvs->rx_bytes + len > vvs->buf_alloc.
virtio_transport_recv_enqueue() skips coalescing for packets with VIRTIO_VSOCK_SEQ_EOM.
If fed with packets with len == 0 and VIRTIO_VSOCK_SEQ_EOM, a very large number of packets can be queued because vvs->rx_bytes stays at 0.
Fix this by estimating the skb metadata size:
(Number of skbs in the queue) * SKB_TRUESIZE(0)
--- net/vmw_vsock/virtio_transport_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/vmw_vsock/virtio_transport_common.c +3 -1
@@ -429,7 +429,9 @@ static int virtio_transport_send_pkt_infstatic bool virtio_transport_inc_rx_pkt (struct virtio_vsock_sock *vvs,u32 len) { -if (vvs->buf_used + len > vvs->buf_alloc) +u64 skb_overhead = (skb_queue_len (&vvs->rx_queue) +1 ) *SKB_TRUESIZE (0 ); + +if (skb_overhead + vvs->buf_used + len > vvs->buf_alloc)return false; vvs->rx_bytes += len;
Greg Kroah-Hartman
maintainerPATCH 199/201 vsock/virtio: fix accept queue count leak on transport mismatch
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
commit 52bcb57a4e8a0865a76c587c2451906342ae1b2d upstream.
virtio_transport_recv_listen() calls sk_acceptq_added() before vsock_assign_transport(). If vsock_assign_transport() fails or selects a different transport, the error path returns without calling sk_acceptq_removed(), permanently incrementing sk_ack_backlog.
After approximately backlog+1 such failures, sk_acceptq_is_full() returns true, causing the listener to reject all new connections.
Fix by moving sk_acceptq_added() to after the transport validation, matching the pattern used by vmci_transport and hyperv_transport.
--- net/vmw_vsock/virtio_transport_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +1 -2
@@ -1546,8 +1546,6 @@ virtio_transport_recv_listen(struct sockreturn -ENOMEM ; } -sk_acceptq_added (sk); -lock_sock_nested (child,SINGLE_DEPTH_NESTING ); child->sk_state =TCP_ESTABLISHED ;
@@ -1569,6 +1567,7 @@ virtio_transport_recv_listen(struct sockreturn ret; } +sk_acceptq_added (sk);if (virtio_transport_space_update (child, skb)) child->sk_write_space (child);
Greg Kroah-Hartman
maintainerPATCH 200/201 drm/amdgpu/vcn3: Avoid overflow on msg bound check
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Cheng <[email protected]>
commit e6e9faba8100628990cccd13f0f044a648c303cf upstream.
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -1
@@ -1972,6 +1972,7 @@ static int vcn_v3_0_dec_msg(struct amdgpfor (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1979,7 +1980,8 @@ static int vcn_v3_0_dec_msg(struct amdgp offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 201/201 drm/amdgpu/vcn4: Avoid overflow on msg bound check
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Cheng <[email protected]>
commit 65bce27ea6192320448c30267ffc17ffa094e713 upstream.
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +3 -1
@@ -1889,6 +1889,7 @@ static int vcn_v4_0_dec_msg(struct amdgpfor (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1896,7 +1897,8 @@ static int vcn_v4_0_dec_msg(struct amdgp offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Hi
no regressions here on x86_64 (Intel 11th Gen. CPU)
Thanks
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.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
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-7.0.y
Best regards,
Pavel
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Linux version 7.0.9-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 7.0.9-rc1rv-g64bd48307320
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 16.1.1 20260430, GNU ld (GNU Binutils) 2.46.0) #1 SMP PREEMPT_DYNAMIC Sat May 16 08:46:38 JST 2026
Thanks
Am 15.05.2026 um 17:46 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.0.9 release. There are 201 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 8 lines · On Fri, 15 May 2026 17:46:58 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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:
I also see the HID warning here:
https://lore.kernel.org/stable/[email protected]/
Thanks!
Cheers,
Miguel
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 7.0.9-rc1-g64bd48307320 #1 SMP PREEMPT_DYNAMIC Sat May 16 09:17:53 -00 2026 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 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
hello.
Compiled and booted 7.0.9-rc1+
No new typical dmesg regressions
.
--
software engineer
rajagiri school of engineering and technology
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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 Sun, 17 May 2026 15:46:37 +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/v7.x/stable-review/patch-7.0.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Tested on 2 different amd64 systems. Working well, no regressions observed.
Signature · 1 line
-Barry K. Nathan <[email protected]>
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.9 release. There are 201 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.