Skip to content

[Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] Update kernel base to 6.6.163-part5 - #2289

Merged
opsiff merged 300 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.163-p5
Nov 30, 2026
Merged

opsiff merged 300 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.163-p5

Conversation

@opsiff

@opsiff opsiff commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Update kernel base to 6.6.163-part5.

Skip: (handle them later)
19b5f85576ef1... wifi: mt76: move the channel survey when the channel changes
c6cda7406ae80... mm/hugetlb: fix endless write fault on a leftover uffd bit
d25821a954382... mm/ksm: fix use of a freed anon_vma at swap-in
80ce365e71263... mm/vma: fix expansion of VMA_MIXEDMAP_BIT VMAs
df588ea0cf5dc... mm/huge_memory: fix truncate racing with PMD zapping
2a04b1bb30d29... mm/mempolicy: apply bind policies against the scoped allocation zone
bb15bbc8ca03a... mm/filemap: read mapping->a_ops->free_folio under i_lock
5723c205fca90... fork: take mmap_lock before copying mm_struct
e04fa7f9daedc... MIPS: Only check -msym32 when need-compiler

jj-anssi and others added 30 commits November 30, 2026 09:41
[ Upstream commit 5291383 ]

parse_reply_info_readdir() checks how many entries are in a readdir
reply by computing the end pointer of the decoded array. That pointer
addition can wrap on 32-bit kernels and let an oversized count pass the
check. For example, a count of 0x40000000 with 156-byte entries wraps
to a zero offset, so the decoder can write past the preallocated buffer.

Check the count against the number of entries that fit in the allocation
before publishing dir_nr. Reject oversized replies through the existing
error path.

Cc: [email protected]
Fixes: 5400839 ("ceph: preallocate buffer for readdir reply")
Assisted-by: LLM
Signed-off-by: Jérémy Jean <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 254214600efb0be9815720661e16513861b752ef)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 569a9bb ]

decode_choose_arg() assumes that its destination is zero-initialized.
Although decode_choose_args() zeroes the argument array, it does not reject
a repeated bucket_index and can decode into an already populated entry.

Repeating a bucket with weight_set_size=0 preserves its existing weight_set
pointer but clears the count. Placement then reads weight_set[-1].weights
and dereferences the resulting pointer.

A malformed monitor OSDMap triggers this during RBD placement:

  BUG: KASAN: slab-out-of-bounds in crush_bucket_choose+0xdd1/0xf90
  Read of size 8 at addr ffff88800290df70 by task init/75

Reject populated arguments before decoding another entry, so the error
path can free their original allocations.

Cc: [email protected]
Fixes: c7ed1a4 ("crush: assume weight_set != null imples weight_set_size > 0")
Assisted-by: Codex:gpt-5
Signed-off-by: Jérémy Jean <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 6e1de78661794fc9f546766696faeee99285a079)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit ec8d583 ]

ceph_mdsc_wait_request() returns the reply head result code of the MDS
request to its callers as a plain int errno.  The value is a
server-controlled u32 and nothing checks that it actually is an errno;
several callers pass it straight to ERR_PTR(), e.g.
ceph_finish_lookup() on the atomic open path:

	err = ceph_mdsc_wait_request(...)	/* e.g. +0x50fc00 */
	...
	if (err)
		dentry = ERR_PTR(err);

IS_ERR() only recognizes the [-MAX_ERRNO, -1] window, so an
out-of-range value is not caught anywhere and survives as a "struct
dentry *".  On the open path the positive error travels
ceph_finish_lookup() -> ceph_atomic_open() -> ERR_PTR() in
fs/namei.c's atomic_open() wrapper -> step_into(), which dereferences
it as a dentry and oopses (mainline 7.3-rc3-135-g4982d3552a3b, the
value in R12 is the server-supplied result):

BUG: KASAN: probably user-memory-access in range
[0x000000000050fc00-0x000000000050fc07]
RIP: 0010:step_into_slowpath+0x3e3/0xe60
R12: 000000000050fc00
Call Trace:
 <TASK>
 ? __pfx_ceph_atomic_open+0x10/0x10
 path_openat+0xf41/0x2440
 do_file_open+0x228/0x480
 do_sys_openat2+0x103/0x1d0
 __x64_sys_openat+0x141/0x200
 do_syscall_64+0xe8/0x4f0
 entry_SYSCALL_64_after_hwframe+0x77/0x79
 </TASK>

(0xdffffc00000a1f80 in the full report is the KASAN shadow of 0x50fc00;
without KASAN the raw value is read.)  Values with the top bit set fare
no better: 0xd8000000 sign-extends through the int conversion into the
kernel address range and takes a page fault instead.

Clamp the result at the single read and return -EIO for anything
outside the errno range, which is what a malformed reply means there.
net/9p does the same to server errno values with safe_errno().  This
is the path the reported crash takes; the other readers of
head->result, including the ceph_async_create_cb() and
ceph_async_unlink_cb() callbacks, are not covered by this patch.

Each of the six crashing opens was run on a build of
7.3-rc3-135-g4982d3552a3bf with only this change applied: it crashes
the unpatched kernel on the first openat() (verified on the same
tree without the patch), and with the patch the open fails cleanly
without an oops.  A few hundred normal file operations on the
patched kernel also completed without a crash; valid errno values
pass through unchanged.

Cc: [email protected]
Fixes: 2f2dc05 ("ceph: MDS client")
Signed-off-by: Yuanfu Xie <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 1249c83d8c2613717f7bc54a67edb1cabfa985f6)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 6ff7920 ]

When ceph_netfs_check_write_begin() finds the folio dirty in an older
snap context, it drops the folio, waits for that snap context to be
flushed and then returns -EAGAIN so that the write is retried.

However, since commit fac47b4 ("netfs: do not unlock and put the
folio twice"), netfs_write_begin() retries only when ->check_write_begin()
returns 0 with *foliop cleared -- every error, -EAGAIN included, is
returned as is. The -EAGAIN thus propagates up to write(2), which fails
with "Resource temporarily unavailable" once the dirty data has been
flushed, rather than being retried.

This is easily hit by buffered writers rewriting dirty pages while
snapshots are being taken, e.g. a kernel build linking vmlinux into a
directory under a snapshot schedule:

  ld: final link failed: Resource temporarily unavailable

Return the wait_event_killable() result as is so that netfs re-gets the
folio and retries on success.

Cc: [email protected]
Fixes: fac47b4 ("netfs: do not unlock and put the folio twice")
Link: https://tracker.ceph.com/issues/57656
Signed-off-by: Venky Shankar <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 952e68dd4e76c5f2e4a9a5eeb7e6abe178f71bf9)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit bc418e2 ]

ceph_crypt_get_context() trusts cfa_blob_len after checking only that the
inode-owned fscrypt_auth allocation contains the fixed header and one byte.
An MDS can therefore place a larger inner length in a shorter outer object,
causing memcpy() to read beyond the allocation when a caller requests the
encryption nonce.

Require the complete blob to fit in the inode-owned allocation before using
the inner length.

On the tested baseline, the malformed reply produced the same KASAN
slab-out-of-bounds read twice. An ordinary UID obtained sixteen wire-absent
SLUB redzone bytes in two non-KASAN production-path runs. The input was
rejected twice after this change, while a complete context still worked.

Cc: [email protected]
Fixes: 2d332d5 ("ceph: fscrypt_auth handling for ceph")
Assisted-by: LLM
Signed-off-by: sung byeongchan <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit cff53880d9513168db812a0773796b0ad0ddce6d)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 7f702e1 ]

ceph_mdsmap_decode() reads two remote u32 name lengths and advances its
parser cursor without checking that either string remains in the message.
On a 32-bit client, a sufficiently large length can wrap the cursor below
`end`.  The following numerical bounds check then succeeds and dereferences
the wrapped address.

Use ceph_decode_skip_n() for both names so the remaining bytes are checked
before the cursor advances.

The issue produced a page fault in ceph_mdsmap_decode twice on the tested
i386 baseline.  The same frame was rejected without a fault twice after
this change, while a normal MDSMap continued to be accepted.

Cc: [email protected]
Fixes: 2f2dc05 ("ceph: MDS client")
Assisted-by: LLM
Signed-off-by: sung byeongchan <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 44abd92f5f8792b3e21a2bdc8197162c42b2857f)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 1663758 ]

__build_xattrs() advances over an MDS-provided name length before checking
that the name remains in the encoded xattr blob.  On 32-bit clients,
UINT_MAX wraps the cursor and is stored as a negative internal name
length.  A later ordinary listxattr() converts it back to a UINT_MAX memcpy
size and corrupts kernel memory.

Check the name range before advancing and reject name, value, or aggregate
sizes that overflow the signed internal accounting.

The malformed blob corrupted kernel state in two baseline boots.  It was
rejected cleanly twice with this change, while normal and length-only
controls remained safe.

Cc: [email protected]
Fixes: 355da1e ("ceph: inode operations")
Assisted-by: LLM
Signed-off-by: sung byeongchan <[email protected]>
Reviewed-by: Alex Markuze <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit b69c4acf01c46155bf5225a06e6e0a8bcdaeb8c4)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f3c7bee ]

The response sent by the firmware when requesting a clock vote (opcode
AFE_CMD_RSP_REMOTE_LPASS_CORE_HW_VOTE_REQUEST) does not actually have
the same opcode + status payload as APR_BASIC_RSP_RESULT. Rather, it
returns one single u32 which is the client_handle that must be used in
future unvote requests for the same clock.

As a result of this type confusion, the status returned by the callback
to q6afe_vote_lpass_core_hw was actually an out-of-bounds read. It was
only interpreted as success (0) most of the time due to luck, but there
are some reports of random errors such as:

[   20.961100] qcom-q6afe aprsvc:service:4:4: AFE failed to vote (3)
[   20.961131] Failed to prepare clk 'core': -110

Fix by correctly interpreting the response as a single u32, and actually
store it as the client_handle to ensure unvote would work correctly.

Cc: [email protected]
Link: https://lore.kernel.org/all/5976946.DvuYhMxLoT@antlia/
Fixes: 55e0753 ("ASoC: q6dsp: q6afe: add lpass hw voting support")
Reviewed-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Val Packett <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 39be15d0c1463976ff7585e1e45cfe56ead60956)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit efee699 ]

read_bulk_callback() takes the frame length from the device, from the
receive header on the 0x8513 and from the trailing status bytes on the
other chips, and only checks it against PEGASUS_MTU before passing that
many bytes up the stack. In two cases the stack then uses bytes that the
device did not send:

- A device that sends a short transfer but claims a long frame gets the
  stale or uninitialized remainder of the receive skb delivered as
  packet data.

- A device that claims a frame shorter than an Ethernet header gets
  past the check as well. eth_type_trans() takes pkt_type from h_dest
  and the protocol from h_proto without checking skb->len. If the
  transfer is also short, those come from bytes left in the skb by an
  earlier transfer, or from uninitialized memory.

Drop frames shorter than ETH_HLEN, and frames whose claimed length, plus
the 0x8513 header, does not fit in the bytes actually received, and
count them as length errors. urb->actual_length never exceeds the
PEGASUS_MTU sized transfer buffer, so this also covers the existing
PEGASUS_MTU check. Valid Ethernet frames are at least 60 bytes long
without the FCS, so they are not affected.

Found by code review with LLM assistance. With an emulated USB device,
a 101-byte transfer claiming a 1500-byte frame was passed up as a
1500-byte packet before this change and is dropped after it, and
frames claiming 0, 4 and 13 bytes were passed up and are now dropped
and counted in rx_length_errors. The extra bytes happened to be zero
in the first test, so disclosure of actual kernel data was not
demonstrated.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Cc: [email protected]
Signed-off-by: Wei Jie Law <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit eb13f958159f481ea45640a3c9d2fc2cbc0cf1a1)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit a81513b ]

