summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-07-21iommu/amd: Wait for completion instead of returning early in ↵Guanghui Feng
iommu_completion_wait() need_sync is a per-IOMMU flag shared by all domains and devices behind that IOMMU. It is set whenever a command is queued with sync == true and cleared when a completion-wait (CWAIT) command is queued. However, a cleared need_sync only means that a covering CWAIT has been queued, not that all previously queued commands have actually completed in hardware. iommu_completion_wait() read need_sync locklessly and returned early when it was false. This breaks the "block until all previously queued commands have completed" contract in a multi-CPU scenario: CPU2: queue inv-B => need_sync = true CPU1: queue CWAIT(N); need_sync = false; then wait_on_sem(N) CPU2: read need_sync == false => return 0 (no wait!) CPU2 returns without waiting for any sequence number even though its inv-B may not have completed yet (CWAIT(N), queued after inv-B, has not been signaled). CPU2 then proceeds to, for example, free page-table pages while the IOMMU can still walk stale translations, opening a use-after-free window. This is a logical race in the meaning of the flag, not a memory-visibility issue, so barriers alone do not help. Fix it without losing the optimization of avoiding redundant CWAIT commands: take iommu->lock before testing need_sync, and when it is false do not return early but wait for the last allocated sequence number (cmd_sem_val). Since need_sync == false implies no sync command was queued after the last CWAIT, that CWAIT is FIFO-ordered after every not-yet-completed command, so waiting for its sequence number guarantees all prior commands (possibly queued by another CPU) have completed. The common path with pending work is unchanged and no extra hardware command is issued. Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com> Fixes: 815b33fdc279 ("x86/amd-iommu: Cleanup completion-wait handling") Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Will Deacon <will@kernel.org>
2026-07-21ALSA: dummy: Properly shutdown the systimer at freeingTakashi Iwai
Add timer_shutdown_sync() call at the free callback for systimer backend, in order to make sure that we can release the resources. This is only for hardening, and there shouldn't be any actual issue that requires this change for now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260720135356.1779857-4-tiwai@suse.de
2026-07-21ALSA: dummy: Implement sync_stop for systimer, tooTakashi Iwai
The systimer backend invokes timer_delete() at stopping the PCM, but it misses its synchronization, which might lead to concurrent changes or releases at PCM prepare or free. Use the sync_stop callback to assure the synchronization of timer deletion. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260720135356.1779857-3-tiwai@suse.de
2026-07-21ALSA: dummy: Use the standard PCM sync_stop callback for hrtimerTakashi Iwai
The hrtimer backend code in ALSA dummy driver calls explicitly the synchronization of hrtimer cancel from prepare and free callbacks, and this is exactly what the standard PCM sync_stop callback serves for. Replace the open-code with the standard PCM sync_stop callback. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260720135356.1779857-2-tiwai@suse.de
2026-07-21Merge branch 'mlxsw-make-the-driver-ops-locked'Paolo Abeni
Ido Schimmel says: ==================== mlxsw: Make the driver ops-locked Make the driver ops-locked in order to allow ethtool operations to be invoked without RTNL being held. An ops-locked driver has most of its NDOs, all of its ethtool operations and some net device notifications run with the netdev instance lock held. In the specific case of mlxsw, the driver is not using any functions that acquire this lock nor functions that expect the lock to be held for an ops-locked driver. Therefore, converting its NDOs to run with the lock being held is trivial except for a small quirk which is handled in patch #1. The driver does not generate any net device notifications, so there is no risk of nested notifications of the ops-locked types. For the notifications that run under the instance lock, RTNL is also held, and the driver does not acquire the instance lock itself, so no changes are required in its notifier handling. Ethtool operations can be invoked without RTNL except for two operations that are annotated in patch #2. Lastly, patch #3 converts the driver to be ops-locked. A probe on rtnl_lock() shows it is no longer taken when dumping statistics: # perf probe --add rtnl_lock Before: # perf stat -e probe:rtnl_lock -- ethtool -S swp1 --all-groups [...] 1 probe:rtnl_lock After: # perf stat -e probe:rtnl_lock -- ethtool -S swp1 --all-groups [...] 0 probe:rtnl_lock No issues were reported after running a full regression with a debug config that has lockdep enabled. ==================== Link: https://patch.msgid.link/20260708123933.1303291-1-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21mlxsw: Tell the core to use the netdev instance lockIdo Schimmel
After the previous changes the driver is now ready to have its net device and ethtool operations invoked with the netdev instance lock held. Tell the core about it by setting request_ops_lock to true. Reviewed-by: Danielle Ratson <danieller@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708123933.1303291-4-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21mlxsw: ethtool: Prepare for RTNL-less ethtool operationsIdo Schimmel
A subsequent patch is going to make the driver ops-locked and allow ethtool operations to run without RTNL. In preparation for this change, tell the core about a couple of ethtool operations that should remain under RTNL: 1. Set pause parameters: Configures the port's headroom buffer which is also configured by RTNL-only paths such as DCB and qdisc. These paths can probably be converted to acquire the netdev instance lock, but this operation in not frequently called (unlike stats query), so avoid the added complexity for now. 2. Get link state: Calls ethtool_op_get_link() which requires RTNL. See commit 1105ef941c1a ("net: ethtool: keep rtnl_lock for ops using ethtool_op_get_link()"). All the other operations do not access shared resources, do not invoke helpers that require RTNL or already have the appropriate locking in place. Reviewed-by: Danielle Ratson <danieller@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708123933.1303291-3-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21mlxsw: Convert to async version of ndo_set_rx_modeIdo Schimmel
Commit c5b9b518adab ("mlxsw: spectrum: Add set_rx_mode ndo stub") added a stub for ndo_set_rx_mode to prevent dev_ifsioc() from returning an error for the SIOCADDMULTI and SIOCDELMULTI cases. Since then dev_ifsioc() was taught to also accept ndo_set_rx_mode_async and commit 3cbd22938877 ("net: warn ops-locked drivers still using ndo_set_rx_mode") modified register_netdevice() to warn when registering an ops-locked net device that still uses ndo_set_rx_mode instead of ndo_set_rx_mode_async. In preparation for converting the driver to be ops-locked, convert the ndo_set_rx_mode stub to a ndo_set_rx_mode_async stub. Reviewed-by: Danielle Ratson <danieller@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708123933.1303291-2-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21Merge branch 'bridge-mcast-fix-a-false-positive-lockdep-splat'Paolo Abeni
Ido Schimmel says: ==================== bridge: mcast: Fix a false positive lockdep splat Patch #1 fixes false positive lockdep splat. See the commit message for more details. Patch #2 is small cleanup following the previous patch. Targeting at net-next since this is a false positive that is only visible with lockdep enabled and the change is not small / trivial. v2: https://lore.kernel.org/netdev/20260430162604.1043756-1-idosch@nvidia.com/ v1: https://lore.kernel.org/netdev/20260426133435.207006-1-idosch@nvidia.com/ ==================== Link: https://patch.msgid.link/20260708122820.1298718-1-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21bridge: mcast: Remove unnecessary argument from br_multicast_alloc_query()Ido Schimmel
After the previous patch, __br_multicast_send_query() no longer relies on br_multicast_alloc_query() to determine the IGMP type of the query. Remove the argument. Reviewed-by: Petr Machata <petrm@nvidia.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708122820.1298718-3-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21bridge: mcast: Fix a false positive lockdep splatIdo Schimmel
Connecting two bridges on the same system [1] can result in a lockdep splat [2]. The report is a false positive. Multicast queries are built and transmitted under the bridge multicast lock. When the outgoing port of one bridge is configured on top of another bridge, the transmit path re-enters bridge code and acquires the other bridge's multicast lock in order to snoop the query. Both lock instances share a single lockdep class, so lockdep flags the nested acquisition as an AA deadlock. Giving each bridge its own lock class will not solve the problem: the reverse topology would produce an ABBA splat with the same pair of classes. It also consumes a lockdep key per bridge. Instead, fix the problem by deferring the transmission of the queries to a workqueue. Build the skb and update querier state under the lock as before, then enqueue the skb on a per multicast context queue and schedule the work. Purge the queue when the multicast context is de-initialized. At this stage the work cannot be requeued. There is no need to take a reference on skb->dev since the work cannot outlive the bridge or the bridge port. Use the high priority workqueue to reduce the delay between the enqueue time and the transmission time. With default settings (i.e., querier interval - 255 seconds, query interval - 125 seconds) the extra delay should not be a problem. Avoid the unlikely case of the queue growing endlessly by limiting it to 1,000 skbs. Use this number for the simple reason that this is the default Tx queue length. Use local_bh_{disable,enable}() to disable/enable softIRQs and migration in order to avoid corrupting the multicast statistics (per-CPU u64_stats). [1] ip link add name br1 up type bridge mcast_snooping 1 mcast_querier 1 ip link add name br0 up type bridge mcast_snooping 1 mcast_querier 1 ip link add link br0 name br0.10 up master br1 type vlan id 10 [2] WARNING: possible recursive locking detected 7.0.0-virtme-gb50c64a58a90 #1 Not tainted [...] ip/339 is trying to acquire lock: ffff888104f0b480 (&br->multicast_lock){+.-.}-{3:3}, at: br_ip6_multicast_query (net/bridge/br_multicast.c:3584) but task is already holding lock: ffff888104f03480 (&br->multicast_lock){+.-.}-{3:3}, at: br_multicast_port_query_expired (net/bridge/br_multicast.c:1904) [...] Call Trace: [...] br_ip6_multicast_query (net/bridge/br_multicast.c:3584) br_multicast_ipv6_rcv (net/bridge/br_multicast.c:3988) br_dev_xmit (net/bridge/br_device.c:98 (discriminator 1)) dev_hard_start_xmit (net/core/dev.c:3904) __dev_queue_xmit (net/core/dev.c:4871) vlan_dev_hard_start_xmit (net/8021q/vlan_dev.c:131 (discriminator 1)) dev_hard_start_xmit (net/core/dev.c:3904) __dev_queue_xmit (net/core/dev.c:4871) br_dev_queue_push_xmit (net/bridge/br_forward.c:60) __br_multicast_send_query (net/bridge/br_multicast.c:1811 (discriminator 1)) br_multicast_send_query (net/bridge/br_multicast.c:1889) br_multicast_port_query_expired (net/bridge/br_multicast.c:1914) call_timer_fn (kernel/time/timer.c:1749) [...] Reported-by: syzbot+d7b7f1412c02134efa6d@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/000000000000c4c9d405f2643e01@google.com/ Reviewed-by: Petr Machata <petrm@nvidia.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708122820.1298718-2-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21net: ipip: use tunnel parameters for fill_forward_path route lookupLorenzo Bianconi
Pass source address, DSCP and output interface from the tunnel configuration to ip_route_output() in ipip_fill_forward_path(), aligning the route lookup with the slow path in ipip_tunnel_xmit(). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20260708-ipip-route-lookup-fill_forward_path-v1-1-b77df74822ed@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21dmaengine: dw-edma: Program endpoint function numbersKoichiro Den
The eDMA/HDMA transfers the driver issues carry a requester function number in their TLPs, but nothing ever programs it: eDMA v0 leaves the FUNC_NUM field of the channel control word zero and HDMA leaves the per-channel func_num register at its reset value, so every transfer is attributed to function 0. That is invisible in single-function setups, but once the DMA block serves a non-zero endpoint function, its requests must carry that function's number for the host to attribute and translate them correctly. Record the function number in the chip data (PCI_FUNC() of the probing device for dw-edma-pcie) and program it per channel. Endpoint-local chip instances keep func_no at 0, so transfers issued by the endpoint-side driver remain PF0-attributed. Delegated channels are programmed by the host-side dw-edma-pcie instance when it takes over the channel, using that instance's PCI_FUNC(). Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-15-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Add chip flags to match dataKoichiro Den
Allow PCI ID match data to pass dw_edma_chip flags into dw_edma_probe(). This keeps per-device policy in the match data instead of open-coding it in probe(). Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-14-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Handle optional data blocksKoichiro Den
Skip data block BAR mapping and debug output when a channel has no data block size. This lets future providers describe channels that only need descriptor memory exposed. No functional change intended for existing Synopsys EDDA and AMD (Xilinx) MDB/CPM6 devices. Their static channel descriptions still provide data block sizes where data block windows are used. A zero-sized data block now means "not present" for future metadata providers. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-13-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Factor out descriptor block address lookupKoichiro Den
Add an optional physical address override to struct dw_edma_block and use a helper to compute descriptor block addresses. No functional change intended. Existing Synopsys EDDA and AMD (Xilinx) MDB/CPM6 block descriptors leave the override unset, so the helper still returns the same values as before. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-12-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Add register offset match flagKoichiro Den
Add a match-data flag for devices whose DMA register block starts at an offset inside the mapped BAR. Existing Synopsys EDDA and AMD (Xilinx) MDB/CPM6 matches keep using the BAR mapping base directly. The offsets handled here come from static, trusted match data. Later metadata-derived offsets are validated when the endpoint DMA metadata path parses them at that trust boundary. No functional change intended. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-11-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Add platform ops to match dataKoichiro Den
Move the platform ops pointer into match data. Existing EDDA/MDB/CPM6 matches keep using dw_edma_pcie_plat_ops. No functional changes intended. Suggested-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-10-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Rename vsec_data to dma_dataKoichiro Den
dw_edma_pcie_probe() now obtains DMA layout data through device-specific capability callbacks, not only from PCIe Vendor-Specific Extended Capabilities. Rename the local data copy from vsec_data to dma_data before adding endpoint DMA BAR metadata discovery, which does not rely on VSEC. No functional change intended. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-9-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Add capability match dataKoichiro Den
Move device-specific capability parsing behind per-device match data. The existing probe path mixes two decisions: which static template a PCI ID uses, and which device-specific capability parser adjusts that template. Split those decisions so device-specific discovery can be added through match data instead of adding more vendor checks to dw_edma_pcie_probe(). No functional change is intended for the existing Synopsys EDDA and AMD (Xilinx) MDB/CPM6 matches. They still copy the same static template data and run the same capability parsing logic before BAR mapping. The AMD (Xilinx) MDB/CPM6 entries also keep using endpoint memory physical addresses for descriptor windows through a new match-data flag. Suggested-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-8-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma-pcie: Track non-LL mode in DMA dataKoichiro Den
The dw-edma-pcie driver copies static template data into a mutable dw_edma_pcie_data instance before applying capability-derived updates. Keep the derived non-LL mode in that copy as well, instead of only tracking it in a local variable in dw_edma_pcie_probe(). This prepares for keeping capability parsing behind match data without a separate non-LL output parameter. No functional change intended. Suggested-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-7-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma: Add partial channel ownership modeKoichiro Den
A DesignWare eDMA instance may represent only a subset of channels that is also initialized by another OS instance, such as an endpoint-side OS. Add a partial ownership flag for instances that must preserve controller-wide state owned by that peer. In partial ownership mode, dw-edma skips the initial core reset and uses the limited quiesce path in probe() and remove() instead of the full core-off path. The flag also makes the driver validate the ownership granularity required by each register layout before registering channels. Probe fails if the limited quiesce cannot stop its resources; remove reports the error after completing the remaining driver teardown. Partial instances also skip interrupt-emulation doorbell allocation: the emulated doorbell is a controller-level resource, and a partial owner must not claim it on behalf of the whole block. For EDMA_MF_EDMA_UNROLL and EDMA_MF_HDMA_COMPAT, the driver programs per-direction registers, such as DMA_{WRITE,READ}_INT_MASK_OFF and DMA_{WRITE,READ}_INT_CLEAR_OFF. These register layouts have at most EDMA_MAX_{WR,RD}_CH channels per direction, so the capped hardware channel count still represents the whole direction. A partial instance can therefore expose write or read channels only if it owns every channel in that direction; otherwise two OS instances could update the same direction-wide registers without a shared locking protocol. In contrast, HDMA native uses per-channel registers, so it can be owned at channel granularity. Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-6-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma: Initialize IRQ data before requesting IRQsKoichiro Den
dw_edma_irq_request() passes struct dw_edma_irq to request_irq() before dw_edma_channel_setup() fills the back pointer. A shared interrupt can therefore enter the handler with dw_irq->dw still NULL, leading to a NULL pointer dereference. Set the back pointer before installing each handler. Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Cc: stable@vger.kernel.org Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-5-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma: Add core quiesce operationsKoichiro Den
Add core operations that quiesce only the resources represented by a dw-edma instance, separate from the existing full controller off path. For unrolled eDMA, quiesce masks the direction, disables ENGINE_EN, waits for it to read back clear, then clears pending interrupt status. If ENGINE_EN does not clear, return the timeout to the caller. HDMA compatibility mode does not implement ENGINE_EN, so quiesce clears CHi_PWR_EN for each represented channel instead. Both register maps share interrupt control per direction, so quiescing one channel quiesces the whole direction. Callers must own that direction and stop the peer from programming it first. HDMA native has per-channel registers and can quiesce the represented channel directly. No caller is added yet, so this is a no-functional-change preparation for delegated channel reclaim and partial-owned remove paths. Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-4-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma: Add per-channel interrupt routing controlKoichiro Den
DesignWare eDMA can signal completion locally through edma_int[] and remotely through IMWr/MSI. When channels are delegated to a remote frontend, the local endpoint side and the remote host side must not both service the same DONE/ABORT status. Add channel interrupt routing state and initialize it from the controller instance configuration. Update the eDMA and HDMA native paths so linked-list interrupt generation, HDMA non-linked-list interrupt enables, and DONE/ABORT masking follow the selected mode. For HDMA native non-linked-list channels, keep the local stop/abort enables set so status is latched. In remote mode, also enable remote signaling and mask the local interrupt pins. Keep the existing dw-edma-pcie host-side instances in remote interrupt routing mode so their IMWr/MSI completion model remains unchanged after local routing becomes the zero value. Note: - The routing mode describes where a channel should report completion. It does not by itself say whether this dw-edma instance owns the interrupt status. A local instance must ignore remote-only channels, and a remote instance must ignore local-only channels, even if such interrupts are unexpectedly delivered. Otherwise the non-owner side could steal the interrupt from the owner by clearing shared DONE/ABORT status. Cc: Devendra K Verma <devendra.verma@amd.com> Suggested-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-3-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21dmaengine: dw-edma: Factor out HDMA interrupt setup helperKoichiro Den
The HDMA linked-list and non-linked-list start paths both program the stop/abort interrupt setup register using the same local/remote enable policy. Only the interrupt-mask handling differs by transfer mode. Factor the common setup into dw_hdma_v0_core_int_setup() before adding per-channel interrupt routing support. No functional change intended. Suggested-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Koichiro Den <den@valinux.co.jp> Link: https://patch.msgid.link/20260721062815.4117887-2-den@valinux.co.jp Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-07-21Merge tag 'kvm-riscv-fixes-7.2-1' of https://github.com/kvm-riscv/linux into ↵Paolo Bonzini
HEAD KVM/riscv fixes for 7.2, take #1 - Avoid redundant page-table allocations in ioremap pcache topup - Apply SBI FWFT LOCK flag only on successful set - Bound SBI PMU counter mask scan to BITS_PER_LONG - Skip TLB flush when G-stage PTE becomes valid with Svvptc - Zicbo[m|z|p] block sizes should be always present in ONE_REG - Inject instruction access fault on unmapped guest fetch - Serialize virtual interrupt pending state updates using raw spinlock - Fix Spectre-v1 in vector register access via ONE_REG
2026-07-21KVM: x86: Only reset TSC Deadline Timer in apic_timer_expired on KVM_RUNVenkatesh Srinivas
On Intel platforms with a VMX preemption timer and APICv, if a VMM calls KVM_GET_LAPIC before KVM_GET_MSRS to save the vCPU state, it is possible to lose a pending timer interrupt. If the thread running these ioctls is migrated to another core after calling KVM_GET_LAPIC but before KVM_GET_MSRS and the guest is using their LAPIC timer in TSC-deadline mode, not only does the save LAPIC state not carry the pending interrupt, the TSCDEADLINE MSR will be zeroed. After migration across CPUs, KVM_GET_MSRS calls vcpu_load, posting the interrupt and clearing the MSR: vcpu_load() -> kvm_arch_vcpu_load() -> kvm_lapic_restart_hv_timer() -> start_hv_timer() -> apic_timer_expired() -> kvm_apic_inject_pending_timer_irqs() . post interrupt into the LAPIC state . clear IA32_TSCDEADLINE The saved LAPIC state will be missing the pending interrupt and the saved MSR will be zero. Oops. Fix by only posting an interrupt when we're attempting to enter the guest (vcpu->wants_to_run == true), not for vcpu_load from other paths. Assisted-by: gemini:gemini-3.1-pro-preview Debugged-by: David Matlack <dmatlack@google.com> Debugged-by: Sean Christopherson <seanjc@google.com> Debugged-by: Jim Mattson <jmattson@google.com> Debugged-by: James Houghton <jthoughton@google.com> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org> Message-ID: <20260715234234.15382-2-venkateshs@chromium.org> Reviewed-by: James Houghton <jthoughton@google.com> Reviewed-by: Chao Gao <chao.gao@intel.com> Cc: stable@vger.kernel.org Fixes: ae95f566b3d2 ("KVM: X86: TSCDEADLINE MSR emulation fastpath", 2020-05-15) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: selftests: sev_init2_tests: Derive SEV availability from KVMDavid Woodhouse
The test asserted that the X86_FEATURE_SEV CPUID bit exactly matches whether KVM offers KVM_X86_SEV_VM. That is not an invariant: when all SEV ASIDs are assigned to SEV-SNP, KVM does not offer the SEV VM type even though CPUID reports SEV, so the test aborts on an SNP-only host. Derive SEV availability from KVM_CAP_VM_TYPES (as already done for SEV-ES and SNP), assert only the one-way implication that a type offered by KVM is also reported in CPUID, and TEST_REQUIRE() the SEV VM type so the test skips cleanly when it is unavailable. Reviewed-by: Tycho Andersen (AMD) <tycho@kernel.org> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-ID: <5d3c345113748f39b7982e365d241abaf3e11086.1784545391.git.dwmw@amazon.co.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: selftests: sev_smoke_test: Only run VM types the host offersDavid Woodhouse
sev_smoke_test ran the plain SEV subtest unconditionally, gated only on the X86_FEATURE_SEV CPUID bit, while gating SEV-ES and SNP on the KVM_CAP_VM_TYPES bits. CPUID reporting SEV does not mean KVM offers the SEV VM type: when all SEV ASIDs are assigned to SEV-SNP, KVM_X86_SEV_VM is unavailable even though X86_FEATURE_SEV is set. On such a host the test aborts in KVM_CREATE_VM instead of exercising the available modes. Gate the SEV subtest on KVM_CAP_VM_TYPES like the others, so the test runs the VM types the host actually offers. Reviewed-by: Tycho Andersen (AMD) <tycho@kernel.org> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-ID: <2b5e7a83d277134294199a455469bb436196b902.1784545391.git.dwmw@amazon.co.uk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: x86/mmu: Fix use-after-free on vendor module reloadPhil Rosenthal
mmu_destroy_caches() destroys pte_list_desc_cache and mmu_page_header_cache, but leaves both pointers unchanged. The pointers live in kvm.ko, and therefore survive when a vendor module is unloaded while kvm.ko remains loaded. If creation of pte_list_desc_cache fails during a subsequent vendor module load, its assignment sets pte_list_desc_cache to NULL and the error path calls mmu_destroy_caches(). mmu_page_header_cache still points to the cache destroyed during the preceding vendor module unload. Passing that stale pointer to kmem_cache_destroy() causes a slab use-after-free. Reproduce the issue on a v7.1.3 kernel with CONFIG_KASAN=y, CONFIG_KASAN_GENERIC=y, CONFIG_KVM=m, and CONFIG_KVM_INTEL=m. A one-shot test hook forces pte_list_desc_cache to NULL on the second invocation of kvm_mmu_vendor_module_init(): 1. Load kvm.ko and kvm-intel.ko, creating both caches. 2. Unload only kvm_intel, leaving kvm.ko loaded. 3. Reload kvm_intel and force initialization through the -ENOMEM path. KASAN reports: BUG: KASAN: slab-use-after-free in kvm_mmu_vendor_module_init+0x5b/0x170 [kvm] ... kmem_cache_destroy+0x21/0x1d0 kvm_mmu_vendor_module_init+0x5b/0x170 [kvm] ... Allocated by task 16817: __kmem_cache_create_args+0x12c/0x3b0 __kmem_cache_create.constprop.0+0xb6/0xf0 [kvm] kvm_mmu_vendor_module_init+0x13b/0x170 [kvm] ... Freed by task 16820: kmem_cache_destroy+0x117/0x1d0 kvm_mmu_vendor_module_exit+0x21/0x30 [kvm] Clear both pointers immediately after destroying their caches so that the stored state reflects the caches' lifetime and repeated cleanup is safe. With the fix applied, the same injected vendor module reload fails with -ENOMEM as expected and produces no KASAN report. Fixes: cb498ea2ce1d ("KVM: Portability: Combine kvm_init and kvm_init_x86") Cc: stable@vger.kernel.org Signed-off-by: Phil Rosenthal <phil@phil.gs> Message-ID: <20260718-kvm-mmu-cache-uaf-v3-1-e103b93c74e1@phil.gs> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: x86/mmu: Preserve nested TDP shadow page tables if they are used as rootsHyunwoo Kim
kvm_mmu_zap_oldest_mmu_pages() excludes a shadow page whose root_count is non-zero from top-level reclaim, because such a page cannot be freed. The path in mmu_page_zap_pte() that recursively zaps a parentless nested TDP child has no such check. As a result, a shadow page can be zapped even if the page itself can't be freed; as the comment in kvm_mmu_zap_oldest_mmu_pages() notes, zapping it will just force vCPUs to rebuild the page. As in top-level reclaim, do not recursively prepare zapping of a nested TDP child whose root_count is non-zero. Fixes: 2de4085cccea ("KVM: x86/MMU: Recursively zap nested TDP SPs when zapping last/only parent") Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: x86: Check for invalid/obsolete root *after* making MMU pages availableSean Christopherson
Check for a "stale" page fault, i.e. for an invalid and/or obsolete root, after making MMU pages available for the shadow MMU. If reclaiming shadow pages zaps an in-use root, i.e. marks it invalid, then KVM will attempt to map memory into an invalid root. On its own, populating an invalid root is "fine", but because child shadow pages inherit their parent's role, any children created during the map/fetch will be created as invalid pages, thus violating KVM's invariant that invalid pages are never on the list of active MMU pages. Note, the underlying flaw has existed since KVM first started tracking invalid roots in 2008 (commit 2e53d63acba7, "KVM: MMU: ignore zapped root pagetables"), but the true badness only came along in 2020 (Linux 5.9) with the invariant that invalid shadow pages can't be on the list of active pages. Note #2, inheriting role.invalid when creating child shadow pages is also far from ideal; that flaw will be addressed separately. Reported-by: Hyunwoo Kim <imv4bel@gmail.com> Fixes: f95eec9bed76 ("KVM: x86/mmu: Don't put invalid SPs back on the list of active pages") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21KVM: nVMX: Hide shadow VMCS right after VMCLEARHyunwoo Kim
free_nested() frees the shadow VMCS while vmcs01 still points to it. But because it is asynchronous with respect to loaded_vmcs_clear(), the vCPU might migrate before the pointer is cleared and __loaded_vmcs_clear() may then execute VMCLEAR. The VMCS needs to stay attached until its explicit VMCLEAR completes, but then it can be hidden and the page safely freed. Fixes: 355f4fb1405e ("kvm: nVMX: VMCLEAR an active shadow VMCS after last use") Cc: stable@vger.kernel.org Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-07-21net: airoha: Fix DMA direction for NPU mailbox bufferWayen Yan
airoha_npu_send_msg() always maps the mailbox buffer with DMA_TO_DEVICE, but some callers expect the NPU to write response data back into the same buffer: - airoha_npu_wlan_msg_get() (NPU_OP_GET): NPU writes response into the buffer, then the caller reads it via memcpy() - airoha_npu_ppe_stats_setup() (NPU_OP_SET): NPU writes back npu_stats_addr field in the response On non-cache-coherent architectures like EN7581 (Cortex-A53 without hardware cache coherency for NPU DMA), DMA_TO_DEVICE unmap is a no-op — it does not invalidate the CPU cache. If the NPU-written cache line is still present in the CPU cache when the caller reads the buffer, the CPU observes stale data instead of the NPU response. This is a timing-sensitive bug: small mailbox buffers (~24 bytes) typically fit in a single cache line and may survive in the cache until the caller reads them, producing silent data corruption rather than a crash. The bug is more likely to trigger when the caller reads the response immediately after dma_unmap_single() without intervening cache-evicting operations. Fix by using DMA_BIDIRECTIONAL for both map and unmap, which ensures dma_unmap_single() invalidates the CPU cache on non-coherent systems. The mailbox buffers are small so there is no performance concern. Fixes: c52918744ee1e49cea86622a2633b9782446428f ("net: airoha: npu: Move memory allocation in airoha_npu_send_msg() caller") Signed-off-by: Wayen Yan <win847@gmail.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/178351055214.98729.11403147818632027428@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21dpaa2-eth: put MAC endpoint device on disconnectGuangshuo Li
fsl_mc_get_endpoint() returns the MAC endpoint device with a reference taken through device_find_child(). The Ethernet connect path stores that device in mac->mc_dev and keeps it for the lifetime of the connected MAC object. However, the disconnect path only disconnects and closes the MAC before freeing the dpaa2_mac object. It does not drop the endpoint device reference stored in mac->mc_dev, so every successful connect leaks that device reference when the MAC is later disconnected. Drop the endpoint device reference after closing the MAC and before freeing the dpaa2_mac object. Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com> Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com> Link: https://patch.msgid.link/20260708111738.750391-1-lgs201920130244@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21KVM: arm64: Update Fuad Tabba's email addressFuad Tabba
Switch my KVM/arm64 reviewer entry to fuad.tabba@linux.dev, my canonical address for kernel work, and add a .mailmap entry so the existing tabba@google.com commits map onto it. Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260719163257.3156529-1-fuad.tabba@linux.dev Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-07-21KVM: arm64: vgic: Avoid double-deactivate of IRQs in the nested contextD Scott Phillips
In the nested state, the physical interrupt has already been deactivated through the HW bit in the LR. The extra deactivation would be harmless but can hit an errata case on AmpereOne, so avoid it here. On AmpereOne, deactivating a physical interrupt through ICC_DIR_EL1 or ICC_EOIR1_EL1 (depending on EOImode) which is not active, but is the highest priority pending interrupt causes the cpu to lose the interrupt pending state and also prevents the delivery of future interrupts. Fixes: 6dd333c8942b2 ("KVM: arm64: GICv3: nv: Plug L1 LR sync into deactivation primitive") Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-arm-kernel/20260710222128.416581-1-scott@os.amperecomputing.com/ Link: https://patch.msgid.link/20260714231158.496808-1-scott@os.amperecomputing.com Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-07-21net: airoha: Fix potential use-after-free in airoha_ppe_deinit()Wayen Yan
airoha_ppe_deinit() replaces the NPU pointer with NULL via rcu_replace_pointer() but does not wait for existing RCU readers to exit before calling ppe_deinit() and airoha_npu_put(). This can cause a use-after-free if a reader in an RCU read-side critical section still holds a reference to the NPU when it is freed. The init path (airoha_ppe_init) already calls synchronize_rcu() after rcu_assign_pointer(), but the deinit path introduced in commit 6abcf751bc08 ("net: airoha: Fix schedule while atomic in airoha_ppe_deinit()") omitted the matching barrier when switching from rcu_read_lock()/rcu_dereference() to rcu_replace_pointer(). Add synchronize_rcu() before ppe_deinit() to ensure all existing RCU readers have completed before the NPU resources are released. Fixes: 6abcf751bc084804a9e5b3051442e8a2ce67f48a ("net: airoha: Fix schedule while atomic in airoha_ppe_deinit()") Signed-off-by: Wayen Yan <win847@gmail.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/178351022574.97989.6880403520276841703@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21dpaa2-switch: put MAC endpoint device on disconnectGuangshuo Li
fsl_mc_get_endpoint() returns the MAC endpoint device with a reference taken through device_find_child(). The switch port connect path stores that device in mac->mc_dev and keeps it for the lifetime of the connected MAC object. However, the disconnect path only closes the MAC and frees the dpaa2_mac object. It does not drop the endpoint device reference stored in mac->mc_dev, so every successful connect leaks that device reference when the MAC is later disconnected. Drop the endpoint device reference before freeing the dpaa2_mac object. Fixes: 84cba72956fd ("dpaa2-switch: integrate the MAC endpoint support") Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260708111025.749311-1-lgs201920130244@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21Merge branch 'vsock-virtio-collapse-receive-queue-under-memory-pressure'Paolo Abeni
Stefano Garzarella says: ==================== vsock/virtio: collapse receive queue under memory pressure This series contains a patch (the first one) that is part of work I'm doing to improve the tracking of memory used by AF_VSOCK sockets. The second patch is a test for our suite that highlights the issue. Since Brien reported an issue with his environment (based on Linux 6.12.y) related to the work I’m doing, I extracted this patch and tried to make it as easy as possible to backport. Brien tested it by backporting it to 6.12.y, which now contains the backport of the 059b7dbd20a6 ("vsock/virtio: fix potential unbounded skb queue"). This patch primarily fixes STREAM sockets, but also partially fixes SEQPACKET (with the exception of EOMs, which are kept in separate skbs to avoid overcomplicating the code). The rest of the work, I feel, is more net-next material and still needs some work to be completed. v1: https://lore.kernel.org/netdev/20260626134823.206676-1-sgarzare@redhat.com/ ==================== Link: https://patch.msgid.link/20260708102904.50732-1-sgarzare@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21vsock/test: add test for small packets under pressureStefano Garzarella
Add a test that sends 2 MB of data using randomly sized small packets (129-512 bytes) over a SOCK_STREAM connection. Packets above GOOD_COPY_LEN (128) bypass the in-place coalescing in recv_enqueue(), forcing each one into its own skb. Without receive queue collapsing, the per-skb overhead eventually exceeds buf_alloc and the connection is reset. The test verifies that all data arrives and that content integrity is preserved. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260708102904.50732-3-sgarzare@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21vsock/virtio: collapse receive queue under memory pressureStefano Garzarella
When many small packets accumulate in the receive queue, the skb overhead can exceed buf_alloc even while the payload is within bounds. This causes virtio_transport_inc_rx_pkt() to reject packets, leading to connection resets during large transfers under backpressure. The issue was reported by Brien, who has a reproducer, but it is also easily reproducible with iperf-vsock [1] using a small packet size: iperf3 --vsock -c $CID -l 129 which fails immediately without this patch but with commit 059b7dbd20a6 ("vsock/virtio: fix potential unbounded skb queue"). Inspired by TCP's tcp_collapse() which solves a similar problem, add virtio_transport_collapse_rx_queue() that walks the receive queue and re-copies data into compact linear skbs to reduce the overhead. The collapse is triggered proactively from when the number of skb queued is close to exceeding the overhead budget. A pre-scan counts the eligible bytes to size each allocation precisely, avoiding waste for isolated small packets. Partially consumed skbs are kept as-is to preserve buf_used/fwd_cnt accounting, EOM-marked skbs to maintain SEQPACKET message boundaries, and skbs already larger than the collapse target because they already have a good data-to-overhead ratio. Walking a large queue may take a significant amount of time and cache misses, causing traffic burstiness. To limit this, the collapse stops once enough room is freed for this packet and the next one, but may opportunistically free more to fill each collapsed skb to capacity. [1] https://github.com/stefano-garzarella/iperf-vsock Fixes: 059b7dbd20a6 ("vsock/virtio: fix potential unbounded skb queue") Cc: stable@vger.kernel.org Reported-by: Brien Oberstein <brienpub@gmail.com> Closes: https://lore.kernel.org/netdev/618701dd023e$063de350$12b9a9f0$@gmail.com/ Tested-by: Brien Oberstein <brienpub@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260708102904.50732-2-sgarzare@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21platform/x86: asus-nb-wmi: map ProArt key (0x8b) to KEY_PROG3Nizar Al-Kabbani
The dedicated "ProArt" key on the ASUS ProArt PX13 (HN7306) emits ASUS WMI event code 0x8b. This code is absent from the asus-nb-wmi sparse keymap, so pressing the key only produces a "Unknown key code 0x8b" message and does nothing in userspace. On this model the key is exposed solely through the WMI interface and has no HID scancode, so it can only be handled inside asus-nb-wmi. Map 0x8b to KEY_PROG3 so the key emits a bindable event, consistent with the existing KEY_PROG3 mapping used for the ASUS programmable/Armoury key. Signed-off-by: Nizar Al-Kabbani <nizar.m.kabbani@gmail.com> Reviewed-by: Denis Benato <denis.benato@linux.dev> Link: https://patch.msgid.link/20260719090843.66777-1-nizar.m.kabbani@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-07-21rxrpc: fix io_thread race in rxrpc_wake_up_io_thread()Xuanqiang Luo
rxrpc_wake_up_io_thread() checks local->io_thread before waking it, but then reloads the pointer for wake_up_process(). local->io_thread is cleared with WRITE_ONCE() when the I/O thread exits, so the second load can see NULL even if the first load did not. Take a READ_ONCE() snapshot and use it for both the NULL check and the wake_up_process() call, as rxrpc_encap_rcv() already does. Fixes: 5800b1cf3fd8 ("rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE") Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260708093534.53486-1-xuanqiang.luo@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21ntfs: drop stale page-cache when shrinking a non-resident attrNamjae Jeon
ntfs_non_resident_attr_shrink() shrinks attribute sizes but fails to trim the page cache. This leaves orphaned dirty folios beyond the new end of the attribute, leading to writeback failures (-ENOENT), data loss, and $EA chain corruption. Fix this by truncating the page cache to the new size immediately after updating the sizes, preventing writeback from flushing out-of-range folios. Fixes: 495e90fa3348 ("ntfs: update attrib operations") Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-07-21ntfs: harden runlist realloc size calculationsNamjae Jeon
Add a shared helper to safely convert runlist element counts to byte sizes using overflow checks, and use it in both ntfs_rl_realloc() and ntfs_rl_realloc_nofail(). Fixes: 11ccc9107dc4 ("ntfs: update runlist handling and cluster allocator") Co-developed-by: Alper Mudar <kommandant_alper@proton.me> Signed-off-by: Alper Mudar <kommandant_alper@proton.me> Tested-by: Alper Mudar <kommandant_alper@proton.me> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
2026-07-21Merge branch 'ipv4-update-rt_flush_dev-and-two-dst-dev-readers'Paolo Abeni
Xuanqiang Luo says: ==================== ipv4: update rt_flush_dev() and two dst.dev readers From: Xuanqiang Luo <xuanqiang.luo@linux.dev> Patch 1 makes the rt_flush_dev() write to rt->dst.dev use rcu_assign_pointer(), matching the existing dst_dev_rcu() readers. Patch 2 makes ip_rt_send_redirect() and ip_rt_get_source() use one dst.dev snapshot throughout each operation, so a concurrent rt_flush_dev() update cannot make them use values from two devices. v2: https://lore.kernel.org/lkml/20260701032434.17500-1-xuanqiang.luo@linux.dev/ v1: https://lore.kernel.org/all/20260630094250.29386-1-xuanqiang.luo@linux.dev/ ==================== Link: https://patch.msgid.link/20260708060537.17188-1-xuanqiang.luo@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21ipv4: snapshot dst.dev in ip_rt_send_redirect() and ip_rt_get_source()Xuanqiang Luo
rt_flush_dev() can replace rt->dst.dev with blackhole_netdev while RCU readers are running. ip_rt_send_redirect() and ip_rt_get_source() both read rt->dst.dev more than once and use the results in one operation. If rt->dst.dev changes between those reads, the operation can use values from two devices. For example, ip_rt_send_redirect() can use in_dev from the old device and the L3 master ifindex from blackhole_netdev. Read rt->dst.dev once in these two functions and use the snapshot for the later device accesses. Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708060537.17188-3-xuanqiang.luo@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-21ipv4: use rcu_assign_pointer() in rt_flush_dev()Xuanqiang Luo
rt_flush_dev() replaces rt->dst.dev with blackhole_netdev on uncached routes. The field is also exposed as dst.dev_rcu, and existing readers use dst_dev_rcu(). Use rcu_assign_pointer() for the replacement, as dst_dev_put() already does for the same field. Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260708060537.17188-2-xuanqiang.luo@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>