1507472 Commits
Author SHA1 Message Date
Linus Torvalds 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
2026-11-19 14:05:24 -08:00
Linus Torvalds 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
2026-11-19 13:20:45 -08:00
Linus Torvalds 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()
2026-11-19 12:57:22 -08:00
Rafael J. Wysocki 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()
2026-11-19 20:23:59 +01:00
Linus Torvalds 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
2026-11-19 08:36:23 -08:00
orkunsari 1ecc5b7c95 nfsd: unlock the locked parent after crossing a mount in CREATE
Since commit f58a48389c ("nfsd: correctly handle CREATE of mounted-on
files"), nfsd_proc_create() and nfsd3_create_file() call
nfsd_cross_mnt() on the dentry returned by start_creating().  When the
name refers to a file that has something mounted on it,
nfsd_cross_mnt() replaces that dentry with the root of the mounted
filesystem and drops its reference to the original one.

The replacement is later passed to end_creating(), which unlocks the
d_parent of the dentry it is given.  That is the parent of the mount
source, not the directory start_creating() locked, so the directory
being created in is left locked and another directory's i_rwsem is
released without being held.

Do the crossing on a separate reference that is only used for
fh_compose(), so that the dentry returned by start_creating() is the
one passed to end_creating().  Only positive regular files are crossed,
so the later checks on the child dentry give the same result.

This was found by AI-assisted code review (Claude Code).  The fix has
been build-tested with W=1 only; no reproducer was run.

Fixes: f58a48389c ("nfsd: correctly handle CREATE of mounted-on files")
Signed-off-by: orkunsari <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Chuck Lever <[email protected]>
2026-11-19 11:14:13 -05:00
Linus Torvalds 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
  ...
2026-11-19 08:11:44 -08:00
Linus Torvalds 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
2026-11-19 08:04:04 -08:00
Chris J Arges 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: 1a37e412a0 ("net: Use 16bits for *_headers fields of struct skbuff")
Cc: [email protected]
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Chris J Arges <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Link: https://patch.msgid.link/20261118-prevent_rx_header_offset_overflow-v1-1-92a5be55f994@cloudflare.com
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 15:28:29 +01:00
Paolo Abeni 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]>
2026-11-19 14:48:04 +01:00
Chris Mason 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: 05bb1fad1c ("[TCP]: Allow minimum RTO to be configurable via routing metrics.")
Signed-off-by: Chris Mason <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 14:47:59 +01:00
Chris Mason 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: 645f4c6f2e ("tcp: switch rcv_rtt_est and rcvq_space to high resolution timestamps")
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 14:47:59 +01:00
Chris Mason 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: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Chris Mason <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 14:47:59 +01:00
Chris Mason 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 740b0f1841 ("tcp:
switch rtt estimations to usec resolution"), which took the wrap of the
smoothed RTT from 2^29 jiffies to 2^29 us.

The fix used here is to clamp each sample to 120 s, the largest possible
RTO, in tcp_rtt_estimator(), where the samples of all sources meet.

The smoothed RTT now saturates at 120 s. A path with a larger real RTT
sees that in TCP_INFO, in the pacing rate and in the metrics cache. BPF
programs on the RTT callback get the clamped sample too.

Found by code inspection (Eric Dumazet), and confirmed with LLM
generated reproducers on an unmodified kernel. Fixed by LLM, and
tested with the reproducers and existing kernel selftests.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Fixes: 740b0f1841 ("tcp: switch rtt estimations to usec resolution")
Signed-off-by: Chris Mason <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 14:47:59 +01:00
Chris Mason 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: 05bb1fad1c ("[TCP]: Allow minimum RTO to be configurable via routing metrics.")
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 14:47:59 +01:00
Julius Bairaktaris 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: 3a1296a38d ("net: Support GRO/GSO fraglist chaining.")
Tested-by: Henry Martin <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Signed-off-by: Julius Bairaktaris <[email protected]>
Link: https://patch.msgid.link/c976a72586cda383b3e42486ee3d0176033b973c.1794151759.git.julius@bairaktaris.de
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:28:50 +01:00
Paolo Abeni 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]>
2026-11-19 13:10:30 +01:00
Eric Dumazet 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 3744b0964d ("ipv6: Implement limits on extension header
parsing") a single chain is bounded to IP6_MAX_EXT_HDRS_CNT headers
(24576 bytes), so this needs a large skb->data - skb->head on top of it,
for instance after several nested decapsulations, each of them possibly
pulling its own extension header chain, since @offset is relative to
the IPv6 header embedded in the ICMPv6 error. No reproducer was written,
this is hardening.

Use skb_set_transport_header_careful() and return an error if the
offset can not be stored, in which case udpv6_err() ignores the
ICMPv6 error. Do this before changing the network header, so that
nothing has to be restored on failure.

Fixes: a36e185e8c ("udp: Handle ICMP errors for tunnels with same destination port on both endpoints")
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Stefano Brivio <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Justin Iurman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:10:27 +01:00
Eric Dumazet 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 3744b0964d ("ipv6: Implement limits on extension header
parsing") a single chain is bounded to IP6_MAX_EXT_HDRS_CNT headers
(24576 bytes), so this needs a large skb->data - skb->head on top of it,
for instance after several nested decapsulations, each of them possibly
pulling its own extension header chain, since @offset is relative to
the IPv6 header embedded in the ICMPv6 error. No reproducer was written,
this is hardening.

Use skb_set_transport_header_careful() and ignore the ICMPv6 error if
the offset can not be stored. Do this before changing the network
header, so that nothing has to be restored on failure.

Fixes: 1a37e412a0 ("net: Use 16bits for *_headers fields of struct skbuff")
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Justin Iurman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:10:27 +01:00
Eric Dumazet 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 3744b0964d ("ipv6: Implement limits on extension header
parsing") a single chain is bounded to IP6_MAX_EXT_HDRS_CNT headers
(24576 bytes), so this needs a large skb->data - skb->head on top of it,
for instance after several nested decapsulations, each of them possibly
pulling its own extension header chain. No reproducer was written,
this is hardening.

Use skb_set_transport_header_careful() and return -EPROTO if the offset
can not be stored. As for other ipv6_find_hdr() failures, the caller
then sets the transport header to the network header and does not
parse L4. While at it, use payload_ofs directly, since
nh_ofs + nh_len == payload_ofs.

Fixes: 1a37e412a0 ("net: Use 16bits for *_headers fields of struct skbuff")
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Ilya Maximets <[email protected]>
Reviewed-by: Aaron Conole <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Justin Iurman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:10:26 +01:00
Eric Dumazet 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 3744b0964d ("ipv6: Implement limits on extension header
parsing") a single chain is bounded to IP6_MAX_EXT_HDRS_CNT headers
(24576 bytes), so this needs a large skb->data - skb->head on top of it,
for instance after several nested decapsulations, each of them possibly
pulling its own extension header chain. No reproducer was written,
this is hardening.

Use skb_set_transport_header_careful() and treat such a packet as
broken (-EINVAL).

Fixes: 9afd85c9e4 ("net: Export IGMP/MLD message validation code")
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Justin Iurman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:10:26 +01:00
Eric Dumazet 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 3744b0964d ("ipv6: Implement limits on extension header
parsing"), ip6_protocol_deliver_rcu() drops packets carrying more than
IP6_MAX_EXT_HDRS_CNT extension headers, but ipv6_gro_pull_exthdrs()
was left unbounded.

There is no point trying to aggregate packets that the stack is going
to drop anyway if they are locally delivered. Apply the same limit in
ipv6_gro_pull_exthdrs().

When the limit is hit, @proto still designates an extension header.
Extension header offloads have no gro_receive() callback, so
ipv6_gro_receive() takes its existing "goto out" path with flush set,
and the packet is given to the normal receive path. Local delivery
drops it with SKB_DROP_REASON_IPV6_TOO_MANY_EXTHDRS, while forwarded
packets are simply not aggregated.

An extension header being at most 2048 bytes, this bounds a chain
to 24576 bytes.

Note that offsets can still accumulate over nested encapsulations,
so the places storing them should be hardened separately.

Fixes: 4b0ebbca3e ("net: gro: move L3 flush checks to tcp_gro_receive and udp_gro_receive_segment")
Cc: [email protected]
Reported-by: Hyunwoo Kim <[email protected]>
Link: https://lore.kernel.org/netdev/avTTQNyvwPP6LtGx@v4bel/
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ido Schimmel <[email protected]>
Tested-by: Hyunwoo Kim <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Reviewed-by: Aaron Conole <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Justin Iurman <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 13:10:26 +01:00
Paolo Abeni 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 fe40427976 ("net: stmmac: dwmac4: stop hardware from dropping
checksum-error packets") did for dwmac4.

Patch 1 makes the AF_XDP zero-copy Rx path honour the checksum error
status. That path already receives such frames on dwmac4, and patches
2 and 3 make them reach it on dwmac1000 as well. Patch 3 depends on
patches 1 and 2.

Tested on an Aruba AP-325 (ipq806x-gmac-dwmac) on the net tree, with
and without the series.

Not tested:

- Patch 1 was only compile-tested, as an AF_XDP zero-copy setup was not
  available.
- dwmac-loongson, which also uses dwmac1000_dma_ops.
- Cores with normal descriptors, such as Rockchip RK3288, RK3328 and
  RK3399.

v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/
====================

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 12:47:31 +01:00
Christian Schmidbauer 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 fe40427976 ("net: stmmac: dwmac4: stop hardware from
dropping checksum-error packets") did for dwmac4. CoE remains enabled,
so the driver still sees the error status and marks the skb
CHECKSUM_NONE for the stack to verify.

Set the bit only with enhanced descriptors. The normal descriptor parser
does not report a checksum-only error to the stack, so cores that use
it keep dropping such frames in hardware anyway.

Tested on an Aruba AP-325 (ipq806x-gmac-dwmac) with Rx checksum offload
on.

Link: https://lore.kernel.org/all/[email protected]/
Link: https://github.com/freifunk-gluon/gluon/issues/3783
Fixes: 47dd7a540b ("net: add support for STMicroelectronics Ethernet controllers.")
Cc: <[email protected]> # 6.6.x: ee0aace5f8: net: stmmac: Correctly handle Rx checksum offload errors
Cc: <[email protected]> # 6.6.x
Signed-off-by: Christian Schmidbauer <[email protected]>
Reviewed-by: Maxime Chevallier <[email protected]>
Tested-by: Maxime Chevallier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 12:47:26 +01:00
Christian Schmidbauer 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 1b746ce8b3 ("net:
stmmac: don't overwrite discard_frame status") the checksum status is
only evaluated for good frames.

Return discard_frame only when ES comes with one of the L2 error bits.
A frame with only a checksum error is then reported as csum_none and
reaches the stack as CHECKSUM_NONE, so the stack verifies the checksum
itself. This matches dwmac4, whose Error Summary bit does not cover
checksum errors.

RDES0 bit 7 is not in the mask, because depending on the core and on
Rx checksum offload it reports a timestamp, an IP header checksum error
or a giant frame, and enh_desc_get_rx_status() cannot tell which. In
threshold Rx mode, a giant frame that fits one buffer therefore reaches
the stack with a verified FCS.

Also remove the pr_err that enh_desc_get_rx_status() prints when bit 7
is set. Once the MAC stops dropping checksum-error frames, any host on
the link can flood the kernel log by sending frames with a bad IPv4
header checksum.

This prepares for setting DMA_CONTROL_DT, which makes the MAC deliver
checksum-error frames instead of dropping them in its Rx FIFO.

Fixes: 1b746ce8b3 ("net: stmmac: don't overwrite discard_frame status")
Cc: <[email protected]> # 6.6.x: ee0aace5f8: net: stmmac: Correctly handle Rx checksum offload errors
Cc: <[email protected]> # 6.6.x
Signed-off-by: Christian Schmidbauer <[email protected]>
Reviewed-by: Maxime Chevallier <[email protected]>
Tested-by: Maxime Chevallier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 12:47:20 +01:00
Christian Schmidbauer fcfc52fcf8 net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
Commit ee0aace5f8 ("net: stmmac: Correctly handle Rx checksum offload
errors") taught stmmac_rx() to honour the csum_none status, but
stmmac_dispatch_skb_zc() still ignores it and sets CHECKSUM_UNNECESSARY
for every IP frame whenever the checksum offload engine (CoE) is
enabled.

Since commit fe40427976 ("net: stmmac: dwmac4: stop hardware from
dropping checksum-error packets") dwmac4 delivers such frames instead of
dropping them, so this path receives them.

Mark the skb CHECKSUM_NONE when csum_none is set, as stmmac_rx() does.

Fixes: bba2556efa ("net: stmmac: Enable RX via AF_XDP zero-copy")
Cc: <[email protected]>
Signed-off-by: Christian Schmidbauer <[email protected]>
Reviewed-by: Maxime Chevallier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 12:47:15 +01:00
Paolo Abeni 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]>
2026-11-19 11:51:05 +01:00
Simon Schippers b2f4c44d7d veth: wake the peer txq when deleting NAPI
Since commit dc82a33297 ("veth: apply qdisc backpressure on full
ptr_ring to reduce TX drops"), only the peer's veth_poll() wakes a txq
that veth_xmit() stopped on a full ptr_ring.

If veth_xmit() stops the txq after the last poll before napi_disable(),
its __veth_xdp_flush() can no longer schedule NAPI. Nothing wakes the
txq, also not after NAPI is added back, so the device stops transmitting
for good. This can happen whenever the peer deletes its NAPI: when it
goes down, turns GRO off, detaches XDP or reduces its RX channels.

Wake the peer txq in veth_napi_del_range() once NAPI is deleted, also
when the peer is down, as opening it does not restart its queues.

Reproduced in virtme-ng with a pktgen flood while toggling GRO on the
peer, with a udelay() before netif_tx_stop_queue() to widen the race:
the txq got stuck within four toggles without this patch, and not in 300
with it. Without the udelay() it was not hit in 1200 toggles.

Fixes: dc82a33297 ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops")
Signed-off-by: Simon Schippers <[email protected]>
Reviewed-by: Tianyi Gao <[email protected]>
Tested-by: Tianyi Gao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 11:50:59 +01:00
Simon Schippers 8a0b03058f veth: wake a stopped peer txq beyond real_num_tx_queues
Since commit dc82a33297 ("veth: apply qdisc backpressure on full
ptr_ring to reduce TX drops"), only the peer's veth_poll() wakes a txq
that veth_xmit() stopped on a full ptr_ring. veth_poll() skips txqs at
or above the peer's real_num_tx_queues.

If the peer shrinks its TX channels while such a txq is stopped, nothing
wakes it. netif_set_real_num_tx_queues() keeps its state, so once the
channels are grown back, its first skb is requeued forever. With a single
root qdisc this blocks all transmission of the device.

Look the txq up below num_tx_queues instead. Waking a txq that is not in
use is harmless.

Reproduced in virtme-ng with a UDP flood from veth0 into veth1, which has
GRO, while switching veth0 between one and two TX channels: without this
patch veth0 stopped transmitting within 11 cycles in 3 of 3 runs, with
it veth0 kept transmitting through 30 cycles in 3 of 3 runs.

Fixes: 08f566e8f8 ("veth: fix OOB txq access in veth_poll() with asymmetric queue counts")
Signed-off-by: Simon Schippers <[email protected]>
Reviewed-by: Tianyi Gao <[email protected]>
Tested-by: Tianyi Gao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
2026-11-19 11:50:44 +01:00
Jakub Kicinski 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]>
2026-11-18 17:49:43 -08:00
Xuanqiang Luo 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: d734223b2f ("iavf: add initial framework for registering PTP clock")
Link: https://docs.kernel.org/driver-api/ptp.html#writing-clock-drivers
Link: https://lore.kernel.org/all/[email protected]/
Cc: [email protected]
Signed-off-by: Xuanqiang Luo <[email protected]>
Reviewed-by: Vadim Fedorenko <[email protected]>
Acked-by: Jacob Keller <[email protected]>
Tested-by: Rafal Romanowski <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:49:43 -08:00
Xuanqiang Luo 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: d358aa9a7a ("i40evf: init code and hardware support")
Cc: [email protected]
Signed-off-by: Xuanqiang Luo <[email protected]>
Reviewed-by: Jedrzej Jagielski <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:49:42 -08:00
Xuanqiang Luo 65f6ffb900 iavf: fix QoS capabilities memory leak
Commit 4c1a457cb8 ("iavf: add support to exchange qos capabilities")
allocates adapter->qos_caps during probe, but iavf_remove() does not
free it. This leaks the allocation whenever an iavf device is removed.

Free adapter->qos_caps in iavf_remove().

Fixes: 4c1a457cb8 ("iavf: add support to exchange qos capabilities")
Cc: [email protected]
Reviewed-by: Jedrzej Jagielski <[email protected]>
Signed-off-by: Xuanqiang Luo <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:49:42 -08:00
Aleksandr Loktionov 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: 9f65e15b4f ("i40e: Move rings from pointer to array to array of pointers")
Cc: [email protected]
Signed-off-by: Aleksandr Loktionov <[email protected]>
Tested-by: Alexander Nowlin <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:49:42 -08:00
Filip Balluch 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: 74608d17fe ("i40e: add support for XDP_TX action")
Signed-off-by: Filip Balluch <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Tested-by: Alexander Nowlin <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:49:42 -08:00
Jakub Kicinski 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]>
2026-11-18 17:31:47 -08:00
Omar Ramadan 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 b9022b53ad ("amt: add control plane of amt interface"), when
there was no receive path yet, and
commit cbc21dc1cf ("amt: add data plane of amt interface") added
amt_rcv() and the per-tunnel copy of the key without moving it. Since
then a Request that arrived during amt_dev_open() could get a tunnel
whose MAC used an all-zero key (on the first open) or the previous key
for the tunnel's whole life.

amt_update_tunnel() retries once when it finds its tunnel dead, and the
lookup skips dead tunnels, so an Update that races amt_tunnel_expire()
creates the replacement instead of being dropped. The Request path's
per-source count and the re-check under amt->lock in
amt_tunnel_get_or_create() skip them too. Every tunnel is now created by
an Update, which stamps last_seen, so amt_tunnel_expire() no longer
treats a last_seen of 0 as never refreshed. amt_tunnel_get_or_create()
also rechecks netif_running() under amt->lock before it links a tunnel.
dev_close() clears the running state before it calls amt_dev_stop(),
which drains the list under amt->lock, so an Update still being received
while the device goes down cannot link a tunnel after the drain.

Every Membership Update, forged ones included, reads the secret
generations to check its MAC. Their writers hold amt->lock and update
them inside a seqcount, amt->key_seq. The Update path copies them in a
key_seq read loop, so reading them takes amt->lock only on PREEMPT_RT,
to wait for a writer.

Keying by address and port lets one address hold several tunnels; before
this patch the Request path looked tunnels up by address alone, so an
address normally held only one. amt_max_tunnels_per_src() bounds that
at an eighth of max_tunnels, at least one tunnel and at most
AMT_MAX_TUNNELS_PER_SRC (16): 16 at the default 128 slots, 2 at 16. One
address then holds at most an eighth of a table of eight or more slots,
while gateways behind NAT still get several tunnels once the table has
16 or more slots. A configurable limit needs new uAPI, so it is left
for net-next.

Found by code inspection against RFC 7450; not triggered at runtime.
The Sashiko AI review of an earlier posting pointed out the undocumented
behaviour changes and that a fixed per-source cap let one address fill
a small table.

Fixes: cbc21dc1cf ("amt: add data plane of amt interface")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:45 -08:00
Omar Ramadan 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: cbc21dc1cf ("amt: add data plane of amt interface")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:45 -08:00
Omar Ramadan 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: b9022b53ad ("amt: add control plane of amt interface")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:45 -08:00
Omar Ramadan 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: cbc21dc1cf ("amt: add data plane of amt interface")
Fixes: 30e22a6ebc ("amt: use workqueue for gateway side message handling")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:45 -08:00
Omar Ramadan 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: cbc21dc1cf ("amt: add data plane of amt interface")
Fixes: bc54e49c14 ("amt: add multicast(IGMP) report message handler")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:44 -08:00
Omar Ramadan 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 3cf7203ca6 ("net/tunnel:
wait until all sk_user_data reader finish before releasing the sock")
until commit 72d3b9a4c2 ("udp_tunnel: Remove synchronize_rcu() in
udp_tunnel_sock_release()."), udp_tunnel_sock_release() waited for
those readers after clearing sk_user_data, which hid it. The wait was
removed because each tunnel driver frees its fast-path state only after
a grace period, but amt_rcv() does more than read that state: it queues
work and links tunnels that amt_dev_stop() must already have stopped.

Found by code inspection; not triggered.

Fixes: cbc21dc1cf ("amt: add data plane of amt interface")
Fixes: 72d3b9a4c2 ("udp_tunnel: Remove synchronize_rcu() in udp_tunnel_sock_release().")
Signed-off-by: Omar Ramadan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 17:26:44 -08:00
Eric Dumazet 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: 0536fcc039 ("tcp: prepare fastopen code for upcoming listener changes")
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Hyunwoo Kim <[email protected]>
Reviewed-by: Kuniyuki Iwashima <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 16:30:42 -08:00
Mateusz Jończyk 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: f0667918d5 ("net: phy: realtek: add support for RTL8261D")
Signed-off-by: Mateusz Jończyk <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 16:27:59 -08:00
Theodor Arsenij Larionov Trichkine 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: 5632848653 ("net: Changes to ip_tunnel to support foo-over-udp encapsulation")
Fixes: ac931d4cde ("ipip,ip_tunnel,sit: Add FOU support for externally controlled ipip devices")
Reported-by: Chengfeng Ye <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]/
Cc: [email protected]
Signed-off-by: Theodor Arsenij Larionov Trichkine <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 16:17:52 -08:00
Alexey Charkov 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: 2d283862dc ("net: via-rhine: add OF bus binding")
Signed-off-by: Alexey Charkov <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 15:58:56 -08:00
Arun Iyengar 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: ec222003bd ("net: stmmac: Prepare to add Split Header support")
Cc: [email protected]
Signed-off-by: Arun Iyengar <[email protected]>
Reviewed-by: Maxime Chevallier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 15:47:58 -08:00
Changyul Lee 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: c5eb51adf0 ("net/mlx5e: Fix VXLAN synchronization after function reload")
Signed-off-by: Changyul Lee <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
2026-11-18 15:41:35 -08:00
Rafael J. Wysocki b91ad39f29 ACPI: PM: Avoid initializing power management for absent devices
Commit 2f4ddf2bd1 ("ACPI: scan: Stop calling acpi_bus_init_power()
early") removed a device presence check from acpi_bus_init_power() which
in some cases causes power management to be initialized for an ACPI
device object and never used going forward.  That in turn may prevent
power management from working as expected for other devices.

Namely, if a given ACPI device object is not enabled according to its
_STA, find_child_checks() will return an error for it which will prevent
it from being used as an ACPI companion for a PCI device.  Thus if
acpi_device_init_power() initializes power management for it and its
initial power state turns out to be different from D3cold, it may stay
in that power state forever.  If it has power resources and they are
"on" during the initialization, they may be reference-counted and never
turned off.  If they are shared with other devices, they will prevent
power from going down after attempting to put the other devices into
low-power states.

To prevent that from happening, restore the device presence check in
acpi_bus_init_power(), but also adjust find_child_checks() to return
an error for absent devices (instead of doing that for disabled devices)
in accordance with acpi_bus_init_power() and the existing check in
acpi_bus_attach().

Fixes: 2f4ddf2bd1 ("ACPI: scan: Stop calling acpi_bus_init_power() early")
Reported-by: Alan Borzeszkowski <[email protected]>
Tested-by: Alan Borzeszkowski <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Tested-by: Mika Westerberg <[email protected]>
Reviewed-by: Mika Westerberg <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Rafael J. Wysocki <[email protected]>
2026-11-18 22:03:40 +01:00
Linus Torvalds 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
  ...
2026-11-18 11:21:30 -08:00