arp_ip_target is a module parameter array with BOND_MAX_ARP_TARGETS
entries. In the loop parsing it in bond_check_params(), arp_ip_count is
the number of accepted targets, while i is the index into
arp_ip_target. Invalid and duplicate entries are skipped without
bumping arp_ip_count, so bounding the loop with arp_ip_count lets i run
past the end of arp_ip_target, e.g. 16 targets with one duplicate:

  BUG: KASAN: global-out-of-bounds in bond_check_params.constprop.0+0x1148/0x1440
  Read of size 8 at addr ffffffff96e9ee00 by task swapper/0/1
  Call Trace:
   <TASK>
   dump_stack_lvl+0x91/0xf0
   print_report+0xd1/0x630
   kasan_report+0xf3/0x130
   __asan_report_load8_noabort+0x14/0x30
   bond_check_params.constprop.0+0x1148/0x1440
   bonding_init+0x13/0xe0
   do_one_initcall+0xe7/0x5b0
   kernel_init_freeable+0xa91/0x1120
   kernel_init+0x24/0x220
   ret_from_fork+0x5b3/0x820
   ret_from_fork_asm+0x1a/0x30
   </TASK>

  The buggy address belongs to the variable:
   arp_ip_target+0x80/0xa0

Bound the loop with i instead. arp_ip_count never exceeds i, so it
stays within BOND_MAX_ARP_TARGETS too.

Fixes: 5a5c5fd ("bonding: arp_ip_count and arp_targets can be wrong")
Cc: [email protected]
Signed-off-by: Jiayuan Chen <[email protected]>
Reviewed-by: Fernando Fernandez Mancera <[email protected]>
Reviewed-by: Nikolay Aleksandrov <[email protected]>
Acked-by: Jay Vosburgh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit e7d2c477cffbf5de7e50e1d80638f14c607eb8c3)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 134351e ]

For an unresolved multicast route query, ipmr_get_route() builds a
synthetic IP header in the headroom obtained from
skb_realloc_headroom(), which does not zero the memory it allocates.
Only a few fields are initialized, leaving others as stale heap
contents.

ipmr_cache_report() copies this header into the IGMPMSG_NOCACHE report
that is queued to the mroute socket, so a recvmsg() on that socket leaks
the uninitialized bytes to user space: the 'tos' field [1] and the 'id'
and 'frag_off' fields [2].

Fix by zeroing the IP header before filling in the few fields that are
used, so that the entire header is initialized, as in ip6mr_get_route().

[1]
BUG: KMSAN: kernel-infoleak in _copy_to_iter
 raw_recvmsg

Uninit was stored to memory at:
 ipmr_cache_report
 ipmr_cache_unresolved
 ipmr_get_route

Uninit was created at:
 pskb_expand_head
 skb_realloc_headroom
 ipmr_get_route

Byte 1 of 28 is uninitialized

[2]
BUG: KMSAN: kernel-infoleak in _copy_to_iter
 raw_recvmsg

Uninit was stored to memory at:
 ipmr_cache_report
 ipmr_cache_unresolved
 ipmr_get_route

Uninit was created at:
 pskb_expand_head
 skb_realloc_headroom
 ipmr_get_route

Bytes 4-7 of 28 are uninitialized

Fixes: 1da177e ("Linux-2.6.12-rc2")
Cc: [email protected]
Reported-by: Sashiko <[email protected]>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/0545f0c83f5ee2f6696210f87268e811ef655715.1792476357.git.zhilinz%40nebusec.ai
Signed-off-by: Ido Schimmel <[email protected]>
Reviewed-by: Hangbin Liu <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit fc4eb478ad937163b659e4a5ae17a5f86c8e820a)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit ea1f418 ]

The MA35D1 clock controller takes two crystal oscillator inputs from
the board:
- HXT, a high-speed 24 MHz crystal for most of the system
- LXT, a low-speed 32.768 kHz crytal for the RTC and low power modes

So far the binding was expecting a single crystal. The example named it
HXT, but no real definition for it was given. LXT was not even
described. In order to remain backward compatible, we will continue to
allow either one (HXT) or two (HXT then LXT) input clocks. I propose to
give those phandles a name to clarify what these entries expect, but I'm
not listing the clock-names property in the required block, for backward
compatibility. The rates are fixed by the TRM, so even if the second
oscillator is not described, the OS can make an educated guess.

Fixes: 2f8b5eb ("dt-bindings: clock: nuvoton: add binding for ma35d1 clock controller")
Cc: [email protected]
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jerome Brunet <[email protected]>
Signed-off-by: Brian Masney <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit f5f4abdbea54fb9eae8e42330db4d1461caa9758)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 850a722 ]

tcp_tso_autosize() right-shifts the u32 returned by tcp_min_rtt() by
sysctl_tcp_tso_rtt_log. The sysctl uses proc_dou8vec_minmax() without
an upper bound, so it accepts values through 255. Values above 31 make
the shift undefined.

A process with CAP_NET_ADMIN in the target network namespace can set the
per-netns sysctl. With CONFIG_UBSAN_SHIFT=y, setting it to 32 and sending
TCP data over loopback triggers:

  UBSAN: shift-out-of-bounds in net/ipv4/tcp_output.c:2264:30
  shift exponent 32 is too large for 32-bit type 'unsigned int'
  Call Trace:
   __ubsan_handle_shift_out_of_bounds
   tcp_tso_segs
   tcp_write_xmit
   __tcp_push_pending_frames
   tcp_push
   tcp_sendmsg_locked

Limit the sysctl to 31, the largest valid shift count for a u32, and
document the accepted range. Writes of larger values now fail with
-EINVAL.

On a UBSAN/KASAN build of the net tree, values 0 and 31 remained
accepted, values 32 and 255 returned -EINVAL, and TCP traffic with the
valid boundary values produced no sanitizer diagnostics.

Fixes: 6546690 ("tcp: adjust TSO packet sizes based on min_rtt")
Cc: [email protected]
Signed-off-by: Yingjie Wang <[email protected]>
Reviewed-by: Jiayuan Chen <[email protected]>
Reviewed-by: Neal Cardwell <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit fd447cac40c4c3e4aa8cc34334e92754ad2ddbf1)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit b88b826 ]

xp_assign_dev() sets XDP_UMEM_SG_FLAG before checking whether the
device supports multibuffer zero-copy. If assignment fails, xsk_bind()
destroys the pool but retains the registered UMEM. A subsequent bind
without XDP_USE_SG inherits the stale flag.

The flag also changes RX buffer sizing after DMA mapping. On igc, a
failed SG bind followed by a non-SG retry with 4096-byte chunks and
1792 bytes of headroom passes admission with 2048 bytes, but programs
a 1024-byte RX buffer. On I225-V hardware, an ordinary 1514-byte frame
is truncated to 1024 bytes or 1008 with RX timestamps enabled.
Restoring the original flags eliminates the truncation in both cases.

Save the UMEM flags before assignment and restore them on failure.

Discovered during development of AF_XDP changes for igc.

Fixes: d609f3d ("xsk: add multi-buffer support for sockets sharing umem")
Cc: [email protected]
Signed-off-by: Paul Moses <[email protected]>
Acked-by: Maciej Fijalkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit b2521918521c6e8123c30201d65049334f30eccb)
Signed-off-by: Wentao Guan <[email protected]>
…ioctl()

[ Upstream commit 87409ee ]

lo_ioctl() checks for (mode & BLK_OPEN_WRITE) || capable(CAP_SYS_ADMIN)
before allowing LOOP_SET_STATUS or LOOP_SET_STATUS64, but not
lo_compat_ioctl(), the handler used by 32-bit user space on 64-bit
kernels.

As a result, on 64-bit kernels with CONFIG_COMPAT=y, a 32-bit
unprivileged user-space process holding a read-only (O_RDONLY) file
descriptor to an active /dev/loopN device can issue a compat
LOOP_SET_STATUS ioctl to modify lo_offset, clear lo_sizelimit to 0
(exposing backing-file data past the configured limit), or alter
lo_flags.

Enforce the same (mode & BLK_OPEN_WRITE) || capable(CAP_SYS_ADMIN) check
on LOOP_SET_STATUS in lo_compat_ioctl().

Cc: [email protected]
Assisted-by: ARTIST LLM
Signed-off-by: Dominik Maier <[email protected]>
Reviewed-by: Bart Van Assche [email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 2e9d353801f64f792d769ce4ec67398b139dafeb)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit a4311e9 ]

Writing to the reconfig or clear sysfs nodes of a codec handled by ASoC
(SOF via hdac_hda, AVS via codecs/hda) hangs the writer.

snd_hda_codec_reset() sets card->shutdown and calls
device_release_driver(). With ext_ops the driver unbind unregisters the
ASoC component, which unbinds and frees the whole ASoC card:
- snd_card_disconnect() returns early as card->shutdown is already set,
  so the card's child devices are not removed and snd_card_free() waits
  for the card release forever.
- Even without that, freeing the card removes the codec's hwdep device,
  which owns the sysfs node the reset was issued from, deadlocking in
  kernfs while waiting for the active write to finish.

The legacy HDA driver keeps the card across a driver rebind, ASoC does
not, so the reset cannot be supported there. Return -EOPNOTSUPP and skip
the misleading "codec is being used" messages in the callers.

Fixes: 6bae5ea ("ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers")
Cc: [email protected]
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222182
Signed-off-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Cezary Rojewski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit ecf162478713c8688ee7377b599bedd580764ef0)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f750625 ]

ixgbe_xmit_frame_ring() takes an extra skb reference with skb_get()
for the pending TX timestamp before preparing the skb for transmit.
Several of the following steps may need to reallocate the skb head:

- ixgbe_tso() calls skb_cow_head(), which reaches pskb_expand_head()
  when the header is cloned (e.g. a packet tap holds a clone).
- ixgbe_tx_csum() falls back to skb_checksum_help() for unsupported
  checksum offsets, which can call pskb_expand_head() through
  skb_ensure_writable().
- With DCB and a software VLAN tag, skb_cow_head() is called to
  rewrite the VLAN priority.

pskb_expand_head() used to BUG() on shared skbs. Since commit
c7d8bc3 ("net: skbuff: don't BUG() on bad arguments to
pskb_expand_head()") it returns -EINVAL instead, so these packets
are dropped (TSO, DCB) or sent with an unfinished checksum
(skb_checksum_help() errors are ignored by ixgbe_tx_csum()).

Reserve the TX timestamp right before ixgbe_tx_map(), after all skb
preparation, as i40e and ice already do. The timestamp request
remains covered on the FCoE path, and the cleanup on ixgbe_tx_map()
failure is unchanged.

Fixes: 891dc08 ("ixgbe: Add ptp work item to poll for the Tx timestamp")
Cc: [email protected]
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Maciej Fijalkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit c9f6ca20d2cf73e2df1f618e79d2c14f89b2079b)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f26c0d5 ]

hdac_hda_codec_remove() disables runtime PM of the codec device before
releasing the HDA link and calling the codec driver's remove callback,
so that no runtime resume can race with the teardown and access the
link or the already freed codec driver data.
snd_hda_codec_cleanup_for_unbind() then disables runtime PM again.

On the next probe snd_hda_codec_register() enables runtime PM only once,
leaving it disabled after the ASoC card or the codec driver has been
unbound and bound again: the codec stays powered and runtime_status
reads 'unsupported'.

Re-enable runtime PM at the end of hdac_hda_codec_remove() to balance
its own disable. The codec remains disabled until it is registered again.

Fixes: c3ec8ac ("ASoC: hdac_hda: fix memleak on module unload")
Cc: [email protected]
Signed-off-by: Peter Ujfalusi <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 16a05a17d4ec4fa00f9828c76f9188e7755ba040)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 244eb26 ]

NODE_ADDRSPACE_SHIFT is 44 now but may be changed in future, so use
pa_to_nid()/nid_to_addrbase() rather than hard-code.

Cc: [email protected]
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 6744cee394142d749d0da256b54ab30e6fcb9435)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 23534c6 ]

In update_bp_registers(), there is a duplicate call to write_wb_reg()
when enabling an execute breakpoint:

    write_wb_reg(CSR_CFG_CTRL, i, 0, CTRL_PLV_ENABLE);
    write_wb_reg(CSR_CFG_CTRL, i, 0, CTRL_PLV_ENABLE);

The two lines are completely identical. Remove the redundant call to
clean up the code and eliminate unnecessary register writes.

Cc: [email protected]
Fixes: edffa33 ("LoongArch: Add hardware breakpoints/watchpoints support")
Signed-off-by: Tiezhu Yang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 653ec7722a71f10020ea996b6101f535c9076bbe)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 30c5267 ]

