Merge tag 'net-7.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni:
"Including fixes from WiFi, Bluetooth and CAN.
Current release - regressions:
- eth: mlx5e: TC, fix a NULL pointer write in the peer flow error path
Current release - new code bugs:
- xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
- eth: b53: use the correct override register 2 Gbps bit
Previous releases - regressions:
- core:
- do not run out of frags in alloc_skb_with_frags()
[78 lines not shown]
Merge tag 'ext4_for-linus-7.4-rc5-postmerge' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o:
"Fix the KUnit ext4_xattr_test by adding missing stub registration
after the recent merge into mainline.
Also address two teset failures that weren't noticed in my original
pre-PR testing.
- Fix the ext4_inode_test when CONFIG_USER_NS is enabled
- Fix generic/311 failure for ext4 with the fast_commit and
inline_data features are enabled"
* tag 'ext4_for-linus-7.4-rc5-postmerge' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: don't track metadata buffers on an inode during fast commit replay
ext4: set s_user_ns in the KUnit tests' fake superblocks
ext4: stub ext4_sb_find_get_block_nonatomic() in the inode KUnit tests
sched/wait: kill leftover bookmark logic in __wake_up_common()
The manual list head check and list_for_each_entry_safe_from() in
__wake_up_common() are leftovers from commit 2554db916586 ("sched/wait:
Break up long wake list walk").
This logic was later removed by commit 37acade0ce89 ("sched: remove
wait bookmarks") but the now-unnecessary list hacks were left behind.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
sctp: don't let a blocked reader take write-space wakeups
sctp_wait_for_packet() waits exclusively on sk_sleep() with the default
autoremove wake function, so it accepts any wakeup and consumes it.
Then __sctp_write_space() sends EPOLLOUT with a wake-one wakeup:
sctp_wait_for_packet() wakes up, finds no data, goes back to sleep, and
the walk stops.
End result: anybody else queued behind it that was waiting for EPOLLOUT
will never see it.
Filter on EPOLLIN | EPOLLERR like receiver_wake_function() in
net/core/datagram.c. State changes (using sock_def_wakeup()) use an
unkeyed wake-all and still get through and will ignore the exclusive
nature of sctp_wait_for_packet().
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com>
[5 lines not shown]
Merge tag 'linux-can-fixes-for-7.4-20261124' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says:
====================
pull-request: can 2026-11-24
this is a pull request of 12 patches for net/main.
The first 7 patches are by Oliver Hartkopp and avoid RTNL stalls in
CAN_RAW, CAN_ISOTP and CAN_BCM protocols and fix CAN_ISOTP issues.
Followed by 3 patches are by Zhu Ling that fix problems with the CAN
netlink handling.
A patch by my fixes a kernel memory information leak over USB in the
gs_usb driver.
Uwe Kleine-König contributes a patch to the flexcan driver to fix
[22 lines not shown]
udp: only quit inuse scan early on identical SO_REUSEPORT sockets
Commit df560056d960 ("udp: inuse checks can quit early for reuseport")
optimized udp_lib_lport_inuse() and udp_lib_lport_inuse2() to return 0
immediately upon encountering the first same-UID SO_REUSEPORT socket
that matches under wildcard conflict rules.
However, a socket that matches under wildcard rules (or shares only a
relaxed subset of bind attributes) does not guarantee that the remaining
sockets in hslot->head or hslot2->head are conflict-free for the new
socket. Because IPv4 UDP sockets prepend to the head of the hash chain,
an unprivileged local user can bind a non-conflicting SO_REUSEPORT
socket (e.g., 127.0.0.2:PORT) ahead of another user's exclusive
127.0.0.1:PORT UDP listener, then bind 0.0.0.0:PORT (returning early on
127.0.0.2:PORT without reaching the exclusive listener), and finally
bind 127.0.0.1:PORT at the head of hslot2->head to intercept cross-UID
UDP datagrams.
Only take the O(1) early exit when sk and sk2 share the exact same
[19 lines not shown]
net: dsa: tag_brcm: fix link-local detection with a prepended tag
brcm_tag_rcv_ll() checks eth_hdr(skb)->h_dest to avoid marking link-local
frames as forwarded by the switch. With a prepended tag, eth_type_trans()
sets the MAC header at the start of the tag, so the address checked is the
tag plus the first two bytes of the real destination address. Link-local
frames such as BPDUs, LLDP or EAPOL are then not recognized and get
skb->offload_fwd_mark set, which keeps the bridge from forwarding them in
software to the other ports of the switch when it is configured to do so.
Read the destination address after the tag instead when the tag is
prepended. Tags embedded after the source address are not affected.
Fixes: 762e7e174da9 ("net: dsa: tag_brcm: do not mark link local traffic as offloaded")
Signed-off-by: Florian Fainelli <florian.fainelli at broadcom.com>
Link: https://patch.msgid.link/20261118184004.1916105-1-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni at redhat.com>
Merge branch 'tg3-bug-fixes'
Pavan Chebbi says:
====================
tg3: Bug fixes
This patchset has 4 fixes. The first patch restores probe on 57766 when
the 31-bit coherent DMA mask cannot be set. The second patch makes NCSI
PLL lock on the TLP clock to fix WOL at 1G speed on 5720. The third
patch fixes ethtool -i display on 5719/5720 when NCSI component is
missing. The fourth one fixes a possible heap overflow in the NVRAM
write path.
v1: https://lore.kernel.org/all/20261108065526.710152-1-pavan.chebbi@broadcom.com/
====================
Link: https://patch.msgid.link/20261118105408.1076095-1-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni at redhat.com>
tg3: Skip management FW version when APE firmware is not ready
When the APE firmware is not present or not ready, for example when
the NCSI component is missing in the NVRAM, tg3_read_fw_ver() still
calls tg3_read_dash_ver() after tg3_probe_ncsi(). The signature and
ready checks that tg3_read_dash_ver() used to make were moved into
tg3_probe_ncsi(), which only sets the NCSI flag and does not stop the
caller. The driver then reads the APE firmware version register, which
holds no valid data in this state, and ethtool -i shows an invalid
"DASH" string with a garbage version.
Make tg3_probe_ncsi() return whether valid, ready APE firmware was
found, and read the version only in that case. Otherwise just report
the bootcode version.
This was seen by a user on BCM5719/BCM5720 with no NCSI component in
the NVRAM. With this change, ethtool -i displays only the bootcode
version.
[5 lines not shown]
tg3: Fix heap overflow in unbuffered NVRAM write path
tg3_nvram_write_block_unbuffered() reads a whole NVRAM page into a
buffer of pagesize bytes, copies the caller's data into it at page_off,
and writes the page back. The copy size was clamped to pagesize rather
than to the room left in the page, pagesize - page_off, so a write at an
offset that is not page aligned, as ETHTOOL_SEEPROM allows, copies past
the end of the buffer and corrupts the kernel heap.
Clamp size to pagesize - page_off. Also advance buf by size on each
iteration. Without this, a write that spans more than one page
programmed every page after the first with the data of the first page,
and a write that did not start on a page boundary lost the tail of the
data without reporting an error.
Reject an nvram_pagesize that is smaller than 4 or not a power of two.
The page mask is pagesize - 1, which is only a valid mask for a power
of two. A page size of 0, which tg3_get_nvram_info() leaves unset for
an unhandled flash vendor, also made the loop issue erase commands at
[13 lines not shown]
tg3: Don't fail probe if 31-bit coherent DMA mask is unsupported
Commit 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for
BCM57766 chipsets") lowered the coherent DMA mask to 31 bits as a
workaround for a spurious address overflow error in the hardware.
The result of dma_set_coherent_mask() is fatal to probe, so on
platforms that cannot satisfy such a mask the device fails to probe:
tg3 0000:01:00.0: Unable to obtain 64 bit DMA for consistent allocations
tg3 0000:01:00.0: probe with driver tg3 failed with error -5
This was reported on a Mac mini (Macmini6,2, BCM57766) running a
kernel built without CONFIG_ZONE_DMA and with IOMMU passthrough as
the default. Without CONFIG_ZONE_DMA, dma_direct_supported() only
accepts a mask narrower than 32 bits if it covers the highest
physical memory address, so with direct mapping a 31-bit coherent
mask is rejected whenever memory extends above 2GB.
Treat the 31-bit mask as best effort. If it is refused, warn and fall
[15 lines not shown]
Merge branch 'tls-don-t-hide-a-queued-keyupdate-from-poll'
Felipe Pereira Stival says:
====================
tls: don't hide a queued KeyUpdate from poll()
A kTLS reader that waits for a read event before each recv() can stall
after the peer sends a TLS 1.3 KeyUpdate. I ran into this while testing
a kTLS patch for Erlang/OTP.
Erlang does one recv() per read event, with level-triggered epoll.
When application data is followed by a KeyUpdate, one recv() can
decrypt both records, return the data without an error, and leave the
KeyUpdate queued. Because a rekey is now pending, poll() no longer
reports the socket as readable. Without another read event, the reader
never calls recv() again, never sees the -EIO for the KeyUpdate, and
never provides the new key.
[16 lines not shown]
selftests: tls: add a poll test for a queued KeyUpdate
Check that poll() reports a read event when a recv() for data has
decrypted and queued a KeyUpdate. Once the KeyUpdate has been read,
check that poll() doesn't report a record sent with the new key.
Signed-off-by: Felipe Pereira Stival <v0idpwn at gmail.com>
Reviewed-by: Simon Horman <horms at kernel.org>
Reviewed-by: Sabrina Dubroca <sd at queasysnail.net>
Link: https://patch.msgid.link/20261118-v0idpwn-tls-poll-parked-keyupdate-v1-2-8e25101e7be6@gmail.com
Signed-off-by: Paolo Abeni <pabeni at redhat.com>
tls: don't hide a queued KeyUpdate from poll()
When application data and a KeyUpdate are both queued, the recv() for
the data can also decrypt the KeyUpdate. That makes a rekey pending,
and the KeyUpdate is left on rx_list because its record type differs.
tls_sk_poll() reports no read events while a rekey is pending, so the
socket doesn't poll readable although a recvmsg() would return the
KeyUpdate. A reader that waits for a read event before each recv()
never reads it, never provides the new key and receives nothing more.
Report read events for records on rx_list while a rekey is pending,
since they are already decrypted. Keep ignoring the records still in
the strparser, so once the KeyUpdate has been read there are no read
events until the new key is provided, as before. Update the
documentation to say so.
Found with a level-triggered epoll reader that does one recv() per
read event. Without this patch it gets the data and then no read event
for the KeyUpdate; with it, the KeyUpdate is reported and the rekey
[8 lines not shown]
xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
AF_XDP sockets bound to an xfrm interface submit skbs with
skb->protocol unset (0) and skb->network_header still 0 from the
__alloc_skb() zero-initialization; skb_reserve() only moves data
NET_SKB_PAD bytes into the headroom.
Since commit 86de3a1118a16 ("xfrm: interface: validate the IP header
on xmit"), xfrmi_xmit() calls pskb_inet_may_pull() unconditionally.
For such a skb, pskb_inet_may_pull_reason() selects nhlen = 0 for the
unknown protocol and pskb_may_pull_reason() receives
len = skb_network_offset(skb) = network_header - data = -64, which as
unsigned int exceeds INT_MAX and trips the
DEBUG_NET_WARN_ON_ONCE(len > INT_MAX) in pskb_may_pull_reason():
WARNING: ./include/linux/skbuff.h:2856 at pskb_may_pull_reason [inline]
WARNING: ./include/linux/skbuff.h:3286 at pskb_network_may_pull_reason [inline]
WARNING: ./include/net/ip_tunnels.h:483 at pskb_inet_may_pull_reason [inline]
WARNING: ./include/net/ip_tunnels.h:488 at pskb_inet_may_pull [inline]
[23 lines not shown]
net: dpaa2-eth: fix objtool warning and logic bug
This commit came about because I locally had a build with COMPILE_TEST
and various runtime hardening features (that don't make sense for a pure
build test anyway) disabled - and objtool complained about some of the
code as a result:
drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.o: warning: objtool: dpaa2_eth_add_bufs+0x3f8: stack state mismatch: reg1[15]=-1+0 reg2[15]=-2-208
The reason seems to be that without the hardening features, objtool
notices that gcc is doing really odd things with the 'page' variable,
which is uninitialized in the path where 'ch->xsk_zc' is true.
Now, this seems to be just objtool becoming confused about some ugly
code, but that code is _also_ actively buggy in a different way, so
let's just fix this all.
What confuses objtool seems to be the stack slot for the uninitialized
'page' variable - for the case where that variable isn't actually used.
[54 lines not shown]
Merge tag 'for-7.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba:
"A number of fixes as reported on the Sashiko Bugs page and the usual
bag of regular fixes:
- send fixes:
- fix sending file hole punching command in incremental mode
- fix invalid memory access for inline extent
- fixes for nowait semantics:
- fix memory allocation in encoding read ioctl
- don't wait for ordered extents in buffered write
- don't propagate nodatacow from mount option to files with
compression flag inherited from parent directory
- fix fsync mode in encoded write so the data are fully written
[38 lines not shown]
Merge tag 'probes-fixes-v7.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu:
- Do not let KASAN check the $stackN read
Use READ_ONCE_NOCHECK() in ftrace_regs_get_kernel_stack_nth() so
reading $stackN entries that fall in another frame's redzone does not
trigger KASAN stack-out-of-bounds splats under CONFIG_KASAN_STACK
- Zero out faulted dereferenced fields
Zero the destination in probe_mem_read() and probe_mem_read_user() on
read failure and continue storing zero in process_fetch_insn_bottom()
instead of leaving stale ring-buffer contents when a dereference
faults
* tag 'probes-fixes-v7.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing/probes: Zero out faulted dereferenced fields
tracing/fprobe: Do not let KASAN check the $stackN read
ext4: don't track metadata buffers on an inode during fast commit replay
Fast commit replay runs without a journal handle and before
EXT4_SB(sb)->s_journal is set, so it effectively runs in nojournal mode.
__ext4_handle_dirty_metadata() then hands every extent tree block and
directory block it dirties to mmb_mark_buffer_dirty().
Commit d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in
mmb_mark_buffer_dirty()") sets this flag on the inode, which can
trigger a NULL pointer dereference on a per-cpu pointer during the
fast commit replay. This is because the iput at the end of each fast
commit update triggers write_inode_now(), and with
I_METADATA_WRITEBACK set, writeback_single_inode() will end up calling
ext4_writepages(), before ext4_percpu_param_init() has initialized
s_writepages_rwsem.
A similar crash was fixed in commit 0ecd56573c1f ("ext4: Avoid
entering writeback paths during fastcommit replay") by not setting
this flag in ext4_mark_iloc_dirty(). This commit applies the same fix
[12 lines not shown]
net/tcp-ao: fix reset key lookup for IPv4 segments on IPv6 listeners
tcp_ao_prepare_reset() looks up the key for a reset that is sent on
behalf of a listener by the address of the peer. It takes that address
from the IPv6 header whenever the listener is an AF_INET6 socket, also
when the segment is an IPv4 one that arrived on a dual-stack listener.
The address is then read from the middle of the IPv4 header, the key of
the peer is not found and the reset is not sent.
The v4-mapped check that follows does not help: it looks at
sk->sk_v6_daddr, which is the unspecified address for a listener, and
it runs after the address has been picked.
Take the family and the address from the protocol of the segment
instead of the family of the socket.
Fixes: 06b22ef29591 ("net/tcp: Wire TCP-AO to request sockets")
Cc: stable at vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707 at gmail.com>
[4 lines not shown]
tcp: Don't clear saddr before ->put_port().
When CGROUP_INET4_POST_BIND or CGROUP_INET6_POST_BIND prog fails,
__inet_bind() / __inet6_bind() calls sk->sk_prot->put_port().
For TCP, __inet_put_port() calls inet_bhashfn_portaddr() to get
the corresponding bhash2 bucket.
inet_bhashfn_portaddr() requires saddr, but it is cleared before
__inet_put_port(), leading to bhash2 lock mismatch.
This triggers list corruption or use-after-free by a conccurent
thread touching the same bhash2 bucket, e.g. tcp_diag_dump()
with TCPF_BOUND_INACTIVE. [0]
Let's clear saddr after calling sk->sk_prot->put_port().
[0]:
BUG: KASAN: slab-use-after-free in tcp_diag_dump (net/ipv4/tcp_diag.c:415)
[59 lines not shown]
vhost/net: Fix receive queue test in busy poll
sock_has_rx_data() returns a positive value when receive data is
available. For sockets without a peek_len() callback, however, its
fallback returns skb_queue_empty(), which has the opposite meaning.
An AF_PACKET SOCK_RAW socket is accepted by get_raw_socket() as a
vhost-net backend, and its socket operations do not provide peek_len().
With busy polling enabled for this backend, an empty receive queue is
treated as ready and a nonempty queue as not ready. This can make
vhost_net_busy_poll() stop polling prematurely or fail to stop for
queued receive data, and invert its receive-side scheduling decision.
TUN and TAP backends provide peek_len() and are unaffected.
Negate skb_queue_empty() so the fallback matches the callback and the
readiness checks in vhost_net_busy_poll().
The issue was found during AI-assisted code review. The helper's
incorrect result was confirmed on x86_64 running 6.6.0-amd64-desktop
[19 lines not shown]
ipv6: mcast: do not pass uninitialized bytes to dev_mc_add()
igmp6_group_added() and igmp6_group_dropped() build a link-layer
multicast address in an on-stack buffer with ndisc_mc_map(), which
fills a number of bytes depending on dev->type.
dev_mc_add() and dev_mc_del() then use dev->addr_len bytes of it.
Since IPv6 multicast joins and leaves no longer hold RTNL, dev->type
and dev->addr_len can change between the two steps, for instance with
TUNSETLINK, or when bonding or team change their type.
If addr_len grows (eg ARPHRD_ETHER -> ARPHRD_IP6GRE), dev_mc_add()
copies uninitialized stack bytes into a netdev_hw_addr, which can
later be dumped to user space by /proc/net/dev_mcast and
RTM_GETMULTICAST.
Zero the buffers.
[11 lines not shown]
tipc: restore write readiness when a socket's group goes away
tipc_group_create() sets tsk->group_is_open to false, and tipc_poll()
only reports EPOLLOUT for a socket in TIPC_OPEN state when that flag is
true. Commit 1b22bcad7e39 ("tipc: correct initial value for group
congestion flag") made sure the flag is true for sockets that never
join a group, since otherwise "SOCK_RDM/DGRAM sockets sending datagrams
never receive POLLOUT".
The flag is not set back when the group goes away again, though:
- tipc_group_create() clears the flag and then fails when the topology
subscription cannot be created, for example when TIPC_MAX_SUBSCR
subscriptions exist already;
- tipc_sk_join() deletes the new group when tipc_sk_publish() fails,
for example when the node's publication limit is reached;
- tipc_sk_leave() deletes the group while the flag may still be false,
e.g. because of group congestion, or because the group has no other
members yet.
[22 lines not shown]
sched/wait: kill leftover bookmark logic in __wake_up_common()
The manual list head check and list_for_each_entry_safe_from() in
__wake_up_common() are leftovers from commit 2554db916586 ("sched/wait:
Break up long wake list walk").
This logic was later removed by commit 37acade0ce89 ("sched: remove
wait bookmarks") but the now-unnecessary list hacks were left behind.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
sched/wait: remove the __add_wait_queue_*exclusive() helpers
Each has one or two special-case users. Open-code them there: set
WQ_FLAG_EXCLUSIVE and queue the entry directly, with a note on why the
caller doesn't use add_wait_queue_exclusive().
I think all cases (eventpoll, orangefs and ubifs) are unnecessary and
could just use the regular ordering, but I'll leave that to those
maintainers to sort out.
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
Cc: Vincent Guittot <vincent.guittot at linaro.org>
Cc: Alexander Viro <viro at zeniv.linux.org.uk> # eventpoll
Cc: Christian Brauner <brauner at kernel.org> # eventpoll
Cc: Jan Kara <jack at suse.cz> # eventpoll
Cc: Mike Marshall <hubcap at omnibond.com> # orangefs
[2 lines not shown]
sched/wait: remove __add_wait_queue_entry_tail()
__add_wait_queue() and __add_wait_queue_entry_tail() are now the same.
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
Cc: Vincent Guittot <vincent.guittot at linaro.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
sched/wait: always queue new waiters at the tail
Non-exclusive waiters have been added at the head and exclusive ones at
the tail, so that an exclusive wakeup stopping early still woke every
non-exclusive waiter.
That only matters for waiters that mix both kinds on one queue like
read() and poll() on a pipe - and even then it doesn't actually buy
anything but complexity and fragility of the code.
An exclusive reader consumes the event, the poller had nothing to see,
so there's no real point in keeping the two ordered.
The pointless ordering results in a special rule for everybody adding
themselves to the wait queue, and that rule has not been consistently
followed anyway (see for example do_wait_intr() and do_wait_intr_irq())
So just queue everyone in FIFO order. LIFO might be better for
throughput, but every time we've ever tried that optimization in real
[22 lines not shown]
Merge tag 'soc-fixes-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Pull SoC fixes from Arnd Bergmann:
"There are once more lots of individual device driver fixes across
several subsystems, and most of them look like they were found with
the help of LLM services looking more closely at corner cases that
had been missed before:
- Multiple SCMI firmware fixes for probing device nodes and mailboxes
- Notifications on Arm FFA firmware with hash conflicts
- Out-of-bounds access to i.MX SCMI firmware data from userspace
- Several error handling and probe fixes for reset controllers, along
with a circular locking problem and one NULL pointer dereference
- Multiple error handling fixes for memory controller drivers
[42 lines not shown]