mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
master
1507472
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
65e4fd942f |
Merge tag 'selinux-pr-20261119' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore: "A single SELinux fix for a problem where we were not properly handling MAP_SHARED_VALIDATE" * tag 'selinux-pr-20261119' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: check MAP_SHARED_VALIDATE mappings as shared |
||
|
|
d3e1fcc930 |
Merge tag 'thermal-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fix from Rafael Wysocki: "Fix the Nova Lake-S PCI device ID in the int340x thermal driver (Sankara Tankala)" * tag 'thermal-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal: int340x: processor_thermal: Fix Nova Lake-S PCI device ID |
||
|
|
75099ce682 |
Merge tag 'pm-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki:
"These fix two recent regressions related to power management, one in
the ACPI CPPC library (affects the CPPC interface in sysfs and the
intel_pstate driver), and one in the ACPI device PM core code (affects
platforms with shared ACPI power resources assigned to devices
reported as "not present" by firmware), another ACPI CPPC library
issue and two cpufreq issues, one in the core and one in the CPPC
cpufreq driver:
- Avoid initializing power management for absent devices in the core
ACPI PM code to unbreak power management on platforms where an ACPI
shared power resource is assigned to a device reported by the
platform firmware as absent (Rafael Wysocki)
- Drop compliance checks involving nominal performance from the ACPI
CPPC library to unbreak the CPPC sysfs interface and the
intel_pstate driver on some Intel platforms after a recent change
that added those checks (Rafael Wysocki)
- Make the ACPI CPPC library reject EPP registers that are too small
to store all of the possible EPP values (Christian Loehle)
- Make cpufreq_driver_target() skip inactive policies to avoid a NULL
pointer dereference on a frequency table access attempt (Zhongqiu
Han)
- Set the CPPC Enable register in cpu_init() in the CPPC cpufreq
driver to enable CPPC on platforms that wait for the OS to enable
it (Sumit Gupta)"
* tag 'pm-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: PM: Avoid initializing power management for absent devices
ACPI: CPPC: Drop compliance checks involving nominal performance
ACPI: CPPC: Reject EPP registers narrower than 8 bits
cpufreq: Skip inactive policies in cpufreq_driver_target()
cpufreq: CPPC: Set CPPC Enable register in cpu_init()
|
||
|
|
d40cb8a12e |
Merge branches 'acpi-cppc-fixes' and 'pm-cpufreq-fixes'
Merge ACPI CPPC library fixes and cpufreq fixes for 7.4-rc1: - Drop compliance checks involving nominal performance from the ACPI CPPC library to unbreak the CPPC sysfs interface and the intel_pstate driver on some Intel platforms after a recent change that added those checks (Rafael Wysocki) - Make the ACPI CPPC library reject EPP registers that are too small to store all of the possible EPP values (Christian Loehle) - Make cpufreq_driver_target() skip inactive policies to avoid a NULL pointer dereference on a frequency table access attempt (Zhongqiu Han) - Set the CPPC Enable register in cpu_init() in the CPPC cpufreq driver to enable CPPC on platforms that wait for the OS to enable it (Sumit Gupta) * acpi-cppc-fixes: ACPI: CPPC: Drop compliance checks involving nominal performance ACPI: CPPC: Reject EPP registers narrower than 8 bits * pm-cpufreq-fixes: cpufreq: Skip inactive policies in cpufreq_driver_target() cpufreq: CPPC: Set CPPC Enable register in cpu_init() |
||
|
|
8dac6df92a |
Merge tag 'nfsd-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fix from Chuck Lever: - Unlock the correct parent directory after CREATE crosses a mount * tag 'nfsd-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: nfsd: unlock the locked parent after crossing a mount in CREATE |
||
|
|
1ecc5b7c95 |
nfsd: unlock the locked parent after crossing a mount in CREATE
Since commit |
||
|
|
1e575bda30 |
Merge tag 'net-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni:
"Including fixes from netfilter and Bluetooth.
Current release - regressions:
- ipvs: honor the overload state and do not enter it forever
Previous releases - regressions:
- core:
- prevent receive header offset overflow during decapsulation
- avoid truncated transport header offsets
- tcp:
- fix NULL pointer dereference when restarting a fast open listener
- fix the SO_REUSEPORT bind cache admitting a conflicting socket
- sctp: do not free a new asoc peeled off while sendmsg slept
- bridge: fix skb leak of reinjected link-local frames
- bluetooth:
- L2CAP: clear the SDU before the receive callback
- vhci: serialize packet reception with device creation
- ipvs:
- avoid stack overflow from recursive connection expiration
- fix problems during connection deletion
- eth:
- virtio_net: check RX buffer length before DMA sync
- gve: fix RX page refcount overflow from INT_MAX pagecnt_bias
Previous releases - always broken:
- core: make room for the tunnel header in skb_segment_list()
- eth:
- i40e: fix freeing of TX rings on RX allocation failure
- stmmac: fix VXLAN over IPv6 with zero UDP checksum"
* tag 'net-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (117 commits)
net: prevent receive header offset overflow during decapsulation
tcp: bound the rto_min of a route in tcp_rto_min()
tcp: clamp the samples in tcp_rcv_rtt_update()
tcp: reject RTT samples from TSecr above 120 s
tcp: clamp RTT samples in tcp_rtt_estimator()
tcp: don't let __tcp_set_rto() return 0
net: make room for the tunnel header in skb_segment_list()
udp: use skb_set_transport_header_careful() in __udp6_lib_err_encap()
sctp: use skb_set_transport_header_careful() in sctp_v6_err()
net: openvswitch: use skb_set_transport_header_careful() in parse_ipv6hdr()
ipv6: mcast: use skb_set_transport_header_careful() in ipv6_mc_check_exthdrs()
ipv6: gro: limit the number of extension headers
net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets
net: stmmac: dwmac1000: don't discard frames with only a checksum error
net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
veth: wake the peer txq when deleting NAPI
veth: wake a stopped peer txq beyond real_num_tx_queues
iavf: add missing PTP adjustment callbacks
iavf: fix ASQ command buffer leak on init failure
iavf: fix QoS capabilities memory leak
...
|
||
|
|
f1715c0c04 |
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull vhost fix from Michael Tsirkin: "Fix vhost ring completion batch wrap" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: vhost: split out-of-order used ring batches at every wrap |
||
|
|
b10c986f17 |
net: prevent receive header offset overflow during decapsulation
Repeated decapsulation can leave skb->data far from skb->head while
the remaining packet data is still valid. Since the skb header positions
are 16-bit offsets, a later header update can truncate and make header
access use unrelated bytes and eventually crash.
Limit receive headroom to 32 KiB. This is well beyond the headroom of
normal packets while allowing the networking stack to pull enough
headers in a single pass without overflowing 16-bit header offsets.
Tunnel decapsulation re-enters __netif_receive_skb_core(), so its check
protects nested IPIP and GRE. FOU and GUE bypass receive core, so check
their IPv4 and IPv6 resubmission paths too. Together, these checks
prevent 16-bit header-offset truncation in cases of repeated
decapsulation.
Report these rejections with the SKB_RX_HEADROOM drop reason.
Fixes:
|
||
|
|
a1671b708d |
Merge branch 'tcp-avoid-integer-wraps-in-the-rtt-estimator-and-the-rto'
Chris Mason says: ==================== tcp: avoid integer wraps in the RTT estimator and the RTO This is v2 of the RTT clamps, with Eric's review folded in. Patch 1: __tcp_set_rto() never returns 0, so that the backoff recovers from any state of the RTT estimator. Patch 2: tcp_rtt_estimator() clamps each sample to 120 s, so that srtt_us, mdev_us, rttvar_us and the sum in __tcp_set_rto() can't wrap. Patch 3: tcp_rtt_tsopt_us() rejects a TSecr sample above 120 s. Patch 4: new, from Eric's review. tcp_rcv_rtt_update() clamps its samples too, which covers tcp_rcv_rtt_measure(). Patch 5: new. tcp_rto_min() bounds the locked rto_min of a route. Eric, I have a question on patch 5. You pointed at a locked rto_min of 0 for patch 1. We can also get an RTO of 0 out of tcp_init_metrics(), which doesn't go through __tcp_set_rto(), so I bounded the metric in tcp_rto_min(). For a locked cwnd of 0 you wanted ip_metrics_convert() to reject it instead. I didn't do that here because claude points out that "rto_min lock 0" is accepted today and mostly works, but just let me know how you want this to look. v1: https://lore.kernel.org/all/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> |
||
|
|
314b35c817 |
tcp: bound the rto_min of a route in tcp_rto_min()
For a route with a locked RTAX_RTO_MIN, tcp_rto_min() returns the metric
as it is, and that can be any 32-bit number of milliseconds. All other
ways to set the minimum RTO have a nonzero floor: the tcp_rto_min_us
sysctl, TCP_RTO_MIN_US and TCP_BPF_RTO_MIN.
Both ends of that range give us trouble.
With an rto_min of 0, tcp_init_metrics() can start a connection with an
RTO of 0, if the cached RTT is below one jiffy:
icsk_rto = crtt + max(2 * crtt, tcp_rto_min(sk)) = 0
It sets icsk_rto itself, so the lower bound in __tcp_set_rto() does not
help here.
At the other end, tcp_rto_min_us() and the sum in __tcp_set_rto() are
u32 values in usec, so an rto_min of more than about 71 minutes does not
fit.
Clamp a locked rto_min to the range from one jiffy to TCP_RTO_MAX in
tcp_rto_min().
ip_metrics_convert() could reject these values instead, as it does for a
locked cwnd of 0. But a route with "rto_min lock 0" is accepted today
and mostly works, so that would break existing setups.
A route still shows the rto_min that it was given, while TCP uses one
jiffy or 120 s.
Found by LLM code inspection, and confirmed with LLM generated
reproducers on an unmodified kernel. Fixed by LLM, and tested with
the reproducers and existing kernel selftests.
Fixes:
|
||
|
|
f22d5042fa |
tcp: clamp the samples in tcp_rcv_rtt_update()
tcp_rcv_rtt_update() starts with sample << 3 in u32 arithmetic, so a
sample of 536.9 s or more wraps.
tcp_rcv_rtt_measure() can hand it one. Its sample is the time the sender
took to fill one receive window, and a low rate flow can take longer
than that. This caller only looks for a minimum, so the wrapped value is
kept whenever it is below the current estimate. A 540 s sample ends up
as an estimate of about 3.1 s.
Clamp the sample to TCP_RTT_MAX_US in tcp_rcv_rtt_update(), like
tcp_rtt_estimator() does on the send side. That covers both callers, and
the smoothed estimate now tops out at 8 * 120 s, which fits in a u32.
Found by code inspection (Eric Dumazet), who also suggested the fix.
Confirmed with an LLM generated reproducer on an unmodified kernel, and
tested with the reproducer and existing kernel selftests.
Fixes:
|
||
|
|
1b91d9c09a |
tcp: reject RTT samples from TSecr above 120 s
tcp_rtt_tsopt_us() returns the timestamp clock minus TSecr as an RTT
sample, and accepts up to 2,147 s. If TSecr echoes an old timestamp,
the sample is the age of that timestamp, not an RTT.
tcp_ack_update_rtt() takes this sample for an ACK of retransmitted data.
tcp_rtt_estimator() clamps it to 120 s. The congestion control gets the
sample unclamped, in rs->rtt_us.
tcp_rcv_rtt_measure_ts() takes the same sample for the RTT estimate of
the receive side.
The fix used here is to reject a sample from TSecr above 120 s, for both
callers of tcp_rtt_tsopt_us().
An ACK of retransmitted data whose TSecr is more than 120 s old now
gives no RTT sample. So it no longer resets the backoff, as on a
connection without timestamps.
Found by LLM code inspection, and confirmed with LLM generated
reproducers on an unmodified kernel. Fixed by LLM, and tested with
the reproducers and existing kernel selftests.
Fixes:
|
||
|
|
fa472d53d9 |
tcp: clamp RTT samples in tcp_rtt_estimator()
tcp_rtt_estimator() keeps its state in u32 fields, in microseconds. srtt_us holds 8 times the smoothed RTT, so it wraps at an RTT of 536.9 s. Samples can be larger than that: - For an ACK of retransmitted data, the sample is the timestamp clock minus TSecr, and tcp_rtt_tsopt_us() accepts a sample of up to 2,147 s. - For a SACK of a segment that was never retransmitted, the sample is the age of that segment. Samples from TSecr could wrap these fields when they still held jiffies. The age of a segment can wrap them since commit |
||
|
|
5d2a5ad036 |
tcp: don't let __tcp_set_rto() return 0
tcp_retransmit_timer() backs off by doubling icsk_rto, so the backoff
only works if icsk_rto is nonzero.
__tcp_set_rto() adds srtt_us >> 3 and rttvar_us with no lower bound, and
relies on tcp_rtt_estimator() to keep rttvar_us at tcp_rto_min() or
above. But tcp_rto_min() returns 0 for a route with a locked
RTAX_RTO_MIN of 0. A first RTT sample of 0 usec, which usec TS allows,
then gives:
srtt_us = max(1U, 0 << 3) = 1
rttvar_us = max(mdev_us, tcp_rto_min_us(sk)) = 0
__tcp_set_rto() = usecs_to_jiffies((1 >> 3) + 0) = 0
Keep the result from 0, so that the backoff recovers from any state of
the RTT estimator.
Do it in __tcp_set_rto() and not in tcp_set_rto(), since
tcp_ld_RTO_revert() uses the same sum. The third caller, the linear
timeouts of thin streams in tcp_retransmit_timer(), already clamps the
result to tcp_rto_min().
Found by code inspection (Eric Dumazet), not reproduced. Fixed by LLM,
and tested with existing kernel selftests.
Fixes:
|
||
|
|
abccf171fa |
net: make room for the tunnel header in skb_segment_list()
skb_segment_list() pushes each frag_list member back to the outer MAC
header and copies the tunnel headers in front of it, but never checks
that the member has the headroom. A fraglist GRO packet forwarded into
a tunnel and segmented in software then hits skb_under_panic() on IPIP,
and on VXLAN the copy writes before the member's head (KASAN:
slab-out-of-bounds write in skb_segment_list()).
Call skb_cow_head() on each member before pushing it.
Fixes:
|
||
|
|
12fc46d870 |
Merge branch 'net-avoid-truncated-transport-header-offsets'
Eric Dumazet says: ==================== net: avoid truncated transport header offsets skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. The first patch addresses the report from Hyunwoo Kim, by applying the IP6_MAX_EXT_HDRS_CNT limit to ipv6_gro_pull_exthdrs(). The four following patches convert places storing an offset derived from an IPv6 extension header walk to skb_set_transport_header_careful(). A single chain being bounded to 24576 bytes, these need a large skb->data - skb->head to overflow, for instance after nested decapsulations. They are hardening, no reproducer was written. The same change for nf_ct_frag6_gather() is sent separately to the netfilter tree. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> |
||
|
|
02f578b736 |
udp: use skb_set_transport_header_careful() in __udp6_lib_err_encap()
skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. __udp6_lib_err_encap() stores @offset, computed by icmpv6_notify() from the extension headers of the packet embedded in an ICMPv6 error. Should the value be truncated, the tunnel encap_err_lookup() and err_handler() callbacks would read the UDP header at the wrong place. Since commit |
||
|
|
13391f1a8c |
sctp: use skb_set_transport_header_careful() in sctp_v6_err()
skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. sctp_v6_err() stores @offset, computed by icmpv6_notify() from the extension headers of the packet embedded in an ICMPv6 error. Should the value be truncated, sctp_err_lookup() would read the SCTP header at the wrong place. Since commit |
||
|
|
b9b77e2430 |
net: openvswitch: use skb_set_transport_header_careful() in parse_ipv6hdr()
skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. parse_ipv6hdr() stores the payload offset found by ipv6_find_hdr(), which depends on the extension headers found in the packet. Should the value be truncated, key_extract_l3l4() would parse the L4 header at the wrong place. Since commit |
||
|
|
425b1fe50b |
ipv6: mcast: use skb_set_transport_header_careful() in ipv6_mc_check_exthdrs()
skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. ipv6_mc_check_exthdrs() stores the offset returned by ipv6_skip_exthdr(), which depends on the extension headers found in the packet. Should the value be truncated, ipv6_mc_check_icmpv6() and ipv6_mc_check_mld_msg() would then validate and parse the MLD message at the wrong place. Since commit |
||
|
|
050f2adb60 |
ipv6: gro: limit the number of extension headers
Hyunwoo Kim reported that a long chain of IPv6 extension headers can push the transport header offset of a GRO packet beyond what the 16-bit skb->transport_header can store. The truncated offset is later used by gro_receive_network_flush() to locate the network header of a packet held in the GRO list, leading to an out-of-bounds read. Since commit |
||
|
|
a8aeac0b18 |
Merge branch 'net-stmmac-deliver-frames-with-rx-checksum-errors-to-the-stack'
Christian Schmidbauer says:
====================
net: stmmac: deliver frames with Rx checksum errors to the stack
On dwmac1000 the MAC drops every frame that fails Rx checksum validation
before the driver sees it. The enhanced descriptor parser would discard
such a frame even if the MAC delivered it. As a result, a VXLAN tunnel
over IPv6 with zero UDP checksums receives nothing while Rx checksum
offload is on, and neither rx_dropped nor rx_errors shows the loss.
Patches 2 and 3 deliver these frames with CHECKSUM_NONE instead, as
commit
|
||
|
|
2dd48c4615 |
net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets
When the checksum offload engine (CoE) is enabled, the dwmac1000 MAC silently drops any frame for which the engine detects a checksum error, before the driver sees it. This breaks VXLAN over IPv6 with zero UDP checksums, which RFC 6935 and RFC 6936 allow for tunnels. Set DMA_CONTROL_DT so that such frames are delivered instead of dropped, as commit |
||
|
|
596c940868 |
net: stmmac: dwmac1000: don't discard frames with only a checksum error
On dwmac1000 with enhanced descriptors, the hardware sets the Error Summary (ES) bit of the Rx descriptor not only for L2 errors but also for an L3/L4 checksum error. enh_desc_get_rx_status() returns discard_frame whenever ES is set, and since commit |
||
|
|
fcfc52fcf8 |
net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
Commit |
||
|
|
952d16c5ee |
Merge branch 'veth-fix-txqs-that-are-never-woken-after-backpressure'
Simon Schippers says: ==================== veth: fix txqs that are never woken after backpressure While debugging the veth BQL series [1], I found two ways in which a veth txq that veth_xmit() stopped on a full ptr_ring is never woken again. Patch 1 lets veth_poll() wake txqs beyond real_num_tx_queues, as a txq stopped before a TX channel shrink is otherwise left stopped. Patch 2 wakes the peer txq when NAPI is deleted, as veth_xmit() can stop it after the last poll. The reproducers are below the --- of each patch. Patch 1 reproduces without changes to the kernel, patch 2 needs a debug-only udelay() to widen the race window. Claude Opus 5.5 was used heavily for this series, to find and reproduce both bugs and to write the patches. [1] https://lore.kernel.org/netdev/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> |
||
|
|
b2f4c44d7d |
veth: wake the peer txq when deleting NAPI
Since commit |
||
|
|
8a0b03058f |
veth: wake a stopped peer txq beyond real_num_tx_queues
Since commit |
||
|
|
e203d8a475 |
Merge branch 'intel-wired-lan-driver-updates-2026-11-12-i40e-iavf'
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2026-11-12 (i40e, iavf) [part] For i40e: Filip Balluch fixes incorrectly provided Tx rings in error path of i40e_set_ringparam(). Alex further fixes the error path clearing the netdev from temporary Tx ring's before it's freed. For iavf: Xuanqiang Luo fixes a couple of memory leaks and prevents NULL pointer dereferences by implementing missing PTP callbacks. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> |
||
|
|
adbc4d0fff |
iavf: add missing PTP adjustment callbacks
The PTP hardware clock documentation requires drivers to implement all
callbacks and return -EOPNOTSUPP for unsupported features.
The iavf driver registers a PHC without adjtime or adjfine callbacks.
A userspace clock_adjtime(2) request reaches ptp_clock_adjtime(), where
ADJ_SETOFFSET calls adjtime and ADJ_FREQUENCY calls adjfine. The missing
callbacks can therefore cause a NULL dereference.
Provide both callbacks and return -EOPNOTSUPP for the unsupported
operations.
Fixes:
|
||
|
|
2a1f106379 |
iavf: fix ASQ command buffer leak on init failure
iavf_alloc_adminq_asq_ring() allocates cmd_buf before the remaining ASQ
resources. If iavf_alloc_asq_bufs() or iavf_config_asq_regs() fails, the
unwind path elides cmd_buf while freeing the other allocations.
The ASQ count is not set until initialization succeeds, so the shutdown
path cannot reclaim the buffer. Free cmd_buf in the common unwind path.
Fixes:
|
||
|
|
65f6ffb900 |
iavf: fix QoS capabilities memory leak
Commit |
||
|
|
e3916fa03f |
i40e: avoid resetting BQL state when freeing temporary Tx rings in set_ringparam
Temporary Tx rings built by i40e_set_ringparam() while resizing
descriptor counts are shallow struct copies of the live vsi->tx_rings[]
entries, so they retain the same ring->netdev and ring->queue_index as
the live ring they are staged to replace.
If an error path frees one of these clones with
i40e_free_tx_resources() before i40e_down() has run - either the
i40e_setup_tx_descriptors() failure unwind loop, or the free_tx: error
label - i40e_clean_tx_ring() will call netdev_tx_reset_queue() on
txring_txq(tx_ring), which resolves to the *same* netdev_queue as the
live ring because netdev/queue_index alias. That call resets the
queue's BQL/dql state (dql_reset(): num_queued = num_completed = 0)
while the live ring is still actively transmitting and completing
Tx on that same queue.
The next time the live ring reports completions for bytes that were
queued before the reset, dql_completed() can underflow its own
sanity check and hit:
BUG_ON(count > num_queued - dql->num_completed);
i.e. a guaranteed kernel panic, not just a warning, given a queue with
outstanding (queued but not yet completed) Tx traffic at the moment
the clone is freed.
Reproduced on real hardware by forcing i40e_setup_tx_descriptors() to
fail partway through building tx_rings[] while flooding real Tx
traffic on the affected queues:
kernel BUG at lib/dynamic_queue_limits.c:99!
RIP: 0010:dql_completed+0x285/0x2a0
Call Trace:
<IRQ>
i40e_napi_poll+0x74b/0x1700 [i40e]
__napi_poll+0x10a/0x200
net_rx_action+0x2f7/0x380
handle_softirqs+0xcc/0x270
Confirmed the same trigger no longer panics with this fix applied,
including repeated resize/traffic cycles.
Clear the clone ring netdev before freeing it in both error paths, so
i40e_clean_tx_ring()'s existing `if (!tx_ring->netdev) return;` guard
skips the netdev_tx_reset_queue() call for the clone. This mirrors the
same idiom i40e already uses for XDP Tx rings, which also have no
netdev_queue of their own (ring->netdev = NULL in i40e_vsi_setup_tx()).
Only the temporary, about-to-be-freed clone is touched; the live ring
in vsi->tx_rings[] keeps its netdev.
Fixes:
|
||
|
|
4957f66868 |
i40e: fix freeing of TX rings on RX allocation failure
When ethtool -G is used to change ring buffer sizes while the interface is
up, i40e_set_ringparam() allocates temporary TX and RX rings. If the RX
ring allocation fails, the error path at the free_tx label incorrectly
calls i40e_free_tx_resources(vsi->tx_rings[i]), freeing the live TX rings
instead of the temporary tx_rings[i].
Since the interface is still up, the next TX completion interrupt causes
i40e_clean_tx_irq() to dereference the freed ring descriptors, resulting in
a NULL pointer dereference in IRQ context and a kernel panic.
This can be reproduced on systems with Intel X710 NICs under memory
pressure, where the second port's DMA allocation fails after the first port
succeeds.
Fix by freeing the temporary tx_rings[i] in the error path instead of
the live vsi->tx_rings[i].
Fixes:
|
||
|
|
343869114a |
Merge branch 'amt-relay-tunnel-lifetime-validation-and-request-path-hardening'
Omar Ramadan says: ==================== amt: relay tunnel lifetime, validation and request-path hardening This series hardens AMT relay tunnel lifetime, validates gateway input, and keeps unauthenticated Requests from consuming relay state. The problems fixed by patches 3 and 4, and the pre-Query drop in patch 5, were found during the AMT IPv6 outer transport work, which is not included here. I am using the existing IPv4 AMT relay and gateway implementation in a multicast delivery network, where gateways on access networks send IGMP/MLD membership state through a relay to reach downstream receivers. The first patch detaches the receive path before amt_dev_stop() tears down events and tunnels, so no receive-path reader can queue work after the teardown. The second closes the gc_wq re-arm use-after-free, the double free of a tunnel when amt_dev_stop() races amt_tunnel_expire(), and the group/source timer-work lifetime bugs, makes teardown safe for RCU readers, and bounds the nodes parked for garbage collection. The third rejects Queries and Data from 0.0.0.0 before relay discovery and revalidates deferred Queries. The fourth requires exactly four bytes for IFLA_AMT_LOCAL_IP and IFLA_AMT_DISCOVERY_IP. The fifth makes pre-Query drops visible, avoids counting successful reports as drops, and uses concurrent-safe TX statistics. The sixth keeps Requests stateless, authenticates Membership Updates and checks their IGMP/MLD message before allocation, keys state by address and port, bounds per-source admission at a share of max_tunnels, and silently drops failed endpoint admission. Each commit message says how its problems were found. The problem in patch 4 was triggered while writing an IPv6 selftest; the others were found by review or code inspection. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> |
||
|
|
8ddd3a1c20 |
amt: create relay tunnels only from authenticated Updates
An AMT Request has an unauthenticated, spoofable source address. Allocating tunnel state from that path allowed spoofed Requests to consume tunnel slots or overwrite the nonce and MAC of an established gateway. Keep Requests stateless by deriving the Query MAC from the source address, source port, nonce, and current secret, and retain four secret generations so a gateway can renew its MAC across rotations. Authenticate the Membership Update before decapsulation, and create or refresh tunnel state only once ip_mc_check_igmp() or ipv6_mc_check_mld() has accepted the encapsulated message. Key verified state by the address/port endpoint, enforce global and per-source limits, and silently reject an endpoint that cannot be admitted: withhold the Query rather than send ICMP Host Unreachable to a source address nothing has authenticated yet. A MAC is now accepted only for a bounded time after the Query that carried it. Before, a tunnel copied the secret when a Request created it and never saw it rotate, so its MAC never expired. Now the secret rotates every 60 seconds and four generations are kept, so a MAC is accepted for 180 to 240 seconds. RFC 7450 section 5.2.3.5.4 has a gateway start a query timer when it accepts a Query, with a duration it SHOULD compute from the Query's QQIC (125 seconds here), and section 5.2.3.5.5 has it send a new Request when that timer expires, so a gateway that times its next Request from QQIC renews its MAC inside the window. The in-tree gateway re-Requests every two seconds while its Requests are answered. A gateway that never sends another Request kept working before; now its Updates are dropped as Invalid MAC once the window has passed. So is the first Update after a new join from a gateway that, as section 5.2.3.5.4 also allows, uses a longer timer while it has no group subscriptions to report: it is dropped until that gateway's next Request. Which MACs are accepted changes too. Before, an Update had to carry the nonce and MAC of the latest Request from its address; now any pair minted for its address and port within the window is accepted. The MAC never covered the encapsulated report, so this changes only how long a pair seen by an on-path observer stays usable: off-path senders still cannot produce a valid pair. The secret is now seeded before amt_socket_create() enables the receive path. It was seeded after the socket was created since commit |
||
|
|
ee58008edb |
amt: make pre-query report drops visible
A gateway cannot forward an IGMP or MLD report until it has received the
relay's Membership Query for that family. The Query supplies the
response MAC the Update echoes, so dropping an early report is required,
but doing so silently leaves operators with a dark multicast path and no
indication why the join never happened.
Emit a family-specific debug message before taking the drop path.
tx_dropped could not show these drops either: amt_dev_xmit() reaches the
same tx_dropped increment after amt_send_membership_update() has handed
the report to the tunnel, so in gateway mode every forwarded report was
also counted as a drop. Return NETDEV_TX_OK directly once the report has
been sent, so a report the tunnel accepted is no longer counted in
tx_dropped.
The device is LLTX, so amt_dev_xmit() can run on several CPUs at once;
use DEV_STATS_INC() for tx_dropped and tx_errors, there and in the
control-message senders that update the same counters, so concurrent
increments are not lost.
Found by code inspection while debugging an IPv6-in-IPv6 forwarding
failure in a selftest for the AMT IPv6 outer transport. This drop can
leave one address family dark, so it was a suspect, but that was not
confirmed: the failure was later traced to the selftest, which sent a
single datagram without waiting for the relay's multicast routes to
converge. The drop has not been observed in production, and there is
no oops or trace. The Sashiko AI review of an earlier posting found the
tx_dropped miscount and the non-atomic counter updates.
Fixes:
|
||
|
|
144183ab4b |
amt: require an exact IPv4-sized IFLA_AMT_{LOCAL,DISCOVERY}_IP
The netlink policy for IFLA_AMT_LOCAL_IP and IFLA_AMT_DISCOVERY_IP is an
untyped entry with .len set to the size of an IPv4 address, which netlink
validation treats as a minimum length only. Any longer payload passes,
and nla_get_in_addr() then reads just its first four bytes: an iproute2
that puts a 16-byte IPv6 literal in one of these IPv4 attributes turns
"2001:db8::" into 32.1.13.184, and the device is created with an address
the user never asked for.
Use NLA_POLICY_EXACT_LEN(sizeof(__be32)) for both, so every payload that
is not exactly four bytes long is refused with a standard extack instead
of being truncated. The range check this expands to fails the attribute
even under the liberal parsing rtnetlink applies to IFLA_INFO_DATA.
amt_get_size() and amt_fill_info() already emit exactly four bytes for
these attributes. IFLA_AMT_REMOTE_IP is only ever reported, never read
from a request, so it is left unchanged.
Triggered while writing a selftest for the AMT IPv6 outer transport:
an iproute2 without the IPv6 attributes put all 16 bytes of
"discovery 2001:db8:a::2" into IFLA_AMT_DISCOVERY_IP. On a stock
kernel the command exited 0 with no error or warning, and the device
came up as an IPv4 gateway with discovery address 32.1.13.184, the
first four bytes. There is no oops or trace; the symptom is the
silently wrong address, which fooled the selftest's capability probe.
Fixes:
|
||
|
|
b4fa7f8dae |
amt: reject a gateway Query or Data from 0.0.0.0 before a relay is learned
A gateway's amt_rcv() admits a Membership Query or Multicast Data message when "saddr != remote_ip" is false. remote_ip is 0 before discovery has learned a relay (and is reset to 0 by amt_dev_open(), by amt_dev_stop(), and when the gateway gives up after its Requests go unanswered), so a packet whose source is 0.0.0.0 would otherwise pass the equality check and could spoof a Query or inject multicast data. IPv4 input accepts a 0.0.0.0 source only on a limited broadcast or a link-local (224.0.0.0/24) multicast destination, so the sender has to be on the gateway's link. A forged Query must also carry the gateway's nonce. That is 0 until the next discovery tick re-randomizes it, because amt_dev_open() and the give-up path in amt_event_send_request() zero amt->nonce along with remote_ip. The Query handler then sets ready4 or ready6, mac and qi, and moves the gateway to AMT_STATUS_RECEIVED_QUERY. From there amt_event_send_discovery() returns early and amt_advertisement_handler() rejects every Advertisement, so discovery stays blocked until the Request retries run out and the device is back in AMT_STATUS_INIT with nonce 0. The Data check is defense in depth: amt_multicast_data_handler() already requires AMT_STATUS_SENT_UPDATE, which a gateway with no relay reaches only after such a forged Query, or in the short window in which the give-up path has cleared remote_ip but not yet reset the status. Reject both when no relay is learned: a 0 remote_ip must match nothing, so guard the check with !remote_ip. A Query is queued before its event worker processes it, so the relay address can also change in that window. Recheck the packet source against the current remote_ip in the handler and discard stale Queries. Discovery is unaffected because Relay Advertisements are validated against discovery_ip, not remote_ip. Found by code inspection while writing the IPv6 receive path for the AMT IPv6 outer transport; not triggered at runtime. The Sashiko AI review of an earlier posting pointed out the nonce condition, the blocked discovery and that the Data check is defense in depth. Fixes: |
||
|
|
5931fd2440 |
amt: fix use-after-free when a Membership Update re-arms a freed tunnel
amt_update_handler() refreshes a relay tunnel's garbage-collection timer with mod_delayed_work() on a tunnel found by an RCU walk. A concurrent amt_tunnel_expire() can unlink and free that tunnel while the Update path still has the cached pointer, leaving gc_wq armed in freed memory. A tunnel can also be freed twice. amt_dev_stop() unlinks and frees tunnels without amt->lock, while amt_tunnel_expire() unlinks and frees them under it, so an ifdown that races a tunnel timeout can run list_del_rcu() and kfree_rcu() on the same tunnel twice. Group and source nodes have lifetime bugs of their own: - __amt_source_gc_work() frees a source, and amt_del_group() a group, after only cancel_delayed_work(), which does not wait for a timer work that is already running. amt_source_work() or amt_group_work() can then run on the freed node. - amt_source_work() reads snode->gnode and gnode->tunnel_list, and amt_group_work() gnode->tunnel_list, before taking tunnel->lock or the RCU read lock, so either can follow a pointer to a group or tunnel that has already been freed. - A timer work that waits for tunnel->lock while its node is deleted can then act on the deleted node: amt_source_work() destroys the source again, or amt_group_work() deletes the group again. Either decrements nr_sources or nr_groups a second time and unlinks, queues or frees the node a second time. Make amt_tunnel_expire() the only timeout-path freer. The Update path records last_seen under tunnel->lock, and expire reads it under tunnel->lock and, in the same section, either re-arms gc_wq from it or marks the tunnel dead for freeing, so an Update either keeps the tunnel alive or finds it dead. Protect the dead state with tunnel->lock so report handling cannot add multicast state after teardown begins. Device stop marks tunnels dead under amt->lock, unlinks them one at a time under it, synchronously cancels their work, and frees them after lockless readers have passed. Apply the same lifetime rules to group and source timer work: mark nodes dead under tunnel->lock, keep RCU held while workers resolve their parents, clear the parent pointers before a node is queued for freeing, defer node freeing, and synchronously cancel each node's timer before freeing that node. Park sources and groups through a gc_node of their own. A destroyed source used to reuse snode->node, its link into the group's hash; no lockless reader is known to follow it onto the GC list, so this is hardening. Run the deferred GC directly before freeing a tunnel so nodes are reclaimed promptly. Do not flush the GC work instead: flush_delayed_work() queues the work and waits for it to run, which needs a free amt_wq active slot, so amt_tunnel_expire() and the group GC, both amt_wq work, can deadlock once every slot is held by such a waiter. The cancel_delayed_work_sync() calls the GC makes need no slot: each takes a pending timer work off its timer or queue, or waits for a running one on a barrier that max_active does not count. Lifetime does not rest on that GC run, which misses nodes a concurrent run has already spliced off: it rests on kfree_rcu() and on the parent pointers being cleared, and the dead checks made, under tunnel->lock. Release the group timer's device reference on every exit. A node on a GC list is no longer charged to max_groups or max_sources, and unless a tunnel expires or the device stops, only the periodic GC drains the lists, every 30 seconds. Sources were already parked that way; groups, which went to kfree_rcu() before, now are too, so Report/Leave churn from one gateway could pin memory without bound in between. Count the nodes parked on both lists, under the one lock that now protects both, and when the count reaches AMT_GC_KICK (2048) queue the drain of both lists at once. A parked group still holds its AMT_HSIZE (256) source hash heads, so it is a kmalloc-4k object, and 2048 of them is about 8 MiB; the kick keeps the backlog near that instead of letting it grow for up to 30 seconds. A periodic drain that ends with that many parked again runs again at once rather than after the interval. This also bounds what amt_dev_stop() has to free in its drain under RTNL, and both drains now call cond_resched() after each node. A Request-only tunnel retains the original GMI timeout. Its last_seen stays 0, a value an Update never stores, and only a valid, authenticated Membership Update refreshes last_seen and gives the tunnel the longer lifetime: an Update whose encapsulated message fails ip_mc_check_igmp() or ipv6_mc_check_mld() no longer extends the tunnel. amt_tunnel_expire() reads jiffies once, so the re-arm delay comes from the value it compared. The Sashiko AI review of an earlier posting of this series pointed out the gc_wq re-arm, and reading amt_update_handler() against amt_tunnel_expire() and amt_dev_stop() confirms it. It is theoretical: it needs a Membership Update that has already found the tunnel under RCU to arrive while amt_tunnel_expire() is freeing that tunnel. Review of later postings raised the races in the group and source timer work, the amt_dev_stop() double free and the unbounded GC lists. I have not triggered any of them, so there is no trace to include. Fixes: |
||
|
|
cd057fd9c7 |
amt: stop receiving before amt_dev_stop() tears down its state
amt_dev_stop() clears amt->sk and waits in synchronize_net(), but the socket's sk_user_data still points at the device until udp_tunnel_sock_release() clears it afterwards, and nothing waits for readers then. An amt_rcv() that loads the pointer after the grace period can still be running once amt_dev_stop() has cancelled event_wq and torn down the relay's tunnels. A gateway can then queue a received Advertisement or Membership Query on event_wq again, and a relay can link a new tunnel from a Request and arm its gc_wq. Either work can then run after the device has been freed. Clear sk_user_data before the grace period, so synchronize_net() also waits for every amt_rcv() that can still see the device. Once it is NULL, amt_rcv() drops the packet and amt_err_lookup() ignores the ICMP error. The race is as old as amt_rcv(). From commit |
||
|
|
342e62fd34 |
tcp: purge Fast Open RST queue when listen() fails
inet_csk_listen_start() moves the socket to TCP_LISTEN before calling
->get_port() and ->hash(). If one of them fails, the socket goes back
to TCP_CLOSE without going through inet_csk_listen_stop().
If the socket was a Fast Open listener in a previous life, and was
stopped with shutdown(SHUT_RD) or connect(AF_UNSPEC) while an accepted
Fast Open child was still in TCP_SYN_RECV state, the request_sock of
this child still points to the listener.
A valid RST received for this child while the listener is transiently
in TCP_LISTEN state makes reqsk_fastopen_remove() queue the
request_sock in rskq_rst_head. When listen() fails, for instance with
-EADDRINUSE because another SO_REUSEADDR socket started listening on
the same port, nothing reclaims it:
- __tcp_close(), tcp_disconnect() and tcp_abort() only call
inet_csk_listen_stop() for sockets in TCP_LISTEN state.
- A later successful listen() overwrites rskq_rst_head in
reqsk_queue_alloc().
The request_sock is leaked, together with the reference it holds
on the listener.
Move the rskq_rst_head purge to a helper, and call it from the
inet_csk_listen_start() error path as well, after the socket state
has been set back to TCP_CLOSE: reqsk_fastopen_remove() checks
sk_state under fastopenq.lock, so it either queued the request before
the purge acquires the lock, or does not queue it at all.
Reported-by: Sashiko AI review <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]/
Fixes:
|
||
|
|
f16d85cd3d |
net: phy: realtek: fix listing of sysfs directory tree
On git master, listing the contents of sysfs produces an error:
root@mateusz-debian:/sys# LANG=C find -iname foobar
find: './module/realtek/drivers': Input/output error
root@mateusz-debian:/sys# LANG=C ls -1 ./module/realtek/drivers
ls: reading directory './module/realtek/drivers': Input/output error
'mdio_bus:Generic FE-GE Realtek PHY'
'mdio_bus:RTL8201CP Ethernet'
'mdio_bus:RTL8201F Fast Ethernet'
'mdio_bus:RTL8208 Fast Ethernet'
'mdio_bus:RTL8211B Gigabit Ethernet'
[...]
Investigation shows that the forward slash in the driver name is the
culprit. Fix it.
Cc: [email protected]
Fixes:
|
||
|
|
bcb4267275 |
fou: reserve headroom before pushing the encap header
ip_tunnel_xmit() and ip_md_tunnel_xmit() push the encap header before reserving headroom. A packet redirected into the tunnel (tc mirred, nft fwd/dup) keeps the headroom of its original device, so fou_build_udp() panics: kernel BUG at net/core/skbuff.c:214! Call Trace: skb_push+0xcc/0xf0 fou_build_udp+0x2f/0x380 gue_build_header+0xfa/0x150 ip_tunnel_xmit+0x87f/0x21c0 With a mirred mirror, the push overwrites the original packet instead. Reachable with CAP_NET_ADMIN in a user namespace. Reserve the headroom in fou_build_header() and gue_build_header(); GUE sizes and builds the header from one copy of the encap fields. The skb head may move, so reload inner_iph after ip_tunnel_encap() and read tnl_params, which points into the head for GRE with header_ops, before the call. sit's ipip6_tunnel_xmit() holds no head pointer across it. Fixes: |
||
|
|
3d10dc3ae1 |
net: via-rhine: Stop the NIC on platform device shutdown
Close a running interface on platform device shutdown, so that the chip
stops its receive DMA before kexec hands its memory to the next kernel.
Do it in the driver, as the platform (OF) variant lacks a .shutdown
callback and nothing else stops it, unlike for PCI, where the core
clears bus mastering ahead of kexec.
Keep incoming frames from landing in receive buffers the old kernel had
allocated: on a WonderMedia WM8950 board, broadcast traffic alone
corrupts the next kernel at random points as it decompresses and boots,
hanging about a third of kexec attempts early on, e.g. with
"unrecognized/unsupported processor variant".
Fixes:
|
||
|
|
ece404eac2 |
net: stmmac: drop the rest of the frame when napi_build_skb() fails
If napi_build_skb() fails on the first buffer of a frame that spans
several descriptors, stmmac_rx() drops that buffer but goes on with the
next descriptor of the same frame as if a new frame started there. The
rest of the frame is then passed up the stack as a frame of its own. A
frame spans several descriptors when it does not fit in the RX buffers
of one descriptor.
Mark the frame as errored instead, so that its remaining descriptors are
discarded like those of a frame with a receive error. The frame is
counted once in rx_dropped and once against the NAPI budget.
Found while working on the sun8i EMAC jumbo frame series, where frames
over 2032 bytes span several descriptors. Tested on an Orange Pi Zero2
(dwmac-sun8i, MTU 4070), w/ jumbo series and error injection.
Fixes:
|
||
|
|
d61480a622 |
net/mlx5e: Hold sync_lock while resetting VXLAN ports
mlx5_vxlan_reset_to_default() walks vxlan->htable without sync_lock
and calls mlx5_vxlan_del_port() for each user port. mlx5e_nic_disable()
and mlx5e_uplink_rep_disable() call it after rtnl_unlock(), so the
udp_tunnel_nic work can run mlx5e_vxlan_unset_port() at the same time.
If that removes and frees the entry saved as the next one in
hash_for_each_safe(), the walk then reads freed memory.
Hold sync_lock over the whole walk, and add __mlx5_vxlan_del_port() for
callers that already hold it.
Fixes:
|
||
|
|
b91ad39f29 |
ACPI: PM: Avoid initializing power management for absent devices
Commit |
||
|
|
27e694b84e |
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Mostly driver fixes. The only core one is the bsg one to prevent copying of sense data after the task is cancelled (which could result in random memory writes from the kernel). ufs has the largest set of fixes, but they're also fairly mundane" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (21 commits) scsi: mpi3mr: Validate reply frame size bounds scsi: target: core: Parse APTPL res_type and res_scope as hex scsi: target: iscsi: Check for existing sessions only after authentication scsi: sd_zbc: Cap zone report count by buffer size scsi: rdac: Keep the error status when controller lookup fails scsi: target: Fix NULL pointer dereference in core_alua_do_port_transition() scsi: target: Fix NULL pointer dereference in target_dev_alua_lu_gp_store() scsi: ufs: qcom: Reprogram ESI after a host controller reset scsi: ufs: mcq: Poll OCS after sq cleanup for device management commands scsi: ufs: core: Skip ABORT TASK for device management commands scsi: leapraid: Fix init_cmd_priv error handling scsi: ufs: rockchip: Improve RX noise immunity scsi: ufs: hwmon, debugfs: Propagate runtime PM resume errors scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails scsi: ufs: sysfs: Propagate runtime PM resume errors scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper scsi: ufs: core: Restore jiffies conversion of device management timeouts scsi: target: iscsi: Fix hanging WRITE_PENDING commands scsi: Revert "scsi: target: iscsi: Fix hang for aborted WRITE_PENDING commands" scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume ... |