In update_bp_registers(), when disabling a LOAD or STORE watchpoint,
the code attempts to clear the bit of LoadEn or StoreEn by using the
standard bit-clearing pattern.

However, due to the omission of parentheses, the bitwise NOT operator
'~' takes higher precedence than the left shift operator '<<'. Then:
(1) ~0x1 << MWPnCFG3_LoadEn evaluates to "(~0x1) << 8 = 0xFFFFFE00",
(2) ~0x1 << MWPnCFG3_StoreEn evaluates to "(~0x1) << 9 = 0xFFFFFC00",
that incorrectly clears all configuration fields in the lower 8 bits.

These fields in the lower 8 bits contain critical configurations such
as DSOnly (bit 0), PLV0-PLV3 privilege levels (bits 1-4), and LCL (bit
7). Writing back these corrupted values severely breaks configuration
isolation and ruins the hardware watchpoint states.

Add parentheses to ensure the correct evaluation order, so that only
the targeted LoadEn/StoreEn bit is cleared while preserving the other
crucial configuration bits in the lower 8 bits.

Cc: [email protected]
Fixes: edffa33 ("LoongArch: Add hardware breakpoints/watchpoints support")
Signed-off-by: Tiezhu Yang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit f2c3cf6c6ea44114f592a7ceec4a7c4c7f1d07fc)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f322ebf ]

According to the LoongArch Reference Manual, the single-step 'Skip' bit
resides in the instruction breakpoint status register (CSR.FWPS), rather
than the configuration register (CSR.FWPC).

Furthermore, the kernel code comments also explicitly document it as
"CSR.FWPS.Skip", yet the macro was erroneously defined as CSR_FWPC_SKIP
and used as such in traps.c and hw_breakpoint.c. This mismatch creates
architectural naming confusion.

Fix this by renaming the macro from CSR_FWPC_SKIP to CSR_FWPS_SKIP to
precisely match the manual and comments. Also, update all call sites to
align with the rectified definition.

Cc: [email protected]
Fixes: 424421a ("LoongArch: ptrace: Add hardware single step support")
Signed-off-by: Tiezhu Yang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 11d8fb6c8ffbf3baebef6cb26726671063104025)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f087903 ]

In do_watch(), the kernel unconditionally forces a SIGTRAP signal at the
end of the handler via force_sig(SIGTRAP). This is essential for ptrace
operations, but it severely disrupts standard perf_event usage.

Under normal perf usage, it is not necessary to force a SIGTRAP signal
on every hit. Forcing it unnecessarily aborts the target process if no
user-space signal handler is registered, which violates performance
monitoring behaviors and injects context switch overheads.

However, a conditional check using only 'current->ptrace' would block
legitimate user-requested signals when a perf_event is configured with
'attr.sigtrap = 1' for asynchronous user-space tracking.

Fix this by refactoring breakpoint_handler() and watchpoint_handler()
to return a boolean status indicating whether any triggered breakpoint
explicitly requires a signal notification. Update do_watch() to enforce
the SIGTRAP signal only when the process is actively being debugged via
ptrace, or when the underlying perf_event infrastructure specifically
demands it via 'attr.sigtrap'.

Cc: [email protected]
Fixes: 424421a ("LoongArch: ptrace: Add hardware single step support")
Signed-off-by: Tiezhu Yang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 44346dd182cfac7e32575295ba0c2aa01d27566e)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit f5c0f84 ]

In hw_breakpoint_control(), the logic to enable CSR_PRMD_PWE (global
watchpoint enable) incorrectly relies on TIF_LOAD_WATCH. This thread
flag is only set during ptrace operations, meaning that the standard
hardware breakpoints created via perf_event_open() will never have
this flag set.

As a result, the CSR_PRMD_PWE switch is skipped, leaving the hardware
breakpoint completely inactive in perf usage.

Fix this by decoupling the CSR_PRMD_PWE from the ptrace specific flag
TIF_LOAD_WATCH, which ensures that CSR_PRMD_PWE is enabled whenever a
hardware breakpoint is installed.

Here is a user-space reproducer to demonstrate the issue:

(1) Test program (test_perf_install.c):

  #include <stdio.h>
  #include <unistd.h>
  #include <sys/syscall.h>
  #include <sys/ioctl.h>
  #include <linux/perf_event.h>
  #include <linux/hw_breakpoint.h>

  static int var = 0;

  int main(void)
  {
  	size_t count = 0;
  	struct perf_event_attr attr = {
  		.type = PERF_TYPE_BREAKPOINT,
  		.size = sizeof(attr),
  		.bp_type = HW_BREAKPOINT_W,
  		.bp_addr = (unsigned long)&var,
  		.bp_len = HW_BREAKPOINT_LEN_1,
  		.exclude_kernel = 1,
  	};

  	int fd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
  	ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);

  	asm volatile("st.b %1, %0" : "=m"(var) : "r"(11) : "memory");

  	ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
  	read(fd, &count, sizeof(size_t));

  	printf("Watchpoint counts: expected = 1, actual = %zu\n", count);

  	close(fd);
  	return 0;
  }

(2) Test steps:

  $ gcc test_perf_install.c -o test_perf_install
  $ ./test_perf_install

(3) Test results:

Without this patch:

  Watchpoint counts: expected = 1, actual = 0

With this patch:

  Watchpoint counts: expected = 1, actual = 1

Cc: [email protected]
Fixes: 3892b11 ("LoongArch: Check TIF_LOAD_WATCH to enable user space watchpoint")
Signed-off-by: Tiezhu Yang <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 79eff2bf7bd40d510cead317b6bfc4f36ec0f5ac)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 8a70298 ]

cpufreq_stats_create_table() sets stats->last_index to -1 if policy->cur
is not in the frequency table. It then stays at -1, because
cpufreq_stats_record_transition() returns early on old_index == -1 before
it gets to update last_index.

Commit 46a310b ("[CPUFREQ] Don't set stat->last_index to -1 if
the pol->cur has incorrect value.") added that check. However, since
commit 40c3bd4 ("cpufreq: stats: Defer stats update to
cpufreq_stats_record_transition()"), the stats reset is deferred to the
beginning of cpufreq_stats_record_transition(), before that check, and
cpufreq_stats_reset_table() ends with an unconditional
cpufreq_stats_update(). So if the "reset" attribute is written while
last_index is -1, the next frequency transition accesses
time_in_state[-1].

Fix it by also returning early on last_index == -1 in
cpufreq_stats_reset_table().

Fixes: 40c3bd4 ("cpufreq: stats: Defer stats update to cpufreq_stats_record_transition()")
Cc: 5.10+ <[email protected]> # 5.10+
Signed-off-by: Zhongqiu Han <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 5d4b0896f954d348cda6c1ba766332ecad3898a5)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit b456f59 ]

amdgpu_dm_commit_streams() takes a runtime PM reference for every
active CRTC that needs a modeset and has a new stream, but
amdgpu_dm_atomic_commit_tail() drops one only for each CRTC that goes
from active to inactive. A modeset of a CRTC that is already active (a
mode change, or anything else that needs a full modeset) therefore
leaks one reference. Once that has happened, the usage count no longer
returns to zero with every CRTC off, and the device cannot runtime
suspend again until reboot. The two also disagree the other way when a
CRTC turns on without a stream ("Failed to create new stream"): no
reference is taken, but one is dropped when it turns off.

Take the reference in the loop that counts the disabled CRTCs, on the
mirror condition: when the CRTC goes from inactive to active, which is
what the commit that added it intended ("every time we enable a
previously disabled CRTC"). Each active CRTC then holds exactly one
reference.

Tested on an RX 9070 XT (Navi 48) over OCuLink, with the change
backported to 7.2.9: an unplugged connector forced on, then mode A on a
CRTC, mode B on the same active CRTC, and the CRTC off, three rounds in
a row. The usage count rose by 3 with the stock module, by 0 with this
patch, and by 3 again after reloading the stock module.

Fixes: 9702803 ("drm/amdgpu: Grab/put runtime PM references in atomic_commit_tail()")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/5951
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Luigi Lauro <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
(cherry picked from commit 59ef9a435499777b8e1c4e0eff52f813c64fb920)
Cc: [email protected]
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 436c89a46b451f5da9259ab31b2524fe694b6a2a)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 9866cb1 ]

The KFD SRAT walker reads the first subtable length without checking
that a header is present and trusts subsequent lengths when accessing
CPU and generic affinity records. Invalid firmware lengths can therefore
cause out-of-bounds reads.

Validate the table header, every generic subtable range, and each
supported typed record before reading its fields.

Fixes: ddec8d3 ("drm/amdkfd: add ACPI SRAT parsing for topology")
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Jiale Yao <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
(cherry picked from commit d76b655c98e8cc9e791b31502ad274f47dee2aae)
Cc: [email protected]
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 7f51881b0bb6ae781071e11cf327d851c8f3cc8a)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 8f3ecda ]

criu_process_info() evicts the queues of the process on every call, and
each kfd_process_evict_queues() increments qpd->evicted, but CRIU UNPAUSE
restores them only once. After PROCESS_INFO twice and UNPAUSE the queues
stay evicted for good. On navi31, a barrier-AND packet on an HSA queue
completes after PROCESS_INFO + UNPAUSE, but times out after
PROCESS_INFO, PROCESS_INFO, UNPAUSE.

The error path has a related problem: when kfd_process_evict_queues()
itself fails, it has already rolled back its partial eviction, and the
kfd_process_restore_queues() in the error path restores once more.

Evict only when the queues are not paused yet, and on errors only undo
an eviction done by this call. The barrier now completes after any
number of PROCESS_INFO calls followed by UNPAUSE.

Fixes: cd9f791 ("drm/amdkfd: CRIU Implement KFD unpause operation")
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Jesse Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
(cherry picked from commit 4d79c9e3c32c677fcadf5ca10ab81ee0a4b81f99)
Cc: [email protected]
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit fed8f95c6ecca7d5165638f081d522988e1f510b)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit b674365 ]

macvlan_changelink() adjusts the lower device's promiscuity count when
NOPROMISC changes, even if the passthru macvlan is down. The reference
is acquired in macvlan_open() and released in macvlan_stop(), so a down
interface has no reference to change.

Clearing NOPROMISC while down leaves an extra reference after the next
open/stop cycle. Setting it while down can remove a reference held by
another user of the lower device.

Guard the count adjustment with netif_running(dev). Keep storing the
requested flags while down so the next open uses the new setting.

Comparing changelink with open/stop exposed the unmatched count changes;
the same issue was also described in earlier macvlan reviews. A netlink
test on UML reproduced both DOWN cases before the fix and verified the
expected counts afterwards. Repeated flag updates, two open/stop cycles,
deletion and bidirectional small-frame delivery were also checked.

Full x86_64 builds completed with WERROR disabled for allmodconfig, and
WERROR and KASAN disabled for allyesconfig, including the resulting
dependency changes. Neither comparison showed new diagnostics.

Fixes: df8ef8f ("macvlan: add FDB bridge ops and macvlan flags")
Link: https://lore.kernel.org/netdev/[email protected]/
Link: https://lore.kernel.org/netdev/[email protected]/
Cc: [email protected]
Signed-off-by: Xia Yan <[email protected]>
Reviewed-by: Hangbin Liu <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit a8ba54055731ad77379c857decbdf039876efed8)
Signed-off-by: Wentao Guan <[email protected]>
… ring

[ Upstream commit d54b21d ]

hisi_femac_net_close() frees the receive ring while the RX address queue
still holds every address that was pushed to IQ_ADDR.

A port that keeps receiving then DMAs arrived frames into buffers that
other slab caches have already taken back; on an EC6108V9C (hi3798mv100)
the queue still held all 52 armed addresses right after the interface
was closed, and had dropped to 43 after 15 s of broadcast traffic.

Reset the port before the buffers are released, so that the receiver no
longer holds any of their addresses.

Fixes: 542ae60 ("net: hisilicon: Add Fast Ethernet MAC driver")
Cc: [email protected]
Signed-off-by: David Yang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit b157822864a39ac7615e5fcdad4e0b401641267d)
Signed-off-by: Wentao Guan <[email protected]>
sean-jc and others added 18 commits November 30, 2026 09:41
… rmap limit)

