6.18.32-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 483/957 HID: usbhid: fix deadlock in hid_post_reset()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit 8df2c1b47ee3cd50fd454f75c7a7e2ae8a6adf72 ]
You can build a USB device that includes a HID component and a storage or UAS component. The components can be reset only together. That means that hid_pre_reset() and hid_post_reset() are in the block IO error handling. Hence no memory allocation used in them may do block IO because the IO can deadlock on the mutex held while resetting a device and calling the interface drivers.
Use GFP_NOIO for all allocations in them.
--- drivers/hid/usbhid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +1 -1
@@ -1552,7 +1552,7 @@ static int hid_post_reset(struct usb_interface *intf)* configuration descriptors passed, we already know that * the size of the HID report descriptor has not changed. */ - rdesc =kmalloc (hid->dev_rsize,GFP_KERNEL ); + rdesc =kmalloc (hid->dev_rsize,GFP_NOIO );if (!rdesc)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 484/957 ext4: fix possible null-ptr-deref in mbt_kunit_exit()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
[ Upstream commit 22f53f08d9eb837ce69b1a07641d414aac8d045f ]
There's issue as follows:
# test_new_blocks_simple: failed to initialize: -12
KASAN: null-ptr-deref in range [0x0000000000000638-0x000000000000063f] Tainted: [E]=UNSIGNED_MODULE, [N]=TEST RIP: 0010:mbt_kunit_exit+0x5e/0x3e0 [ext4_test] Call Trace: <TASK> kunit_try_run_case_cleanup+0xbc/0x100 [kunit] kunit_generic_run_threadfn_adapter+0x89/0x100 [kunit] kthread+0x408/0x540 ret_from_fork+0xa76/0xdf0 ret_from_fork_asm+0x1a/0x30
If mbt_kunit_init() init testcase failed will lead to null-ptr-deref. So add test if 'sb' is inited success in mbt_kunit_exit().
--- fs/ext4/mballoc-test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/mballoc-test.c +5 -1
@@ -362,7 +362,6 @@ static int mbt_kunit_init(struct kunit *test)return ret; } - test->priv = sb;kunit_activate_static_stub (test, ext4_read_block_bitmap_nowait, ext4_read_block_bitmap_nowait_stub);
@@ -383,6 +382,8 @@ static int mbt_kunit_init(struct kunit *test)return -ENOMEM ; } + test->priv = sb; +return 0 ; }
@@ -390,6 +391,9 @@ static void mbt_kunit_exit(struct kunit *test) {struct super_block *sb = (struct super_block *)test->priv; +if (!sb) +return ; +mbt_mb_release (sb);mbt_ctx_release (sb);mbt_ext4_free_super_block (sb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 485/957 bpf, arm64: Fix off-by-one in check_imm signed range check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 1dd8be4ec722ce54e4cace59f3a4ba658111b3ec ]
check_imm(bits, imm) is used in the arm64 BPF JIT to verify that a branch displacement (in arm64 instruction units) fits into the signed N-bit immediate field of a B, B.cond or CBZ/CBNZ encoding before it is handed to the encoder. The macro currently tests for (imm > 0 && imm >> bits) || (imm < 0 && ~imm >> bits) which admits values in [-2^N, 2^N) — effectively a signed (N+1)-bit range. A signed N-bit field only holds [-2^(N-1), 2^(N-1)), so the check admits one extra bit of range on each side.
In particular, for check_imm19(), values in [2^18, 2^19) slip past the check but do not fit into the 19-bit signed imm19 field of B.cond. aarch64_insn_encode_immediate() then masks the raw value into the 19-bit field, setting bit 18 (the sign bit) and flipping a forward branch into a backward one. Same class of issue exists for check_imm26() and the B/BL encoding. Shift by (bits - 1) instead of bits so the actual signed N-bit range is enforced.
--- arch/arm64/net/bpf_jit_comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/net/bpf_jit_comp.c +2 -2
@@ -35,8 +35,8 @@#define ARENA_VM_START (MAX_BPF_JIT_REG + 5)#define check_imm (bits, imm) do { \ - if ((((imm) > 0) && ((imm) >> (bits))) || \ - (((imm) < 0) && (~(imm) >> (bits)))) { \ + if ((((imm) > 0) && ((imm) >> ((bits) - 1))) || \ + (((imm) < 0) && (~(imm) >> ((bits) - 1)))) { \ pr_info("[%2d] imm=%d(0x%x) out of range\n", \ i, imm, imm); \ return -EINVAL; \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 486/957 bpf, arm64: Remove redundant bpf_flush_icache() after pack allocator finalize
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 42f18ae53011826cfd3c84d041817e7f07bc645b ]
bpf_flush_icache() calls flush_icache_range() to clean the data cache and invalidate the instruction cache for the JITed code region. However, since commit 1dad391daef1 ("bpf, arm64: use bpf_prog_pack for memory management"), this flush is redundant.
bpf_jit_binary_pack_finalize() copies the JITed instructions to the ROX region via bpf_arch_text_copy() -> aarch64_insn_copy() -> __text_poke(), and __text_poke() already calls flush_icache_range() on the written range. The subsequent bpf_flush_icache() repeats the same cache maintenance on an overlapping range, including an unnecessary second synchronous IPI to all CPUs via kick_all_cpus_sync().
Remove the redundant bpf_flush_icache() call and its now-unused definition.
--- arch/arm64/net/bpf_jit_comp.c | 12 ------------ 1 file changed, 12 deletions(-)
arch/arm64/net/bpf_jit_comp.c +0 -12
@@ -18,7 +18,6 @@#include <asm/asm-extable.h> #include <asm/byteorder.h> -#include <asm/cacheflush.h> #include <asm/cpufeature.h> #include <asm/debug-monitors.h> #include <asm/insn.h>
@@ -1964,11 +1963,6 @@ static int validate_ctx(struct jit_ctx *ctx)return 0 ; } -static inline void bpf_flush_icache (void *start,void *end) -{ -flush_icache_range ((unsigned long )start, (unsigned long )end); -} -static void priv_stack_init_guard (void __percpu *priv_stack_ptr,int alloc_size) {int cpu, underflow_idx = (alloc_size -PRIV_STACK_GUARD_SZ ) >>3 ;
@@ -2207,12 +2201,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog = orig_prog; goto out_off; } -/* -* The instructions have now been copied to the ROX region from -* where they will execute. Now the data cache has to be cleaned to -* the PoU and the I-cache has to be invalidated for the VAs. -*/ -bpf_flush_icache (ro_header, ctx.ro_image + ctx.idx); }else { jit_data->ctx = ctx; jit_data->ro_image = ro_image_ptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 487/957 bpf, riscv: Remove redundant bpf_flush_icache() after pack allocator finalize
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 46ee1342b887c9387a933397d846ff6c9584322c ]
bpf_flush_icache() calls flush_icache_range() to clean the data cache and invalidate the instruction cache for the JITed code region. However, since commit 48a8f78c50bd ("bpf, riscv: use prog pack allocator in the BPF JIT"), this flush is redundant.
bpf_jit_binary_pack_finalize() copies the JITed instructions to the ROX region via bpf_arch_text_copy() -> patch_text_nosync(), and patch_text_nosync() already calls flush_icache_range() on the written range. The subsequent bpf_flush_icache() repeats the same cache maintenance on an overlapping range.
Remove the redundant bpf_flush_icache() call and its now-unused definition.
--- arch/riscv/net/bpf_jit.h | 6 ------ arch/riscv/net/bpf_jit_core.c | 7 ------- 2 files changed, 13 deletions(-)
arch/riscv/net/bpf_jit.h +0 -6
@@ -11,7 +11,6 @@#include <linux/bpf.h> #include <linux/filter.h> -#include <asm/cacheflush.h> /* verify runtime detection extension status */ #define rv_ext_enabled (ext) \
@@ -105,11 +104,6 @@ static inline void bpf_fill_ill_insns(void *area, unsigned int size)memset (area,0 , size); } -static inline void bpf_flush_icache (void *start,void *end) -{ -flush_icache_range ((unsigned long )start, (unsigned long )end); -} -/* Emit a 4-byte riscv instruction. */ static inline void emit (const u32 insn,struct rv_jit_context *ctx) {
arch/riscv/net/bpf_jit_core.c +0 -7
@@ -183,13 +183,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog = orig_prog; goto out_offset; } -/* -* The instructions have now been copied to the ROX region from -* where they will execute. -* Write any modified data cache blocks out to memory and -* invalidate the corresponding blocks in the instruction cache. -*/ -bpf_flush_icache (jit_data->ro_header, ctx->ro_insns + ctx->ninsns);for (i =0 ; i < prog->len; i++) ctx->offset[i] =ninsns_rvoff (ctx->offset[i]);bpf_prog_fill_jited_linfo (prog, ctx->offset);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 488/957 bpf, sockmap: Fix af_unix iter deadlock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 4d328dd695383224aa750ddee6b4ad40c0f8d205 ]
bpf_iter_unix_seq_show() may deadlock when lock_sock_fast() takes the fast path and the iter prog attempts to update a sockmap. Which ends up spinning at sock_map_update_elem()'s bh_lock_sock():
WARNING: possible recursive locking detected
test_progs/1393 is trying to acquire lock:ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: sock_map_update_elem+0xdb/0x1f0
but task is already holding lock:ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: __lock_sock_fast+0x37/0xe0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(slock-AF_UNIX);
lock(slock-AF_UNIX);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by test_progs/1393:
#0: ffff88814b59c790 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x59/0x10d0 #1: ffff88811ec25fd8 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: bpf_seq_read+0x42c/0x10d0 #2: ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: __lock_sock_fast+0x37/0xe0 #3: ffffffff85a6a7c0 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x51d/0xb00
Call Trace: dump_stack_lvl+0x5d/0x80 print_deadlock_bug.cold+0xc0/0xce __lock_acquire+0x130f/0x2590 lock_acquire+0x14e/0x2b0 _raw_spin_lock+0x30/0x40 sock_map_update_elem+0xdb/0x1f0 bpf_prog_2d0075e5d9b721cd_dump_unix+0x55/0x4f4 bpf_iter_run_prog+0x5b9/0xb00 bpf_iter_unix_seq_show+0x1f7/0x2e0 bpf_seq_read+0x42c/0x10d0 vfs_read+0x171/0xb20 ksys_read+0xff/0x200 do_syscall_64+0x6b/0x3a0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/unix/af_unix.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/unix/af_unix.c +3 -4
@@ -3773,15 +3773,14 @@ static int bpf_iter_unix_seq_show(struct seq_file *seq, void *v)struct bpf_prog *prog;struct sock *sk = v;uid_t uid; -bool slow;int ret;if (v ==SEQ_START_TOKEN )return 0 ; - slow =lock_sock_fast (sk); +lock_sock (sk); -if (unlikely (sk_unhashed (sk))) { +if (unlikely (sock_flag (sk,SOCK_DEAD ))) { ret =SEQ_SKIP ; goto unlock; }
@@ -3791,7 +3790,7 @@ static int bpf_iter_unix_seq_show(struct seq_file *seq, void *v) prog =bpf_iter_get_info (&meta, false); ret =unix_prog_seq_show (prog, &meta, v, uid); unlock: -unlock_sock_fast (sk, slow); +release_sock (sk);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 489/957 bpf, sockmap: Fix af_unix null-ptr-deref in proto update
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit dca38b7734d2ea00af4818ff3ae836fab33d5d5a ]
unix_stream_connect() sets sk_state (WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)) _before_ it assigns a peer (unix_peer(sk) = newsk). sk_state == TCP_ESTABLISHED makes sock_map_sk_state_allowed() believe that socket is properly set up, which would include having a defined peer. IOW, there's a window when unix_stream_bpf_update_proto() can be called on socket which still has unix_peer(sk) == NULL.
CPU0 bpf CPU1 connect
-------- ------------
WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)sock_map_sk_state_allowed(sk)
...sk_pair = unix_peer(sk)sock_hold(sk_pair)
sock_hold(newsk) smp_mb__after_atomic() unix_peer(sk) = newsk
BUG: kernel NULL pointer dereference, address: 0000000000000080 RIP: 0010:unix_stream_bpf_update_proto+0xa0/0x1b0 Call Trace: sock_map_link+0x564/0x8b0 sock_map_update_common+0x6e/0x340 sock_map_update_elem_sys+0x17d/0x240 __sys_bpf+0x26db/0x3250 __x64_sys_bpf+0x21/0x30 do_syscall_64+0x6b/0x3a0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Initial idea was to move peer assignment _before_ the sk_state update[1], but that involved an additional memory barrier, and changing the hot path was rejected.
Then a NULL check during proto update in unix_stream_bpf_update_proto() was considered[2], but the follow-up discussion[3] focused on the root cause, i.e. sockmap update taking a wrong lock. Or, more specifically, missing unix_state_lock()[4].
In the end it was concluded that teaching sockmap about the af_unix locking would be unnecessarily complex[5].
Complexity aside, since BPF_PROG_TYPE_SCHED_CLS and BPF_PROG_TYPE_SCHED_ACT are allowed to update sockmaps, sock_map_update_elem() taking the unix lock, as it is currently implemented in unix_state_lock():
spin_lock(&unix_sk(s)->lock), would be problematic. unix_state_lock() taken in a process context, followed by a softirq-context TC BPF program attempting to take the same spinlock -- deadlock[6].
This way we circled back to the peer check idea[2].
[1]: https://lore.kernel.org/netdev/[email protected]/
[2]: https://lore.kernel.org/netdev/[email protected]/
[3]: https://lore.kernel.org/netdev/[email protected]/
[4]: https://lore.kernel.org/netdev/CAAVpQUA+8GL_j63CaKb8hbxoL21izD58yr1NvhOhU=j+35+3og@mail.gmail.com/
[5]: https://lore.kernel.org/bpf/CAAVpQUAHijOMext28Gi10dSLuMzGYh+jK61Ujn+fZ-wvcODR2A@mail.gmail.com/
[6]: https://lore.kernel.org/bpf/[email protected]/
Summary of scenarios where af_unix/stream connect() may race a sockmap update:
1. connect() vs. bpf(BPF_MAP_UPDATE_ELEM), i.e. sock_map_update_elem_sys()
Implemented NULL check is sufficient. Once assigned, socket peer won't be released until socket fd is released. And that's not an issue because sock_map_update_elem_sys() bumps fd refcnf.
2. connect() vs BPF program doing update
Update restricted per verifier.c:may_update_sockmap() to
BPF_PROG_TYPE_TRACING/BPF_TRACE_ITER BPF_PROG_TYPE_SOCK_OPS (bpf_sock_map_update() only) BPF_PROG_TYPE_SOCKET_FILTER BPF_PROG_TYPE_SCHED_CLS BPF_PROG_TYPE_SCHED_ACT
BPF_PROG_TYPE_XDP BPF_PROG_TYPE_SK_REUSEPORT BPF_PROG_TYPE_FLOW_DISSECTOR BPF_PROG_TYPE_SK_LOOKUP
Plus one more race to consider:
CPU0 bpf CPU1 connect
-------- ------------
WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)
sock_map_sk_state_allowed(sk)
sock_hold(newsk)
smp_mb__after_atomic()
unix_peer(sk) = newsk
sk_pair = unix_peer(sk)
if (unlikely(!sk_pair))
return -EINVAL;
CPU1 close
----------
skpair = unix_peer(sk);
unix_peer(sk) = NULL;
sock_put(skpair) // use after free?
sock_hold(sk_pair)
2.1 BPF program invoking helper function bpf_sock_map_update() ->
BPF_CALL_4(bpf_sock_map_update(), ...)
Helper limited to BPF_PROG_TYPE_SOCK_OPS. Nevertheless, a unix sock might be accessible via bpf_map_lookup_elem(). Which implies sk already having psock, which in turn implies sk already having sk_pair. Since sk_psock_destroy() is queued as RCU work, sk_pair won't go away while BPF executes the update.
2.2 BPF program invoking helper function bpf_map_update_elem() ->
sock_map_update_elem()
2.2.1 Unix sock accessible to BPF prog only via sockmap lookup in
BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_SCHED_CLS,
BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_XDP,
BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR,
BPF_PROG_TYPE_SK_LOOKUP.
Pretty much the same as case 2.1.
2.2.2 Unix sock accessible to BPF program directly:
BPF_PROG_TYPE_TRACING, narrowed down to BPF_TRACE_ITER.
Sockmap iterator (sock_map_seq_ops) is safe: unix sock
residing in a sockmap means that the sock already went through
the proto update step.
Unix sock iterator (bpf_iter_unix_seq_ops), on the other hand,
gives access to socks that may still be unconnected. Which
means iterator prog can race sockmap/proto update against
connect().
BUG: KASAN: null-ptr-deref in unix_stream_bpf_update_proto+0x253/0x4d0
Write of size 4 at addr 0000000000000080 by task test_progs/3140
Call Trace:
dump_stack_lvl+0x5d/0x80
kasan_report+0xe4/0x1c0
kasan_check_range+0x125/0x200
unix_stream_bpf_update_proto+0x253/0x4d0
sock_map_link+0x71c/0xec0
sock_map_update_common+0xbc/0x600
sock_map_update_elem+0x19a/0x1f0
bpf_prog_bbbf56096cdd4f01_selective_dump_unix+0x20c/0x217
bpf_iter_run_prog+0x21e/0xae0
bpf_iter_unix_seq_show+0x1e0/0x2a0
bpf_seq_read+0x42c/0x10d0
vfs_read+0x171/0xb20
ksys_read+0xff/0x200
do_syscall_64+0xf7/0x5e0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
While the introduced NULL check prevents null-ptr-deref in the
BPF program path as well, it is insufficient to guard against
a poorly timed close() leading to a use-after-free. This will
be addressed in a subsequent patch.--- net/unix/unix_bpf.c | 3 +++ 1 file changed, 3 insertions(+)
net/unix/unix_bpf.c +3 -0
@@ -185,6 +185,9 @@ int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool r*/ if (!psock->sk_pair) { sk_pair =unix_peer (sk); +if (unlikely (!sk_pair)) +return -EINVAL ; +sock_hold (sk_pair); psock->sk_pair = sk_pair; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 490/957 bpf, sockmap: Take state lock for af_unix iter
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 64c2f93fc3254d3bf5de4445fb732ee5c451edb6 ]
When a BPF iterator program updates a sockmap, there is a race condition in unix_stream_bpf_update_proto() where the peer pointer can become stale[1] during a state transition TCP_ESTABLISHED -> TCP_CLOSE.
CPU0 bpf CPU1 close
-------- ----------
// unix_stream_bpf_update_proto()sk_pair = unix_peer(sk)
if (unlikely(!sk_pair))
return -EINVAL;
// unix_release_sock()
skpair = unix_peer(sk);
unix_peer(sk) = NULL;
sock_put(skpair)sock_hold(sk_pair) // UaF
More practically, this fix guarantees that the iterator program is consistently provided with a unix socket that remains stable during iterator execution.
[1]:
BUG: KASAN: slab-use-after-free in unix_stream_bpf_update_proto+0x155/0x490 Write of size 4 at addr ffff8881178c9a00 by task test_progs/2231 Call Trace: dump_stack_lvl+0x5d/0x80 print_report+0x170/0x4f3 kasan_report+0xe4/0x1c0 kasan_check_range+0x125/0x200 unix_stream_bpf_update_proto+0x155/0x490 sock_map_link+0x71c/0xec0 sock_map_update_common+0xbc/0x600 sock_map_update_elem+0x19a/0x1f0 bpf_prog_bbbf56096cdd4f01_selective_dump_unix+0x20c/0x217 bpf_iter_run_prog+0x21e/0xae0 bpf_iter_unix_seq_show+0x1e0/0x2a0 bpf_seq_read+0x42c/0x10d0 vfs_read+0x171/0xb20 ksys_read+0xff/0x200 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 __kasan_slab_alloc+0x63/0x80 kmem_cache_alloc_noprof+0x1d5/0x680 sk_prot_alloc+0x59/0x210 sk_alloc+0x34/0x470 unix_create1+0x86/0x8a0 unix_stream_connect+0x318/0x15b0 __sys_connect+0xfd/0x130 __x64_sys_connect+0x72/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x70 __kasan_slab_free+0x47/0x70 kmem_cache_free+0x11c/0x590 __sk_destruct+0x432/0x6e0 unix_release_sock+0x9b3/0xf60 unix_release+0x8a/0xf0 __sock_release+0xb0/0x270 sock_close+0x18/0x20 __fput+0x36e/0xac0 fput_close_sync+0xe5/0x1a0 __x64_sys_close+0x7d/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/unix/af_unix.c | 2 ++ 1 file changed, 2 insertions(+)
net/unix/af_unix.c +2 -0
@@ -3779,6 +3779,7 @@ static int bpf_iter_unix_seq_show(struct seq_file *seq, void *v)return 0 ;lock_sock (sk); +unix_state_lock (sk);if (unlikely (sock_flag (sk,SOCK_DEAD ))) { ret =SEQ_SKIP ;
@@ -3790,6 +3791,7 @@ static int bpf_iter_unix_seq_show(struct seq_file *seq, void *v) prog =bpf_iter_get_info (&meta, false); ret =unix_prog_seq_show (prog, &meta, v, uid); unlock: +unix_state_unlock (sk);release_sock (sk);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 491/957 bpf: Fix precedence bug in convert_bpf_ld_abs alignment check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit e5f635edd393aeaa7cad9e42831d397e6e2e1eed ]
Fix an operator precedence issue in convert_bpf_ld_abs() where the expression offset + ip_align % size evaluates as offset + (ip_align % size) due to % having higher precedence than +. That latter evaluation does not make any sense. The intended check is (offset + ip_align) % size == 0 to verify that the packet load offset is properly aligned for direct access.
With NET_IP_ALIGN == 2, the bug causes the inline fast-path for direct packet loads to almost never be taken on !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS platforms. This forces nearly all cBPF BPF_LD_ABS packet loads through the bpf_skb_load_helper slow path on the affected archs.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -508,7 +508,7 @@ static bool convert_bpf_ld_abs(struct sock_filter *fp, struct bpf_insn **insnp) ((unaligned_ok && offset >= 0) || (!unaligned_ok && offset >= 0 && offset + ip_align >= 0 && - offset + ip_align % size == 0))) { + (offset + ip_align) % size == 0))) {bool ldx_off_ok = offset <=S16_MAX ; *insn++ =BPF_MOV64_REG (BPF_REG_TMP ,BPF_REG_H );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 492/957 bpf: Fix NULL deref in map_kptr_match_type for scalar regs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit 4d0a375887ab4d49e4da1ff10f9606cab8f7c3ad ]
Commit ab6c637ad027 ("bpf: Fix a bpf_kptr_xchg() issue with local kptr") refactored map_kptr_match_type() to branch on btf_is_kernel() before checking base_type(). A scalar register stored into a kptr slot has no btf, so the btf_is_kernel(reg->btf) call dereferences NULL.
Move the base_type() != PTR_TO_BTF_ID guard before any reg->btf access.
--- kernel/bpf/verifier.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +4 -1
@@ -5843,6 +5843,9 @@ static int map_kptr_match_type(struct bpf_verifier_env *env,int perm_flags;const char *reg_name ="" ; +if (base_type (reg->type) !=PTR_TO_BTF_ID ) + goto bad_type; +if (btf_is_kernel (reg->btf)) { perm_flags =PTR_MAYBE_NULL |PTR_TRUSTED |MEM_RCU ;
@@ -5855,7 +5858,7 @@ static int map_kptr_match_type(struct bpf_verifier_env *env, perm_flags |=MEM_PERCPU ; } -if (base_type (reg->type) !=PTR_TO_BTF_ID || (type_flag (reg->type) & ~perm_flags)) +if (type_flag (reg->type) & ~perm_flags) goto bad_type;/* We need to verify reg->type and reg->btf, before accessing reg->btf */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 493/957 bpf: allow UTF-8 literals in bpf_bprintf_prepare()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihan Ding <[email protected]>
[ Upstream commit b960430ea8862ef37ce53c8bf74a8dc79d3f2404 ]
bpf_bprintf_prepare() only needs ASCII parsing for conversion specifiers. Plain text can safely carry bytes >= 0x80, so allow UTF-8 literals outside '%' sequences while keeping ASCII control bytes rejected and format specifiers ASCII-only.
This keeps existing parsing rules for format directives unchanged, while allowing helpers such as bpf_trace_printk() to emit UTF-8 literal text.
Update test_snprintf_negative() in the same commit so selftests keep matching the new plain-text vs format-specifier split during bisection.
--- kernel/bpf/helpers.c | 17 ++++++++++++++++- .../testing/selftests/bpf/prog_tests/snprintf.c | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-)
kernel/bpf/helpers.c +16 -1
@@ -848,7 +848,13 @@ int bpf_bprintf_prepare(const char *fmt, u32 fmt_size, const u64 *raw_args, data->buf = buffers->buf;for (i =0 ; i < fmt_size; i++) { -if ((!isprint (fmt[i]) && !isspace (fmt[i])) || !isascii (fmt[i])) { +unsigned char c = fmt[i]; + +/* +* Permit bytes >= 0x80 in plain text so UTF-8 literals can pass +* through unchanged, while still rejecting ASCII control bytes. +*/ +if (isascii (c) && !isprint (c) && !isspace (c)) { err = -EINVAL ; goto out; }
@@ -870,6 +876,15 @@ int bpf_bprintf_prepare(const char *fmt, u32 fmt_size, const u64 *raw_args,* always access fmt[i + 1], in the worst case it will be a 0 */ i++; + c = fmt[i]; +/* +* The format parser below only understands ASCII conversion +* specifiers and modifiers, so reject non-ASCII after '%'. +*/ +if (!isascii (c)) { + err = -EINVAL ; + goto out; + }/* skip optional "[0 +-][num]" width formatting field */ while (fmt[i] == '0' || fmt[i] == '+' || fmt[i] == '-' ||
tools/testing/selftests/bpf/prog_tests/snprintf.c +2 -1
@@ -114,7 +114,8 @@ static void test_snprintf_negative(void)ASSERT_ERR (load_single_snprintf ("%--------" ),"invalid specifier 5" );ASSERT_ERR (load_single_snprintf ("%lc" ),"invalid specifier 6" );ASSERT_ERR (load_single_snprintf ("%llc" ),"invalid specifier 7" ); -ASSERT_ERR (load_single_snprintf ("\x80" ),"non ascii character" ); +ASSERT_OK (load_single_snprintf ("\x80" ),"non ascii plain text" ); +ASSERT_ERR (load_single_snprintf ("%\x80" ),"non ascii in specifier" );ASSERT_ERR (load_single_snprintf ("\x1" ),"non printable character" );ASSERT_ERR (load_single_snprintf ("%p%" ),"invalid specifier 8" );ASSERT_ERR (load_single_snprintf ("%s%" ),"invalid specifier 9" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 494/957 libbpf: Prevent double close and leak of btf objects
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 380044c40b1636a72fd8f188b5806be6ae564279 ]
Sashiko found possible double close of btf object fd [1], which happens when strdup in load_module_btfs fails at which point the obj->btf_module_cnt is already incremented.
The error path close btf fd and so does later cleanup code in bpf_object_post_load_cleanup function.
Also libbpf_ensure_mem failure leaves btf object not assigned and it's leaked.
Replacing the err_out label with break to make the error path less confusing as suggested by Alan.
Incrementing obj->btf_module_cnt only if there's no failure and releasing btf object in error path.
[1] https://sashiko.dev/#/patchset/20260324081846.2334094-1-jolsa%40kernel.org
--- tools/lib/bpf/libbpf.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
tools/lib/bpf/libbpf.c +11 -10
@@ -5746,11 +5746,12 @@ static int load_module_btfs(struct bpf_object *obj) info.name =ptr_to_u64 (name); info.name_len =sizeof (name); + btf =NULL ; err =bpf_btf_get_info_by_fd (fd, &info, &len);if (err) { err = -errno;pr_warn ("failed to get BTF object #%d info: %s\n" , id,errstr (err)); - goto err_out; +break ; }/* ignore non-module BTFs */
@@ -5764,15 +5765,15 @@ static int load_module_btfs(struct bpf_object *obj)if (err) {pr_warn ("failed to load module [%s]'s BTF object #%d: %s\n" , name, id,errstr (err)); - goto err_out; +break ; } err =libbpf_ensure_mem ((void **)&obj->btf_modules, &obj->btf_module_cap,sizeof (*obj->btf_modules), obj->btf_module_cnt +1 );if (err) - goto err_out; +break ; - mod_btf = &obj->btf_modules[obj->btf_module_cnt++]; + mod_btf = &obj->btf_modules[obj->btf_module_cnt]; mod_btf->btf = btf; mod_btf->id = id;
@@ -5780,16 +5781,16 @@ static int load_module_btfs(struct bpf_object *obj) mod_btf->name =strdup (name);if (!mod_btf->name) { err = -ENOMEM ; - goto err_out; +break ; } -continue ; + obj->btf_module_cnt++; + } -err_out: +if (err) { +btf__free (btf);close (fd); -return err; } - -return 0 ; +return err; } static struct bpf_core_cand_list *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 495/957 bpf: Validate node_id in arena_alloc_pages()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 2845989f2ebaf7848e4eccf9a779daf3156ea0a5 ]
arena_alloc_pages() accepts a plain int node_id and forwards it through the entire allocation chain without any bounds checking.
Validate node_id before passing it down the allocation chain in arena_alloc_pages().
--- kernel/bpf/arena.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/arena.c +4 -0
@@ -446,6 +446,10 @@ static long arena_alloc_pages(struct bpf_arena *arena, long uaddr, long page_cntu32 uaddr32;int ret, i; +if (node_id !=NUMA_NO_NODE && + ((unsigned int )node_id >= nr_node_ids || !node_online (node_id))) +return 0 ; +if (page_cnt > page_cnt_max)return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 496/957 bpf, arm32: Reject BPF-to-BPF calls and callbacks in the JIT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit e1d486445af3c392628532229f7ce5f5cf7891b6 ]
The ARM32 BPF JIT does not support BPF-to-BPF function calls (BPF_PSEUDO_CALL) or callbacks (BPF_PSEUDO_FUNC), but it does not reject them either.
When a program with subprograms is loaded (e.g. libxdp's XDP dispatcher uses __noinline__ subprograms, or any program using callbacks like bpf_loop or bpf_for_each_map_elem), the verifier invokes bpf_jit_subprogs() which calls bpf_int_jit_compile() for each subprogram.
For BPF_PSEUDO_CALL, since ARM32 does not reject it, the JIT silently emits code using the wrong address computation:
func = __bpf_call_base + imm
where imm is a pc-relative subprogram offset, producing a bogus function pointer.
For BPF_PSEUDO_FUNC, the ldimm64 handler ignores src_reg and loads the immediate as a normal 64-bit value without error.
In both cases, build_body() reports success and a JIT image is allocated. ARM32 lacks the jit_data/extra_pass mechanism needed for the second JIT pass in bpf_jit_subprogs(). On the second pass, bpf_int_jit_compile() performs a full fresh compilation, allocating a new JIT binary and overwriting prog->bpf_func. The first allocation is never freed. bpf_jit_subprogs() then detects the function pointer changed and aborts with -ENOTSUPP, but the original JIT binary has already been leaked. Each program load/unload cycle leaks one JIT binary allocation, as reported by kmemleak:
unreferenced object 0xbf0a1000 (size 4096):
backtrace:
bpf_jit_binary_alloc+0x64/0xfc
bpf_int_jit_compile+0x14c/0x348
bpf_jit_subprogs+0x4fc/0xa60Fix this by rejecting both BPF_PSEUDO_CALL in the BPF_CALL handler and BPF_PSEUDO_FUNC in the BPF_LD_IMM64 handler, falling through to the existing 'notyet' path. This causes build_body() to fail before any JIT binary is allocated, so bpf_int_jit_compile() returns the original program unjitted. bpf_jit_subprogs() then sees !prog->jited and cleanly falls back to the interpreter with no leak.
--- arch/arm/net/bpf_jit_32.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/net/bpf_jit_32.c +6 -0
@@ -1852,6 +1852,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) {u64 val = (u32 )imm | (u64 )insn[1 ].imm <<32 ; +if (insn->src_reg ==BPF_PSEUDO_FUNC ) + goto notyet; +emit_a32_mov_i64 (dst, val, ctx);return 1 ;
@@ -2055,6 +2058,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)const s8 *r5 = bpf2a32[BPF_REG_5 ];const u32 func = (u32 )__bpf_call_base + (u32 )imm; +if (insn->src_reg ==BPF_PSEUDO_CALL ) + goto notyet; +emit_a32_mov_r64 (true, r0, r1, ctx);emit_a32_mov_r64 (true, r1, r2, ctx);emit_push_r64 (r5, ctx);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 497/957 perf trace: Fix IS_ERR() vs NULL check bug
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangguangju <[email protected]>
[ Upstream commit 96f202eab8133f94479b14a32902c636e9bdf6af ]
The alloc_syscall_stats() function always returns an error pointer (ERR_PTR) on failure.
So replace NULL check with IS_ERR() check after calling delete_syscall_stats() function.
--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
@@ -1573,7 +1573,7 @@ static void delete_syscall_stats(struct hashmap *syscall_stats)struct hashmap_entry *pos;size_t bkt; -if (syscall_stats ==NULL ) +if (IS_ERR (syscall_stats))return ;hashmap__for_each_entry (syscall_stats, pos, bkt)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 498/957 pinctrl: pinctrl-pic32: Fix resource leak
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ethan Tidmore <[email protected]>
[ Upstream commit fe5560688f3ba98364c7de7b4f8dc240ffd1ff75 ]
Fix three possible resource leaks by using the devres version of clk_prepare_enable(). Also, update error message accordingly.
Detected by Smatch:drivers/pinctrl/pinctrl-pic32.c:2211 pic32_pinctrl_probe() warn:
'pctl->clk' from clk_prepare_enable() not released on lines: 2208.
drivers/pinctrl/pinctrl-pic32.c:2274 pic32_gpio_probe() warn:
'bank->clk' from clk_prepare_enable() not released on lines: 2264,2272.
--- drivers/pinctrl/pinctrl-pic32.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/pinctrl/pinctrl-pic32.c +4 -16
@@ -2175,16 +2175,10 @@ static int pic32_pinctrl_probe(struct platform_device *pdev)if (IS_ERR (pctl->reg_base))return PTR_ERR (pctl->reg_base); - pctl->clk =devm_clk_get (&pdev->dev,NULL ); + pctl->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (pctl->clk)) { ret =PTR_ERR (pctl->clk); -dev_err (&pdev->dev,"clk get failed\n" ); -return ret; - } - - ret =clk_prepare_enable (pctl->clk); -if (ret) { -dev_err (&pdev->dev,"clk enable failed\n" ); +dev_err (&pdev->dev,"Failed to get and enable clock\n" );return ret; }
@@ -2240,16 +2234,10 @@ static int pic32_gpio_probe(struct platform_device *pdev)if (irq <0 )return irq; - bank->clk =devm_clk_get (&pdev->dev,NULL ); + bank->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (bank->clk)) { ret =PTR_ERR (bank->clk); -dev_err (&pdev->dev,"clk get failed\n" ); -return ret; - } - - ret =clk_prepare_enable (bank->clk); -if (ret) { -dev_err (&pdev->dev,"clk enable failed\n" ); +dev_err (&pdev->dev,"Failed to get and enable clock\n" );return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 499/957 perf trace: Avoid an ERR_PTR in syscall_stats
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit d05073adda0f047e9b2115a2932bcb2797eab238 ]
hashmap__new may return an ERR_PTR and previously this would be assigned to syscall_stats meaning all use of syscall_stats needs to test for NULL (uninitialized) or an ERR_PTR. Given the only reason hashmap__new can fail is ENOMEM, just use NULL to indicate the allocation failure and avoid the code having to test for NULL and IS_ERR.
--- tools/perf/builtin-trace.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tools/perf/builtin-trace.c +7 -5
@@ -1565,7 +1565,9 @@ static bool syscall_id_equal(long key1, long key2, void *ctx __maybe_unused)static struct hashmap *alloc_syscall_stats (void ) { -return hashmap__new (syscall_id_hash, syscall_id_equal,NULL ); +struct hashmap *result =hashmap__new (syscall_id_hash, syscall_id_equal,NULL ); + +return IS_ERR (result) ?NULL : result; }static void delete_syscall_stats (struct hashmap *syscall_stats)
@@ -1573,7 +1575,7 @@ static void delete_syscall_stats(struct hashmap *syscall_stats)struct hashmap_entry *pos;size_t bkt; -if (IS_ERR (syscall_stats)) +if (!syscall_stats)return ;hashmap__for_each_entry (syscall_stats, pos, bkt)
@@ -1589,7 +1591,7 @@ static struct thread_trace *thread_trace__new(struct trace *trace) ttrace->files.max =-1 ;if (trace->summary) { ttrace->syscall_stats =alloc_syscall_stats (); -if (IS_ERR (ttrace->syscall_stats)) +if (!ttrace->syscall_stats)zfree (&ttrace); } }
@@ -4441,7 +4443,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)if (trace->summary_mode ==SUMMARY__BY_TOTAL && !trace->summary_bpf) { trace->syscall_stats =alloc_syscall_stats (); -if (IS_ERR (trace->syscall_stats)) +if (!trace->syscall_stats) goto out_delete_evlist; }
@@ -4749,7 +4751,7 @@ static int trace__replay(struct trace *trace)if (trace->summary_mode ==SUMMARY__BY_TOTAL ) { trace->syscall_stats =alloc_syscall_stats (); -if (IS_ERR (trace->syscall_stats)) +if (!trace->syscall_stats) goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 500/957 pinctrl: cy8c95x0: remove duplicate error message
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 970dacb3b9f0fedbbbcfd7dbf1f4f22340b3f359 ]
The pin control core is covered to report any error via message. The devm_request_threaded_irq() already prints an error message. Remove the duplicates.
While at it, drop the info message as the same information about an IRQ in use can be retrieved differently.
Stable-dep-of: 5ad32c3607cf ("pinctrl: cy8c95x0: Avoid returning positive values to user space")
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +5 -16
@@ -1310,6 +1310,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) {struct gpio_irq_chip *girq = &chip->gpio_chip.irq;DECLARE_BITMAP (pending_irqs,MAX_LINE ); +struct device *dev = chip->dev;int ret;mutex_init (&chip->irq_lock);
@@ -1336,17 +1337,9 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) girq->handler = handle_simple_irq; girq->threaded = true; - ret =devm_request_threaded_irq (chip->dev, irq, -NULL , cy8c95x0_irq_handler, -IRQF_ONESHOT |IRQF_SHARED , -dev_name (chip->dev), chip); -if (ret) { -dev_err (chip->dev,"failed to request irq %d\n" , irq); -return ret; - } -dev_info (chip->dev,"Registered threaded IRQ\n" ); - -return 0 ; +return devm_request_threaded_irq (dev, irq,NULL , cy8c95x0_irq_handler, +IRQF_ONESHOT |IRQF_SHARED , +dev_name (chip->dev), chip); }static int cy8c95x0_setup_pinctrl (struct cy8c95x0_pinctrl *chip)
@@ -1362,11 +1355,7 @@ static int cy8c95x0_setup_pinctrl(struct cy8c95x0_pinctrl *chip) pd->owner =THIS_MODULE ; chip->pctldev =devm_pinctrl_register (chip->dev, pd, chip); -if (IS_ERR (chip->pctldev)) -return dev_err_probe (chip->dev,PTR_ERR (chip->pctldev), -"can't register controller\n" ); - -return 0 ; +return PTR_ERR_OR_ZERO (chip->pctldev); } static int cy8c95x0_detect(struct i2c_client *client,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 501/957 pinctrl: cy8c95x0: Unify messages with help of dev_err_probe()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 014884732095b982412d13d3220c3fe8483b9b3e ]
Unify error messages that might appear during probe phase by switching to use dev_err_probe().
Stable-dep-of: 5ad32c3607cf ("pinctrl: cy8c95x0: Avoid returning positive values to user space")
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +2 -4
@@ -1319,10 +1319,8 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)/* Read IRQ status register to clear all pending interrupts */ ret =cy8c95x0_irq_pending (chip, pending_irqs); -if (ret) { -dev_err (chip->dev,"failed to clear irq status register\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"failed to clear irq status register\n" );/* Mask all interrupts */ bitmap_fill (chip->irq_mask,MAX_LINE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 502/957 pinctrl: cy8c95x0: Avoid returning positive values to user space
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 5ad32c3607cf241a1a2680cabd64cbcd757227aa ]
When probe fails due to unclear interrupt status register, it returns a positive number instead of the proper error code. Fix this accordingly.
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
@@ -1320,7 +1320,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)/* Read IRQ status register to clear all pending interrupts */ ret =cy8c95x0_irq_pending (chip, pending_irqs);if (ret) -return dev_err_probe (dev, ret,"failed to clear irq status register\n" ); +return dev_err_probe (dev, -EBUSY ,"failed to clear irq status register\n" );/* Mask all interrupts */ bitmap_fill (chip->irq_mask,MAX_LINE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 503/957 perf branch: Avoid incrementing NULL
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit c969a9d7bbf46f983c4a48566b3b2f7340b02296 ]
If the entry is NULL the value is meaningless so early return NULL to avoid an increment of NULL. This was happening in calls from has_stitched_lbr when running the "perf record LBR tests". The return value isn't used in that case, so returning NULL as no effect.
--- tools/perf/util/branch.h | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/branch.h +3 -0
@@ -66,6 +66,9 @@ static inline struct branch_entry *perf_sample__branch_entries(struct perf_sampl {u64 *entry = (u64 *)sample->branch_stack; +if (entry ==NULL ) +return NULL ; + entry++;if (sample->no_hw_idx)return (struct branch_entry *)entry;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 504/957 perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Leach <[email protected]>
[ Upstream commit 6c478e7b3eba3f387a2d6c749e3e3ee0f8ad1c53 ]
Building perf with CORESIGHT=1 and the optional CSTRACE_RAW=1 enables additional debug printing of raw trace data when using command:- perf report --dump.
This raw trace prints the CoreSight formatted trace frames, which may be used to investigate suspected issues with trace quality / corruption / decode.
These frames are not present in ETE + TRBE trace. This fix removes the unnecessary call to print these frames.
This fix also rationalises implementation - original code had helper function that unnecessarily repeated initialisation calls that had already been made.
Due to an addtional fault with the OpenCSD library, this call when ETE/TRBE are being decoded will cause a segfault in perf. This fix also prevents that problem for perf using older (<= 1.8.0 version) OpenCSD libraries.
--- .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 51 +++++-------------- 1 file changed, 13 insertions(+), 38 deletions(-)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +13 -38
@@ -237,46 +237,24 @@ cs_etm_decoder__init_def_logger_printing(struct cs_etm_decoder_params *d_params, (void *)decoder, cs_etm_decoder__print_str_cb);if (ret !=0 ) - ret =-1 ; - -return 0 ; -} +return -1 ;#ifdef CS_LOG_RAW_FRAMES -static void -cs_etm_decoder__init_raw_frame_logging (struct cs_etm_decoder_params *d_params, -struct cs_etm_decoder *decoder) -{ -/* Only log these during a --dump operation */ -if (d_params->operation ==CS_ETM_OPERATION_PRINT ) { -/* set up a library default logger to process the -* raw frame printer we add later -*/ -ocsd_def_errlog_init (OCSD_ERR_SEV_ERROR ,1 ); - -/* no stdout / err / file output */ -ocsd_def_errlog_config_output (C_API_MSGLOGOUT_FLG_NONE ,NULL ); - -/* set the string CB for the default logger, -* passes strings to perf print logger. -*/ -ocsd_def_errlog_set_strprint_cb (decoder->dcd_tree, - (void *)decoder, - cs_etm_decoder__print_str_cb); - +/* +* Only log raw frames if --dump operation and hardware is actually +* generating formatted CoreSight trace frames +*/ +if ((d_params->operation ==CS_ETM_OPERATION_PRINT ) && + (d_params->formatted == true)) {/* use the built in library printer for the raw frames */ -ocsd_dt_set_raw_frame_printer (decoder->dcd_tree, -CS_RAW_DEBUG_FLAGS ); + ret =ocsd_dt_set_raw_frame_printer (decoder->dcd_tree, +CS_RAW_DEBUG_FLAGS ); +if (ret !=0 ) +return -1 ; } -} -#else -static void -cs_etm_decoder__init_raw_frame_logging ( -struct cs_etm_decoder_params *d_params__maybe_unused , -struct cs_etm_decoder *decoder__maybe_unused ) -{ -}#endif +return 0 ; +} static ocsd_datapath_resp_t cs_etm_decoder__do_soft_timestamp(struct cs_etm_queue *etmq,
@@ -760,9 +738,6 @@ cs_etm_decoder__new(int decoders, struct cs_etm_decoder_params *d_params,if (ret !=0 ) goto err_free_decoder; -/* init raw frame logging if required */ -cs_etm_decoder__init_raw_frame_logging (d_params, decoder); -for (i =0 ; i < decoders; i++) { ret = cs_etm_decoder__create_etm_decoder(d_params, &t_params[i],
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 505/957 pinctrl: pinconf-generic: Fully validate pinmux property
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit c98324ea7849b6e5baa1774f71709b375a2c2f9e ]
The pinconf_generic_parse_dt_pinmux() assumes that the 'pinmux' property is not empty when present. This might be not true. With that, the allocator will give a special value in return and not NULL which lead to the crash when trying to access that (invalid) memory. Fix that by fully validating 'pinmux' value, including its length.
--- drivers/pinctrl/pinconf-generic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pinctrl/pinconf-generic.c +6 -1
@@ -261,12 +261,17 @@ int pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev,return -ENOENT ; } + npins_t = prop->length /sizeof (u32); +if (npins_t ==0 ) { +dev_info (dev,"pinmux property doesn't have entries\n" ); +return -ENODATA ; + } +if (!pid || !pmux || !npins) {dev_err (dev,"parameters error\n" );return -EINVAL ; } - npins_t = prop->length /sizeof (u32); pid_t =devm_kcalloc (dev, npins_t,sizeof (*pid_t),GFP_KERNEL ); pmux_t =devm_kcalloc (dev, npins_t,sizeof (*pmux_t),GFP_KERNEL );if (!pid_t || !pmux_t) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 506/957 pinctrl: realtek: Fix function signature for config argument
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu-Chun Lin <[email protected]>
[ Upstream commit 1f5451844786ed203605528dca9e5d84ed378160 ]
The argument originates from pinconf_to_config_argument(), which returns a u32. Therefore, the arg parameter should be an unsigned int instead of enum pin_config_param.
--- drivers/pinctrl/realtek/pinctrl-rtd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/realtek/pinctrl-rtd.c +1 -1
@@ -279,7 +279,7 @@ static const struct rtd_pin_sconfig_desc *rtd_pinctrl_find_sconfig(struct rtd_pistatic int rtd_pconf_parse_conf (struct rtd_pinctrl *data,unsigned int pinnr,enum pin_config_param param, -enum pin_config_param arg) +unsigned int arg) {const struct rtd_pin_config_desc *config_desc;const struct rtd_pin_sconfig_desc *sconfig_desc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 507/957 pinctrl: abx500: Fix type of argument variable
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu-Chun Lin <[email protected]>
[ Upstream commit 34006f77890d050e6d80cbee365b5d703c1140b4 ]
The argument variable is assigned the return value of pinconf_to_config_argument(), which returns a u32. Change its type from enum pin_config_param to unsigned int to correctly store the configuration argument.
--- drivers/pinctrl/nomadik/pinctrl-abx500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-abx500.c +1 -1
@@ -852,7 +852,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,int ret = -EINVAL ;int i;enum pin_config_param param; -enum pin_config_param argument; +unsigned int argument;for (i =0 ; i < num_configs; i++) { param =pinconf_to_config_param (configs[i]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 508/957 pinctrl: renesas: rzg2l: Fix save/restore of {IOLH,IEN,PUPD,SMT} registers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit d9a60e367919752a1d398ebeba667f1e200fae1e ]
The rzg2l_pinctrl_pm_setup_regs() handles save/restore of {IOLH,IEN,PUPD,SMT} registers during s2ram, but only for ports where all pins share the same pincfg. Extend the code to also support ports with variable pincfg per pin, so that {IOLH,IEN,PUPD,SMT} registers are correctly saved and restored for all pins.
--- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +7 -0
@@ -2997,6 +2997,13 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen off =RZG2L_PIN_CFG_TO_PORT_OFFSET (cfg); pincnt =hweight8 (FIELD_GET (PIN_CFG_PIN_MAP_MASK , cfg)); +if (cfg &RZG2L_VARIABLE_CFG ) { +unsigned int pin = port *RZG2L_PINS_PER_PORT ; + +for (unsigned int i =0 ; i <RZG2L_PINS_PER_PORT ; i++) + cfg |= *(u64 *)pctrl->desc.pins[pin + i].drv_data; + } + caps =FIELD_GET (PIN_CFG_MASK , cfg); has_iolh = !!(caps & (PIN_CFG_IOLH_A |PIN_CFG_IOLH_B |PIN_CFG_IOLH_C )); has_ien = !!(caps &PIN_CFG_IEN );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 509/957 perf lock: Fix option value type in parse_max_stack
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit cfaade34b52aa1ec553044255702c4b31b57c005 ]
The value is a void* and the address of an int, max_stack_depth, is set up in the perf lock options. The parse_max_stack function treats the int* as a long*, make this more correct by declaring the value to be an int*.
--- tools/perf/builtin-lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-lock.c +1 -1
@@ -2250,7 +2250,7 @@ static int parse_map_entry(const struct option *opt, const char *str,static int parse_max_stack (const struct option *opt,const char *str,int unset__maybe_unused ) { -unsigned long *len = (unsigned long *)opt->value; +int *len = opt->value;long val;char *endptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 510/957 perf stat: Fix opt->value type for parse_cache_level
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 44311ae84ad9177fb311aee856027861c22f17b2 ]
Commit f5803651b4a4 ("perf stat: Choose the most disaggregate command line option") changed aggregation option handling for perf stat but not perf stat report leading to parse_cache_level being passed a struct in the perf stat case but erroneously an aggr_mode enum value for perf stat report. Change the perf stat report aggregation handling to use the same opt_aggr_mode as perf stat. Also, just pass the boolean for consistency with other boolean argument handling.
--- tools/perf/builtin-stat.c | 43 +++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-)
tools/perf/builtin-stat.c +23 -20
@@ -153,7 +153,7 @@ struct opt_aggr_mode { };/* Turn command line option into most generic aggregation mode setting. */ -static enum aggr_mode opt_aggr_mode_to_aggr_mode (struct opt_aggr_mode *opt_mode) +static enum aggr_mode opt_aggr_mode_to_aggr_mode (const struct opt_aggr_mode *opt_mode) {enum aggr_mode mode =AGGR_GLOBAL ;
@@ -1161,8 +1161,8 @@ static int parse_cache_level(const struct option *opt, int unset __maybe_unused) {int level; -struct opt_aggr_mode *opt_aggr_mode = (struct opt_aggr_mode *)opt->value; -u32 *aggr_level = (u32 *)opt->data; +bool *per_cache = opt->value; +u32 *aggr_level = opt->data;/* * If no string is specified, aggregate based on the topology of
@@ -1200,7 +1200,7 @@ static int parse_cache_level(const struct option *opt,return -EINVAL ; } out: - opt_aggr_mode->cache = true; + *per_cache = true; *aggr_level = level;return 0 ; }
@@ -2262,24 +2262,23 @@ static struct perf_stat perf_stat = {static int __cmd_report (int argc,const char **argv) {struct perf_session *session; +struct opt_aggr_mode opt_mode = {};const struct option options[] = {OPT_STRING ('i' ,"input" , &input_name,"file" ,"input file name" ), -OPT_SET_UINT (0 ,"per-socket" , &perf_stat.aggr_mode, -"aggregate counts per processor socket" ,AGGR_SOCKET ), -OPT_SET_UINT (0 ,"per-die" , &perf_stat.aggr_mode, -"aggregate counts per processor die" ,AGGR_DIE ), -OPT_SET_UINT (0 ,"per-cluster" , &perf_stat.aggr_mode, -"aggregate counts perf processor cluster" ,AGGR_CLUSTER ), -OPT_CALLBACK_OPTARG (0 ,"per-cache" , &perf_stat.aggr_mode, &perf_stat.aggr_level, -"cache level" , -"aggregate count at this cache level (Default: LLC)" , +OPT_BOOLEAN (0 ,"per-thread" , &opt_mode.thread,"aggregate counts per thread" ), +OPT_BOOLEAN (0 ,"per-socket" , &opt_mode.socket, +"aggregate counts per processor socket" ), +OPT_BOOLEAN (0 ,"per-die" , &opt_mode.die,"aggregate counts per processor die" ), +OPT_BOOLEAN (0 ,"per-cluster" , &opt_mode.cluster, +"aggregate counts per processor cluster" ), +OPT_CALLBACK_OPTARG (0 ,"per-cache" , &opt_mode.cache, &perf_stat.aggr_level, +"cache level" ,"aggregate count at this cache level (Default: LLC)" , parse_cache_level), -OPT_SET_UINT (0 ,"per-core" , &perf_stat.aggr_mode, -"aggregate counts per physical processor core" ,AGGR_CORE ), -OPT_SET_UINT (0 ,"per-node" , &perf_stat.aggr_mode, -"aggregate counts per numa node" ,AGGR_NODE ), -OPT_SET_UINT ('A' ,"no-aggr" , &perf_stat.aggr_mode, -"disable CPU count aggregation" ,AGGR_NONE ), +OPT_BOOLEAN (0 ,"per-core" , &opt_mode.core, +"aggregate counts per physical processor core" ), +OPT_BOOLEAN (0 ,"per-node" , &opt_mode.node,"aggregate counts per numa node" ), +OPT_BOOLEAN ('A' ,"no-aggr" , &opt_mode.no_aggr, +"disable aggregation across CPUs or PMUs" ),OPT_END () };struct stat st;
@@ -2287,6 +2286,10 @@ static int __cmd_report(int argc, const char **argv) argc =parse_options (argc, argv, options, stat_report_usage,0 ); + perf_stat.aggr_mode =opt_aggr_mode_to_aggr_mode (&opt_mode); +if (perf_stat.aggr_mode ==AGGR_GLOBAL ) + perf_stat.aggr_mode =AGGR_UNSET ;/* No option found so leave unset. */ +if (!input_name || !strlen (input_name)) {if (!fstat (STDIN_FILENO , &st) &&S_ISFIFO (st.st_mode)) input_name ="-" ;
@@ -2462,7 +2465,7 @@ int cmd_stat(int argc, const char **argv)OPT_BOOLEAN (0 ,"per-die" , &opt_mode.die,"aggregate counts per processor die" ),OPT_BOOLEAN (0 ,"per-cluster" , &opt_mode.cluster,"aggregate counts per processor cluster" ), -OPT_CALLBACK_OPTARG (0 ,"per-cache" , &opt_mode, &stat_config.aggr_level, +OPT_CALLBACK_OPTARG (0 ,"per-cache" , &opt_mode.cache, &stat_config.aggr_level,"cache level" ,"aggregate count at this cache level (Default: LLC)" , parse_cache_level), OPT_BOOLEAN(0, "per-core", &opt_mode.core,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 511/957 memblock: reserve_mem: fix end caclulation in reserve_mem_release_by_name()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Rapoport (Microsoft) <[email protected]>
[ Upstream commit c12c3e1507809ad1fc0448f51c933f52e17d13cd ]
free_reserved_area() expects end parameter to point to the first address after the area, but reserve_mem_release_by_name() passes it the last address inside the area.
Remove subtraction of one in calculation of the area end.
--- mm/memblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memblock.c +1 -1
@@ -2433,7 +2433,7 @@ int reserve_mem_release_by_name(const char *name)return 0 ; start =phys_to_virt (map->start); - end = start + map->size -1 ; + end = start + map->size;snprintf (buf,sizeof (buf),"reserve_mem:%s" , name);free_reserved_area (start, end,0 , buf); map->size =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 512/957 perf tools: Fix module symbol resolution for non-zero .text sh_addr
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 9a82bfde4775b7a87cd1a7e791f46f83ae442848 ]
When perf resolves symbols from kernel module ELF files (ET_REL), it converts symbol addresses to file offsets so that sample IPs can be matched to the correct symbol. The conversion adjusts each symbol's st_value:
sym->st_value -= shdr->sh_addr - shdr->sh_offset;
For vmlinux (ET_EXEC), st_value is a virtual address and sh_addr is the section's virtual base, so subtracting sh_addr and adding sh_offset correctly yields a file offset.
For kernel modules (ET_REL), st_value is a section-relative offset. The module loader ignores sh_addr entirely and places symbols at module_base + st_value. Converting to file offset requires only adding sh_offset; subtracting sh_addr introduces an error equal to sh_addr bytes.
When .text has sh_addr == 0 -- the historical norm for simple modules -- both formulas produce the same result and the bug is latent. As modules gain more metadata sections before .text (.note, .static_call.text, etc.), the linker assigns .text a non-zero sh_addr, exposing the defect. For example, nfsd.ko on this kernel has sh_addr=0xa80, kvm-intel.ko has sh_addr=0x1e90.
The effect is that all .text symbols in affected modules shift by sh_addr bytes relative to sample IPs, causing perf report to attribute samples to incorrect, nearby symbols. This was observed as 13% of LLC-load-miss samples misattributed to nfsd_file_get_dio_attrs when the actual hot function was nfsd_cache_lookup, approximately 0xa80 bytes away in the symbol table.
Use the existing dso__rel() flag (already set for ET_REL modules) to select the correct adjustment: add sh_offset for ET_REL, subtract (sh_addr - sh_offset) for ET_EXEC/ET_DYN.
--- tools/perf/util/symbol-elf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +6 -2
@@ -1353,8 +1353,12 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map,char dso_name[PATH_MAX ];/* Adjust symbol to map to file offset */ -if (adjust_kernel_syms) - sym->st_value -= shdr->sh_addr - shdr->sh_offset; +if (adjust_kernel_syms) { +if (dso__rel (dso)) + sym->st_value += shdr->sh_offset; +else + sym->st_value -= shdr->sh_addr - shdr->sh_offset; + }if (strcmp (section_name, (dso__short_name (curr_dso) +dso__short_name_len (dso))) ==0 )return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 513/957 perf expr: Return -EINVAL for syntax error in expr__find_ids()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 3a61fd866ef9aaa1d3158b460f852b74a2df07f4 ]
expr__find_ids() propagates the parser return value directly. For syntax errors, the parser can return a positive value, but callers treat it as success, e.g., for below case on Arm64 platform:
metric expr 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES) for backend_bound parsing metric: 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES) Failure to read '#slots' literal: #slots = nan
syntax error
Convert positive parser returns in expr__find_ids() to -EINVAL, as a result, the error value will be respected by callers.
Before:
perf stat -C 5
Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Segmentation fault
After:
perf stat -C 5
Failure to read '#slots'Cannot find metric or group `Default'
--- tools/perf/util/expr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/expr.c +2 -1
@@ -376,7 +376,8 @@ int expr__find_ids(const char *expr, const char *one,if (one)expr__del_id (ctx, one); -return ret; +/* A positive value means syntax error, convert to -EINVAL */ +return ret >0 ? -EINVAL : ret; }double expr_id_data__value (const struct expr_id_data *data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 514/957 ipmi: ssif_bmc: fix missing check for copy_to_user() partial failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Zhang <[email protected]>
[ Upstream commit ea641be7a4faee4351f9c5ed6b188e1bbf5586a6 ]
copy_to_user() returns the number of bytes that could not be copied, with a non-zero value indicating a partial or complete failure. The current code only checks for negative return values and treats all non-negative results as success.
Treating any positive return value from copy_to_user() as an error and returning -EFAULT.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ssif_bmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/char/ipmi/ssif_bmc.c +2 -0
@@ -163,6 +163,8 @@ static ssize_t ssif_bmc_read(struct file *file, char __user *buf, size_t count,spin_unlock_irqrestore (&ssif_bmc->lock, flags); ret =copy_to_user (buf, &msg, count); +if (ret >0 ) + ret = -EFAULT ; }return (ret <0 ) ? ret : count;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 515/957 ipmi: ssif_bmc: fix message desynchronization after truncated response
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Zhang <[email protected]>
[ Upstream commit 1d38e849adb6851ee280aa1a1d687b2181549a66 ]
A truncated response, caused by host power-off, or other conditions, can lead to message desynchronization.
Raw trace data (STOP loss scenario, add state transition comment):
1. T-1: Read response phase (SSIF_RES_SENDING)
8271.955342 WR_RCV [03] <- Read polling cmd 8271.955348 RD_REQ [04] <== SSIF_RES_SENDING <- start sending response 8271.955436 RD_PRO [b4] 8271.955527 RD_PRO [00] 8271.955618 RD_PRO [c1] 8271.955707 RD_PRO [00] 8271.955814 RD_PRO [ad] <== SSIF_RES_SENDING <- last byte
<- !! STOP lost (truncated response)
2. T: New Write request arrives, BMC still in SSIF_RES_SENDING
8271.967973 WR_REQ [] <== SSIF_RES_SENDING >> SSIF_ABORTING <- log: unexpected WR_REQ in RES_SENDING 8271.968447 WR_RCV [02] <== SSIF_ABORTING <- do nothing 8271.968452 WR_RCV [02] <== SSIF_ABORTING <- do nothing 8271.968454 WR_RCV [18] <== SSIF_ABORTING <- do nothing 8271.968456 WR_RCV [01] <== SSIF_ABORTING <- do nothing 8271.968458 WR_RCV [66] <== SSIF_ABORTING <- do nothing 8271.978714 STOP [] <== SSIF_ABORTING >> SSIF_READY <- log: unexpected SLAVE STOP in state=SSIF_ABORTING
3. T+1: Next Read polling, treated as a fresh transaction
8271.979125 WR_REQ [] <== SSIF_READY >> SSIF_START 8271.979326 WR_RCV [03] <== SSIF_START >> SSIF_SMBUS_CMD <- smbus_cmd=0x03 8271.979331 RD_REQ [04] <== SSIF_RES_SENDING <- sending response 8271.979427 RD_PRO [b4] <- !! this is T's stale response -> desynchronization
When in SSIF_ABORTING state, a newly arrived command should still be handled to avoid dropping the request or causing message desynchronization.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ssif_bmc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/char/ipmi/ssif_bmc.c +14 -0
@@ -458,6 +458,15 @@ static bool supported_write_cmd(u8 cmd)return false; } +static bool supported_write_start_cmd (u8 cmd) +{ +if (cmd ==SSIF_IPMI_SINGLEPART_WRITE || + cmd ==SSIF_IPMI_MULTIPART_WRITE_START ) +return true; + +return false; +} +/* Process the IPMI response that will be read by master */ static void handle_read_processed (struct ssif_bmc_ctx *ssif_bmc,u8 *val) {
@@ -709,6 +718,11 @@ static void on_write_received_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) ssif_bmc->state =SSIF_ABORTING ; else ssif_bmc->state = SSIF_REQ_RECVING; + }else if (ssif_bmc->state ==SSIF_ABORTING ) { +if (supported_write_start_cmd (*val)) { + ssif_bmc->state =SSIF_SMBUS_CMD ; + ssif_bmc->aborting = false; + } }/* This is response sending state */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 516/957 ipmi: ssif_bmc: change log level to dbg in irq callback
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Zhang <[email protected]>
[ Upstream commit c9c99b7b7051eb7121b3224bfce181fb023b0269 ]
Long-running tests indicate that this logging can occasionally disrupt timing and lead to request/response corruption.
Irq handler need to be executed as fast as possible,
most I2C slave IRQ implementations are byte-level, logging here can significantly affect transfer behavior and timing. It is recommended to use dev_dbg() for these messages.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ssif_bmc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/char/ipmi/ssif_bmc.c +9 -9
@@ -569,7 +569,7 @@ static void process_request_part(struct ssif_bmc_ctx *ssif_bmc) len = ssif_bmc->request.len + part->length;/* Do the bound check here, not allow the request len exceed 254 bytes */ if (len >IPMI_SSIF_PAYLOAD_MAX ) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: Request exceeded 254 bytes, aborting" );/* Request too long, aborting */ ssif_bmc->aborting = true;
@@ -615,7 +615,7 @@ static void on_read_requested_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) ssif_bmc->state == SSIF_START || ssif_bmc->state == SSIF_REQ_RECVING || ssif_bmc->state == SSIF_RES_SENDING) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: %s unexpected READ REQUESTED in state=%s\n" , __func__,state_to_string (ssif_bmc->state)); ssif_bmc->state =SSIF_ABORTING ;
@@ -624,7 +624,7 @@ static void on_read_requested_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) }else if (ssif_bmc->state ==SSIF_SMBUS_CMD ) {if (!supported_read_cmd (ssif_bmc->part_buf.smbus_cmd)) { -dev_warn (&ssif_bmc->client->dev,"Warn: Unknown SMBus read command=0x%x" , +dev_dbg (&ssif_bmc->client->dev,"Warn: Unknown SMBus read command=0x%x" , ssif_bmc->part_buf.smbus_cmd); ssif_bmc->aborting = true; }
@@ -659,7 +659,7 @@ static void on_read_processed_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) ssif_bmc->state == SSIF_START || ssif_bmc->state == SSIF_REQ_RECVING || ssif_bmc->state == SSIF_SMBUS_CMD) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: %s unexpected READ PROCESSED in state=%s\n" , __func__,state_to_string (ssif_bmc->state)); ssif_bmc->state =SSIF_ABORTING ;
@@ -684,7 +684,7 @@ static void on_write_requested_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) }else if (ssif_bmc->state ==SSIF_START || ssif_bmc->state ==SSIF_REQ_RECVING || ssif_bmc->state ==SSIF_RES_SENDING ) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: %s unexpected WRITE REQUEST in state=%s\n" , __func__,state_to_string (ssif_bmc->state)); ssif_bmc->state =SSIF_ABORTING ;
@@ -699,7 +699,7 @@ static void on_write_received_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) {if (ssif_bmc->state ==SSIF_READY || ssif_bmc->state ==SSIF_RES_SENDING ) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: %s unexpected WRITE RECEIVED in state=%s\n" , __func__,state_to_string (ssif_bmc->state)); ssif_bmc->state =SSIF_ABORTING ;
@@ -709,7 +709,7 @@ static void on_write_received_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) }else if (ssif_bmc->state ==SSIF_SMBUS_CMD ) {if (!supported_write_cmd (ssif_bmc->part_buf.smbus_cmd)) { -dev_warn (&ssif_bmc->client->dev,"Warn: Unknown SMBus write command=0x%x" , +dev_dbg (&ssif_bmc->client->dev,"Warn: Unknown SMBus write command=0x%x" , ssif_bmc->part_buf.smbus_cmd); ssif_bmc->aborting = true; }
@@ -738,7 +738,7 @@ static void on_stop_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) ssif_bmc->state == SSIF_START || ssif_bmc->state == SSIF_SMBUS_CMD || ssif_bmc->state == SSIF_ABORTING) { -dev_warn (&ssif_bmc->client->dev, +dev_dbg (&ssif_bmc->client->dev,"Warn: %s unexpected SLAVE STOP in state=%s\n" , __func__,state_to_string (ssif_bmc->state)); ssif_bmc->state =SSIF_READY ;
@@ -805,7 +805,7 @@ static int ssif_bmc_cb(struct i2c_client *client, enum i2c_slave_event event, u8break ;default : -dev_warn (&ssif_bmc->client->dev,"Warn: Unknown i2c slave event\n" ); +dev_dbg (&ssif_bmc->client->dev,"Warn: Unknown i2c slave event\n" );break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 517/957 perf cgroup: Update metric leader in evlist__expand_cgroup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit c9ef786c0970991578397043f1c819229e2b7197 ]
When the evlist is expanded the metric leader wasn't being updated. As the original evsel is deleted this creates a use-after-free in stat-shadow's prepare_metric. This was detected running the "perf stat --bpf-counters --for-each-cgroup test" with sanitizers.
The change itself puts the copied evsel into the priv field (known unused because of evsel__clone use) and then in a second pass over the list updates the copied values using the priv pointer.
--- tools/perf/util/cgroup.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
tools/perf/util/cgroup.c +23 -7
@@ -416,7 +416,6 @@ static bool has_pattern_string(const char *str)int evlist__expand_cgroup (struct evlist *evlist,const char *str,bool open_cgroup) {struct evlist *orig_list, *tmp_list; -struct evsel *pos, *evsel, *leader;struct rblist orig_metric_events;struct cgroup *cgrp =NULL ;struct cgroup_name *cn;
@@ -451,6 +450,7 @@ int evlist__expand_cgroup(struct evlist *evlist, const char *str, bool open_cgro goto out_err;list_for_each_entry (cn, &cgroup_list, list) { +struct evsel *pos;char *name;if (!cn->used)
@@ -466,21 +466,37 @@ int evlist__expand_cgroup(struct evlist *evlist, const char *str, bool open_cgroif (cgrp ==NULL )continue ; - leader =NULL ; +/* copy the list and set to the new cgroup. */ evlist__for_each_entry (orig_list, pos) { - evsel =evsel__clone (/*dest=*/ NULL , pos); +struct evsel *evsel =evsel__clone (/*dest=*/ NULL , pos); +if (evsel ==NULL ) goto out_err; +/* stash the copy during the copying. */ + pos->priv = evsel;cgroup__put (evsel->cgrp); evsel->cgrp =cgroup__get (cgrp); -if (evsel__is_group_leader (pos)) - leader = evsel; -evsel__set_leader (evsel, leader); -evlist__add (tmp_list, evsel); } +/* update leader information using stashed pointer to copy. */ +evlist__for_each_entry (orig_list, pos) { +struct evsel *evsel = pos->priv; + +if (evsel__leader (pos)) +evsel__set_leader (evsel,evsel__leader (pos)->priv); + +if (pos->metric_leader) + evsel->metric_leader = pos->metric_leader->priv; + +if (pos->first_wildcard_match) + evsel->first_wildcard_match = pos->first_wildcard_match->priv; + } +/* the stashed copy is no longer used. */ +evlist__for_each_entry (orig_list, pos) + pos->priv =NULL ; +/* cgroup__new() has a refcount, release it here */ cgroup__put (cgrp); nr_cgroups++;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 518/957 pinctrl: sophgo: pinctrl-sg2042: Fix wrong module description
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit ca1c2ddff00480c213903a1479b56203536e92de ]
Fix the SoC model in module description string, it should be sg2042 instead of sg2002.
--- drivers/pinctrl/sophgo/pinctrl-sg2042.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sophgo/pinctrl-sg2042.c +1 -1
@@ -651,5 +651,5 @@ static struct platform_driver sg2042_pinctrl_driver = { };module_platform_driver (sg2042_pinctrl_driver); -MODULE_DESCRIPTION ("Pinctrl driver for the SG2002 series SoC" ); +MODULE_DESCRIPTION ("Pinctrl driver for the SG2042 series SoC" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 519/957 pinctrl: sophgo: pinctrl-sg2044: Fix wrong module description
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit 7648112358a4207916d3e38bfee49f85552fe95f ]
Fix the SoC model in module description string, it should be sg2044 instead of sg2002.
--- drivers/pinctrl/sophgo/pinctrl-sg2044.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sophgo/pinctrl-sg2044.c +1 -1
@@ -714,5 +714,5 @@ static struct platform_driver sg2044_pinctrl_driver = { };module_platform_driver (sg2044_pinctrl_driver); -MODULE_DESCRIPTION ("Pinctrl driver for the SG2002 series SoC" ); +MODULE_DESCRIPTION ("Pinctrl driver for the SG2044 series SoC" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 520/957 perf maps: Fix fixup_overlap_and_insert that can break sorted by name order
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit c4f3ff3289380437d26177e8f2fe4b7507816ee3 ]
When an entry in the address array is replaced, the corresponding name entry is replaced. The entries names may sort differently and so it is important that the sorted by name property be cleared on the maps.
--- tools/perf/util/maps.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/maps.c +2 -0
@@ -924,6 +924,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)if (maps_by_name) {map__put (maps_by_name[ni]); maps_by_name[ni] =map__get (new); +maps__set_maps_by_name_sorted (maps, false); } err =__maps__insert_sorted (maps, i +1 , after,NULL );
@@ -949,6 +950,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)if (maps_by_name) {map__put (maps_by_name[ni]); maps_by_name[ni] =map__get (new); +maps__set_maps_by_name_sorted (maps, false); }check_invariants (maps);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 521/957 perf maps: Fix copy_from that can break sorted by name order
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit f552b132e4d5248715828e7e5c2bf7889bf05b2e ]
When an parent is copied into a child the name array is populated in address not name order. Make sure the name array isn't flagged as sorted.
--- tools/perf/util/maps.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
tools/perf/util/maps.c +3 -10
@@ -1032,16 +1032,9 @@ int maps__copy_from(struct maps *dest, struct maps *parent)map__put (new); }maps__set_maps_by_address_sorted (dest,maps__maps_by_address_sorted (parent)); -if (!err) { -RC_CHK_ACCESS (dest)->last_search_by_name_idx = -RC_CHK_ACCESS (parent)->last_search_by_name_idx; -maps__set_maps_by_name_sorted (dest, - dest_maps_by_name && -maps__maps_by_name_sorted (parent)); - }else { -RC_CHK_ACCESS (dest)->last_search_by_name_idx =0 ; -maps__set_maps_by_name_sorted (dest, false); - } +RC_CHK_ACCESS (dest)->last_search_by_name_idx =0 ; +/* Values were copied into the name array in address order. */ +maps__set_maps_by_name_sorted (dest, false); }else {/* Unexpected copying to a maps containing entries. */ for (unsigned int i =0 ; !err && i < n; i++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 522/957 perf util: Kill die() prototype, dead for a long time
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit e5cce1b9c82fbd48e2f1f7a25a9fad8ee228176f ]
In fef2a735167a827a ("perf tools: Kill die()") the die() function was removed, but not the prototype in util.h, now when building with LIBPERL=1, during a 'make -C tools/perf build-test' routine test, it is failing as perl likes die() calls and then this clashes with this remnant, remove it.
--- tools/perf/util/util.h | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/util.h +0 -1
@@ -29,7 +29,6 @@ extern bool perf_guest;/* General helper functions */ void usage (const char *err)__noreturn ; -void die(const char *err, ...) __noreturn __printf(1, 2);struct dirent ;struct strlist ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 523/957 i3c: master: dw-i3c: Fix missing reset assertion in remove() callback
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit bef1eef667186cedb0bc6d152464acb3c97d5f72 ]
The reset line acquired during probe is currently left deasserted when the driver is unbound.
Switch to devm_reset_control_get_optional_exclusive_deasserted() to ensure the reset is automatically re-asserted by the devres core when the driver is removed.
--- drivers/i3c/master/dw-i3c-master.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/i3c/master/dw-i3c-master.c +3 -8
@@ -1554,13 +1554,11 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,if (IS_ERR (master->pclk))return PTR_ERR (master->pclk); - master->core_rst =devm_reset_control_get_optional_exclusive (&pdev->dev, -"core_rst" ); + master->core_rst =devm_reset_control_get_optional_exclusive_deasserted (&pdev->dev, +"core_rst" );if (IS_ERR (master->core_rst))return PTR_ERR (master->core_rst); -reset_control_deassert (master->core_rst); -spin_lock_init (&master->xferqueue.lock);INIT_LIST_HEAD (&master->xferqueue.list);
@@ -1572,7 +1570,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master, dw_i3c_master_irq_handler,0 , dev_name(&pdev->dev), master);if (ret) - goto err_assert_rst; +return ret;platform_set_drvdata (pdev, master);
@@ -1610,9 +1608,6 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,pm_runtime_set_suspended (&pdev->dev);pm_runtime_dont_use_autosuspend (&pdev->dev); -err_assert_rst: -reset_control_assert (master->core_rst); -return ret; }EXPORT_SYMBOL_GPL (dw_i3c_common_probe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 524/957 i3c: master: renesas: Fix memory leak in renesas_i3c_i3c_xfers()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit d7665c3b4f575251e449e2656879392346ca612b ]
The xfer structure allocated by renesas_i3c_alloc_xfer() was never freed in the renesas_i3c_i3c_xfers() function. Use the __free(kfree) cleanup attribute to automatically free the memory when the variable goes out of scope.
--- drivers/i3c/master/renesas-i3c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i3c/master/renesas-i3c.c +2 -2
@@ -8,6 +8,7 @@#include <linux/bitfield.h> #include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/completion.h> #include <linux/err.h>
@@ -800,13 +801,12 @@ static int renesas_i3c_priv_xfers(struct i3c_dev_desc *dev, struct i3c_priv_xferstruct i3c_master_controller *m =i3c_dev_get_master (dev);struct renesas_i3c *i3c =to_renesas_i3c (m);struct renesas_i3c_i2c_dev_data *data =i3c_dev_get_master_data (dev); -struct renesas_i3c_xfer *xfer;int i;/* Enable I3C bus. */ renesas_i3c_bus_enable (m, true); - xfer =renesas_i3c_alloc_xfer (i3c,1 ); + struct renesas_i3c_xfer *xfer __free(kfree) = renesas_i3c_alloc_xfer(i3c, 1);if (!xfer)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 525/957 i3c: dw: Fix memory leak in dw_i3c_master_i3c_xfers()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 256cc1f1305a8e5dcadf8ca208d04a3acadd26f1 ]
The dw_i3c_master_i3c_xfers() function allocates memory for the xfer structure using dw_i3c_master_alloc_xfer(). If pm_runtime_resume_and_get() fails, the function returns without freeing the allocated xfer, resulting in a memory leak.
Since dw_i3c_master_free_xfer() is a thin wrapper around kfree(), use the __free(kfree) cleanup attribute to handle the free automatically on all exit paths.
--- drivers/i3c/master/dw-i3c-master.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/i3c/master/dw-i3c-master.c +2 -3
@@ -6,6 +6,7 @@*/ #include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/completion.h> #include <linux/err.h>
@@ -905,7 +906,6 @@ static int dw_i3c_master_priv_xfers(struct i3c_dev_desc *dev,struct i3c_master_controller *m =i3c_dev_get_master (dev);struct dw_i3c_master *master =to_dw_i3c_master (m);unsigned int nrxwords =0 , ntxwords =0 ; -struct dw_i3c_xfer *xfer;int i, ret =0 ;if (!i3c_nxfers)
@@ -925,7 +925,7 @@ static int dw_i3c_master_priv_xfers(struct i3c_dev_desc *dev, nrxwords > master->caps.datafifodepth)return -EOPNOTSUPP ; - xfer =dw_i3c_master_alloc_xfer (master, i3c_nxfers); + struct dw_i3c_xfer *xfer __free(kfree) = dw_i3c_master_alloc_xfer(master, i3c_nxfers);if (!xfer)return -ENOMEM ;
@@ -976,7 +976,6 @@ static int dw_i3c_master_priv_xfers(struct i3c_dev_desc *dev, } ret = xfer->ret; -dw_i3c_master_free_xfer (xfer);pm_runtime_put_autosuspend (master->dev);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 526/957 i3c: master: Fix error codes at send_ccc_cmd
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jorge Marques <[email protected]>
[ Upstream commit ef8b5229348f0719aca557c4ca5530630ae4d134 ]
i3c_master_send_ccc_cmd_locked() would propagate cmd->err (positive, Mx codes) to the ret variable, cascading down multiple methods until reaching methods that explicitly stated they would return 0 on success or negative error code. For example, the call chain:
i3c_device_enable_ibi <- i3c_dev_enable_ibi_locked <- master->ops.enable_ibi <- i3c_master_enec_locked <- i3c_master_enec_disec_locked <- i3c_master_send_ccc_cmd_locked
Fix this by returning the ret value, callers can still read the cmd->err value if ret is negative.
All corner cases where the Mx codes do need to be handled individually, are resolved in previous commits. Those corner cases are all scenarios when I3C_ERROR_M2 is expected and acceptable.
The prerequisite patches for the fix are:
i3c: master: Move rstdaa error suppression
i3c: master: Move entdaa error suppression
i3c: master: Move bus_init error suppression
--- drivers/i3c/master.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
drivers/i3c/master.c +13 -19
@@ -826,11 +826,17 @@ static void i3c_ccc_cmd_init(struct i3c_ccc_cmd *cmd, bool rnw, u8 id, cmd->err =I3C_ERROR_UNKNOWN ; } +/** +* i3c_master_send_ccc_cmd_locked() - send a CCC (Common Command Codes) +* @master: master used to send frames on the bus +* @cmd: command to send +* +* Return: 0 in case of success, or a negative error code otherwise. +* I3C Mx error codes are stored in cmd->err. +*/ static int i3c_master_send_ccc_cmd_locked (struct i3c_master_controller *master,struct i3c_ccc_cmd *cmd) { -int ret; -if (!cmd || !master)return -EINVAL ;
@@ -848,15 +854,7 @@ static int i3c_master_send_ccc_cmd_locked(struct i3c_master_controller *master, !master->ops->supports_ccc_cmd(master, cmd)) return -EOPNOTSUPP; - ret = master->ops->send_ccc_cmd (master, cmd); -if (ret) { -if (cmd->err !=I3C_ERROR_UNKNOWN ) -return cmd->err; - -return ret; - } - -return 0 ; +return master->ops->send_ccc_cmd (master, cmd); } static struct i2c_dev_desc *
@@ -960,8 +958,7 @@ static int i3c_master_rstdaa_locked(struct i3c_master_controller *master,* * This function must be called with the bus lock held in write mode. * -* Return: 0 in case of success, a positive I3C error code if the error is -* one of the official Mx error codes, and a negative error code otherwise. +* Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_entdaa_locked (struct i3c_master_controller *master) {
@@ -1013,8 +1010,7 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,* * This function must be called with the bus lock held in write mode. * -* Return: 0 in case of success, a positive I3C error code if the error is -* one of the official Mx error codes, and a negative error code otherwise. +* Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_disec_locked (struct i3c_master_controller *master,u8 addr,u8 evts)
@@ -1034,8 +1030,7 @@ EXPORT_SYMBOL_GPL(i3c_master_disec_locked);* * This function must be called with the bus lock held in write mode. * -* Return: 0 in case of success, a positive I3C error code if the error is -* one of the official Mx error codes, and a negative error code otherwise. +* Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_enec_locked (struct i3c_master_controller *master,u8 addr,u8 evts)
@@ -1060,8 +1055,7 @@ EXPORT_SYMBOL_GPL(i3c_master_enec_locked);* * This function must be called with the bus lock held in write mode. * -* Return: 0 in case of success, a positive I3C error code if the error is -* one of the official Mx error codes, and a negative error code otherwise. +* Return: 0 in case of success, or a negative error code otherwise. */ int i3c_master_defslvs_locked (struct i3c_master_controller *master) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 527/957 i3c: master: adi: Fix error propagation for CCCs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jorge Marques <[email protected]>
[ Upstream commit 0b73da96b6eb6b9354654f96a9d423ab22cb222d ]
adi_i3c_master_send_ccc_cmd() always returned 0, ignoring the transfer result populated in the completion path. As a consequence, CCC command errors were silently dropped, including the default -ETIMEDOUT and later overwritten by adi_i3c_master_end_xfer_locked().
Fix this by returning xfer->ret so that callers correctly receive any transfer error codes.
--- drivers/i3c/master/adi-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/adi-i3c-master.c +1 -1
@@ -362,7 +362,7 @@ static int adi_i3c_master_send_ccc_cmd(struct i3c_master_controller *m, cmd->err =adi_i3c_cmd_get_err (&xfer->cmds[0 ]); -return 0 ; +return xfer->ret; } static int adi_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 528/957 i3c: mipi-i3c-hci: fix IBI payload length calculation for final status
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <[email protected]>
[ Upstream commit d35a6db887eeae7c57b719521e39d64f929c6dc3 ]
In DMA mode, the IBI status descriptor encodes the payload using CHUNKS (number of chunks) and DATA_LENGTH (valid bytes in the last chunk). All preceding chunks are implicitly full-sized.
The current code accumulates full chunk sizes for non-final status descriptors, but for the final status descriptor it only adds DATA_LENGTH. This ignores the contribution of the preceding full chunks described by the same final status entry.
As a result, the computed IBI payload length is truncated whenever the final status spans multiple chunks. For example, with a chunk size of 4 bytes, CHUNKS=2 and DATA_LENGTH=1 should result in a total payload size of 5 bytes, but the current code reports only 1 byte.
Fix the calculation by adding the size of (CHUNKS - 1) full chunks plus DATA_LENGTH for the last chunk.
--- drivers/i3c/master/mipi-i3c-hci/dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i3c/master/mipi-i3c-hci/dma.c +4 -1
@@ -683,7 +683,10 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)if (!(ibi_status &IBI_LAST_STATUS )) { ibi_size += chunks * rh->ibi_chunk_sz; }else { - ibi_size +=FIELD_GET (IBI_DATA_LENGTH , ibi_status); +if (chunks) { + ibi_size += (chunks -1 ) * rh->ibi_chunk_sz; + ibi_size +=FIELD_GET (IBI_DATA_LENGTH , ibi_status); + } last_ptr = ptr;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 529/957 backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 797cc011ae02bda26f93d25a4442d7a1a77d84df ]
The devm_gpiod_get_optional() function may return an ERR_PTR in case of genuine GPIO acquisition errors, not just NULL which indicates the legitimate absence of an optional GPIO.
Add an IS_ERR() check after the call in sky81452_bl_parse_dt(). On error, return the error code to ensure proper failure handling rather than proceeding with invalid pointers.
--- drivers/video/backlight/sky81452-backlight.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/backlight/sky81452-backlight.c +3 -0
@@ -202,6 +202,9 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( pdata->dpwm_mode =of_property_read_bool (np,"skyworks,dpwm-mode" ); pdata->phase_shift =of_property_read_bool (np,"skyworks,phase-shift" ); pdata->gpiod_enable =devm_gpiod_get_optional (dev,NULL ,GPIOD_OUT_HIGH ); +if (IS_ERR (pdata->gpiod_enable)) +return dev_err_cast_probe (dev, pdata->gpiod_enable, +"failed to get gpio\n" ); ret =of_property_count_u32_elems (np,"led-sources" );if (ret <0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 530/957 platform/surface: surfacepro3_button: Drop wakeup source on remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 1410a228ab2d36fe2b383415a632ae12048d4f3a ]
The wakeup source added by device_init_wakeup() in surface_button_add() needs to be dropped during driver removal, so update the driver to do that.
--- drivers/platform/surface/surfacepro3_button.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/surface/surfacepro3_button.c +1 -0
@@ -243,6 +243,7 @@ static void surface_button_remove(struct acpi_device *device) {struct surface_button *button =acpi_driver_data (device); +device_init_wakeup (&device->dev, false);input_unregister_device (button->input);kfree (button); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 531/957 leds: lgm-sso: Remove duplicate assignments for priv->mmap
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 7186d0330c3f3e86de577687a82f4ebd96dcb5ac ]
Remove duplicate assignment of priv->mmap in intel_sso_led_probe().
--- drivers/leds/blink/leds-lgm-sso.c | 2 -- 1 file changed, 2 deletions(-)
drivers/leds/blink/leds-lgm-sso.c +0 -2
@@ -808,8 +808,6 @@ static int intel_sso_led_probe(struct platform_device *pdev) priv->fpid_clkrate =clk_get_rate (priv->clocks[1 ].clk); - priv->mmap =syscon_node_to_regmap (dev->of_node); - priv->mmap =syscon_node_to_regmap (dev->of_node);if (IS_ERR (priv->mmap)) {dev_err (dev,"Failed to map iomem!\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 532/957 usb: typec: Fix error pointer dereference
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ethan Tidmore <[email protected]>
[ Upstream commit f2529d08fcb429ea01bb87c326342f41483f8b2f ]
The variable tps->partner is checked for an error pointer and then if it is, it sends an error message but does not return and then immediately dereferenced a few lines below:
tps->partner = typec_register_partner(tps->port, &desc); if (IS_ERR(tps->partner))
dev_warn(tps->dev, "%s: failed to register partnet\n", __func__);
if (desc.identity) {
typec_partner_set_identity(tps->partner);
cd321x->cur_partner_identity = st.partner_identity;
}Add early return and fix spelling mistake in error message.
Detected by Smatch:drivers/usb/typec/tipd/core.c:827 cd321x_update_work() error:
'tps->partner' dereferencing possible ERR_PTR()
--- drivers/usb/typec/tipd/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/typec/tipd/core.c +4 -2
@@ -814,8 +814,10 @@ static void cd321x_update_work(struct work_struct *work) desc.identity = &st.partner_identity; tps->partner =typec_register_partner (tps->port, &desc); -if (IS_ERR (tps->partner)) -dev_warn (tps->dev,"%s: failed to register partnet\n" , __func__); +if (IS_ERR (tps->partner)) { +dev_warn (tps->dev,"%s: failed to register partner\n" , __func__); +return ; + }if (desc.identity) {typec_partner_set_identity (tps->partner);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 533/957 tty: hvc_iucv: fix off-by-one in number of supported devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit f2a880e802ad12d1e38039d1334fb1475d0f5241 ]
MAX_HVC_IUCV_LINES == HVC_ALLOC_TTY_ADAPTERS == 8.
This is the number of entries in:
static struct hvc_iucv_private *hvc_iucv_table[MAX_HVC_IUCV_LINES];
Sometimes hvc_iucv_table[] is limited by:
(a) if (num > hvc_iucv_devices) // for error detection
or
(b) for (i = 0; i < hvc_iucv_devices; i++) // in 2 places
(so these 2 don't agree; second one appears to be correct to me.)
hvc_iucv_devices can be 0..8. This is a counter.
(c) if (hvc_iucv_devices > MAX_HVC_IUCV_LINES)
If hvc_iucv_devices == 8, (a) allows the code to access hvc_iucv_table[8]. Oops.
--- drivers/tty/hvc/hvc_iucv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/hvc/hvc_iucv.c +1 -1
@@ -131,7 +131,7 @@ static struct iucv_handler hvc_iucv_handler = {*/ static struct hvc_iucv_private *hvc_iucv_get_private (uint32_t num) { -if (num > hvc_iucv_devices) +if (num >= hvc_iucv_devices)return NULL ;return hvc_iucv_table[num]; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 534/957 usb: typec: ps883x: Fix Oops at unbind
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <[email protected]>
[ Upstream commit 381133848a033c2086cf9cafb226f425bd0414ff ]
When trying to unbind a device in order to bind to it vfio-platform as:
echo bc0000.geniqup > /sys/bus/platform/devices/bc0000.geniqup/driver/unbind
I get the following Oops:
[ 436.478639] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 [ 436.487762] Mem abort info: [ 436.490716] ESR = 0x0000000096000004 [ 436.494595] EC = 0x25: DABT (current EL), IL = 32 bits [ 436.500071] SET = 0, FnV = 0 [ 436.503250] EA = 0, S1PTW = 0 [ 436.506505] FSC = 0x04: level 0 translation fault [ 436.511533] Data abort info: [ 436.514558] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 [ 436.520215] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 436.525436] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 436.530918] user pgtable: 4k pages, 48-bit VAs, pgdp=00000008861a9000 [ 436.537554] [0000000000000020] pgd=0000000000000000, p4d=0000000000000000 [ 436.544548] Internal error: Oops: 0000000096000004 [#1] SMP [ 436.550374] Modules linked in: [ 436.553542] CPU: 2 UID: 0 PID: 671 Comm: bash Tainted: G W 7.0.0-rc3-g56fcdd0911a5-dirty #2 PREEMPT [ 436.564440] Tainted: [W]=WARN [ 436.567515] Hardware name: LENOVO 91B6CTO1WW/3796, BIOS O6NKT3BA 05/02/2025 [ 436.574675] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 436.581841] pc : ps883x_retimer_remove+0x14/0x94 [ 436.586605] lr : i2c_device_remove+0x28/0x84 [ 436.591017] sp : ffff8000847137c0
That's because the ps883x_retimer_remove() retrieves the driver data from i2c_get_clientdata() which was never set at probe. So, add i2c_set_clientdata() at the end of the probe.
--- drivers/usb/typec/mux/ps883x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/mux/ps883x.c +1 -0
@@ -411,6 +411,7 @@ static int ps883x_retimer_probe(struct i2c_client *client) goto err_switch_unregister; } +i2c_set_clientdata (client, retimer);return 0 ; err_switch_unregister:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 535/957 platform/x86: panasonic-laptop: Fix OPTD notifier registration and cleanup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 8baeff2c1d33dad8572216c6ad3a7425852507d4 ]
An ACPI notify handler is leaked if device_create_file() returns an error in acpi_pcc_hotkey_add().
Also, it is pointless to call pcc_unregister_optd_notifier() in acpi_pcc_hotkey_remove() if pcc->platform is NULL and it is better to arrange the cleanup code in that function in the same order as the rollback code in acpi_pcc_hotkey_add().
Address the above by placing the pcc_register_optd_notifier() call in acpi_pcc_hotkey_add() after the device_create_file() return value check and placing the pcc_unregister_optd_notifier() call in acpi_pcc_hotkey_remove() right before the device_remove_file() call.
--- drivers/platform/x86/panasonic-laptop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/panasonic-laptop.c +3 -2
@@ -1093,9 +1093,10 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) } result =device_create_file (&pcc->platform->dev, &dev_attr_cdpower); -pcc_register_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );if (result) goto out_platform; + +pcc_register_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" ); }else { pcc->platform =NULL ; }
@@ -1129,10 +1130,10 @@ static void acpi_pcc_hotkey_remove(struct acpi_device *device)i8042_remove_filter (panasonic_i8042_filter);if (pcc->platform) { +pcc_unregister_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );device_remove_file (&pcc->platform->dev, &dev_attr_cdpower);platform_device_unregister (pcc->platform); } -pcc_unregister_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );sysfs_remove_group (&device->dev.kobj, &pcc_attr_group);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 536/957 platform/x86: barco-p50-gpio: normalize return value of gpio_get
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit 1c9d30d37aaffe3454d70b89a77f8aaecda257bf ]
The GPIO get callback is expected to return 0 or 1 (or a negative error code). Ensure that the value returned by p50_gpio_get() is normalized to the [0, 1] range.
--- drivers/platform/x86/barco-p50-gpio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/barco-p50-gpio.c +4 -1
@@ -275,8 +275,11 @@ static int p50_gpio_get(struct gpio_chip *gc, unsigned int offset)mutex_lock (&p50->lock); ret =p50_send_mbox_cmd (p50,P50_MBOX_CMD_READ_GPIO , gpio_params[offset],0 ); -if (ret ==0 ) +if (ret ==0 ) { ret =p50_read_mbox_reg (p50,P50_MBOX_REG_DATA ); +if (ret >=0 ) + ret = !!ret; + }mutex_unlock (&p50->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 537/957 mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit a5a65a7fb2f7796bbe492cd6be59c92cb64377d1 ]
The memory allocated for cell.name using kmemdup() is not freed when mfd_add_devices() fails. Fix that by using devm_kmemdup().
--- drivers/mfd/mc13xxx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +1 -1
@@ -377,7 +377,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,if (snprintf (buf,sizeof (buf), format, name) >sizeof (buf))return -E2BIG ; - cell.name =kmemdup (buf,strlen (buf) +1 ,GFP_KERNEL ); + cell.name =devm_kmemdup (mc13xxx->dev, buf,strlen (buf) +1 ,GFP_KERNEL );if (!cell.name)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 538/957 nfs/blocklayout: Fix compilation error (`make W=1`) in bl_write_pagelist()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit f83c8dda456ce4863f346aa26d88efa276eda35d ]
Clang compiler is not happy about set but unused variable (when dprintk() is no-op):
.../blocklayout/blocklayout.c:384:9: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
Remove a leftover from the previous cleanup.
--- fs/nfs/blocklayout/blocklayout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfs/blocklayout/blocklayout.c +1 -3
@@ -381,14 +381,13 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync)sector_t isect, extent_length =0 ;struct parallel_io *par =NULL ;loff_t offset = header->args.offset; -size_t count = header->args.count;struct page **pages = header->args.pages;int pg_index = header->args.pgbase >>PAGE_SHIFT ;unsigned int pg_len;struct blk_plug plug;int i; -dprintk ("%s enter, %zu@%lld\n" , __func__, count, offset); +dprintk ("%s enter, %u@%lld\n" , __func__, header->args.count, offset);/* At this point, header->page_aray is a (sequential) list of nfs_pages. * We want to write each, and if there is an error set pnfs_error
@@ -429,7 +428,6 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync) } offset += pg_len; - count -= pg_len; isect += (pg_len >>SECTOR_SHIFT ); extent_length -= (pg_len >>SECTOR_SHIFT ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 539/957 NFSD: fix nfs4_file access extra count in nfsd4_add_rdaccess_to_wrdeleg
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
[ Upstream commit b48f44f36e6607b2f818560f19deb86b4a9c717b ]
In nfsd4_add_rdaccess_to_wrdeleg, if fp->fi_fds[O_RDONLY] is already set by another thread, __nfs4_file_get_access should not be called to increment the nfs4_file access count since that was already done by the thread that added READ access to the file. The extra fi_access count in nfs4_file can prevent the corresponding nfsd_file from being freed.
When stopping nfs-server service, these extra access counts trigger a BUG in kmem_cache_destroy() that shows nfsd_file object remaining on __kmem_cache_shutdown.
This problem can be reproduced by running the Git project's test suite over NFS.
--- fs/nfsd/nfs4state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +2 -2
@@ -6255,12 +6255,12 @@ nfsd4_add_rdaccess_to_wrdeleg(struct svc_rqst *rqstp, struct nfsd4_open *open,return (false); fp = stp->st_stid.sc_file;spin_lock (&fp->fi_lock); -__nfs4_file_get_access (fp,NFS4_SHARE_ACCESS_READ );if (!fp->fi_fds[O_RDONLY ]) { +__nfs4_file_get_access (fp,NFS4_SHARE_ACCESS_READ ); fp->fi_fds[O_RDONLY ] = nf; + fp->fi_rdeleg_file =nfsd_file_get (fp->fi_fds[O_RDONLY ]); nf =NULL ; } - fp->fi_rdeleg_file =nfsd_file_get (fp->fi_fds[O_RDONLY ]);spin_unlock (&fp->fi_lock);if (nf)nfsd_file_put (nf);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 540/957 platform/x86: asus-wmi: adjust screenpad power/brightness handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Benato <[email protected]>
[ Upstream commit 130d29c5627cd50e786e926ad7ef66322c5a0c09 ]
Fix illogical screen off control by hardcoding 0 and 1 depending on the requested brightness and also do not rely on the last screenpad power state to issue screen brightness commands.
--- drivers/platform/x86/asus-wmi.c | 34 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 21 deletions(-)
drivers/platform/x86/asus-wmi.c +13 -21
@@ -4154,32 +4154,24 @@ static int read_screenpad_brightness(struct backlight_device *bd)static int update_screenpad_bl_status (struct backlight_device *bd) { -struct asus_wmi *asus =bl_get_data (bd); -int power, err =0 ; -u32 ctrl_param; +u32 ctrl_param = bd->props.brightness; +int err =0 ; - power =read_screenpad_backlight_power (asus); -if (power <0 ) -return power; +if (bd->props.power) { + err =asus_wmi_set_devstate (ASUS_WMI_DEVID_SCREENPAD_POWER ,1 ,NULL ); +if (err <0 ) +return err; -if (bd->props.power != power) { -if (power !=BACKLIGHT_POWER_ON ) { -/* Only brightness > 0 can power it back on */ - ctrl_param = asus->driver->screenpad_brightness -ASUS_SCREENPAD_BRIGHT_MIN ; - err =asus_wmi_set_devstate (ASUS_WMI_DEVID_SCREENPAD_LIGHT , - ctrl_param,NULL ); - }else { - err =asus_wmi_set_devstate (ASUS_WMI_DEVID_SCREENPAD_POWER ,0 ,NULL ); - } - }else if (power ==BACKLIGHT_POWER_ON ) { -/* Only set brightness if powered on or we get invalid/unsync state */ - ctrl_param = bd->props.brightness +ASUS_SCREENPAD_BRIGHT_MIN ; err =asus_wmi_set_devstate (ASUS_WMI_DEVID_SCREENPAD_LIGHT , ctrl_param,NULL ); +if (err <0 ) +return err; } -/* Ensure brightness is stored to turn back on with */ -if (err ==0 ) - asus->driver->screenpad_brightness = bd->props.brightness +ASUS_SCREENPAD_BRIGHT_MIN ; +if (!bd->props.power) { + err =asus_wmi_set_devstate (ASUS_WMI_DEVID_SCREENPAD_POWER ,0 ,NULL ); +if (err <0 ) +return err; + }return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 541/957 platform/x86: asus-wmi: fix screenpad brightness range
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Benato <[email protected]>
[ Upstream commit 8d95d1f4aa5c76202b0833a70998769384612488 ]
Fix screenpad brightness range being too limited without reason:
testing this patch on a Zenbook Duo showed the hardware minimum not being too low, therefore allow the user to configure the entire range, and expose to userspace the hardware brightness range and value.
--- drivers/platform/x86/asus-wmi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/platform/x86/asus-wmi.c +6 -10
@@ -127,7 +127,6 @@ module_param(fnlock_default, bool, 0444);#define NVIDIA_TEMP_MIN 75#define NVIDIA_TEMP_MAX 87 -#define ASUS_SCREENPAD_BRIGHT_MIN 20#define ASUS_SCREENPAD_BRIGHT_MAX 255#define ASUS_SCREENPAD_BRIGHT_DEFAULT 60
@@ -4143,13 +4142,13 @@ static int read_screenpad_brightness(struct backlight_device *bd)return err;/* The device brightness can only be read if powered, so return stored */ if (err ==BACKLIGHT_POWER_OFF ) -return asus->driver->screenpad_brightness -ASUS_SCREENPAD_BRIGHT_MIN ; +return bd->props.brightness; err =asus_wmi_get_devstate (asus,ASUS_WMI_DEVID_SCREENPAD_LIGHT , &retval);if (err <0 )return err; -return (retval &ASUS_WMI_DSTS_BRIGHTNESS_MASK ) -ASUS_SCREENPAD_BRIGHT_MIN ; +return retval &ASUS_WMI_DSTS_BRIGHTNESS_MASK ; }static int update_screenpad_bl_status (struct backlight_device *bd)
@@ -4189,22 +4188,19 @@ static int asus_screenpad_init(struct asus_wmi *asus)int err, power;int brightness =0 ; - power =read_screenpad_backlight_power (asus); + power =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_SCREENPAD_POWER );if (power <0 )return power; -if (power !=BACKLIGHT_POWER_OFF ) { +if (power) { err =asus_wmi_get_devstate (asus,ASUS_WMI_DEVID_SCREENPAD_LIGHT , &brightness);if (err <0 )return err; } -/* default to an acceptable min brightness on boot if too low */ -if (brightness <ASUS_SCREENPAD_BRIGHT_MIN ) - brightness =ASUS_SCREENPAD_BRIGHT_DEFAULT ;memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ;/* ensure this bd is last to be picked */ - props.max_brightness =ASUS_SCREENPAD_BRIGHT_MAX -ASUS_SCREENPAD_BRIGHT_MIN ; + props.max_brightness =ASUS_SCREENPAD_BRIGHT_MAX ; bd =backlight_device_register ("asus_screenpad" , &asus->platform_device->dev, asus, &asus_screenpad_bl_ops, &props);
@@ -4215,7 +4211,7 @@ static int asus_screenpad_init(struct asus_wmi *asus) asus->screenpad_backlight_device = bd; asus->driver->screenpad_brightness = brightness; - bd->props.brightness = brightness -ASUS_SCREENPAD_BRIGHT_MIN ; + bd->props.brightness = brightness; bd->props.power = power;backlight_update_status (bd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 542/957 tty: serial: ip22zilog: Fix section mispatch warning
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bogendoerfer <[email protected]>
[ Upstream commit a1a81aef99e853dec84241d701fbf587d713eb5b ]
ip22zilog_prepare() is now called by driver probe routine, so it shouldn't be in the __init section any longer.
--- drivers/tty/serial/ip22zilog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/ip22zilog.c +1 -1
@@ -1025,7 +1025,7 @@ static struct uart_driver ip22zilog_reg = {#endif }; -static void __init ip22zilog_prepare (struct uart_ip22zilog_port *up) +static void ip22zilog_prepare (struct uart_ip22zilog_port *up) {unsigned char sysrq_on =IS_ENABLED (CONFIG_SERIAL_IP22_ZILOG_CONSOLE );int brg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 543/957 fs/ntfs3: terminate the cached volume label after UTF-8 conversion
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a6cd43fe9b083fa23fe1595666d5738856cb261a ]
ntfs_fill_super() loads the on-disk volume label with utf16s_to_utf8s() and stores the result in sbi->volume.label. The converted label is later exposed through ntfs3_label_show() using %s, but utf16s_to_utf8s() only returns the number of bytes written and does not add a trailing NUL.
If the converted label fills the entire fixed buffer, ntfs3_label_show() can read past the end of sbi->volume.label while looking for a terminator.
Terminate the cached label explicitly after a successful conversion and clamp the exact-full case to the last byte of the buffer.
--- fs/ntfs3/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ntfs3/super.c +6 -1
@@ -1277,8 +1277,13 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)le32_to_cpu (attr->res.data_size) >>1 ,UTF16_LITTLE_ENDIAN , sbi->volume.label, sizeof(sbi->volume.label)); -if (err <0 ) +if (err <0 ) { sbi->volume.label[0 ] =0 ; + }else if (err >=sizeof (sbi->volume.label)) { + sbi->volume.label[sizeof (sbi->volume.label) -1 ] =0 ; + }else { + sbi->volume.label[err] =0 ; + } }else {/* Should we break mounting here? */ //err = -EINVAL;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 544/957 platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit f8fd138c2363c0e2d3235c32bfb4fb5c6474e4ae ]
Ensure the temp value has been properly parsed from the user-provided buffer and initialized to be used in later operations. While at it, prefer a convenient kstrtoul() helper.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- drivers/platform/x86/dell/dell_rbu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/dell/dell_rbu.c +5 -1
@@ -30,6 +30,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/init.h> +#include <linux/kstrtox.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/string.h>
@@ -619,9 +620,12 @@ static ssize_t packet_size_write(struct file *filp, struct kobject *kobj, char *buffer, loff_t pos, size_t count) { unsigned long temp; + +if (kstrtoul (buffer,10 , &temp)) +return -EINVAL ; +spin_lock (&rbu_data.lock);packet_empty_list (); -sscanf (buffer,"%lu" , &temp);if (temp <0xffffffff ) rbu_data.packetsize = temp;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 545/957 platform/x86: dell-wmi-sysman: bound enumeration string aggregation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3c34471c26abc52a37f5ad90949e2e4b8027eb14 ]
populate_enum_data() aggregates firmware-provided value-modifier and possible-value strings into fixed 512-byte struct members. The current code bounds each individual source string but then appends every string and separator with raw strcat() and no remaining-space check.
Switch the aggregation loops to a bounded append helper and reject enumeration packages whose combined strings do not fit in the destination buffers.
--- .../dell/dell-wmi-sysman/enum-attributes.c | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c +28 -6
@@ -6,10 +6,32 @@* Copyright (c) 2020 Dell Inc. */ +#include <linux/bug.h> +#include "dell-wmi-sysman.h" get_instance_id (enumeration); +static int append_enum_string (char *dest,const char *src) +{ +size_t dest_len =strlen (dest); +ssize_t copied; + +if (WARN_ON_ONCE (dest_len >=MAX_BUFF )) +return -EINVAL ; + + copied =strscpy (dest + dest_len, src,MAX_BUFF - dest_len); +if (copied <0 ) +return -EINVAL ; + + dest_len += copied; + copied =strscpy (dest + dest_len,";" ,MAX_BUFF - dest_len); +if (copied <0 ) +return -EINVAL ; + +return 0 ; +} +static ssize_t current_value_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf) {int instance_id =get_enumeration_instance_id (kobj);
@@ -176,9 +198,9 @@ int populate_enum_data(union acpi_object *enumeration_obj, int instance_id,return -EINVAL ;if (check_property_type (enumeration, next_obj,ACPI_TYPE_STRING ))return -EINVAL ; -strcat (wmi_priv.enumeration_data[instance_id].dell_value_modifier, - enumeration_obj[next_obj++].string.pointer); -strcat (wmi_priv.enumeration_data[instance_id].dell_value_modifier,";" ); +if (append_enum_string (wmi_priv.enumeration_data[instance_id].dell_value_modifier, + enumeration_obj[next_obj++].string.pointer)) +return -EINVAL ; }if (next_obj >= enum_property_count)
@@ -193,9 +215,9 @@ int populate_enum_data(union acpi_object *enumeration_obj, int instance_id,return -EINVAL ;if (check_property_type (enumeration, next_obj,ACPI_TYPE_STRING ))return -EINVAL ; -strcat (wmi_priv.enumeration_data[instance_id].possible_values, - enumeration_obj[next_obj++].string.pointer); -strcat (wmi_priv.enumeration_data[instance_id].possible_values,";" ); +if (append_enum_string (wmi_priv.enumeration_data[instance_id].possible_values, + enumeration_obj[next_obj++].string.pointer)) +return -EINVAL ; }return sysfs_create_group (attr_name_kobj, &enumeration_attr_group);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 546/957 RDMA/core: Prefer NLA_NUL_STRING
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 6ed3d14fc45d3da6025e7fe4a6a09066856698e2 ]
These attributes are evaluated as c-string (passed to strcmp), but NLA_STRING doesn't check for the presence of a \0 terminator.
Either this needs to switch to nla_strcmp() and needs to adjust printf fmt specifier to not use plain %s, or this needs to use NLA_NUL_STRING.
As the code has been this way for long time, it seems to me that userspace does include the terminating nul, even tough its not enforced so far, and thus NLA_NUL_STRING use is the simpler solution.
--- drivers/infiniband/core/iwpm_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/iwpm_msg.c +3 -3
@@ -365,9 +365,9 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)/* netlink attribute policy for the received response to register pid request */ static const struct nla_policy resp_reg_policy[IWPM_NLA_RREG_PID_MAX ] = { [IWPM_NLA_RREG_PID_SEQ ] = { .type =NLA_U32 }, - [IWPM_NLA_RREG_IBDEV_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_RREG_IBDEV_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_DEVNAME_SIZE -1 }, - [IWPM_NLA_RREG_ULIB_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_RREG_ULIB_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_ULIBNAME_SIZE -1 }, [IWPM_NLA_RREG_ULIB_VER ] = { .type =NLA_U16 }, [IWPM_NLA_RREG_PID_ERR ] = { .type =NLA_U16 }
@@ -677,7 +677,7 @@ int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb)/* netlink attribute policy for the received request for mapping info */ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX ] = { - [IWPM_NLA_MAPINFO_ULIB_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_MAPINFO_ULIB_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_ULIBNAME_SIZE -1 }, [IWPM_NLA_MAPINFO_ULIB_VER ] = { .type =NLA_U16 } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 547/957 dt-bindings: clock: qcom: Add GCC video axi reset clock for Glymur
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 7c3260327fc874b7c89d7bb230cd569d2e78aff7 ]
The global clock controller video axi reset clocks are required by the video SW driver to assert and deassert the clock resets.
Stable-dep-of: 1c8ce43e1e07 ("clk: qcom: gcc-glymur: Add video axi clock resets for glymur")
--- include/dt-bindings/clock/qcom,glymur-gcc.h | 1 + 1 file changed, 1 insertion(+)
include/dt-bindings/clock/qcom,glymur-gcc.h +1 -0
@@ -574,5 +574,6 @@#define GCC_VIDEO_AXI0_CLK_ARES 89#define GCC_VIDEO_AXI1_CLK_ARES 90#define GCC_VIDEO_BCR 91 +#define GCC_VIDEO_AXI0C_CLK_ARES 92#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 548/957 clk: qcom: gcc-glymur: Add video axi clock resets for glymur
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 1c8ce43e1e07ecc531fb517f95620ed85e998608 ]
The global clock controller video axi reset clocks are required by the video SW driver to assert and deassert the clock resets during their power down sequence. Hence add these clock resets.
--- drivers/clk/qcom/gcc-glymur.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-glymur.c +1 -0
@@ -8508,6 +8508,7 @@ static const struct qcom_reset_map gcc_glymur_resets[] = { [GCC_VIDEO_AXI0_CLK_ARES] = { 0x3201c, 2 }, [GCC_VIDEO_AXI1_CLK_ARES] = { 0x32044, 2 }, [GCC_VIDEO_BCR] = { 0x32000 }, + [GCC_VIDEO_AXI0C_CLK_ARES] = { 0x32030, 2 }, };static const struct clk_rcg_dfs_data gcc_dfs_clocks[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 549/957 clk: qcom: dispcc-glymur: use RCG2 ops for DPTX1 AUX clock source
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit e7c8eb1646db5d967d77ee67793dd95a2c5ff451 ]
The clk_dp_ops are supposed to be used for DP-related clocks with a proper MND divier. Use shared RCG2 ops for dptx1_aux_clk_src, the same as all other DPTX AUX clocks in this driver.
--- drivers/clk/qcom/dispcc-glymur.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-glymur.c +1 -1
@@ -417,7 +417,7 @@ static struct clk_rcg2 disp_cc_mdss_dptx1_aux_clk_src = { .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_dp_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 550/957 clk: qcom: dispcc-sm8450: use RCG2 ops for DPTX1 AUX clock source
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 141af1be817c42c7f1e1605348d4b1983d319bea ]
The clk_dp_ops are supposed to be used for DP-related clocks with a proper MND divier. Use standard RCG2 ops for dptx1_aux_clk_src, the same as all other DPTX AUX clocks in this driver.
--- drivers/clk/qcom/dispcc-sm8450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8450.c +1 -1
@@ -409,7 +409,7 @@ static struct clk_rcg2 disp_cc_mdss_dptx1_aux_clk_src = { .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_dp_ops, + .ops = &clk_rcg2_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 551/957 clk: sunxi-ng: sun55i-a523-r: Add missing r-spi module clock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit fb20ccf70cf695f178d7c32e2d33b376560df0ff ]
When the PRCM clk driver was added, somehow the r-spi module clock was skipped over.
Add it so that r-spi can actually work.
--- drivers/clk/sunxi-ng/ccu-sun55i-a523-r.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun55i-a523-r.c +16 -1
@@ -83,9 +83,22 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_pwmctrl_clk, "r-pwmctrl", static SUNXI_CCU_GATE_HW(bus_r_pwmctrl_clk, "bus-r-pwmctrl", &r_apb0_clk.common.hw, 0x13c, BIT(0), 0); -/* SPI clock is /M/N (same as new MMC?) */ +static const struct clk_parent_data r_spi_parents[] = { + { .fw_name ="hosc" }, + { .fw_name ="pll-periph" }, + { .name ="pll-periph0-300M" }, + { .name ="pll-periph1-300M" }, + { .name ="pll-audio" }, +}; +static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, +0 ,5 ,/* M */ +8 ,5 ,/* P */ +24 ,3 ,/* mux */ +BIT (31 ),/* gate */ + 0); static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); + static SUNXI_CCU_GATE_HW(bus_r_spinlock_clk, "bus-r-spinlock", &r_ahb_clk.common.hw, 0x16c, BIT(0), 0); static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox",
@@ -138,6 +151,7 @@ static struct ccu_common *sun55i_a523_r_ccu_clks[] = { &bus_r_twd_clk.common, &r_pwmctrl_clk.common, &bus_r_pwmctrl_clk.common, + &r_spi_clk.common, &bus_r_spi_clk.common, &bus_r_spinlock_clk.common, &bus_r_msgbox_clk.common,
@@ -169,6 +183,7 @@ static struct clk_hw_onecell_data sun55i_a523_r_hw_clks = { [CLK_BUS_R_TWD] = &bus_r_twd_clk.common.hw, [CLK_R_PWMCTRL] = &r_pwmctrl_clk.common.hw, [CLK_BUS_R_PWMCTRL] = &bus_r_pwmctrl_clk.common.hw, + [CLK_R_SPI] = &r_spi_clk.common.hw, [CLK_BUS_R_SPI] = &bus_r_spi_clk.common.hw, [CLK_BUS_R_SPINLOCK] = &bus_r_spinlock_clk.common.hw, [CLK_BUS_R_MSGBOX] = &bus_r_msgbox_clk.common.hw,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 552/957 scsi: sg: Fix sysctl sg-big-buff register during sg_init()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
[ Upstream commit 3033c471aaf675254efaa0da431e95d91a104b41 ]
Commit 26d1c80fd61e ("scsi/sg: move sg-big-buff sysctl to scsi/sg.c") made a mistake. sysctl sg-big-buff was not created because the call to register_sg_sysctls() was placed on the wrong code path.
--- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sg.c +1 -1
@@ -1689,13 +1689,13 @@ init_sg(void) sg_sysfs_valid =1 ; rc =scsi_register_interface (&sg_interface);if (0 == rc) { +register_sg_sysctls ();#ifdef CONFIG_SCSI_PROC_FS sg_proc_init ();#endif /* CONFIG_SCSI_PROC_FS */ return 0 ; }class_unregister (&sg_sysfs_class); -register_sg_sysctls (); err_out:unregister_chrdev_region (MKDEV (SCSI_GENERIC_MAJOR ,0 ),SG_MAX_DEVS );return rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 553/957 scsi: sg: Resolve soft lockup issue when opening /dev/sgX
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
[ Upstream commit d06a310b45e153872033dd0cf19d5a2279121099 ]
The parameter def_reserved_size defines the default buffer size reserved for each Sg_fd and should be restricted to a range between 0 and 1,048,576 (see https://tldp.org/HOWTO/SCSI-Generic-HOWTO/proc.html). Although the function sg_proc_write_dressz enforces this limit, it is possible to bypass it by directly modifying the module parameter as shown below, which then causes a soft lockup:
echo -1 > /sys/module/sg/parameters/def_reserved_size exec 4<> /dev/sg0
watchdog: BUG: soft lockup - CPU#5 stuck for 26 seconds! [bash:537] Modules loaded: CPU: 5 UID: 0 PID: 537 Command: bash, kernel version 6.19.0-rc3+ #134,
PREEMPT disabled
Hardware: QEMU Standard PC (i440FX + PIIX, 1996), BIOS version 1.16.1-2.fc37 dated 04/01/2014
...
Call Trace: sg_build_reserve+0x5c/0xa0 sg_add_sfp+0x168/0x270 sg_open+0x16e/0x340 chrdev_open+0xbe/0x230 do_dentry_open+0x175/0x480 vfs_open+0x34/0xf0 do_open+0x265/0x3d0 path_openat+0x110/0x290 do_filp_open+0xc3/0x170 do_sys_openat2+0x71/0xe0 __x64_sys_openat+0x6d/0xa0 do_syscall_64+0x62/0x310 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The fix is to use module_param_cb to validate and reject invalid values assigned to def_reserved_size.
--- drivers/scsi/sg.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/scsi/sg.c +27 -2
@@ -1621,10 +1621,35 @@ sg_remove_device(struct device *cl_dev) }module_param_named (scatter_elem_sz, scatter_elem_sz, int,S_IRUGO |S_IWUSR ); -module_param_named (def_reserved_size, def_reserved_size, int, -S_IRUGO |S_IWUSR );module_param_named (allow_dio, sg_allow_dio, int,S_IRUGO |S_IWUSR ); +static int def_reserved_size_set (const char *val,const struct kernel_param *kp) +{ +int size, ret; + +if (!val) +return -EINVAL ; + + ret =kstrtoint (val,0 , &size); +if (ret) +return ret; + +/* limit to 1 MB */ +if (size <0 || size >1048576 ) +return -ERANGE ; + + def_reserved_size = size; +return 0 ; +} + +static const struct kernel_param_ops def_reserved_size_ops = { + .set = def_reserved_size_set, + .get = param_get_int, +}; + +module_param_cb (def_reserved_size, &def_reserved_size_ops, &def_reserved_size, +S_IRUGO |S_IWUSR ); +MODULE_AUTHOR ("Douglas Gilbert" );MODULE_DESCRIPTION ("SCSI generic (sg) driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 554/957 clk: qcom: dispcc-sc8280xp: remove CLK_SET_RATE_PARENT from byte_div_clk_src dividers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: White Lewis <[email protected]>
[ Upstream commit 0b151a6307205eb867250985a910a88787cbf12e ]
The four byte_div_clk_src dividers (disp{0,1}_cc_mdss_byte{0,1}_div_clk_src) had CLK_SET_RATE_PARENT set. When the DSI driver calls clk_set_rate() on byte_intf_clk, the rate-change propagates through the divider up to the parent PLL (byte_clk_src), halving the byte clock rate.
A simiar issue had been also encountered on SM8750.b8501febdc51 ("clk: qcom: dispcc-sm8750: Drop incorrect CLK_SET_RATE_PARENT on byte intf parent").
Likewise, remove CLK_SET_RATE_PARENT from all four byte divider clocks so that clk_set_rate() on the divider adjusts only the divider ratio, leaving the parent PLL untouched.
--- drivers/clk/qcom/dispcc-sc8280xp.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/clk/qcom/dispcc-sc8280xp.c +0 -4
@@ -1160,7 +1160,6 @@ static struct clk_regmap_div disp0_cc_mdss_byte0_div_clk_src = { &disp0_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -1175,7 +1174,6 @@ static struct clk_regmap_div disp1_cc_mdss_byte0_div_clk_src = { &disp1_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -1190,7 +1188,6 @@ static struct clk_regmap_div disp0_cc_mdss_byte1_div_clk_src = { &disp0_cc_mdss_byte1_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -1205,7 +1202,6 @@ static struct clk_regmap_div disp1_cc_mdss_byte1_div_clk_src = { &disp1_cc_mdss_byte1_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 555/957 clk: qcom: dispcc-glymur: Fix DSI byte clock rate setting
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 98ea9eda030587601db56425efcd32263d853591 ]
The clock tree for byte_clk_src is as follows:
┌──────byte0_clk_src─────┐
│ │
byte0_clk byte0_div_clk_src
│ byte0_intf_clk
If both of its direct children have CLK_SET_RATE_PARENT with different requests, byte0_clk_src (and its parent) will be reconfigured. In this case, byte0_intf should strictly follow the rate of byte0_clk (with some adjustments based on PHY mode).
Remove CLK_SET_RATE_PARENT from byte0_div_clk_src to avoid this issue.
--- drivers/clk/qcom/dispcc-glymur.c | 2 -- 1 file changed, 2 deletions(-)
drivers/clk/qcom/dispcc-glymur.c +0 -2
@@ -747,7 +747,6 @@ static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = { &disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -762,7 +761,6 @@ static struct clk_regmap_div disp_cc_mdss_byte1_div_clk_src = { &disp_cc_mdss_byte1_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 556/957 clk: qcom: dispcc-milos: Fix DSI byte clock rate setting
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit dd5b76257b4048151006620c9895e2f5f0d997eb ]
The clock tree for byte_clk_src is as follows:
┌──────byte0_clk_src─────┐
│ │
byte0_clk byte0_div_clk_src
│ byte0_intf_clk
If both of its direct children have CLK_SET_RATE_PARENT with different requests, byte0_clk_src (and its parent) will be reconfigured. In this case, byte0_intf should strictly follow the rate of byte0_clk (with some adjustments based on PHY mode).
Remove CLK_SET_RATE_PARENT from byte0_div_clk_src to avoid this issue.
--- drivers/clk/qcom/dispcc-milos.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/qcom/dispcc-milos.c +0 -1
@@ -394,7 +394,6 @@ static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = { &disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 557/957 clk: qcom: dispcc-sm4450: Fix DSI byte clock rate setting
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 7bc48fcdf9e77bf68ef04af015d50df2a9acac00 ]
The clock tree for byte_clk_src is as follows:
┌──────byte0_clk_src─────┐
│ │
byte0_clk byte0_div_clk_src
│ byte0_intf_clk
If both of its direct children have CLK_SET_RATE_PARENT with different requests, byte0_clk_src (and its parent) will be reconfigured. In this case, byte0_intf should strictly follow the rate of byte0_clk (with some adjustments based on PHY mode).
Remove CLK_SET_RATE_PARENT from byte0_div_clk_src to avoid this issue.
--- drivers/clk/qcom/dispcc-sm4450.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/qcom/dispcc-sm4450.c +0 -1
@@ -335,7 +335,6 @@ static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = { &disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 558/957 clk: qcom: dispcc[01]-sa8775p: Fix DSI byte clock rate setting
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 2851b6c6a42e22c243aa4cd606a49e2b9acfb6d6 ]
The clock tree for byte_clk_src is as follows:
┌──────byte0_clk_src─────┐
│ │
byte0_clk byte0_div_clk_src
│ byte0_intf_clk
If both of its direct children have CLK_SET_RATE_PARENT with different requests, byte0_clk_src (and its parent) will be reconfigured. In this case, byte0_intf should strictly follow the rate of byte0_clk (with some adjustments based on PHY mode).
Remove CLK_SET_RATE_PARENT from byte0_div_clk_src to avoid this issue.
--- drivers/clk/qcom/dispcc0-sa8775p.c | 2 -- drivers/clk/qcom/dispcc1-sa8775p.c | 2 -- 2 files changed, 4 deletions(-)
drivers/clk/qcom/dispcc0-sa8775p.c +0 -2
@@ -591,7 +591,6 @@ static struct clk_regmap_div mdss_0_disp_cc_mdss_byte0_div_clk_src = { &mdss_0_disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -606,7 +605,6 @@ static struct clk_regmap_div mdss_0_disp_cc_mdss_byte1_div_clk_src = { &mdss_0_disp_cc_mdss_byte1_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
drivers/clk/qcom/dispcc1-sa8775p.c +0 -2
@@ -591,7 +591,6 @@ static struct clk_regmap_div mdss_1_disp_cc_mdss_byte0_div_clk_src = { &mdss_1_disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
@@ -606,7 +605,6 @@ static struct clk_regmap_div mdss_1_disp_cc_mdss_byte1_div_clk_src = { &mdss_1_disp_cc_mdss_byte1_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, .ops = &clk_regmap_div_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 559/957 clk: renesas: r9a09g057: Add clock and reset entries for RTC
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit 7a03ef9f8223434f19e19a37acc32dcb581ab475 ]
Add module clock and reset entries for the RTC module on the Renesas RZ/V2H (R9A09G057) SoC.
Stable-dep-of: 1b4f047dc401 ("clk: renesas: r9a09g057: Remove entries for WDT{0,2,3}")
--- drivers/clk/renesas/r9a09g057-cpg.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/renesas/r9a09g057-cpg.c +4 -0
@@ -239,6 +239,8 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { BUS_MSTOP(5, BIT(13))),DEF_MOD ("wdt_3_clk_loco" ,CLK_QEXTAL ,5 ,2 ,2 ,18 ,BUS_MSTOP (5 ,BIT (13 ))), +DEF_MOD ("rtc_0_clk_rtc" ,CLK_PLLCM33_DIV16 ,5 ,3 ,2 ,19 , +BUS_MSTOP (3 ,BIT (11 ) |BIT (12 ))),DEF_MOD ("rspi_0_pclk" ,CLK_PLLCLN_DIV8 ,5 ,4 ,2 ,20 ,BUS_MSTOP (11 ,BIT (0 ))), DEF_MOD("rspi_0_pclk_sfr", CLK_PLLCLN_DIV8, 5, 5, 2, 21,
@@ -401,6 +403,8 @@ static const struct rzv2h_reset r9a09g057_resets[] __initconst = {DEF_RST (7 ,6 ,3 ,7 ),/* WDT_1_RESET */ DEF_RST (7 ,7 ,3 ,8 ),/* WDT_2_RESET */ DEF_RST (7 ,8 ,3 ,9 ),/* WDT_3_RESET */ +DEF_RST (7 ,9 ,3 ,10 ),/* RTC_0_RST_RTC */ +DEF_RST (7 ,10 ,3 ,11 ),/* RTC_0_RST_RTC_V */ DEF_RST (7 ,11 ,3 ,12 ),/* RSPI_0_PRESETN */ DEF_RST (7 ,12 ,3 ,13 ),/* RSPI_0_TRESETN */ DEF_RST(7, 13, 3, 14), /* RSPI_1_PRESETN */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 560/957 clk: renesas: r9a09g057: Add entries for RSCIs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 2efea3b35cc916f04f06b89f2e2557dbd9c48109 ]
Add clock and reset entries for the RSCI IPs.
Stable-dep-of: 1b4f047dc401 ("clk: renesas: r9a09g057: Remove entries for WDT{0,2,3}")
--- drivers/clk/renesas/r9a09g057-cpg.c | 126 ++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+)
drivers/clk/renesas/r9a09g057-cpg.c +126 -0
@@ -44,6 +44,9 @@ enum clk_ids {CLK_PLLCLN_DIV2 ,CLK_PLLCLN_DIV8 ,CLK_PLLCLN_DIV16 , +CLK_PLLCLN_DIV64 , +CLK_PLLCLN_DIV256 , +CLK_PLLCLN_DIV1024 ,CLK_PLLDTY_ACPU ,CLK_PLLDTY_ACPU_DIV2 , CLK_PLLDTY_ACPU_DIV4,
@@ -144,6 +147,9 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {DEF_FIXED (".pllcln_div2" ,CLK_PLLCLN_DIV2 ,CLK_PLLCLN ,1 ,2 ),DEF_FIXED (".pllcln_div8" ,CLK_PLLCLN_DIV8 ,CLK_PLLCLN ,1 ,8 ),DEF_FIXED (".pllcln_div16" ,CLK_PLLCLN_DIV16 ,CLK_PLLCLN ,1 ,16 ), +DEF_FIXED (".pllcln_div64" ,CLK_PLLCLN_DIV64 ,CLK_PLLCLN ,1 ,64 ), +DEF_FIXED (".pllcln_div256" ,CLK_PLLCLN_DIV256 ,CLK_PLLCLN ,1 ,256 ), +DEF_FIXED (".pllcln_div1024" ,CLK_PLLCLN_DIV1024 ,CLK_PLLCLN ,1 ,1024 ),DEF_DDIV (".plldty_acpu" ,CLK_PLLDTY_ACPU ,CLK_PLLDTY ,CDDIV0_DIVCTL2 , dtable_2_64), DEF_FIXED(".plldty_acpu_div2", CLK_PLLDTY_ACPU_DIV2, CLK_PLLDTY_ACPU, 1, 2),
@@ -239,6 +245,106 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { BUS_MSTOP(5, BIT(13))),DEF_MOD ("wdt_3_clk_loco" ,CLK_QEXTAL ,5 ,2 ,2 ,18 ,BUS_MSTOP (5 ,BIT (13 ))), +DEF_MOD ("rsci0_pclk" ,CLK_PLLCLN_DIV16 ,5 ,13 ,2 ,29 , +BUS_MSTOP (11 ,BIT (3 ))), +DEF_MOD ("rsci0_tclk" ,CLK_PLLCLN_DIV16 ,5 ,14 ,2 ,30 , +BUS_MSTOP (11 ,BIT (3 ))), +DEF_MOD ("rsci0_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,5 ,15 ,2 ,31 , +BUS_MSTOP (11 ,BIT (3 ))), +DEF_MOD ("rsci0_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,6 ,0 ,3 ,0 , +BUS_MSTOP (11 ,BIT (3 ))), +DEF_MOD ("rsci0_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,6 ,1 ,3 ,1 , +BUS_MSTOP (11 ,BIT (3 ))), +DEF_MOD ("rsci1_pclk" ,CLK_PLLCLN_DIV16 ,6 ,2 ,3 ,2 , +BUS_MSTOP (11 ,BIT (4 ))), +DEF_MOD ("rsci1_tclk" ,CLK_PLLCLN_DIV16 ,6 ,3 ,3 ,3 , +BUS_MSTOP (11 ,BIT (4 ))), +DEF_MOD ("rsci1_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,6 ,4 ,3 ,4 , +BUS_MSTOP (11 ,BIT (4 ))), +DEF_MOD ("rsci1_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,6 ,5 ,3 ,5 , +BUS_MSTOP (11 ,BIT (4 ))), +DEF_MOD ("rsci1_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,6 ,6 ,3 ,6 , +BUS_MSTOP (11 ,BIT (4 ))), +DEF_MOD ("rsci2_pclk" ,CLK_PLLCLN_DIV16 ,6 ,7 ,3 ,7 , +BUS_MSTOP (11 ,BIT (5 ))), +DEF_MOD ("rsci2_tclk" ,CLK_PLLCLN_DIV16 ,6 ,8 ,3 ,8 , +BUS_MSTOP (11 ,BIT (5 ))), +DEF_MOD ("rsci2_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,6 ,9 ,3 ,9 , +BUS_MSTOP (11 ,BIT (5 ))), +DEF_MOD ("rsci2_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,6 ,10 ,3 ,10 , +BUS_MSTOP (11 ,BIT (5 ))), +DEF_MOD ("rsci2_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,6 ,11 ,3 ,11 , +BUS_MSTOP (11 ,BIT (5 ))), +DEF_MOD ("rsci3_pclk" ,CLK_PLLCLN_DIV16 ,6 ,12 ,3 ,12 , +BUS_MSTOP (11 ,BIT (6 ))), +DEF_MOD ("rsci3_tclk" ,CLK_PLLCLN_DIV16 ,6 ,13 ,3 ,13 , +BUS_MSTOP (11 ,BIT (6 ))), +DEF_MOD ("rsci3_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,6 ,14 ,3 ,14 , +BUS_MSTOP (11 ,BIT (6 ))), +DEF_MOD ("rsci3_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,6 ,15 ,3 ,15 , +BUS_MSTOP (11 ,BIT (6 ))), +DEF_MOD ("rsci3_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,7 ,0 ,3 ,16 , +BUS_MSTOP (11 ,BIT (6 ))), +DEF_MOD ("rsci4_pclk" ,CLK_PLLCLN_DIV16 ,7 ,1 ,3 ,17 , +BUS_MSTOP (11 ,BIT (7 ))), +DEF_MOD ("rsci4_tclk" ,CLK_PLLCLN_DIV16 ,7 ,2 ,3 ,18 , +BUS_MSTOP (11 ,BIT (7 ))), +DEF_MOD ("rsci4_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,7 ,3 ,3 ,19 , +BUS_MSTOP (11 ,BIT (7 ))), +DEF_MOD ("rsci4_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,7 ,4 ,3 ,20 , +BUS_MSTOP (11 ,BIT (7 ))), +DEF_MOD ("rsci4_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,7 ,5 ,3 ,21 , +BUS_MSTOP (11 ,BIT (7 ))), +DEF_MOD ("rsci5_pclk" ,CLK_PLLCLN_DIV16 ,7 ,6 ,3 ,22 , +BUS_MSTOP (11 ,BIT (8 ))), +DEF_MOD ("rsci5_tclk" ,CLK_PLLCLN_DIV16 ,7 ,7 ,3 ,23 , +BUS_MSTOP (11 ,BIT (8 ))), +DEF_MOD ("rsci5_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,7 ,8 ,3 ,24 , +BUS_MSTOP (11 ,BIT (8 ))), +DEF_MOD ("rsci5_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,7 ,9 ,3 ,25 , +BUS_MSTOP (11 ,BIT (8 ))), +DEF_MOD ("rsci5_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,7 ,10 ,3 ,26 , +BUS_MSTOP (11 ,BIT (8 ))), +DEF_MOD ("rsci6_pclk" ,CLK_PLLCLN_DIV16 ,7 ,11 ,3 ,27 , +BUS_MSTOP (11 ,BIT (9 ))), +DEF_MOD ("rsci6_tclk" ,CLK_PLLCLN_DIV16 ,7 ,12 ,3 ,28 , +BUS_MSTOP (11 ,BIT (9 ))), +DEF_MOD ("rsci6_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,7 ,13 ,3 ,29 , +BUS_MSTOP (11 ,BIT (9 ))), +DEF_MOD ("rsci6_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,7 ,14 ,3 ,30 , +BUS_MSTOP (11 ,BIT (9 ))), +DEF_MOD ("rsci6_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,7 ,15 ,3 ,31 , +BUS_MSTOP (11 ,BIT (9 ))), +DEF_MOD ("rsci7_pclk" ,CLK_PLLCLN_DIV16 ,8 ,0 ,4 ,0 , +BUS_MSTOP (11 ,BIT (10 ))), +DEF_MOD ("rsci7_tclk" ,CLK_PLLCLN_DIV16 ,8 ,1 ,4 ,1 , +BUS_MSTOP (11 ,BIT (10 ))), +DEF_MOD ("rsci7_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,8 ,2 ,4 ,2 , +BUS_MSTOP (11 ,BIT (10 ))), +DEF_MOD ("rsci7_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,8 ,3 ,4 ,3 , +BUS_MSTOP (11 ,BIT (10 ))), +DEF_MOD ("rsci7_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,8 ,4 ,4 ,4 , +BUS_MSTOP (11 ,BIT (10 ))), +DEF_MOD ("rsci8_pclk" ,CLK_PLLCLN_DIV16 ,8 ,5 ,4 ,5 , +BUS_MSTOP (11 ,BIT (11 ))), +DEF_MOD ("rsci8_tclk" ,CLK_PLLCLN_DIV16 ,8 ,6 ,4 ,6 , +BUS_MSTOP (11 ,BIT (11 ))), +DEF_MOD ("rsci8_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,8 ,7 ,4 ,7 , +BUS_MSTOP (11 ,BIT (11 ))), +DEF_MOD ("rsci8_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,8 ,8 ,4 ,8 , +BUS_MSTOP (11 ,BIT (11 ))), +DEF_MOD ("rsci8_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,8 ,9 ,4 ,9 , +BUS_MSTOP (11 ,BIT (11 ))), +DEF_MOD ("rsci9_pclk" ,CLK_PLLCLN_DIV16 ,8 ,10 ,4 ,10 , +BUS_MSTOP (11 ,BIT (12 ))), +DEF_MOD ("rsci9_tclk" ,CLK_PLLCLN_DIV16 ,8 ,11 ,4 ,11 , +BUS_MSTOP (11 ,BIT (12 ))), +DEF_MOD ("rsci9_ps_ps3_n" ,CLK_PLLCLN_DIV1024 ,8 ,12 ,4 ,12 , +BUS_MSTOP (11 ,BIT (12 ))), +DEF_MOD ("rsci9_ps_ps2_n" ,CLK_PLLCLN_DIV256 ,8 ,13 ,4 ,13 , +BUS_MSTOP (11 ,BIT (12 ))), +DEF_MOD ("rsci9_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,8 ,14 ,4 ,14 , +BUS_MSTOP (11 ,BIT (12 ))),DEF_MOD ("rtc_0_clk_rtc" ,CLK_PLLCM33_DIV16 ,5 ,3 ,2 ,19 ,BUS_MSTOP (3 ,BIT (11 ) |BIT (12 ))), DEF_MOD("rspi_0_pclk", CLK_PLLCLN_DIV8, 5, 4, 2, 20,
@@ -403,6 +509,26 @@ static const struct rzv2h_reset r9a09g057_resets[] __initconst = {DEF_RST (7 ,6 ,3 ,7 ),/* WDT_1_RESET */ DEF_RST (7 ,7 ,3 ,8 ),/* WDT_2_RESET */ DEF_RST (7 ,8 ,3 ,9 ),/* WDT_3_RESET */ +DEF_RST (8 ,1 ,3 ,18 ),/* RSCI0_PRESETN */ +DEF_RST (8 ,2 ,3 ,19 ),/* RSCI0_TRESETN */ +DEF_RST (8 ,3 ,3 ,20 ),/* RSCI1_PRESETN */ +DEF_RST (8 ,4 ,3 ,21 ),/* RSCI1_TRESETN */ +DEF_RST (8 ,5 ,3 ,22 ),/* RSCI2_PRESETN */ +DEF_RST (8 ,6 ,3 ,23 ),/* RSCI2_TRESETN */ +DEF_RST (8 ,7 ,3 ,24 ),/* RSCI3_PRESETN */ +DEF_RST (8 ,8 ,3 ,25 ),/* RSCI3_TRESETN */ +DEF_RST (8 ,9 ,3 ,26 ),/* RSCI4_PRESETN */ +DEF_RST (8 ,10 ,3 ,27 ),/* RSCI4_TRESETN */ +DEF_RST (8 ,11 ,3 ,28 ),/* RSCI5_PRESETN */ +DEF_RST (8 ,12 ,3 ,29 ),/* RSCI5_TRESETN */ +DEF_RST (8 ,13 ,3 ,30 ),/* RSCI6_PRESETN */ +DEF_RST (8 ,14 ,3 ,31 ),/* RSCI6_TRESETN */ +DEF_RST (8 ,15 ,4 ,0 ),/* RSCI7_PRESETN */ +DEF_RST (9 ,0 ,4 ,1 ),/* RSCI7_TRESETN */ +DEF_RST (9 ,1 ,4 ,2 ),/* RSCI8_PRESETN */ +DEF_RST (9 ,2 ,4 ,3 ),/* RSCI8_TRESETN */ +DEF_RST (9 ,3 ,4 ,4 ),/* RSCI9_PRESETN */ +DEF_RST (9 ,4 ,4 ,5 ),/* RSCI9_TRESETN */ DEF_RST (7 ,9 ,3 ,10 ),/* RTC_0_RST_RTC */ DEF_RST (7 ,10 ,3 ,11 ),/* RTC_0_RST_RTC_V */ DEF_RST(7, 11, 3, 12), /* RSPI_0_PRESETN */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 561/957 clk: renesas: r9a09g057: Fix ordering of module clocks array
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit 79cac2b8dc1d9f63fbf6c6793e423052118cc51a ]
The r9a09g057_mod_clks array is sorted by CPG_CLKON register number and bit position. Move the RTC and RSPI module clock entries to their correct position to restore the array sort order.
Stable-dep-of: 1b4f047dc401 ("clk: renesas: r9a09g057: Remove entries for WDT{0,2,3}")
--- drivers/clk/renesas/r9a09g057-cpg.c | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/clk/renesas/r9a09g057-cpg.c +20 -20
@@ -245,6 +245,26 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { BUS_MSTOP(5, BIT(13))),DEF_MOD ("wdt_3_clk_loco" ,CLK_QEXTAL ,5 ,2 ,2 ,18 ,BUS_MSTOP (5 ,BIT (13 ))), +DEF_MOD ("rtc_0_clk_rtc" ,CLK_PLLCM33_DIV16 ,5 ,3 ,2 ,19 , +BUS_MSTOP (3 ,BIT (11 ) |BIT (12 ))), +DEF_MOD ("rspi_0_pclk" ,CLK_PLLCLN_DIV8 ,5 ,4 ,2 ,20 , +BUS_MSTOP (11 ,BIT (0 ))), +DEF_MOD ("rspi_0_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,5 ,2 ,21 , +BUS_MSTOP (11 ,BIT (0 ))), +DEF_MOD ("rspi_0_tclk" ,CLK_PLLCLN_DIV8 ,5 ,6 ,2 ,22 , +BUS_MSTOP (11 ,BIT (0 ))), +DEF_MOD ("rspi_1_pclk" ,CLK_PLLCLN_DIV8 ,5 ,7 ,2 ,23 , +BUS_MSTOP (11 ,BIT (1 ))), +DEF_MOD ("rspi_1_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,8 ,2 ,24 , +BUS_MSTOP (11 ,BIT (1 ))), +DEF_MOD ("rspi_1_tclk" ,CLK_PLLCLN_DIV8 ,5 ,9 ,2 ,25 , +BUS_MSTOP (11 ,BIT (1 ))), +DEF_MOD ("rspi_2_pclk" ,CLK_PLLCLN_DIV8 ,5 ,10 ,2 ,26 , +BUS_MSTOP (11 ,BIT (2 ))), +DEF_MOD ("rspi_2_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,11 ,2 ,27 , +BUS_MSTOP (11 ,BIT (2 ))), +DEF_MOD ("rspi_2_tclk" ,CLK_PLLCLN_DIV8 ,5 ,12 ,2 ,28 , +BUS_MSTOP (11 ,BIT (2 ))),DEF_MOD ("rsci0_pclk" ,CLK_PLLCLN_DIV16 ,5 ,13 ,2 ,29 ,BUS_MSTOP (11 ,BIT (3 ))), DEF_MOD("rsci0_tclk", CLK_PLLCLN_DIV16, 5, 14, 2, 30,
@@ -345,26 +365,6 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { BUS_MSTOP(11, BIT(12))),DEF_MOD ("rsci9_ps_ps1_n" ,CLK_PLLCLN_DIV64 ,8 ,14 ,4 ,14 ,BUS_MSTOP (11 ,BIT (12 ))), -DEF_MOD ("rtc_0_clk_rtc" ,CLK_PLLCM33_DIV16 ,5 ,3 ,2 ,19 , -BUS_MSTOP (3 ,BIT (11 ) |BIT (12 ))), -DEF_MOD ("rspi_0_pclk" ,CLK_PLLCLN_DIV8 ,5 ,4 ,2 ,20 , -BUS_MSTOP (11 ,BIT (0 ))), -DEF_MOD ("rspi_0_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,5 ,2 ,21 , -BUS_MSTOP (11 ,BIT (0 ))), -DEF_MOD ("rspi_0_tclk" ,CLK_PLLCLN_DIV8 ,5 ,6 ,2 ,22 , -BUS_MSTOP (11 ,BIT (0 ))), -DEF_MOD ("rspi_1_pclk" ,CLK_PLLCLN_DIV8 ,5 ,7 ,2 ,23 , -BUS_MSTOP (11 ,BIT (1 ))), -DEF_MOD ("rspi_1_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,8 ,2 ,24 , -BUS_MSTOP (11 ,BIT (1 ))), -DEF_MOD ("rspi_1_tclk" ,CLK_PLLCLN_DIV8 ,5 ,9 ,2 ,25 , -BUS_MSTOP (11 ,BIT (1 ))), -DEF_MOD ("rspi_2_pclk" ,CLK_PLLCLN_DIV8 ,5 ,10 ,2 ,26 , -BUS_MSTOP (11 ,BIT (2 ))), -DEF_MOD ("rspi_2_pclk_sfr" ,CLK_PLLCLN_DIV8 ,5 ,11 ,2 ,27 , -BUS_MSTOP (11 ,BIT (2 ))), -DEF_MOD ("rspi_2_tclk" ,CLK_PLLCLN_DIV8 ,5 ,12 ,2 ,28 , -BUS_MSTOP (11 ,BIT (2 ))),DEF_MOD ("scif_0_clk_pck" ,CLK_PLLCM33_DIV16 ,8 ,15 ,4 ,15 ,BUS_MSTOP (3 ,BIT (14 ))), DEF_MOD("i3c_0_pclkrw", CLK_PLLCLN_DIV16, 9, 0, 4, 16,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 562/957 clk: renesas: r9a09g057: Remove entries for WDT{0,2,3}
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrizio Castro <[email protected]>
[ Upstream commit 1b4f047dc4010d51821694cc4ed73b52b3040a5c ]
The HW user manual for the Renesas RZ/V2H(P) SoC specifies that only the WDT1 IP is supposed to be used by Linux, while the WDT{0,2,3} IPs are supposed to be used by the CM33 and CR8 cores.
Remove the clock and reset entries for WDT{0,2,3} to prevent interfering with the CM33 and CR8 cores.
This change is harmless as only WDT1 is used by Linux, there are no users for the WDT{0,2,3} cores.
--- drivers/clk/renesas/r9a09g057-cpg.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/clk/renesas/r9a09g057-cpg.c +0 -15
@@ -229,22 +229,10 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { BUS_MSTOP(11, BIT(15))),DEF_MOD ("gtm_7_pclk" ,CLK_PLLCLN_DIV16 ,4 ,10 ,2 ,10 ,BUS_MSTOP (12 ,BIT (0 ))), -DEF_MOD ("wdt_0_clkp" ,CLK_PLLCM33_DIV16 ,4 ,11 ,2 ,11 , -BUS_MSTOP (3 ,BIT (10 ))), -DEF_MOD ("wdt_0_clk_loco" ,CLK_QEXTAL ,4 ,12 ,2 ,12 , -BUS_MSTOP (3 ,BIT (10 ))),DEF_MOD ("wdt_1_clkp" ,CLK_PLLCLN_DIV16 ,4 ,13 ,2 ,13 ,BUS_MSTOP (1 ,BIT (0 ))),DEF_MOD ("wdt_1_clk_loco" ,CLK_QEXTAL ,4 ,14 ,2 ,14 ,BUS_MSTOP (1 ,BIT (0 ))), -DEF_MOD ("wdt_2_clkp" ,CLK_PLLCLN_DIV16 ,4 ,15 ,2 ,15 , -BUS_MSTOP (5 ,BIT (12 ))), -DEF_MOD ("wdt_2_clk_loco" ,CLK_QEXTAL ,5 ,0 ,2 ,16 , -BUS_MSTOP (5 ,BIT (12 ))), -DEF_MOD ("wdt_3_clkp" ,CLK_PLLCLN_DIV16 ,5 ,1 ,2 ,17 , -BUS_MSTOP (5 ,BIT (13 ))), -DEF_MOD ("wdt_3_clk_loco" ,CLK_QEXTAL ,5 ,2 ,2 ,18 , -BUS_MSTOP (5 ,BIT (13 ))),DEF_MOD ("rtc_0_clk_rtc" ,CLK_PLLCM33_DIV16 ,5 ,3 ,2 ,19 ,BUS_MSTOP (3 ,BIT (11 ) |BIT (12 ))), DEF_MOD("rspi_0_pclk", CLK_PLLCLN_DIV8, 5, 4, 2, 20,
@@ -505,10 +493,7 @@ static const struct rzv2h_reset r9a09g057_resets[] __initconst = {DEF_RST (7 ,2 ,3 ,3 ),/* GTM_5_PRESETZ */ DEF_RST (7 ,3 ,3 ,4 ),/* GTM_6_PRESETZ */ DEF_RST (7 ,4 ,3 ,5 ),/* GTM_7_PRESETZ */ -DEF_RST (7 ,5 ,3 ,6 ),/* WDT_0_RESET */ DEF_RST (7 ,6 ,3 ,7 ),/* WDT_1_RESET */ -DEF_RST (7 ,7 ,3 ,8 ),/* WDT_2_RESET */ -DEF_RST (7 ,8 ,3 ,9 ),/* WDT_3_RESET */ DEF_RST (8 ,1 ,3 ,18 ),/* RSCI0_PRESETN */ DEF_RST (8 ,2 ,3 ,19 ),/* RSCI0_TRESETN */ DEF_RST(8, 3, 3, 20), /* RSCI1_PRESETN */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 563/957 scsi: target: core: Fix integer overflow in UNMAP bounds check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
[ Upstream commit 2bf2d65f76697820dbc4227d13866293576dd90a ]
sbc_execute_unmap() checks LBA + range does not exceed the device capacity, but does not guard against LBA + range wrapping around on 64-bit overflow.
Add an overflow check matching the pattern already used for WRITE_SAME in the same file.
--- drivers/target/target_core_sbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_sbc.c +2 -1
@@ -1136,7 +1136,8 @@ sbc_execute_unmap(struct se_cmd *cmd) goto err; } -if (lba + range > dev->transport->get_blocks (dev) +1 ) { +if (lba + range < lba || + lba + range > dev->transport->get_blocks (dev) +1 ) { ret =TCM_ADDRESS_OUT_OF_RANGE ; goto err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 564/957 scsi: ufs: rockchip,rk3576-ufshc: dt-bindings: Add new mphy reset item
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit bdce3a69c578090dd5e3c77bcdaaca10c3a41e34 ]
Add the mphy reset property to the devicetree bindings for the Rockchip RK3576 UFS host controller. The mphy reset signal is used to reset the physical adapter. Resetting other components while leaving the mphy unreset may occasionally prevent the UFS controller from successfully linking up with the device.
This addresses an intermittent hardware bug where the UFS link fails to establish under specific timing conditions with certain chips. While difficult to reproduce initially, this issue was consistently observed in downstream testing and requires explicit mphy reset control for full stability.
Although this change increases the maxItems for resets and adds a new entry (which technically alters the binding ABI), it does not break compatibility for existing Linux systems. The driver uses devm_reset_control_array_get_exclusive() to manage resets, allowing it to function correctly with both older Device Trees (without the mphy entry) and newer ones.
--- .../devicetree/bindings/ufs/rockchip,rk3576-ufshc.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/ufs/rockchip,rk3576-ufshc.yaml +4 -3
@@ -41,7 +41,7 @@ properties: maxItems: 1 resets: - maxItems: 4 + maxItems: 5 reset-names: items:
@@ -49,6 +49,7 @@ properties: - const: sys - const: ufs - const: grf + - const: mphy reset-gpios: maxItems: 1
@@ -98,8 +99,8 @@ examples: interrupts = <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>; power-domains = <&power RK3576_PD_USB>; resets = <&cru SRST_A_UFS_BIU>, <&cru SRST_A_UFS_SYS>, <&cru SRST_A_UFS>, - <&cru SRST_P_UFS_GRF>; - reset-names = "biu", "sys", "ufs", "grf"; + <&cru SRST_P_UFS_GRF>, <&cru SRST_MPHY_INIT>; + reset-names = "biu", "sys", "ufs", "grf", "mphy"; reset-gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 565/957 dt-bindings: clock: qcom,gcc-sc8180x: Add missing GDSCs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 76404ffbf07f28a5ec04748e18fce3dac2e78ef6 ]
There are 5 more GDSCs that we were ignoring and not putting to sleep, which are listed in downstream DTS. Add them.
Stable-dep-of: 3565741eb985 ("clk: qcom: gcc-sc8180x: Add missing GDSCs")
--- include/dt-bindings/clock/qcom,gcc-sc8180x.h | 5 +++++ 1 file changed, 5 insertions(+)
include/dt-bindings/clock/qcom,gcc-sc8180x.h +5 -0
@@ -322,5 +322,10 @@#define USB30_MP_GDSC 8#define USB30_PRIM_GDSC 9#define USB30_SEC_GDSC 10 +#define HLOS1_VOTE_MMNOC_MMU_TBU_HF0_GDSC 11 +#define HLOS1_VOTE_MMNOC_MMU_TBU_HF1_GDSC 12 +#define HLOS1_VOTE_MMNOC_MMU_TBU_SF_GDSC 13 +#define HLOS1_VOTE_TURING_MMU_TBU0_GDSC 14 +#define HLOS1_VOTE_TURING_MMU_TBU1_GDSC 15#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 566/957 clk: qcom: gcc-sc8180x: Add missing GDSCs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 3565741eb985a8a7cc6656eb33496195468cb99e ]
There are 5 more GDSCs that we were ignoring and not putting to sleep, which are listed in downstream DTS. Add them.
--- drivers/clk/qcom/gcc-sc8180x.c | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/clk/qcom/gcc-sc8180x.c +50 -0
@@ -4266,6 +4266,51 @@ static struct gdsc usb30_mp_gdsc = { .flags = POLL_CFG_GDSCR, }; +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { + .gdscr =0x7d050 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = { + .gdscr =0x7d058 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { + .gdscr =0x7d054 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_sf_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_turing_mmu_tbu0_gdsc = { + .gdscr =0x7d05c , + .pd = { + .name ="hlos1_vote_turing_mmu_tbu0_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_turing_mmu_tbu1_gdsc = { + .gdscr =0x7d060 , + .pd = { + .name ="hlos1_vote_turing_mmu_tbu1_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; +static struct clk_regmap *gcc_sc8180x_clocks[] = { [GCC_AGGRE_NOC_PCIE_TBU_CLK ] = &gcc_aggre_noc_pcie_tbu_clk.clkr, [GCC_AGGRE_UFS_CARD_AXI_CLK ] = &gcc_aggre_ufs_card_axi_clk.clkr,
@@ -4595,6 +4640,11 @@ static struct gdsc *gcc_sc8180x_gdscs[] = { [USB30_MP_GDSC] = &usb30_mp_gdsc, [USB30_PRIM_GDSC] = &usb30_prim_gdsc, [USB30_SEC_GDSC] = &usb30_sec_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF0_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF1_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_SF_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_sf_gdsc, + [HLOS1_VOTE_TURING_MMU_TBU0_GDSC] = &hlos1_vote_turing_mmu_tbu0_gdsc, + [HLOS1_VOTE_TURING_MMU_TBU1_GDSC] = &hlos1_vote_turing_mmu_tbu1_gdsc, };static const struct regmap_config gcc_sc8180x_regmap_config = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 567/957 clk: qcom: gcc-sc8180x: Use retention for USB power domains
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 25bc96f26cd6c19dde13a0b9859183e531d6fbfc ]
The USB subsystem does not expect to lose its state on suspend:
xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit usb usb1: root hub lost power or was reset
(The reinitialization usually succeeds, but it does slow down resume.)
To maintain state during suspend, the relevant GDSCs need to stay in retention mode, like they do on other similar SoCs. Change the mode to PWRSTS_RET_ON to fix.
--- drivers/clk/qcom/gcc-sc8180x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/gcc-sc8180x.c +3 -3
@@ -4172,7 +4172,7 @@ static struct gdsc usb30_sec_gdsc = { .pd = { .name = "usb30_sec_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4190,7 +4190,7 @@ static struct gdsc usb30_prim_gdsc = { .pd = { .name = "usb30_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4262,7 +4262,7 @@ static struct gdsc usb30_mp_gdsc = { .pd = { .name = "usb30_mp_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 568/957 clk: qcom: gcc-sc8180x: Use retention for PCIe power domains
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit ccb92c78b42edd26225b4d5920847dfee3e1b093 ]
As the PCIe host controller driver does not yet support dealing with the loss of state during suspend, use retention for relevant GDSCs.
This fixes the link not surviving upon resume:
nvme 0002:01:00.0: Unable to change power state from D3cold to D0, device inaccessible nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS read failed (134) nvme 0002:01:00.0: Unable to change power state from D3cold to D0, device inaccessible nvme nvme0: Disabling device after reset failure: -19
--- drivers/clk/qcom/gcc-sc8180x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/gcc-sc8180x.c +4 -4
@@ -4199,7 +4199,7 @@ static struct gdsc pcie_0_gdsc = { .pd = { .name = "pcie_0_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4226,7 +4226,7 @@ static struct gdsc pcie_1_gdsc = { .pd = { .name = "pcie_1_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4235,7 +4235,7 @@ static struct gdsc pcie_2_gdsc = { .pd = { .name = "pcie_2_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4253,7 +4253,7 @@ static struct gdsc pcie_3_gdsc = { .pd = { .name = "pcie_3_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 569/957 clk: qcom: dispcc-sm8250: Use shared ops on the mdss vsync clk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 8c522da70f0c2e5148c4c13ccb1c64cca57a6fdb ]
mdss_gdsc can get stuck on boot due to RCGs being left on from last boot. As a fix, commit 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon registration") introduced a callback to ensure the RCG is off upon init. However, the fix depends on all shared RCGs being marked as such in code.
For SM8150/SC8180X/SM8250 the MDSS vsync clock was using regular ops, unlike the same clock in the SC7180 code. This was causing display to frequently fail to initialize after rebooting on the Surface Pro X. Fix by using shared ops for this clock.
--- drivers/clk/qcom/dispcc-sm8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8250.c +1 -1
@@ -632,7 +632,7 @@ static struct clk_rcg2 disp_cc_mdss_vsync_clk_src = { .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 570/957 clk: qcom: dispcc-sm8250: Enable parents for pixel clocks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit acf7a91d0b0e9e3ef374944021de62062125b7e4 ]
Add CLK_OPS_PARENT_ENABLE to MDSS pixel clock sources to ensure parent clocks are enabled during clock operations, preventing potential stability issues during display configuration.
--- drivers/clk/qcom/dispcc-sm8250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/dispcc-sm8250.c +2 -2
@@ -578,7 +578,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = { .name = "disp_cc_mdss_pclk0_clk_src", .parent_data = disp_cc_parent_data_6, .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
@@ -592,7 +592,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = { .name = "disp_cc_mdss_pclk1_clk_src", .parent_data = disp_cc_parent_data_6, .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 571/957 clk: imx: imx6q: Fix device node reference leak in pll6_bypassed()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 4b84d496c804b470124cd3a08e928df6801d8eae ]
The function pll6_bypassed() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak.
Fix this by adding proper cleanup calls on all exit paths.
--- drivers/clk/imx/clk-imx6q.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-imx6q.c +7 -1
@@ -238,8 +238,11 @@ static bool pll6_bypassed(struct device_node *node)return false;if (clkspec.np == node && - clkspec.args[0 ] ==IMX6QDL_PLL6_BYPASS ) + clkspec.args[0 ] ==IMX6QDL_PLL6_BYPASS ) { +of_node_put (clkspec.np);break ; + } +of_node_put (clkspec.np); }/* PLL6 bypass is not part of the assigned clock list */
@@ -249,6 +252,9 @@ static bool pll6_bypassed(struct device_node *node) ret =of_parse_phandle_with_args (node,"assigned-clock-parents" ,"#clock-cells" , index, &clkspec); +if (!ret) +of_node_put (clkspec.np); +if (clkspec.args[0 ] !=IMX6QDL_CLK_PLL6 )return true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 572/957 clk: imx: imx6q: Fix device node reference leak in of_assigned_ldb_sels()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 9faf207208951460f3f7eefbc112246c8d28ff1b ]
The function of_assigned_ldb_sels() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak.
Fix this by adding proper cleanup calls on all exit paths.
--- drivers/clk/imx/clk-imx6q.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/imx/clk-imx6q.c +4 -0
@@ -188,9 +188,11 @@ static void of_assigned_ldb_sels(struct device_node *node, }if (clkspec.np != node || clkspec.args[0 ] >=IMX6QDL_CLK_END ) {pr_err ("ccm: parent clock %d not in ccm\n" , index); +of_node_put (clkspec.np);return ; } parent = clkspec.args[0 ]; +of_node_put (clkspec.np); rc =of_parse_phandle_with_args (node,"assigned-clocks" ,"#clock-cells" , index, &clkspec);
@@ -198,9 +200,11 @@ static void of_assigned_ldb_sels(struct device_node *node,return ;if (clkspec.np != node || clkspec.args[0 ] >=IMX6QDL_CLK_END ) {pr_err ("ccm: child clock %d not in ccm\n" , index); +of_node_put (clkspec.np);return ; } child = clkspec.args[0 ]; +of_node_put (clkspec.np);if (child !=IMX6QDL_CLK_LDB_DI0_SEL && child !=IMX6QDL_CLK_LDB_DI1_SEL )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 573/957 clk: imx8mq: Correct the CSI PHY sels
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit d16f57caa78776e6e8a88b96cb2597797b376138 ]
According to i.MX 8M Quad Reference Manual (Section 5.1.2 Table 5-1) MIPI_CSI1_PHY_REF_CLK_ROOT and MIPI_CSI2_PHY_REF_CLK_ROOT have SYSTEM_PLL2_DIV3 available as their second source, which corresponds to sys2_pll_333m rather than sys2_pll_125m.
--- drivers/clk/imx/clk-imx8mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx8mq.c +2 -2
@@ -237,7 +237,7 @@ static const char * const imx8mq_dsi_esc_sels[] = {"osc_25m", "sys2_pll_100m", "static const char *const imx8mq_csi1_core_sels[] = {"osc_25m" ,"sys1_pll_266m" ,"sys2_pll_250m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"sys3_pll_out" ,"audio_pll2_out" ,"video_pll1_out" , }; -static const char *const imx8mq_csi1_phy_sels[] = {"osc_25m" ,"sys2_pll_125m" ,"sys2_pll_100m" ,"sys1_pll_800m" , +static const char *const imx8mq_csi1_phy_sels[] = {"osc_25m" ,"sys2_pll_333m" ,"sys2_pll_100m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"clk_ext2" ,"audio_pll2_out" ,"video_pll1_out" , };static const char *const imx8mq_csi1_esc_sels[] = {"osc_25m" ,"sys2_pll_100m" ,"sys1_pll_80m" ,"sys1_pll_800m" ,
@@ -246,7 +246,7 @@ static const char * const imx8mq_csi1_esc_sels[] = {"osc_25m", "sys2_pll_100m",static const char *const imx8mq_csi2_core_sels[] = {"osc_25m" ,"sys1_pll_266m" ,"sys2_pll_250m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"sys3_pll_out" ,"audio_pll2_out" ,"video_pll1_out" , }; -static const char *const imx8mq_csi2_phy_sels[] = {"osc_25m" ,"sys2_pll_125m" ,"sys2_pll_100m" ,"sys1_pll_800m" , +static const char *const imx8mq_csi2_phy_sels[] = {"osc_25m" ,"sys2_pll_333m" ,"sys2_pll_100m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"clk_ext2" ,"audio_pll2_out" ,"video_pll1_out" , };static const char *const imx8mq_csi2_esc_sels[] = {"osc_25m" ,"sys2_pll_100m" ,"sys1_pll_80m" ,"sys1_pll_800m" ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 574/957 x86/um/vdso: Drop VDSO64-y from Makefile
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 3c9b904f9033fb250db72d258bbdec791dc89405 ]
This symbol is unnecessary, remove it.
Stable-dep-of: d1895c15fc7d ("x86/um: fix vDSO installation")
--- arch/x86/um/vdso/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/um/vdso/Makefile +2 -5
@@ -3,16 +3,13 @@ # Building vDSO images for x86. # -VDSO64-y := y - -vdso-install-$(VDSO64-y) += vdso.so - +vdso-install-y += vdso.so # files to link into the vdso vobjs-y := vdso-note.o um_vdso.o # files to link into kernel -obj-$(VDSO64-y) += vdso.o vma.o +obj-y += vdso.o vma.o vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 575/957 x86/um: fix vDSO installation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit d1895c15fc7d90a615bc8c455feb02acaf08ef1e ]
The generic vDSO installation logic used by 'make vdso_install' requires that $(vdso-install-y) is defined by the top-level architecture Makefile and that it contains a path relative to the root of the tree. For UML neither of these is satisfied.
Move the definition of $(vdso-install-y) to a place which is included by the arch/um/Makefile and use the full relative path.
--- arch/x86/Makefile.um | 2 ++ arch/x86/um/vdso/Makefile | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/Makefile.um +2 -0
@@ -60,4 +60,6 @@ ELF_FORMAT := elf64-x86-64 LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64 LINK-y += -m64 +vdso-install-y += arch/x86/um/vdso/vdso.so.dbg + endif
arch/x86/um/vdso/Makefile +0 -2
@@ -3,8 +3,6 @@ # Building vDSO images for x86. # -vdso-install-y += vdso.so - # files to link into the vdso vobjs-y := vdso-note.o um_vdso.o
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 576/957 clk: qoriq: avoid format string warning
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 096abbb6682ee031a0f5ce9f4c71ead9fa63d31e ]
clang-22 warns about the use of non-variadic format arguments passed into snprintf():
drivers/clk/clk-qoriq.c:925:39: error: diagnostic behavior may be improved by adding the
'format(printf, 7, 8)' attribute to the declaration of 'create_mux_common' [-Werror,-Wmissing-format-attribute]
910 | static struct clk * __init create_mux_common(struct clockgen *cg,
| __attribute__((format(printf, 7, 8)))
911 | struct mux_hwclock *hwc,
912 | const struct clk_ops *ops,
913 | unsigned long min_rate,
914 | unsigned long max_rate,
915 | unsigned long pct80_rate,
916 | const char *fmt, int idx)
917 | {
918 | struct clk_init_data init = {};
919 | struct clk *clk;
920 | const struct clockgen_pll_div *div;
921 | const char *parent_names[NUM_MUX_PARENTS];
922 | char name[32];
923 | int i, j;
924 |
925 | snprintf(name, sizeof(name), fmt, idx);
| ^drivers/clk/clk-qoriq.c:910:28: note: 'create_mux_common' declared here
910 | static struct clk * __init create_mux_common(struct clockgen *cg,
Rework this to pass the 'int idx' as a varargs argument, allowing the format string to be verified at the caller location.
--- drivers/clk/clk-qoriq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/clk/clk-qoriq.c +9 -8
@@ -907,13 +907,11 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg,return &cg->pll[pll].div[div]; } -static struct clk *__init create_mux_common (struct clockgen *cg, -struct mux_hwclock *hwc, -const struct clk_ops *ops, -unsigned long min_rate, -unsigned long max_rate, -unsigned long pct80_rate, -const char *fmt,int idx) +static struct clk * __init __printf(7, 8) +create_mux_common(struct clockgen *cg, struct mux_hwclock *hwc, + const struct clk_ops *ops, unsigned long min_rate, + unsigned long max_rate, unsigned long pct80_rate, + const char *fmt, ...) { struct clk_init_data init = {};struct clk *clk;
@@ -921,8 +919,11 @@ static struct clk * __init create_mux_common(struct clockgen *cg,const char *parent_names[NUM_MUX_PARENTS ];char name[32 ];int i, j; +va_list args; -snprintf (name,sizeof (name), fmt, idx); +va_start (args, fmt); +vsnprintf (name,sizeof (name), fmt, args); +va_end (args);for (i =0 , j =0 ; i <NUM_MUX_PARENTS ; i++) {unsigned long rate;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 577/957 clk: xgene: Fix mapping leak in xgene_pllclk_init()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f520a492e07bc6718e26cfb7543ab4cadd8bb0e2 ]
If xgene_register_clk_pll() fails, the mapped register block is never unmapped.
--- drivers/clk/clk-xgene.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/clk-xgene.c +2 -0
@@ -188,6 +188,8 @@ static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_tyof_clk_add_provider (np, of_clk_src_simple_get, clk);clk_register_clkdev (clk, clk_name,NULL );pr_debug ("Add %s clock PLL\n" , clk_name); + }else { +iounmap (reg); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 578/957 dt-bindings: clock: qcom,dispcc-sc7180: Define MDSS resets
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit fc6e29d42872680dca017f2e5169eefe971f8d89 ]
The MDSS resets have so far been left undescribed. Fix that.
Stable-dep-of: b0bc6011c549 ("clk: qcom: dispcc-sc7180: Add missing MDSS resets")
--- include/dt-bindings/clock/qcom,dispcc-sc7180.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/dt-bindings/clock/qcom,dispcc-sc7180.h +6 -1
@@ -6,6 +6,7 @@#ifndef _DT_BINDINGS_CLK_QCOM_DISP_CC_SC7180_H#define _DT_BINDINGS_CLK_QCOM_DISP_CC_SC7180_H +/* Clocks */ #define DISP_CC_PLL0 0#define DISP_CC_PLL0_OUT_EVEN 1#define DISP_CC_MDSS_AHB_CLK 2
@@ -40,7 +41,11 @@#define DISP_CC_MDSS_VSYNC_CLK_SRC 31#define DISP_CC_XO_CLK 32 -/* DISP_CC GDSCR */ +/* Resets */ +#define DISP_CC_MDSS_CORE_BCR 0 +#define DISP_CC_MDSS_RSCC_BCR 1 + +/* GDSCs */ #define MDSS_GDSC 0#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 579/957 clk: qcom: dispcc-sc7180: Add missing MDSS resets
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit b0bc6011c5499bdfddd0390262bfa13dce1eff74 ]
The MDSS resets have so far been left undescribed. Fix that.
--- drivers/clk/qcom/dispcc-sc7180.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/dispcc-sc7180.c +8 -0
@@ -17,6 +17,7 @@#include "clk-regmap-divider.h" #include "common.h" #include "gdsc.h" +#include "reset.h" enum {P_BI_TCXO ,
@@ -636,6 +637,11 @@ static struct gdsc mdss_gdsc = { .flags = HW_CTRL, }; +static const struct qcom_reset_map disp_cc_sc7180_resets[] = { + [DISP_CC_MDSS_CORE_BCR ] = {0x2000 }, + [DISP_CC_MDSS_RSCC_BCR ] = {0x4000 }, +}; +static struct gdsc *disp_cc_sc7180_gdscs[] = { [MDSS_GDSC ] = &mdss_gdsc, };
@@ -687,6 +693,8 @@ static const struct qcom_cc_desc disp_cc_sc7180_desc = { .config = &disp_cc_sc7180_regmap_config, .clks = disp_cc_sc7180_clocks, .num_clks = ARRAY_SIZE(disp_cc_sc7180_clocks), + .resets = disp_cc_sc7180_resets, + .num_resets = ARRAY_SIZE(disp_cc_sc7180_resets), .gdscs = disp_cc_sc7180_gdscs, .num_gdscs = ARRAY_SIZE(disp_cc_sc7180_gdscs), };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 580/957 clk: spacemit: ccu_mix: fix inverted condition in ccu_mix_trigger_fc()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuwei Wu <[email protected]>
[ Upstream commit 54e97360b44bed6b4399dd3be3d65f392df940fa ]
Fix inverted condition that skips frequency change trigger, causing kernel panics during cpufreq scaling.
--- drivers/clk/spacemit/ccu_mix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/spacemit/ccu_mix.c +1 -1
@@ -69,7 +69,7 @@ static int ccu_mix_trigger_fc(struct clk_hw *hw)struct ccu_common *common =hw_to_ccu_common (hw);unsigned int val; -if (common->reg_fc) +if (!common->reg_fc)return 0 ;ccu_update (common, fc, common->mask_fc, common->mask_fc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 581/957 f2fs: use f2fs_filemap_get_folio() instead of f2fs_pagecache_get_page()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit e0b89d00ea9f846da42fc92f200c96254d0e2fef ]
Let's use f2fs_filemap_get_folio() instead of f2fs_pagecache_get_page() in ra_data_block() and move_data_block(), then remove f2fs_pagecache_get_page() since it has no user.
Stable-dep-of: 570e2ccc7cb3 ("f2fs: avoid reading already updated pages during GC")
--- fs/f2fs/f2fs.h | 10 ---------- fs/f2fs/gc.c | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-)
fs/f2fs/f2fs.h +0 -10
@@ -2996,16 +2996,6 @@ static inline struct folio *f2fs_filemap_get_folio(return __filemap_get_folio (mapping, index, fgp_flags, gfp_mask); } -static inline struct page *f2fs_pagecache_get_page ( -struct address_space *mapping,pgoff_t index, -fgf_t fgp_flags,gfp_t gfp_mask) -{ -if (time_to_inject (F2FS_M_SB (mapping),FAULT_PAGE_GET )) -return NULL ; - -return pagecache_get_page (mapping, index, fgp_flags, gfp_mask); -} -static inline void f2fs_folio_put (struct folio *folio,bool unlock) {if (IS_ERR_OR_NULL (folio))
fs/f2fs/gc.c +13 -10
@@ -1211,7 +1211,7 @@ static int ra_data_block(struct inode *inode, pgoff_t index)struct address_space *mapping =f2fs_is_cow_file (inode) ?F2FS_I (inode)->atomic_inode->i_mapping : inode->i_mapping;struct dnode_of_data dn; -struct folio *folio; +struct folio *folio, *efolio;struct f2fs_io_info fio = { .sbi = sbi, .ino = inode->i_ino,
@@ -1266,14 +1266,15 @@ static int ra_data_block(struct inode *inode, pgoff_t index)f2fs_wait_on_block_writeback (inode, dn.data_blkaddr); - fio.encrypted_page =f2fs_pagecache_get_page (META_MAPPING (sbi), - dn.data_blkaddr, + efolio =f2fs_filemap_get_folio (META_MAPPING (sbi), dn.data_blkaddr,FGP_LOCK |FGP_CREAT ,GFP_NOFS ); -if (!fio.encrypted_page) { - err = -ENOMEM ; +if (IS_ERR (efolio)) { + err =PTR_ERR (efolio); goto put_folio; } + fio.encrypted_page = &efolio->page; + err =f2fs_submit_page_bio (&fio);if (err) goto put_encrypted_page;
@@ -1313,7 +1314,7 @@ static int move_data_block(struct inode *inode, block_t bidx,struct dnode_of_data dn;struct f2fs_summary sum;struct node_info ni; -struct folio *folio, *mfolio; +struct folio *folio, *mfolio, *efolio;block_t newaddr;int err =0 ;bool lfs_mode =f2fs_lfs_mode (fio.sbi);
@@ -1407,14 +1408,16 @@ static int move_data_block(struct inode *inode, block_t bidx, goto up_out; } - fio.encrypted_page =f2fs_pagecache_get_page (META_MAPPING (fio.sbi), - newaddr,FGP_LOCK |FGP_CREAT ,GFP_NOFS ); -if (!fio.encrypted_page) { - err = -ENOMEM ; + efolio =f2fs_filemap_get_folio (META_MAPPING (fio.sbi), newaddr, +FGP_LOCK |FGP_CREAT ,GFP_NOFS ); +if (IS_ERR (efolio)) { + err =PTR_ERR (efolio);f2fs_folio_put (mfolio, true); goto recover_block; } + fio.encrypted_page = &efolio->page; +/* write target block */ f2fs_wait_on_page_writeback (fio.encrypted_page,DATA , true, true); memcpy(page_address(fio.encrypted_page),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 582/957 f2fs: avoid reading already updated pages during GC
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianan Huang <[email protected]>
[ Upstream commit 570e2ccc7cb35fe720106964e65060602d3d2ac4 ]
We found the following issue during fuzz testing:
page: refcount:3 mapcount:0 mapping:00000000b6e89c65 index:0x18b2dc pfn:0x161ba9 memcg:f8ffff800e269c00 aops:f2fs_meta_aops ino:2 flags: 0x52880000000080a9(locked|waiters|uptodate|lru|private|zone=1|kasantag=0x4a) raw: 52880000000080a9 fffffffec6e17588 fffffffec0ccc088 a7ffff8067063618 raw: 000000000018b2dc 0000000000000009 00000003ffffffff f8ffff800e269c00 page dumped because: VM_BUG_ON_FOLIO(folio_test_uptodate(folio)) page_owner tracks the page as allocated post_alloc_hook+0x58c/0x5ec prep_new_page+0x34/0x284 get_page_from_freelist+0x2dcc/0x2e8c __alloc_pages_noprof+0x280/0x76c __folio_alloc_noprof+0x18/0xac __filemap_get_folio+0x6bc/0xdc4 pagecache_get_page+0x3c/0x104 do_garbage_collect+0x5c78/0x77a4 f2fs_gc+0xd74/0x25f0 gc_thread_func+0xb28/0x2930 kthread+0x464/0x5d8 ret_from_fork+0x10/0x20 ------------[ cut here ]------------ kernel BUG at mm/filemap.c:1563! folio_end_read+0x140/0x168 f2fs_finish_read_bio+0x5c4/0xb80 f2fs_read_end_io+0x64c/0x708 bio_endio+0x85c/0x8c0 blk_update_request+0x690/0x127c scsi_end_request+0x9c/0xb8c scsi_io_completion+0xf0/0x250 scsi_finish_command+0x430/0x45c scsi_complete+0x178/0x6d4 blk_mq_complete_request+0xcc/0x104 scsi_done_internal+0x214/0x454 scsi_done+0x24/0x34
which is similar to the problem reported by syzbot:
https://syzkaller.appspot.com/bug?extid=3686758660f980b402dc
This case is consistent with the description in commit 9bf1a3f ("f2fs: avoid GC causing encrypted file corrupted"):
Page 1 is moved from blkaddr A to blkaddr B by move_data_block, and after being written it is marked as uptodate. Then, Page 1 is moved from blkaddr B to blkaddr C, VM_BUG_ON_FOLIO was triggered in the endio initiated by ra_data_block.
There is no need to read Page 1 again from blkaddr B, since it has already been updated. Therefore, avoid initiating I/O in this case.
--- fs/f2fs/gc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +4 -1
@@ -1222,7 +1222,7 @@ static int ra_data_block(struct inode *inode, pgoff_t index) .encrypted_page = NULL, .in_list = 0, }; -int err; +int err =0 ; folio =f2fs_grab_cache_folio (mapping, index, true);if (IS_ERR (folio))
@@ -1275,6 +1275,9 @@ static int ra_data_block(struct inode *inode, pgoff_t index) fio.encrypted_page = &efolio->page; +if (folio_test_uptodate (efolio)) + goto put_encrypted_page; + err =f2fs_submit_page_bio (&fio);if (err) goto put_encrypted_page;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 583/957 clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <[email protected]>
[ Upstream commit 16ba98dace9e7cfe25ad8a314e34befacd91f86f ]
Some pm subdomains may be left in added to a parent domain state, if gdsc_add_subdomain_list() function fails in the middle and bails from a GDSC power domain controller registration out.
--- drivers/clk/qcom/gdsc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/clk/qcom/gdsc.c +11 -1
@@ -518,10 +518,20 @@ static int gdsc_add_subdomain_list(struct dev_pm_domain_list *pd_list, ret =pm_genpd_add_subdomain (genpd, subdomain);if (ret) -return ret; + goto remove_added_subdomains; }return 0 ; + +remove_added_subdomains: +for (i--; i >=0 ; i--) { +struct device *dev = pd_list->pd_devs[i]; +struct generic_pm_domain *genpd =pd_to_genpd (dev->pm_domain); + +pm_genpd_remove_subdomain (genpd, subdomain); + } + +return ret; } static void gdsc_remove_subdomain_list(struct dev_pm_domain_list *pd_list,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 584/957 lib/hexdump: print_hex_dump_bytes() calls print_hex_dump_debug()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 36776b7f8a8955b4e75b5d490a75fee0c7a2a7ef ]
print_hex_dump_bytes() claims to be a simple wrapper around print_hex_dump(), but it actally calls print_hex_dump_debug(), which means no output is printed if (dynamic) DEBUG is disabled.
Update the documentation to match the implementation.
--- include/linux/printk.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/printk.h +3 -2
@@ -816,7 +816,8 @@ static inline void print_hex_dump_devel(const char *prefix_str, int prefix_type,#endif /** -* print_hex_dump_bytes - shorthand form of print_hex_dump() with default params +* print_hex_dump_bytes - shorthand form of print_hex_dump_debug() with default +* params * @prefix_str: string to prefix each line with; * caller supplies trailing spaces for alignment if desired * @prefix_type: controls whether prefix of an offset, address, or none
@@ -824,7 +825,7 @@ static inline void print_hex_dump_devel(const char *prefix_str, int prefix_type,* @buf: data blob to dump * @len: number of bytes in the @buf * -* Calls print_hex_dump(), with log level of KERN_DEBUG, +* Calls print_hex_dump_debug(), with log level of KERN_DEBUG, * rowsize of 16, groupsize of 1, and ASCII output included. */ #define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 585/957 f2fs: expand scalability of f2fs mount option
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 1627a303bca692edc6552630aa2f878c8a726a01 ]
opt field in structure f2fs_mount_info and opt_mask field in structure f2fs_fs_context is 32-bits variable, now we're running out of available bits in them, let's expand them to 64-bits for better scalability.
Stable-dep-of: 01968164d947 ("f2fs: fix to preserve previous reserve_{blocks,node} value when remount")
--- fs/f2fs/f2fs.h | 85 ++++++++++++++++++++++++++----------------------- fs/f2fs/super.c | 36 ++++++++++----------- 2 files changed, 63 insertions(+), 58 deletions(-)
fs/f2fs/f2fs.h +45 -40
@@ -96,47 +96,52 @@ extern const char *f2fs_fault_name[FAULT_MAX];/* * For mount options */ -#define F2FS_MOUNT_DISABLE_ROLL_FORWARD 0x00000001 -#define F2FS_MOUNT_DISCARD 0x00000002 -#define F2FS_MOUNT_NOHEAP 0x00000004 -#define F2FS_MOUNT_XATTR_USER 0x00000008 -#define F2FS_MOUNT_POSIX_ACL 0x00000010 -#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000020 -#define F2FS_MOUNT_INLINE_XATTR 0x00000040 -#define F2FS_MOUNT_INLINE_DATA 0x00000080 -#define F2FS_MOUNT_INLINE_DENTRY 0x00000100 -#define F2FS_MOUNT_FLUSH_MERGE 0x00000200 -#define F2FS_MOUNT_NOBARRIER 0x00000400 -#define F2FS_MOUNT_FASTBOOT 0x00000800 -#define F2FS_MOUNT_READ_EXTENT_CACHE 0x00001000 -#define F2FS_MOUNT_DATA_FLUSH 0x00002000 -#define F2FS_MOUNT_FAULT_INJECTION 0x00004000 -#define F2FS_MOUNT_USRQUOTA 0x00008000 -#define F2FS_MOUNT_GRPQUOTA 0x00010000 -#define F2FS_MOUNT_PRJQUOTA 0x00020000 -#define F2FS_MOUNT_QUOTA 0x00040000 -#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00080000 -#define F2FS_MOUNT_RESERVE_ROOT 0x00100000 -#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x00200000 -#define F2FS_MOUNT_NORECOVERY 0x00400000 -#define F2FS_MOUNT_ATGC 0x00800000 -#define F2FS_MOUNT_MERGE_CHECKPOINT 0x01000000 -#define F2FS_MOUNT_GC_MERGE 0x02000000 -#define F2FS_MOUNT_COMPRESS_CACHE 0x04000000 -#define F2FS_MOUNT_AGE_EXTENT_CACHE 0x08000000 -#define F2FS_MOUNT_NAT_BITS 0x10000000 -#define F2FS_MOUNT_INLINECRYPT 0x20000000 -/* -* Some f2fs environments expect to be able to pass the "lazytime" option -* string rather than using the MS_LAZYTIME flag, so this must remain. -*/ -#define F2FS_MOUNT_LAZYTIME 0x40000000 -#define F2FS_MOUNT_RESERVE_NODE 0x80000000 +enum f2fs_mount_opt { +F2FS_MOUNT_DISABLE_ROLL_FORWARD , +F2FS_MOUNT_DISCARD , +F2FS_MOUNT_NOHEAP , +F2FS_MOUNT_XATTR_USER , +F2FS_MOUNT_POSIX_ACL , +F2FS_MOUNT_DISABLE_EXT_IDENTIFY , +F2FS_MOUNT_INLINE_XATTR , +F2FS_MOUNT_INLINE_DATA , +F2FS_MOUNT_INLINE_DENTRY , +F2FS_MOUNT_FLUSH_MERGE , +F2FS_MOUNT_NOBARRIER , +F2FS_MOUNT_FASTBOOT , +F2FS_MOUNT_READ_EXTENT_CACHE , +F2FS_MOUNT_DATA_FLUSH , +F2FS_MOUNT_FAULT_INJECTION , +F2FS_MOUNT_USRQUOTA , +F2FS_MOUNT_GRPQUOTA , +F2FS_MOUNT_PRJQUOTA , +F2FS_MOUNT_QUOTA , +F2FS_MOUNT_INLINE_XATTR_SIZE , +F2FS_MOUNT_RESERVE_ROOT , +F2FS_MOUNT_DISABLE_CHECKPOINT , +F2FS_MOUNT_NORECOVERY , +F2FS_MOUNT_ATGC , +F2FS_MOUNT_MERGE_CHECKPOINT , +F2FS_MOUNT_GC_MERGE , +F2FS_MOUNT_COMPRESS_CACHE , +F2FS_MOUNT_AGE_EXTENT_CACHE , +F2FS_MOUNT_NAT_BITS , +F2FS_MOUNT_INLINECRYPT , +/* +* Some f2fs environments expect to be able to pass the "lazytime" option +* string rather than using the MS_LAZYTIME flag, so this must remain. +*/ +F2FS_MOUNT_LAZYTIME , +F2FS_MOUNT_RESERVE_NODE , +};#define F2FS_OPTION (sbi) ((sbi)->mount_opt) -#define clear_opt (sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) -#define set_opt (sbi, option) (F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option) -#define test_opt (sbi, option) (F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option) +#define clear_opt (sbi, option) \ + (F2FS_OPTION(sbi).opt &= ~BIT(F2FS_MOUNT_##option)) +#define set_opt (sbi, option) \ + (F2FS_OPTION(sbi).opt |= BIT(F2FS_MOUNT_##option)) +#define test_opt (sbi, option) \ + (F2FS_OPTION(sbi).opt & BIT(F2FS_MOUNT_##option))#define ver_after (a, b) (typecheck(unsigned long long, a) && \ typecheck(unsigned long long, b) && \
@@ -183,7 +188,7 @@ struct f2fs_rwsem { };struct f2fs_mount_info { -unsigned int opt; +unsigned long long opt;block_t root_reserved_blocks;/* root reserved blocks */ block_t root_reserved_nodes;/* root reserved nodes */ kuid_t s_resuid;/* reserved blocks for uid */
fs/f2fs/super.c +18 -18
@@ -352,7 +352,7 @@ static match_table_t f2fs_checkpoint_tokens = {struct f2fs_fs_context {struct f2fs_mount_info info; -unsigned int opt_mask;/* Bits changed */ +unsigned long long opt_mask;/* Bits changed */ unsigned int spec_mask;unsigned short qname_mask; };
@@ -360,23 +360,23 @@ struct f2fs_fs_context {#define F2FS_CTX_INFO (ctx) ((ctx)->info)static inline void ctx_set_opt (struct f2fs_fs_context *ctx, -unsigned int flag) +enum f2fs_mount_opt flag) { - ctx->info.opt |= flag; - ctx->opt_mask |= flag; + ctx->info.opt |=BIT (flag); + ctx->opt_mask |=BIT (flag); }static inline void ctx_clear_opt (struct f2fs_fs_context *ctx, -unsigned int flag) +enum f2fs_mount_opt flag) { - ctx->info.opt &= ~flag; - ctx->opt_mask |= flag; + ctx->info.opt &= ~BIT (flag); + ctx->opt_mask |=BIT (flag); }static inline bool ctx_test_opt (struct f2fs_fs_context *ctx, -unsigned int flag) +enum f2fs_mount_opt flag) { -return ctx->info.opt & flag; +return ctx->info.opt &BIT (flag); } void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
@@ -1371,7 +1371,7 @@ static int f2fs_check_compression(struct fs_context *fc, ctx_test_opt(ctx, F2FS_MOUNT_COMPRESS_CACHE))f2fs_info (sbi,"Image doesn't support compression" );clear_compression_spec (ctx); - ctx->opt_mask &= ~F2FS_MOUNT_COMPRESS_CACHE ; + ctx->opt_mask &= ~BIT (F2FS_MOUNT_COMPRESS_CACHE );return 0 ; }if (ctx->spec_mask & F2FS_SPEC_compress_extension) {
@@ -1439,42 +1439,42 @@ static int f2fs_check_opt_consistency(struct fs_context *fc,return -EINVAL ;if (f2fs_hw_should_discard (sbi) && - (ctx->opt_mask &F2FS_MOUNT_DISCARD ) && + (ctx->opt_mask &BIT (F2FS_MOUNT_DISCARD )) && !ctx_test_opt (ctx,F2FS_MOUNT_DISCARD )) {f2fs_warn (sbi,"discard is required for zoned block devices" );return -EINVAL ; }if (!f2fs_hw_support_discard (sbi) && - (ctx->opt_mask &F2FS_MOUNT_DISCARD ) && + (ctx->opt_mask &BIT (F2FS_MOUNT_DISCARD )) &&ctx_test_opt (ctx,F2FS_MOUNT_DISCARD )) {f2fs_warn (sbi,"device does not support discard" );ctx_clear_opt (ctx,F2FS_MOUNT_DISCARD ); - ctx->opt_mask &= ~F2FS_MOUNT_DISCARD ; + ctx->opt_mask &= ~BIT (F2FS_MOUNT_DISCARD ); }if (f2fs_sb_has_device_alias (sbi) && - (ctx->opt_mask &F2FS_MOUNT_READ_EXTENT_CACHE ) && + (ctx->opt_mask &BIT (F2FS_MOUNT_READ_EXTENT_CACHE )) && !ctx_test_opt (ctx,F2FS_MOUNT_READ_EXTENT_CACHE )) {f2fs_err (sbi,"device aliasing requires extent cache" );return -EINVAL ; }if (test_opt (sbi,RESERVE_ROOT ) && - (ctx->opt_mask &F2FS_MOUNT_RESERVE_ROOT ) && + (ctx->opt_mask &BIT (F2FS_MOUNT_RESERVE_ROOT )) &&ctx_test_opt (ctx,F2FS_MOUNT_RESERVE_ROOT )) {f2fs_info (sbi,"Preserve previous reserve_root=%u" ,F2FS_OPTION (sbi).root_reserved_blocks);ctx_clear_opt (ctx,F2FS_MOUNT_RESERVE_ROOT ); - ctx->opt_mask &= ~F2FS_MOUNT_RESERVE_ROOT ; + ctx->opt_mask &= ~BIT (F2FS_MOUNT_RESERVE_ROOT ); }if (test_opt (sbi,RESERVE_NODE ) && - (ctx->opt_mask &F2FS_MOUNT_RESERVE_NODE ) && + (ctx->opt_mask &BIT (F2FS_MOUNT_RESERVE_NODE )) &&ctx_test_opt (ctx,F2FS_MOUNT_RESERVE_NODE )) {f2fs_info (sbi,"Preserve previous reserve_node=%u" ,F2FS_OPTION (sbi).root_reserved_nodes);ctx_clear_opt (ctx,F2FS_MOUNT_RESERVE_NODE ); - ctx->opt_mask &= ~F2FS_MOUNT_RESERVE_NODE ; + ctx->opt_mask &= ~BIT (F2FS_MOUNT_RESERVE_NODE ); } err =f2fs_check_test_dummy_encryption (fc, sb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 586/957 f2fs: fix to preserve previous reserve_{blocks,node} value when remount
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiguo Niu <[email protected]>
[ Upstream commit 01968164d94762db2f703647c5acfa28613844f1 ]
The following steps will change previous value of reserve_{blocks,node}, this dones not match the original intention.
1.mount -t f2fs -o reserve_root=8192 imgfile test_mount/
F2FS-fs (loop56): Mounted with checkpoint version = 1b69f8c7
mount info:/dev/block/loop56 on /data/test_mount type f2fs (xxx,reserve_root=8192,reserve_node=0,resuid=0,resgid=0,xxx)
2.mount -t f2fs -o remount,reserve_root=4096 /data/test_mount
F2FS-fs (loop56): Preserve previous reserve_root=8192
check mount info: reserve_root change to 4096/dev/block/loop56 on /data/test_mount type f2fs (xxx,reserve_root=4096,reserve_node=0,resuid=0,resgid=0,xxx)
Prior to commit d18535132523 ("f2fs: separate the options parsing and options checking"), the value of reserve_{blocks,node} was only set during the first mount, along with the corresponding mount option F2FS_MOUNT_RESERVE_{ROOT,NODE} . If the mount option F2FS_MOUNT_RESERVE_{ROOT,NODE} was found to have been set during the mount/remount, the previously value of reserve_{blocks,node} would also be preserved, as shown in the code below.
if (test_opt(sbi, RESERVE_ROOT)) {
f2fs_info(sbi, "Preserve previous reserve_root=%u",
F2FS_OPTION(sbi).root_reserved_blocks);
} else {
F2FS_OPTION(sbi).root_reserved_blocks = arg;
set_opt(sbi, RESERVE_ROOT);
}But commit d18535132523 ("f2fs: separate the options parsing and options checking") only preserved the previous mount option; it did not preserve the previous value of reserve_{blocks,node}. Since value of reserve_{blocks,node} value is assigned or not depends on ctx->spec_mask, ctx->spec_mask should be alos handled in f2fs_check_opt_consistency.
This patch will clear the corresponding ctx->spec_mask bits in f2fs_check_opt_consistency to preserve the previously values of reserve_{blocks,node} if it already have a value.
--- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/super.c +2 -0
@@ -1467,6 +1467,7 @@ static int f2fs_check_opt_consistency(struct fs_context *fc, F2FS_OPTION(sbi).root_reserved_blocks);ctx_clear_opt (ctx,F2FS_MOUNT_RESERVE_ROOT ); ctx->opt_mask &= ~BIT (F2FS_MOUNT_RESERVE_ROOT ); + ctx->spec_mask &= ~F2FS_SPEC_reserve_root; } if (test_opt(sbi, RESERVE_NODE) && (ctx->opt_mask & BIT(F2FS_MOUNT_RESERVE_NODE)) &&
@@ -1475,6 +1476,7 @@ static int f2fs_check_opt_consistency(struct fs_context *fc, F2FS_OPTION(sbi).root_reserved_nodes);ctx_clear_opt (ctx,F2FS_MOUNT_RESERVE_NODE ); ctx->opt_mask &= ~BIT (F2FS_MOUNT_RESERVE_NODE ); + ctx->spec_mask &= ~F2FS_SPEC_reserve_node; } err =f2fs_check_test_dummy_encryption (fc, sb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 587/957 clk: qcom: gcc-x1e80100: Keep GCC USB QTB clock always ON
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jagadeesh Kona <[email protected]>
[ Upstream commit 05566ebcc0cd170bd4f50c907ee3ed8e106251e3 ]
In Hamoa, SMMU invalidation requires the GCC_AGGRE_USB_NOC_AXI_CLK to be on for the USB QTB to be functional. This is currently explicitly enabled by the DWC3 glue driver, so an invalidation happening while the USB controller is suspended will fault.
Solve this by voting for the GCC MMU USB QTB clock.
--- drivers/clk/qcom/gcc-x1e80100.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-x1e80100.c +1 -0
@@ -6751,6 +6751,7 @@ static int gcc_x1e80100_probe(struct platform_device *pdev)qcom_branch_set_clk_en (regmap,0x32004 );/* GCC_VIDEO_AHB_CLK */ qcom_branch_set_clk_en (regmap,0x32030 );/* GCC_VIDEO_XO_CLK */ qcom_branch_set_clk_en (regmap,0x71004 );/* GCC_GPU_CFG_AHB_CLK */ +qcom_branch_set_clk_en (regmap,0x7d01c );/* GCC_HLOS1_VOTE_AGGRE_NOC_MMU_USB_QTB_CLK */ /* Clear GDSC_SLEEP_ENA_VOTE to stop votes being auto-removed in sleep. */ regmap_write (regmap,0x52224 ,0x0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 588/957 clk: visconti: pll: initialize clk_init_data to zero
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Masney <[email protected]>
[ Upstream commit 1603cbb64173a0e9fa7500f2a686f4aa011c58b9 ]
Sashiko reported the following:
Quoted 4 lines
The struct
clk_init_datainit is declared on the stack without being fully zero-initialized. While fields like name, flags,parent_names,num_parents, and ops are explicitly assigned, theparent_dataandparent_hwsfields are left containing stack garbage.
clk_core_populate_parent_map() currently prefers the parent names over the parent data and hws, so this isn't a problem at the moment. If that ordering ever changed in the future, then this could lead to some unexpected crashes. Let's just go ahead and make sure that the struct clk_init_data is initialized to zero as a good practice.
--- drivers/clk/visconti/pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/visconti/pll.c +1 -1
@@ -249,7 +249,7 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx,const struct visconti_pll_rate_table *rate_table, spinlock_t *lock) { - struct clk_init_data init; + struct clk_init_data init = {};struct visconti_pll *pll;struct clk_hw *pll_hw_clk;size_t len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 589/957 f2fs: allow empty mount string for Opt_usr|grp|projjquota
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
[ Upstream commit 2a3db1e02ce08c14af04da70bb99e8a0a31eb9e8 ]
The fsparam_string_empty() gives an error when mounting without string, since its type is set to fsparam_flag in VFS. So, let's allow the flag as well.
This addresses xfstests/f2fs/015 and f2fs/021.
--- fs/f2fs/super.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
fs/f2fs/super.c +15 -12
@@ -285,9 +285,12 @@ static const struct fs_parameter_spec f2fs_param_specs[] = {fsparam_flag ("usrquota" , Opt_usrquota),fsparam_flag ("grpquota" , Opt_grpquota),fsparam_flag ("prjquota" , Opt_prjquota), -fsparam_string_empty ("usrjquota" , Opt_usrjquota), -fsparam_string_empty ("grpjquota" , Opt_grpjquota), -fsparam_string_empty ("prjjquota" , Opt_prjjquota), +fsparam_string ("usrjquota" , Opt_usrjquota), +fsparam_flag ("usrjquota" , Opt_usrjquota), +fsparam_string ("grpjquota" , Opt_grpjquota), +fsparam_flag ("grpjquota" , Opt_grpjquota), +fsparam_string ("prjjquota" , Opt_prjjquota), +fsparam_flag ("prjjquota" , Opt_prjjquota),fsparam_flag ("nat_bits" , Opt_nat_bits),fsparam_enum ("jqfmt" , Opt_jqfmt, f2fs_param_jqfmt), fsparam_enum("alloc_mode", Opt_alloc, f2fs_param_alloc_mode),
@@ -931,26 +934,26 @@ static int f2fs_parse_param(struct fs_context *fc, struct fs_parameter *param)ctx_set_opt (ctx,F2FS_MOUNT_PRJQUOTA );break ;case Opt_usrjquota: -if (!*param->string) - ret =f2fs_unnote_qf_name (fc,USRQUOTA ); -else +if (param->type == fs_value_is_string && *param->string) ret =f2fs_note_qf_name (fc,USRQUOTA , param); +else + ret =f2fs_unnote_qf_name (fc,USRQUOTA );if (ret)return ret;break ;case Opt_grpjquota: -if (!*param->string) - ret =f2fs_unnote_qf_name (fc,GRPQUOTA ); -else +if (param->type == fs_value_is_string && *param->string) ret =f2fs_note_qf_name (fc,GRPQUOTA , param); +else + ret =f2fs_unnote_qf_name (fc,GRPQUOTA );if (ret)return ret;break ;case Opt_prjjquota: -if (!*param->string) - ret =f2fs_unnote_qf_name (fc,PRJQUOTA ); -else +if (param->type == fs_value_is_string && *param->string) ret =f2fs_note_qf_name (fc,PRJQUOTA , param); +else + ret =f2fs_unnote_qf_name (fc,PRJQUOTA );if (ret)return ret;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 590/957 f2fs: protect extension_list reading with sb_lock in f2fs_sbi_show()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongpeng Yang <[email protected]>
[ Upstream commit 5909bedbed38c558bee7cb6758ceedf9bc3a9194 ]
In f2fs_sbi_show(), the extension_list, extension_count and hot_ext_count are read without holding sbi->sb_lock. If a concurrent sysfs store modifies the extension list via f2fs_update_extension_list(), the show path may read inconsistent count and array contents, potentially leading to out-of-bounds access or displaying stale data.
Fix this by holding sb_lock around the entire extension list read and format operation.
--- fs/f2fs/sysfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +5 -2
@@ -377,10 +377,12 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,if (!strcmp (a->attr.name,"extension_list" )) {__u8 (*extlist)[F2FS_EXTENSION_LEN ] = sbi->raw_super->extension_list; -int cold_count =le32_to_cpu (sbi->raw_super->extension_count); -int hot_count = sbi->raw_super->hot_ext_count; +int cold_count, hot_count;int len =0 , i; +f2fs_down_read (&sbi->sb_lock); + cold_count =le32_to_cpu (sbi->raw_super->extension_count); + hot_count = sbi->raw_super->hot_ext_count; len +=sysfs_emit_at (buf, len,"cold file extension:\n" );for (i =0 ; i < cold_count; i++) len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]);
@@ -388,6 +390,7 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a, len +=sysfs_emit_at (buf, len,"hot file extension:\n" );for (i = cold_count; i < cold_count + hot_count; i++) len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]); +f2fs_up_read (&sbi->sb_lock);return len; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 591/957 drm/i915/wm: Verify the correct plane DDB entry
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
[ Upstream commit a97c88a176b6b8d116f4d3f508f3bd02bc77b462 ]
Actually verify the DDB entry for the plane we're looking at instead of always verifying the cursor DDB.
--- drivers/gpu/drm/i915/display/skl_watermark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/skl_watermark.c +2 -2
@@ -3935,8 +3935,8 @@ void intel_wm_state_verify(struct intel_atomic_state *state, }/* DDB */ - hw_ddb_entry = &hw->ddb[PLANE_CURSOR ]; - sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[PLANE_CURSOR ]; + hw_ddb_entry = &hw->ddb[plane->id]; + sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[plane->id];if (!skl_ddb_entry_equal (hw_ddb_entry, sw_ddb_entry)) { drm_err(display->drm,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 592/957 virt: arm-cca-guest: fix error check for RSI_INCOMPLETE
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sami Mujawar <[email protected]>
[ Upstream commit e534e9d13d0b7bdbb2cccdace7b96b769a10540e ]
The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.
Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.
This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.
--- drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +2 -1
@@ -157,7 +157,8 @@ static int arm_cca_report_new(struct tsm_report *report, void *data) }while (info.result ==RSI_INCOMPLETE && info.offset <RSI_GRANULE_SIZE ); -if (info.result !=RSI_SUCCESS ) { +/* Break out in case of failure */ +if (info.result !=RSI_SUCCESS && info.result !=RSI_INCOMPLETE ) { ret = -ENXIO ; token_size =0 ; goto exit_free_granule_page;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 593/957 crypto: eip93 - fix hmac setkey algo selection
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 3ba3b02f897b14e34977e1886d95ffe64d907204 ]
eip93_hmac_setkey() allocates a temporary ahash transform for computing HMAC ipad/opad key material. The allocation uses the driver-specific cra_driver_name (e.g. "sha256-eip93") but passes CRYPTO_ALG_ASYNC as the mask, which excludes async algorithms.
Since the EIP93 hash algorithms are the only ones registered under those driver names and they are inherently async, the lookup is self-contradictory and always fails with -ENOENT.
When called from the AEAD setkey path, this failure leaves the SA record partially initialized with zeroed digest fields. A subsequent crypto operation then dereferences a NULL pointer in the request context, resulting in a kernel panic:
``` pc : eip93_aead_handle_result+0xc8c/0x1240 [crypto_hw_eip93] lr : eip93_aead_handle_result+0xbec/0x1240 [crypto_hw_eip93] sp : ffffffc082feb820 x29: ffffffc082feb820 x28: ffffff8011043980 x27: 0000000000000000 x26: 0000000000000000 x25: ffffffc078da0bc8 x24: 0000000091043980 x23: ffffff8004d59e50 x22: ffffff8004d59410 x21: ffffff8004d593c0 x20: ffffff8004d593c0 x19: ffffff8004d4f300 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000007fda7aa498 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000000 x10: fffffffff8127a80 x9 : 0000000000000000 x8 : ffffff8004d4f380 x7 : 0000000000000000 x6 : 000000000000003f x5 : 0000000000000040 x4 : 0000000000000008 x3 : 0000000000000009 x2 : 0000000000000008 x1 : 0000000028000003 x0 : ffffff8004d388c0 Code: 910142b6 f94012e0 f9002aa0 f90006d3 (f9400740) ```
The reported symbol eip93_aead_handle_result+0xc8c is a resolution artifact from static functions being merged under the nearest exported symbol. Decoding the faulting sequence:
``` 910142b6 ADD X22, X21, #0x50 f94012e0 LDR X0, [X23, #0x20] f9002aa0 STR X0, [X21, #0x50] f90006d3 STR X19, [X22, #0x8] f9400740 LDR X0, [X26, #0x8] ```
The faulting LDR at [X26, #0x8] is loading ctx->flags (offset 8 in eip93_hash_ctx), where ctx has been resolved to NULL from a partially initialized or unreachable transform context following the failed setkey.
Fix this by dropping the CRYPTO_ALG_ASYNC mask from the crypto_alloc_ahash() call. The code already handles async completion correctly via crypto_wait_req(), so there is no requirement to restrict the lookup to synchronous algorithms.
Note that hashing a single 64-byte block through the hardware is likely slower than doing it in software due to the DMA round-trip overhead, but offloading it may still spare CPU cycles on the slower embedded cores where this IP is found.
--- drivers/crypto/inside-secure/eip93/eip93-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/inside-secure/eip93/eip93-common.c +1 -1
@@ -731,7 +731,7 @@ int eip93_hmac_setkey(u32 ctx_flags, const u8 *key, unsigned int keylen,return -EINVAL ; } - ahash_tfm =crypto_alloc_ahash (alg_name,0 ,CRYPTO_ALG_ASYNC ); + ahash_tfm =crypto_alloc_ahash (alg_name,0 ,0 );if (IS_ERR (ahash_tfm))return PTR_ERR (ahash_tfm);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 594/957 crypto: sa2ul - Fix AEAD fallback algorithm names
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: T Pratham <[email protected]>
[ Upstream commit 8451ab6ad686ffdcdf9ddadaa446a79ab48e5590 ]
For authenc AEAD algorithms, sa2ul is trying to register very specific -ce version as a fallback. This causes registration failure on SoCs which do not have ARMv8-CE enabled/available. Change the fallback algorithm from the specific driver name to generic algorithm name so that the kernel can allocate any available fallback.
--- drivers/crypto/sa2ul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/sa2ul.c +2 -2
@@ -1744,13 +1744,13 @@ static int sa_cra_init_aead(struct crypto_aead *tfm, const char *hash,static int sa_cra_init_aead_sha1 (struct crypto_aead *tfm) {return sa_cra_init_aead (tfm,"sha1" , -"authenc(hmac(sha1-ce),cbc(aes-ce))" ); +"authenc(hmac(sha1),cbc(aes))" ); }static int sa_cra_init_aead_sha256 (struct crypto_aead *tfm) {return sa_cra_init_aead (tfm,"sha256" , -"authenc(hmac(sha256-ce),cbc(aes-ce))" ); +"authenc(hmac(sha256),cbc(aes))" ); }static void sa_exit_tfm_aead (struct crypto_aead *tfm)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 595/957 crypto: ccp - copy IV using skcipher ivsize
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moses <[email protected]>
[ Upstream commit a7a1f3cdd64d8a165d9b8c9e9ad7fb46ac19dfc4 ]
AF_ALG rfc3686-ctr-aes-ccp requests pass an 8-byte IV to the driver.
ccp_aes_complete() restores AES_BLOCK_SIZE bytes into the caller's IV buffer while RFC3686 skciphers expose an 8-byte IV, so the restore overruns the provided buffer.
Use crypto_skcipher_ivsize() to copy only the algorithm's IV length.
--- drivers/crypto/ccp/ccp-crypto-aes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/crypto/ccp/ccp-crypto-aes.c +5 -2
@@ -30,8 +30,11 @@ static int ccp_aes_complete(struct crypto_async_request *async_req, int ret)if (ret)return ret; -if (ctx->u.aes.mode !=CCP_AES_MODE_ECB ) -memcpy (req->iv, rctx->iv,AES_BLOCK_SIZE ); +if (ctx->u.aes.mode !=CCP_AES_MODE_ECB ) { +size_t ivsize =crypto_skcipher_ivsize (crypto_skcipher_reqtfm (req)); + +memcpy (req->iv, rctx->iv, ivsize); + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 596/957 erofs: unify lcn as u64 for 32-bit platforms
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 2d8c7edcb661812249469f4a5b62e9339118846f ]
As sashiko reported [1], lcn was typed as unsigned long (or unsigned int sometimes), which is only 32 bits wide on 32-bit platforms, which causes (lcn << lclusterbits) to be truncated at 4 GiB.
In order to consolidate the logic, just use u64 consistently around the codebase.
[1] https://sashiko.dev/r/20260420034612.1899973-1-hsiangkao%40linux.alibaba.com
--- fs/erofs/zmap.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
fs/erofs/zmap.c +9 -10
@@ -10,7 +10,7 @@struct z_erofs_maprecorder {struct inode *inode;struct erofs_map_blocks *map; -unsigned long lcn; +u64 lcn;/* compression extent information gathered */ u8 type, headtype;u16 clusterofs;
@@ -20,8 +20,7 @@ struct z_erofs_maprecorder {bool partialref, in_mbox; }; -static int z_erofs_load_full_lcluster (struct z_erofs_maprecorder *m, -unsigned long lcn) +static int z_erofs_load_full_lcluster (struct z_erofs_maprecorder *m,u64 lcn) {struct inode *const inode = m->inode;struct erofs_inode *const vi =EROFS_I (inode);
@@ -94,7 +93,7 @@ static int get_compacted_la_distance(unsigned int lobits, }static int z_erofs_load_compact_lcluster (struct z_erofs_maprecorder *m, -unsigned long lcn,bool lookahead) +u64 lcn,bool lookahead) {struct inode *const inode = m->inode;struct erofs_inode *const vi =EROFS_I (inode);
@@ -234,7 +233,7 @@ static int z_erofs_load_compact_lcluster(struct z_erofs_maprecorder *m, }static int z_erofs_load_lcluster_from_disk (struct z_erofs_maprecorder *m, -unsigned int lcn,bool lookahead) +u64 lcn,bool lookahead) {struct erofs_inode *vi =EROFS_I (m->inode);int err;
@@ -249,7 +248,7 @@ static int z_erofs_load_lcluster_from_disk(struct z_erofs_maprecorder *m,return err;if (m->type >=Z_EROFS_LCLUSTER_TYPE_MAX ) { -erofs_err (m->inode->i_sb,"unknown type %u @ lcn %u of nid %llu" , +erofs_err (m->inode->i_sb,"unknown type %u @ lcn %llu of nid %llu" , m->type, lcn,EROFS_I (m->inode)->nid);DBG_BUGON (1 );return -EOPNOTSUPP ;
@@ -269,7 +268,7 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m,const unsigned int lclusterbits = vi->z_lclusterbits;while (m->lcn >= lookback_distance) { -unsigned long lcn = m->lcn - lookback_distance; +u64 lcn = m->lcn - lookback_distance;int err;if (!lookback_distance)
@@ -286,7 +285,7 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m, m->map->m_la = (lcn << lclusterbits) | m->clusterofs;return 0 ; } -erofs_err (sb,"bogus lookback distance %u @ lcn %lu of nid %llu" , +erofs_err (sb,"bogus lookback distance %u @ lcn %llu of nid %llu" , lookback_distance, m->lcn, vi->nid);DBG_BUGON (1 );return -EFSCORRUPTED ;
@@ -300,7 +299,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m,struct erofs_inode *vi =EROFS_I (inode);bool bigpcl1 = vi->z_advise &Z_EROFS_ADVISE_BIG_PCLUSTER_1 ;bool bigpcl2 = vi->z_advise &Z_EROFS_ADVISE_BIG_PCLUSTER_2 ; -unsigned long lcn = m->lcn +1 ; +u64 lcn = m->lcn +1 ;int err;DBG_BUGON (m->type ==Z_EROFS_LCLUSTER_TYPE_NONHEAD );
@@ -331,7 +330,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m, m->type == Z_EROFS_LCLUSTER_TYPE_NONHEAD);if (m->type ==Z_EROFS_LCLUSTER_TYPE_NONHEAD && m->delta[0 ] !=1 ) { -erofs_err (sb,"bogus CBLKCNT @ lcn %lu of nid %llu" , lcn, vi->nid); +erofs_err (sb,"bogus CBLKCNT @ lcn %llu of nid %llu" , lcn, vi->nid);DBG_BUGON (1 );return -EFSCORRUPTED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 597/957 arm64: dts: imx8mp-debix-model-a: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 3b778178997aee24537b521a8cb60970bc1ce01c ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there is interrupt storm for i.MX8MP DEBIX Model A. Per schematic, there is no on board PULL-UP resistors for GPIO1_IO03, so need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-debix-model-a.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-debix-model-a.dts +1 -1
@@ -440,7 +440,7 @@ MX8MP_IOMUXC_SAI5_RXC__I2C6_SDA 0x400001c3 pinctrl_pmic: pmicirqgrp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 598/957 arm64: dts: imx8mp-debix-som-a: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 2ea7872048a179b0ea8dadc67771961df3f0fc4a ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there is interrupt storm for i.MX8MP DEBIX SOM A. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-debix-som-a-bmb-08.dts | 2 +- arch/arm64/boot/dts/freescale/imx8mp-debix-som-a.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-debix-som-a-bmb-08.dts +1 -1
@@ -452,7 +452,7 @@ MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03 0x140 pinctrl_pmic: pmicgrp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
arch/arm64/boot/dts/freescale/imx8mp-debix-som-a.dtsi +1 -1
@@ -241,7 +241,7 @@ MX8MP_IOMUXC_I2C4_SDA__I2C4_SDA 0x400001c3 pinctrl_pmic: pmicgrp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 599/957 arm64: dts: imx8mp-navqp: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 741d6ac1a2a2e0f3e2cae5eef3516cdd75119e83 ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there will be interrupt storm for i.MX8MP NAVQP. Per schematic, there is no on board PULL-UP resistors for GPIO1_IO03, so need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-navqp.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-navqp.dts +1 -1
@@ -356,7 +356,7 @@ MX8MP_IOMUXC_I2C4_SDA__I2C4_SDA 0x400001c3 pinctrl_pmic: pmicgrp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 600/957 arm64: dts: imx8mp-icore-mx8mp: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit ea8c90f5c7ceeb6657a8fe564aa7b190dce298a6 ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-icore-mx8mp.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-icore-mx8mp.dtsi +1 -1
@@ -132,7 +132,7 @@ MX8MP_IOMUXC_I2C1_SDA__I2C1_SDA 0x400001c3 pinctrl_pmic: pmicgrp { fsl,pins = < - MX8MP_IOMUXC_NAND_CE0_B__GPIO3_IO01 0x41 + MX8MP_IOMUXC_NAND_CE0_B__GPIO3_IO01 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 601/957 arm64: dts: imx8mp-edm-g: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit c46c5a54443440ce0f71de9f4df9dd860f5c2afd ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-edm-g.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-edm-g.dtsi +1 -1
@@ -563,7 +563,7 @@ MX8MP_IOMUXC_GPIO1_IO01__GPIO1_IO01 0x41 /* PCIE RST */ pinctrl_pmic: pmicirqgrp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 602/957 arm64: dts: imx8mp-aristainetos3a-som-v1: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e6d2d8e49ca34bb39126a69128794d08ffd7c83e ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-aristainetos3a-som-v1.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-aristainetos3a-som-v1.dtsi +1 -1
@@ -903,7 +903,7 @@ MX8MP_IOMUXC_SAI1_MCLK__GPIO4_IO20 0x41 pinctrl_pmic: aristainetos3-pmic-grp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 603/957 arm64: dts: imx8mp-nitrogen-som: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 16611eda2c7584a1a7d6f80511d825e5108f026c ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-nitrogen-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-nitrogen-som.dtsi +1 -1
@@ -296,7 +296,7 @@ MX8MP_IOMUXC_I2C4_SDA__I2C4_SDA 0x400001c3 pinctrl_pmic: pmicirqgrp { fsl,pins = < - MX8MP_IOMUXC_NAND_ALE__GPIO3_IO00 0x41 + MX8MP_IOMUXC_NAND_ALE__GPIO3_IO00 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 604/957 arm64: dts: imx8mp-sr-som: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 695a476275cfb9c798a696aeaa43967701d5c78a ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-sr-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-sr-som.dtsi +2 -2
@@ -174,7 +174,7 @@ pmic: pmic@25 { pinctrl-0 = <&pmic_pins>; pinctrl-names = "default"; interrupt-parent = <&gpio1>; - interrupts = <3 GPIO_ACTIVE_LOW>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; nxp,i2c-lt-enable; regulators {
@@ -417,7 +417,7 @@ MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03 0x160 pmic_pins: pinctrl-pmic-grp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 605/957 arm64: dts: imx8mp-ultra-mach-sbc: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit daaf41ee72fb5fad936e7051a015cccae9b33937 ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-ultra-mach-sbc.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-ultra-mach-sbc.dts +2 -2
@@ -275,7 +275,7 @@ pmic@25 { reg = <0x25>; pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; - interrupts = <3 GPIO_ACTIVE_LOW>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; /* * i.MX 8M Plus Data Sheet for Consumer Products
@@ -739,7 +739,7 @@ MX8MP_IOMUXC_GPIO1_IO07__GPIO1_IO07 0x40 /* NFC_INT */ pinctrl_pmic: pmic-grp { fsl,pins = < - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x40 /* #PMIC_INT */ + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 /* #PMIC_INT */ >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 606/957 arm64: dts: imx8mp-dhcom-som: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit f9ed5afc988da3e22543725e35be6addbb0497bc ]
PMIC_nINT is low level triggered, but the current PAD settings is PE=0,PUE=0,FSEL_1_FAST_SLEW_RATE=1,SION=1. So PAD needs to be configured as PULL UP with PULL Enable, no need SION. Correct it.
--- arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi +1 -1
@@ -989,7 +989,7 @@ MX8MP_IOMUXC_SAI5_RXC__GPIO3_IO20 0x22 pinctrl_pmic: dhcom-pmic-grp { fsl,pins = < /* PMIC_nINT */ - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x40000090 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 607/957 arm64: dts: imx8mp-data-modul-edm-sbc: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 8ff145577e93f312ff398cb950ee3bd44835f5be ]
PMIC_nINT is low level triggered, but the current PAD settings is PE=0,PUE=0,FSEL_1_FAST_SLEW_RATE=1,SION=1. So PAD needs to be configured as PULL UP with PULL Enable, no need SION. Correct it.
--- arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts +1 -1
@@ -900,7 +900,7 @@ MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_PDM_BIT_STREAM00 0x0 pinctrl_pmic: pmic-grp { fsl,pins = < /* PMIC_nINT */ - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x40000090 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.18.32 release. There are 957 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 22 May 2026 16:20:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.18.32-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.18.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Greg Kroah-Hartman
maintainerPATCH 608/957 PCMCIA: Fix garbled log messages for KERN_CONT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: René Rebe <[email protected]>
[ Upstream commit bfeaa6814bd3f9a1f6d525b3b35a03b9a0368961 ]
For years the PCMCIA info messages are messed up by superfluous newlines. While f2e6cf76751d ("pcmcia: Convert dev_printk to dev_<level>") converted the code to pr_cont(), dev_info enforces a \n via vprintk_store setting LOG_NEWLINE, breaking subsequent pr_cont.
Fix by logging the device name manually to allow pr_cont to work for more readable and not \n distorted logs.
--- drivers/pcmcia/rsrc_nonstatic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pcmcia/rsrc_nonstatic.c +3 -3
@@ -188,7 +188,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,int any;u_char *b, hole, most; -dev_info (&s->dev,"cs: IO port probe %#x-%#x:" , base, base+num-1 ); +pr_info ("%s: cs: IO port probe %#x-%#x:" ,dev_name (&s->dev), base, base+num-1 );/* First, what does a floating port look like? */ b =kzalloc (256 ,GFP_KERNEL );
@@ -410,8 +410,8 @@ static int do_mem_probe(struct pcmcia_socket *s, u_long base, u_long num,struct socket_data *s_data = s->resource_data;u_long i, j, bad, fail, step; -dev_info (&s->dev,"cs: memory probe 0x%06lx-0x%06lx:" , - base, base+num-1 ); +pr_info ("%s: cs: memory probe 0x%06lx-0x%06lx:" , +dev_name (&s->dev), base, base+num-1 ); bad = fail =0 ; step = (num <0x20000 ) ?0x2000 : ((num>>4 ) & ~0x1fff );/* don't allow too large steps */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 609/957 reset: amlogic: t7: Fix null reset ops
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronald Claveau <[email protected]>
[ Upstream commit 9797524ef2b69c6b187b55bd844eb72a8c1cbd99 ]
Fix missing reset ops causing kernel null pointer dereference. This SOC's reset is currently not used yet.
--- drivers/reset/amlogic/reset-meson.c | 1 + 1 file changed, 1 insertion(+)
drivers/reset/amlogic/reset-meson.c +1 -0
@@ -42,6 +42,7 @@ static const struct meson_reset_param meson_s4_param = { };static const struct meson_reset_param t7_param = { + .reset_ops = &meson_reset_ops, .reset_num =224 , .reset_offset =0x0 , .level_offset =0x40 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 610/957 arm64: dts: imx8mm-emtop-som: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 721dec3ee9ff5231d13a412ff87df63b966d137b ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
While at here, also correct interrupt type as IRQ_TYPE_LEVEL_LOW.
--- arch/arm64/boot/dts/freescale/imx8mm-emtop-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-emtop-som.dtsi +2 -2
@@ -60,7 +60,7 @@ pmic@25 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; - interrupts = <3 IRQ_TYPE_EDGE_RISING>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; regulators { buck1: BUCK1 {
@@ -194,7 +194,7 @@ MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA 0x400001c3 pinctrl_pmic: emtop-pmic-grp { fsl,pins = < - MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3 0x41 + MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3 0x141 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 611/957 arm64: dts: imx8mn-tqma8mqnl: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 0fb37990774113afd943eaa91323679388584b6d ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mn-tqma8mqnl.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mn-tqma8mqnl.dtsi +1 -1
@@ -298,7 +298,7 @@ pinctrl_i2c1_gpio: i2c1gpiogrp { }; pinctrl_pmic: pmicgrp { - fsl,pins = <MX8MN_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x84>; + fsl,pins = <MX8MN_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x1c4>; }; pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 612/957 arm64: dts: imx8mm-tqma8mqml: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 42a9f5a16328ed78a88e0498556965b6c6ec515c ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi +1 -1
@@ -291,7 +291,7 @@ pinctrl_i2c1_gpio: i2c1gpiogrp { }; pinctrl_pmic: pmicgrp { - fsl,pins = <MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x94>; + fsl,pins = <MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x1d4>; }; pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 613/957 arm64: dts: marvell: armada-37xx: use usb2-phy in USB3 controllers phy-names
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
[ Upstream commit 0fef19844624f8bc07651b4d26088d8940affba3 ]
Instead of the generic 'usb2-phy' name, the Armada 37xx device trees are using a custom 'usb2-utmi-otg-phy' name for the USB2 PHY in the USB3 controller node. Since commit 53a2d95df836 ("usb: core: add phy notify connect and disconnect"), this triggers a bug [1] in the USB core which causes double use of the USB3 PHY.
Change the PHY name to 'usb2-phy' in the SoC and in the uDPU specific dtsi files in order to avoid triggering the bug and also to keep the names in line with the ones used by other platforms.
--- arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi | 2 +- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi +1 -1
@@ -161,7 +161,7 @@ ð1 { &usb3 { status = "okay"; phys = <&usb2_utmi_otg_phy>; - phy-names = "usb2-utmi-otg-phy"; + phy-names = "usb2-phy"; }; &uart0 {
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +1 -1
@@ -373,7 +373,7 @@ usb3: usb@58000 { interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; clocks = <&sb_periph_clk 12>; phys = <&comphy0 0>, <&usb2_utmi_otg_phy>; - phy-names = "usb3-phy", "usb2-utmi-otg-phy"; + phy-names = "usb3-phy", "usb2-phy"; status = "disabled"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 614/957 pwm: stm32: Fix rounding issue for requests with inverted polarity
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 5d087c485b6ecf200a9ebb2a032bf8571d330250 ]
The calculation of the number of pwm clk ticks from a time length in nanoseconds involves a division and thus some rounding. That might result in
duty_ticks + offset_ticks < period_ticks
despite
duty_length_ns + duty_offset_ns >= period_length_ns
. The stm32 PWM cannot configure offset_ticks freely, it can only select 0 or period_length_ns - duty_length_ns---that is the classic normal and inverted polarity. The decision to select the hardware polarity must be done using the ticks values and not the nanoseconds times to adhere to the rounding rules by the pwm core.
With the pwm clk running at 208900 kHz on my test machine (stm32mp135f-dk), a test case that was handled wrong is:
# pwmround -P 9999962 -O 24970 -D 9974992 period_length = 9999962 duty_length = 9974840 duty_offset = 25123
With this change applied the rounding is done correctly:
# pwmround -P 9999962 -O 24970 -D 9974992 period_length = 9999962 duty_length = 9974840 duty_offset = 0
--- drivers/pwm/pwm-stm32.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/pwm/pwm-stm32.c +12 -10
@@ -68,7 +68,7 @@ static int stm32_pwm_round_waveform_tohw(struct pwm_chip *chip,struct stm32_pwm *priv =to_stm32_pwm_dev (chip);unsigned int ch = pwm->hwpwm;unsigned long rate; -u64 ccr, duty; +u64 duty_ticks, offset_ticks;int ret;if (wf->period_length_ns ==0 ) {
@@ -164,23 +164,25 @@ static int stm32_pwm_round_waveform_tohw(struct pwm_chip *chip, wfhw->arr =min_t (u64, arr, priv->max_arr) -1 ; } - duty =mul_u64_u64_div_u64 (wf->duty_length_ns, rate, - (u64 )NSEC_PER_SEC * (wfhw->psc +1 )); - duty =min_t (u64, duty, wfhw->arr +1 ); + duty_ticks =mul_u64_u64_div_u64 (wf->duty_length_ns, rate, + (u64 )NSEC_PER_SEC * (wfhw->psc +1 )); + duty_ticks =min_t (u64, duty_ticks, wfhw->arr +1 ); -if (wf->duty_length_ns && wf->duty_offset_ns && - wf->duty_length_ns + wf->duty_offset_ns >= wf->period_length_ns) { + offset_ticks =mul_u64_u64_div_u64 (wf->duty_offset_ns, rate, + (u64 )NSEC_PER_SEC * (wfhw->psc +1 )); + offset_ticks =min_t (u64, offset_ticks, wfhw->arr +1 ); + +if (duty_ticks && offset_ticks && + duty_ticks + offset_ticks >= wfhw->arr +1 ) { wfhw->ccer |=TIM_CCER_CCxP (ch +1 );if (priv->have_complementary_output) wfhw->ccer |=TIM_CCER_CCxNP (ch +1 ); - ccr = wfhw->arr +1 - duty; + wfhw->ccr = wfhw->arr +1 - duty_ticks; }else { - ccr = duty; + wfhw->ccr = duty_ticks; } - wfhw->ccr =min_t (u64, ccr, wfhw->arr +1 ); - out: dev_dbg(&chip->dev, "pwm#%u: %lld/%lld [+%lld] @%lu -> CCER: %08x, PSC: %08x, ARR: %08x, CCR: %08x\n", pwm->hwpwm, wf->duty_length_ns, wf->period_length_ns, wf->duty_offset_ns,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 615/957 net/sched: act_mirred: fix wrong device for mac_header_xmit check in tcf_blockcast_redir
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
[ Upstream commit 4510d140524ca7d6e772db962e013f26f09a63b1 ]
In tcf_blockcast_redir(), when iterating block ports to redirect packets to multiple devices, the mac_header_xmit flag is queried from the wrong device. The loop sends to dev_prev but queries dev_is_mac_header_xmit(dev) — which is the NEXT device in the iteration, not the one being sent to.
This causes tcf_mirred_to_dev() to make incorrect decisions about whether to push or pull the MAC header. When the block contains mixed device types (e.g., an ethernet veth and a tunnel device), intermediate devices get the wrong mac_header_xmit flag, leading to skb header corruption. In the worst case, skb_push_rcsum with an incorrect mac_len can exhaust headroom and panic.
The last device in the loop is handled correctly (line 365-366 uses dev_is_mac_header_xmit(dev_prev)), confirming this is a copy-paste oversight for the intermediate devices.
Fix by using dev_prev instead of dev for the mac_header_xmit query, consistent with the device actually being sent to.
--- net/sched/act_mirred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_mirred.c +1 -1
@@ -370,7 +370,7 @@ static int tcf_blockcast_redir(struct sk_buff *skb, struct tcf_mirred *m, goto assign_prev;tcf_mirred_to_dev (skb, m, dev_prev, -dev_is_mac_header_xmit (dev), +dev_is_mac_header_xmit (dev_prev), mirred_eaction, retval); assign_prev: dev_prev = dev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 616/957 macvlan: fix macvlan_get_size() not reserving space for IFLA_MACVLAN_BC_CUTOFF
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
[ Upstream commit fa92a77b0ed4d5f11a71665a232ac5a54a4b055d ]
macvlan_get_size() does not account for IFLA_MACVLAN_BC_CUTOFF, but macvlan_fill_info() conditionally includes it when port->bc_cutoff != 1. This causes nla_put_s32() to fail with -EMSGSIZE when the netlink skb runs out of space, triggering a WARN_ON in rtnetlink and preventing the interface from being dumped.
The bug can be reproduced with:
ip link add macvlan0 link eth0 type macvlan mode bridge ip link set macvlan0 type macvlan bc_cutoff 0
ip -d link show macvlan0 # fails with -EMSGSIZE
The bc_cutoff feature was added in commit 954d1fa1ac93 ("macvlan: Add netlink attribute for broadcast cutoff"), which added the nla_put_s32() call in macvlan_fill_info() but missed adding the corresponding nla_total_size(4) in macvlan_get_size(). A follow-up commit 55cef78c244d ("macvlan: add forgotten nla_policy for IFLA_MACVLAN_BC_CUTOFF") fixed the missing nla_policy entry but still did not fix the size calculation.
--- drivers/net/macvlan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/macvlan.c +1 -0
@@ -1682,6 +1682,7 @@ static size_t macvlan_get_size(const struct net_device *dev) +macvlan_get_size_mac (vlan)/* IFLA_MACVLAN_MACADDR */ +nla_total_size (4 )/* IFLA_MACVLAN_BC_QUEUE_LEN */ +nla_total_size (4 )/* IFLA_MACVLAN_BC_QUEUE_LEN_USED */ + +nla_total_size (4 )/* IFLA_MACVLAN_BC_CUTOFF */ ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 617/957 net/sched: sch_cake: fix NAT destination port not being updated in cake_update_flowkeys
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
[ Upstream commit f9e40664706927d7ae22a448a3383e23c38a4c0b ]
cake_update_flowkeys() is supposed to update the flow dissector keys with the NAT-translated addresses and ports from conntrack, so that CAKE's per-flow fairness correctly identifies post-NAT flows as belonging to the same connection.
For the source port, this works correctly:
keys->ports.src = port;
But for the destination port, the assignment is reversed:
port = keys->ports.dst;
This means the NAT destination port is never updated in the flow keys. As a result, when multiple connections are NATed to the same destination, CAKE treats them as separate flows because the original (pre-NAT) destination ports differ. This breaks CAKE's NAT-aware flow isolation when using the "nat" mode.
The bug was introduced in commit b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate") which refactored the original direct assignment into a compare-and-conditionally-update pattern, but wrote the destination port update backwards.
Fix by reversing the assignment direction to match the source port pattern.
--- net/sched/sch_cake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cake.c +1 -1
@@ -606,7 +606,7 @@ static bool cake_update_flowkeys(struct flow_keys *keys, } port = rev ? tuple.src.u.all : tuple.dst.u.all;if (port != keys->ports.dst) { - port = keys->ports.dst; + keys->ports.dst = port; upd = true; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 618/957 nexthop: fix IPv6 route referencing IPv4 nexthop
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 29c95185ba32b621fbc3800fb86e7dc3edf5c2be ]
syzbot reported a panic [1] [2].
When an IPv6 nexthop is replaced with an IPv4 nexthop, the has_v4 flag of all groups containing this nexthop is not updated. This is because nh_group_v4_update is only called when replacing AF_INET to AF_INET6, but the reverse direction (AF_INET6 to AF_INET) is missed.
This allows a stale has_v4=false to bypass fib6_check_nexthop, causing IPv6 routes to be attached to groups that effectively contain only AF_INET members. Subsequent route lookups then call nexthop_fib6_nh() which returns NULL for the AF_INET member, leading to a NULL pointer dereference.
Fix by calling nh_group_v4_update whenever the family changes, not just AF_INET to AF_INET6.
Reproducer:
# AF_INET6 blackhole
ip -6 nexthop add id 1 blackhole
# group with has_v4=false
ip nexthop add id 100 group 1
# replace with AF_INET (no -6), has_v4 stays false ip nexthop replace id 1 blackhole
# pass stale has_v4 check
ip -6 route add 2001:db8::/64 nhid 100
# panic
ping -6 2001:db8::1
[1] https://syzkaller.appspot.com/bug?id=e17283eb2f8dcf3dd9b47fe6f67a95f71faadad0
[2] https://syzkaller.appspot.com/bug?id=8699b6ae54c9f35837d925686208402949e12ef3
--- net/ipv4/nexthop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/nexthop.c +2 -2
@@ -2469,10 +2469,10 @@ static int replace_nexthop_single(struct net *net, struct nexthop *old, goto err_notify; } -/* When replacing an IPv4 nexthop with an IPv6 nexthop, potentially +/* When replacing a nexthop with one of a different family, potentially * update IPv4 indication in all the groups using the nexthop. */ -if (oldi->family ==AF_INET && newi->family ==AF_INET6 ) { +if (oldi->family != newi->family) {list_for_each_entry (nhge, &old->grp_list, nh_list) {struct nexthop *nhp = nhge->nh_parent;struct nh_group *nhg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 619/957 net: airoha: Wait for NPU PPE configuration to complete in airoha_ppe_offload_setup()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit f3206328bb52c2787197d80d7cbd687946047d5f ]
In order to properly enable flowtable hw offloading, poll REG_PPE_FLOW_CFG register in airoha_ppe_offload_setup routine and wait for NPU PPE configuration triggered by ppe_init callback to complete before running airoha_ppe_hw_init().
--- drivers/net/ethernet/airoha/airoha_ppe.c | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/net/ethernet/airoha/airoha_ppe.c +28 -0
@@ -1321,6 +1321,29 @@ static struct airoha_npu *airoha_ppe_npu_get(struct airoha_eth *eth)return npu; } +static int airoha_ppe_wait_for_npu_init (struct airoha_eth *eth) +{ +int err; +u32 val; + +/* PPE_FLOW_CFG default register value is 0. Since we reset FE +* during the device probe we can just check the configured value +* is not 0 here. +*/ + err =read_poll_timeout (airoha_fe_rr, val, val,USEC_PER_MSEC , +100 *USEC_PER_MSEC , false, eth, +REG_PPE_PPE_FLOW_CFG (0 )); +if (err) +return err; + +if (airoha_ppe_is_enabled (eth,1 )) + err =read_poll_timeout (airoha_fe_rr, val, val,USEC_PER_MSEC , +100 *USEC_PER_MSEC , false, eth, +REG_PPE_PPE_FLOW_CFG (1 )); + +return err; +} +static int airoha_ppe_offload_setup (struct airoha_eth *eth) {struct airoha_npu *npu =airoha_ppe_npu_get (eth);
@@ -1334,6 +1357,11 @@ static int airoha_ppe_offload_setup(struct airoha_eth *eth)if (err) goto error_npu_put; +/* Wait for NPU PPE configuration to complete */ + err =airoha_ppe_wait_for_npu_init (eth); +if (err) + goto error_npu_put; + ppe_num_stats_entries =airoha_ppe_get_total_num_stats_entries (ppe);if (ppe_num_stats_entries >0 ) { err = npu->ops.ppe_init_stats(npu, ppe->foe_stats_dma,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 620/957 net/sched: taprio: fix use-after-free in advance_sched() on schedule switch
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
[ Upstream commit 105425b1969c5affe532713cfac1c0b320d7ac2b ]
In advance_sched(), when should_change_schedules() returns true, switch_schedules() is called to promote the admin schedule to oper. switch_schedules() queues the old oper schedule for RCU freeing via call_rcu(), but 'next' still points into an entry of the old oper schedule. The subsequent 'next->end_time = end_time' and rcu_assign_pointer(q->current_entry, next) are use-after-free.
Fix this by selecting 'next' from the new oper schedule immediately after switch_schedules(), and using its pre-calculated end_time. setup_first_end_time() sets the first entry's end_time to base_time + interval when the schedule is installed, so the value is already correct.
The deleted 'end_time = sched_base_time(admin)' assignment was also harmful independently: it would overwrite the new first entry's pre-calculated end_time with just base_time.
--- net/sched/sch_taprio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/sched/sch_taprio.c +5 -4
@@ -971,11 +971,12 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) }if (should_change_schedules (admin, oper, end_time)) { -/* Set things so the next time this runs, the new -* schedule runs. -*/ - end_time =sched_base_time (admin);switch_schedules (q, &admin, &oper); +/* After changing schedules, the next entry is the first one +* in the new schedule, with a pre-calculated end_time. +*/ + next = list_first_entry(&oper->entries, struct sched_entry, list); + end_time = next->end_time; } next->end_time = end_time;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 621/957 net: dsa: cpu_dp->orig_ethtool_ops might be NULL
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit eba81b0a6de39e2466d37e410003642282b4e546 ]
In theory this would have been seen by now, but it seems that all drivers used as DSA conduit interfaces thus far have had ethtool_ops set, and it's hard to even find modern Ethernet drivers (and not VF ones) which don't use ethtool.
Here is the unfiltered list of drivers which register any sort of net_device but don't set its ethtool_ops pointer. I don't think any of them 'risks' being used as a DSA conduit, maybe except for moxart, rnpbge and icssm, I'm not sure.
- drivers/net/can/dev/dev.c
- drivers/net/wwan/qcom_bam_dmux.c
- drivers/net/wwan/t7xx/t7xx_netdev.c
- drivers/net/arcnet/arcnet.c
- drivers/net/hamradio/
- drivers/net/slip/slip.c
- drivers/net/ethernet/ezchip/nps_enet.c
- drivers/net/ethernet/moxa/moxart_ether.c
- drivers/net/ethernet/wangxun/txgbevf/txgbevf_main.c
- drivers/net/ethernet/wangxun/ngbevf/ngbevf_main.c
- drivers/net/ethernet/huawei/hinic3/hinic3_main.c
- drivers/net/ethernet/i825xx/
- drivers/net/ethernet/ti/icssm/icssm_prueth.c
- drivers/net/ethernet/seeq/
- drivers/net/ethernet/litex/litex_liteeth.c
- drivers/net/ethernet/sunplus/spl2sw_driver.c
- drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
- drivers/net/ipa/
- drivers/net/wireless/microchip/wilc1000/
- drivers/net/wireless/mediatek/mt76/dma.c
- drivers/net/wireless/ath/ath12k/
- drivers/net/wireless/ath/ath11k/
- drivers/net/wireless/ath/ath6kl/
- drivers/net/wireless/ath/ath10k/
- drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
- drivers/net/wireless/virtual/mac80211_hwsim.c
- drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
- drivers/net/wireless/realtek/rtw89/core.c
- drivers/net/wireless/realtek/rtw88/pci.c
- drivers/net/caif/
- drivers/net/plip/
- drivers/net/wan/
- drivers/net/mctp/
- drivers/net/ppp/
- drivers/net/thunderbolt/
Nonetheless, it's good for the framework not to make such assumptions, and not panic when coming across such kind of host device in the future.
Stable-dep-of: 0f99e0c3e19b ("net: dsa: remove redundant netdev_lock_ops() from conduit ethtool ops")
--- net/dsa/conduit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/dsa/conduit.c +7 -7
@@ -26,7 +26,7 @@ static int dsa_conduit_get_regs_len(struct net_device *dev)int ret =0 ;int len; -if (ops->get_regs_len) { +if (ops && ops->get_regs_len) {netdev_lock_ops (dev); len = ops->get_regs_len (dev);netdev_unlock_ops (dev);
@@ -59,7 +59,7 @@ static void dsa_conduit_get_regs(struct net_device *dev,int port = cpu_dp->index;int len; -if (ops->get_regs_len && ops->get_regs) { +if (ops && ops->get_regs_len && ops->get_regs) {netdev_lock_ops (dev); len = ops->get_regs_len (dev);if (len <0 ) {
@@ -97,7 +97,7 @@ static void dsa_conduit_get_ethtool_stats(struct net_device *dev,int port = cpu_dp->index;int count =0 ; -if (ops->get_sset_count && ops->get_ethtool_stats) { +if (ops && ops->get_sset_count && ops->get_ethtool_stats) {netdev_lock_ops (dev); count = ops->get_sset_count (dev,ETH_SS_STATS ); ops->get_ethtool_stats (dev, stats, data);
@@ -118,11 +118,11 @@ static void dsa_conduit_get_ethtool_phy_stats(struct net_device *dev,int port = cpu_dp->index;int count =0 ; -if (dev->phydev && !ops->get_ethtool_phy_stats) { +if (dev->phydev && (!ops || !ops->get_ethtool_phy_stats)) { count =phy_ethtool_get_sset_count (dev->phydev);if (count >=0 )phy_ethtool_get_stats (dev->phydev, stats, data); - }else if (ops->get_sset_count && ops->get_ethtool_phy_stats) { + }else if (ops && ops->get_sset_count && ops->get_ethtool_phy_stats) {netdev_lock_ops (dev); count = ops->get_sset_count (dev,ETH_SS_PHY_STATS ); ops->get_ethtool_phy_stats (dev, stats, data);
@@ -145,9 +145,9 @@ static int dsa_conduit_get_sset_count(struct net_device *dev, int sset)netdev_lock_ops (dev);if (sset ==ETH_SS_PHY_STATS && dev->phydev && - !ops->get_ethtool_phy_stats) + (!ops || !ops->get_ethtool_phy_stats)) count =phy_ethtool_get_sset_count (dev->phydev); -else if (ops->get_sset_count) +else if (ops && ops->get_sset_count) count = ops->get_sset_count (dev, sset);netdev_unlock_ops (dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 622/957 net: dsa: use kernel data types for ethtool ops on conduit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 8afabd27fe46ebf991b4aea20b74e08196c15c0c ]
Suppress some checkpatch 'CHECK' messages about u8 being preferable over uint8_t, etc. No functional change.
Stable-dep-of: 0f99e0c3e19b ("net: dsa: remove redundant netdev_lock_ops() from conduit ethtool ops")
--- net/dsa/conduit.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/dsa/conduit.c +5 -6
@@ -89,7 +89,7 @@ static void dsa_conduit_get_regs(struct net_device *dev,static void dsa_conduit_get_ethtool_stats (struct net_device *dev,struct ethtool_stats *stats, -uint64_t *data) +u64 *data) {struct dsa_port *cpu_dp = dev->dsa_ptr;const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
@@ -110,7 +110,7 @@ static void dsa_conduit_get_ethtool_stats(struct net_device *dev,static void dsa_conduit_get_ethtool_phy_stats (struct net_device *dev,struct ethtool_stats *stats, -uint64_t *data) +u64 *data) {struct dsa_port *cpu_dp = dev->dsa_ptr;const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
@@ -160,8 +160,8 @@ static int dsa_conduit_get_sset_count(struct net_device *dev, int sset)return count; } -static void dsa_conduit_get_strings (struct net_device *dev,uint32_t stringset, -uint8_t *data) +static void dsa_conduit_get_strings (struct net_device *dev,u32 stringset, +u8 *data) {struct dsa_port *cpu_dp = dev->dsa_ptr;const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
@@ -169,8 +169,7 @@ static void dsa_conduit_get_strings(struct net_device *dev, uint32_t stringset,int port = cpu_dp->index;int len =ETH_GSTRING_LEN ;int mcount =0 , count, i; -uint8_t pfx[4 ]; -uint8_t *ndata; +u8 pfx[4 ], *ndata;snprintf (pfx,sizeof (pfx),"p%.2d" , port);/* We do not want to be NULL-terminated, since this is a prefix */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 623/957 net: dsa: append ethtool counters of all hidden ports to conduit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit f647ed2ca78ec4efcc436915b441da9de0974926 ]
Currently there is no way to see packet counters on cascade ports, and no clarity on how the API for that would look like.
Because it's something that is currently needed, just extend the hack where ethtool -S on the conduit interface dumps CPU port counters, and also use it to dump counters of cascade ports.
Note that the "pXX_" naming convention changes to "sXX_pYY", to distinguish between ports having the same index but belonging to different switches. This has a slight chance of causing regressions to existing tooling:
- grepping for "p04_counter_name" still works, but might return more than one string now
- grepping for " p04_counter_name" no longer works
Stable-dep-of: 0f99e0c3e19b ("net: dsa: remove redundant netdev_lock_ops() from conduit ethtool ops")
--- net/dsa/conduit.c | 126 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 93 insertions(+), 33 deletions(-)
net/dsa/conduit.c +93 -33
@@ -87,25 +87,51 @@ static void dsa_conduit_get_regs(struct net_device *dev, } } +static ssize_t dsa_conduit_append_port_stats (struct dsa_switch *ds,int port, +u64 *data,size_t start) +{ +int count; + +if (!ds->ops->get_sset_count) +return 0 ; + + count = ds->ops->get_sset_count (ds, port,ETH_SS_STATS ); +if (count <0 ) +return count; + +if (ds->ops->get_ethtool_stats) + ds->ops->get_ethtool_stats (ds, port, data + start); + +return count; +} +static void dsa_conduit_get_ethtool_stats (struct net_device *dev,struct ethtool_stats *stats,u64 *data) { -struct dsa_port *cpu_dp = dev->dsa_ptr; +struct dsa_port *dp, *cpu_dp = dev->dsa_ptr;const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; -struct dsa_switch *ds = cpu_dp->ds; -int port = cpu_dp->index; -int count =0 ; +struct dsa_switch_tree *dst = cpu_dp->dst; +int count, mcount =0 ;if (ops && ops->get_sset_count && ops->get_ethtool_stats) {netdev_lock_ops (dev); - count = ops->get_sset_count (dev,ETH_SS_STATS ); + mcount = ops->get_sset_count (dev,ETH_SS_STATS ); ops->get_ethtool_stats (dev, stats, data);netdev_unlock_ops (dev); } -if (ds->ops->get_ethtool_stats) - ds->ops->get_ethtool_stats (ds, port, data + count); +list_for_each_entry (dp, &dst->ports, list) { +if (!dsa_port_is_dsa (dp) && !dsa_port_is_cpu (dp)) +continue ; + + count =dsa_conduit_append_port_stats (dp->ds, dp->index, + data, mcount); +if (count <0 ) +return ; + + mcount += count; + } } static void dsa_conduit_get_ethtool_phy_stats(struct net_device *dev,
@@ -136,11 +162,18 @@ static void dsa_conduit_get_ethtool_phy_stats(struct net_device *dev, ds->ops->get_ethtool_phy_stats (ds, port, data + count); } +static void dsa_conduit_append_port_sset_count (struct dsa_switch *ds,int port, +int sset,int *count) +{ +if (ds->ops->get_sset_count) + *count += ds->ops->get_sset_count (ds, port, sset); +} +static int dsa_conduit_get_sset_count (struct net_device *dev,int sset) { -struct dsa_port *cpu_dp = dev->dsa_ptr; +struct dsa_port *dp, *cpu_dp = dev->dsa_ptr;const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; -struct dsa_switch *ds = cpu_dp->ds; +struct dsa_switch_tree *dst = cpu_dp->dst;int count =0 ;netdev_lock_ops (dev);
@@ -154,26 +187,57 @@ static int dsa_conduit_get_sset_count(struct net_device *dev, int sset)if (count <0 ) count =0 ; -if (ds->ops->get_sset_count) - count += ds->ops->get_sset_count (ds, cpu_dp->index, sset); +list_for_each_entry (dp, &dst->ports, list) { +if (!dsa_port_is_dsa (dp) && !dsa_port_is_cpu (dp)) +continue ; + +dsa_conduit_append_port_sset_count (dp->ds, dp->index, sset, + &count); + }return count; } -static void dsa_conduit_get_strings (struct net_device *dev,u32 stringset, -u8 *data) +static ssize_t dsa_conduit_append_port_strings (struct dsa_switch *ds,int port, +u32 stringset,u8 *data, +size_t start) { -struct dsa_port *cpu_dp = dev->dsa_ptr; -const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; -struct dsa_switch *ds = cpu_dp->ds; -int port = cpu_dp->index;int len =ETH_GSTRING_LEN ; -int mcount =0 , count, i; -u8 pfx[4 ], *ndata; +u8 pfx[8 ], *ndata; +int count, i; + +if (!ds->ops->get_strings) +return 0 ; -snprintf (pfx,sizeof (pfx),"p%.2d" , port); +snprintf (pfx,sizeof (pfx),"s%.2d_p%.2d" , ds->index, port);/* We do not want to be NULL-terminated, since this is a prefix */ pfx[sizeof (pfx) -1 ] ='_' ; + ndata = data + start * len; +/* This function copies ETH_GSTRINGS_LEN bytes, we will mangle +* the output after to prepend our CPU port prefix we +* constructed earlier +*/ + ds->ops->get_strings (ds, port, stringset, ndata); + count = ds->ops->get_sset_count (ds, port, stringset); +if (count <0 ) +return count; + +for (i =0 ; i < count; i++) { +memmove (ndata + (i * len +sizeof (pfx)), + ndata + i * len, len -sizeof (pfx)); +memcpy (ndata + i * len, pfx,sizeof (pfx)); + } + +return count; +} + +static void dsa_conduit_get_strings (struct net_device *dev,u32 stringset, +u8 *data) +{ +struct dsa_port *dp, *cpu_dp = dev->dsa_ptr; +const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; +struct dsa_switch_tree *dst = cpu_dp->dst; +int count, mcount =0 ;netdev_lock_ops (dev); if (stringset == ETH_SS_PHY_STATS && dev->phydev &&
@@ -191,21 +255,17 @@ static void dsa_conduit_get_strings(struct net_device *dev, u32 stringset, }netdev_unlock_ops (dev); -if (ds->ops->get_strings) { - ndata = data + mcount * len; -/* This function copies ETH_GSTRINGS_LEN bytes, we will mangle -* the output after to prepend our CPU port prefix we -* constructed earlier -*/ - ds->ops->get_strings (ds, port, stringset, ndata); - count = ds->ops->get_sset_count (ds, port, stringset); +list_for_each_entry (dp, &dst->ports, list) { +if (!dsa_port_is_dsa (dp) && !dsa_port_is_cpu (dp)) +continue ; + + count =dsa_conduit_append_port_strings (dp->ds, dp->index, + stringset, data, + mcount);if (count <0 )return ; -for (i =0 ; i < count; i++) { -memmove (ndata + (i * len +sizeof (pfx)), - ndata + i * len, len -sizeof (pfx)); -memcpy (ndata + i * len, pfx,sizeof (pfx)); - } + + mcount += count; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 624/957 net: dsa: remove redundant netdev_lock_ops() from conduit ethtool ops
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 0f99e0c3e19badaf3fdced0d3feba623e59eed41 ]
DSA replaces the conduit (master) device's ethtool_ops with its own wrappers that aggregate stats from both the conduit and DSA switch ports. Taking the lock again inside the DSA wrappers causes a deadlock.
Stumbled upon this when booting qemu with fbnic and CONFIG_NET_DSA_LOOP=y (which looks like some kind of testing device that auto-populates the ports of eth0). ethtool -i is enough to deadlock. This means we have basically zero coverage for DSA stuff with real ops locked devs.
Remove the redundant netdev_lock_ops()/netdev_unlock_ops() calls from the DSA conduit ethtool wrappers.
--- net/dsa/conduit.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
net/dsa/conduit.c +1 -15
@@ -27,9 +27,7 @@ static int dsa_conduit_get_regs_len(struct net_device *dev)int len;if (ops && ops->get_regs_len) { -netdev_lock_ops (dev); len = ops->get_regs_len (dev); -netdev_unlock_ops (dev);if (len <0 )return len; ret += len;
@@ -60,15 +58,11 @@ static void dsa_conduit_get_regs(struct net_device *dev,int len;if (ops && ops->get_regs_len && ops->get_regs) { -netdev_lock_ops (dev); len = ops->get_regs_len (dev); -if (len <0 ) { -netdev_unlock_ops (dev); +if (len <0 )return ; - } regs->len = len; ops->get_regs (dev, regs, data); -netdev_unlock_ops (dev); data += regs->len; }
@@ -115,10 +109,8 @@ static void dsa_conduit_get_ethtool_stats(struct net_device *dev,int count, mcount =0 ;if (ops && ops->get_sset_count && ops->get_ethtool_stats) { -netdev_lock_ops (dev); mcount = ops->get_sset_count (dev,ETH_SS_STATS ); ops->get_ethtool_stats (dev, stats, data); -netdev_unlock_ops (dev); }list_for_each_entry (dp, &dst->ports, list) {
@@ -149,10 +141,8 @@ static void dsa_conduit_get_ethtool_phy_stats(struct net_device *dev,if (count >=0 )phy_ethtool_get_stats (dev->phydev, stats, data); }else if (ops && ops->get_sset_count && ops->get_ethtool_phy_stats) { -netdev_lock_ops (dev); count = ops->get_sset_count (dev,ETH_SS_PHY_STATS ); ops->get_ethtool_phy_stats (dev, stats, data); -netdev_unlock_ops (dev); }if (count <0 )
@@ -176,13 +166,11 @@ static int dsa_conduit_get_sset_count(struct net_device *dev, int sset)struct dsa_switch_tree *dst = cpu_dp->dst;int count =0 ; -netdev_lock_ops (dev);if (sset ==ETH_SS_PHY_STATS && dev->phydev && (!ops || !ops->get_ethtool_phy_stats)) count =phy_ethtool_get_sset_count (dev->phydev);else if (ops && ops->get_sset_count) count = ops->get_sset_count (dev, sset); -netdev_unlock_ops (dev);if (count <0 ) count =0 ;
@@ -239,7 +227,6 @@ static void dsa_conduit_get_strings(struct net_device *dev, u32 stringset,struct dsa_switch_tree *dst = cpu_dp->dst;int count, mcount =0 ; -netdev_lock_ops (dev);if (stringset ==ETH_SS_PHY_STATS && dev->phydev && !ops->get_ethtool_phy_stats) { mcount =phy_ethtool_get_sset_count (dev->phydev);
@@ -253,7 +240,6 @@ static void dsa_conduit_get_strings(struct net_device *dev, u32 stringset, mcount =0 ; ops->get_strings (dev, stringset, data); } -netdev_unlock_ops (dev);list_for_each_entry (dp, &dst->ports, list) {if (!dsa_port_is_dsa (dp) && !dsa_port_is_cpu (dp))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 625/957 net: enetc: correct the command BD ring consumer index
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 759a32900b6f3db3d0f34a3b61123742723b50b4 ]
The command BD ring cousumer index register has the consumer index as the lower 10 bits, and the bit 31 is SBE, which indicates whether a system bus error occurred during execution of the CBD command. So if a system bus error occurs, reading the register will get the SBE bit set.
However, the current implementation directly uses the register value as the consumer index without masking it. Therefore, if a system bus error occurs, an incorrect consumer index will be obtained, causing errors in the processing of the command BD ring. Thus, we need to mask out the other bits to obtain the correct consumer index.
In addition, this patch adds a check for the SBE bit after the polling loop and returns an error if the bit is set.
--- drivers/net/ethernet/freescale/enetc/ntmp.c | 13 ++++++++++--- drivers/net/ethernet/freescale/enetc/ntmp_private.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/enetc/ntmp.c +10 -3
@@ -55,7 +55,7 @@ int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev,spin_lock_init (&cbdr->ring_lock); cbdr->next_to_use =netc_read (cbdr->regs.pir); - cbdr->next_to_clean =netc_read (cbdr->regs.cir); + cbdr->next_to_clean =netc_read (cbdr->regs.cir) &NETC_CBDRCIR_INDEX ;/* Step 1: Configure the base address of the Control BD Ring */ netc_write (cbdr->regs.bar0,lower_32_bits (cbdr->dma_base_align));
@@ -98,7 +98,7 @@ static void ntmp_clean_cbdr(struct netc_cbdr *cbdr)int i; i = cbdr->next_to_clean; -while (netc_read (cbdr->regs.cir) != i) { +while ((netc_read (cbdr->regs.cir) &NETC_CBDRCIR_INDEX ) != i) { cbd =ntmp_get_cbd (cbdr, i);memset (cbd,0 ,sizeof (*cbd)); i = (i +1 ) % cbdr->bd_num;
@@ -135,12 +135,19 @@ static int netc_xmit_ntmp_cmd(struct ntmp_user *user, union netc_cbd *cbd) cbdr->next_to_use = i;netc_write (cbdr->regs.pir, i); - err =read_poll_timeout_atomic (netc_read, val, val == i, + err =read_poll_timeout_atomic (netc_read, val, + (val &NETC_CBDRCIR_INDEX ) == i,NETC_CBDR_DELAY_US ,NETC_CBDR_TIMEOUT , true, cbdr->regs.cir);if (unlikely (err)) goto cbdr_unlock; +if (unlikely (val &NETC_CBDRCIR_SBE )) { +dev_err (user->dev,"Command BD system bus error\n" ); + err = -EIO ; + goto cbdr_unlock; + } +dma_rmb ();/* Get the writeback command BD, because the caller may need * to check some other fields of the response header.
drivers/net/ethernet/freescale/enetc/ntmp_private.h +2 -0
@@ -12,6 +12,8 @@#define NTMP_EID_REQ_LEN 8#define NETC_CBDR_BD_NUM 256 +#define NETC_CBDRCIR_INDEX GENMASK(9, 0) +#define NETC_CBDRCIR_SBE BIT(31) union netc_cbd { struct {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 626/957 net: enetc: fix NTMP DMA use-after-free issue
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 3cade698881eb238f88cbbfec82acc2110440a3f ]
The AI-generated review reported a potential DMA use-after-free issue [1]. If netc_xmit_ntmp_cmd() times out and returns an error, the pending command is not explicitly aborted, while ntmp_free_data_mem() unconditionally frees the DMA buffer. If the buffer has already been reallocated elsewhere, this may lead to silent memory corruption. Because the hardware eventually processes the pending command and perform a DMA write of the response to the physical address of the freed buffer.
To resolve this issue, this patch does the following modifications:
1. Convert cbdr->ring_lock from a spinlock to a mutex
The lock was originally a spinlock in case NTMP operations might be invoked from atomic context. After downstream support for all NTMP tables, no such usage has materialized. A mutex lock is now required because the driver now needs to reclaim used BDs and release associated DMA memory within the lock's context, while dma_free_coherent() might sleep.
2. Introduce software command BD (struct netc_swcbd)
The hardware write-back overwrites the addr and len fields of the BD, so the driver cannot rely on the hardware BD to free the associated DMA memory. The driver now maintains a software shadow BD storing the DMA buffer pointer, DMA address, and size. And netc_xmit_ntmp_cmd() only reclaims older BDs when the number of used BDs reaches NETC_CBDR_CLEAN_WORK (16). The software BD enables correct DMA memory release. With this, struct ntmp_dma_buf and ntmp_free_data_mem() are no longer needed and are removed.
3. Require callers to hold ring_lock across netc_xmit_ntmp_cmd()
netc_xmit_ntmp_cmd() releases the ring_lock before the caller finishes consuming the response. At this point, if a concurrent thread submits a new command, it may trigger ntmp_clean_cbdr() and free the DMA buffer while it is still in use. Move ring_lock ownership to the caller to ensure the response buffer cannot be reclaimed prematurely. So the helpers ntmp_select_and_lock_cbdr() and ntmp_unlock_cbdr() are added.
These changes eliminate the DMA use-after-free condition and ensure safe and consistent BD reclamation and DMA buffer lifecycle management.
--- drivers/net/ethernet/freescale/enetc/ntmp.c | 214 ++++++++++-------- .../ethernet/freescale/enetc/ntmp_private.h | 8 +- include/linux/fsl/ntmp.h | 9 +- 3 files changed, 134 insertions(+), 97 deletions(-)
drivers/net/ethernet/freescale/enetc/ntmp.c +125 -89
@@ -7,6 +7,7 @@#include <linux/dma-mapping.h> #include <linux/fsl/netc_global.h> #include <linux/iopoll.h> +#include <linux/vmalloc.h> #include "ntmp_private.h"
@@ -42,6 +43,12 @@ int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev,if (!cbdr->addr_base)return -ENOMEM ; + cbdr->swcbd =vcalloc (cbd_num,sizeof (struct netc_swcbd )); +if (!cbdr->swcbd) { +dma_free_coherent (dev, size, cbdr->addr_base, cbdr->dma_base); +return -ENOMEM ; + } + cbdr->dma_size = size; cbdr->bd_num = cbd_num; cbdr->regs = *regs;
@@ -52,7 +59,7 @@ int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev, cbdr->addr_base_align =PTR_ALIGN (cbdr->addr_base,NTMP_BASE_ADDR_ALIGN ); -spin_lock_init (&cbdr->ring_lock); +mutex_init (&cbdr->ring_lock); cbdr->next_to_use =netc_read (cbdr->regs.pir); cbdr->next_to_clean =netc_read (cbdr->regs.cir) &NETC_CBDRCIR_INDEX ;
@@ -71,10 +78,24 @@ int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev, }EXPORT_SYMBOL_GPL (ntmp_init_cbdr); +static void ntmp_free_data_mem (struct device *dev,struct netc_swcbd *swcbd) +{ +if (unlikely (!swcbd->buf)) +return ; + +dma_free_coherent (dev, swcbd->size +NTMP_DATA_ADDR_ALIGN , + swcbd->buf, swcbd->dma); +} +void ntmp_free_cbdr (struct netc_cbdr *cbdr) {/* Disable the Control BD Ring */ netc_write (cbdr->regs.mr,0 ); + +for (int i =0 ; i < cbdr->bd_num; i++) +ntmp_free_data_mem (cbdr->dev, &cbdr->swcbd[i]); + +vfree (cbdr->swcbd);dma_free_coherent (cbdr->dev, cbdr->dma_size, cbdr->addr_base, cbdr->dma_base);memset (cbdr,0 ,sizeof (*cbdr));
@@ -94,40 +115,59 @@ static union netc_cbd *ntmp_get_cbd(struct netc_cbdr *cbdr, int index)static void ntmp_clean_cbdr (struct netc_cbdr *cbdr) { -union netc_cbd *cbd; -int i; +int i = cbdr->next_to_clean; - i = cbdr->next_to_clean;while ((netc_read (cbdr->regs.cir) &NETC_CBDRCIR_INDEX ) != i) { - cbd =ntmp_get_cbd (cbdr, i); +union netc_cbd *cbd =ntmp_get_cbd (cbdr, i); +struct netc_swcbd *swcbd = &cbdr->swcbd[i]; + +ntmp_free_data_mem (cbdr->dev, swcbd); +memset (swcbd,0 ,sizeof (*swcbd));memset (cbd,0 ,sizeof (*cbd)); i = (i +1 ) % cbdr->bd_num; } +dma_wmb (); cbdr->next_to_clean = i; } -static int netc_xmit_ntmp_cmd (struct ntmp_user *user,union netc_cbd *cbd) +static void ntmp_select_and_lock_cbdr (struct ntmp_user *user, +struct netc_cbdr **cbdr) +{ +/* Currently only ENETC is supported, and it has only one command +* BD ring. +*/ + *cbdr = &user->ring[0 ]; + +mutex_lock (&(*cbdr)->ring_lock); +} + +static void ntmp_unlock_cbdr (struct netc_cbdr *cbdr) +{ +mutex_unlock (&cbdr->ring_lock); +} + +static int netc_xmit_ntmp_cmd (struct netc_cbdr *cbdr,union netc_cbd *cbd, +struct netc_swcbd *swcbd) {union netc_cbd *cur_cbd; -struct netc_cbdr *cbdr; -int i, err; +int i, err, used_bds;u16 status;u32 val; -/* Currently only i.MX95 ENETC is supported, and it only has one -* command BD ring -*/ - cbdr = &user->ring[0 ]; - -spin_lock_bh (&cbdr->ring_lock); - -if (unlikely (!ntmp_get_free_cbd_num (cbdr))) + used_bds = cbdr->bd_num -ntmp_get_free_cbd_num (cbdr); +if (unlikely (used_bds >=NETC_CBDR_CLEAN_WORK )) {ntmp_clean_cbdr (cbdr); +if (unlikely (!ntmp_get_free_cbd_num (cbdr))) { +ntmp_free_data_mem (cbdr->dev, swcbd); +return -EBUSY ; + } + } i = cbdr->next_to_use; cur_cbd =ntmp_get_cbd (cbdr, i); *cur_cbd = *cbd; + cbdr->swcbd[i] = *swcbd;dma_wmb ();/* Update producer index of both software and hardware */
@@ -135,17 +175,16 @@ static int netc_xmit_ntmp_cmd(struct ntmp_user *user, union netc_cbd *cbd) cbdr->next_to_use = i;netc_write (cbdr->regs.pir, i); - err =read_poll_timeout_atomic (netc_read, val, - (val &NETC_CBDRCIR_INDEX ) == i, -NETC_CBDR_DELAY_US ,NETC_CBDR_TIMEOUT , - true, cbdr->regs.cir); + err =read_poll_timeout (netc_read, val, + (val &NETC_CBDRCIR_INDEX ) == i, +NETC_CBDR_DELAY_US ,NETC_CBDR_TIMEOUT , + true, cbdr->regs.cir);if (unlikely (err)) - goto cbdr_unlock; +return err;if (unlikely (val &NETC_CBDRCIR_SBE )) { -dev_err (user->dev,"Command BD system bus error\n" ); - err = -EIO ; - goto cbdr_unlock; +dev_err (cbdr->dev,"Command BD system bus error\n" ); +return -EIO ; }dma_rmb ();
@@ -157,40 +196,29 @@ static int netc_xmit_ntmp_cmd(struct ntmp_user *user, union netc_cbd *cbd)/* Check the writeback error status */ status =le16_to_cpu (cbd->resp_hdr.error_rr) &NTMP_RESP_ERROR ;if (unlikely (status)) { - err = -EIO ; -dev_err (user->dev,"Command BD error: 0x%04x\n" , status); +dev_err (cbdr->dev,"Command BD error: 0x%04x\n" , status); +return -EIO ; } -ntmp_clean_cbdr (cbdr); -dma_wmb (); - -cbdr_unlock: -spin_unlock_bh (&cbdr->ring_lock); - -return err; +return 0 ; } -static int ntmp_alloc_data_mem (struct ntmp_dma_buf *data,void **buf_align) +static int ntmp_alloc_data_mem (struct device *dev,struct netc_swcbd *swcbd, +void **buf_align) {void *buf; - buf =dma_alloc_coherent (data->dev, data->size +NTMP_DATA_ADDR_ALIGN , - &data->dma,GFP_KERNEL ); + buf =dma_alloc_coherent (dev, swcbd->size +NTMP_DATA_ADDR_ALIGN , + &swcbd->dma,GFP_KERNEL );if (!buf)return -ENOMEM ; - data->buf = buf; + swcbd->buf = buf; *buf_align =PTR_ALIGN (buf,NTMP_DATA_ADDR_ALIGN );return 0 ; } -static void ntmp_free_data_mem (struct ntmp_dma_buf *data) -{ -dma_free_coherent (data->dev, data->size +NTMP_DATA_ADDR_ALIGN , - data->buf, data->dma); -} -static void ntmp_fill_request_hdr (union netc_cbd *cbd,dma_addr_t dma,int len,int table_id,int cmd,int access_method)
@@ -241,37 +269,39 @@ static int ntmp_delete_entry_by_id(struct ntmp_user *user, int tbl_id, u8 tbl_ver, u32 entry_id, u32 req_len, u32 resp_len) { - struct ntmp_dma_buf data = { - .dev = user->dev, + struct netc_swcbd swcbd = { .size =max (req_len, resp_len), };struct ntmp_req_by_eid *req; +struct netc_cbdr *cbdr;union netc_cbd cbd;int err; - err =ntmp_alloc_data_mem (&data, (void **)&req); + err =ntmp_alloc_data_mem (user->dev, &swcbd, (void **)&req);if (err)return err;ntmp_fill_crd_eid (req, tbl_ver,0 ,0 , entry_id); -ntmp_fill_request_hdr (&cbd, data.dma,NTMP_LEN (req_len, resp_len), +ntmp_fill_request_hdr (&cbd, swcbd.dma,NTMP_LEN (req_len, resp_len), tbl_id,NTMP_CMD_DELETE ,NTMP_AM_ENTRY_ID ); - err =netc_xmit_ntmp_cmd (user, &cbd); +ntmp_select_and_lock_cbdr (user, &cbdr); + err =netc_xmit_ntmp_cmd (cbdr, &cbd, &swcbd);if (err)dev_err (user->dev,"Failed to delete entry 0x%x of %s, err: %pe" , entry_id,ntmp_table_name (tbl_id),ERR_PTR (err)); - -ntmp_free_data_mem (&data); +ntmp_unlock_cbdr (cbdr);return err; } -static int ntmp_query_entry_by_id (struct ntmp_user *user,int tbl_id, -u32 len,struct ntmp_req_by_eid *req, -dma_addr_t dma,bool compare_eid) +static int ntmp_query_entry_by_id (struct netc_cbdr *cbdr,int tbl_id, +struct ntmp_req_by_eid *req, +struct netc_swcbd *swcbd, +bool compare_eid) { +u32 len =NTMP_LEN (sizeof (*req), swcbd->size);struct ntmp_cmn_resp_query *resp;int cmd =NTMP_CMD_QUERY ;union netc_cbd cbd;
@@ -283,10 +313,11 @@ static int ntmp_query_entry_by_id(struct ntmp_user *user, int tbl_id, cmd =NTMP_CMD_QU ;/* Request header */ -ntmp_fill_request_hdr (&cbd, dma, len, tbl_id, cmd,NTMP_AM_ENTRY_ID ); - err =netc_xmit_ntmp_cmd (user, &cbd); +ntmp_fill_request_hdr (&cbd, swcbd->dma, len, tbl_id, cmd, +NTMP_AM_ENTRY_ID ); + err =netc_xmit_ntmp_cmd (cbdr, &cbd, swcbd);if (err) { -dev_err (user->dev, +dev_err (cbdr->dev,"Failed to query entry 0x%x of %s, err: %pe\n" , entry_id,ntmp_table_name (tbl_id),ERR_PTR (err));return err;
@@ -300,7 +331,7 @@ static int ntmp_query_entry_by_id(struct ntmp_user *user, int tbl_id, resp = (struct ntmp_cmn_resp_query *)req;if (unlikely (le32_to_cpu (resp->entry_id) != entry_id)) { -dev_err (user->dev, +dev_err (cbdr->dev,"%s: query EID 0x%x doesn't match response EID 0x%x\n" ,ntmp_table_name (tbl_id), entry_id,le32_to_cpu (resp->entry_id));return -EIO ;
@@ -312,15 +343,15 @@ static int ntmp_query_entry_by_id(struct ntmp_user *user, int tbl_id,int ntmp_maft_add_entry (struct ntmp_user *user,u32 entry_id,struct maft_entry_data *maft) { -struct ntmp_dma_buf data = { - .dev = user->dev, +struct netc_swcbd swcbd = { .size =sizeof (struct maft_req_add ), };struct maft_req_add *req; +struct netc_cbdr *cbdr;union netc_cbd cbd;int err; - err =ntmp_alloc_data_mem (&data, (void **)&req); + err =ntmp_alloc_data_mem (user->dev, &swcbd, (void **)&req);if (err)return err;
@@ -329,14 +360,15 @@ int ntmp_maft_add_entry(struct ntmp_user *user, u32 entry_id, req->keye = maft->keye; req->cfge = maft->cfge; -ntmp_fill_request_hdr (&cbd, data.dma,NTMP_LEN (data.size,0 ), +ntmp_fill_request_hdr (&cbd, swcbd.dma,NTMP_LEN (swcbd.size,0 ),NTMP_MAFT_ID ,NTMP_CMD_ADD ,NTMP_AM_ENTRY_ID ); - err =netc_xmit_ntmp_cmd (user, &cbd); + +ntmp_select_and_lock_cbdr (user, &cbdr); + err =netc_xmit_ntmp_cmd (cbdr, &cbd, &swcbd);if (err)dev_err (user->dev,"Failed to add MAFT entry 0x%x, err: %pe\n" , entry_id,ERR_PTR (err)); - -ntmp_free_data_mem (&data); +ntmp_unlock_cbdr (cbdr);return err; }
@@ -345,31 +377,31 @@ EXPORT_SYMBOL_GPL(ntmp_maft_add_entry);int ntmp_maft_query_entry (struct ntmp_user *user,u32 entry_id,struct maft_entry_data *maft) { -struct ntmp_dma_buf data = { - .dev = user->dev, +struct netc_swcbd swcbd = { .size =sizeof (struct maft_resp_query ), };struct maft_resp_query *resp;struct ntmp_req_by_eid *req; +struct netc_cbdr *cbdr;int err; - err =ntmp_alloc_data_mem (&data, (void **)&req); + err =ntmp_alloc_data_mem (user->dev, &swcbd, (void **)&req);if (err)return err;ntmp_fill_crd_eid (req, user->tbl.maft_ver,0 ,0 , entry_id); - err =ntmp_query_entry_by_id (user,NTMP_MAFT_ID , -NTMP_LEN (sizeof (*req), data.size), - req, data.dma, true); + +ntmp_select_and_lock_cbdr (user, &cbdr); + err =ntmp_query_entry_by_id (cbdr,NTMP_MAFT_ID , req, &swcbd, true);if (err) - goto end; + goto unlock_cbdr; resp = (struct maft_resp_query *)req; maft->keye = resp->keye; maft->cfge = resp->cfge; -end: -ntmp_free_data_mem (&data); +unlock_cbdr: +ntmp_unlock_cbdr (cbdr);return err; }
@@ -385,8 +417,9 @@ EXPORT_SYMBOL_GPL(ntmp_maft_delete_entry);int ntmp_rsst_update_entry (struct ntmp_user *user,const u32 *table,int count) { -struct ntmp_dma_buf data = {.dev = user->dev};struct rsst_req_update *req; +struct netc_swcbd swcbd; +struct netc_cbdr *cbdr;union netc_cbd cbd;int err, i;
@@ -394,8 +427,8 @@ int ntmp_rsst_update_entry(struct ntmp_user *user, const u32 *table,/* HW only takes in a full 64 entry table */ return -EINVAL ; - data.size =struct_size (req, groups, count); - err =ntmp_alloc_data_mem (&data, (void **)&req); + swcbd.size =struct_size (req, groups, count); + err =ntmp_alloc_data_mem (user->dev, &swcbd, (void **)&req);if (err)return err;
@@ -405,15 +438,15 @@ int ntmp_rsst_update_entry(struct ntmp_user *user, const u32 *table,for (i =0 ; i < count; i++) req->groups[i] = (u8)(table[i]); -ntmp_fill_request_hdr (&cbd, data.dma,NTMP_LEN (data.size,0 ), +ntmp_fill_request_hdr (&cbd, swcbd.dma,NTMP_LEN (swcbd.size,0 ),NTMP_RSST_ID ,NTMP_CMD_UPDATE ,NTMP_AM_ENTRY_ID ); - err =netc_xmit_ntmp_cmd (user, &cbd); +ntmp_select_and_lock_cbdr (user, &cbdr); + err =netc_xmit_ntmp_cmd (cbdr, &cbd, &swcbd);if (err)dev_err (user->dev,"Failed to update RSST entry, err: %pe\n" ,ERR_PTR (err)); - -ntmp_free_data_mem (&data); +ntmp_unlock_cbdr (cbdr);return err; }
@@ -421,8 +454,9 @@ EXPORT_SYMBOL_GPL(ntmp_rsst_update_entry);int ntmp_rsst_query_entry (struct ntmp_user *user,u32 *table,int count) { -struct ntmp_dma_buf data = {.dev = user->dev};struct ntmp_req_by_eid *req; +struct netc_swcbd swcbd; +struct netc_cbdr *cbdr;union netc_cbd cbd;int err, i;u8 *group;
@@ -431,21 +465,23 @@ int ntmp_rsst_query_entry(struct ntmp_user *user, u32 *table, int count)/* HW only takes in a full 64 entry table */ return -EINVAL ; - data.size =NTMP_ENTRY_ID_SIZE +RSST_STSE_DATA_SIZE (count) + -RSST_CFGE_DATA_SIZE (count); - err =ntmp_alloc_data_mem (&data, (void **)&req); + swcbd.size =NTMP_ENTRY_ID_SIZE +RSST_STSE_DATA_SIZE (count) + +RSST_CFGE_DATA_SIZE (count); + err =ntmp_alloc_data_mem (user->dev, &swcbd, (void **)&req);if (err)return err;/* Set the request data buffer */ ntmp_fill_crd_eid (req, user->tbl.rsst_ver,0 ,0 ,0 ); -ntmp_fill_request_hdr (&cbd, data.dma,NTMP_LEN (sizeof (*req), data.size), +ntmp_fill_request_hdr (&cbd, swcbd.dma,NTMP_LEN (sizeof (*req), swcbd.size),NTMP_RSST_ID ,NTMP_CMD_QUERY ,NTMP_AM_ENTRY_ID ); - err =netc_xmit_ntmp_cmd (user, &cbd); + +ntmp_select_and_lock_cbdr (user, &cbdr); + err =netc_xmit_ntmp_cmd (cbdr, &cbd, &swcbd);if (err) {dev_err (user->dev,"Failed to query RSST entry, err: %pe\n" ,ERR_PTR (err)); - goto end; + goto unlock_cbdr; } group = (u8 *)req;
@@ -453,8 +489,8 @@ int ntmp_rsst_query_entry(struct ntmp_user *user, u32 *table, int count)for (i =0 ; i < count; i++) table[i] = group[i]; -end: -ntmp_free_data_mem (&data); +unlock_cbdr: +ntmp_unlock_cbdr (cbdr);return err; }
drivers/net/ethernet/freescale/enetc/ntmp_private.h +1 -7
@@ -14,6 +14,7 @@#define NETC_CBDR_BD_NUM 256#define NETC_CBDRCIR_INDEX GENMASK(9, 0)#define NETC_CBDRCIR_SBE BIT(31) +#define NETC_CBDR_CLEAN_WORK 16 union netc_cbd { struct {
@@ -56,13 +57,6 @@ union netc_cbd { } resp_hdr;/* NTMP Response Message Header Format */ }; -struct ntmp_dma_buf { -struct device *dev; -size_t size; -void *buf; -dma_addr_t dma; -}; -struct ntmp_cmn_req_data {__le16 update_act;u8 dbg_opt;
include/linux/fsl/ntmp.h +8 -1
@@ -31,6 +31,12 @@ struct netc_tbl_vers {u8 rsst_ver; }; +struct netc_swcbd { +void *buf; +dma_addr_t dma; +size_t size; +}; +struct netc_cbdr {struct device *dev;struct netc_cbdr_regs regs;
@@ -44,9 +50,10 @@ struct netc_cbdr {void *addr_base_align;dma_addr_t dma_base;dma_addr_t dma_base_align; +struct netc_swcbd *swcbd;/* Serialize the order of command BD ring */ -spinlock_t ring_lock; +struct mutex ring_lock; };struct ntmp_user {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 627/957 smb: move smb_version_values to common/smbglob.h
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhangGuoDong <[email protected]>
[ Upstream commit 34cf191bb6a349dc88ec2c4f6355fe006ac669e0 ]
Merge the struct members of the server and the client:
- req_capabilities: from client
- header_preamble_size: from client
- cap_unicode: from client
- capabilities: from server, rename to req_capabilities
- max_read_size: from server
- max_write_size: from server
- max_trans_size: from server
- max_credits: from server
- create_durable_size: from server
- create_durable_v2_size: from server
- create_mxac_size: from server
- create_disk_id_size: from server
- create_posix_size: from server
Then move duplicate definitions to common header file.
Stable-dep-of: 1baff47b81f9 ("ksmbd: fix use-after-free in smb2_open during durable reconnect")
--- fs/smb/client/cifsglob.h | 22 ---------------------- fs/smb/common/cifsglob.h | 31 +++++++++++++++++++++++++++++++ fs/smb/server/smb2misc.c | 2 +- fs/smb/server/smb2ops.c | 32 ++++++++++++++++---------------- fs/smb/server/smb2pdu.c | 10 +++++----- fs/smb/server/smb_common.h | 29 ----------------------------- 6 files changed, 53 insertions(+), 73 deletions(-)
fs/smb/client/cifsglob.h +0 -22
@@ -634,28 +634,6 @@ struct smb_version_operations { struct kvec *xattr_iov); }; -struct smb_version_values { -char *version_string; -__u16 protocol_id; -__u32 req_capabilities; -__u32 large_lock_type; -__u32 exclusive_lock_type; -__u32 shared_lock_type; -__u32 unlock_lock_type; -size_t header_preamble_size; -size_t header_size; -size_t max_header_size; -size_t read_rsp_size; -__le16 lock_cmd; -unsigned int cap_unix; -unsigned int cap_nt_find; -unsigned int cap_large_files; -unsigned int cap_unicode; -__u16 signing_enabled; -__u16 signing_required; -size_t create_lease_size; -}; -#define HEADER_SIZE (server) (server->vals->header_size)#define MAX_HEADER_SIZE (server) (server->vals->max_header_size)#define HEADER_PREAMBLE_SIZE (server) (server->vals->header_preamble_size)
fs/smb/common/cifsglob.h +31 -0
@@ -9,6 +9,37 @@#ifndef _COMMON_CIFS_GLOB_H#define _COMMON_CIFS_GLOB_H +struct smb_version_values { +char *version_string; +__u16 protocol_id; +__le16 lock_cmd; +__u32 req_capabilities; +__u32 max_read_size; +__u32 max_write_size; +__u32 max_trans_size; +__u32 max_credits; +__u32 large_lock_type; +__u32 exclusive_lock_type; +__u32 shared_lock_type; +__u32 unlock_lock_type; +size_t header_preamble_size; +size_t header_size; +size_t max_header_size; +size_t read_rsp_size; +unsigned int cap_unix; +unsigned int cap_nt_find; +unsigned int cap_large_files; +unsigned int cap_unicode; +__u16 signing_enabled; +__u16 signing_required; +size_t create_lease_size; +size_t create_durable_size; +size_t create_durable_v2_size; +size_t create_mxac_size; +size_t create_disk_id_size; +size_t create_posix_size; +}; +static inline void inc_rfc1001_len (void *buf,int count) {be32_add_cpu ((__be32 *)buf, count);
fs/smb/server/smb2misc.c +1 -1
@@ -460,7 +460,7 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work) } validate_credit: -if ((work->conn->vals->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU ) && +if ((work->conn->vals->req_capabilities &SMB2_GLOBAL_CAP_LARGE_MTU ) &&smb2_validate_credit_charge (work->conn, hdr))return 1 ;
fs/smb/server/smb2ops.c +16 -16
@@ -15,7 +15,7 @@static struct smb_version_values smb21_server_values = { .version_string =SMB21_VERSION_STRING , .protocol_id =SMB21_PROT_ID , - .capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , .max_read_size =SMB21_DEFAULT_IOSIZE , .max_write_size =SMB21_DEFAULT_IOSIZE , .max_trans_size =SMB21_DEFAULT_IOSIZE ,
@@ -41,7 +41,7 @@ static struct smb_version_values smb21_server_values = {static struct smb_version_values smb30_server_values = { .version_string =SMB30_VERSION_STRING , .protocol_id =SMB30_PROT_ID , - .capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , .max_read_size =SMB3_DEFAULT_IOSIZE , .max_write_size =SMB3_DEFAULT_IOSIZE , .max_trans_size =SMB3_DEFAULT_TRANS_SIZE ,
@@ -68,7 +68,7 @@ static struct smb_version_values smb30_server_values = {static struct smb_version_values smb302_server_values = { .version_string =SMB302_VERSION_STRING , .protocol_id =SMB302_PROT_ID , - .capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , .max_read_size =SMB3_DEFAULT_IOSIZE , .max_write_size =SMB3_DEFAULT_IOSIZE , .max_trans_size =SMB3_DEFAULT_TRANS_SIZE ,
@@ -95,7 +95,7 @@ static struct smb_version_values smb302_server_values = {static struct smb_version_values smb311_server_values = { .version_string =SMB311_VERSION_STRING , .protocol_id =SMB311_PROT_ID , - .capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , + .req_capabilities =SMB2_GLOBAL_CAP_LARGE_MTU , .max_read_size =SMB3_DEFAULT_IOSIZE , .max_write_size =SMB3_DEFAULT_IOSIZE , .max_trans_size =SMB3_DEFAULT_TRANS_SIZE ,
@@ -204,7 +204,7 @@ void init_smb2_1_server(struct ksmbd_conn *conn) conn->signing_algorithm =SIGNING_ALG_HMAC_SHA256_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_LEASING ; }/**
@@ -221,20 +221,20 @@ void init_smb3_0_server(struct ksmbd_conn *conn) conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING | + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_DIRECTORY_LEASING ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION && conn->cli_cap &SMB2_GLOBAL_CAP_ENCRYPTION ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION || (!(server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF ) && conn->cli_cap &SMB2_GLOBAL_CAP_ENCRYPTION )) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ; }/**
@@ -251,19 +251,19 @@ void init_smb3_02_server(struct ksmbd_conn *conn) conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING | + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_DIRECTORY_LEASING ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION || (!(server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF ) && conn->cli_cap &SMB2_GLOBAL_CAP_ENCRYPTION )) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_ENCRYPTION ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_DURABLE_HANDLE ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ; }/**
@@ -280,14 +280,14 @@ int init_smb3_11_server(struct ksmbd_conn *conn) conn->signing_algorithm =SIGNING_ALG_AES_CMAC_LE ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB2_LEASES ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_LEASING | + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_LEASING |SMB2_GLOBAL_CAP_DIRECTORY_LEASING ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_MULTI_CHANNEL ;if (server_conf.flags &KSMBD_GLOBAL_FLAG_DURABLE_HANDLE ) - conn->vals->capabilities |=SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ; + conn->vals->req_capabilities |=SMB2_GLOBAL_CAP_PERSISTENT_HANDLES ;INIT_LIST_HEAD (&conn->preauth_sess_table);return 0 ;
fs/smb/server/smb2pdu.c +5 -5
@@ -291,7 +291,7 @@ int init_smb2_neg_rsp(struct ksmbd_work *work)/* Not setting conn guid rsp->ServerGUID, as it * not used by client for identifying connection */ - rsp->Capabilities =cpu_to_le32 (conn->vals->capabilities); + rsp->Capabilities =cpu_to_le32 (conn->vals->req_capabilities);/* Default Max Message Size till SMB2.0, 64K*/ rsp->MaxTransactSize =cpu_to_le32 (conn->vals->max_trans_size); rsp->MaxReadSize =cpu_to_le32 (conn->vals->max_read_size);
@@ -965,7 +965,7 @@ bool smb3_encryption_negotiated(struct ksmbd_conn *conn)* SMB 3.0 and 3.0.2 dialects use the SMB2_GLOBAL_CAP_ENCRYPTION flag. * SMB 3.1.1 uses the cipher_type field. */ -return (conn->vals->capabilities &SMB2_GLOBAL_CAP_ENCRYPTION ) || +return (conn->vals->req_capabilities &SMB2_GLOBAL_CAP_ENCRYPTION ) || conn->cipher_type; }
@@ -1219,7 +1219,7 @@ int smb2_handle_negotiate(struct ksmbd_work *work) rc = -EINVAL ; goto err_out; } - rsp->Capabilities =cpu_to_le32 (conn->vals->capabilities); + rsp->Capabilities =cpu_to_le32 (conn->vals->req_capabilities);/* For stats */ conn->connection_type = conn->dialect;
@@ -3505,7 +3505,7 @@ int smb2_open(struct ksmbd_work *work) share_ret =ksmbd_smb_check_shared_mode (fp->filp, fp);if (!test_share_config_flag (work->tcon->share_conf,KSMBD_SHARE_FLAG_OPLOCKS ) || (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE && - !(conn->vals->capabilities &SMB2_GLOBAL_CAP_LEASING ))) { + !(conn->vals->req_capabilities &SMB2_GLOBAL_CAP_LEASING ))) {if (share_ret <0 && !S_ISDIR (file_inode (fp->filp)->i_mode)) { rc = share_ret; goto err_out1;
@@ -8100,7 +8100,7 @@ static int fsctl_validate_negotiate_info(struct ksmbd_conn *conn, goto err_out; } - neg_rsp->Capabilities =cpu_to_le32 (conn->vals->capabilities); + neg_rsp->Capabilities =cpu_to_le32 (conn->vals->req_capabilities);memset (neg_rsp->Guid,0 ,SMB2_CLIENT_GUID_SIZE ); neg_rsp->SecurityMode =cpu_to_le16 (conn->srv_sec_mode); neg_rsp->Dialect =cpu_to_le16 (conn->dialect);
fs/smb/server/smb_common.h +0 -29
@@ -338,35 +338,6 @@ struct file_id_full_dir_info {char FileName[]; } __packed;/* level 0x105 FF rsp data */ -struct smb_version_values { -char *version_string; -__u16 protocol_id; -__le16 lock_cmd; -__u32 capabilities; -__u32 max_read_size; -__u32 max_write_size; -__u32 max_trans_size; -__u32 max_credits; -__u32 large_lock_type; -__u32 exclusive_lock_type; -__u32 shared_lock_type; -__u32 unlock_lock_type; -size_t header_size; -size_t max_header_size; -size_t read_rsp_size; -unsigned int cap_unix; -unsigned int cap_nt_find; -unsigned int cap_large_files; -__u16 signing_enabled; -__u16 signing_required; -size_t create_lease_size; -size_t create_durable_size; -size_t create_durable_v2_size; -size_t create_mxac_size; -size_t create_disk_id_size; -size_t create_posix_size; -}; -struct filesystem_posix_info {/* For undefined recommended transfer size return -1 in that field */ __le32 OptimalTransferSize;/* bsize on some os, iosize on other os */
Signature · 1 line
2.53.0