[ Upstream commit e4558c3 ]

When potentially reusing a shadow page, zap the shadow page if its number
of parent PTEs exceeds KVM's (mostly) arbitrary rmap recycling threshold.
Letting the guest create a (mostly) unbounded number of parent PTEs allows
the guest to coerce KVM into creating lists containing millions of PTEs,
effectively bounded only by the maximum number of shadow pages.

Because PTE lists are simple singly linked lists, removal is O(n).  Even
worse, if a list is constructed just so, teardown can be O(n^2), e.g. if
SPTEs are built such that zapping child SPTEs always zaps the last entry
in the list.  To cap things off, all paths that walk PTE lists do so
while holding mmu_lock, without conditionally rescheduling.

Using a doubly linked list would not address the issue, as removal would
remain O(n) since KVM still wouldn't know where in the list to remove from.
Removal could be made O(1) by storing a per-SPTE pointer, but that would
largely defeat the purpose of reusing SPs, and would penalize well-behaved
guests, especially for nested TDP where aliasing page tables is uncommon.

So, cap the maximum number of parent PTEs at the rmap limit.  In practice,
well-behaved guests will likely never run afoul of the limit.  E.g. when
running Linux as L1 with TDP, the number of parent PTEs for a single SP
tops out at under 200 (though undoubtedly obscure workloads can push it
higher).  Deliberately use a "greater than or equal" as opposed to rmap's
strictly "greater than", as the rmap code checks the threshold immediately
*after* inserting into the list, i.e. the limit is 1000 for rmaps, KVM just
very briefly blows past it.

Apply the check to both indirect and direct SPs, because while a fully
direct MMU naturally limits the number of parent PTEs to '1', direct SPs in
indirect MMUs have no such constraint.  E.g. if the guest maps a huge PTE
into many locations in its page tables, and KVM is backing the hugepage
with a direct SP, i.e. with a series of smaller pages, then KVM could end
up with a direct SP with many parents.

Note, shadow_mmu_try_split_huge_pages() always restarts the rmap walk or
bails entirely if it gets to the point where it tries to grab a SP, i.e.
there is *no* pre-existing bug that would be tripped by zapping a SP and
thus rmaps when getting a SP.

Cc: Jim Mattson <[email protected]>
Cc: James Houghton <[email protected]>
Cc: Yosry Ahmed <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: [email protected]
Reported-by: Stefan Teodorescu <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit d358a3e5b7d11b4213c77a96ab5951983210be65)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit c7c288d ]

Force an MMU reset when emulating an INIT even if paging was already
disabled, as the MMU page role includes guest_mode (L2), i.e. an INIT while
L2 is running with CR0.PG=0 will result in KVM running L1 with a stale MMU
context.

Alternatively, the reset could be scoped strictly to paging being enabled
or L2 being active, but SMM is also encoded in the page role.  Even though
it _should_ be impossible for the vCPU to be INIT'd while SMM is active,
there's zero value in not handling SMM.  At that point, the only scenario
where KVM _doesn't_ need to reset the MMU context is on an INIT with the
vCPU running in Real Mode or Unpaged Protect Mode, and while INIT in those
modes is somewhat common, it's far from a hot path and re-initializing the
MMU is not expensive, especially when the role isn't changing (KVM elides
most of the re-configuration in that case).

Note, like the Fixes commit, this bug only affects nested SVM as INIT is an
unconditional intercept on VMX, i.e. it's impossible to emulate INIT while
L2 is active.

Temporarily keep the guest TLB flush when CR0.PG is being cleared even
though it is fully redundant with the flush that is emitted on all INIT
events (KVM itself only does RESET when a vCPU is being created, i.e. when
CR0.PG must be '0').

Fixes: ed129ec ("KVM: x86: forcibly leave nested mode on vCPU reset")
Reported-by: Stefan Teodorescu <[email protected]>
Reported-by: Oren Yomtov <[email protected]>
Reported-by: Chris Mason <[email protected]>
Cc: [email protected]
Cc: Yosry Ahmed <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 87bd6507186c6357fb9267ab5aca869c57f0ef54)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 737139f ]

hci_resume_advertising_sync() never re-enables advertising on a
controller without extended advertising.

It restores HCI_ADVERTISING from advertising_old_state, then calls
hci_schedule_adv_instance_sync(), which starts with:

  if (hci_dev_test_flag(hdev, HCI_ADVERTISING) && !ext_adv_capable(hdev))
          return -EPERM;

The flag it tests was set a few lines earlier by the resume itself, so
the call returns -EPERM without sending anything. The return value is
discarded by every caller, so the failure is silent: advertising_paused
is cleared, HCI_ADVERTISING is set, and the controller is not
advertising.

Observed on a BCM43455 (no extended advertising) after an active scan:
btmon shows the pause disabling advertising and no re-enable in the ten
seconds that follow, the device does not appear in another controller's
scan, and btmgmt info still reports "advertising" in current settings.

Enable instance 0x00 directly in that case, the way reenable_adv_sync()
already does for the same situation. Instances continue to go through
hci_schedule_adv_instance_sync() so the software rotation loop is
rearmed.

This affects every caller of hci_resume_advertising_sync(), not only the
scan path: address resolution changes, accept list updates, discovery
stop, suspend/resume and the end of an LE connection attempt all leave
advertising disabled on such a controller today.

The resume does nothing when the controller is already advertising, as
it is after directed advertising was started for a peripheral
connection, so it does not replace that advertising.

err is initialised because the extended branch leaves it unset when
adv_instances is empty and HCI_LE_ADV_0 is clear.

Fixes: ad383c2 ("Bluetooth: hci_sync: Enable advertising when LL privacy is enabled")
Cc: [email protected]
Assisted-by: Claude:claude-opus-5.5 btmon
Signed-off-by: Valentin Kindschi <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 9ee80a31c41854e1f8d4daba3d921505cab01699)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit ef70628 ]

The GPR bus needs to make response callbacks available before invoking a
client probe because clients can issue synchronous commands from probe.
This creates a short interval where a callback can run before the client
has published its private data.

Make q6apm publish its driver data only after all callback-visible state
has been initialized. Have the q6apm and q6prm callbacks ignore packets
received before driver data is available.

Fixes: ec1471a ("soc: qcom: apr: Add GPR support")
Cc: [email protected]
Co-developed-by: Ajay Kumar Nandam <[email protected]>
Signed-off-by: Ajay Kumar Nandam <[email protected]>
Signed-off-by: Mohit Sharma <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit a2aaaa6d8e60f99fb07fc183f48d7ce85b0a7ad5)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit dfb1903 ]

Patch series "mm/hugetlb: fix mremap bugs", v3.

This series fixes a few hugetlb mremap bugs.

Patch 1 fixes the return type of move_hugetlb_page_tables(), so large
hugetlb moves cannot be truncated when reported back to the generic
mremap code.

Patch 2 disables hugetlb PMD sharing for UFFD missing mode, so
UFFDIO_POISON markers cannot become visible through shared PMD page
tables.

Patch 3 fixes the recursive i_mmap_rwsem deadlock in the hugetlb mremap
path by avoiding the destination PMD sharing allocation path while the
mapping lock is already held for write.

This patch (of 3):

move_hugetlb_page_tables() returns the number of bytes moved, but
its return type is int while the generic move_page_tables() path uses
unsigned long lengths.

A hugetlb mremap() move length above INT_MAX can therefore be
misreported to copy_vma_and_data(). The out-of-range conversion to int
is implementation-defined; on common 64-bit builds, for example, a
4 GiB move can be reported as zero, making the caller treat the move as
a failure and use the wrong length for rollback.

Return unsigned long from move_hugetlb_page_tables(), matching
move_page_tables() and preserving the full byte count.

Link: https://lore.kernel.org/[email protected]
Link: https://lore.kernel.org/[email protected]
Fixes: 550a7d6 ("mm, hugepages: add mremap() support for hugepage backed vma")
Signed-off-by: Li Zhe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Jose A. Perez de Azpillaga <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit a9bfda4871d648ea1041bb72215ec950a6107650)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 2efc633 ]

replace_page() maps the KSM page with a PTE built from scratch, so the
soft-dirty bit of the PTE it replaces is lost.  A page written since
"clear_refs 4" then no longer shows as soft-dirty once it is merged, and a
soft-dirty based dumper treats it as unchanged.

Copy the soft-dirty bit from the original PTE to the new PTE.

Link: https://lore.kernel.org/[email protected]
Fixes: 0f8975e ("mm: soft-dirty bits for user memory changes tracking")
Signed-off-by: Samarth Narang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Lance Yang <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Assisted-by: LLM
Cc: Xu Xin <[email protected]>
Cc: Chengming Zhou <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Kiryl Shutsemau <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 5d1cef68112bac6fef3c427cc68f155eb36dba95)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 740128d ]

try_to_unuse() only checks for a pending signal between mms, and
shmem_unuse() doesn't check at all.  That means that once swapoff gets to
a process or a shmem file with a lot swapped out, nothing can interrupt it
until every last page of it has been read back in.

Just as one example of where this can concretely show up, freezing tasks
for suspend or hibernation has to wait for swapoff to notice the freezer's
fake signal, and gives up after freeze_timeout_msecs (20 seconds by
default).

Here's a facetious example where one swaps out 2GiB of one process to a
swap file on ext4, starts swapoff, and half a second later tries to freeze
with pm_test=freezer.  Writing to /sys/power/state then fails with EBUSY
and this in dmesg:

    Freezing user space processes failed after 20.003 seconds (1 tasks refusing to freeze, wq_busy=0):
    task:swapoff         state:D stack:0     pid:3175  tgid:3175  ppid:2955   task_flags:0x400100 flags:0x00000419
    Call trace:
     [...]
     io_schedule+0x44/0x70
     folio_wait_bit_common+0x1ec/0x3d0
     __folio_lock+0x24/0x40
     unuse_pte_range+0x2d0/0x348
     unuse_vma+0x158/0x248
     unuse_mm+0xfc/0x150
     try_to_unuse+0x104/0x3f8
     __do_sys_swapoff+0x220/0x5d8
     [...]

The same goes for anything else that wants swapoff to stop, like an admin
hitting ^C in a panic, of course.

Prior to commit b56a2d8 ("mm: rid swapoff of quadratic complexity")
try_to_unuse() was driven by find_next_to_unuse() which checks for a
signal before every entry, so let's restore that behaviour.

Just as an example of the improvements, here's how long freezing takes
in the same test while swapoff is happening on my computer:

                      before                  after
    400MiB anon       8.925s                  0.028s
    400MiB shmem      1.639s                  0.003s
    2GiB anon         failed after 20.003s    0.011s

Link: https://lore.kernel.org/[email protected]
Fixes: b56a2d8 ("mm: rid swapoff of quadratic complexity")
Signed-off-by: Chris Down <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Acked-by: Vineeth Pillai (Google) <[email protected]>
Reviewed-by: Baolin Wang <[email protected]>
Reviewed-by: Kairui Song <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Nhat Pham <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Youngjun Park <[email protected]>
Cc: Ying Huang <[email protected]>
Cc: Kelley Nielsen <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 21f2f55bd40f25c260e9c29522562e1480c5371b)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 7d8746d ]

When move_pages() is used with nodes == NULL, do_pages_stat_array() passes
each page address directly to vma_lookup().  A valid tagged address
therefore fails the VMA lookup and gets -EFAULT in its status entry,
instead of the node reported for the corresponding untagged address.

The tagged address ABI permits these pointers, and the migration path
already removes their tags.  Apply the target mm's untagging rules to the
query path as well, while holding its mmap read lock.

Link: https://lore.kernel.org/[email protected]
Fixes: 057d338 ("mm: untag user pointers passed to memory syscalls")
Signed-off-by: Hungyu Lin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reported-by: Sashiko <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]
Acked-by: Zi Yan <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Joshua Hahn <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Gregory Price <[email protected]>
Cc: Ying Huang <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: Andrey Konovalov <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit e80b056f5a95e1c7f14d0e74584c2ae3a63d6d9f)
Signed-off-by: Wentao Guan <[email protected]>
…on dying memcg

[ Upstream commit dd94d8c ]

When memory.high is exceeded in non-task context, try_charge_memcg()
schedules memcg->high_work without taking a reference on the memcg, and
high_work_func() invokes reclaim_high() without pinning the memcg.

With obj_cgroup reparenting, introduced in commit bf4f059 ("mm:
memcg/slab: obj_cgroup API"), objects charged to a child memcg are
reparented to its parent in mem_cgroup_css_offline() instead of holding a
reference on the child until uncharged.  Subsequent uncharges of those
objects go to the parent, which can leave the child's memory use
permanently above its high limit, so any later charge on the offlined
memcg in non-task context schedules high_work.  This was later widened
from kernel memory to LRU folios when commit f1cf8d2 ("mm:
memcontrol: eliminate the problem of dying memory cgroup for LRU folios")
converted LRU folios to use obj_cgroup reparenting.

cancel_work_sync(&memcg->high_work) only runs at the end of teardown in
mem_cgroup_css_free(), so high_work_func() can start or still be running
reclaim_high() after mem_cgroup_css_released() or shrink_many() has called
lru_gen_release_memcg() and unhashed lruvec->lrugen.list.  If reclaim
tries to rotate the memcg, lru_gen_rotate_memcg() dereferences a NULL
pprev pointer.  This issue is specific to MGLRU and was introduced with
the memcg LRU in commit e4dde56 ("mm: multi-gen LRU: per-node
lru_gen_folio lists").

With either traditional LRU or MGLRU, css_free_rwork_fn() calls
css_rstat_exit() which frees per-CPU rstat data before calling
mem_cgroup_css_free().  If reclaim_high() is still running, rstat updates
via mod_lruvec_state() -> __css_rstat_updated() cause a use-after-free on
the per-CPU rstat data.  This was introduced when commit 5da3bfa
("cgroup: use separate rstat trees for each subsystem") moved
css_rstat_exit() ahead of ss->css_free().

Fix both problems by acquiring a reference with css_tryget_online() in
high_work_func() before calling reclaim_high(), and by resetting
memory.high and swap.high to PAGE_COUNTER_MAX in mem_cgroup_css_offline()
so that charges via references on an offlined memcg do not trigger
high_work on the dead child and skip checking live ancestors in
try_charge_memcg().

Acquiring the reference in high_work_func() rather than before scheduling
high_work is safe because mem_cgroup_css_free() calls irq_work_sync() and
cancel_work_sync() which cancels pending work and waits for an already
running high_work_func() to complete before mem_cgroup_free() frees the
memcg.  css_tryget_online() uses percpu_ref_tryget_live() and is safe to
call after percpu_ref_exit() before the cgroup is freed unlike
css_tryget().

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 UID: 0 PID: 27 Comm: kworker/1:0 Tainted: G    B   W           7.3.0-rc5-g2bba28e98578 deepin-community#284 PREEMPT(full)
Tainted: [B]=BAD_PAGE, [W]=WARN  <-- Taint from lru_gen_rotate_memcg() VM_WARN_ON_ONCE
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
Workqueue: events high_work_func
RIP: 0010:lru_gen_rotate_memcg+0x1a3/0xe90
Call Trace:
 <TASK>
 ? read_ctrl_pos+0x22f/0x3f0
 shrink_lruvec+0x16cb/0x1b80
 ? ret_from_fork_asm+0x1a/0x30
 ? lapic_next_event+0x15/0x20
 ? clockevents_program_event+0x2bb/0x6f0
 ? lapic_next_event+0x15/0x20
 ? __pfx_shrink_lruvec+0x10/0x10
 ? __pfx_clockevents_program_event+0x10/0x10
 ? _raw_spin_lock+0x84/0xe0
 ? __pfx__raw_spin_lock+0x10/0x10
 ? kasan_save_stack+0x30/0x50
 ? psi_group_change+0x381/0x740
 ? __pfx_sched_clock_cpu+0x10/0x10
 ? save_fpregs_to_fpstate+0xc4/0x2c0
 ? finish_task_switch.isra.0+0x1de/0xac0
 ? __schedule+0xf62/0x42c0
 ? __pfx___schedule+0x10/0x10
 ? __pfx___irq_work_queue_local+0x10/0x10
 ? shrink_node+0x626/0x31e0
 shrink_node+0x626/0x31e0
 ? ring_buffer_unlock_commit+0x11d/0x5c0
 ? kswapd_clear_hopeless+0xa0/0x150
 ? __pfx_shrink_node+0x10/0x10
 ? 0xffffffffc0000095
 do_try_to_free_pages+0x255/0x13b0
 ? ring_buffer_unlock_commit+0x11d/0x5c0
 ? reclaim_high+0x10a/0x1b0
 try_to_free_mem_cgroup_pages+0x1f9/0x5a0
 ? __pfx_try_to_free_mem_cgroup_pages+0x10/0x10
 ? irqentry_exit+0xc6/0x670
 reclaim_high+0x10a/0x1b0
 ? __pfx_reclaim_high+0x10/0x10
 ? process_one_work+0x5ff/0x1030
 ? __pfx_high_work_func+0x10/0x10
 process_one_work+0x6e2/0x1030
 ? __pfx___schedule+0x10/0x10
 ? __pfx_process_one_work+0x10/0x10
 worker_thread+0x422/0xbb0
 ? __pfx_worker_thread+0x10/0x10
 kthread+0x2cd/0x3a0
 ? recalc_sigpending+0x15c/0x200
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x368/0x590
 ? __pfx_ret_from_fork+0x10/0x10
 ? __switch_to+0x588/0xf50
 ? __pfx_kthread+0x10/0x10
 ret_from_fork_asm+0x1a/0x30
 </TASK>

Link: https://lore.kernel.org/[email protected]
Fixes: e4dde56 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
Fixes: 5da3bfa ("cgroup: use separate rstat trees for each subsystem")
Signed-off-by: T.J. Mercier <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Johannes Weiner <[email protected]>
Acked-by: Muchun Song <[email protected]>
Acked-by: Shakeel Butt <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Qi Zheng <[email protected]>
Cc: JP Kobryn <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 16062b71048d8ef85ca6a99d5ef26f0143d0e0c7)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 8ff981a ]

OpenRISC configurations without hardware multiplication fail to build
modules which contain compiler-generated calls to __mulsi3.  The failure
is widespread, affecting filesystems, drivers and KUnit tests at modpost.

When CONFIG_OPENRISC_HAVE_INST_MUL is disabled, the architecture Makefile
passes -msoft-mul to GCC.  The multiplication helper is supplied by the
libgcc archive linked into vmlinux, but or32_ksyms.c does not export it.
Built-in callers can therefore link while module callers cannot resolve
the symbol.

Export __mulsi3 alongside the other compiler-generated helpers.

The omission predates 7c3f4d6 ("resource, kunit: stop selecting
GET_FREE_REGION"), which the robot identified when reporting an additional
failing module.  It was already present in the initial OpenRISC export
list.

Fixes: 6162576 ("OpenRISC: Miscellaneous")
Signed-off-by: Andrew Morton <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Reviewed-by: Bradley Morgan <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Stefan Kristiansson <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Karl Mehltretter <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 7b1579eee9e75860796acad34e94e80b799f8242)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 9a40c05 ]

ocfs2_xattr_set_entry_bucket() hands loc.xl_entry to ocfs2_xa_set() twice:
once for the bucket as it stands, and, if that reports -ENOSPC, once more
after ocfs2_defrag_xattr_bucket() has packed the name/value pairs down.

Defragmenting ends by sorting the entry array on xe_name_hash.  Buckets
are kept sorted, so the sort only permutes entries that share a hash, but
lib/sort.c is an unstable heapsort and it does permute them.  loc.xl_entry
is an address inside xh_entries[], so afterwards it denotes whichever
entry landed in that slot rather than the one the search found.

The second ocfs2_xa_set() then works on the wrong entry.  Nothing on that
path compares the entry's name with xi->xi_name, so what happens depends
on how the two entries compare in size: ocfs2_xa_reuse_entry() trips its
BUG_ON() when the padded name sizes differ, and otherwise the new value is
written into the neighbouring attribute's value slot while the attribute
being set is left untouched.  setxattr() reports success either way.

Remember the entry's hash before defragmenting and look the entry up
again afterwards, the way ocfs2_xattr_bucket_find() does.  An entry that
cannot be found again means the bucket no longer holds what the search
found, so fail with -EFSCORRUPTED rather than writing through the stale
pointer.

Link: https://lore.kernel.org/[email protected]
Fixes: 0122559 ("ocfs2: Enable xattr set in index btree")
Signed-off-by: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 10976cdcd61075eb51799a56ac99de1acda8b84c)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 9c191a7 ]

ocfs2_xattr_create_index_block() turns a non-indexed xattr block into a
tree by copying it into a bucket, and the copy sorts the entries: a
block holds them in insertion order, a bucket by name hash.
ocfs2_xattr_update_xattr_search() nevertheless relocates the caller's
search by the index the entry had in the block, so unless the two orders
agreed it points at an unrelated entry, and nothing between there and
the write compares that entry's name with the one being set.

Setting an xattr whose new value no longer fits the block arrives here
with xs->not_found clear.  The block gave up because
ocfs2_xa_block_can_reuse() wants an exact namevalue size match, while
ocfs2_xa_bucket_can_reuse() only wants an entry at least as large as the
new one, so the bucket accepts a pair the block rejected and the update
lands on whichever entry the sort left at that index.  Equal padded name
lengths get that other attribute's value replaced in place and its name
left alone, so setxattr returns success while the attribute asked for
keeps its old value.  A longer one trips ocfs2_xa_reuse_entry()'s
BUG_ON, and a shorter one is refused by the bucket as well, so
ocfs2_xa_prepare_entry() wipes the entry and writes the new name over
it, leaving xe_name_hash describing a name that is no longer there.

Find the entry again by the name being set, matching the type as well.
The copy carries every entry and every name over unchanged, and (type,
name) pairs are unique within a block, so the match is exact.  The type
matters because the handlers strip their prefix before calling
ocfs2_xattr_set(), so user.foo and trusted.foo share a stored name, a
stored length and a hash, and both can sit in the same block.

The name has to come from xi rather than from xs->here: a failed set can
remove the entry xs->here names, and only the "growing" caller sets
ctxt->set_abort, which is what stops the conversion.  Scan every entry
rather than narrowing on the hash the way ocfs2_find_xe_in_bucket()
does, since an existing entry keeps the hash it was stored under, which
a kernel that sign-extended the name bytes made different from the one
computed now.  An empty result means the entry did not survive the
failed set and this has become an insert; leaving xs->here alone would
keep it pointing into the block, which is rewritten as a tree root
before the caller reads it again.

Link: https://lore.kernel.org/[email protected]
Fixes: 0122559 ("ocfs2: Enable xattr set in index btree")
Signed-off-by: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit f3e86037f2ac33ad13d84d46158e04580bbae24e)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit e8de099 ]

ocfs2_check_xattr_bucket_collision() decides whether splitting a bucket
can make room by comparing the hash being inserted against the first and
the last entry.  xh_count comes off disk and is never checked, and a
bucket is allowed to hold no entries: ocfs2_xa_remove_entry() keeps the
last slot when it removes the only one, so that an empty bucket still
carries the hash it is keyed by.  xh_count then reads back as 0 while
xh_entries[0] is still meaningful, and the second comparison indexes
xh_entries[-1].

That is outside the __counted_by_le(xh_count) bounds of xh_entries[] and
lands on the header.  An entry is 16 bytes and xe_name_hash is its first
field, so the value read is xh_count | xh_free_start << 16.  It stays
inside the block, but the answer is arbitrary, and for an empty bucket
it says there is no collision, so a new bucket gets added on the
strength of it.

An empty bucket holds no entries to collide with.  Return before reading
the array.

One way to reach the test with an empty bucket is a set that removes the
bucket's only entry during cleanup and then fails for space again, since
it is that second -ENOSPC which calls this.  Growing a value past
OCFS2_XATTR_INLINE_SIZE is the easy route: the cluster allocation fails,
the "!orig_clusters" arm of ocfs2_xa_cleanup_value_truncate() removes
the entry, and although the "growing" caller does set ctxt->set_abort,
only ocfs2_xattr_block_set() and __ocfs2_xattr_set_handle() look at it,
so ocfs2_xattr_set_entry_index_block() goes straight on to the collision
check.

This sits on commit a9ea8b397864 ("ocfs2: use the stored hash when
checking xattr bucket collision"), which gave the collision check its two
argument form and is marked for 6.2 and later.  The read fixed here is
present in the three argument version too, but a tree without that
commit needs the hunk adapted by hand.

Link: https://lore.kernel.org/[email protected]
Fixes: 0122559 ("ocfs2: Enable xattr set in index btree")
Signed-off-by: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 2146debe33d00ff9976d179555c169604c3da5c7)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 7133a0d ]

ocfs2_divide_xattr_bucket() appends an empty bucket carrying a sentinel
hash when the source bucket has no divide position, taking that hash
from xh_entries[start - 1].  ocfs2_xattr_find_divide_pos() returns count
when every entry shares one hash, and its loop does not run at all for
count < 2, so an empty bucket comes back with start == count == 0 and
the read is xh_entries[-1].

That is outside the __counted_by_le(xh_count) bounds of xh_entries[] and
lands on the header, so the value picked up is
xh_count | xh_free_start << 16.  One above it is written into the new
bucket's xh_entries[0] and committed, which leaves a bucket whose first
hash does not follow the bucket before it.  ocfs2_xattr_bucket_find()
binary searches on xh_entries[0], so the broken key hides the range the
sentinel was meant to cover: getxattr() answers -ENODATA for an
attribute that is stored, and an insert can go to the wrong bucket and
leave two copies of a name.  The cross cluster divide hands the same
value back as a tree record's e_cpos, which then claims a hash range it
does not cover.

Read xh_entries[0] instead.  The branch is only reached when every entry
shares one hash, so for a non-empty bucket it holds the same value, and
for an empty one it is the slot that carries the bucket key.

An empty bucket reaches the divide from
ocfs2_check_xattr_bucket_collision(), which reports no collision for
one, through ocfs2_add_new_xattr_bucket() and
ocfs2_extend_xattr_bucket().  It does not take a failed set to get
there: a divide that finds no position is itself what leaves an empty
sentinel bucket behind, and a later extend can pick it as the target.

Link: https://lore.kernel.org/[email protected]
Fixes: 80bcaf3 ("ocfs2/xattr: Proper hash collision handle in bucket division")
Signed-off-by: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit b813e2771f1a52e06c70db1790c602f6e6929eaf)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit cd7c356 ]

ocfs2_cp_xattr_block_to_bucket() sizes the name and value area it has to
carry over from the block's last entry, so an empty block makes it read
xh_entries[-1].  That lands on the header, where xe_name_offset overlaps
xh_name_value_len, and block storage never maintains that field, so it
reads as 0 and the copy runs from the header to the end of the block.

The bucket that comes out has xh_count 0 but a name_value_len of
blocksize less the header, and a matching xh_free_start that claims
those bytes are in use -- nearly the whole bucket with the common 4K
block size -- while the last block of the bucket holds a copy of the old
block's bytes.  Nothing but a trace event reads xh_name_value_len, the
copied bytes came from the same inode and were wiped before the entry
was removed, and ocfs2_defrag_xattr_bucket() recomputes xh_free_start,
so this corrupts the header rather than leaking anything.

Leave the bucket empty instead, carrying over the hash the block was
keyed by, since ocfs2_add_new_xattr_bucket() and
ocfs2_xattr_bucket_find() both read xh_entries[0] of an empty bucket.
That read is the exception ocfs2_xa_remove_entry() documents rather than
a new out of bounds access.

A block reaches the conversion empty when truncating an external value
back fails partway through: the "reusing" and "overwriting" callers of
ocfs2_xa_cleanup_value_truncate() remove the entry without setting
ctxt->set_abort, so ocfs2_xattr_block_set() sees a plain -ENOSPC and
converts.  The "growing" caller does set it, and the block form makes a
single attempt with no defragment and retry in between, so that is the
only route here.

Link: https://lore.kernel.org/[email protected]
Fixes: 0122559 ("ocfs2: Enable xattr set in index btree")
Signed-off-by: Joseph Qi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 32af6e623796b430de57da2435ce91035b9af41b)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 7b90009 ]

The current fat_write_failed() implementation calls into
fat_truncate_blocks() without holding truncate_lock.

A failed or short extending write racing with FIBMAP can spuriously make a
FAT filesystem read-only.  FIBMAP bounds its lookup by i_blocks, so it can
walk allocated clusters beyond i_size while fat_write_failed() is removing
them.  If the chain is shortened during the walk, the mapper can report a
bogus "request beyond EOF" error, triggering the default read-only error
policy.  Hold truncate_lock for write around the block cleanup to
serialize it with _fat_bmap().

For comparison, fat_setattr() correctly holds truncate_lock during
truncation:

	down_write(&MSDOS_I(inode)->truncate_lock);
	truncate_setsize(inode, attr->ia_size);
	fat_truncate_blocks(inode, attr->ia_size);
	up_write(&MSDOS_I(inode)->truncate_lock);

Make it so ->truncate_lock is held exclusive while truncating.

Link: https://lore.kernel.org/[email protected]
Fixes: 16fab20 ("fat: permit to return phy block number by fibmap in fallocated region")
Fixes: 459f6ed ("fat: convert to use the new truncate convention.")
Signed-off-by: Matheus Alves de Almeida <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Acked-by: OGAWA Hirofumi <[email protected]>
Cc: Pedro Falcato <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 7eb287241cb89d99a65b79557e7ee6a5237811c7)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 5bdef46 ]

The locking_state reader calls ocfs2_dlm_lvb() through the selected
cluster stack.  Its debug-object reference keeps the tracking list alive,
but does not keep that stack selected without a cluster connection.

DLM initialization publishes the file before establishing its connection,
and DLM shutdown drops the connection while the file still exists.  Both
the mount error unwind in ocfs2_mount_volume() and ocfs2_dismount_volume()
remove the debugfs subtree only after ocfs2_dlm_shutdown() has returned.
Whenever the disconnect releases the last stack reference, which is the
case for a failed mount and for any unmount without a pending hangup, a
concurrent reader dereferences a NULL active_stack:

  Mount error unwind                  Debugfs reader
  ------------------                  --------------
  ocfs2_mount_volume(): out_dlm
    ocfs2_dlm_shutdown()
      disconnect last cluster
        clear active_stack
                                      read locking_state
                                        ocfs2_dlm_seq_show()
                                          ocfs2_dlm_lvb()
                                            dereference active_stack
  fill_super(): out_debugfs
    remove debugfs subtree

Publish the debug files only after the connection and the mount lock
resources are initialized, so a failed DLM initialization has no debug
reference to drop.  Remove them again in the common DLM shutdown helper
before the connection is dropped: debugfs removal waits for readers that
are inside the file operations, and the parent directory is still present
at that point in every caller.  This covers the mount error unwind, the
ocfs2_fill_super() failures after a successful mount that dismount with
mnt_err set, and unmounts whose disconnect releases the stack directly.

Only the relevant frames of the report are kept:

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:ocfs2_dlm_lvb+0x38/0xf0
Call Trace:
 <TASK>
 ocfs2_dlm_seq_show+0x36a/0xb70
 seq_read_iter+0x480/0x1110
 seq_read+0x362/0x5a0
 full_proxy_read+0x11f/0x180
 vfs_read+0x1a0/0xc20
 ksys_read+0x111/0x200
 </TASK>

Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0011-v7-61e3ef8b1ad44ac2e817@gmail.com
Fixes: 286eaa9 ("ocfs2: Break out stackglue into modules.")
Signed-off-by: Cen Zhang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
Assisted-by: LLM
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Jia-Ju Bai <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 89f0674a7718cb1e52c87a5290bec912ee425e6a)
Signed-off-by: Wentao Guan <[email protected]>
[ Upstream commit 6146924 ]

A migration MLE has a base reference for the mastering answer and an
in-use reference held by dlm_migrate_lockres(). The finishing assertion
consumes the base reference, but migration failure drops it again
without checking whether the assertion already consumed it.

The target queues its migration worker before it acknowledges the
ALL_DONE packet, so its finishing assertion can be handled while the
sender still waits for the status. If the connection fails before the
status arrives, dlm_send_one_lockres() returns an error for a migration
that the target has already completed:

  Old-master sender                  Finishing assertion
  -----------------                  -------------------
  publish MLE; take in-use reference
  send ALL_DONE; wait for status
                                     take lookup reference
                                     unlink MLE
                                     put lookup and base references
  send returns a connection error
  put base reference again; free MLE
  put in-use reference; access freed MLE

dlm_assert_master_handler() holds dlm->spinlock from the MLE lookup to
the final puts, and it takes dlm->master_lock around the unlink and the
puts. Decide under the same locks: if the MLE is already unhashed, the
assertion consumed the base reference, so drop only the sender's in-use
reference. Otherwise unlink it before consuming the base reference so a
later assertion no longer finds it.

An assertion that got there first has also made the target the owner
and cleared DLM_LOCK_RES_MIGRATING. Treating the attempt as failed at
that point would leave the lockres owned by the target while this node
still holds the other nodes' locks and refmap bits, so it could neither
be purged nor migrated again. Finish our side as a completed migration
does instead: drop those locks under res->spinlock if the target still
owns the lockres, and recalculate its usage.

Use the same cleanup for the pre-send failure, the send failure and the
target-death failure paths. The sender's in-use reference keeps the MLE
alive until its final put outside the nested locks. Successful
migration retains its existing in-use-only put.

A target that has died cannot assert after the sender has seen its
death. The o2net node-down callback runs before the DLM one; it
disconnects the node and flushes the workqueue that runs the message
handlers, so an assertion already received has been handled by the time
the DLM removes the node from the domain map. A node that leaves the
domain cleanly sends its exit message only after its assertions have
been answered.

Two windows of the hand-over itself are left as they are: the handler
switches the owner and the sender drops the other nodes' locks moments
later, and an assertion from a live target that arrives after the
sender has given up still meets the owner check in the handler. Waiting
for the target before giving up would only stretch the first window
into the time in which recovery of the target can observe it.

KASAN report, only the relevant frames are kept:

BUG: KASAN: slab-use-after-free in dlm_put_mle_inuse+0xce/0xe0
Read of size 8 at addr ffff8881190e3c20 by task umount/593

Call Trace:
 <TASK>
 dlm_put_mle_inuse+0xce/0xe0
 dlm_migrate_lockres+0x16af/0x20d0
 dlm_empty_lockres+0x60a/0xbd0
 dlm_unregister_domain+0x53b/0x11d0
 o2cb_cluster_disconnect+0xa5/0x110
 ocfs2_cluster_disconnect+0x73/0xc0
 ocfs2_dlm_shutdown+0x311/0x440
 ocfs2_dismount_volume+0x696/0x940
 generic_shutdown_super+0x15f/0x490
 kill_block_super+0x40/0xa0
 deactivate_locked_super+0xae/0x120
 deactivate_super+0xa2/0xc0
 cleanup_mnt+0x217/0x450
 task_work_run+0x144/0x230
 </TASK>

Allocated by task 593:
 kmem_cache_alloc_noprof+0x20b/0x5c0
 dlm_migrate_lockres+0x20e/0x20d0
 dlm_empty_lockres+0x60a/0xbd0
 dlm_unregister_domain+0x53b/0x11d0
 o2cb_cluster_disconnect+0xa5/0x110
 ocfs2_cluster_disconnect+0x73/0xc0
 ocfs2_dlm_shutdown+0x311/0x440
 ocfs2_dismount_volume+0x696/0x940

Freed by task 593:
 kmem_cache_free+0x242/0x580
 __dlm_put_mle+0x4b2/0x660
 dlm_migrate_lockres+0x1690/0x20d0
 dlm_empty_lockres+0x60a/0xbd0
 dlm_unregister_domain+0x53b/0x11d0
 o2cb_cluster_disconnect+0xa5/0x110
 ocfs2_cluster_disconnect+0x73/0xc0
 ocfs2_dlm_shutdown+0x311/0x440

The buggy address belongs to the object at ffff8881190e3c00
 which belongs to the cache o2dlm_mle of size 480
The buggy address is located 32 bytes inside of
 freed 480-byte region [ffff8881190e3c00, ffff8881190e3de0)

Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0038-v9-659f247ea980d5f3fbeb@gmail.com
Fixes: 6714d8e ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
Signed-off-by: Cen Zhang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
Assisted-by: LLM
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Heming Zhao <[email protected]>
Cc: Jia-Ju Bai <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit e3c7c28a73ad0c34ef44c7a95c71c5e0ceae110a)
Signed-off-by: Wentao Guan <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Sorry @opsiff, your pull request is larger than the review limit of 150,000 diff characters

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff
opsiff merged commit 4254737 into deepin-community:linux-6.6.y Nov 30, 2026
13 checks passed
@opsiff
opsiff requested a balanced review from Copilot December 1, 2026 03:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The preliminary access check rejects delete-on-close opens requesting only MAXIMUM_ALLOWED before maximal-access resolution can grant DELETE, incorrectly denying callers with DELETE permission.

1 open issue
What changed in this PR

Integrates the next batch of Linux 6.6.163 stable fixes into Deepin’s 6.6.y kernel, leaving the explicitly listed commits for later handling.

Changes:

  • Hardens filesystem, networking, and driver input validation and permission checks.
  • Fixes resource lifetimes, synchronization, error recovery, and memory accounting.
  • Updates architecture-specific behavior, hardware support, and related documentation.
File Description
sound/​x86/​intel_hdmi_audio.c Adds channel-map termination and disables unsafe TLV reads.
sound/​usb/​usx2y/​usb_stream.c Initializes URB tracking before starting transfers.
sound/​usb/​usx2y/​us122l.c Checks missing interfaces and stream state.
sound/​soc/​qcom/​qdsp6/​q6prm.c Guards callbacks against missing driver data.
sound/​soc/​qcom/​qdsp6/​q6apm.c Publishes initialized state and guards early callbacks.
sound/​soc/​qcom/​qdsp6/​q6afe.c Captures and returns hardware-vote handles.
sound/​soc/​codecs/​tlv320aic32x4-clk.c Rejects invalid clock rates and divisors.
sound/​soc/​codecs/​hdac_hda.c Balances runtime power state across unbind and reprobe.
sound/​pci/​hda/​hda_sysfs.c Handles unsupported codec resets explicitly.
sound/​pci/​hda/​hda_codec.c Rejects unsafe codec resets under ASoC.
sound/​core/​hwdep.c Serializes DSP loading with a mutex.
security/​apparmor/​policy.c Removes filesystem entries after failed policy loads.
security/​apparmor/​label.c Removes an obsolete TODO comment.
security/​apparmor/​include/​label.h Converts the profile accessor to an inline function.
net/​xfrm/​xfrm_policy.c Retries policy evaluation after concurrent inexact-tree changes.
net/​xfrm/​xfrm_interface_core.c Validates IP headers before transmission.
net/​xdp/​xsk_buff_pool.c Restores UMEM flags after device-assignment failure.
net/​wireless/​reg.c Bounds regulatory rules within the database.
net/​tipc/​socket.c Wakes senders when group membership restores writability.
net/​tipc/​group.c Tracks pending replicast acknowledgments explicitly.
net/​sctp/​sm_make_chunk.c Includes alignment padding in tailroom checks.
net/​rxrpc/​rxperf.c Handles request completion separately from call completion.
net/​rxrpc/​recvmsg.c Distinguishes completed requests from completed service calls.
net/​rds/​recv.c Restricts multipath handshakes to capable transports.
net/​packet/​af_packet.c Checks fragment capacity before filling the packet.
net/​mac80211/​tx.c Marks packets for operational aggregation sessions.
net/​mac80211/​tdls.c Refreshes the packet pointer after receive preparation.
net/​ipv6/​raw.c Refreshes the route after possible destination replacement.
net/​ipv6/​ip6mr.c Rejects multicast forwarding from unknown interfaces.
net/​ipv4/​tcp_output.c Widens arithmetic before adding the reordering allowance.
net/​ipv4/​tcp_cong.c Checks permissions before acquiring a module reference.
net/​ipv4/​sysctl_net_ipv4.c Caps the TCP TSO RTT logarithm at 31.
net/​ipv4/​ipmr.c Validates forwarding interfaces and initializes synthesized headers.
net/​core/​filter.c Validates packet headers before neighbor redirection.
net/​ceph/​osdmap.c Validates bucket arguments and weight-set sizes.
net/​ceph/​osd_client.c Restricts replica-read flags and bounds response decoding.
net/​ceph/​mon_client.c Validates the initial monitor count.
net/​bluetooth/​smp.c Pins the module while selftest files are open.
net/​bluetooth/​selftest.c Adds module ownership to selftest operations.
net/​bluetooth/​hci_sync.c Corrects advertising restart handling.
net/​batman-adv/​main.c Frees packets when interface reference acquisition fails.
net/​batman-adv/​distributed-arp-table.c Clears unselected candidate pointers.
net/​9p/​trans_xen.c Validates response sizes and releases rejected request references.
net/​9p/​trans_virtio.c Limits mount-tag length.
mm/​vmscan.c Uses live page-table entries and the proper node LRU accessor.
mm/​swapfile.c Makes swapoff interruption restartable and more responsive.
mm/​shmem.c Handles failed large-folio splits, error markers, and swapoff signals.
mm/​shmem_quota.c Preserves quota settings that differ from mount defaults.
mm/​migrate.c Untags remote addresses before page-status lookup.
mm/​mempolicy.c Accounts policy allocations to memory cgroups.
mm/​memfd.c Enables atomic shared file-position updates.
mm/​memcontrol.c Fixes time reads and offline-cgroup reclaim handling.
mm/​madvise.c Adds a rescheduling point after large-page processing.
mm/​ksm.c Preserves soft-dirty state during page replacement.
mm/​hugetlb.c Widens the page-table move return type.
mm/​filemap.c Handles exclusive waiters interrupted after wakeup.
mm/​damon/​core-test.h Updates filter tests for the error-output parameter.
lib/​raid6/​recov_avx512.c Clears upper vector state after recovery operations.
lib/​raid6/​recov_avx2.c Clears upper vector state after recovery operations.
lib/​raid6/​avx512.c Clears upper vector state after syndrome operations.
lib/​raid6/​avx2.c Clears upper vector state after syndrome operations.
kernel/​ucount.c Acquires references before limit checks and balances rollback.
kernel/​trace/​trace_events_hist.c Includes bucket sizes in histogram expressions.
kernel/​time/​timekeeping.c Preserves the original sequence across read retries.
kernel/​time/​posix-stubs.c Accepts null result pointers for clock resolution queries.
kernel/​time/​posix-cpu-timers.c Cleans up sleep timers when their target disappears.
kernel/​time/​namespace.c Corrects time-offset overflow detection.
kernel/​time/​itimer.c Handles timers exactly at their expiration threshold.
kernel/​sys.c Avoids unnecessary compatible clock-unit conversions.
kernel/​cgroup/​cgroup.c Uses thread-directed signaling for cgroup termination.
io_uring/​sqpoll.c Prevents attachment to exiting polling threads.
io_uring/​rsrc.c Holds the submission lock through fixed-file result copying.
io_uring/​io_uring.c Releases the polling-thread lock during cancellation waits.
io_uring/​cancel.c Counts all canceled poll requests.
init/​main.c Processes extra init arguments before command-line init arguments.
include/​trace/​events/​rxrpc.h Updates AFS abort trace identifiers.
include/​sound/​hwdep.h Adds the DSP-loading mutex.
include/​net/​espintcp.h Orders and stabilizes access to socket context data.
include/​linux/​hugetlb.h Updates page-table move declarations and stubs.
include/​linux/​fs.h Clarifies writeback timestamp comments only.
include/​acpi/​cppc_acpi.h Declares the immutable automatic-selection capability helper.
fs/​xfs/​xfs_ioctl.c Requires space for an attribute-list offset entry.
fs/​xfs/​scrub/​quota.c Allows soft limits when no hard limit is set.
fs/​xfs/​scrub/​fscounters.c Detects negative delayed-allocation counts.
fs/​xfs/​scrub/​dabtree.c Traces corruption errors before clearing them.
fs/​xfs/​scrub/​common.c Preserves original errors in scrub traces.
fs/​xfs/​scrub/​btree.c Records btree errors before marking them handled.
fs/​xfs/​libxfs/​xfs_da_btree.c Bounds node entries using the active fork’s geometry.
fs/​verity/​read_metadata.c Requires read access for metadata retrieval.
fs/​verity/​open.c Validates descriptor sizes before allocation and use.
fs/​verity/​measure.c Requires read access for digest retrieval.
fs/​splice.c Preserves file positions when splice fails.
fs/​smb/​server/​vfs.h Exposes the exact-name extended-attribute length helper.
fs/​smb/​server/​vfs.c Makes the attribute-length helper available to other server code.
fs/​smb/​server/​smbacl.c Checks membership before granting group-entry permissions.
fs/​smb/​server/​smb2pdu.c Checks delete-on-close access and queries stream sizes directly.
fs/​smb/​server/​misc.c Sizes UTF-16 name buffers including their terminator.
fs/​smb/​client/​smb2pdu.c Validates read-data offsets against received response sizes.
fs/​smb/​client/​cifsglob.h Adds a server-object lifetime reference counter.
fs/​read_write.c Skips write-limit checks for zero-byte file copies.
fs/​overlayfs/​file.c Tracks write ownership explicitly for asynchronous cleanup.
fs/​ocfs2/​file.c Uses stable dentry-name snapshots in release tracing.
fs/​ocfs2/​dlmglue.c Removes debug readers before cluster-stack teardown.
fs/​ocfs2/​cluster/​nodemanager.c Uses configuration state to determine IP-tree membership.
fs/​ntfs3/​fslog.c Bounds logged attribute insertion, deletion, and resizing.
fs/​nfsd/​pnfs.h Passes request context to layout-generation callbacks.
fs/​nfsd/​nfs4proc.c Supplies request context when obtaining layouts.
fs/​nfsd/​nfs4layouts.c Gates flex layouts on NFSv3 and guards partial cleanup.
fs/​nfsd/​flexfilelayoutxdr.h Stores mapped numeric layout user and group IDs.
fs/​nfsd/​flexfilelayoutxdr.c Encodes already-mapped layout IDs.
fs/​nfsd/​flexfilelayout.c Maps layout credentials through the request’s user namespace.
fs/​nfsd/​blocklayout.c Adapts the block-layout callback signature.
fs/​nfs/​write.c Uses lock-type helpers for write-extension decisions.
fs/​nfs/​pnfs.h Declares shared data-server address-list cleanup.
fs/​nfs/​pnfs_nfs.c Centralizes and exports address-list cleanup.
fs/​nfs/​nfs4xdr.c Uses the read-lock helper during encoding.
fs/​nfs/​nfs4_fs.h Declares the lost-lock-context helper.
fs/​nfs/​flexfilelayout/​flexfilelayoutdev.c Uses shared data-server address cleanup.
fs/​nfs/​filelayout/​filelayoutdev.c Uses shared data-server address cleanup.
fs/​nfs/​file.c Uses lock-type helpers to identify unlock requests.
fs/​nfs/​delegation.c Uses the dedicated file-lock iterator.
fs/​nfs/​callback_xdr.c Bounds device-notification counts before allocation.
fs/​namespace.c Checks the current filesystem context’s sharing count.
fs/​jbd2/​journal.c Advances fast-commit offsets only after buffer acquisition.
fs/​fs-writeback.c Corrects timestamps, list accounting, and sync coordination.
fs/​fat/​inode.c Locks block truncation during failed-write cleanup.
fs/​f2fs/​segment.c Avoids finalizing live mappings when aborting atomic writes.
fs/​f2fs/​file.c Uses nonfinal page-cache truncation for atomic replacement.
fs/​ext2/​file.c Preserves partial direct-write progress after fallback errors.
fs/​exportfs/​expfs.c Releases temporary directory files synchronously.
fs/​ceph/​xattr.c Checks decoded lengths and aggregate-size overflow.
fs/​ceph/​snap.c Uses overflow-safe snapshot-length calculations.
fs/​ceph/​mdsmap.c Bounds metadata-server counts and variable-length fields.
fs/​ceph/​mds_client.c Validates replies and fixes session-reference cleanup.
fs/​ceph/​crypto.c Bounds encryption-context data within its stored blob.
fs/​ceph/​caps.c Releases failed-send buffers and respects nonblocking requests.
fs/​ceph/​addr.c Bounds inline reads and corrects write-begin retry behavior.
fs/​btrfs/​sysfs.c Restores allocation context on an early return.
fs/​aio.c Handles faults on truncated ring mappings safely.
fs/​9p/​vfs_inode.c Avoids decrementing an already-zero link count.
fs/​9p/​v9fs.c Uses bounded sysfs output for cache tags.
drivers/​video/​fbdev/​atmel_lcdfb.c Handles mode-allocation failures and empty mode lists.
drivers/​vhost/​vringh.c Rejects empty indirect tables and counts descriptor loops.
drivers/​vhost/​vdpa.c Corrects page-unpin tracking on mapping failures.
drivers/​ufs/​core/​ufshcd.c Resets retry arguments and removes a redundant warning.
drivers/​ufs/​core/​ufs_bsg.c Validates requests, initializes replies, and completes error paths.
drivers/​tty/​serial/​amba-pl011.c Keeps transmission enabled when leaving RS485 mode.
drivers/​target/​target_core_user.c Rejects nonpositive data-page block sizes.
drivers/​target/​target_core_fabric_lib.c Validates iSCSI ISID length and termination.
drivers/​spi/​spi-zynq-qspi.c Supports four-byte addresses with a dedicated buffer.
drivers/​spi/​spi-bcm-qspi.c Bounds dummy bytes in memory operations.
drivers/​sh/​maple/​maple.c Matches IRQ cleanup identifiers to registration.
drivers/​scsi/​scsi_ioctl.c Rejects negative timeouts and caps converted values.
drivers/​scsi/​scsi_bsg.c Propagates user-buffer unmapping errors.
drivers/​scsi/​libiscsi_tcp.c Uses overflow-safe R2T bounds checks.
drivers/​scsi/​aic7xxx/​aic7xxx_pci.c Handles SGI O2 onboard controller defaults.
drivers/​scsi/​aic7xxx/​aic7xxx_core.c Preserves the PCI-selected host ID.
drivers/​s390/​char/​vmcp.c Zero-initializes session state.
drivers/​pwm/​pwm-tiehrpwm.c Releases disabled channels’ shared-period constraints.
drivers/​pci/​quirks.c Refines failed-link retraining conditions.
drivers/​parisc/​eisa_enumerator.c Bounds EEPROM slot counts and available configuration data.
drivers/​nvme/​target/​rdma.c Validates inline-data bounds and connection-request length.
drivers/​nvme/​target/​io-cmd-bdev.c Finishes block plugs on integrity-allocation failures.
drivers/​nvme/​target/​fc.c Cleans up failed associations and suppresses failed-command data.
drivers/​nvme/​target/​fabrics-cmd-auth.c Resets negotiation state and handles challenge failures.
drivers/​nvme/​target/​configfs.c Locks controller-list traversal during forced reconnects.
drivers/​nvme/​target/​auth.c Clears session-key length during cleanup.
drivers/​net/​wwan/​iosm/​iosm_ipc_protocol_ops.c Validates the message-ring head index.
drivers/​net/​wireless/​rsi/​rsi_91x_core.c Bounds traffic identifiers before aggregation lookup.
drivers/​net/​wireless/​realtek/​rtw88/​tx.h Defines short and long transmit-report timeouts.
drivers/​net/​wireless/​realtek/​rtw88/​tx.c Uses longer report timeouts for non-PCIe devices.
drivers/​net/​wireless/​mediatek/​mt76/​mt792x_core.c Preserves capability-query errors and applies a fallback.
drivers/​net/​wireless/​broadcom/​brcm80211/​brcmfmac/​msgbuf.c Uses bidirectional DMA mappings for receive buffers.
drivers/​net/​vxlan/​vxlan_core.c Removes explicit tunnel statistics callbacks.
drivers/​net/​veth.c Corrects carrier restoration and XDP MTU updates.
drivers/​net/​usb/​pegasus.c Validates received Ethernet frame lengths.
drivers/​net/​ppp/​ppp_generic.c Refreshes the data pointer after pulling packet data.
drivers/​net/​macvlan.c Changes promiscuity only for running devices.
drivers/​net/​ethernet/​mellanox/​mlxsw/​spectrum_span.c Initializes the policer register-query buffer.
drivers/​net/​ethernet/​mellanox/​mlxsw/​core.c Initializes firmware-health register buffers.
drivers/​net/​ethernet/​mellanox/​mlxsw/​core_hwmon.c Initializes temperature and fan register buffers.
drivers/​net/​ethernet/​jme.h Adds a wake-on-LAN quiesce state flag.
drivers/​net/​ethernet/​intel/​ixgbe/​ixgbe_main.c Defers timestamp reservation until packet preparation finishes.
drivers/​net/​ethernet/​hisilicon/​hisi_femac.c Resets the port before freeing packet rings.
drivers/​net/​ethernet/​broadcom/​bgmac.c Enables interrupt handling before chip initialization.
drivers/​net/​ethernet/​atheros/​atl1c/​atl1c_main.c Validates receive lengths and counts dropped frames as work.
drivers/​net/​bonding/​bond_main.c Bounds ARP-target parsing by the input index.
drivers/​mtd/​nand/​raw/​pl35x-nand-controller.c Separates ECC-mode handling and diagnostic messages.
drivers/​mtd/​nand/​raw/​Kconfig Updates NDFC platform and device-tree dependencies.
drivers/​media/​usb/​uvc/​uvc_driver.c Adds AVerMedia capture-device quirks.
drivers/​media/​usb/​dvb-usb/​dvb-usb-firmware.c Validates extended-address firmware records.
drivers/​media/​platform/​mediatek/​jpeg/​mtk_jpeg_core.c Avoids context access after completing JPEG jobs.
drivers/​media/​i2c/​adv748x/​adv748x-core.c Balances device-tree references on probe failures.
drivers/​media/​common/​cypress_firmware.c Validates extended-address firmware records.
drivers/​iio/​pressure/​dps310.c Corrects configuration-register bit definitions.
drivers/​i2c/​i2c-core-acpi.c Releases the adapter reference after client creation.
drivers/​i2c/​busses/​i2c-mt7621.c Initializes transfer buffers and avoids unnecessary register access.
drivers/​i2c/​busses/​i2c-designware-master.c Waits for block-read length before queuing more reads.
drivers/​hwmon/​pmbus/​q54sj108a2.c Skips debugfs setup when its parent is unavailable.
drivers/​hwmon/​pmbus/​pmbus_core.c Handles unavailable thermal support and registration errors.
drivers/​hwmon/​peci/​dimmtemp.c Cancels deferred detection explicitly during removal.
drivers/​hwmon/​nct6683.c Uses the correct PWM attribute structure.
drivers/​hwmon/​lm87.c Retrieves VRM state through the I2C client.
drivers/​hwmon/​lm70.c Corrects signed temperature conversion.
drivers/​hwmon/​corsair-cpro.c Updates cached targets only after successful commands.
drivers/​hwmon/​asus_wmi_sensors.c Makes hardware-monitor descriptions device-local.
drivers/​gpu/​drm/​vc4/​vc4_hdmi.c Reorders scrambling setup and synchronizes its shutdown.
drivers/​gpu/​drm/​vc4/​vc4_gem.c Updates sync objects outside the job lock with a fence reference.
drivers/​gpu/​drm/​v3d/​v3d_sched.c Initializes compute-job timeout progress tracking.
drivers/​gpu/​drm/​loongson/​lsdc_ttm.h Exposes buffer-clearing errors in the interface.
drivers/​gpu/​drm/​loongson/​lsdc_ttm.c Handles mapping failures and avoids duplicate allocation cleanup.
drivers/​gpu/​drm/​loongson/​lsdc_plane.c Uses the new framebuffer during asynchronous cursor updates.
drivers/​gpu/​drm/​loongson/​lsdc_gem.c Releases objects when buffer clearing fails.
drivers/​gpu/​drm/​i915/​gem/​i915_gem_execbuffer.c Resets error state for each timeline fence.
drivers/​gpu/​drm/​drm_crtc.c Waits for RCU readers before CRTC cleanup.
drivers/​gpu/​drm/​amd/​display/​amdgpu_dm/​amdgpu_dm.c Balances power references on CRTC activity transitions.
drivers/​gpu/​drm/​amd/​amdkfd/​kfd_chardev.c Avoids repeated queue eviction during checkpoint queries.
drivers/​gpio/​gpio-pca953x.c Updates wake accounting only after successful IRQ configuration.
drivers/​firmware/​efi/​libstub/​Makefile Reserves register x18 in the arm64 EFI stub.
drivers/​cpufreq/​cpufreq_stats.c Skips updates when the frequency index is unknown.
drivers/​cpufreq/​amd-pstate.c Rejects passive mode when automatic selection is immutable.
drivers/​char/​tpm/​tpm-dev-common.c Returns immediately for zero-length reads.
drivers/​char/​tpm/​tpm_nsc.c Guards removal and preserves platform-device release handling.
drivers/​block/​loop.c Checks permissions for compatible status-setting ioctls.
Documentation/​virt/​hyperv/​vmbus.rst Updates message APIs and transaction-lifetime guidance.
Documentation/​networking/​rxrpc.rst Documents distinct service-call receive return values.
Documentation/​networking/​ip-sysctl.rst Documents the TCP TSO RTT setting’s valid range.
Documentation/​filesystems/​fsverity.rst Documents read-access requirements for verity ioctls.
Documentation/​devicetree/​bindings/​clock/​nuvoton,ma35d1-clk.yaml Describes both oscillator inputs and their names.
block/​bsg.c Validates and caps SCSI timeout values.
block/​blk-iocost.c Stops surplus redistribution after invalid weight detection.
arch/​x86/​kvm/​vmx/​vmx.c Registers the VMX halted-state clearing callback.
arch/​x86/​kvm/​vmx/​nested.c Stops searching after restoring a matching host MSR.
arch/​x86/​kvm/​svm/​nested.c Rejects inconsistent nested long-mode state.
arch/​x86/​kvm/​mmu/​paging_tmpl.h Reschedules repeated guest page-table walk retries.
arch/​x86/​kvm/​mmu/​mmu.c Recycles shadow pages with excessive parent mappings.
arch/​x86/​kernel/​acpi/​cppc.c Validates fixed-hardware register addresses and bit ranges.
arch/​x86/​include/​asm/​xor_avx.h Clears upper vector state after XOR operations.
arch/​x86/​include/​asm/​kvm-x86-ops.h Adds the optional halted-state clearing operation.
arch/​x86/​include/​asm/​kvm_host.h Declares and documents the halted-state clearing callback.
arch/​riscv/​include/​asm/​pgtable.h Excludes invalidated huge-page entries from accessibility checks.
arch/​openrisc/​kernel/​or32_ksyms.c Exports the integer multiplication helper.
arch/​loongarch/​pci/​pci.c Uses the NUMA address-base helper for PCI configuration.
arch/​loongarch/​kernel/​traps.c Conditions SIGTRAP delivery and corrects watchpoint constants.
arch/​loongarch/​kernel/​irq.c Uses the NUMA helper to decode PCI node IDs.
arch/​loongarch/​include/​asm/​numa.h Uses a 64-bit cast for node address construction.
arch/​loongarch/​include/​asm/​loongarch.h Corrects watchpoint-status constant names.
arch/​loongarch/​include/​asm/​hw_breakpoint.h Returns signal decisions from breakpoint handlers.
arch/​arm64/​kernel/​topology.c Propagates remote-call errors and validates register bit ranges.

Review effort: Balanced

Comment thread fs/smb/server/smb2pdu.c
Comment on lines +3157 to +3159
if (req->CreateOptions & FILE_DELETE_ON_CLOSE_LE &&
!(smb_map_generic_desired_access(req->DesiredAccess) &
FILE_DELETE_LE)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.