* [PATCH 7.3 001/742] sched/fair: Use guard in sched_group_set_idle()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 002/742] sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle Greg Kroah-Hartman
` (156 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Zijlstra (Intel),
Kayra Cizmeci, Vincent Guittot, Josh Don, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 9a92f776dfa6a88fc16fe0512c725734190bf9d0 ]
Cleanup the code by using guards; prepares for further changes in this function.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Josh Don <joshdon@google.com>
Link: https://patch.msgid.link/20261105170157.453569788@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/fair.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d1ea0e53f1657..bb32341728d0f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -15819,12 +15819,9 @@ int sched_group_set_idle(struct task_group *tg, long idle)
if (idle < 0 || idle > 1)
return -EINVAL;
- mutex_lock(&shares_mutex);
-
- if (tg->idle == idle) {
- mutex_unlock(&shares_mutex);
+ guard(mutex)(&shares_mutex);
+ if (tg->idle == idle)
return 0;
- }
tg->idle = idle;
@@ -15834,13 +15831,12 @@ int sched_group_set_idle(struct task_group *tg, long idle)
struct cfs_rq *grp_cfs_rq = tg_cfs_rq(tg, i);
bool was_idle = cfs_rq_is_idle(grp_cfs_rq);
long idle_task_delta;
- struct rq_flags rf;
- rq_lock_irqsave(rq, &rf);
+ guard(rq_lock_irqsave)(rq);
grp_cfs_rq->idle = idle;
if (WARN_ON_ONCE(was_idle == cfs_rq_is_idle(grp_cfs_rq)))
- goto next_cpu;
+ continue;
idle_task_delta = grp_cfs_rq->h_nr_queued -
grp_cfs_rq->h_nr_idle;
@@ -15859,9 +15855,6 @@ int sched_group_set_idle(struct task_group *tg, long idle)
if (cfs_rq_is_idle(cfs_rq))
break;
}
-
-next_cpu:
- rq_unlock_irqrestore(rq, &rf);
}
/* Idle groups have minimum weight. */
@@ -15870,7 +15863,6 @@ int sched_group_set_idle(struct task_group *tg, long idle)
else
__sched_group_set_shares(tg, NICE_0_LOAD);
- mutex_unlock(&shares_mutex);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 002/742] sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 001/742] sched/fair: Use guard in sched_group_set_idle() Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 003/742] mm/page_alloc: apply per-task GFP context in bulk allocator Greg Kroah-Hartman
` (155 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Zijlstra (Intel),
Kayra Cizmeci, Vincent Guittot, Josh Don, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 75545668ae0fd80c08fe8fd0c6799b2ba9284557 ]
Rather than keeping cfs_rq::idle as a copy of tg::idle, make it the sum of
all ancestor tg::idle. This makes it trivial to tell if the current cgroup
is marked idle somewhere along its ancestral path.
This makes se_is_idle() behave differently. Notably is will now be true when
there is a idle cgroup anywhere in the ancestor path. This addresses an issue
where preemption of cgroup::idle was overlooked when flattening the runqueue.
Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Josh Don <joshdon@google.com>
Link: https://patch.msgid.link/20261107113639.GK2668200@noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/debug.c | 1 +
kernel/sched/fair.c | 88 +++++++++++++++++++++++++++-----------------
kernel/sched/sched.h | 2 +-
3 files changed, 56 insertions(+), 35 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 72236db67983b..9206e081bec2c 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -1118,6 +1118,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
atomic_long_read(&cfs_rq->tg->load_avg));
SEQ_printf(m, " .%-30s: %lu\n", "h_load",
cfs_rq->h_load);
+ SEQ_printf(m, " .%-30s: %d\n", "idle", cfs_rq->idle);
#endif /* CONFIG_FAIR_GROUP_SCHED */
#ifdef CONFIG_CFS_BANDWIDTH
SEQ_printf(m, " .%-30s: %d\n", "throttled",
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bb32341728d0f..2c9dd314771e8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -445,8 +445,10 @@ static int cfs_rq_is_idle(struct cfs_rq *cfs_rq)
static int se_is_idle(struct sched_entity *se)
{
- if (entity_is_task(se))
- return task_has_idle_policy(task_of(se));
+ if (entity_is_task(se)) {
+ return task_has_idle_policy(task_of(se)) ||
+ cfs_rq_is_idle(cfs_rq_of(se));
+ }
return cfs_rq_is_idle(group_cfs_rq(se));
}
@@ -15688,19 +15690,20 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
void online_fair_sched_group(struct task_group *tg)
{
- struct sched_entity *se;
- struct rq_flags rf;
- struct rq *rq;
int i;
for_each_possible_cpu(i) {
- rq = cpu_rq(i);
- se = tg_se(tg, i);
- rq_lock_irq(rq, &rf);
+ struct cfs_rq *cfs_rq = tg_cfs_rq(tg, i);
+ struct sched_entity *se = tg_se(tg, i);
+ struct rq *rq = cpu_rq(i);
+
+ guard(rq_lock_irq)(rq);
+
update_rq_clock(rq);
attach_entity_cfs_rq(se);
sync_throttle(tg, i);
- rq_unlock_irq(rq, &rf);
+
+ cfs_rq->idle = tg_cfs_rq(tg->parent, i)->idle;
}
}
@@ -15809,6 +15812,43 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
return ret;
}
+struct tg_set_idle_struct {
+ long idle;
+ int cpu;
+};
+
+static int tg_set_idle_up(struct task_group *tg, void *data)
+{
+ struct tg_set_idle_struct *tsi = data;
+ struct cfs_rq *grp_cfs_rq = tg_cfs_rq(tg, tsi->cpu);
+ struct sched_entity *se = tg_se(tg, tsi->cpu);
+ int old_idle = grp_cfs_rq->idle;
+ int task_delta;
+
+ grp_cfs_rq->idle += tsi->idle;
+
+ if (!!old_idle == !!grp_cfs_rq->idle)
+ return 0;
+
+ task_delta = grp_cfs_rq->h_nr_queued - grp_cfs_rq->h_nr_idle;
+ if (!task_delta)
+ return 0;
+
+ task_delta *= tsi->idle;
+ for_each_sched_entity(se) {
+ struct cfs_rq *cfs_rq = cfs_rq_of(se);
+
+ if (!se->on_rq)
+ break;
+
+ cfs_rq->h_nr_idle += task_delta;
+
+ if (cfs_rq_is_idle(cfs_rq))
+ break;
+ }
+ return 0;
+}
+
int sched_group_set_idle(struct task_group *tg, long idle)
{
int i;
@@ -15827,34 +15867,14 @@ int sched_group_set_idle(struct task_group *tg, long idle)
for_each_possible_cpu(i) {
struct rq *rq = cpu_rq(i);
- struct sched_entity *se = tg_se(tg, i);
- struct cfs_rq *grp_cfs_rq = tg_cfs_rq(tg, i);
- bool was_idle = cfs_rq_is_idle(grp_cfs_rq);
- long idle_task_delta;
guard(rq_lock_irqsave)(rq);
- grp_cfs_rq->idle = idle;
- if (WARN_ON_ONCE(was_idle == cfs_rq_is_idle(grp_cfs_rq)))
- continue;
-
- idle_task_delta = grp_cfs_rq->h_nr_queued -
- grp_cfs_rq->h_nr_idle;
- if (!cfs_rq_is_idle(grp_cfs_rq))
- idle_task_delta *= -1;
-
- for_each_sched_entity(se) {
- struct cfs_rq *cfs_rq = cfs_rq_of(se);
-
- if (!se->on_rq)
- break;
-
- cfs_rq->h_nr_idle += idle_task_delta;
-
- /* Already accounted at parent level and above. */
- if (cfs_rq_is_idle(cfs_rq))
- break;
- }
+ struct tg_set_idle_struct tsi = {
+ .idle = idle ? 1 : -1,
+ .cpu = i,
+ };
+ walk_tg_tree_from(tg, tg_nop, tg_set_idle_up, &tsi);
}
/* Idle groups have minimum weight. */
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index b345f62263b3e..61b913032c640 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -751,7 +751,7 @@ struct cfs_rq {
struct list_head leaf_cfs_rq_list;
struct task_group *tg; /* Group that "owns" this runqueue */
- /* Locally cached copy of our task_group's idle value */
+ /* Sum of all ancestor tg->idle. */
int idle;
# ifdef CONFIG_CFS_BANDWIDTH
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 003/742] mm/page_alloc: apply per-task GFP context in bulk allocator
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 001/742] sched/fair: Use guard in sched_group_set_idle() Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 002/742] sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 004/742] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
` (154 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qiqi Liu, Andrew Morton,
Vlastimil Babka (SUSE), Brendan Jackman, Johannes Weiner,
Michal Hocko, Suren Baghdasaryan, Zi Yan, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiqi Liu <liuqiqi@kylinos.cn>
[ Upstream commit 1372648980b8524a5747a2732e90b20d3db10c3c ]
alloc_pages_bulk_noprof() does not call current_gfp_context(), so per-task
scoped allocation constraints (PF_MEMALLOC_NOIO, PF_MEMALLOC_NOFS,
PF_MEMALLOC_PIN) are not applied on the bulk fast path.
By ignoring PF_MEMALLOC_NOIO and PF_MEMALLOC_NOFS, the allocation can
theoretically result in a deadlock.
Ignoring PF_MEMALLOC_PIN also has consequences: without clearing
__GFP_MOVABLE, prepare_alloc_pages() selects MIGRATE_MOVABLE for the PCP
list, and a task with PF_MEMALLOC_PIN set receives movable pages from the
bulk allocator. Once pinned, these pages can no longer be migrated but
remain in MOVABLE pageblocks, violating the mobility contract. This can
increase fragmentation and interfere with compaction or contiguous-memory
allocations, eventually surfacing as higher allocation latency or
allocation failures under memory pressure.
Found via review of the bulk allocation tracepoint hooks [1].
Link: https://sashiko.dev/#/patchset/20260907120949.418450-1-liuqiqi%40kylinos.cn
Link: https://lore.kernel.org/all/20260907120949.418450-1-liuqiqi@kylinos.cn/ [1]
Link: https://lore.kernel.org/20260915074928.327471-1-liuqiqi@kylinos.cn
Fixes: 387ba26fb1cb ("mm/page_alloc: add a bulk page allocator")
Signed-off-by: Qiqi Liu <liuqiqi@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Stable-dep-of: bcfc8286f0cd ("mm/page_alloc: retry allocations that raced with a zonelist rebuild")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 55232081a32b2..86f4901c4c2f2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5262,6 +5262,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
/* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
gfp &= gfp_allowed_mask;
+ gfp = current_gfp_context(gfp);
if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 004/742] mm/page_alloc: retry allocations that raced with a zonelist rebuild
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (2 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 003/742] mm/page_alloc: apply per-task GFP context in bulk allocator Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 005/742] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
` (153 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit bcfc8286f0cd5a74c827d502f9f1ad408d7eff30 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone. The iterator approves a slot,
then the allocator loads the zone from it, so a GFP_KERNEL request can
land in ZONE_MOVABLE and a nodemask request on a node outside its mask:
CPU 0 CPU 1
prepare_alloc_pages()
first_zones_zonelist(nodemask {1})
slot 0 (NORMAL1) approved
online_pages()
build_all_zonelists()
[NORMAL1, NORMAL2, ...]
-> [MOVABLE1, NORMAL1, ...]
get_page_from_freelist()
zone = zonelist_zone(slot 0) /* MOVABLE1 */
allocates from MOVABLE1
zonelist_update_seq detects the rebuild, but only the slowpath's failure
exits check it.
Check it whenever an allocation succeeds too, and if it changed, free
the page and retry, as the memcg charge failure path does. Eligible
pages are dropped as well: zonelists only change when memory comes or
goes, and a retry is simpler than rechecking the page.
Freeing the page does not undo a block the allocation claimed. A
GFP_KERNEL request that lands in a fresh ZONE_MOVABLE converts a free
block to MIGRATE_UNMOVABLE, which stays until the zone's movable free
list runs out and a movable allocation takes it back.
The fast and bulk paths read the seqlock's raw seqcount without waiting:
an ALLOC_NOLOCK caller can be an NMI that interrupted the writer, and on
PREEMPT_RT the seqlock accessor takes the spinlock. A sample taken
mid-write costs a retry, or NULL under ALLOC_NOLOCK.
check_retry_zonelist() returns 0 when compiled out, so a backport
without the hot-add change stays harmless.
Fixes: 11cd8638c37f ("mm, page_alloc: remove stop_machine from build_all_zonelists")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Link: https://patch.msgid.link/20261101021340.2251928-9-gourry@gourry.net
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 86f4901c4c2f2..bc02971867220 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4443,12 +4443,25 @@ static unsigned int zonelist_iter_begin(void)
return 0;
}
+/*
+ * Never wait for the writer, which an ALLOC_NOLOCK caller in NMI may have
+ * interrupted. Read the raw seqcount: on PREEMPT_RT the seqlock accessor takes
+ * the spinlock while a write is in progress.
+ */
+static unsigned int zonelist_iter_sample(void)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return raw_seqcount_begin(&zonelist_update_seq.seqcount.seqcount);
+
+ return 0;
+}
+
static unsigned int check_retry_zonelist(unsigned int seq)
{
if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqretry(&zonelist_update_seq, seq);
- return seq;
+ return 0;
}
/* Perform direct synchronous page reclaim */
@@ -5139,6 +5152,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
warn_alloc(gfp_mask, ac->nodemask,
"page allocation failure: order:%u", order);
got_pg:
+ /* A rebuild during the walk may have handed out an ineligible zone. */
+ if (page && check_retry_zonelist(zonelist_iter_cookie)) {
+ __free_frozen_pages(page, order, FPI_NONE);
+ page = NULL;
+ goto restart;
+ }
return page;
}
@@ -5223,6 +5242,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
struct list_head *pcp_list;
struct alloc_context ac;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
+ unsigned int zonelist_iter_cookie;
int nr_populated = 0, nr_account = 0;
/*
@@ -5263,6 +5283,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
/* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
gfp &= gfp_allowed_mask;
gfp = current_gfp_context(gfp);
+ zonelist_iter_cookie = zonelist_iter_sample();
if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
goto out;
@@ -5312,6 +5333,10 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
if (unlikely(!zone))
goto failed;
+ /* The zone was chosen from a zonelist that a rebuild may have changed. */
+ if (unlikely(check_retry_zonelist(zonelist_iter_cookie)))
+ goto failed;
+
/* spin_trylock may fail due to a parallel drain or IRQ reentrancy. */
pcp = pcp_spin_trylock(zone->per_cpu_pageset);
if (!pcp)
@@ -5450,6 +5475,7 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
.alloc_flags = alloc_flags,
};
unsigned int fastpath_alloc_flags = alloc_flags;
+ unsigned int zonelist_iter_cookie;
/* Other flags could be supported later if needed. */
if (WARN_ON(alloc_flags & ~(ALLOC_NOLOCK | ALLOC_NO_CODETAG)))
@@ -5479,6 +5505,7 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
*/
gfp = current_gfp_context(gfp);
alloc_gfp = gfp;
+ zonelist_iter_cookie = zonelist_iter_sample();
if (!prepare_alloc_pages(gfp, order, preferred_nid, nodemask, &ac,
&alloc_gfp, &fastpath_alloc_flags))
return NULL;
@@ -5495,6 +5522,11 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
/* First allocation attempt (or, for nolock, only attempt) */
page = get_page_from_freelist(alloc_gfp, order, fastpath_alloc_flags, &ac);
+ if (likely(page) && unlikely(check_retry_zonelist(zonelist_iter_cookie))) {
+ __free_frozen_pages(page, order,
+ alloc_flags & ALLOC_NOLOCK ? FPI_NOLOCK : 0);
+ page = NULL;
+ }
if (likely(page) || (alloc_flags & ALLOC_NOLOCK))
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 005/742] mm/hugetlb: retry the pool walk when the zonelist is rebuilt
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (3 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 004/742] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 006/742] gve: Fix race between stats query and queue reconfig Greg Kroah-Hartman
` (152 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit 9f6674f842bbceda8326cf4e494af5ad3a5a05e6 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone. dequeue_hugetlb_folio_nodemask()
approves a slot by its node, then loads the zone from it, so a hugetlb
fault bound to one node can take a pool page from another:
CPU 0 CPU 1
dequeue_hugetlb_folio_nodemask(nodemask {2})
slot 3 (NORMAL2) approved
online_pages()
build_all_zonelists()
[.., NORMAL1, NORMAL2]
-> [.., MOVABLE1, NORMAL1, ...]
zone = zonelist_zone(slot 3) /* NORMAL1 */
dequeue_hugetlb_folio_node_exact(h, 1)
Check zonelist_update_seq before using each zone, and on the way out
with nothing found, and restart the walk if it changed. Checking before
the dequeue leaves nothing to put back. Reset the last-tried node on
restart, so it is not skipped.
With kprobes holding the walk across the online, a fault bound to node 2
took a node 1 page in 3 of 3 runs, and a node 2 page in 3 of 3 with this
change.
Fixes: 11cd8638c37f ("mm, page_alloc: remove stop_machine from build_all_zonelists")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-10-gourry@gourry.net
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/hugetlb.c | 13 ++++++++++---
mm/page_alloc.c | 18 +-----------------
mm/page_alloc.h | 19 +++++++++++++++++++
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 82963b9977b45..4d184378b89a7 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1285,11 +1285,11 @@ static struct folio *dequeue_hugetlb_folio_node_exact(struct hstate *h,
static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_mask,
int nid, nodemask_t *nmask)
{
- unsigned int cpuset_mems_cookie;
+ unsigned int cpuset_mems_cookie, zonelist_cookie;
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
- int node = NUMA_NO_NODE;
+ int node;
/* 'nid' should not be NUMA_NO_NODE. Try to catch any misuse of it and rectifiy. */
if (nid == NUMA_NO_NODE)
@@ -1298,10 +1298,16 @@ static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_
zonelist = node_zonelist(nid, gfp_mask);
retry_cpuset:
+ node = NUMA_NO_NODE;
cpuset_mems_cookie = read_mems_allowed_begin();
+ zonelist_cookie = zonelist_iter_begin();
for_each_zone_zonelist_nodemask(zone, z, zonelist, gfp_zone(gfp_mask), nmask) {
struct folio *folio;
+ /* A rebuild may have shifted a node outside @nmask into this slot. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry_cpuset;
+
if (!cpuset_zone_allowed(zone, gfp_mask))
continue;
/*
@@ -1316,7 +1322,8 @@ static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_
if (folio)
return folio;
}
- if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie)))
+ if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie) ||
+ check_retry_zonelist(zonelist_cookie)))
goto retry_cpuset;
return NULL;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bc02971867220..b006cc8217a6a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4433,15 +4433,7 @@ EXPORT_SYMBOL_GPL(fs_reclaim_release);
* retries the allocation if zonelist changes. Writer side is protected by the
* embedded spin_lock.
*/
-static DEFINE_SEQLOCK(zonelist_update_seq);
-
-static unsigned int zonelist_iter_begin(void)
-{
- if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
- return read_seqbegin(&zonelist_update_seq);
-
- return 0;
-}
+DEFINE_SEQLOCK(zonelist_update_seq);
/*
* Never wait for the writer, which an ALLOC_NOLOCK caller in NMI may have
@@ -4456,14 +4448,6 @@ static unsigned int zonelist_iter_sample(void)
return 0;
}
-static unsigned int check_retry_zonelist(unsigned int seq)
-{
- if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
- return read_seqretry(&zonelist_update_seq, seq);
-
- return 0;
-}
-
/* Perform direct synchronous page reclaim */
static unsigned long
__perform_reclaim(gfp_t gfp_mask, unsigned int order,
diff --git a/mm/page_alloc.h b/mm/page_alloc.h
index a9b72cb9520e1..2ae37ffdb623f 100644
--- a/mm/page_alloc.h
+++ b/mm/page_alloc.h
@@ -9,6 +9,7 @@
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/nodemask.h>
+#include <linux/seqlock.h>
#include <linux/types.h>
#define ALLOC_DEFAULT 0
@@ -267,6 +268,24 @@ extern void zone_pcp_disable(struct zone *zone);
extern void zone_pcp_enable(struct zone *zone);
extern void zone_pcp_init(struct zone *zone);
+extern seqlock_t zonelist_update_seq;
+
+static inline unsigned int zonelist_iter_begin(void)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return read_seqbegin(&zonelist_update_seq);
+
+ return 0;
+}
+
+static inline unsigned int check_retry_zonelist(unsigned int seq)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return read_seqretry(&zonelist_update_seq, seq);
+
+ return 0;
+}
+
enum fallback_result {
/* Found suitable migratetype, *mt_out is valid. */
FALLBACK_FOUND,
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 006/742] gve: Fix race between stats query and queue reconfig
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (4 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 005/742] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 007/742] gve: Block invalid ring sizes when device options are 0 Greg Kroah-Hartman
` (151 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Debarghya Kundu, Pin-yen Lin,
Harshitha Ramamurthy, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <treapking@google.com>
[ Upstream commit 7de69da15088ac2add08eb2b5f5c0a79fd461c1e ]
Fix a concurrency bug where network statistics queries race with queue
reconfiguration or interface teardown, causing a Use-After-Free (UAF) or
NULL pointer dereference.
Currently, statistics queries access priv->tx and priv->rx without
locking. When an interface is brought down or reconfigured,
gve_queues_mem_remove() frees these arrays. A concurrent stats query
can dereference freed queue structures and crash the kernel.
This issue was discovered and actually triggered by the
drivers/net/stats.py selftest. When an interface was brought down,
querying per-queue statistics via Netlink caused a kernel NULL pointer
dereference in gve_get_rx_queue_stats():
BUG: kernel NULL pointer dereference, address: 00000000000000a0
RIP: 0010:gve_get_rx_queue_stats+0x17/0x50 [gve]
Call Trace:
<TASK>
netdev_stat_queue_sum+0x11c/0x250
netdev_nl_stats_by_netdev+0x21b/0x2d0
netdev_nl_qstats_get_dumpit+0xd2/0x220
genl_dumpit+0x32/0x90
netlink_dump+0x1d2/0x450
__netlink_dump_start+0x1db/0x2a0
genl_family_rcv_msg_dumpit+0x9b/0x100
...
The per-queue stats callbacks run under the netdev instance lock, so
this NULL dereference is not a race; it happens on any query while the
interface is down.
Additionally, concurrent stats queries during queue reconfiguration can
race with gve_queues_mem_remove(), causing a Use-After-Free.
This affects gve_get_stats(), which does not hold the instance lock.
gve_handle_report_stats() also runs without it; it is stopped before
queue teardown, but can still read priv->rx[idx] while the single-queue
restart path rewrites it.
Fix this by introducing stats_lock to serialize stats queries against
queue teardown. In gve_queues_mem_remove(), queue pointers are set to
NULL under stats_lock before freeing. Stats readers acquire the lock
and verify pointers are non-NULL before reading counters.
The per-queue stats callbacks already run under the instance lock, but
take stats_lock as well for consistency.
The single-queue restart path also rewrites priv->rx[idx] in place, so
gve_rx_queue_stop() and gve_rx_queue_start() do those writes under
stats_lock as well.
This change was tested using the DQO RDA queue format.
Cc: stable@vger.kernel.org
Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
Fixes: 2e5e0932dff5 ("gve: add support for basic queue stats")
Co-developed-by: Debarghya Kundu <debarghyak@google.com>
Signed-off-by: Debarghya Kundu <debarghyak@google.com>
Signed-off-by: Pin-yen Lin <treapking@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20261109182036.2910559-2-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adjusted context in gve_queues_start() and gve_queues_mem_remove() because this tree sets the header-split and packet-buffer-size fields later in gve_queues_start(), so the unlock follows rx_pages_per_qpl. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/google/gve/gve.h | 5 +++
drivers/net/ethernet/google/gve/gve_main.c | 43 ++++++++++++++++++++--
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index c280ff35ee771..59c7fb32fda76 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -883,6 +883,11 @@ struct gve_priv {
struct workqueue_struct *gve_wq;
struct work_struct service_task;
struct work_struct stats_report_task;
+ /* Protects the priv->tx/priv->rx arrays, the in-place rewrite of
+ * priv->rx[idx] and the queue counts against stats readers that do
+ * not hold the netdev instance lock.
+ */
+ spinlock_t stats_lock;
unsigned long service_task_flags;
unsigned long state_flags;
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index a6c18e2431cc7..1bcc8318c9d9d 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -114,6 +114,7 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
int num_tx_queues;
int ring;
+ spin_lock_bh(&priv->stats_lock);
num_tx_queues = gve_num_tx_queues(priv);
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
@@ -141,6 +142,7 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
s->tx_bytes += bytes;
}
}
+ spin_unlock_bh(&priv->stats_lock);
}
static int gve_alloc_flow_rule_caches(struct gve_priv *priv)
@@ -1386,9 +1388,13 @@ static void gve_queues_mem_remove(struct gve_priv *priv)
struct gve_rx_alloc_rings_cfg rx_alloc_cfg = {0};
gve_get_curr_alloc_cfgs(priv, &tx_alloc_cfg, &rx_alloc_cfg);
- gve_queues_mem_free(priv, &tx_alloc_cfg, &rx_alloc_cfg);
+
+ spin_lock_bh(&priv->stats_lock);
priv->tx = NULL;
priv->rx = NULL;
+ spin_unlock_bh(&priv->stats_lock);
+
+ gve_queues_mem_free(priv, &tx_alloc_cfg, &rx_alloc_cfg);
}
/* The passed-in queue memory is stored into priv and the queues are made live.
@@ -1402,6 +1408,7 @@ static int gve_queues_start(struct gve_priv *priv,
int err;
/* Record new resources into priv */
+ spin_lock_bh(&priv->stats_lock);
priv->tx = tx_alloc_cfg->tx;
priv->rx = rx_alloc_cfg->rx;
@@ -1413,10 +1420,11 @@ static int gve_queues_start(struct gve_priv *priv,
priv->rx_desc_cnt = rx_alloc_cfg->ring_size;
priv->tx_pages_per_qpl = tx_alloc_cfg->pages_per_qpl;
priv->rx_pages_per_qpl = rx_alloc_cfg->pages_per_qpl;
+ gve_init_sync_stats(priv);
+ spin_unlock_bh(&priv->stats_lock);
gve_tx_start_rings(priv, gve_num_tx_queues(priv));
gve_rx_start_rings(priv, rx_alloc_cfg->qcfg_rx->num_queues);
- gve_init_sync_stats(priv);
err = netif_set_real_num_tx_queues(dev, priv->tx_cfg.num_queues);
if (err)
@@ -2296,6 +2304,7 @@ void gve_handle_report_stats(struct gve_priv *priv)
if (!gve_get_report_stats(priv))
return;
+ spin_lock_bh(&priv->stats_lock);
be64_add_cpu(&priv->stats_report->written_count, 1);
/* tx stats */
if (priv->tx) {
@@ -2360,6 +2369,7 @@ void gve_handle_report_stats(struct gve_priv *priv)
};
}
}
+ spin_unlock_bh(&priv->stats_lock);
}
/* Handle NIC status register changes, reset requests and report stats */
@@ -2668,8 +2678,10 @@ static int gve_rx_queue_stop(struct net_device *dev, void *per_q_mem, int idx)
gve_turnup_and_check_status(priv);
gve_per_q_mem = (struct gve_rx_ring *)per_q_mem;
+ spin_lock_bh(&priv->stats_lock);
*gve_per_q_mem = priv->rx[idx];
memset(&priv->rx[idx], 0, sizeof(priv->rx[idx]));
+ spin_unlock_bh(&priv->stats_lock);
return 0;
}
@@ -2723,7 +2735,9 @@ static int gve_rx_queue_start(struct net_device *dev,
return -EAGAIN;
gve_per_q_mem = (struct gve_rx_ring *)per_q_mem;
+ spin_lock_bh(&priv->stats_lock);
priv->rx[idx] = *gve_per_q_mem;
+ spin_unlock_bh(&priv->stats_lock);
/* Single-queue creation requires quiescence on all queues */
gve_turndown(priv);
@@ -2759,7 +2773,9 @@ static int gve_rx_queue_start(struct net_device *dev,
* which needs the rtnl lock, will not run till this func returns and
* its caller gives up the lock.
*/
+ spin_lock_bh(&priv->stats_lock);
memset(&priv->rx[idx], 0, sizeof(priv->rx[idx]));
+ spin_unlock_bh(&priv->stats_lock);
return err;
}
@@ -2775,9 +2791,15 @@ static void gve_get_rx_queue_stats(struct net_device *dev, int idx,
struct netdev_queue_stats_rx *rx_stats)
{
struct gve_priv *priv = netdev_priv(dev);
- struct gve_rx_ring *rx = &priv->rx[idx];
+ struct gve_rx_ring *rx;
unsigned int start;
+ spin_lock_bh(&priv->stats_lock);
+ if (!priv->rx)
+ goto unlock;
+
+ rx = &priv->rx[idx];
+
do {
start = u64_stats_fetch_begin(&rx->statss);
rx_stats->packets = rx->rpackets;
@@ -2785,20 +2807,32 @@ static void gve_get_rx_queue_stats(struct net_device *dev, int idx,
rx_stats->alloc_fail = rx->rx_skb_alloc_fail +
rx->rx_buf_alloc_fail;
} while (u64_stats_fetch_retry(&rx->statss, start));
+
+unlock:
+ spin_unlock_bh(&priv->stats_lock);
}
static void gve_get_tx_queue_stats(struct net_device *dev, int idx,
struct netdev_queue_stats_tx *tx_stats)
{
struct gve_priv *priv = netdev_priv(dev);
- struct gve_tx_ring *tx = &priv->tx[idx];
+ struct gve_tx_ring *tx;
unsigned int start;
+ spin_lock_bh(&priv->stats_lock);
+ if (!priv->tx)
+ goto unlock;
+
+ tx = &priv->tx[idx];
+
do {
start = u64_stats_fetch_begin(&tx->statss);
tx_stats->packets = tx->pkt_done;
tx_stats->bytes = tx->bytes_done;
} while (u64_stats_fetch_retry(&tx->statss, start));
+
+unlock:
+ spin_unlock_bh(&priv->stats_lock);
}
static void gve_get_base_stats(struct net_device *dev,
@@ -2915,6 +2949,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
INIT_WORK(&priv->service_task, gve_service_task);
INIT_WORK(&priv->stats_report_task, gve_stats_report_task);
+ spin_lock_init(&priv->stats_lock);
priv->tx_cfg.max_queues = max_tx_queues;
priv->rx_cfg.max_queues = max_rx_queues;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 007/742] gve: Block invalid ring sizes when device options are 0
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (5 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 006/742] gve: Fix race between stats query and queue reconfig Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 008/742] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
` (150 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pin-yen Lin, Joshua Washington,
Jordan Rhee, Harshitha Ramamurthy, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <treapking@google.com>
[ Upstream commit edc9a730ad3c98662047a76db2d7f26ea4350b2e ]
On older device versions, minimum ring sizes in the device option are
reported as 0. The driver imports these 0 values, allowing userspace
(`ethtool -G`) to request invalidly small ring sizes.
This issue was discovered and actually triggered by the
drivers/net/ring_reconfig.py selftest (ringparam test case). Halving the
ring size down to 1 triggered a kernel NULL pointer dereference in
gve_tx_alloc_rings_dqo():
BUG: kernel NULL pointer dereference, address: 0000000000000002
RIP: 0010:gve_tx_alloc_rings_dqo+0x1c4/0x510 [gve]
Call Trace:
<TASK>
gve_queues_mem_alloc+0x29/0xa0 [gve]
gve_adjust_config+0x1b/0x140 [gve]
gve_set_ringparam+0x1f4/0x250 [gve]
ethnl_set_rings+0x260/0x440
...
Fix this by falling back to the driver's default minimum ring sizes
(GVE_DEFAULT_MIN_RX_RING_SIZE and GVE_DEFAULT_MIN_TX_RING_SIZE) whenever
the device option reports minimum ring sizes as 0.
The device reports either both minimum ring sizes or neither, so a
single fallback for both is sufficient.
This change was tested using the DQO RDA queue format.
Cc: stable@vger.kernel.org
Fixes: ed4fb326947d ("gve: add support to read ring size ranges from the device")
Signed-off-by: Pin-yen Lin <treapking@google.com>
Reviewed-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20261109182036.2910559-4-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/google/gve/gve_adminq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index f05f4895f4c74..5e2f91b633350 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -189,7 +189,9 @@ void gve_parse_device_option(struct gve_priv *priv,
*dev_op_modify_ring = (void *)(option + 1);
/* device has not provided min ring size */
- if (option_length == GVE_DEVICE_OPTION_NO_MIN_RING_SIZE)
+ if (option_length == GVE_DEVICE_OPTION_NO_MIN_RING_SIZE ||
+ be16_to_cpu((*dev_op_modify_ring)->min_rx_ring_size) == 0 ||
+ be16_to_cpu((*dev_op_modify_ring)->min_tx_ring_size) == 0)
priv->default_min_ring_size = true;
break;
case GVE_DEV_OPT_ID_FLOW_STEERING:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 008/742] Bluetooth: L2CAP: Only accept LE responses to outstanding requests
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (6 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 007/742] gve: Block invalid ring sizes when device options are 0 Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 009/742] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
` (149 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit f50b32aa233d4687af2d241ddcb572da969e8989 ]
The LE and ECRED response handlers match channels by identifier without
checking whether they sent the request. An incoming channel stores the
identifier chosen by the peer, so an unsolicited response can bypass
deferred setup, delete an established channel, or leave an unaccepted
socket and channel allocated after l2cap_chan_del().
Extend the BR/EDR lookup from commit a518b9a9ef6e ("Bluetooth: L2CAP:
Only accept connection responses to outstanding requests") to LE.
Require the matching connect-request flag and add a reconfigure-request
flag. Check reconfigure identifiers under the channel lock, since
BT_RCVMTU can replace a request without the connection lock. Match all
members of a rejected ECRED request, which share one identifier.
A reconfigure request can outlive close(). Complete it even in
BT_DISCONN, and call the close callback after deletion to release an
orphaned socket. Otherwise deletion cancels the timer and removes the
channel before the disconnect response or the channel timeout can close
it.
AI assistance was used.
Fixes: f1496dee9cbd ("Bluetooth: Add initial code for LE L2CAP Connect Request")
Fixes: 71fb419724fa ("Bluetooth: Fix handling of L2CAP Command Reject over LE")
Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Cc: <stable@vger.kernel.org> # 5.7.x: a518b9a9ef6e: Bluetooth: L2CAP: Only accept connection responses to outstanding requests
Cc: <stable@vger.kernel.org> # 5.7.x
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Dropped the lockdep_assert_held() and __must_hold() annotations, since this tree lacks them; the l2cap_le_command_rej() and l2cap_ecred_reconf_rsp() logic is otherwise unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_core.c | 78 +++++++++++++++++------------------
2 files changed, 40 insertions(+), 39 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 84f557d354cae..b864d50bb5e59 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -749,6 +749,7 @@ enum {
FLAG_DEFER_SETUP,
FLAG_LE_CONN_REQ_SENT,
FLAG_ECRED_CONN_REQ_SENT,
+ FLAG_ECRED_RECONF_REQ_SENT,
FLAG_PENDING_SECURITY,
FLAG_HOLD_HCI_CONN,
FLAG_DEL,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index fdf92a3d57455..7ac5dd0fb6fe4 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -139,23 +139,12 @@ static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
return c;
}
-static struct l2cap_chan *__l2cap_get_chan_by_ident(struct l2cap_conn *conn,
- u8 ident)
-{
- struct l2cap_chan *c;
-
- list_for_each_entry(c, &conn->chan_l, list) {
- if (c->ident == ident)
- return c;
- }
- return NULL;
-}
-
/* Our connection request has been sent and is still outstanding */
static bool l2cap_chan_connect_pending(struct l2cap_chan *chan)
{
return chan->state == BT_CONNECT &&
- test_bit(CONF_CONNECT_PEND, &chan->conf_state);
+ (test_bit(CONF_CONNECT_PEND, &chan->conf_state) ||
+ test_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags));
}
/* Other channels may hold the same ident for a response they still have
@@ -167,7 +156,7 @@ static struct l2cap_chan *__l2cap_get_connect_chan_by_ident(struct l2cap_conn *c
struct l2cap_chan *c;
list_for_each_entry(c, &conn->chan_l, list) {
- if (c->ident == ident && l2cap_chan_connect_pending(c))
+ if (l2cap_chan_connect_pending(c) && c->ident == ident)
return c;
}
return NULL;
@@ -4964,7 +4953,7 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
BT_DBG("dcid 0x%4.4x mtu %u mps %u credits %u result 0x%2.2x",
dcid, mtu, mps, credits, result);
- chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
+ chan = __l2cap_get_connect_chan_by_ident(conn, cmd->ident);
if (!chan)
return -EBADSLT;
@@ -5501,9 +5490,10 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
struct l2cap_chan *orig;
u16 dcid;
- if (chan->ident != cmd->ident ||
+ if (chan->state != BT_CONNECT ||
chan->mode != L2CAP_MODE_EXT_FLOWCTL ||
- chan->state == BT_CONNECTED)
+ !test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags) ||
+ chan->ident != cmd->ident)
continue;
l2cap_chan_hold(chan);
@@ -5718,23 +5708,24 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn,
BT_DBG("result 0x%4.4x", result);
- if (!result) {
- list_for_each_entry(chan, &conn->chan_l, list) {
- if (chan->ident == cmd->ident)
- chan->ident = 0;
- }
- return 0;
- }
-
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
- if (chan->ident != cmd->ident)
+ /* Reconfiguration updates ident with only chan->lock held. */
+ if (data_race(READ_ONCE(chan->ident)) != cmd->ident)
continue;
if (!l2cap_chan_hold_unless_zero(chan))
continue;
l2cap_chan_lock(chan);
- l2cap_chan_del(chan, ECONNRESET);
+ if (chan->ident == cmd->ident &&
+ test_and_clear_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags)) {
+ if (result) {
+ l2cap_chan_del(chan, ECONNRESET);
+ chan->ops->close(chan);
+ } else {
+ chan->ident = 0;
+ }
+ }
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
@@ -5748,25 +5739,33 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
u8 *data)
{
struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data;
- struct l2cap_chan *chan;
+ struct l2cap_chan *chan, *tmp;
if (cmd_len < sizeof(*rej))
return -EPROTO;
- chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
- if (!chan)
- goto done;
+ list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
+ /* Reconfiguration updates ident with only chan->lock held. */
+ if (data_race(READ_ONCE(chan->ident)) != cmd->ident)
+ continue;
- chan = l2cap_chan_hold_unless_zero(chan);
- if (!chan)
- goto done;
+ if (!l2cap_chan_hold_unless_zero(chan))
+ continue;
- l2cap_chan_lock(chan);
- l2cap_chan_del(chan, ECONNREFUSED);
- l2cap_chan_unlock(chan);
- l2cap_chan_put(chan);
+ l2cap_chan_lock(chan);
+ if (chan->ident == cmd->ident &&
+ ((chan->state == BT_CONNECT &&
+ (test_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags) ||
+ test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags))) ||
+ test_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags))) {
+ l2cap_chan_del(chan, ECONNREFUSED);
+ chan->ops->close(chan);
+ }
+
+ l2cap_chan_unlock(chan);
+ l2cap_chan_put(chan);
+ }
-done:
return 0;
}
@@ -7628,6 +7627,7 @@ static void l2cap_ecred_reconfigure(struct l2cap_chan *chan)
pdu->scid[0] = cpu_to_le16(chan->scid);
chan->ident = l2cap_get_ident(conn);
+ set_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags);
l2cap_send_cmd(conn, chan->ident, L2CAP_ECRED_RECONF_REQ,
struct_size(pdu, scid, 1), pdu);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 009/742] ksmbd: pin parent dentries in SMB2 CREATE ACL path
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (7 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 008/742] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 010/742] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
` (148 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jiwoo Kim, Namjae Jeon,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiwoo Kim <arpe1618@gmail.com>
[ Upstream commit 0383a66dabd7aa06237b9b24713c03656abeffe4 ]
smb2_open() and smb_inherit_dacl() read a child's d_parent without a
dentry reference. A concurrent SMB request can move the child and
remove the parent while CREATE uses its inode for permission, status,
and ACL inheritance work. A remote SMB race with concurrent opener and
mover connections on a writable KSMBD acl_xattr share triggered an
8-byte slab-use-after-free read in get_cached_acl on tmpfs and ext4
KASAN guests. With oops=panic, it also caused an Oops and kernel panic
on an ext4 guest.
Take a parent dentry reference around each parent inode or ACL access
in these paths and release it when the operation completes. Treat a
negative parent dentry as -ENOENT for the affected operation.
On a tmpfs KASAN QEMU guest, two 3,000-round reproducer instances
completed without a KASAN report or Oops; SMB remained reachable. On
an ext4 non-KASAN QEMU guest with oops=panic, a 2,000-operation no-race
control and two 5,000-round reproducer instances completed without an
Oops or panic. An SMB health probe still succeeded.
OpenAI Codex assisted with finding the bug, generating the SMB race
reproducer, drafting this fix and changelog, and running the tests.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@kernel.org
Signed-off-by: Jiwoo Kim <arpe1618@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Dropped the kunit include and the const on idmap from the smbacl.c context lines, since this tree has neither, and kept only the fix's own changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 39 +++++++++++++++++++++++++++++++--------
fs/smb/server/smbacl.c | 9 ++++++++-
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 8f9773e0cf016..d6359702faa3e 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4974,16 +4974,32 @@ int smb2_open(struct ksmbd_work *work)
if ((daccess & FILE_DELETE_LE) ||
(req->CreateOptions & FILE_DELETE_ON_CLOSE_LE)) {
- rc = inode_permission(idmap,
- d_inode(path.dentry->d_parent),
- MAY_EXEC | MAY_WRITE);
+ struct dentry *parent = dget_parent(path.dentry);
+ struct inode *parent_inode = d_inode(parent);
+
+ if (parent_inode)
+ rc = inode_permission(idmap, parent_inode,
+ MAY_EXEC | MAY_WRITE);
+ else
+ rc = -ENOENT;
+ dput(parent);
if (rc)
goto err_out;
}
}
}
- rc = ksmbd_query_inode_status(path.dentry->d_parent);
+ {
+ struct dentry *parent = dget_parent(path.dentry);
+
+ if (!d_inode(parent)) {
+ dput(parent);
+ rc = -ENOENT;
+ goto err_out;
+ }
+ rc = ksmbd_query_inode_status(parent);
+ dput(parent);
+ }
if (rc == KSMBD_INODE_STATUS_PENDING_DELETE) {
rc = -EBUSY;
goto err_out;
@@ -5066,10 +5082,17 @@ int smb2_open(struct ksmbd_work *work)
if (created) {
int posix_acl_rc;
struct inode *inode = d_inode(path.dentry);
-
- posix_acl_rc = ksmbd_vfs_inherit_posix_acl(idmap,
- &path,
- d_inode(path.dentry->d_parent));
+ struct inode *parent_inode;
+ struct dentry *parent;
+
+ parent = dget_parent(path.dentry);
+ parent_inode = d_inode(parent);
+ if (parent_inode)
+ posix_acl_rc = ksmbd_vfs_inherit_posix_acl(idmap, &path,
+ parent_inode);
+ else
+ posix_acl_rc = -ENOENT;
+ dput(parent);
if (posix_acl_rc)
ksmbd_debug(SMB, "inherit posix acl failed : %d\n", posix_acl_rc);
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index c3be25f2db87b..27da571c96127 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -7,6 +7,7 @@
*/
#include <linux/fs.h>
+#include <linux/dcache.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/mnt_idmapping.h>
@@ -1200,7 +1201,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,
struct smb_acl *parent_pdacl;
struct smb_ntsd *parent_pntsd = NULL;
struct smb_sid owner_sid, group_sid;
- struct dentry *parent = path->dentry->d_parent;
+ struct dentry *parent;
struct mnt_idmap *idmap = mnt_idmap(path->mnt);
int inherited_flags = 0, flags = 0, i, nt_size = 0, pdacl_size;
int rc = 0, pntsd_type, ppntsd_size, acl_len, aces_size;
@@ -1210,8 +1211,14 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,
char *aces_base;
bool is_dir = S_ISDIR(d_inode(path->dentry)->i_mode);
+ parent = dget_parent(path->dentry);
+ if (!d_inode(parent)) {
+ dput(parent);
+ return -ENOENT;
+ }
ppntsd_size = ksmbd_vfs_get_sd_xattr(conn, idmap,
parent, &parent_pntsd);
+ dput(parent);
if (ppntsd_size <= 0)
return -ENOENT;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 010/742] ksmbd: refuse to read a handle that is not open for reading
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (8 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 009/742] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 011/742] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
` (147 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wahid Khan, Ian Bridges, Namjae Jeon,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wahid Khan <wahidzk0091@gmail.com>
[ Upstream commit 2fd145f8865bb1a6c38a3dc68fa44290008789d8 ]
smb2_create_open_flags() picks the open mode from the read and write
bits of the desired access. FILE_EXECUTE and FILE_READ_ATTRIBUTES select
neither, so a request for FILE_WRITE_DATA | FILE_EXECUTE |
FILE_READ_ATTRIBUTES opens the file O_WRONLY.
smb2_read() accepts FILE_READ_ATTRIBUTES and ksmbd_vfs_read() accepts
FILE_EXECUTE, so a later READ on that handle passes both checks and
reaches __kernel_read() on a file that has no FMODE_READ:
WARNING: fs/read_write.c:518 at __kernel_read
__kernel_read
ksmbd_vfs_read
smb2_read
handle_ksmbd_work
Any client that can open a file with write access on a share, including
a guest session, can trigger it; with panic_on_warn it takes the machine
down.
Return STATUS_ACCESS_DENIED when the file is not readable.
Fixes: f44158485826 ("cifsd: add file operations")
Cc: stable@vger.kernel.org
Signed-off-by: Wahid Khan <wahidzk0091@gmail.com>
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: adjusted context: the new FMODE_READ check is inserted before this tree's if (!work->tcon->posix_extensions) { line instead of upstream's if (!fp->is_posix_ctxt) {. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/vfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index f88daeb5ef873..d9b8714f01beb 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -366,6 +366,10 @@ int ksmbd_vfs_read(struct ksmbd_work *work, struct ksmbd_file *fp, size_t count,
if (ksmbd_stream_fd(fp))
return ksmbd_vfs_stream_read(fp, rbuf, pos, count);
+ /* The access granted on open can include FILE_EXECUTE for a write-only file */
+ if (!(filp->f_mode & FMODE_READ))
+ return -EACCES;
+
if (!work->tcon->posix_extensions) {
int ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 011/742] comedi: comedi_bond: Fix leak of opened device references
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (9 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 010/742] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 012/742] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY Greg Kroah-Hartman
` (146 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Wentao Liang, Ian Abbott,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <abbotti@mev.co.uk>
commit fa0858523f07f8dd71d89b221f4422c3b8096d90 upstream.
bonding_attach() calls do_dev_config() to open other comedi devices
specified by the user and tries to make use of them as part of the
'bonding' device. If it successfully opens the other device but cannot
use it (either because it does not any subdevices of a type the
'bonding' device can use, or because of some error that occurs while
dealing with its subdevices) then it is left in the open state and the
fact that it is open does not get recorded by the 'bonding' device, so
the reference to the opened device gets lost. Fix it by closing the
opened device if it could not be bound to the 'bonding' device.
To match previous behavior, if the opened device is unsuitable then
ignore it (after closing it). The opened devices recorded by the
'bonding' device will eventually get closed by bonding_detach() even if
bonding_attach() returns an error.
Fixes: 3cf840f65ad5 ("Staging: comedi: add comedi_bond driver")
Cc: stable <stable@kernel.org>
Reported-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/lkml/20261103063301.1025860-1-vulab@iscas.ac.cn
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20261103173610.89687-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fa0858523f07f8dd71d89b221f4422c3b8096d90)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/comedi/drivers/comedi_bond.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/comedi/drivers/comedi_bond.c b/drivers/comedi/drivers/comedi_bond.c
index 8e10ecab4f0dc..aeb34eaa6a0e7 100644
--- a/drivers/comedi/drivers/comedi_bond.c
+++ b/drivers/comedi/drivers/comedi_bond.c
@@ -182,7 +182,9 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
char file[sizeof("/dev/comediXXXXXX")];
int minor = it->options[i];
struct comedi_device *d;
- int sdev = -1, nchans;
+ int sdev = -1;
+ int nchans;
+ int nope = 1;
struct bonded_device *bdev;
struct bonded_device **devs;
@@ -221,11 +223,14 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
dev_err(dev->class_dev,
"comedi_get_n_channels() returned %d on minor %u subdev %d!\n",
nchans, minor, sdev);
- return -EINVAL;
+ nope = -EINVAL;
+ break;
}
bdev = kmalloc_obj(*bdev);
- if (!bdev)
- return -ENOMEM;
+ if (!bdev) {
+ nope = -ENOMEM;
+ break;
+ }
bdev->dev = d;
bdev->minor = minor;
@@ -246,10 +251,12 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
dev_err(dev->class_dev,
"Could not allocate memory. Out of memory?\n");
kfree(bdev);
- return -ENOMEM;
+ nope = -ENOMEM;
+ break;
}
devpriv->devs = devs;
devpriv->devs[devpriv->ndevs++] = bdev;
+ nope = 0; /* keeps the device open */
{
/* Append dev:subdev to devpriv->name */
char buf[20];
@@ -260,6 +267,13 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
sizeof(devpriv->name));
}
}
+
+ if (nope) {
+ /* Opened device cannot be used, so close it. */
+ comedi_close_from(d, dev->minor);
+ if (nope < 0)
+ return nope;
+ }
}
if (!devpriv->nchans) {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 012/742] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (10 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 011/742] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 013/742] sched_ext: Reset task fields on exit of an SCX_TASK_READY task Greg Kroah-Hartman
` (145 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alice Ryhl, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Ryhl <aliceryhl@google.com>
commit ff9de8571f05e8f62f9cbe29f38e0aedda9389cf upstream.
When building a reply fails in Thread::reply_inner(), BR_FAILED_REPLY is
delivered to the caller before BR_TRANSACTION_COMPLETE is pushed to the
replying thread's work list.
In a nested transaction, the caller can wake up upon receiving
BR_FAILED_REPLY and send an outer reply to the replying thread before
BR_TRANSACTION_COMPLETE is queued. This causes the outer BR_REPLY to
arrive ahead of BR_TRANSACTION_COMPLETE, which is not legal. This leads
to userspace tripping on an assertion.
Thus, push BR_TRANSACTION_COMPLETE in Thread::reply_inner() before
delivering BR_FAILED_REPLY to the caller.
As a nice side effect, this lets us remove the now-unused
BR_TRANSACTION_COMPLETE error path in Thread::transaction().
Cc: stable@vger.kernel.org
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Link: https://patch.msgid.link/20261028-binder-reply-fail-v1-1-8b71d4daaf1d@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[aliceryhl: resolve conflicts in Thread::transaction() and reply_inner()]
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/android/binder/error.rs | 1 -
drivers/android/binder/thread.rs | 68 +++++++++++++++-----------------
2 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/drivers/android/binder/error.rs b/drivers/android/binder/error.rs
index 1296072c35d96..b9faf09566108 100644
--- a/drivers/android/binder/error.rs
+++ b/drivers/android/binder/error.rs
@@ -79,7 +79,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
BR_FROZEN_REPLY => f.pad("BR_FROZEN_REPLY"),
BR_TRANSACTION_PENDING_FROZEN => f.pad("BR_TRANSACTION_PENDING_FROZEN"),
- BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
_ => match self.source.as_ref() {
Some(source) => source.fmt(f),
None => self.reply.fmt(f),
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index a1bef151c2c59..e1929f5739dfb 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -1309,37 +1309,36 @@ fn transaction(self: &Arc<Self>, cmd: u32, reader: &mut UserSliceReader) -> Resu
self.transaction_inner(&mut info)
};
+ // This runs when a transaction fails with an error returned to the caller.
if let Err(err) = ret {
self.push_return_work(err.reply);
- if err.reply != BR_TRANSACTION_COMPLETE {
- info.reply = err.reply;
- if let Some(source) = &err.source {
- info.errno = source.to_errno();
-
- {
- let mut inner = self.inner.lock();
- inner.extended_error =
- ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
- }
-
- binder_debug!(
- FailedTransaction,
- "transaction {} to {}:{} failed {:?}, code {} size {}-{}",
- if info.is_reply {
- "reply"
- } else if info.is_oneway() {
- "async"
- } else {
- "call"
- },
- info.to_pid,
- info.to_tid,
- err,
- info.code,
- info.data_size,
- info.offsets_size
- );
+ info.reply = err.reply;
+ if let Some(source) = &err.source {
+ info.errno = source.to_errno();
+
+ {
+ let mut inner = self.inner.lock();
+ inner.extended_error =
+ ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
}
+
+ binder_debug!(
+ FailedTransaction,
+ "transaction {} to {}:{} failed {:?}, code {} size {}-{}",
+ if info.is_reply {
+ "reply"
+ } else if info.is_oneway() {
+ "async"
+ } else {
+ "call"
+ },
+ info.to_pid,
+ info.to_tid,
+ err,
+ info.code,
+ info.data_size,
+ info.offsets_size
+ );
}
}
@@ -1416,7 +1415,7 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
info.to_pid = orig.from.process.task.pid();
// We need to complete the transaction even if we cannot complete building the reply.
- let out = (|| -> BinderResult<_> {
+ if let Err(err) = (|| -> BinderResult<_> {
let completion = DTRWrap::arc_try_new(DeliverCode::new(
BR_TRANSACTION_COMPLETE,
self.process.task.pid(),
@@ -1431,11 +1430,10 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
}
orig.from.deliver_reply(Ok(reply), &orig, None);
Ok(())
- })()
- .map_err(|mut err| {
+ })() {
// At this point we only return `BR_TRANSACTION_COMPLETE` to the caller, and we must let
// the sender know that the transaction has completed (with an error in this case).
-
+ self.push_return_work(BR_TRANSACTION_COMPLETE);
pr_warn!(
"{}:{} reply to {} failed: {err:?}",
info.from_pid,
@@ -1447,11 +1445,9 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
orig.from
.deliver_reply(Err(BR_FAILED_REPLY), &orig, Some(ee));
info.reply = BR_FAILED_REPLY;
- err.reply = BR_TRANSACTION_COMPLETE;
- err
- });
+ }
- out
+ Ok(())
}
fn oneway_transaction_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 013/742] sched_ext: Reset task fields on exit of an SCX_TASK_READY task
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (11 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 012/742] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 014/742] sched_ext: make DSQ iterator stay drained after NULL Greg Kroah-Hartman
` (144 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rahad Bhuiya, Tejun Heo,
Cheng-Yang Chou, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahad Bhuiya <rahadbhuiya2021@gmail.com>
commit 564405c424f49d70b13debe7fe5b550234ad6b84 upstream.
Tasks in SCX_TASK_READY are attached to a scheduler but outside the ext
class, such as RT/DL tasks, or non-SCHED_EXT tasks under a partial switch.
The scheduler's BPF code can still update their dsq_vtime and slice (for
instance, via ops.cgroup_move() as done by scx_flatcg).
Because __scx_disable_and_exit_task() currently breaks out of the state
switch for SCX_TASK_READY without calling scx_reset_task_fields(), these
fields are not cleared when the task leaves the scheduler. If the task is
subsequently moved to another cgroup/sub-scheduler and later switches to
SCHED_NORMAL, the new scheduler's ops.enable() sees stale dsq_vtime from
the previous scheduler's clock.
Call scx_reset_task_fields() in the SCX_TASK_READY case of
__scx_disable_and_exit_task() to ensure SCX-managed fields are properly
reset when leaving the scheduler.
Fixes: 5771e79e461e ("sched_ext: Reset dsq_vtime and slice when a task leaves SCX")
Signed-off-by: Rahad Bhuiya <rahadbhuiya2021@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ chengyang: 7.3 lacks scx_reset_task_fields(), so factor it out of
scx_disable_task() ]
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext/ext.c | 40 ++++++++++++++++++++++++----------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index cc8d09924fa13..1049a0914d600 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -4159,6 +4159,27 @@ void scx_enable_task(struct scx_sched *sch, struct task_struct *p)
scx_set_task_state(p, SCX_TASK_ENABLED);
}
+/*
+ * Reset the SCX-managed fields when @p leaves the BPF scheduler's control.
+ */
+static void scx_reset_task_fields(struct rq *rq, struct task_struct *p)
+{
+ lockdep_assert_rq_held(rq);
+
+ p->scx.dsq_vtime = 0;
+ scx_task_slice_ended(rq, p);
+ scx_set_task_slice(p, 0);
+ p->scx.reenq_cnt = 0;
+
+ /*
+ * If @p is runnable but not running, its wait started at runnable_at,
+ * which ops_dequeue() didn't reset. Leaving the scheduler ends the
+ * wait. Reset runnable_at the next time @p is enqueued on SCX, so that
+ * the watchdog doesn't count the time @p spends elsewhere.
+ */
+ p->scx.flags |= SCX_TASK_RESET_RUNNABLE_AT;
+}
+
static void scx_disable_task(struct scx_sched *sch, struct task_struct *p)
{
struct rq *rq = task_rq(p);
@@ -4172,22 +4193,8 @@ static void scx_disable_task(struct scx_sched *sch, struct task_struct *p)
SCX_CALL_OP_TASK(sch, disable, rq, p);
scx_set_task_state(p, SCX_TASK_READY);
- /*
- * Reset the SCX-managed fields when @p leaves the BPF scheduler's
- * control, after ops.disable() has observed their final values.
- */
- p->scx.dsq_vtime = 0;
- scx_task_slice_ended(rq, p);
- scx_set_task_slice(p, 0);
- p->scx.reenq_cnt = 0;
-
- /*
- * If @p is runnable but not running, its wait started at runnable_at,
- * which ops_dequeue() didn't reset. Leaving @sch ends the wait. Reset
- * runnable_at the next time @p is enqueued on SCX, so that the watchdog
- * doesn't count the time @p spends elsewhere.
- */
- p->scx.flags |= SCX_TASK_RESET_RUNNABLE_AT;
+ /* after ops.disable() has observed the final values */
+ scx_reset_task_fields(rq, p);
/*
* Verify the task is not in BPF scheduler's custody. If flag
@@ -4213,6 +4220,7 @@ void __scx_disable_and_exit_task(struct scx_sched *sch, struct task_struct *p)
args.cancelled = true;
break;
case SCX_TASK_READY:
+ scx_reset_task_fields(task_rq(p), p);
break;
case SCX_TASK_ENABLED:
scx_disable_task(sch, p);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 014/742] sched_ext: make DSQ iterator stay drained after NULL
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (12 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 013/742] sched_ext: Reset task fields on exit of an SCX_TASK_READY task Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 7.3 015/742] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
` (143 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Chen, Tejun Heo,
Cheng-Yang Chou, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Chen <k.chen@smail.nju.edu.cn>
commit fcbff7b56a881bbe041b6c5ba12831a3c1ac1bb4 upstream.
nldsq_cursor_next_task() unlinks the iteration cursor when it reaches the
end of the DSQ. A later call sees list_empty(&cursor->node), starts
from the DSQ head again, and returns the first task of the same
iteration.
The verifier relies on the iterator contract that once next() returns
NULL it keeps returning NULL: process_iter_next_call() marks the
iterator DRAINED and treats the result of later next() calls as the
constant zero. A restarted DSQ iteration therefore hands the BPF
program a task pointer while the verifier believes R0 == 0.
Remember the drained state in the cursor flags and return NULL on every
later next() call. The cursor has spare flag bits and the BPF-visible
iterator layout is unchanged.
Fixes: 650ba21b131e ("sched_ext: Implement DSQ iterator")
Signed-off-by: Kang Chen <k.chen@smail.nju.edu.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ chengyang: drop __SCX_DSQ_ITER_HAS_REENQ, which 7.3 lacks ]
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext/ext.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 1049a0914d600..6db6ca912bb37 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -492,11 +492,13 @@ enum scx_dsq_iter_flags {
/* iterate in the reverse dispatch order */
SCX_DSQ_ITER_REV = 1U << 16,
+ __SCX_DSQ_ITER_DRAINED = 1U << 28,
__SCX_DSQ_ITER_HAS_SLICE = 1U << 30,
__SCX_DSQ_ITER_HAS_VTIME = 1U << 31,
__SCX_DSQ_ITER_USER_FLAGS = SCX_DSQ_ITER_REV,
__SCX_DSQ_ITER_ALL_FLAGS = __SCX_DSQ_ITER_USER_FLAGS |
+ __SCX_DSQ_ITER_DRAINED |
__SCX_DSQ_ITER_HAS_SLICE |
__SCX_DSQ_ITER_HAS_VTIME,
};
@@ -10255,13 +10257,24 @@ __bpf_kfunc int bpf_iter_scx_dsq_new(struct bpf_iter_scx_dsq *it, u64 dsq_id,
__bpf_kfunc struct task_struct *bpf_iter_scx_dsq_next(struct bpf_iter_scx_dsq *it)
{
struct bpf_iter_scx_dsq_kern *kit = (void *)it;
+ struct task_struct *p;
- if (!kit->dsq)
+ if (!kit->dsq || (kit->cursor.flags & __SCX_DSQ_ITER_DRAINED))
return NULL;
guard(raw_spinlock_irqsave)(&kit->dsq->lock);
- return nldsq_cursor_next_task(&kit->cursor, kit->dsq);
+ p = nldsq_cursor_next_task(&kit->cursor, kit->dsq);
+ /*
+ * nldsq_cursor_next_task() unlinks the cursor and starts from the DSQ
+ * head when it is called again. The verifier relies on an iterator
+ * which returned NULL to keep returning NULL (see
+ * process_iter_next_call()), so remember the drained state.
+ */
+ if (!p)
+ kit->cursor.flags |= __SCX_DSQ_ITER_DRAINED;
+
+ return p;
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 015/742] ipv6: Remove IPV6_ADDRFORM.
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (13 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 014/742] sched_ext: make DSQ iterator stay drained after NULL Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 016/742] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
` (142 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daehyeon Ko, Hyunwoo Kim,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 31c5ea8a3296e1486ac34bccea452bfe8c0bb1f9 ]
Recently, IPV6_ADDRFORM has received many AI-driven bug reports.
Fixing them properly would needlessly churn the fast paths in TCP
and UDP.
IPV6_ADDRFORM was initially introduced in RFC 2133 in 1997,
but only two years later, it was removed from RFC 2553 in 1999.
In 2026, modern applications natively support dual-stack sockets;
notably, systemd's socket activation does not use IPV6_ADDRFORM.
Also, getsockopt(IPV6_ADDRFORM) can be replaced with SO_DOMAIN.
Let's remove IPV6_ADDRFORM.
Later, we can remove sk->sk_prot_creator and revert commit
c26c192c3d48 ("udp: properly deal with xfrm encap and ADDRFORM").
Reported-by: Daehyeon Ko <4ncienth@gmail.com>
Closes: https://lore.kernel.org/netdev/20260902010408.1057857-1-4ncienth@gmail.com/
Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
Closes: https://lore.kernel.org/netdev/20260824033331.1084971-1-imv4bel@gmail.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260904033543.2635540-3-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/net.h | 2 +-
net/core/sock.c | 4 +-
net/ipv4/af_inet.c | 3 --
net/ipv6/af_inet6.c | 4 --
net/ipv6/ipv6_sockglue.c | 87 ----------------------------------------
5 files changed, 2 insertions(+), 98 deletions(-)
diff --git a/include/linux/net.h b/include/linux/net.h
index 3d82966e2243b..470100ae71077 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -166,7 +166,7 @@ struct socket {
struct file *file;
struct sock *sk;
- const struct proto_ops *ops; /* Might change with IPV6_ADDRFORM or MPTCP. */
+ const struct proto_ops *ops; /* Might change with MPTCP. */
struct socket_wq wq;
};
diff --git a/net/core/sock.c b/net/core/sock.c
index f93ae40ef6bd7..43d2b4545db6e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -772,7 +772,7 @@ bool sk_mc_loop(const struct sock *sk)
sk = sk_const_to_full_sk(sk);
if (!sk)
return true;
- /* IPV6_ADDRFORM can change sk->sk_family under us. */
+
switch (READ_ONCE(sk->sk_family)) {
case AF_INET:
return inet_test_bit(MC_LOOP, sk);
@@ -4023,7 +4023,6 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
return READ_ONCE(sk->sk_prot)->getsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_getsockopt);
@@ -4045,7 +4044,6 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
return READ_ONCE(sk->sk_prot)->setsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_setsockopt);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index bc3bbb2366d81..09bf6e8aa058c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -582,7 +582,6 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr_unsized *uaddr,
if (addr_len < sizeof(uaddr->sa_family))
return -EINVAL;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (uaddr->sa_family == AF_UNSPEC)
@@ -791,7 +790,6 @@ int inet_accept(struct socket *sock, struct socket *newsock,
{
struct sock *sk1 = sock->sk, *sk2;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
arg->err = -EINVAL;
sk2 = READ_ONCE(sk1->sk_prot)->accept(sk1, arg);
if (!sk2)
@@ -877,7 +875,6 @@ void inet_splice_eof(struct socket *sock)
if (unlikely(inet_send_prepare(sk)))
return;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (prot->splice_eof)
prot->splice_eof(sock);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 282912a119999..f0efdc13baf4e 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -429,7 +429,6 @@ int inet6_bind_sk(struct sock *sk, struct sockaddr_unsized *uaddr, int addr_len)
const struct proto *prot;
int err = 0;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
/* If the socket has its own bind function then use it. */
if (prot->bind)
@@ -567,7 +566,6 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFDSTADDR:
return addrconf_set_dstaddr(net, argp);
default:
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (!prot->ioctl)
return -ENOIOCTLCMD;
@@ -636,7 +634,6 @@ int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
if (unlikely(inet_send_prepare(sk)))
return -EAGAIN;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
return INDIRECT_CALL_2(prot->sendmsg, tcp_sendmsg, udpv6_sendmsg,
sk, msg, size);
@@ -651,7 +648,6 @@ int inet6_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
if (likely(!(flags & MSG_ERRQUEUE)))
sock_rps_record_flow(sk);
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
return INDIRECT_CALL_2(prot->recvmsg, tcp_recvmsg, udpv6_recvmsg,
sk, msg, size, flags);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index b4c977434c2e0..1f68fb64a43ef 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -547,86 +547,7 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
sockopt_lock_sock(sk);
- /* Another thread has converted the socket into IPv4 with
- * IPV6_ADDRFORM concurrently.
- */
- if (unlikely(sk->sk_family != AF_INET6))
- goto unlock;
-
switch (optname) {
-
- case IPV6_ADDRFORM:
- if (optlen < sizeof(int))
- goto e_inval;
- if (val == PF_INET) {
- if (sk->sk_type == SOCK_RAW)
- break;
-
- if (sk->sk_protocol == IPPROTO_UDP) {
- if (udp_sk(sk)->pending == AF_INET6) {
- retv = -EBUSY;
- break;
- }
- } else if (sk->sk_protocol == IPPROTO_TCP) {
- if (sk->sk_prot != &tcpv6_prot) {
- retv = -EBUSY;
- break;
- }
- } else {
- break;
- }
-
- if (sk->sk_state != TCP_ESTABLISHED) {
- retv = -ENOTCONN;
- break;
- }
-
- if (ipv6_only_sock(sk) ||
- !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) {
- retv = -EADDRNOTAVAIL;
- break;
- }
-
- __ipv6_sock_mc_close(sk);
- __ipv6_sock_ac_close(sk);
-
- if (sk->sk_protocol == IPPROTO_TCP) {
- struct inet_connection_sock *icsk = inet_csk(sk);
-
- sock_prot_inuse_add(net, sk->sk_prot, -1);
- sock_prot_inuse_add(net, &tcp_prot, 1);
-
- /* Paired with READ_ONCE(sk->sk_prot) in inet6_stream_ops */
- WRITE_ONCE(sk->sk_prot, &tcp_prot);
- /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
- WRITE_ONCE(icsk->icsk_af_ops, &ipv4_specific);
- WRITE_ONCE(sk->sk_socket->ops, &inet_stream_ops);
- WRITE_ONCE(sk->sk_family, PF_INET);
- tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
- } else {
- sock_prot_inuse_add(net, sk->sk_prot, -1);
- sock_prot_inuse_add(net, &udp_prot, 1);
-
- /* Paired with READ_ONCE(sk->sk_prot) in inet6_dgram_ops */
- WRITE_ONCE(sk->sk_prot, &udp_prot);
- WRITE_ONCE(sk->sk_socket->ops, &inet_dgram_ops);
- WRITE_ONCE(sk->sk_family, PF_INET);
- }
-
- /* Disable all options not to allocate memory anymore,
- * but there is still a race. See the lockless path
- * in udpv6_sendmsg() and ipv6_local_rxpmtu().
- */
- np->rxopt.all = 0;
-
- inet6_cleanup_sock(sk);
-
- module_put(THIS_MODULE);
- retv = 0;
- break;
- }
- goto e_inval;
-
case IPV6_V6ONLY:
if (optlen < sizeof(int) ||
inet_sk(sk)->inet_num)
@@ -1088,14 +1009,6 @@ int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
if (copy_from_sockptr(&len, optlen, sizeof(int)))
return -EFAULT;
switch (optname) {
- case IPV6_ADDRFORM:
- if (sk->sk_protocol != IPPROTO_UDP &&
- sk->sk_protocol != IPPROTO_TCP)
- return -ENOPROTOOPT;
- if (sk->sk_state != TCP_ESTABLISHED)
- return -ENOTCONN;
- val = sk->sk_family;
- break;
case MCAST_MSFILTER:
if (in_compat_syscall())
return compat_ipv6_get_msfilter(sk, optval, optlen, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 016/742] kprobes: Switch ftrace ops when adding probe with post_handler
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (14 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 7.3 015/742] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 017/742] gve: Fix backward stats when interface goes down or configuration is adjusted Greg Kroah-Hartman
` (141 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit f60f98881b54b0cf36b61f41c91fbd93b76a2d9c ]
When an ftrace-based kprobe is registered without a post_handler, it is
armed using kprobe_ftrace_ops. If a second probe with a post_handler is
subsequently registered at the same address, register_aggr_kprobe() sets
ap->post_handler to aggr_post_handler, but leaves the probe armed using
kprobe_ftrace_ops.
When the probe is later disarmed or disabled, disarm_kprobe_ftrace()
checks whether p->post_handler is non-NULL and attempts to disarm from
kprobe_ipmodify_ops. This fails with -ENOENT, decrements
kprobe_ipmodify_enabled below zero, leaves the probe armed on
kprobe_ftrace_ops, and aborts unregistration, leading to a use-after-free
if the probe module is unloaded.
Switch the armed probe from kprobe_ftrace_ops to kprobe_ipmodify_ops in
register_aggr_kprobe() outside of text_mutex and cpus_read_lock to avoid
lockdep and deadlock issues when modifying ftrace code. Defer adding the
new probe onto ap->list until the ftrace ops switch completes so that the
new probe's handlers are not published prematurely while ap is still on
kprobe_ftrace_ops, and mark ap disabled if rollback re-arming fails.
Also restore ftrace ops registration and counter if ftrace_set_filter_ip()
fails in __disarm_kprobe_ftrace().
Link: https://lore.kernel.org/all/179440641120.328088.15542754095040659094.stgit@devnote2/
Fixes: 5dd7caf0bdc5 ("kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/kprobes.c | 55 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 2461116015805..0fd0d40a71ee2 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1200,9 +1200,14 @@ static int __disarm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
(*cnt)--;
ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 1, 0);
- WARN_ONCE(ret < 0, "Failed to disarm kprobe-ftrace at %pS (error %d)\n",
- p->addr, ret);
- return ret;
+ if (WARN_ONCE(ret < 0, "Failed to disarm kprobe-ftrace at %pS (error %d)\n",
+ p->addr, ret)) {
+ if (*cnt == 0)
+ register_ftrace_function(ops);
+ (*cnt)++;
+ return ret;
+ }
+ return 0;
}
static int disarm_kprobe_ftrace(struct kprobe *p)
@@ -1331,16 +1336,12 @@ void kprobe_busy_end(void)
}
/* Add the new probe to 'ap->list'. */
-static int add_new_kprobe(struct kprobe *ap, struct kprobe *p)
+static void add_new_kprobe(struct kprobe *ap, struct kprobe *p)
{
if (p->post_handler)
unoptimize_kprobe(ap, true); /* Fall back to normal kprobe */
list_add_rcu(&p->list, &ap->list);
- if (p->post_handler && !ap->post_handler)
- ap->post_handler = aggr_post_handler;
-
- return 0;
}
/*
@@ -1373,6 +1374,8 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p)
{
int ret = 0;
struct kprobe *ap = orig_p;
+ bool reset_post_handler = false;
+ bool ftrace_switch_ops = false;
scoped_guard(cpus_read_lock) {
/* For preparing optimization, jump_label_text_reserved() is called */
@@ -1419,18 +1422,50 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p)
| KPROBE_FLAG_DISABLED;
}
+ if (p->post_handler && !ap->post_handler) {
+ reset_post_handler = true;
+ if (kprobe_ftrace(ap) && !kprobes_all_disarmed &&
+ !kprobe_disabled(ap))
+ ftrace_switch_ops = true;
+ else
+ ap->post_handler = aggr_post_handler;
+ }
+
/* Copy the insn slot of 'p' to 'ap'. */
copy_kprobe(ap, p);
- ret = add_new_kprobe(ap, p);
+ if (!ftrace_switch_ops)
+ add_new_kprobe(ap, p);
+ }
+
+ if (ftrace_switch_ops) {
+ /*
+ * Must switch ftrace ops outside of text_mutex and cpus_read_lock
+ * to prevent deadlocks when ftrace code modification acquires text_mutex.
+ */
+ ret = disarm_kprobe_ftrace(ap);
+ if (ret)
+ return ret;
+
+ ap->post_handler = aggr_post_handler;
+ ret = arm_kprobe_ftrace(ap);
+ if (ret) {
+ ap->post_handler = NULL;
+ if (arm_kprobe_ftrace(ap))
+ ap->flags |= KPROBE_FLAG_DISABLED;
+ return ret;
+ }
+ add_new_kprobe(ap, p);
}
- if (ret == 0 && kprobe_disabled(ap) && !kprobe_disabled(p)) {
+ if (kprobe_disabled(ap) && !kprobe_disabled(p)) {
ap->flags &= ~KPROBE_FLAG_DISABLED;
if (!kprobes_all_disarmed) {
/* Arm the breakpoint again. */
ret = arm_kprobe(ap);
if (ret) {
ap->flags |= KPROBE_FLAG_DISABLED;
+ if (reset_post_handler)
+ ap->post_handler = NULL;
list_del_rcu(&p->list);
synchronize_rcu();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 017/742] gve: Fix backward stats when interface goes down or configuration is adjusted
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (15 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 016/742] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 018/742] buffer: Document mmb_mark_buffer_dirty() Greg Kroah-Hartman
` (140 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Debarghya Kundu, Pin-yen Lin,
Harshitha Ramamurthy, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Debarghya Kundu <debarghyak@google.com>
[ Upstream commit 6752dfc316b94ce02998a79509df62a3aba51d1c ]
gve_get_base_stats() sets all the stats to 0, so the stats go backwards
when interface goes down or configuration is adjusted.
ndo_get_stats64 has the same problem, since gve_get_stats() only sums
the live rings, which are freed when the interface goes down.
This issue was discovered and actually triggered by the
drivers/net/stats.py selftest (check_down test case). Bringing down the
interface caused statistics counters to reset to 0, triggering selftest
assertion failures because netdevice stats must not go backwards.
Fix this by persisting baseline stats across queue teardown in
gve_queues_mem_remove() and single-queue stop in gve_rx_queue_stop().
The baseline is reported by both ndo_get_stats64 and
gve_get_base_stats().
Also report the live XDP TX ring counters in gve_get_base_stats(), as
those rings are not exposed as netdev queues.
This change was tested using the DQO RDA queue format.
Cc: stable@vger.kernel.org
Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
Fixes: 2e5e0932dff5 ("gve: add support for basic queue stats")
Signed-off-by: Debarghya Kundu <debarghyak@google.com>
Co-developed-by: Pin-yen Lin <treapking@google.com>
Signed-off-by: Pin-yen Lin <treapking@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20261109182036.2910559-3-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/google/gve/gve.h | 7 ++
drivers/net/ethernet/google/gve/gve_main.c | 125 +++++++++++++++++----
2 files changed, 110 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index 59c7fb32fda76..5fe8653883526 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -797,6 +797,10 @@ struct gve_ptp {
struct gve_priv *priv;
};
+struct gve_ring_err_stats {
+ u64 rx_alloc_fails;
+};
+
struct gve_priv {
struct net_device *dev;
struct gve_tx_ring *tx; /* array of tx_cfg.num_queues */
@@ -886,11 +890,14 @@ struct gve_priv {
/* Protects the priv->tx/priv->rx arrays, the in-place rewrite of
* priv->rx[idx] and the queue counts against stats readers that do
* not hold the netdev instance lock.
+ * Also protects base_net_stats and base_ring_err_stats.
*/
spinlock_t stats_lock;
unsigned long service_task_flags;
unsigned long state_flags;
+ struct gve_ring_err_stats base_ring_err_stats;
+ struct rtnl_link_stats64 base_net_stats;
struct gve_stats_report *stats_report;
u64 stats_report_len;
dma_addr_t stats_report_bus; /* dma address for the stats report */
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 1bcc8318c9d9d..af56a5bcc4e2a 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -106,16 +106,44 @@ static netdev_tx_t gve_start_xmit(struct sk_buff *skb, struct net_device *dev)
return gve_tx_dqo(skb, dev);
}
-static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
+static void gve_add_base_stats(struct gve_priv *priv,
+ struct rtnl_link_stats64 *s)
+{
+ struct rtnl_link_stats64 *base_stats = &priv->base_net_stats;
+
+ s->rx_packets += base_stats->rx_packets;
+ s->rx_bytes += base_stats->rx_bytes;
+ s->tx_packets += base_stats->tx_packets;
+ s->tx_bytes += base_stats->tx_bytes;
+}
+
+static void gve_add_tx_ring_range_stats(struct gve_priv *priv, int start_ring,
+ int end_ring, u64 *packets, u64 *bytes)
+{
+ int ring;
+
+ for (ring = start_ring; ring < end_ring; ring++) {
+ struct gve_tx_ring *tx = &priv->tx[ring];
+ unsigned int start;
+ u64 pkts, byts;
+
+ do {
+ start = u64_stats_fetch_begin(&tx->statss);
+ pkts = tx->pkt_done;
+ byts = tx->bytes_done;
+ } while (u64_stats_fetch_retry(&tx->statss, start));
+ *packets += pkts;
+ *bytes += byts;
+ }
+}
+
+static void gve_get_ring_stats(struct gve_priv *priv,
+ struct rtnl_link_stats64 *s)
{
- struct gve_priv *priv = netdev_priv(dev);
unsigned int start;
u64 packets, bytes;
- int num_tx_queues;
int ring;
- spin_lock_bh(&priv->stats_lock);
- num_tx_queues = gve_num_tx_queues(priv);
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
do {
@@ -129,19 +157,41 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
s->rx_bytes += bytes;
}
}
- if (priv->tx) {
- for (ring = 0; ring < num_tx_queues; ring++) {
- do {
- start =
- u64_stats_fetch_begin(&priv->tx[ring].statss);
- packets = priv->tx[ring].pkt_done;
- bytes = priv->tx[ring].bytes_done;
- } while (u64_stats_fetch_retry(&priv->tx[ring].statss,
- start));
- s->tx_packets += packets;
- s->tx_bytes += bytes;
- }
+ if (priv->tx)
+ gve_add_tx_ring_range_stats(priv, 0, gve_num_tx_queues(priv),
+ &s->tx_packets, &s->tx_bytes);
+}
+
+static void gve_get_ring_err_stats(struct gve_priv *priv,
+ struct gve_ring_err_stats *err_stats)
+{
+ int ring;
+
+ if (!priv->rx)
+ return;
+
+ for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
+ struct gve_rx_ring *rx = &priv->rx[ring];
+ unsigned int start;
+ u64 rx_alloc_fails;
+
+ do {
+ start = u64_stats_fetch_begin(&rx->statss);
+ rx_alloc_fails = rx->rx_skb_alloc_fail +
+ rx->rx_buf_alloc_fail;
+ } while (u64_stats_fetch_retry(&rx->statss, start));
+
+ err_stats->rx_alloc_fails += rx_alloc_fails;
}
+}
+
+static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
+{
+ struct gve_priv *priv = netdev_priv(dev);
+
+ spin_lock_bh(&priv->stats_lock);
+ gve_get_ring_stats(priv, s);
+ gve_add_base_stats(priv, s);
spin_unlock_bh(&priv->stats_lock);
}
@@ -1390,6 +1440,9 @@ static void gve_queues_mem_remove(struct gve_priv *priv)
gve_get_curr_alloc_cfgs(priv, &tx_alloc_cfg, &rx_alloc_cfg);
spin_lock_bh(&priv->stats_lock);
+ gve_get_ring_stats(priv, &priv->base_net_stats);
+ gve_get_ring_err_stats(priv, &priv->base_ring_err_stats);
+
priv->tx = NULL;
priv->rx = NULL;
spin_unlock_bh(&priv->stats_lock);
@@ -2679,9 +2732,19 @@ static int gve_rx_queue_stop(struct net_device *dev, void *per_q_mem, int idx)
gve_per_q_mem = (struct gve_rx_ring *)per_q_mem;
spin_lock_bh(&priv->stats_lock);
+ priv->base_net_stats.rx_packets += priv->rx[idx].rpackets;
+ priv->base_net_stats.rx_bytes += priv->rx[idx].rbytes;
+ priv->base_ring_err_stats.rx_alloc_fails +=
+ priv->rx[idx].rx_skb_alloc_fail +
+ priv->rx[idx].rx_buf_alloc_fail;
*gve_per_q_mem = priv->rx[idx];
memset(&priv->rx[idx], 0, sizeof(priv->rx[idx]));
spin_unlock_bh(&priv->stats_lock);
+
+ gve_per_q_mem->rpackets = 0;
+ gve_per_q_mem->rbytes = 0;
+ gve_per_q_mem->rx_skb_alloc_fail = 0;
+ gve_per_q_mem->rx_buf_alloc_fail = 0;
return 0;
}
@@ -2839,12 +2902,30 @@ static void gve_get_base_stats(struct net_device *dev,
struct netdev_queue_stats_rx *rx,
struct netdev_queue_stats_tx *tx)
{
- rx->packets = 0;
- rx->bytes = 0;
- rx->alloc_fail = 0;
+ const struct gve_ring_err_stats *base_err_stats;
+ const struct rtnl_link_stats64 *base_stats;
+ struct gve_priv *priv;
- tx->packets = 0;
- tx->bytes = 0;
+ priv = netdev_priv(dev);
+ base_stats = &priv->base_net_stats;
+ base_err_stats = &priv->base_ring_err_stats;
+
+ spin_lock_bh(&priv->stats_lock);
+ rx->packets = base_stats->rx_packets;
+ rx->bytes = base_stats->rx_bytes;
+ rx->alloc_fail = base_err_stats->rx_alloc_fails;
+
+ tx->packets = base_stats->tx_packets;
+ tx->bytes = base_stats->tx_bytes;
+ /* XDP TX rings are not exposed as netdev queues, so report their live
+ * counters here to keep the device totals consistent with
+ * ndo_get_stats64.
+ */
+ if (priv->tx)
+ gve_add_tx_ring_range_stats(priv, priv->tx_cfg.num_queues,
+ gve_num_tx_queues(priv),
+ &tx->packets, &tx->bytes);
+ spin_unlock_bh(&priv->stats_lock);
}
static const struct netdev_stat_ops gve_stat_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 018/742] buffer: Document mmb_mark_buffer_dirty()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (16 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 017/742] gve: Fix backward stats when interface goes down or configuration is adjusted Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 019/742] fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty() Greg Kroah-Hartman
` (139 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthew Wilcox (Oracle), Jan Kara,
Christian Brauner (Amutable), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <willy@infradead.org>
[ Upstream commit 6c8b7651d06f635fe3d8789eda493eda3b4d13ef ]
Add kernel-doc for mmb_mark_buffer_dirty().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20260828205429.3678204-5-willy@infradead.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Stable-dep-of: d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/buffer.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index ed966fa73b1ba..30e7f2cc2386f 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -618,6 +618,14 @@ void write_boundary_block(struct block_device *bdev,
}
}
+/**
+ * mmb_mark_buffer_dirty - Mark a metadata buffer dirty.
+ * @bh: The buffer to mark dirty.
+ * @mmb: The list of buffers to add the buffer to.
+ *
+ * Mark the buffer dirty and add it to the list if it is not already on
+ * a list.
+ */
void mmb_mark_buffer_dirty(struct buffer_head *bh,
struct mapping_metadata_bhs *mmb)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 019/742] fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (17 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 018/742] buffer: Document mmb_mark_buffer_dirty() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 020/742] NFSv4/flexfiles: report the intended opnum when DS connection setup fails Greg Kroah-Hartman
` (138 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Kara,
Christian Brauner (Amutable), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit d4fdde3257a577f184b4498d040f6fe20be72326 ]
ext2, ext4 without a journal, fat, udf and minix track the metadata
buffers of an inode in a mapping_metadata_bhs list and sync them from
->sync_inode_metadata() and ->evict_inode(). The inode block itself is
only tracked by I_METADATA_WRITEBACK which ->write_inode() sets after
copying the inode into its buffer.
Set the bit in mmb_mark_buffer_dirty() as well so that it covers all
the metadata an inode may still have to write out. Set it after the
buffer is on the list. An fsync() that sees the bit then also finds the
buffer when it walks the list, and one that cleared the bit before we
set it leaves it set for the next one.
The inode itself may never have been dirtied. fat for example tracks
the FAT buffers on a private inode that nothing marks dirty. So attach
the inode to a wb before setting the bit, the way ext4_mark_iloc_dirty()
does, or writeback_single_inode() has no wb to lock once evict() syncs
it.
That lets evict() write out everything the bit tracks in one place
instead of every ->evict_inode() calling mmb_sync() itself.
Suggested-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org # v7.3
Link: https://patch.msgid.link/20261109-work-inode-metadata_writeback-v3-8-91ac6c024018@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/buffer.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 30e7f2cc2386f..3f430fb824500 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -623,12 +623,15 @@ void write_boundary_block(struct block_device *bdev,
* @bh: The buffer to mark dirty.
* @mmb: The list of buffers to add the buffer to.
*
- * Mark the buffer dirty and add it to the list if it is not already on
- * a list.
+ * Mark the buffer dirty, add it to the list if it is not already on a list
+ * and set I_METADATA_WRITEBACK on the inode so that fsync() and eviction
+ * write it out.
*/
void mmb_mark_buffer_dirty(struct buffer_head *bh,
struct mapping_metadata_bhs *mmb)
{
+ struct inode *inode = mmb->mapping->host;
+
mark_buffer_dirty(bh);
if (!bh->b_mmb) {
spin_lock(&mmb->lock);
@@ -643,6 +646,15 @@ void mmb_mark_buffer_dirty(struct buffer_head *bh,
list_move_tail(&bh->b_assoc_buffers, &mmb->list);
spin_unlock(&mmb->lock);
}
+ /*
+ * The inode itself may never have been dirtied, so attach it to a wb
+ * before setting the bit or writeback_single_inode() has nothing to
+ * lock when evict() syncs it.
+ */
+ spin_lock(&inode->i_lock);
+ inode_attach_wb(inode, NULL);
+ inode_state_set(inode, I_METADATA_WRITEBACK);
+ spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(mmb_mark_buffer_dirty);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 020/742] NFSv4/flexfiles: report the intended opnum when DS connection setup fails
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (18 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 019/742] fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 021/742] pNFS: allow layout drivers to cancel I/O to a single device Greg Kroah-Hartman
` (137 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Benjamin Coddington,
Tigran Mkrtchyan, Anna Schumaker, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <ben.coddington@hammerspace.com>
[ Upstream commit 3a612faba5c40a59257db50e3a2da30c02a8c969 ]
When nfs4_ff_layout_prepare_ds() cannot establish a connection to a
data server, it records a device error with opnum OP_ILLEGAL, since no
operation ever made it to the wire. But servers can use the ff_ioerr4
opnum to distinguish failed read-class operations from write-class
operations when deciding how to recover the affected mirror -- a mirror
that may have missed writes needs to be brought back in sync, while one
that merely failed to serve a read does not. OP_ILLEGAL gives the
server nothing to act on.
Every caller of nfs4_ff_layout_prepare_ds() knows which operation it
was preparing to send, and the existing fail_return argument already
divides the callers along the same boundary (false for READ, true for
WRITE and COMMIT). Replace the boolean with the intended opnum, derive
the layout return decision from it, and report it in the tracked device
error instead of OP_ILLEGAL.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Reviewed-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Stable-dep-of: 9e28836b480c ("pNFS: avoid repeatedly cancelling I/O for the same lseg")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 13 ++++++++-----
fs/nfs/flexfilelayout/flexfilelayout.h | 2 +-
fs/nfs/flexfilelayout/flexfilelayoutdev.c | 14 ++++++++------
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index a4ccd53c79e79..121c55f4a46d9 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -904,7 +904,7 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
mirror_ds = ff_layout_get_mirror_ds(lseg->pls_layout, mirror,
*dss_id);
ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds,
- *dss_id, false);
+ *dss_id, OP_READ);
if (IS_ERR(ds)) {
nfs4_ff_layout_put_deviceid(mirror_ds);
ret = ERR_CAST(ds);
@@ -1183,7 +1183,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
mirror_ds = ff_layout_get_mirror_ds(pgio->pg_lseg->pls_layout,
mirror, dss_id);
ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, mirror,
- mirror_ds, dss_id, true);
+ mirror_ds, dss_id, OP_WRITE);
if (IS_ERR(ds)) {
nfs4_ff_layout_put_deviceid(mirror_ds);
if (!ff_layout_no_fallback_to_mds(pgio->pg_lseg))
@@ -2277,7 +2277,8 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
mirror->dss_count,
offset);
mirror_ds = ff_layout_get_mirror_ds(lseg->pls_layout, mirror, dss_id);
- ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id, false);
+ ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id,
+ OP_READ);
if (IS_ERR(ds)) {
ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
goto out_failed;
@@ -2374,7 +2375,8 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
mirror->dss_count,
offset);
mirror_ds = ff_layout_get_mirror_ds(lseg->pls_layout, mirror, dss_id);
- ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id, true);
+ ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id,
+ OP_WRITE);
if (IS_ERR(ds)) {
ds_fatal_error = nfs_error_is_fatal(PTR_ERR(ds));
goto out_failed;
@@ -2481,7 +2483,8 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
mirror = FF_LAYOUT_COMP(lseg, idx);
dss_id = calc_dss_id_from_commit(lseg, data->ds_commit_index);
mirror_ds = ff_layout_get_mirror_ds(lseg->pls_layout, mirror, dss_id);
- ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id, true);
+ ds = nfs4_ff_layout_prepare_ds(lseg, mirror, mirror_ds, dss_id,
+ OP_COMMIT);
if (IS_ERR(ds))
goto out_err;
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index 24de108af2cf8..19b833f547416 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -269,7 +269,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
struct nfs4_ff_layout_mirror *mirror,
struct nfs4_ff_layout_ds *mirror_ds,
u32 dss_id,
- bool fail_return);
+ enum nfs_opnum4 opnum);
struct rpc_clnt *
nfs4_ff_find_or_create_ds_client(const struct nfs4_ff_layout_ds *mirror_ds,
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index 3cef6a4a51a70..fa4e9ddafea6f 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -378,7 +378,7 @@ ff_layout_get_mirror_ds(struct pnfs_layout_hdr *lo,
* @mirror_ds: referenced device node for the stripe, from
* ff_layout_get_mirror_ds() (may be an ERR_PTR)
* @dss_id: DS stripe id to select stripe to use
- * @fail_return: return layout on connect failure?
+ * @opnum: operation this connection is being prepared for
*
* Try to prepare a DS connection to accept an RPC call. This involves
* selecting a mirror to use and connecting the client to it if it's not
@@ -386,8 +386,10 @@ ff_layout_get_mirror_ds(struct pnfs_layout_hdr *lo,
*
* Since we only need a single functioning mirror to satisfy a read, we don't
* want to return the layout if there is one. For writes though, any down
- * mirror should result in a LAYOUTRETURN. @fail_return is how we distinguish
- * between the two cases.
+ * mirror should result in a LAYOUTRETURN. @opnum is how we distinguish
+ * between the two cases. On failure, @opnum is also reported in the tracked
+ * device error so that the server can tell which class of I/O the client
+ * was unable to send to the mirror.
*
* Returns a pointer to a connected DS object on success or NULL on failure.
*/
@@ -396,7 +398,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
struct nfs4_ff_layout_mirror *mirror,
struct nfs4_ff_layout_ds *mirror_ds,
u32 dss_id,
- bool fail_return)
+ enum nfs_opnum4 opnum)
{
struct nfs4_pnfs_ds *ds;
struct inode *ino = lseg->pls_layout->plh_inode;
@@ -443,9 +445,9 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout),
mirror, dss_id, lseg->pls_range.offset,
lseg->pls_range.length, NFS4ERR_NXIO,
- OP_ILLEGAL, GFP_NOIO);
+ opnum, GFP_NOIO);
ff_layout_send_layouterror(lseg);
- if (fail_return || !ff_layout_has_available_ds(lseg))
+ if (opnum != OP_READ || !ff_layout_has_available_ds(lseg))
pnfs_error_mark_layout_for_return(ino, lseg);
ds = ERR_PTR(status);
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 021/742] pNFS: allow layout drivers to cancel I/O to a single device
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (19 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 020/742] NFSv4/flexfiles: report the intended opnum when DS connection setup fails Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 022/742] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
` (136 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Benjamin Coddington,
Tigran Mkrtchyan, Anna Schumaker, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <ben.coddington@hammerspace.com>
[ Upstream commit 94dc092b208ad324981caa85fcf8416b905ca593 ]
The ->cancel_io() layout operation cancels all in-flight I/O for a
layout segment that is being returned. When the return is triggered
by the failure of a single mirror instance, cancelling I/O to the
healthy mirrors is both unnecessary and harmful: requests that were
already transmitted cannot be un-sent, and will complete on the data
servers after the layout has been returned.
Give ->cancel_io() a device ID argument identifying the failed device,
and thread it through pnfs_error_mark_layout_for_return() and
pnfs_mark_matching_lsegs_return(). The flexfiles implementation
compares it against the raw device ID from the layout, so that it can
identify the failed mirror instance even when its device ID node was
never instantiated.
A NULL device ID preserves the existing cancel-everything behavior,
and all callers pass NULL for now, so this patch makes no change in
behavior.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Reviewed-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Stable-dep-of: 9e28836b480c ("pNFS: avoid repeatedly cancelling I/O for the same lseg")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/blocklayout/blocklayout.c | 6 +++--
fs/nfs/callback_proc.c | 2 +-
fs/nfs/filelayout/filelayout.c | 4 +--
fs/nfs/flexfilelayout/flexfilelayout.c | 16 +++++++-----
fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +-
fs/nfs/pnfs.c | 32 ++++++++++++++---------
fs/nfs/pnfs.h | 14 ++++++----
7 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index d54a141a89b3b..d86702e604f95 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -859,7 +859,8 @@ bl_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
if (pgio->pg_lseg &&
test_bit(NFS_LSEG_UNAVAILABLE, &pgio->pg_lseg->pls_flags)) {
- pnfs_error_mark_layout_for_return(pgio->pg_inode, pgio->pg_lseg);
+ pnfs_error_mark_layout_for_return(pgio->pg_inode, pgio->pg_lseg,
+ NULL);
pnfs_set_lo_fail(pgio->pg_lseg);
nfs_pageio_reset_read_mds(pgio);
}
@@ -921,7 +922,8 @@ bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
if (pgio->pg_lseg &&
test_bit(NFS_LSEG_UNAVAILABLE, &pgio->pg_lseg->pls_flags)) {
- pnfs_error_mark_layout_for_return(pgio->pg_inode, pgio->pg_lseg);
+ pnfs_error_mark_layout_for_return(pgio->pg_inode, pgio->pg_lseg,
+ NULL);
pnfs_set_lo_fail(pgio->pg_lseg);
nfs_pageio_reset_write_mds(pgio);
}
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 3fb10c8e42718..ddc8736100e11 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -292,7 +292,7 @@ static u32 initiate_file_draining(struct nfs_client *clp,
switch (pnfs_mark_matching_lsegs_return(lo, &free_me_list,
&args->cbl_range,
be32_to_cpu(args->cbl_stateid.seqid),
- args->cbl_layoutchanged)) {
+ args->cbl_layoutchanged, NULL)) {
case 0:
case -EBUSY:
/* There are layout segments that need to be returned */
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 727fe1270aab5..53808e42546a0 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -187,7 +187,7 @@ static int filelayout_async_handle_error(struct rpc_task *task,
dprintk("%s DS connection error %d\n", __func__,
task->tk_status);
nfs4_mark_deviceid_unavailable(devid);
- pnfs_error_mark_layout_for_return(inode, lseg);
+ pnfs_error_mark_layout_for_return(inode, lseg, NULL);
pnfs_set_lo_fail(lseg);
rpc_wake_up(&tbl->slot_tbl_waitq);
fallthrough;
@@ -857,7 +857,7 @@ fl_pnfs_update_layout(struct inode *ino,
status = filelayout_check_deviceid(lo, fl, gfp_flags);
if (status) {
- pnfs_error_mark_layout_for_return(ino, lseg);
+ pnfs_error_mark_layout_for_return(ino, lseg, NULL);
pnfs_set_lo_fail(lseg);
pnfs_put_lseg(lseg);
lseg = NULL;
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 121c55f4a46d9..9e1a78d7d6336 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1333,7 +1333,7 @@ static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
mirror_ds = ff_layout_choose_any_ds_for_read(hdr->lseg, idx, &new_idx,
hdr->args.offset, &dss_id);
if (IS_ERR(mirror_ds)) {
- pnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg);
+ pnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg, NULL);
} else {
nfs4_ff_layout_put_deviceid(mirror_ds);
ff_layout_send_layouterror(hdr->lseg);
@@ -1346,7 +1346,7 @@ static void ff_layout_reset_read(struct nfs_pgio_header *hdr)
struct rpc_task *task = &hdr->task;
pnfs_layoutcommit_inode(hdr->inode, false);
- pnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg);
+ pnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg, NULL);
if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {
dprintk("%s Reset task %5u for i/o through MDS "
@@ -1660,7 +1660,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
fallthrough;
default:
pnfs_error_mark_layout_for_return(lseg->pls_layout->plh_inode,
- lseg);
+ lseg, NULL);
}
out:
@@ -2342,7 +2342,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
* FF_FLAGS_NO_IO_THRU_MDS: force fresh LAYOUTGET,
* never fall through to MDS I/O.
*/
- pnfs_error_mark_layout_for_return(hdr->inode, lseg);
+ pnfs_error_mark_layout_for_return(hdr->inode, lseg, NULL);
return PNFS_TRY_AGAIN;
}
trace_pnfs_mds_fallback_read_pagelist(hdr->inode,
@@ -2442,7 +2442,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
* FF_FLAGS_NO_IO_THRU_MDS: force fresh LAYOUTGET,
* never fall through to MDS I/O.
*/
- pnfs_error_mark_layout_for_return(hdr->inode, lseg);
+ pnfs_error_mark_layout_for_return(hdr->inode, lseg, NULL);
return PNFS_TRY_AGAIN;
}
trace_pnfs_mds_fallback_write_pagelist(hdr->inode,
@@ -2570,7 +2570,8 @@ static bool ff_layout_match_io(const struct rpc_task *task, const void *data)
return false;
}
-static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg)
+static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg,
+ const struct nfs4_deviceid *devid)
{
struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(lseg);
struct nfs4_ff_layout_mirror *mirror;
@@ -2583,6 +2584,9 @@ static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg)
for (idx = 0; idx < flseg->mirror_array_cnt; idx++) {
mirror = flseg->mirror_array[idx];
for (dss_id = 0; dss_id < mirror->dss_count; dss_id++) {
+ if (devid && memcmp(&mirror->dss[dss_id].devid, devid,
+ sizeof(*devid)) != 0)
+ continue;
rcu_read_lock();
mirror_ds = rcu_dereference(mirror->dss[dss_id].mirror_ds);
if (IS_ERR_OR_NULL(mirror_ds) ||
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index fa4e9ddafea6f..b10c6de2f6d59 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -448,7 +448,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
opnum, GFP_NOIO);
ff_layout_send_layouterror(lseg);
if (opnum != OP_READ || !ff_layout_has_available_ds(lseg))
- pnfs_error_mark_layout_for_return(ino, lseg);
+ pnfs_error_mark_layout_for_return(ino, lseg, NULL);
ds = ERR_PTR(status);
out:
return ds;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ff85b82a1e222..0af3a02cea6fb 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -433,7 +433,7 @@ bool nfs4_layout_refresh_old_stateid(nfs4_stateid *dst,
}
/* Try to update the seqid to the most recent */
err = pnfs_mark_matching_lsegs_return(lo, &head, &range, 0,
- true);
+ true, NULL);
if (err != -EBUSY) {
dst->seqid = lo->plh_stateid.seqid;
*dst_range = range;
@@ -487,7 +487,8 @@ static int pnfs_mark_layout_stateid_return(struct pnfs_layout_hdr *lo,
.length = NFS4_MAX_UINT64,
};
- return pnfs_mark_matching_lsegs_return(lo, lseg_list, &range, seq, true);
+ return pnfs_mark_matching_lsegs_return(lo, lseg_list, &range, seq, true,
+ NULL);
}
static int
@@ -525,7 +526,7 @@ pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode)
spin_lock(&inode->i_lock);
pnfs_layout_set_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
- pnfs_mark_matching_lsegs_return(lo, &head, &range, 0, true);
+ pnfs_mark_matching_lsegs_return(lo, &head, &range, 0, true, NULL);
spin_unlock(&inode->i_lock);
pnfs_free_lseg_list(&head);
dprintk("%s Setting layout IOMODE_%s fail bit\n", __func__,
@@ -740,7 +741,7 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
if (mark_lseg_invalid(lseg, tmp_list))
continue;
remaining++;
- pnfs_lseg_cancel_io(server, lseg);
+ pnfs_lseg_cancel_io(server, lseg, NULL);
}
dprintk("%s:Return %i\n", __func__, remaining);
return remaining;
@@ -1462,7 +1463,7 @@ _pnfs_return_layout(struct inode *ino)
}
valid_layout = pnfs_layout_is_valid(lo);
pnfs_clear_layoutcommit(ino, &tmp_list);
- pnfs_mark_matching_lsegs_return(lo, &tmp_list, &range, 0, true);
+ pnfs_mark_matching_lsegs_return(lo, &tmp_list, &range, 0, true, NULL);
/* Don't send a LAYOUTRETURN if list was initially empty */
@@ -2628,7 +2629,8 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
.iomode = IOMODE_ANY,
.length = NFS4_MAX_UINT64,
};
- pnfs_mark_matching_lsegs_return(lo, &free_me, &range, 0, true);
+ pnfs_mark_matching_lsegs_return(lo, &free_me, &range, 0, true,
+ NULL);
goto out_forget;
} else {
/* We have a completely new layout */
@@ -2661,6 +2663,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
* @return_range: describe layout segment ranges to be returned
* @seq: stateid seqid to match
* @cancel_io: signal io be cancelled
+ * @devid: only cancel io directed at this device (all devices if NULL)
*
* This function is mainly intended for use by layoutrecall. It attempts
* to free the layout segment immediately, or else to mark it for return
@@ -2675,7 +2678,8 @@ int
pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
struct list_head *tmp_list,
const struct pnfs_layout_range *return_range,
- u32 seq, bool cancel_io)
+ u32 seq, bool cancel_io,
+ const struct nfs4_deviceid *devid)
{
struct pnfs_layout_segment *lseg, *next;
struct nfs_server *server = NFS_SERVER(lo->plh_inode);
@@ -2702,7 +2706,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
remaining++;
set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);
if (cancel_io)
- pnfs_lseg_cancel_io(server, lseg);
+ pnfs_lseg_cancel_io(server, lseg, devid);
}
if (remaining) {
@@ -2720,7 +2724,8 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
static void
pnfs_mark_layout_for_return(struct inode *inode,
- const struct pnfs_layout_range *range)
+ const struct pnfs_layout_range *range,
+ const struct nfs4_deviceid *devid)
{
struct pnfs_layout_hdr *lo;
bool return_now = false;
@@ -2738,7 +2743,7 @@ pnfs_mark_layout_for_return(struct inode *inode,
* for how it works.
*/
if (pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, range, 0,
- true) != -EBUSY) {
+ true, devid) != -EBUSY) {
const struct cred *cred;
nfs4_stateid stateid;
enum pnfs_iomode iomode;
@@ -2755,7 +2760,8 @@ pnfs_mark_layout_for_return(struct inode *inode,
}
void pnfs_error_mark_layout_for_return(struct inode *inode,
- struct pnfs_layout_segment *lseg)
+ struct pnfs_layout_segment *lseg,
+ const struct nfs4_deviceid *devid)
{
struct pnfs_layout_range range = {
.iomode = lseg->pls_range.iomode,
@@ -2763,7 +2769,7 @@ void pnfs_error_mark_layout_for_return(struct inode *inode,
.length = NFS4_MAX_UINT64,
};
- pnfs_mark_layout_for_return(inode, &range);
+ pnfs_mark_layout_for_return(inode, &range, devid);
}
EXPORT_SYMBOL_GPL(pnfs_error_mark_layout_for_return);
@@ -2853,7 +2859,7 @@ static int pnfs_layout_return_unused_byserver(struct nfs_server *server,
pnfs_get_layout_hdr(lo);
pnfs_set_plh_return_info(lo, range->iomode, 0);
if (pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs,
- range, 0, true) != 0 ||
+ range, 0, true, NULL) != 0 ||
!pnfs_prepare_layoutreturn(lo, &stateid, &cred, &iomode)) {
spin_unlock(&inode->i_lock);
rcu_read_unlock();
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 5725ea06efc2d..6638ffe877b32 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -178,7 +178,8 @@ struct pnfs_layoutdriver_type {
int (*prepare_layoutcommit) (struct nfs4_layoutcommit_args *args);
int (*prepare_layoutstats) (struct nfs42_layoutstat_args *args);
- void (*cancel_io)(struct pnfs_layout_segment *lseg);
+ void (*cancel_io)(struct pnfs_layout_segment *lseg,
+ const struct nfs4_deviceid *devid);
};
struct pnfs_commit_ops {
@@ -301,7 +302,8 @@ int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
int pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
struct list_head *tmp_list,
const struct pnfs_layout_range *recall_range,
- u32 seq, bool cancel_io);
+ u32 seq, bool cancel_io,
+ const struct nfs4_deviceid *devid);
int pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
struct list_head *lseg_list);
bool pnfs_roc(struct inode *ino, struct nfs4_layoutreturn_args *args,
@@ -351,7 +353,8 @@ int pnfs_read_done_resend_to_mds(struct nfs_pgio_header *);
int pnfs_write_done_resend_to_mds(struct nfs_pgio_header *);
struct nfs4_threshold *pnfs_mdsthreshold_alloc(void);
void pnfs_error_mark_layout_for_return(struct inode *inode,
- struct pnfs_layout_segment *lseg);
+ struct pnfs_layout_segment *lseg,
+ const struct nfs4_deviceid *devid);
void pnfs_layout_return_unused_byclid(struct nfs_client *clp,
enum pnfs_iomode iomode);
int pnfs_layout_handle_reboot(struct nfs_client *clp);
@@ -691,10 +694,11 @@ pnfs_lseg_request_intersecting(struct pnfs_layout_segment *lseg, struct nfs_page
}
static inline void pnfs_lseg_cancel_io(struct nfs_server *server,
- struct pnfs_layout_segment *lseg)
+ struct pnfs_layout_segment *lseg,
+ const struct nfs4_deviceid *devid)
{
if (server->pnfs_curr_ld->cancel_io)
- server->pnfs_curr_ld->cancel_io(lseg);
+ server->pnfs_curr_ld->cancel_io(lseg, devid);
}
extern unsigned int layoutstats_timer;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 022/742] pNFS: avoid repeatedly cancelling I/O for the same lseg
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (20 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 021/742] pNFS: allow layout drivers to cancel I/O to a single device Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 023/742] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
` (135 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tim Menninger, Anna Schumaker,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
[ Upstream commit 9e28836b480c66cca4c3d391177f5b3a50927f7d ]
Commit b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout is
recalled or revoked") added I/O cancellation when a layout segment is
invalidated while outstanding references remain.
The invalid segment stays on the layout's segment list until those
references drain. Subsequent scans can find it again and repeatedly
invoke the layout driver's cancel_io() callback. For flexfiles, this
cancels matching RPC tasks and disconnects data server RPC clients.
During RPC/RDMA data server recovery, repeated cancellation can cause a
reconnect loop that consumes essentially all client CPU and prevents
forward progress.
Record cancellation requests per mirror stripe in the flexfiles layout
segment. Each stripe is cancelled at most once, regardless of how many
times the invalid segment is encountered. A per-stripe bitmap rather
than a single per-segment bit preserves the ability to cancel I/O to a
different device after an earlier device-specific cancellation.
Cancellation is best-effort. An RPC that has already passed the
layout-validity check may not yet be visible to the cancellation
scan. Such I/O retains its lseg reference and remains subject to
the normal RPC completion and recovery paths. Suppress repeated
cancellation and disconnect requests without changing the existing
lseg lifetime and deferred layout-return accounting.
This reproduced on 6.8.0, 7.0.0, and 7.4.0-rc1. It was tested on
7.4.0-rc1 with sustained pNFS/flexfiles I/O over RPC/RDMA while
restarting the NFS service on a data server. Without it, repeated
cancellation led to a reconnect loop and no workload recovery. With it,
the client recovered after the data server returned.
Fixes: b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout is recalled or revoked")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 12 ++++++++++++
fs/nfs/flexfilelayout/flexfilelayout.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 9e1a78d7d6336..1c88bdc600ae7 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -11,6 +11,7 @@
#include <linux/nfs_mount.h>
#include <linux/nfs_page.h>
#include <linux/module.h>
+#include <linux/bitmap.h>
#include <linux/file.h>
#include <linux/sched/mm.h>
@@ -340,6 +341,7 @@ static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls)
{
if (fls) {
ff_layout_free_mirror_array(fls);
+ bitmap_free(fls->cancelled_stripes);
kfree(fls);
}
}
@@ -653,6 +655,12 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
fls->mirror_array[i]->report_interval = be32_to_cpup(p);
out_sort_mirrors:
+ fls->cancelled_stripes = bitmap_zalloc(
+ fls->mirror_array_cnt * dss_count, gfp_flags);
+ if (!fls->cancelled_stripes) {
+ rc = -ENOMEM;
+ goto out_err_free;
+ }
ff_layout_sort_mirrors(fls);
ret = &fls->generic_hdr;
dprintk("<-- %s (success)\n", __func__);
@@ -2587,6 +2595,10 @@ static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg,
if (devid && memcmp(&mirror->dss[dss_id].devid, devid,
sizeof(*devid)) != 0)
continue;
+ /* Do not cancel a stripe again while this lseg drains. */
+ if (test_and_set_bit(idx * mirror->dss_count + dss_id,
+ flseg->cancelled_stripes))
+ continue;
rcu_read_lock();
mirror_ds = rcu_dereference(mirror->dss[dss_id].mirror_ds);
if (IS_ERR_OR_NULL(mirror_ds) ||
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index 19b833f547416..7b0d625b06a70 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -109,6 +109,7 @@ struct nfs4_ff_layout_segment {
u64 stripe_unit;
u32 flags;
u32 mirror_array_cnt;
+ unsigned long *cancelled_stripes;
struct nfs4_ff_layout_mirror *mirror_array[] __counted_by(mirror_array_cnt);
};
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 023/742] hwmon: (nct6775) Handle dual use registers
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (21 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 022/742] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 024/742] s390/dasd: Fix typo immediatly -> immediately Greg Kroah-Hartman
` (134 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anton Lundin, Guenter Roeck,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Lundin <glance@ac2.se>
[ Upstream commit ca1abdd1a9b9ce51713a18c8905bf10579533c3b ]
The REG_TARGET register has different meaning, depending on if pwm is in
thermal_cruise or speed_cruise.
This means we can't assume it's always word sized, so we need to handle
it differently depending on which mode we're in.
The code already does this, but the register was configured as word
sized for the speed_cruise mode, which would do the wrong thing in
thermal_cruise mode.
Fixes: 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
Fixes: 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D")
Cc: stable@vger.kernel.org
Signed-off-by: Anton Lundin <glance@ac2.se>
Link: https://patch.msgid.link/20261109082511.851377-2-glance@ac2.se
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/nct6775-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 759ea3d1286e3..9096be35448bb 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1153,14 +1153,12 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
case nct6106:
return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
(reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
- reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
- reg == 0x111 || reg == 0x121 || reg == 0x131;
+ reg == 0xe0 || reg == 0xe2 || reg == 0xe4;
case nct6116:
return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
reg == 0x26 || reg == 0x28 || reg == 0x59 || reg == 0x5b ||
reg == 0xe0 || reg == 0xe2 || reg == 0xe4 || reg == 0xe6 ||
- reg == 0xe8 || reg == 0x111 || reg == 0x121 || reg == 0x131 ||
- reg == 0x191 || reg == 0x1a1;
+ reg == 0xe8;
case nct6775:
return (((reg & 0xff00) == 0x100 ||
(reg & 0xff00) == 0x200) &&
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 024/742] s390/dasd: Fix typo immediatly -> immediately
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (22 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 023/742] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 025/742] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
` (133 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jan Höppner,
Stefan Haberland, Jens Axboe, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
[ Upstream commit ae6f19236b5ae4eef4df2780d51bee19add0eba8 ]
Fix typo in function name dasd_sleep_on_immediatly().
Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20261112102608.1057852-2-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 25cdc1f63227 ("s390/dasd: Re-initialize RCD buffer with "V1.0" before every start")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/block/dasd.c | 4 ++--
drivers/s390/block/dasd_alias.c | 2 +-
drivers/s390/block/dasd_eckd.c | 14 +++++++-------
drivers/s390/block/dasd_int.h | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 2ffe404b890fd..d74ef737ae26a 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2576,7 +2576,7 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device)
return rc;
}
-int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
+int dasd_sleep_on_immediately(struct dasd_ccw_req *cqr)
{
struct dasd_device *device;
int rc;
@@ -2628,7 +2628,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
return rc;
}
-EXPORT_SYMBOL(dasd_sleep_on_immediatly);
+EXPORT_SYMBOL(dasd_sleep_on_immediately);
/*
* Cancels a request that was started with dasd_sleep_on_req.
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index 8d6c16d35c22a..1ffcfcfe4565f 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -750,7 +750,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu,
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
return rc;
}
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index d3de0d97cca21..73741873d42a4 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -922,7 +922,7 @@ static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags);
cqr->retries = 5;
cqr->callback = read_conf_cb;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
return rc;
}
@@ -6009,7 +6009,7 @@ __context_unsafe(/* Conditional locking */)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
clear_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -6065,7 +6065,7 @@ __context_unsafe(/* Conditional locking */)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
set_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -6120,7 +6120,7 @@ __context_unsafe(/* Conditional locking */)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
set_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -6184,7 +6184,7 @@ __context_unsafe(/* Conditional locking */)
cqr->status = DASD_CQR_FILLED;
cqr->lpm = usrparm.path_mask;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
/* verify that I/O processing didn't modify the path mask */
if (!rc && usrparm.path_mask && (cqr->lpm != usrparm.path_mask))
rc = -EIO;
@@ -6816,7 +6816,7 @@ static int dasd_eckd_read_message_buffer(struct dasd_device *device,
cqr->block = NULL;
cqr->expires = 10 * HZ;
set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags);
- /* dasd_sleep_on_immediatly does not do complex error
+ /* dasd_sleep_on_immediately does not do complex error
* recovery so clear erp flag and set retry counter to
* do basic erp */
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
@@ -6848,7 +6848,7 @@ static int dasd_eckd_read_message_buffer(struct dasd_device *device,
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (rc == 0) {
prssdp = (struct dasd_psf_prssd_data *) cqr->data;
message_buf = (struct dasd_rssd_messages *)
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index ef4930432c098..26ecf9f47d2eb 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -998,7 +998,7 @@ void dasd_schedule_device_bh(struct dasd_device *);
void dasd_schedule_block_bh(struct dasd_block *);
int dasd_sleep_on(struct dasd_ccw_req *);
int dasd_sleep_on_queue(struct list_head *);
-int dasd_sleep_on_immediatly(struct dasd_ccw_req *);
+int dasd_sleep_on_immediately(struct dasd_ccw_req *);
int dasd_sleep_on_queue_interruptible(struct list_head *);
int dasd_sleep_on_interruptible(struct dasd_ccw_req *);
void dasd_device_set_timer(struct dasd_device *, int);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 025/742] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (23 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 024/742] s390/dasd: Fix typo immediatly -> immediately Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 026/742] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online() Greg Kroah-Hartman
` (132 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Höppner, Stefan Haberland,
Jens Axboe, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
[ Upstream commit 25cdc1f63227a1ea69a1ec823a8a860e33299169 ]
Under z/VM the Read Configuration Data (RCD) buffer has to start with
EBCDIC "V1.0" to request the virtual device SNEQ that carries the
minidisk UIT. The request and the response share the same buffer:
CP evaluates the magic on the way out and the RCD data is written into
the same buffer on the way back.
The magic is only written when the request is built and again in
read_conf_cb() when the original request fails.
Several restart paths do not run that callback:
- ERP use the same buffer and if the same error occurs again,
the ERP restarts the existing ERP request;
if a different error occurs, it adds another ERP request.
Neither re-initializes the magic.
- Terminated (timed out) ERP requests, killed requests and requests
requeued after the last path was gone are restarted without it.
- dasd_sleep_on_immediately() overwrites cqr->callback, so read_conf_cb()
never ran for dasd_eckd_read_conf_immediately(), and its fastpath
retries in dasd_int_handler() do not call a callback either.
If such a restart succeeds, z/VM omits the virtual device SNEQ, the UID
of that path is built without the UIT and the paths are reported as
"Not all channel paths lead to the same device" although they lead to
the same minidisk.
Every start of a request, whatever path led to it, goes through
dasd_start_IO(). Add an optional prepare_io function to the request
that dasd_start_IO() calls before every start of the request and of
its ERP requests, and use it to write the magic for RCD requests.
The ERP handling stays unchanged. read_conf_cb() is no longer needed
and is removed, which also gets rid of its memset() that only cleared
a single byte.
Fixes: 5915a873fcb1 ("[S390] dasd: re-initialize read_conf buffer for retries")
Cc: stable@vger.kernel.org
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20261112102608.1057852-3-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/block/dasd.c | 1 +
drivers/s390/block/dasd_eckd.c | 52 ++++++++++++----------------------
drivers/s390/block/dasd_int.h | 15 ++++++++++
3 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d74ef737ae26a..3a55c937d0d64 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1396,6 +1396,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
cqr->status = DASD_CQR_ERROR;
return -EIO;
}
+ dasd_start_IO_prepare(cqr);
cqr->startclk = get_tod_clock();
cqr->starttime = jiffies;
cqr->retries--;
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 73741873d42a4..7e60d5b3b343c 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -845,20 +845,29 @@ static int dasd_eckd_compare_path_uid(struct dasd_device *device,
return memcmp(&device_uid, &path_uid, sizeof(struct dasd_uid));
}
+/*
+ * The RCD buffer has to start with EBCDIC "V1.0" to show support for
+ * virtual device SNEQ. The RCD data is written into the same buffer, so
+ * a failed attempt may already have overwritten the magic. Re-initialize
+ * it before every start, including restarts by ERP requests.
+ */
+static void dasd_eckd_rcd_prepare_io(struct dasd_ccw_req *cqr)
+{
+ struct ccw1 *ccw = cqr->cpaddr;
+ __u8 *rcd_buffer = dma32_to_virt(ccw->cda);
+
+ rcd_buffer[0] = 0xE5;
+ rcd_buffer[1] = 0xF1;
+ rcd_buffer[2] = 0x4B;
+ rcd_buffer[3] = 0xF0;
+}
+
static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device,
struct dasd_ccw_req *cqr,
__u8 *rcd_buffer,
__u8 lpm)
{
struct ccw1 *ccw;
- /*
- * buffer has to start with EBCDIC "V1.0" to show
- * support for virtual device SNEQ
- */
- rcd_buffer[0] = 0xE5;
- rcd_buffer[1] = 0xF1;
- rcd_buffer[2] = 0x4B;
- rcd_buffer[3] = 0xF0;
ccw = cqr->cpaddr;
ccw->cmd_code = DASD_ECKD_CCW_RCD;
@@ -875,33 +884,10 @@ static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device,
cqr->retries = 256;
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
+ cqr->prepare_io = dasd_eckd_rcd_prepare_io;
set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags);
}
-/*
- * Wakeup helper for read_conf
- * if the cqr is not done and needs some error recovery
- * the buffer has to be re-initialized with the EBCDIC "V1.0"
- * to show support for virtual device SNEQ
- */
-static void read_conf_cb(struct dasd_ccw_req *cqr, void *data)
-{
- struct ccw1 *ccw;
- __u8 *rcd_buffer;
-
- if (cqr->status != DASD_CQR_DONE) {
- ccw = cqr->cpaddr;
- rcd_buffer = dma32_to_virt(ccw->cda);
- memset(rcd_buffer, 0, sizeof(*rcd_buffer));
-
- rcd_buffer[0] = 0xE5;
- rcd_buffer[1] = 0xF1;
- rcd_buffer[2] = 0x4B;
- rcd_buffer[3] = 0xF0;
- }
- dasd_wakeup_cb(cqr, data);
-}
-
static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
struct dasd_ccw_req *cqr,
__u8 *rcd_buffer,
@@ -921,7 +907,6 @@ static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags);
cqr->retries = 5;
- cqr->callback = read_conf_cb;
rc = dasd_sleep_on_immediately(cqr);
return rc;
}
@@ -959,7 +944,6 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
goto out_error;
}
dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buf, lpm);
- cqr->callback = read_conf_cb;
ret = dasd_sleep_on(cqr);
/*
* on success we update the user input parms
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 26ecf9f47d2eb..53c450036fe10 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -147,6 +147,8 @@ struct dasd_ccw_req {
void *data; /* pointer to data area */
struct irb irb; /* device status in case of an error */
struct dasd_ccw_req *refers; /* ERP-chain queueing. */
+ /* optional prepare function called before every start_io, must not sleep */
+ void (*prepare_io)(struct dasd_ccw_req *cqr);
void *function; /* originating ERP action */
void *mem_chunk;
@@ -892,6 +894,19 @@ static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr)
return cqr->callback_data;
}
+/*
+ * Walk down the ERP chain to the original CQR and call its
+ * prepare_io function if set.
+ */
+static inline void dasd_start_IO_prepare(struct dasd_ccw_req *cqr)
+{
+ /* ERP requests use the prepare function of the original request */
+ while (cqr->refers)
+ cqr = cqr->refers;
+ if (cqr->prepare_io)
+ cqr->prepare_io(cqr);
+}
+
static inline bool dasd_req_conflict(struct dasd_ccw_req *cqr1,
struct dasd_ccw_req *cqr2)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 026/742] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (24 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 025/742] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 027/742] ksmbd: let the parents DACL grant DELETE and FILE_READ_ATTRIBUTES Greg Kroah-Hartman
` (131 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tejun Heo, Andrea Righi, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <tj@kernel.org>
[ Upstream commit 2227a34ff7bfcf6112931039e3554f4b70b65ab9 ]
ops.cpu_online() documents that the cpu doesn't call ops.enqueue() or
ops.dispatch() before that op. Both are gated on SCX_RQ_ONLINE, which
follows the core's rq online state through the ext class's rq_online and
rq_offline hooks. On a runtime cpu up, sched_cpu_activate() runs:
1. set_cpu_active() marks the cpu active.
2. cpuset_cpu_active() rebuilds the sched domains synchronously, and
rq_attach_root() puts the rq online as the cpu is active now. The
rq_online hook sets SCX_RQ_ONLINE.
3. scx_rq_activate() calls the root's ops.cpu_online().
Between 2 and 3, ops.enqueue() can be called for tasks woken or migrated
onto the cpu, and ops.dispatch() can run on it.
The hooks can't call the ops. They run under the rq lock with IRQs off while
the ops can be sleepable BPF programs, and handle_hotplug() needs the
rebuilt sched domains for its idle topology update.
Track SCX_RQ_ONLINE in handle_hotplug() alone. Set it right after the root's
ops.cpu_online(). Clear it and move the cpu's tasks to its local DSQ when
the cpu goes down. Sched domain rebuilds, which take a live cpu's rq offline
and online again, no longer touch the flag, so a remote dispatch can't see
it cleared by a rebuild and bounce to the global DSQ.
Between 2 and 3, tasks that land on the cpu now go to its local DSQ without
ops.enqueue(), and with sub-schedulers a task whose scheduler lacks caps on
the cpu is admitted anyway and counted in SCX_EV_SUB_FORCED_ADMIT. Both
already happen between 1 and 2.
Fixes: 60c27fb59f6c ("sched_ext: Implement sched_ext_ops.cpu_online/offline()")
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
[ sashal: Moved the SCX_RQ_ONLINE set/clear into handle_hotplug() and placed the ecaps reseed after it, dropping context lines for helpers and a flag this tree lacks and using the older comment wording. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext/ext.c | 65 ++++++++++++++++++++++----------------
kernel/sched/ext/inlines.h | 2 +-
kernel/sched/ext/sub.c | 9 +++---
kernel/sched/sched.h | 8 +++--
4 files changed, 48 insertions(+), 36 deletions(-)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 6db6ca912bb37..fbdf03214564d 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -1997,11 +1997,11 @@ static void direct_dispatch(struct scx_sched *sch, struct task_struct *p,
bool scx_rq_online(struct rq *rq)
{
/*
- * Test both cpu_active() and %SCX_RQ_ONLINE. %SCX_RQ_ONLINE indicates
- * the online state as seen from the BPF scheduler. cpu_active() test
- * guarantees that, if this function returns %true, %SCX_RQ_ONLINE will
- * stay set until the current scheduling operation is complete even if
- * we aren't locking @rq.
+ * Test both cpu_active() and %SCX_RQ_ONLINE. %SCX_RQ_ONLINE is set
+ * after the root's ops.cpu_online() and cleared when the cpu goes down.
+ * cpu_active() test guarantees that, if this function returns %true,
+ * %SCX_RQ_ONLINE will stay set until the current scheduling operation
+ * is complete even if we aren't locking @rq.
*/
return likely((rq->scx.flags & SCX_RQ_ONLINE) && cpu_active(cpu_of(rq)));
}
@@ -3825,6 +3825,13 @@ static void handle_hotplug(struct rq *rq, bool online)
s32 cpu = cpu_of(rq);
s32 cpu_or_cid = cpu;
+ if (!online) {
+ guard(rq_lock_irqsave)(rq);
+ update_rq_clock(rq);
+ rq->scx.flags &= ~SCX_RQ_ONLINE;
+ drain_offline_rq(rq);
+ }
+
atomic_long_inc(&scx_hotplug_seq);
/*
@@ -3832,15 +3839,19 @@ static void handle_hotplug(struct rq *rq, bool online)
* stable here. Note that we can't depend on scx_enabled() test as the
* hotplug ops need to be enabled before __scx_enabled is set.
*/
- if (unlikely(!sch))
+ if (unlikely(!sch)) {
+ /* no root to notify, set %SCX_RQ_ONLINE right away */
+ if (online) {
+ guard(rq_lock_irqsave)(rq);
+ rq->scx.flags |= SCX_RQ_ONLINE;
+ }
return;
+ }
if (scx_enabled())
scx_idle_update_selcpu_topology(&sch->ops);
- if (online)
- scx_online_ecaps(rq);
- else
+ if (!online)
scx_offline_ecaps(rq);
/*
@@ -3880,6 +3891,23 @@ static void handle_hotplug(struct rq *rq, bool online)
SCX_ECODE_ACT_RESTART | SCX_ECODE_RSN_HOTPLUG,
"cpu %d going %s, exiting scheduler", cpu,
online ? "online" : "offline");
+
+ if (online) {
+ /*
+ * The cpu must not call ops.enqueue() or ops.dispatch() before
+ * the root's ops.cpu_online(). The core's rq online state can't
+ * gate them, as the sched domain rebuild in
+ * sched_cpu_activate() can put @rq online before this function
+ * runs. Set %SCX_RQ_ONLINE here.
+ *
+ * scx_online_ecaps() queues a reseed whose ecaps ops run in
+ * dispatch context on the cpu and can insert into its local
+ * DSQ. Set the flag first.
+ */
+ scoped_guard (rq_lock_irqsave, rq)
+ rq->scx.flags |= SCX_RQ_ONLINE;
+ scx_online_ecaps(rq);
+ }
}
void scx_rq_activate(struct rq *rq)
@@ -3892,22 +3920,6 @@ void scx_rq_deactivate(struct rq *rq)
handle_hotplug(rq, false);
}
-static void rq_online_scx(struct rq *rq)
-{
- rq->scx.flags |= SCX_RQ_ONLINE;
-}
-
-static void rq_offline_scx(struct rq *rq)
-{
- rq->scx.flags &= ~SCX_RQ_ONLINE;
-
- /* sched domain rebuilds call rq_offline with the CPU staying alive */
- if (cpu_active(cpu_of(rq)))
- return;
-
- drain_offline_rq(rq);
-}
-
static bool check_rq_for_timeouts(struct rq *rq)
{
struct scx_sched *sch;
@@ -5287,9 +5299,6 @@ DEFINE_SCHED_CLASS(ext) = {
.task_woken = task_woken_scx,
.set_cpus_allowed = set_cpus_allowed_scx,
- .rq_online = rq_online_scx,
- .rq_offline = rq_offline_scx,
-
.task_tick = task_tick_scx,
.switching_to = switching_to_scx,
diff --git a/kernel/sched/ext/inlines.h b/kernel/sched/ext/inlines.h
index 5dce394e08134..8de281a5c9c6e 100644
--- a/kernel/sched/ext/inlines.h
+++ b/kernel/sched/ext/inlines.h
@@ -104,7 +104,7 @@ scx_dispatch_sched(struct scx_sched *sch, struct rq *rq,
/*
* scx_rq_online() can't be used. Its cpu_active() test goes false
* before CPU hotplug waits for an RCU grace period, and
- * rq_offline_scx() moves this CPU's tasks to the local DSQ only after
+ * handle_hotplug() moves this CPU's tasks to the local DSQ only after
* the wait. The grace period can depend on those tasks running.
*/
if (unlikely(!SCX_HAS_OP(sch, dispatch)) || !(rq->scx.flags & SCX_RQ_ONLINE))
diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c
index 4dc3bb12aca3a..c06017429890c 100644
--- a/kernel/sched/ext/sub.c
+++ b/kernel/sched/ext/sub.c
@@ -883,10 +883,11 @@ struct scx_dispatch_q *scx_resolve_local_dsq(struct scx_sched *sch, struct rq *r
return &rq->scx.local_dsq;
/*
- * The task must run on this CPU regardless of caps: the rq is draining
- * offline (BPF scheduler bypassed), the task is migration-disabled, or a
- * migration is pending. Admit despite the missing caps and count it.
- * Refuse preemptions.
+ * The task must run on this CPU regardless of caps: ops.enqueue() is
+ * skipped while the CPU is going down or before the root's
+ * ops.cpu_online(), the task is migration-disabled, or a migration is
+ * pending. Admit despite the missing caps and count it. Refuse
+ * preemptions.
*/
if (unlikely(!scx_rq_online(rq) || is_migration_disabled(p) ||
p->migration_pending)) {
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 61b913032c640..80e72b01b718c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -781,9 +781,11 @@ struct cfs_rq {
/* scx_rq->flags, protected by the rq lock */
enum scx_rq_flags {
/*
- * A hotplugged CPU starts scheduling before rq_online_scx(). Track
- * ops.cpu_on/offline() state so that ops.enqueue/dispatch() are called
- * only while the BPF scheduler considers the CPU to be online.
+ * Set right after the root's ops.cpu_online() when a cpu comes up and
+ * cleared when the cpu goes down, see handle_hotplug(). A hotplugged
+ * cpu starts scheduling before %SCX_RQ_ONLINE is set. ops.enqueue() and
+ * ops.dispatch() are called for the cpu only while the flag is set, see
+ * scx_rq_online() and scx_dispatch_sched().
*/
SCX_RQ_ONLINE = 1 << 0,
SCX_RQ_CAN_STOP_TICK = 1 << 1,
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 027/742] ksmbd: let the parents DACL grant DELETE and FILE_READ_ATTRIBUTES
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (25 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 026/742] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 028/742] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
` (130 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ian Bridges, Namjae Jeon,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <icb@fastmail.org>
[ Upstream commit 4ab80fd4d1f1c4363b336ddb3d8818ea37c4997d ]
FILE_DELETE_CHILD on a directory can grant DELETE on its children.
FILE_LIST_DIRECTORY can similarly grant FILE_READ_ATTRIBUTES. Because
ksmbd checks only the child's DACL, it can refuse rename, deletion and
attribute opens that the parent permits.
When the child does not grant an explicitly requested DELETE or
FILE_READ_ATTRIBUTES, check the parent for FILE_DELETE_CHILD or
FILE_LIST_DIRECTORY. Use exact SID matching, evaluate group allows and
denies, and exclude guest and anonymous sessions from Authenticated
Users. Fail closed on non-inherit-only object deny ACEs, missing or
unreadable parent DACLs and the mount root.
For the strict parent check, let applicable group and OWNER RIGHTS ACEs
decide before the POSIX ACL fallback. Otherwise a POSIX ACL entry can
hide a FILE_DELETE_CHILD grant.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smbacl.c | 99 ++++++++++++++++++++++++++++++++++--------
1 file changed, 81 insertions(+), 18 deletions(-)
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index 27da571c96127..50e6ef4240571 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -1494,6 +1494,11 @@ static bool smb_sid_is_owner_rights(const struct smb_sid *sid)
!compare_sids(sid, &sid_owner_rights);
}
+static unsigned int smb_parent_derived_rights(struct ksmbd_conn *conn,
+ const struct path *path, int uid,
+ bool authenticated,
+ unsigned int want);
+
int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
__le32 *pdaccess, __le32 raw_daccess, int uid,
bool authenticated, bool strict)
@@ -1514,16 +1519,19 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
unsigned int grp_allowed = 0, grp_denied = 0, bits;
struct smb_ace *others_ace = NULL;
bool or_ace = false, obj_deny = false, au_ace = false, member, counted;
+ bool grp_ace = false;
struct posix_acl_entry *pa_entry;
unsigned int sid_type = SIDOWNER;
unsigned short ace_size;
bool is_owner, owner_rights = false;
bool maximal = *pdaccess & FILE_MAXIMAL_ACCESS_LE;
/*
- * MAXIMUM_ALLOWED requests match every session against
- * Authenticated Users.
+ * MAXIMUM_ALLOWED requests that are not strict match every session
+ * against Authenticated Users and do not count ACEs for the
+ * caller's groups. Strict ones match SIDs as explicit requests do.
*/
- bool authusers = authenticated || maximal;
+ bool open_max = maximal && !strict;
+ bool authusers = authenticated || open_max;
vfsuid_t vfsuid;
ksmbd_debug(SMB, "check permission using windows acl\n");
@@ -1557,13 +1565,16 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
/*
* An empty (present, zero-ACE) DACL grants no access to
* anyone except the object owner's implicit READ_CONTROL
- * and WRITE_DAC (MS-DTYP 2.4.5). Deny every other caller,
- * deny the owner any access beyond those two bits, and do
- * not let trailing bytes after a zero-ACE DACL become an
- * implicit grant.
+ * and WRITE_DAC (MS-DTYP 2.5.3.2), besides what the parent
+ * grants. Deny every other right, and do not let trailing
+ * bytes after a zero-ACE DACL become an implicit grant.
*/
if (is_owner)
allowed = READ_CONTROL | WRITE_DAC;
+ if (!strict)
+ allowed |= smb_parent_derived_rights(conn, path, uid,
+ authenticated,
+ requested & ~allowed);
if (maximal)
requested |= allowed;
if (!allowed || requested & ~allowed)
@@ -1576,9 +1587,10 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
/*
* Evaluate the DACL in order (MS-DTYP 2.5.3.2). access_bits collects
* the result for the ACEs that apply to the caller, without its groups
- * for MAXIMUM_ALLOWED. grp_granted collects what ACEs for the caller's
- * groups, or OWNER RIGHTS for the owner, grant. It is used when the
- * SID lookup and POSIX ACL fallback below do not decide.
+ * for a MAXIMUM_ALLOWED request that is not strict. grp_granted
+ * collects what ACEs for the caller's groups, or OWNER RIGHTS for the
+ * owner, grant. It is used when the SID lookup and POSIX ACL fallback
+ * below do not decide.
*/
ace = (struct smb_ace *)((char *)pdacl + sizeof(struct smb_acl));
aces_size = pdacl_size - sizeof(struct smb_acl);
@@ -1623,8 +1635,8 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
compare_sids(&sid_owner_rights, &ace->sid) &&
!member))
goto next_ace;
- /* An explicit request counts only SIDs that match exactly */
- if (!maximal && !member &&
+ /* Other requests count only SIDs that match exactly */
+ if (!open_max && !member &&
!smb_sid_equal(&sid, &ace->sid) &&
!smb_sid_equal(&sid_everyone, &ace->sid) &&
!(authusers && smb_sid_equal(&sid_authusers, &ace->sid)) &&
@@ -1634,10 +1646,11 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
bits = le32_to_cpu(ace->access_req);
switch (ace->type) {
case ACCESS_ALLOWED_ACE_TYPE:
+ grp_ace |= counted;
if (counted)
grp_allowed |= bits;
- /* MAXIMUM_ALLOWED takes no group grants */
- if (maximal && member)
+ /* An open's MAXIMUM_ALLOWED takes no group grants */
+ if (open_max && member)
break;
if (counted)
grp_granted |= bits;
@@ -1645,10 +1658,11 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
break;
case ACCESS_DENIED_ACE_TYPE:
case ACCESS_DENIED_CALLBACK_ACE_TYPE:
+ grp_ace |= counted;
if (counted)
grp_denied |= ~grp_allowed & bits;
- /* MAXIMUM_ALLOWED takes no group denials either */
- if (!(maximal && member))
+ /* nor group denials */
+ if (!(open_max && member))
denied |= ~access_bits & bits;
break;
}
@@ -1663,6 +1677,9 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
access_bits |= READ_CONTROL | WRITE_DAC |
FILE_READ_ATTRIBUTES | DELETE;
access_bits &= ~denied;
+ /* An object deny ACE could deny the parent's rights */
+ if (!open_max && obj_deny)
+ access_bits = 0;
if ((raw_daccess & FILE_GENERIC_EXECUTE_LE) &&
S_ISREG(d_inode(path->dentry)->i_mode) &&
(access_bits & GENERIC_READ_FLAGS) == GENERIC_READ_FLAGS)
@@ -1719,10 +1736,13 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
posix_acls = get_inode_acl(d_inode(path->dentry), ACL_TYPE_ACCESS);
/*
* An Authenticated Users ACE keeps the POSIX ACL from deciding,
- * also for sessions that it does not match.
+ * also for sessions that it does not match. For a strict
+ * MAXIMUM_ALLOWED request, ACEs for the caller's groups or
+ * OWNER RIGHTS decide before the POSIX ACL, unless the DACL has
+ * an object deny ACE, which ksmbd does not parse.
*/
if (!IS_ERR_OR_NULL(posix_acls) && !found && !others_ace &&
- !au_ace) {
+ !au_ace && !(strict && maximal && grp_ace && !obj_deny)) {
unsigned int id = -1;
pa_entry = posix_acls->a_entries;
@@ -1783,6 +1803,10 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
*/
if (!obj_deny)
allowed |= grp_granted;
+ if (!strict)
+ allowed |= smb_parent_derived_rights(conn, path, uid,
+ authenticated,
+ requested & ~allowed);
if (maximal)
requested |= allowed;
if (!allowed || requested & ~allowed) {
@@ -1828,6 +1852,45 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
return rc;
}
+/*
+ * Return the rights in @want that @path gets from its parent directory:
+ * DELETE if the parent's DACL grants FILE_DELETE_CHILD, and
+ * FILE_READ_ATTRIBUTES if it grants FILE_LIST_DIRECTORY
+ * (MS-FSA 2.1.5.1.2.1). A parent with no DACL, or with one that ksmbd
+ * cannot read, gives nothing. Callers pass only rights that the request
+ * names.
+ */
+static unsigned int smb_parent_derived_rights(struct ksmbd_conn *conn,
+ const struct path *path, int uid,
+ bool authenticated,
+ unsigned int want)
+{
+ struct path parent = { .mnt = path->mnt };
+ __le32 granted = FILE_MAXIMAL_ACCESS_LE;
+ unsigned int rights = 0;
+ int rc;
+
+ if (!(want & (DELETE | FILE_READ_ATTRIBUTES)))
+ return 0;
+
+ /* The root of the mount, or a disconnected dentry, has no parent */
+ if (path->dentry == path->mnt->mnt_root || IS_ROOT(path->dentry))
+ return 0;
+
+ parent.dentry = dget_parent(path->dentry);
+ /* Strict, so the parent's own parent is not consulted */
+ rc = smb_check_perm_dacl(conn, &parent, &granted, 0, uid,
+ authenticated, true);
+ dput(parent.dentry);
+ if (rc || granted == FILE_MAXIMAL_ACCESS_LE)
+ return 0;
+ if (granted & FILE_DELETE_CHILD_LE)
+ rights |= DELETE;
+ if (granted & FILE_LIST_DIRECTORY_LE)
+ rights |= FILE_READ_ATTRIBUTES;
+ return rights & want;
+}
+
int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
const struct path *path, struct smb_ntsd *pntsd, int ntsd_len,
bool type_check, bool get_write)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 028/742] ksmbd: skip metadata-only opens in sharing checks
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (26 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 027/742] ksmbd: let the parents DACL grant DELETE and FILE_READ_ATTRIBUTES Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 029/742] ksmbd: skip metadata-only stream opens in the delete check Greg Kroah-Hartman
` (129 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ian Bridges, Namjae Jeon,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <icb@fastmail.org>
[ Upstream commit 81fefb6c635489e71e286d1465b6dd1d0a27ceec ]
A READ_CONTROL open without sharing can block later reads, writes and
deletes even though it holds no data, execute or delete access.
Keep the existing attribute-only exception. For other pairs, require
both effective access masks to hold one of those rights. MS-FSA
2.1.5.1.2 grants FILE_WRITE_DATA when an open overwrites a file or
stream, or creates a named stream on an existing file. Use that granted
access for sharing checks while keeping the requested access on the
returned handle.
The Time Machine AFP_AfpInfo synthesis keeps its requested access.
ksmbd implements FILE_SUPERSEDE by truncating the file, so count it as
a write.
This also prevents an overwrite from truncating a file while another
open that holds data, execute or delete access does not share writing.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 30 ++++++++++++++++++++++--------
fs/smb/server/smb_common.c | 34 +++++++++++++++++++++++++++++++++-
fs/smb/server/smb_common.h | 5 +++++
fs/smb/server/vfs_cache.h | 2 ++
4 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index d6359702faa3e..c8e87c7c8bc21 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3537,7 +3537,8 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
static noinline int smb2_set_stream_name_xattr(const struct path *path,
struct ksmbd_file *fp,
- char *stream_name, int s_type)
+ char *stream_name, int s_type,
+ bool *created)
{
struct mnt_idmap *idmap = mnt_idmap(path->mnt);
size_t xattr_stream_size;
@@ -3601,6 +3602,8 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,
rc = ksmbd_vfs_setxattr(idmap, path, xattr_stream_name, NULL, 0, 0, false);
if (rc < 0)
pr_err("Failed to store XATTR stream name :%d\n", rc);
+ else
+ *created = true;
return 0;
}
@@ -4419,6 +4422,7 @@ int smb2_open(struct ksmbd_work *work)
char *stream_name = NULL;
bool file_present = false, created = false, already_permitted = false;
bool app_instance_id_checked = false, app_instance_closed;
+ bool stream_created = false;
int share_ret, need_truncate = 0;
u64 time, alloc_size = 0;
umode_t posix_mode = 0;
@@ -5174,7 +5178,8 @@ int smb2_open(struct ksmbd_work *work)
rc = smb2_set_stream_name_xattr(&path,
fp,
stream_name,
- s_type);
+ s_type,
+ &stream_created);
if (rc)
goto err_out;
file_info = FILE_CREATED;
@@ -5182,12 +5187,24 @@ int smb2_open(struct ksmbd_work *work)
fp->attrib_only = !(req->DesiredAccess & ~(FILE_READ_ATTRIBUTES_LE |
FILE_WRITE_ATTRIBUTES_LE | FILE_SYNCHRONIZE_LE));
+ need_truncate = !S_ISDIR(file_inode(filp)->i_mode) &&
+ open_flags & O_TRUNC && !fp->attrib_only && !stream_name;
+ /*
+ * Count the FILE_WRITE_DATA that MS-FSA 2.1.5.1.2 grants an overwrite,
+ * supersede included, or a new named stream on an existing file.
+ * An attribute-only open of the file is not truncated, and the
+ * synthesized AFP_AfpInfo stream is not created by the client.
+ */
+ fp->implied_write = need_truncate ||
+ (stream_name &&
+ (open_flags & O_TRUNC ||
+ (file_present && stream_created)));
fp->is_posix_ctxt = posix_ctxt;
/* fp should be searchable through ksmbd_inode.m_fp_list
- * after daccess, saccess, attrib_only, and stream are
- * initialized.
+ * after daccess, saccess, attrib_only, implied_write, and
+ * stream are initialized.
*/
down_write(&fp->f_ci->m_lock);
list_add(&fp->node, &fp->f_ci->m_fp_list);
@@ -5208,11 +5225,8 @@ int smb2_open(struct ksmbd_work *work)
if (file_present || created)
path_put(&path);
- if (!S_ISDIR(file_inode(filp)->i_mode) && open_flags & O_TRUNC &&
- !fp->attrib_only && !stream_name) {
+ if (need_truncate)
smb_break_all_oplock(work, fp);
- need_truncate = 1;
- }
share_ret = ksmbd_smb_check_shared_mode(fp->filp, fp);
if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
index 5ddefb5a7078c..9c962952082fb 100644
--- a/fs/smb/server/smb_common.c
+++ b/fs/smb/server/smb_common.c
@@ -695,10 +695,24 @@ static void smb_shared_mode_error(int error, struct ksmbd_file *prev_fp,
prev_fp->saccess, curr_fp->daccess);
}
+/*
+ * Sharing checks use fp->daccess plus the FILE_WRITE_DATA that MS-FSA
+ * grants an open that overwrites data or creates a named stream.
+ * fp->daccess keeps the open's own access.
+ */
+__le32 ksmbd_sharing_daccess(const struct ksmbd_file *fp)
+{
+ if (fp->implied_write)
+ return fp->daccess | FILE_WRITE_DATA_LE;
+ return fp->daccess;
+}
+
int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
{
int rc = 0;
struct ksmbd_file *prev_fp;
+ __le32 curr_access = ksmbd_sharing_daccess(curr_fp);
+ __le32 access;
/*
* Lookup fp in master fp list, and check desired access and
@@ -719,6 +733,24 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
if (prev_fp->attrib_only != curr_fp->attrib_only)
continue;
+ /*
+ * MS-FSA checks sharing per stream, so a named stream open's
+ * implied write is not a write against the primary stream.
+ * It still decides whether the pair is checked.
+ */
+ access = curr_access;
+ if (ksmbd_stream_fd(curr_fp) && !ksmbd_stream_fd(prev_fp))
+ access = curr_fp->daccess;
+
+ /*
+ * Two opens conflict only if both hold a right in
+ * FILE_SHARE_CHECKED_ACCESS_LE (MS-FSA 2.1.5.1.2.1 and
+ * 2.1.5.1.2.2)
+ */
+ if (!(ksmbd_sharing_daccess(prev_fp) & FILE_SHARE_CHECKED_ACCESS_LE) ||
+ !(curr_access & FILE_SHARE_CHECKED_ACCESS_LE))
+ continue;
+
if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE) &&
curr_fp->daccess & FILE_DELETE_LE) {
smb_shared_mode_error(SHARE_DELETE_ERROR,
@@ -745,7 +777,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
}
if (!(prev_fp->saccess & FILE_SHARE_WRITE_LE) &&
- curr_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) {
+ access & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) {
smb_shared_mode_error(SHARE_WRITE_ERROR,
prev_fp,
curr_fp);
diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
index 7b9c5cfcb63b0..d481f02b365e8 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -69,6 +69,10 @@
FILE_EXECUTE | FILE_DELETE_CHILD | \
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES)
+/* Rights that make an open take part in sharing checks */
+#define FILE_SHARE_CHECKED_ACCESS_LE (FILE_EXECUTE_LE | FILE_READ_DATA_LE | \
+ FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE | FILE_DELETE_LE)
+
#define SMB_COM_NEGOTIATE 0x72 /* See MS-CIFS 2.2.2.1 */
/* See MS-CIFS 2.2.3.1 */
@@ -186,6 +190,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn,
int ksmbd_smb_negotiate_common(struct ksmbd_work *work, unsigned int command);
+__le32 ksmbd_sharing_daccess(const struct ksmbd_file *fp);
int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp);
int __ksmbd_override_fsids(struct ksmbd_work *work,
struct ksmbd_share_config *share);
diff --git a/fs/smb/server/vfs_cache.h b/fs/smb/server/vfs_cache.h
index 84ca73f483143..c35e4ba8432c0 100644
--- a/fs/smb/server/vfs_cache.h
+++ b/fs/smb/server/vfs_cache.h
@@ -119,6 +119,8 @@ struct ksmbd_file {
bool is_nt_open;
bool attrib_only;
+ /* writes data on open, see ksmbd_sharing_daccess() */
+ bool implied_write;
bool allocation_size_set;
char client_guid[16];
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 029/742] ksmbd: skip metadata-only stream opens in the delete check
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (27 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 028/742] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 030/742] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
` (128 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ian Bridges, Namjae Jeon,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <icb@fastmail.org>
[ Upstream commit 2f14fe2d589583ce649b2bf1b449cc9839abda8b ]
A metadata-only named-stream open without FILE_SHARE_DELETE blocks a
later DELETE open of the file. It also blocks setting the file delete
pending.
Ignore a stream open unless its effective access includes data, execute
or delete access. Reuse the sharing-access helper so overwriting a
stream, or creating one on an existing file, still counts as
FILE_WRITE_DATA. The Time Machine AFP_AfpInfo synthesis keeps only its
requested access.
Fixes: 19043971c947 ("ksmbd: honor stream delete sharing for base file")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/vfs_cache.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index c6999ed4e6d67..e0b78623d7b62 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -344,7 +344,12 @@ bool ksmbd_has_stream_without_delete_share(struct ksmbd_file *fp)
if (file_inode(fp->filp) != file_inode(prev_fp->filp))
continue;
- if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE)) {
+ /*
+ * A stream open with no right in FILE_SHARE_CHECKED_ACCESS_LE,
+ * implied writes included, never conflicts.
+ */
+ if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE) &&
+ ksmbd_sharing_daccess(prev_fp) & FILE_SHARE_CHECKED_ACCESS_LE) {
ret = true;
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 030/742] gpio: mvebu: name regmaps to fix debugfs collisions
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (28 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 029/742] ksmbd: skip metadata-only stream opens in the delete check Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 031/742] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
` (127 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Linus Walleij,
Bartosz Golaszewski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 4d305c2273123119c27d6e4c822215e650c451e3 ]
Each marvell,armada-370-gpio node provides both 'gpio' and 'pwm'
register windows, and the driver creates one regmap per window on the
same platform device. The shared regmap_config was unnamed, so both
maps defaulted their debugfs directory to dev_name(), e.g.
debugfs: 'f1018100.gpio' already exists in 'regmap'
because the PWM regmap (and on Armada XP the per-CPU regmap) claimed
the same directory as the GPIO regmap.
Give each regmap a distinct .name so the debugfs directories become
'<dev>.gpio', '<dev>.percpu' and '<dev>.pwm'. This only affects
debugfs naming; register access is unchanged.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260905004334.177074-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Stable-dep-of: 42269cdb3d3b ("gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a2796240fe14b..267e6d5bacd0d 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -599,6 +599,21 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc)
}
static const struct regmap_config mvebu_gpio_regmap_config = {
+ .name = "gpio",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+};
+
+static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
+ .name = "percpu",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+};
+
+static const struct regmap_config mvebu_pwm_regmap_config = {
+ .name = "pwm",
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
@@ -868,7 +883,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
return PTR_ERR(base);
mvpwm->regs = devm_regmap_init_mmio(&pdev->dev, base,
- &mvebu_gpio_regmap_config);
+ &mvebu_pwm_regmap_config);
if (IS_ERR(mvpwm->regs))
return PTR_ERR(mvpwm->regs);
@@ -1135,7 +1150,7 @@ static int mvebu_gpio_probe_raw(struct platform_device *pdev,
mvchip->percpu_regs =
devm_regmap_init_mmio(&pdev->dev, base,
- &mvebu_gpio_regmap_config);
+ &mvebu_gpio_percpu_regmap_config);
if (IS_ERR(mvchip->percpu_regs))
return PTR_ERR(mvchip->percpu_regs);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 031/742] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (29 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 030/742] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 032/742] NFSv4: wake blocking lock waiters when a delegated lock is released Greg Kroah-Hartman
` (126 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
[ Upstream commit 42269cdb3d3b46ba6e80f31d0e00d0bdcff1d8d4 ]
mvebu_gpio_write_level_mask() is called with a raw spinlock taken but
the underlying regmap uses a standard spinlock which can sleep on
RT_PREEMPT kernels. Add the .use_raw_spinlock attribute to the
appropriate regmap config.
Cc: stable@vger.kernel.org
Fixes: 2233bf7a92e7 ("gpio: mvebu: switch to regmap for register access")
Fixes: 4d305c227312 ("gpio: mvebu: name regmaps to fix debugfs collisions")
Closes: https://sashiko.dev/#/bug/linux-6bee0c4f-384c-494c-868e-07c420195d13
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261109-gpio-mvebu-sleeping-while-atomic-v2-1-41f070421e70@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 267e6d5bacd0d..92ce02441cc99 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -603,6 +603,7 @@ static const struct regmap_config mvebu_gpio_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
@@ -610,6 +611,7 @@ static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_pwm_regmap_config = {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 032/742] NFSv4: wake blocking lock waiters when a delegated lock is released
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (30 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 031/742] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 033/742] ext4: dont track metadata buffers on an inode during fast commit replay Greg Kroah-Hartman
` (125 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Olga Kornievskaia, Anna Schumaker,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <okorniev@redhat.com>
[ Upstream commit e8433473eca284bc561373d0a0fff632f76aa594 ]
When the client holds a delegation, _nfs4_proc_setlk() caches POSIX
locks locally and never sends a LOCK to the server. It has to strip
FL_SLEEP to do so, since that branch runs holding
sp->so_delegreturn_mutex and nfsi->rwsem and F_SETLKW can block
indefinitely. A contending waiter is therefore never placed on the VFS
blocked-lock list, and locks_wake_up_blocks() does not reach it when the
holder releases.
The waiter blocks in nfs4_retry_setlk() on clp->cl_lock_waitq instead,
whose only waker is nfs4_callback_notify_lock(). The server never saw a
LOCK for a cached lock, so it does not know anyone is waiting and will
never send a CB_NOTIFY_LOCK; nfs4_proc_unlck() returns early without
sending LOCKU for the same reason. The waiter sleeps out the full
NFS4_LOCK_MAXTIMEOUT of 30s before retrying a lock that is long free.
Wake cl_lock_waitq when releasing a cached lock. The releasing thread
cannot tell which waiter wants the lock, so the wakeup names only the
inode; make the owner comparison in nfs4_wake_lock_waiter() conditional
on cbnl_valid so that a CB_NOTIFY_LOCK still wakes exactly the owner it
names. The inode restriction matters: without it every blocked locker
for the server is woken, and those on non-delegated state each retry
with a LOCK RPC.
Fixes: a1d617d8f134 ("nfs: allow blocking locks to be awoken by lock callbacks")
Assisted-by: Claude Opus 5
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4proc.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2a27d17a86b11..bbf53366455b3 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7292,8 +7292,15 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
if (status != 0)
goto out;
/* Is this a delegated lock? */
- if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0)
+ if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0) {
+ struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
+ struct cb_notify_lock_args cbnl = { .cbnl_valid = false };
+
+ /* The server never saw it, so it will not notify waiters */
+ nfs_copy_fh(&cbnl.cbnl_fh, NFS_FH(inode));
+ __wake_up(&clp->cl_lock_waitq, TASK_NORMAL, 0, &cbnl);
goto out;
+ }
alloc_seqid = NFS_SERVER(inode)->nfs_client->cl_mvops->alloc_seqid;
seqid = alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
status = -ENOMEM;
@@ -7713,8 +7720,14 @@ nfs4_wake_lock_waiter(wait_queue_entry_t *wait, unsigned int mode, int flags, vo
struct nfs_lowner *lowner = &cbnl->cbnl_owner,
*wowner = &waiter->owner;
- /* Only wake if the callback was for the same owner. */
- if (lowner->id != wowner->id || lowner->s_dev != wowner->s_dev)
+ /*
+ * Only wake the owner a CB_NOTIFY_LOCK names. A lock cached
+ * under a delegation is released locally, and the releasing
+ * thread cannot tell which waiter wants it, so those wakeups
+ * (cbnl_valid false) name only the inode and wake them all.
+ */
+ if (cbnl->cbnl_valid &&
+ (lowner->id != wowner->id || lowner->s_dev != wowner->s_dev))
return 0;
/* Make sure it's for the right inode */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 033/742] ext4: dont track metadata buffers on an inode during fast commit replay
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (31 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 032/742] NFSv4: wake blocking lock waiters when a delegated lock is released Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 034/742] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
` (124 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Theodore Tso, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <tytso@mit.edu>
[ Upstream commit aceadbccd428fb8e6593b27a3091d961f80225d1 ]
Fast commit replay runs without a journal handle and before
EXT4_SB(sb)->s_journal is set, so it effectively runs in nojournal mode.
__ext4_handle_dirty_metadata() then hands every extent tree block and
directory block it dirties to mmb_mark_buffer_dirty().
Commit d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in
mmb_mark_buffer_dirty()") sets this flag on the inode, which can
trigger a NULL pointer dereference on a per-cpu pointer during the
fast commit replay. This is because the iput at the end of each fast
commit update triggers write_inode_now(), and with
I_METADATA_WRITEBACK set, writeback_single_inode() will end up calling
ext4_writepages(), before ext4_percpu_param_init() has initialized
s_writepages_rwsem.
A similar crash was fixed in commit 0ecd56573c1f ("ext4: Avoid
entering writeback paths during fastcommit replay") by not setting
this flag in ext4_mark_iloc_dirty(). This commit applies the same fix
to __ext4_handle_dirty_metadata().
Once the fast commit replay is complete, jbd2_journal_recover() syncs
and flushes the whole block device, o the buffer is still written out
before the mount proceeds.
Reproduced with generic/311 using "-O inline_data,fast_commit" (the
ext4/adv test configuration).
Fixes: d4fdde3257a5 ("fs: set I_METADATA_WRITEBACK in mmb_mark_buffer_dirty()")
Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/ext4_jbd2.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 53ddedb52a6f7..d81ce9b8a5407 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -412,7 +412,19 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
err);
}
} else {
- if (inode) {
+ /*
+ * Fast commit replay runs without a handle, before the
+ * writeback paths are set up. Don't track the buffer in the
+ * inode's metadata list then: mmb_mark_buffer_dirty() sets
+ * I_METADATA_WRITEBACK, and since the superblock isn't active
+ * yet the iput() ending the replay step writes the inode out
+ * and enters ext4_writepages() before s_writepages_rwsem is
+ * initialized. Journal recovery flushes the whole block
+ * device once replay is done, so the buffer still gets
+ * written.
+ */
+ if (inode && !(EXT4_SB(inode->i_sb)->s_mount_state &
+ EXT4_FC_REPLAY)) {
if (!ext4_i_metadata_bhs(inode))
ext4_inode_attach_mmb(inode);
mmb_mark_buffer_dirty(bh, ext4_i_metadata_bhs(inode));
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 034/742] ACPI: PM: Avoid initializing power management for absent devices
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (32 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 033/742] ext4: dont track metadata buffers on an inode during fast commit replay Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 035/742] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
` (123 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alan Borzeszkowski,
Rafael J. Wysocki, Mika Westerberg, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit b91ad39f29ceeee3e3d37eedff6b7c912855623c ]
Commit 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power()
early") removed a device presence check from acpi_bus_init_power() which
in some cases causes power management to be initialized for an ACPI
device object and never used going forward. That in turn may prevent
power management from working as expected for other devices.
Namely, if a given ACPI device object is not enabled according to its
_STA, find_child_checks() will return an error for it which will prevent
it from being used as an ACPI companion for a PCI device. Thus if
acpi_device_init_power() initializes power management for it and its
initial power state turns out to be different from D3cold, it may stay
in that power state forever. If it has power resources and they are
"on" during the initialization, they may be reference-counted and never
turned off. If they are shared with other devices, they will prevent
power from going down after attempting to put the other devices into
low-power states.
To prevent that from happening, restore the device presence check in
acpi_bus_init_power(), but also adjust find_child_checks() to return
an error for absent devices (instead of doing that for disabled devices)
in accordance with acpi_bus_init_power() and the existing check in
acpi_bus_attach().
Fixes: 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power() early")
Reported-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Tested-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/13013440.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/device_pm.c | 15 +++++++++++++--
drivers/acpi/glue.c | 8 ++------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 76104f715efa1..d975700936e87 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -365,14 +365,25 @@ int acpi_bus_init_power(struct acpi_device *device)
* fails, ACPI power management will not be used for the device going
* forward.
*/
+ if (!acpi_device_is_present(device)) {
+ acpi_handle_debug(device->handle,
+ "Device not present, ACPI PM disabled\n");
+ result = -ENXIO;
+ goto fail;
+ }
+
result = acpi_device_init_power(device);
if (result) {
- device->flags.power_manageable = 0;
- device->power.state = ACPI_D_STATE_INVALID;
acpi_handle_info(device->handle,
"Initial power state undetermined, ACPI PM disabled\n");
+ goto fail;
}
+ return 0;
+
+fail:
+ device->flags.power_manageable = 0;
+ device->power.state = ACPI_D_STATE_INVALID;
return result;
}
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index e55daa4221da8..9348b98d93d85 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -105,14 +105,10 @@ static bool acpi_dev_has_children(struct acpi_device *adev)
static int find_child_checks(struct acpi_device *adev, bool check_children)
{
- unsigned long long sta;
- acpi_status status;
-
if (check_children && !acpi_dev_has_children(adev))
return -ENODEV;
- status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
- if (status == AE_NOT_FOUND) {
+ if (!acpi_has_method(adev->handle, METHOD_NAME__STA)) {
/*
* Special case: backlight device objects without _STA are
* preferred to other objects with the same _ADR value, because
@@ -124,7 +120,7 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
return FIND_CHILD_MIN_SCORE;
}
- if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
+ if (!acpi_device_is_present(adev))
return -ENODEV;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 035/742] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B"
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (33 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 034/742] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 036/742] smb: client: remove commented-out cancel_*_requests() calls Greg Kroah-Hartman
` (122 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cristian-Marian Fotache,
Takashi Iwai, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit b9fd2f07df77076f83a58fe7a5640cbcbc5a61ff ]
This reverts commit 2a8ee6897302ca12ff39e8eb180503956797c60c.
We've received a regression report due to this commit, and it turned
out that the PCI SSID for this quirk entry is too generic (10ec:111e)
that may match with several different models.
Usually a workaround would be to apply the quirk for a more unique ID
such as codec SSID, but in this case, unfortunately, the codec SSID is
also 10ec:111e, so BIOS is in a premature state.
For addressing the regression, revert the change for now.
Fixes: 2a8ee6897302 ("ALSA: hda/realtek: Fix silent speaker on Higole F9B")
Reported-by: Cristian-Marian Fotache <cristianmarianfotache@gmail.com>
Closes: https://lore.kernel.org/CACGjpbf73XdwrG34ffjmYU3ZYuStPpFNXf9w+AGYcTmLyHCN_w@mail.gmail.com
Link: https://patch.msgid.link/20261123093436.48511-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/realtek/alc269.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index c9b75def6732c..95d4db2b62b92 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -8120,7 +8120,6 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
- SND_PCI_QUIRK(0x10ec, 0x111e, "Higole F9B", ALC290_FIXUP_MONO_SPEAKERS),
SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 036/742] smb: client: remove commented-out cancel_*_requests() calls
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (34 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 035/742] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 037/742] smb: client: dont fail writeback preparation if the task is dying Greg Kroah-Hartman
` (121 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paulo Alcantara, David Howells,
Namjae Jeon, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Bharath SM, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit a40b17cc9ecaaa85c3615963ec21cfed1c734340 ]
Drop these leftover commented-out calls.
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Shyam Prasad N <sprasad@microsoft.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Bharath SM <bharathsm@microsoft.com>
Stable-dep-of: 9bd8ee0c1614 ("smb: client: don't replay handle reopens inside SMB2_open()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 5a22796f2e957..5518a62549806 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -869,8 +869,6 @@ static void cifs_umount_begin(struct super_block *sb)
spin_unlock(&tcon->tc_lock);
spin_unlock(&cifs_tcp_ses_lock);
- /* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
- /* cancel_notify_requests(tcon); */
if (tcon->ses && tcon->ses->server) {
cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
wake_up_all(&tcon->ses->server->request_q);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 037/742] smb: client: dont fail writeback preparation if the task is dying
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (35 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 036/742] smb: client: remove commented-out cancel_*_requests() calls Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 038/742] smb: client: retry writeback after losing the connection, share or handle Greg Kroah-Hartman
` (120 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 29ead886deaa1344a43ab68b1ea305ea2c86c378 ]
cifs_prepare_write() may need to reopen an invalidated handle and to wait
for credits, both from the context of the task doing writeback. A dying
task gets the reopen refused at send time and the killable credit wait
interrupted, so the subrequest is failed and, as with refused sends, its
folios end writeback clean and the data is lost.
For writeback in a dying task, skip both and prepare a credit-less
subrequest capped at SMB2_MAX_BUFFER_SIZE, as already done when the
server is low on credits. It gets issued from cifswritebackd, which
reopens the handle if needed and takes a single credit when sending,
neither of which can be interrupted there. Do the same when the reopen
or credit wait fails because a fatal signal arrived meanwhile.
cifs_begin_writeback() reopens the handle too when all the writable ones
got invalidated, e.g. by a reconnect. If that fails, there is no
upload stream, so netfs ends writeback of every folio clean with no
error recorded. Take an invalidated handle as is there and leave
reopening it to cifs_prepare_write(). If there is no writable handle at
all, record -EIO for the mapping, so that the loss gets reported.
Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
[ sashal: moved cifs_writeback_dying() above cifs_prepare_write() so the new calls compile, because the earlier backport had left it after that function. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/file.c | 49 +++++++++++++++++++++++++++++-----------
2 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 68f56547ef721..c70c214ac7cc6 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1898,6 +1898,7 @@ enum cifs_find_flags {
FIND_NO_PENDING_DELETE = (1U << 2),
FIND_OPEN_FLAGS = (1U << 3),
FIND_NO_DIRECT = (1U << 4),
+ FIND_NO_REOPEN = (1U << 5),
};
#define MID_FREE 0
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 4da53f84196f1..e999d94ac44fb 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -94,6 +94,12 @@ static bool cifs_io_aborted(struct cifs_io_subrequest *subreq)
tcon->need_reconnect;
}
+static bool cifs_writeback_dying(struct netfs_io_subrequest *subreq)
+{
+ return subreq->rreq->origin == NETFS_WRITEBACK &&
+ fatal_signal_pending(current);
+}
+
/*
* Prepare a subrequest to upload to the server. We need to allocate credits
* so that we know the maximum amount of data that we can include in it.
@@ -129,12 +135,17 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
cifs_negotiate_wsize(server, cifs_sb->ctx,
tlink_tcon(req->cfile->tlink));
+ if (cifs_writeback_dying(subreq))
+ goto defer;
+
retry:
if (open_file->invalidHandle) {
rc = cifs_reopen_file(open_file, false);
if (rc < 0) {
if (rc == -EAGAIN)
goto retry;
+ if (cifs_writeback_dying(subreq))
+ goto defer;
subreq->error = rc;
return netfs_prepare_write_failed(subreq);
}
@@ -143,10 +154,17 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
rc = server->ops->wait_mtu_credits(server, wsize, &stream->sreq_max_len,
&wdata->credits);
if (rc < 0) {
+ if (cifs_writeback_dying(subreq))
+ goto defer;
subreq->error = rc;
return netfs_prepare_write_failed(subreq);
}
+ goto out;
+defer:
+ wdata->credits = (struct cifs_credits){};
+ stream->sreq_max_len = min_t(size_t, wsize, SMB2_MAX_BUFFER_SIZE);
+out:
wdata->credits.rreq_debug_id = subreq->rreq->debug_id;
wdata->credits.rreq_debug_index = subreq->debug_index;
wdata->credits.in_flight_check = 1;
@@ -167,12 +185,6 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
#endif
}
-static bool cifs_writeback_dying(struct netfs_io_subrequest *subreq)
-{
- return subreq->rreq->origin == NETFS_WRITEBACK &&
- fatal_signal_pending(current);
-}
-
/*
* Issue a subrequest to upload to the server.
*/
@@ -221,10 +233,15 @@ static void __cifs_issue_write(struct netfs_io_subrequest *subreq)
static void cifs_issue_write_worker(struct work_struct *work)
{
- struct netfs_io_subrequest *subreq;
+ struct cifs_io_subrequest *wdata;
+ struct cifsFileInfo *cfile;
- subreq = container_of(work, struct netfs_io_subrequest, work);
- __cifs_issue_write(subreq);
+ wdata = container_of(work, struct cifs_io_subrequest, subreq.work);
+ cfile = wdata->req->cfile;
+ while (cfile->invalidHandle &&
+ cifs_reopen_file(cfile, false) == -EAGAIN)
+ ;
+ __cifs_issue_write(&wdata->subreq);
}
static void cifs_issue_write(struct netfs_io_subrequest *subreq)
@@ -362,15 +379,17 @@ static void cifs_begin_writeback(struct netfs_io_request *wreq)
struct cifs_io_request *req = container_of(wreq, struct cifs_io_request, rreq);
int ret;
- ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_NO_DIRECT,
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode),
+ FIND_NO_REOPEN | FIND_NO_DIRECT,
&req->cfile);
if (ret) {
- ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_ANY,
- &req->cfile);
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode),
+ FIND_NO_REOPEN, &req->cfile);
}
if (ret) {
cifs_dbg(VFS, "%s: couldn't find writable handle: %d\n",
__func__, ret);
+ mapping_set_error(wreq->mapping, -EIO);
return;
}
@@ -2841,7 +2860,7 @@ int __cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
}
if (test_bit(CIFS_INO_TMPFILE, &cifs_inode->flags))
- find_flags &= FIND_NO_DIRECT;
+ find_flags &= FIND_NO_REOPEN | FIND_NO_DIRECT;
cifs_sb = CIFS_SB(cifs_inode);
@@ -2901,6 +2920,10 @@ int __cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
spin_unlock(&cifs_inode->open_file_lock);
if (inv_file) {
+ if (find_flags & FIND_NO_REOPEN) {
+ *ret_file = inv_file;
+ return 0;
+ }
rc = cifs_reopen_file(inv_file, false);
if (!rc) {
*ret_file = inv_file;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 038/742] smb: client: retry writeback after losing the connection, share or handle
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (36 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 037/742] smb: client: dont fail writeback preparation if the task is dying Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 039/742] smb: client: let umount -f stop waiting for reconnects on hard mounts Greg Kroah-Hartman
` (119 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 59d223256f5912263a1a8d2b5b0c5abf9542cf7d ]
Writeback still fails, dropping its data, when a write gets back an
error that only means the client lost track of the server for a while:
- -EHOSTDOWN from smb2_reconnect() when a soft mount's server stays
unreachable for longer than the reconnect wait, or from
STATUS_HOST_UNREACHABLE,
- -EREMCHG from STATUS_NETWORK_NAME_DELETED, for which the receive path
already marks the tcon for reconnect,
- -EBADF from STATUS_FILE_CLOSED or STATUS_INVALID_HANDLE, e.g. after
the server lost a durable handle,
- -ENETRESET and -ESHUTDOWN from STATUS_CONNECTION_RESET and
STATUS_REMOTE_DISCONNECT,
- any replayable error on SMB1, whose async write never retries them,
while it retries writes cut short by a reconnect forever, regardless
of soft mounts.
Reopening the handle needed by a read or write is worse:
cifs_prepare_write() and cifs_issue_read() retry cifs_reopen_file() only
on -EAGAIN, with no limit and no delay, and fail on anything else. A
server failing the reopen with a status mapped to -EAGAIN, such as
STATUS_INSUFFICIENT_RESOURCES, makes them spin forever, past umount -f
and, when netfs retries from a worker, with no signal to stop them,
while any of the errors above fails writeback right away.
Retry writeback failing with any of these, as already done for
interrupts and allocation failures, with backoff and giving up on umount
-f. On -EBADF, have the retry mark the handle invalid, so that it gets
reopened, unless it got reopened since the write was issued: a late
-EBADF would otherwise get the new handle replaced too, leaving it open
on the server along with any byte-range locks pushed to it. Subrequests
of the same request can fail -EBADF concurrently on different channels,
so record the bad reopen generation atomically (keeping the newest),
decide the invalidation under the handle lock, and have a reopen publish
its new fid before its generation so a -EBADF is attributed to the fid
that was actually sent.
When writeback finally gives up on any of these errors, record -EIO for
it instead, so that fsync(2) and close(2) don't return transient or
internal errors such as -EAGAIN or -ERESTARTSYS.
Retry reopens as the read or write needing them gets retried: as above
for writeback, otherwise per the hard and retrans mount options on
replayable errors, with backoff and giving up on umount -f. If any
channel of the session got reconnected meanwhile, retry once regardless,
as the reconnect may be what failed the reopen; the next attempt waits
for the reconnect to finish. Never retry reopens on interrupts or once
the task is dying, so that dying tasks don't spin there; for writeback,
issue the subrequest without credits instead, as done for dying tasks,
so that it gets retried from the netfs collector, where no signals are
pending.
Don't reopen for requests that predate a umount -f either, unless it is
a first attempt on a connected server, as with issuing them. Once a
reopen for writeback gives up, fail the other subrequests of the
request right away, rather than each waiting out a retry window of its
own.
Reopen handles for reads in prepare, before acquiring credits, as
already done for writes, so that reads don't hold credits across a
reopen. A read whose handle or credits went stale before it could be
sent is retried regardless of mount options, after the backoff, so that
prepare reopens and takes fresh credits; check a write's credits the
same way.
Fixes: 69c3c023af25 ("cifs: Implement netfslib hooks")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Stable-dep-of: 9bd8ee0c1614 ("smb: client: don't replay handle reopens inside SMB2_open()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 4 +
fs/smb/client/cifssmb.c | 6 +-
fs/smb/client/file.c | 207 ++++++++++++++++++++++++++++++++++-----
3 files changed, 188 insertions(+), 29 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index c70c214ac7cc6..6193340963845 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1462,6 +1462,7 @@ struct cifsFileInfo {
int count;
spinlock_t file_info_lock; /* protects four flag/count fields above */
struct mutex fh_mutex; /* prevents reopen race after dead ses*/
+ unsigned int reopens;
struct cifs_search_info srch_inf;
struct work_struct oplock_break; /* work for oplock breaks */
struct work_struct put; /* work for the final part of _put */
@@ -1487,6 +1488,8 @@ struct cifs_io_request {
struct cifsFileInfo *cfile;
pid_t pid;
int umount_aborts;
+ bool reopen_gave_up;
+ atomic_t bad_reopens; /* 0 or bad gen + 1 */
};
/* asynchronous read support */
@@ -1501,6 +1504,7 @@ struct cifs_io_subrequest {
int result;
bool have_xid;
bool replay;
+ unsigned int reopens;
unsigned int retries; /* number of retries so far */
unsigned int cur_sleep; /* time to sleep before replay */
unsigned long retry_deadline;
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 8283a7ac44c00..ae81d00fddd9d 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -1949,12 +1949,14 @@ cifs_writev_callback(struct TCP_Server_Info *server, struct mid_q_entry *mid)
break;
case MID_REQUEST_SUBMITTED:
trace_netfs_sreq(&wdata->subreq, netfs_sreq_trace_io_req_submitted);
- __set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags);
+ if (wdata->rreq->origin != NETFS_WRITEBACK)
+ __set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags);
result = -EAGAIN;
break;
case MID_RETRY_NEEDED:
trace_netfs_sreq(&wdata->subreq, netfs_sreq_trace_io_retry_needed);
- __set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags);
+ if (wdata->rreq->origin != NETFS_WRITEBACK)
+ __set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags);
result = -EAGAIN;
break;
case MID_RESPONSE_MALFORMED:
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index e999d94ac44fb..2f073088f5700 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -94,12 +94,135 @@ static bool cifs_io_aborted(struct cifs_io_subrequest *subreq)
tcon->need_reconnect;
}
+static bool cifs_writeback_transient(int rc)
+{
+ if (is_replayable_error(rc) || is_interrupt_error(rc))
+ return true;
+
+ switch (rc) {
+ case -ENOMEM:
+ case -EHOSTDOWN:
+ case -ENETRESET:
+ case -ESHUTDOWN:
+ case -EREMCHG:
+ case -EBADF:
+ return true;
+ }
+ return false;
+}
+
+static int cifs_writeback_error(struct netfs_io_subrequest *subreq, int rc)
+{
+ if (subreq->rreq->origin == NETFS_WRITEBACK &&
+ cifs_writeback_transient(rc))
+ return -EIO;
+ return rc;
+}
+
static bool cifs_writeback_dying(struct netfs_io_subrequest *subreq)
{
return subreq->rreq->origin == NETFS_WRITEBACK &&
fatal_signal_pending(current);
}
+static unsigned int cifs_ses_reconnects(struct cifs_ses *ses)
+{
+ unsigned int n = 0;
+
+ guard(spinlock)(&ses->chan_lock);
+ for (size_t i = 0; i < ses->chan_count; i++) {
+ struct TCP_Server_Info *server = ses->chans[i].server;
+
+ if (server)
+ n += READ_ONCE(server->reconnect_instance);
+ }
+ return n;
+}
+
+static bool cifs_tcon_reconnecting(struct cifs_tcon *tcon)
+{
+ struct cifs_ses *ses = tcon->ses;
+
+ if (tcon->need_reconnect)
+ return true;
+
+ guard(spinlock)(&ses->chan_lock);
+ for (size_t i = 0; i < ses->chan_count; i++) {
+ struct TCP_Server_Info *server = ses->chans[i].server;
+
+ if (server && READ_ONCE(server->tcpStatus) == CifsNeedReconnect)
+ return true;
+ }
+ return false;
+}
+
+static int cifs_reopen_file_retry(struct cifsFileInfo *cfile, bool can_flush,
+ struct cifs_io_subrequest *subreq)
+{
+ bool writeback = subreq->rreq->origin == NETFS_WRITEBACK;
+ struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
+ struct cifs_ses *ses = tcon->ses;
+ unsigned int reconnects;
+ bool free_retry = true;
+ bool retrying = false;
+ int rc;
+
+ if (writeback && READ_ONCE(subreq->req->reopen_gave_up))
+ return -EIO;
+
+ for (;;) {
+ if ((retrying && cifs_io_stopped(subreq)) ||
+ cifs_io_aborted(subreq))
+ return -EIO;
+ retrying = true;
+ reconnects = cifs_ses_reconnects(ses);
+ rc = cifs_reopen_file(cfile, can_flush);
+ if (!rc || is_interrupt_error(rc) ||
+ cifs_writeback_dying(&subreq->subreq))
+ return rc;
+ if (!is_replayable_error(rc) &&
+ !(writeback && cifs_writeback_transient(rc)))
+ return rc;
+ if (free_retry && !cifs_io_stopped(subreq) &&
+ (cifs_ses_reconnects(ses) != reconnects ||
+ cifs_tcon_reconnecting(tcon))) {
+ free_retry = false;
+ continue;
+ }
+ if (!cifs_io_should_replay(subreq)) {
+ if (writeback)
+ WRITE_ONCE(subreq->req->reopen_gave_up, true);
+ return rc;
+ }
+ msleep(subreq->cur_sleep);
+ }
+}
+
+/*
+ * Record, as generation + 1 (0 means none), the newest reopen generation of a
+ * handle that a writeback subrequest found bad (-EBADF). Subrequests of the
+ * same request can fail concurrently on different channels, so keep the newest.
+ */
+static void cifs_mark_bad_handle(struct cifs_io_request *req, unsigned int gen)
+{
+ int cur = atomic_read(&req->bad_reopens);
+ int want = gen + 1;
+
+ while (want > cur && !atomic_try_cmpxchg(&req->bad_reopens, &cur, want))
+ ;
+}
+
+static void cifs_invalidate_bad_handle(struct cifs_io_request *req)
+{
+ struct cifsFileInfo *cfile = req->cfile;
+ unsigned int bad;
+
+ guard(mutex)(&cfile->fh_mutex);
+ bad = atomic_read(&req->bad_reopens);
+ if (bad && bad - 1 == cfile->reopens)
+ cfile->invalidHandle = true;
+}
+
/*
* Prepare a subrequest to upload to the server. We need to allocate credits
* so that we know the maximum amount of data that we can include in it.
@@ -138,15 +261,16 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
if (cifs_writeback_dying(subreq))
goto defer;
-retry:
+ cifs_invalidate_bad_handle(req);
+
if (open_file->invalidHandle) {
- rc = cifs_reopen_file(open_file, false);
+ rc = cifs_reopen_file_retry(open_file, false, wdata);
if (rc < 0) {
- if (rc == -EAGAIN)
- goto retry;
- if (cifs_writeback_dying(subreq))
+ if (subreq->rreq->origin == NETFS_WRITEBACK &&
+ (is_interrupt_error(rc) ||
+ fatal_signal_pending(current)))
goto defer;
- subreq->error = rc;
+ subreq->error = cifs_writeback_error(subreq, rc);
return netfs_prepare_write_failed(subreq);
}
}
@@ -156,7 +280,7 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
if (rc < 0) {
if (cifs_writeback_dying(subreq))
goto defer;
- subreq->error = rc;
+ subreq->error = cifs_writeback_error(subreq, rc);
return netfs_prepare_write_failed(subreq);
}
goto out;
@@ -208,13 +332,18 @@ static void __cifs_issue_write(struct netfs_io_subrequest *subreq)
if (rc)
goto fail;
- rc = -EAGAIN;
- if (wdata->req->cfile->invalidHandle)
- goto fail;
-
if (wdata->replay && wdata->cur_sleep)
msleep(wdata->cur_sleep);
+ rc = -EAGAIN;
+ if (wdata->req->cfile->invalidHandle ||
+ (wdata->credits.value &&
+ wdata->credits.instance !=
+ READ_ONCE(wdata->server->reconnect_instance)))
+ goto fail;
+
+ /* pairs with smp_store_release() in cifs_reopen_file() */
+ wdata->reopens = smp_load_acquire(&wdata->req->cfile->reopens);
wdata->server->ops->async_writev(wdata);
out:
return;
@@ -235,12 +364,19 @@ static void cifs_issue_write_worker(struct work_struct *work)
{
struct cifs_io_subrequest *wdata;
struct cifsFileInfo *cfile;
+ int rc = 0;
wdata = container_of(work, struct cifs_io_subrequest, subreq.work);
cfile = wdata->req->cfile;
- while (cfile->invalidHandle &&
- cifs_reopen_file(cfile, false) == -EAGAIN)
- ;
+ cifs_invalidate_bad_handle(wdata->req);
+ if (cfile->invalidHandle)
+ rc = cifs_reopen_file_retry(cfile, false, wdata);
+ if (rc) {
+ add_credits_and_wake_if(wdata->server, &wdata->credits, 0);
+ cifs_write_subrequest_terminated(wdata,
+ cifs_writeback_error(&wdata->subreq, rc));
+ return;
+ }
__cifs_issue_write(&wdata->subreq);
}
@@ -289,6 +425,12 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
cifs_negotiate_rsize(server, cifs_sb->ctx,
tlink_tcon(req->cfile->tlink));
+ if (req->cfile->invalidHandle) {
+ rc = cifs_reopen_file_retry(req->cfile, true, rdata);
+ if (rc)
+ return rc;
+ }
+
rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
&size, &rdata->credits);
if (rc)
@@ -341,29 +483,32 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq)
rc = adjust_credits(server, rdata, cifs_trace_rw_credits_issue_read_adjust);
if (rc)
- goto failed;
+ goto not_sent;
- if (req->cfile->invalidHandle) {
- do {
- rc = cifs_reopen_file(req->cfile, true);
- } while (rc == -EAGAIN);
- if (rc)
- goto failed;
- }
+ if (rdata->replay && rdata->cur_sleep)
+ msleep(rdata->cur_sleep);
+
+ rc = -EAGAIN;
+ if (req->cfile->invalidHandle ||
+ (rdata->credits.value &&
+ rdata->credits.instance != READ_ONCE(server->reconnect_instance)))
+ goto not_sent;
if (subreq->rreq->origin != NETFS_UNBUFFERED_READ &&
subreq->rreq->origin != NETFS_DIO_READ)
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
- if (rdata->replay && rdata->cur_sleep)
- msleep(rdata->cur_sleep);
-
trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
rc = rdata->server->ops->async_readv(rdata);
if (rc)
goto failed;
return;
+not_sent:
+ if (rc == -EAGAIN) {
+ trace_netfs_sreq(subreq, netfs_sreq_trace_retry);
+ __set_bit(NETFS_SREQ_NEED_RETRY, &subreq->flags);
+ }
failed:
add_credits_and_wake_if(rdata->server, &rdata->credits, 0);
subreq->error = rc;
@@ -1541,6 +1686,8 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
reopen_success:
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+ /* pairs with smp_load_acquire() in __cifs_issue_write() */
+ smp_store_release(&cfile->reopens, cfile->reopens + 1);
cfile->invalidHandle = false;
mutex_unlock(&cfile->fh_mutex);
cinode = CIFS_I(inode);
@@ -2759,14 +2906,20 @@ void cifs_write_subrequest_terminated(struct cifs_io_subrequest *wdata, ssize_t
spin_unlock(&inode->i_lock);
}
- if ((is_interrupt_error(result) || result == -ENOMEM) &&
- wreq->origin == NETFS_WRITEBACK && cifs_io_should_replay(wdata)) {
+ if (wreq->origin == NETFS_WRITEBACK &&
+ !test_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags) &&
+ cifs_writeback_transient(result) && cifs_io_should_replay(wdata)) {
+ if (result == -EBADF)
+ cifs_mark_bad_handle(wdata->req, wdata->reopens);
wdata->replay = true;
trace_netfs_sreq(&wdata->subreq,
netfs_sreq_trace_io_retry_needed);
__set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags);
}
+ if (result < 0 &&
+ !test_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags))
+ result = cifs_writeback_error(&wdata->subreq, result);
netfs_write_subrequest_terminated(&wdata->subreq, result);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 039/742] smb: client: let umount -f stop waiting for reconnects on hard mounts
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (37 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 038/742] smb: client: retry writeback after losing the connection, share or handle Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 040/742] smb: client: dont replay handle reopens inside SMB2_open() Greg Kroah-Hartman
` (118 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Paulo Alcantara, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit f8ea398448ce4adf32493649ab6665ab1f858d10 ]
Requests waiting in smb2_reconnect() or cifs_reconnect_tcon() for a
reconnect wait for as long as it takes on hard mounts. With the server
gone, writeback stuck there keeps umount -f hanging in sync_filesystem()
while it waits for that writeback, even though retries of reads and
writes started before it now give up.
Count umount -f attempts per tcon and stop waiting for reconnects, as on
soft mounts, once one is made after the request started waiting, waking
up such requests on all channels right away. Do this for the master
tcon and for the per-user tcons of a multiuser mount, skipping tcons
another mount still uses. Count the references mounts hold on a tcon
for that, rather than relying on tc_count, which internal references
such as a reconnect worker also raise: one per tlink in a superblock's
tree, dropped when the tlink leaves it, and decide under the tree lock so
that pruning or building a tlink can't skew it. Have a handle reopen
started before umount -f stop short of a reconnect it would otherwise
wait for afterwards, and have a retried read check for umount -f again
after backing off. Requests started after umount -f are unaffected.
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Stable-dep-of: 9bd8ee0c1614 ("smb: client: don't replay handle reopens inside SMB2_open()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsfs.c | 115 ++++++++++++++++++++++++++++----------
fs/smb/client/cifsglob.h | 8 +++
fs/smb/client/cifsproto.h | 4 +-
fs/smb/client/cifssmb.c | 9 ++-
fs/smb/client/connect.c | 69 +++++++++++++++++++----
fs/smb/client/file.c | 35 ++++++++++--
fs/smb/client/misc.c | 16 +++++-
fs/smb/client/smb2pdu.c | 9 ++-
8 files changed, 211 insertions(+), 54 deletions(-)
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 5518a62549806..b912717668f4b 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -295,6 +295,64 @@ cifs_read_super(struct super_block *sb)
return rc;
}
+struct cifs_tcon_ref {
+ struct list_head list;
+ struct tcon_link *tlink;
+ struct cifs_tcon *tcon;
+ bool shared;
+};
+
+static bool used_by_other_mounts(struct cifs_tcon *tcon,
+ struct list_head *tcons)
+{
+ struct cifs_tcon_ref *ref;
+ int n = 0;
+
+ list_for_each_entry(ref, tcons, list)
+ n += ref->tcon == tcon;
+
+ guard(spinlock)(&tcon->tc_lock);
+ return tcon->mnt_refs - tcon->mnt_unlinked > n;
+}
+
+static void get_sb_tcons(struct cifs_sb_info *cifs_sb, struct list_head *tcons)
+{
+ struct rb_root *root = &cifs_sb->tlink_tree;
+ struct cifs_tcon_ref *ref;
+ struct tcon_link *tlink;
+ struct cifs_tcon *tcon;
+ struct rb_node *node;
+
+ guard(spinlock)(&cifs_sb->tlink_tree_lock);
+ for (node = rb_first(root); node; node = rb_next(node)) {
+ tlink = rb_entry(node, struct tcon_link, tl_rbnode);
+ tcon = tlink_tcon(tlink);
+ if (IS_ERR_OR_NULL(tcon))
+ continue;
+
+ ref = kmalloc_obj(struct cifs_tcon_ref, GFP_ATOMIC);
+ if (!ref)
+ break;
+
+ ref->tlink = cifs_get_tlink(tlink);
+ ref->tcon = tcon;
+ list_add_tail(&ref->list, tcons);
+ }
+ list_for_each_entry(ref, tcons, list)
+ ref->shared = used_by_other_mounts(ref->tcon, tcons);
+}
+
+static void put_sb_tcons(struct list_head *tcons)
+{
+ struct cifs_tcon_ref *ref, *tmp;
+
+ list_for_each_entry_safe(ref, tmp, tcons, list) {
+ cifs_put_tlink(ref->tlink);
+ list_del(&ref->list);
+ kfree(ref);
+ }
+}
+
static void cifs_kill_sb(struct super_block *sb)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -839,47 +897,46 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
return 0;
}
+static void abort_reconnect(struct cifs_tcon *tcon)
+{
+ scoped_guard(spinlock, &tcon->tc_lock)
+ trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
+ netfs_trace_tcon_ref_see_umount);
+
+ atomic_inc(&tcon->umount_aborts);
+ if (tcon->ses && tcon->ses->server) {
+ cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
+ cifs_wake_ses_waiters(tcon->ses);
+ msleep(1); /* yield */
+ /* we have to kick the requests once more */
+ cifs_wake_ses_waiters(tcon->ses);
+ msleep(1);
+ }
+}
+
static void cifs_umount_begin(struct super_block *sb)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
- struct cifs_tcon *tcon;
+ struct cifs_tcon_ref *ref;
+ LIST_HEAD(tcons);
if (cifs_sb == NULL)
return;
atomic_inc(&cifs_sb->umount_aborts);
- tcon = cifs_sb_master_tcon(cifs_sb);
- spin_lock(&cifs_tcp_ses_lock);
- spin_lock(&tcon->tc_lock);
- trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
- netfs_trace_tcon_ref_see_umount);
- if ((tcon->tc_count > 1) || (tcon->status == TID_EXITING)) {
- /* we have other mounts to same share or we have
- already tried to umount this and woken up
- all waiting network requests, nothing to do */
- spin_unlock(&tcon->tc_lock);
- spin_unlock(&cifs_tcp_ses_lock);
- return;
- }
/*
- * can not set tcon->status to TID_EXITING yet since we don't know if umount -f will
- * fail later (e.g. due to open files). TID_EXITING will be set just before tdis req sent
+ * Abort the reconnect waits of the master tcon and of any per-user
+ * tcons of a multiuser mount that no other mount uses, pinning their
+ * tlinks so that they stay alive, and aren't pruned, while we abort and
+ * sleep outside the tree lock.
*/
- spin_unlock(&tcon->tc_lock);
- spin_unlock(&cifs_tcp_ses_lock);
-
- if (tcon->ses && tcon->ses->server) {
- cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
- wake_up_all(&tcon->ses->server->request_q);
- wake_up_all(&tcon->ses->server->response_q);
- msleep(1); /* yield */
- /* we have to kick the requests once more */
- wake_up_all(&tcon->ses->server->response_q);
- msleep(1);
+ get_sb_tcons(cifs_sb, &tcons);
+ list_for_each_entry(ref, &tcons, list) {
+ if (!ref->shared)
+ abort_reconnect(ref->tcon);
}
-
- return;
+ put_sb_tcons(&tcons);
}
static int cifs_freeze(struct super_block *sb)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 6193340963845..219f991fe435a 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1199,6 +1199,9 @@ struct cifs_tcon {
struct list_head tcon_list;
int debug_id; /* Debugging for tracing */
int tc_count;
+ int mnt_refs; /* refs held by mounts, under tc_lock */
+ int mnt_unlinked; /* mnt_refs of tlinks being built */
+ atomic_t umount_aborts; /* nr of umount -f attempts */
struct list_head rlist; /* reconnect list */
spinlock_t tc_lock; /* protect anything here that is not protected */
atomic_t num_local_opens; /* num of all opens including disconnected */
@@ -2386,6 +2389,11 @@ static inline void cifs_reset_oplock(struct cifsInodeInfo *cinode)
WRITE_ONCE(cinode->oplock, 0);
}
+static inline bool cifs_tcon_retry(struct cifs_tcon *tcon, int aborts)
+{
+ return tcon->retry && atomic_read(&tcon->umount_aborts) == aborts;
+}
+
static inline bool cifs_forced_shutdown(const struct cifs_sb_info *sbi)
{
return cifs_sb_flags(sbi) & CIFS_MOUNT_SHUTDOWN;
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index 5b41af529955f..515ca0698d4ab 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -440,7 +440,9 @@ static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)
return options;
}
-int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry);
+void cifs_wake_ses_waiters(struct cifs_ses *ses);
+int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server,
+ struct cifs_tcon *tcon, int aborts);
static inline void cifs_put_smb_ses(struct cifs_ses *ses)
{
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index ae81d00fddd9d..ff9bf20088b12 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -73,6 +73,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
{
struct TCP_Server_Info *server;
struct cifs_ses *ses;
+ int aborts;
int rc;
/*
@@ -83,6 +84,8 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
if (!tcon)
return 0;
+ aborts = atomic_read(&tcon->umount_aborts);
+
ses = tcon->ses;
server = ses->server;
@@ -102,7 +105,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
spin_unlock(&tcon->tc_lock);
again:
- rc = cifs_wait_for_server_reconnect(server, tcon->retry);
+ rc = cifs_wait_for_server_reconnect(server, tcon, aborts);
if (rc)
return rc;
@@ -127,7 +130,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
case CifsNeedReconnect:
spin_unlock(&server->srv_lock);
mutex_unlock(&ses->session_mutex);
- if (!tcon->retry)
+ if (!cifs_tcon_retry(tcon, aborts))
return -EHOSTDOWN;
goto again;
default:
@@ -159,7 +162,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
rc = cifs_negotiate_protocol(0, ses, server);
if (rc) {
mutex_unlock(&ses->session_mutex);
- if (!tcon->retry)
+ if (!cifs_tcon_retry(tcon, aborts))
return -EHOSTDOWN;
goto again;
}
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 1878a880e1662..9c41515044473 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2591,7 +2591,8 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
}
static struct cifs_tcon *
-cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
+cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx,
+ bool unlinked)
{
struct cifs_tcon *tcon;
@@ -2603,6 +2604,8 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
continue;
}
++tcon->tc_count;
+ ++tcon->mnt_refs;
+ tcon->mnt_unlinked += unlinked;
trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
netfs_trace_tcon_ref_get_find);
spin_unlock(&tcon->tc_lock);
@@ -2676,10 +2679,44 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
#endif
}
+void cifs_wake_ses_waiters(struct cifs_ses *ses)
+{
+ guard(spinlock)(&ses->chan_lock);
+ for (size_t i = 0; i < ses->chan_count; i++) {
+ struct TCP_Server_Info *server = ses->chans[i].server;
+
+ if (!server)
+ continue;
+ wake_up_all(&server->request_q);
+ wake_up_all(&server->response_q);
+ }
+}
+
+static void drop_mnt_ref(struct cifs_tcon *tcon)
+{
+ guard(spinlock)(&tcon->tc_lock);
+ tcon->mnt_refs--;
+}
+
+static void put_mnt_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
+{
+ drop_mnt_ref(tcon);
+ cifs_put_tcon(tcon, trace);
+}
+
+static void erase_tlink(struct cifs_sb_info *cifs_sb, struct tcon_link *tlink)
+{
+ clear_bit(TCON_LINK_IN_TREE, &tlink->tl_flags);
+ rb_erase(&tlink->tl_rbnode, &cifs_sb->tlink_tree);
+ if (!IS_ERR(tlink_tcon(tlink)))
+ drop_mnt_ref(tlink_tcon(tlink));
+}
+
/**
* cifs_get_tcon - get a tcon matching @ctx data from @ses
* @ses: smb session to issue the request on
* @ctx: the superblock configuration context to use for building the
+ * @unlinked: the mount reference is for a tlink not yet in a superblock's tree
*
* - tcon refcount is the number of mount points using the tcon.
* - ses refcount is the number of tcon using the session.
@@ -2699,13 +2736,13 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
* decrement the ses refcount.
*/
static struct cifs_tcon *
-cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
+cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx, bool unlinked)
{
struct cifs_tcon *tcon;
bool nohandlecache;
int rc, xid;
- tcon = cifs_find_tcon(ses, ctx);
+ tcon = cifs_find_tcon(ses, ctx, unlinked);
if (tcon) {
/*
* tcon has refcount already incremented but we need to
@@ -2731,6 +2768,8 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
rc = -ENOMEM;
goto out_fail;
}
+ tcon->mnt_refs = 1;
+ tcon->mnt_unlinked = unlinked;
tcon->nohandlecache = nohandlecache;
if (ctx->snapshot_time) {
@@ -3558,7 +3597,7 @@ void cifs_mount_put_conns(struct cifs_mount_ctx *mnt_ctx)
int rc = 0;
if (mnt_ctx->tcon)
- cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx);
+ put_mnt_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx);
else if (mnt_ctx->ses)
cifs_put_smb_ses(mnt_ctx->ses);
else if (mnt_ctx->server)
@@ -3638,7 +3677,7 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)
cifs_sb = mnt_ctx->cifs_sb;
/* search for existing tcon to this server share */
- tcon = cifs_get_tcon(mnt_ctx->ses, ctx);
+ tcon = cifs_get_tcon(mnt_ctx->ses, ctx, false);
if (IS_ERR(tcon)) {
rc = PTR_ERR(tcon);
tcon = NULL;
@@ -4014,8 +4053,7 @@ cifs_umount(struct cifs_sb_info *cifs_sb)
while ((node = rb_first(root))) {
tlink = rb_entry(node, struct tcon_link, tl_rbnode);
cifs_get_tlink(tlink);
- clear_bit(TCON_LINK_IN_TREE, &tlink->tl_flags);
- rb_erase(node, root);
+ erase_tlink(cifs_sb, tlink);
spin_unlock(&cifs_sb->tlink_tree_lock);
cifs_put_tlink(tlink);
@@ -4305,7 +4343,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
}
#endif
- tcon = cifs_get_tcon(ses, ctx);
+ tcon = cifs_get_tcon(ses, ctx, true);
if (IS_ERR(tcon)) {
cifs_put_smb_ses(ses);
goto out;
@@ -4408,6 +4446,7 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
{
struct tcon_link *tlink, *newtlink;
kuid_t fsuid = current_fsuid();
+ struct cifs_tcon *tcon;
int err;
if (!(cifs_sb_flags(cifs_sb) & CIFS_MOUNT_MULTIUSER))
@@ -4465,7 +4504,16 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
goto wait_for_construction;
}
- tlink->tl_tcon = cifs_construct_tcon(cifs_sb, fsuid);
+ tcon = cifs_construct_tcon(cifs_sb, fsuid);
+ scoped_guard(spinlock, &cifs_sb->tlink_tree_lock) {
+ tlink->tl_tcon = tcon;
+ if (!IS_ERR(tcon)) {
+ scoped_guard(spinlock, &tcon->tc_lock)
+ tcon->mnt_unlinked--;
+ if (!test_bit(TCON_LINK_IN_TREE, &tlink->tl_flags))
+ drop_mnt_ref(tcon);
+ }
+ }
clear_bit(TCON_LINK_PENDING, &tlink->tl_flags);
wake_up_bit(&tlink->tl_flags, TCON_LINK_PENDING);
@@ -4514,8 +4562,7 @@ cifs_prune_tlinks(struct work_struct *work)
continue;
cifs_get_tlink(tlink);
- clear_bit(TCON_LINK_IN_TREE, &tlink->tl_flags);
- rb_erase(tmp, root);
+ erase_tlink(cifs_sb, tlink);
spin_unlock(&cifs_sb->tlink_tree_lock);
cifs_put_tlink(tlink);
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 2f073088f5700..ac2fd53e27f2e 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -485,8 +485,12 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq)
if (rc)
goto not_sent;
- if (rdata->replay && rdata->cur_sleep)
+ if (rdata->replay && rdata->cur_sleep) {
msleep(rdata->cur_sleep);
+ rc = -EIO;
+ if (cifs_io_aborted(rdata))
+ goto failed;
+ }
rc = -EAGAIN;
if (req->cfile->invalidHandle ||
@@ -1549,6 +1553,16 @@ cifs_relock_file(struct cifsFileInfo *cfile)
return rc;
}
+static bool reopen_aborted(struct cifs_tcon *tcon, int aborts)
+{
+ struct TCP_Server_Info *server;
+
+ if (atomic_read(&tcon->umount_aborts) == aborts)
+ return false;
+ server = cifs_pick_channel(tcon->ses);
+ return server && READ_ONCE(server->tcpStatus) == CifsNeedReconnect;
+}
+
static int
cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
{
@@ -1567,7 +1581,10 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
int create_options = CREATE_NOT_DIR;
struct cifs_open_parms oparms;
int rdwr_for_fscache = 0;
+ int aborts;
+ tcon = tlink_tcon(cfile->tlink);
+ aborts = atomic_read(&tcon->umount_aborts);
xid = get_xid();
mutex_lock(&cfile->fh_mutex);
if (!cfile->invalidHandle) {
@@ -1575,10 +1592,14 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
free_xid(xid);
return 0;
}
+ if (reopen_aborted(tcon, aborts)) {
+ mutex_unlock(&cfile->fh_mutex);
+ free_xid(xid);
+ return -EHOSTDOWN;
+ }
inode = d_inode(cfile->dentry);
cifs_sb = CIFS_SB(inode->i_sb);
- tcon = tlink_tcon(cfile->tlink);
server = tcon->ses->server;
/*
@@ -1660,10 +1681,16 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
* version of file size can be stale. If we knew for sure that inode was
* not dirty locally we could do this.
*/
- rc = server->ops->open(xid, &oparms, &oplock, NULL);
+ if (reopen_aborted(tcon, aborts))
+ rc = -EHOSTDOWN;
+ else
+ rc = server->ops->open(xid, &oparms, &oplock, NULL);
if (rc == -ENOENT && oparms.reconnect == false) {
/* durable handle timeout is expired - open the file again */
- rc = server->ops->open(xid, &oparms, &oplock, NULL);
+ if (reopen_aborted(tcon, aborts))
+ rc = -EHOSTDOWN;
+ else
+ rc = server->ops->open(xid, &oparms, &oplock, NULL);
/* indicate that we need to relock the file */
oparms.reconnect = true;
}
diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c
index 05168284f2051..71a233adade31 100644
--- a/fs/smb/client/misc.c
+++ b/fs/smb/client/misc.c
@@ -1075,7 +1075,15 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid,
}
#endif
-int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry)
+static bool reco_wait_done(struct TCP_Server_Info *server,
+ struct cifs_tcon *tcon, int aborts)
+{
+ return server->tcpStatus != CifsNeedReconnect ||
+ atomic_read(&tcon->umount_aborts) != aborts;
+}
+
+int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server,
+ struct cifs_tcon *tcon, int aborts)
{
int timeout = 10;
int rc;
@@ -1098,7 +1106,9 @@ int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry)
*/
do {
rc = wait_event_interruptible_timeout(server->response_q,
- (server->tcpStatus != CifsNeedReconnect),
+ reco_wait_done(server,
+ tcon,
+ aborts),
timeout * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to received signal\n",
@@ -1113,7 +1123,7 @@ int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry)
return 0;
}
spin_unlock(&server->srv_lock);
- } while (retry);
+ } while (cifs_tcon_retry(tcon, aborts));
cifs_dbg(FYI, "%s: gave up waiting on reconnect\n", __func__);
return -EHOSTDOWN;
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 3c7e42a47a5ae..679ab668051cb 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -253,6 +253,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
bool hold_server_ref = false;
struct cifs_ses *ses;
int rc = 0;
+ int aborts;
int xid;
/*
@@ -263,6 +264,8 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
if (tcon == NULL)
return 0;
+ aborts = atomic_read(&tcon->umount_aborts);
+
if (smb2_command == SMB2_TREE_CONNECT)
return 0;
@@ -319,7 +322,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
spin_unlock(&server->srv_lock);
again:
- rc = cifs_wait_for_server_reconnect(server, tcon->retry);
+ rc = cifs_wait_for_server_reconnect(server, tcon, aborts);
if (rc)
return rc;
@@ -347,7 +350,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
case CifsNeedReconnect:
spin_unlock(&server->srv_lock);
mutex_unlock(&ses->session_mutex);
- if (!tcon->retry)
+ if (!cifs_tcon_retry(tcon, aborts))
return -EHOSTDOWN;
goto again;
default:
@@ -378,7 +381,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
rc = cifs_negotiate_protocol(0, ses, server);
if (rc) {
mutex_unlock(&ses->session_mutex);
- if (!tcon->retry)
+ if (!cifs_tcon_retry(tcon, aborts))
return -EHOSTDOWN;
goto again;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 040/742] smb: client: dont replay handle reopens inside SMB2_open()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (38 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 039/742] smb: client: let umount -f stop waiting for reconnects on hard mounts Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 041/742] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
` (117 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Paulo Alcantara, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 9bd8ee0c16146a3d0a401b39dc4cb1a84144c956 ]
cifs_reopen_file_retry() reopens a read's or write's handle with backoff,
per the hard and retrans mount options, giving up on umount -f. It calls
cifs_reopen_file() -> SMB2_open(), which replays replayable errors on its
own, also per hard and retrans. So each reopen is retried at both
layers: up to (retrans + 1)^2 opens on a soft mount, and, on a hard
mount, forever inside SMB2_open() without ever returning to
cifs_reopen_file_retry() to notice umount -f - a worker doing writeback
then can't be stopped.
Have cifs_reopen_file_retry() tell SMB2_open() not to replay, so these
reopens are bounded and stopped only by cifs_reopen_file_retry(). Other
callers of cifs_reopen_file() keep SMB2_open()'s replay; SMB1 opens are
unchanged.
A reopen reconnects the durable handle or, if the server lost it, opens
the file afresh. Without SMB2_open()'s loop, a retry must open afresh
again rather than reconnect, which the server would reject, and replay
its last create, with the same GUID and access and keeping its access
fallbacks, if that create may have been processed, or it leaks or loses
a handle. Track both on the open file under fh_mutex, so concurrent
reopens agree: replay only after a create that SMB2_open() built and
that failed with no answer from the server, or only a retryable one to
its replay, and leave the state alone after an attempt that was
interrupted or never built.
SMB2_open()'s own loop retried a failed durable reconnect as a fresh open
with a stale GUID, and smb2_open_file()'s retry without
FILE_READ_ATTRIBUTES as a fresh open, skipping the relock; have both
reissue the same create, only replay a create that was built, and don't
leave SMB2_open()'s own replay state behind for the caller's next create.
Fixes: 69c3c023af25 ("cifs: Implement netfslib hooks")
Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
Fixes: 79520587fe42 ("cifs: update the same create_guid on replay")
Fixes: e255612b5ed9 ("cifs: Add fallback for SMB2 CREATE without FILE_READ_ATTRIBUTES")
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 5 +++++
fs/smb/client/file.c | 45 ++++++++++++++++++++++++++++++----------
fs/smb/client/smb2file.c | 18 +++++++++++-----
fs/smb/client/smb2pdu.c | 45 +++++++++++++++++++++++++++++++++-------
4 files changed, 89 insertions(+), 24 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 219f991fe435a..db0e9fc14fb28 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1414,6 +1414,8 @@ struct cifs_open_parms {
umode_t mode;
bool reconnect:1;
bool replay:1; /* indicates that this open is for a replay */
+ bool no_replay:1; /* don't replay this open internally */
+ bool pending:1; /* in/out: last built create had no answer */
struct kvec *ea_cctx;
__le32 lease_flags;
};
@@ -1466,6 +1468,9 @@ struct cifsFileInfo {
spinlock_t file_info_lock; /* protects four flag/count fields above */
struct mutex fh_mutex; /* prevents reopen race after dead ses*/
unsigned int reopens;
+ bool reopen_fresh; /* durable handle gone: reopen opens afresh */
+ bool reopen_replay; /* reopen replays its last create */
+ int reopen_access; /* desired access of that create */
struct cifs_search_info srch_inf;
struct work_struct oplock_break; /* work for oplock breaks */
struct work_struct put; /* work for the final part of _put */
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index ac2fd53e27f2e..f2ab7618034e8 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -37,7 +37,11 @@
#include "cached_dir.h"
#include <trace/events/netfs.h>
-static int cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush);
+/* flags for cifs_reopen_file() */
+#define CIFS_REOPEN_BOUND BIT(0) /* caller bounds the retries */
+
+static int cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush,
+ unsigned int flags);
bool cifs_io_stopped(struct cifs_io_subrequest *subreq)
{
@@ -176,7 +180,7 @@ static int cifs_reopen_file_retry(struct cifsFileInfo *cfile, bool can_flush,
return -EIO;
retrying = true;
reconnects = cifs_ses_reconnects(ses);
- rc = cifs_reopen_file(cfile, can_flush);
+ rc = cifs_reopen_file(cfile, can_flush, CIFS_REOPEN_BOUND);
if (!rc || is_interrupt_error(rc) ||
cifs_writeback_dying(&subreq->subreq))
return rc;
@@ -1564,7 +1568,7 @@ static bool reopen_aborted(struct cifs_tcon *tcon, int aborts)
}
static int
-cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush, unsigned int flags)
{
int rc = -EACCES;
unsigned int xid;
@@ -1582,6 +1586,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
struct cifs_open_parms oparms;
int rdwr_for_fscache = 0;
int aborts;
+ bool fresh;
tcon = tlink_tcon(cfile->tlink);
aborts = atomic_read(&tcon->umount_aborts);
@@ -1655,6 +1660,10 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
if (cifs_fscache_enabled(inode) && (cfile->f_flags & O_ACCMODE) == O_WRONLY)
rdwr_for_fscache = 1;
+ if (cfile->reopen_replay && rdwr_for_fscache == 1 &&
+ !(cfile->reopen_access & GENERIC_READ))
+ rdwr_for_fscache = 2;
+
desired_access = cifs_convert_flags(cfile->f_flags, rdwr_for_fscache);
create_options |= cifs_open_create_options(cfile->f_flags,
create_options);
@@ -1663,15 +1672,20 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
server->ops->get_lease_key(inode, &cfile->fid);
retry_open:
+ fresh = cfile->reopen_fresh;
oparms = (struct cifs_open_parms) {
.tcon = tcon,
.cifs_sb = cifs_sb,
- .desired_access = desired_access,
+ .desired_access = cfile->reopen_replay ?
+ cfile->reopen_access : desired_access,
.create_options = cifs_create_options(cifs_sb, create_options),
.disposition = disposition,
.path = full_path,
.fid = &cfile->fid,
- .reconnect = true,
+ .reconnect = !fresh,
+ .replay = cfile->reopen_replay,
+ .pending = cfile->reopen_replay,
+ .no_replay = !!(flags & CIFS_REOPEN_BOUND),
};
/*
@@ -1685,16 +1699,24 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
rc = -EHOSTDOWN;
else
rc = server->ops->open(xid, &oparms, &oplock, NULL);
- if (rc == -ENOENT && oparms.reconnect == false) {
+ if (rc == -ENOENT && !fresh && !oparms.reconnect && !oparms.pending) {
/* durable handle timeout is expired - open the file again */
+ fresh = true;
+ oparms.desired_access = desired_access;
+ oparms.replay = false;
if (reopen_aborted(tcon, aborts))
rc = -EHOSTDOWN;
else
rc = server->ops->open(xid, &oparms, &oplock, NULL);
- /* indicate that we need to relock the file */
- oparms.reconnect = true;
}
- if (rc == -EACCES && rdwr_for_fscache == 1) {
+ cfile->reopen_fresh = rc && fresh;
+ cfile->reopen_replay = rc && oparms.pending;
+ if (cfile->reopen_replay)
+ cfile->reopen_access = oparms.desired_access;
+ /* indicate that we need to relock the file */
+ if (fresh)
+ oparms.reconnect = true;
+ if (rc == -EACCES && rdwr_for_fscache == 1 && !oparms.pending) {
desired_access = cifs_convert_flags(cfile->f_flags, 0);
rdwr_for_fscache = 2;
goto retry_open;
@@ -1874,7 +1896,8 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
spin_unlock(&tcon->open_file_lock);
list_for_each_entry_safe(open_file, tmp, &tmp_list, rlist) {
- if (cifs_reopen_file(open_file, false /* do not flush */))
+ /* do not flush */
+ if (cifs_reopen_file(open_file, false, 0))
tcon->need_reopen_files = true;
list_del_init(&open_file->rlist);
cifsFileInfo_put(open_file);
@@ -3104,7 +3127,7 @@ int __cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
*ret_file = inv_file;
return 0;
}
- rc = cifs_reopen_file(inv_file, false);
+ rc = cifs_reopen_file(inv_file, false, 0);
if (!rc) {
*ret_file = inv_file;
return 0;
diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
index fb2fccbe86677..764cfd894ad09 100644
--- a/fs/smb/client/smb2file.c
+++ b/fs/smb/client/smb2file.c
@@ -175,6 +175,7 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
struct cifs_fid *fid = oparms->fid;
struct network_resiliency_req nr_ioctl_req;
bool retry_without_read_attributes = false;
+ bool reconnect = oparms->reconnect;
smb2_path = cifs_convert_path_to_utf16(oparms->path, oparms->cifs_sb);
if (smb2_path == NULL)
@@ -186,23 +187,30 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
* FILE_READ_ATTRIBUTES when not needed and prevent calling code path
* for retry_without_read_attributes.
*/
- if (!(oparms->desired_access & FILE_READ_ATTRIBUTES) &&
- !(oparms->desired_access & GENERIC_READ) &&
+ if (!(oparms->desired_access & GENERIC_READ) &&
!(oparms->desired_access & GENERIC_EXECUTE) &&
!(oparms->desired_access & GENERIC_ALL) &&
!(oparms->desired_access & MAXIMUM_ALLOWED)) {
- oparms->desired_access |= FILE_READ_ATTRIBUTES;
- retry_without_read_attributes = true;
+ if (oparms->replay) {
+ retry_without_read_attributes =
+ oparms->desired_access & FILE_READ_ATTRIBUTES;
+ } else if (!(oparms->desired_access & FILE_READ_ATTRIBUTES)) {
+ oparms->desired_access |= FILE_READ_ATTRIBUTES;
+ retry_without_read_attributes = true;
+ }
}
smb2_oplock = SMB2_OPLOCK_LEVEL_BATCH;
rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, data, NULL, &err_iov,
&err_buftype);
- if (rc == -EACCES && retry_without_read_attributes) {
+ if (rc == -EACCES && retry_without_read_attributes &&
+ !oparms->pending) {
free_rsp_buf(err_buftype, err_iov.iov_base);
memset(&err_iov, 0, sizeof(err_iov));
err_buftype = CIFS_NO_BUFFER;
oparms->desired_access &= ~FILE_READ_ATTRIBUTES;
+ oparms->reconnect = reconnect;
+ oparms->replay = false;
rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, data, NULL, &err_iov,
&err_buftype);
}
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 679ab668051cb..4fd6fe8f6d742 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3363,14 +3363,25 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
int flags = 0;
int retries = 0, cur_sleep = 0;
struct smb2_file_all_info *file_info = buf ? &buf->fi : NULL;
+ bool reconnect = oparms->reconnect;
+ bool replay = oparms->replay;
+ bool unanswered = replay;
+ bool answered;
+ bool sent;
replay_again:
/* reinitialize for possible replay */
+ answered = false;
+ sent = false;
resp_buftype = CIFS_NO_BUFFER;
memset(&rsp_iov, 0, sizeof(rsp_iov));
flags = 0;
server = cifs_pick_channel(ses);
- oparms->replay = !!(retries);
+ /* reissue the same create: a durable reconnect clears ->reconnect */
+ oparms->reconnect = reconnect;
+ /* with no_replay the caller owns oparms->replay */
+ if (!oparms->no_replay)
+ oparms->replay = unanswered;
cifs_dbg(FYI, "create/open\n");
if (!ses || !server)
@@ -3388,21 +3399,22 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
&rqst, oplock, oparms, path);
if (rc)
goto creat_exit;
+ sent = true;
trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path,
oparms->create_options, oparms->desired_access);
- if (retries) {
- /* Back-off before retry */
- if (cur_sleep)
- msleep(cur_sleep);
+ /* Back-off before retry */
+ if (cur_sleep)
+ msleep(cur_sleep);
+ if (oparms->replay)
smb2_set_replay(server, &rqst);
- }
rc = cifs_send_recv(xid, ses, server,
&rqst, &resp_buftype, flags,
&rsp_iov);
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
+ answered = rsp;
if (rc != 0) {
cifs_stats_fail_inc(tcon, SMB2_CREATE_HE);
@@ -3459,10 +3471,27 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
SMB2_open_free(&rqst);
free_rsp_buf(resp_buftype, rsp);
- if (is_replayable_error(rc) &&
- smb2_should_replay(tcon, &retries, &cur_sleep))
+ if (sent) {
+ if (!rc || (answered && (!oparms->replay ||
+ !is_replayable_error(rc))))
+ unanswered = false;
+ else if (!answered && !is_interrupt_error(rc))
+ unanswered = true;
+ oparms->pending = unanswered;
+ }
+
+ if (!oparms->no_replay && is_replayable_error(rc) &&
+ smb2_should_replay(tcon, &retries, &cur_sleep)) {
+ if (err_iov && answered && !rsp) {
+ free_rsp_buf(*buftype, err_iov->iov_base);
+ *err_iov = (struct kvec){};
+ *buftype = CIFS_NO_BUFFER;
+ }
goto replay_again;
+ }
+ if (!oparms->no_replay)
+ oparms->replay = replay;
return rc;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 041/742] w1: w1_therm: lock the list of slaves for the bulk read
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (39 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 040/742] smb: client: dont replay handle reopens inside SMB2_open() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 042/742] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
` (116 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 1e46334d38e0217f5d255dc6fd63243593052f8e ]
The callbacks of the file therm_bulk_read walk the list of the slaves of
the master, trigger_bulk_read() three times and therm_bulk_read_show()
once, without the list_mutex which protects it. In the meantime the
thread of the master may find out that a sensor has gone:
write to therm_bulk_read w1_process()
trigger_bulk_read() w1_slave_detach()
list_for_each_entry(sl, ...) w1_unref_slave()
bulk_read_slave(sl) list_del()
w1_therm_remove_slave()
kfree(sl->family_data)
kfree(sl)
SLAVE_CONVERT_TRIGGERED(sl) = 1
The walk reads, and writes to, memory which has been freed, and follows
the poisoned list pointers.
Take list_mutex around each of the four walks. No pointer to a slave is
kept from one walk to the next.
This could not be done as long as w1_unref_slave() held the mutex while
it waited, in w1_therm_remove_slave(), for these very callbacks and for
the readers of the sensor, who need the bus_mutex which
trigger_bulk_read() holds around its second walk. Now nothing is waited
for with list_mutex held, and none of the other mutexes of the subsystem
is taken under it, so it can be nested inside bus_mutex.
Fixes: 57c76221d5af ("w1_therm: adding bulk read support to trigger multiple conversion on bus")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-w1-v1-8-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/w1/slaves/w1_therm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index fed45ad4e4e78..d8751b29f4205 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1508,6 +1508,7 @@ static int trigger_bulk_read(struct w1_master *dev_master)
* and compute duration of conversion for these devices
* so we can apply a strong pullup if required
*/
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl)) {
int t_cur = conversion_time(sl);
@@ -1519,6 +1520,7 @@ static int trigger_bulk_read(struct w1_master *dev_master)
w1_strong_pullup));
}
}
+ mutex_unlock(&dev_master->list_mutex);
/*
* t_conv is the max conversion time required on the bus
@@ -1545,11 +1547,13 @@ static int trigger_bulk_read(struct w1_master *dev_master)
w1_write_8(dev_master, W1_CONVERT_TEMP);
/* set a flag to instruct that converT pending */
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl,
&dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = -1;
}
+ mutex_unlock(&dev_master->list_mutex);
if (strong_pullup) { /* some device need pullup */
sleep_rem = msleep_interruptible(t_conv);
@@ -1575,10 +1579,12 @@ static int trigger_bulk_read(struct w1_master *dev_master)
mutex_unlock(&dev_master->bus_mutex);
set_flag:
/* set a flag to register convsersion is done */
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = 1;
}
+ mutex_unlock(&dev_master->list_mutex);
error:
return ret;
}
@@ -1943,6 +1949,7 @@ static ssize_t therm_bulk_read_show(struct device *device,
struct w1_slave *sl = NULL;
int ret = 0;
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl)) {
if (SLAVE_CONVERT_TRIGGERED(sl) == -1) {
@@ -1955,6 +1962,7 @@ static ssize_t therm_bulk_read_show(struct device *device,
}
}
show_result:
+ mutex_unlock(&dev_master->list_mutex);
return sprintf(buf, "%d\n", ret);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 042/742] ipvs: read flags and seqs in master atomically
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (40 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 041/742] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 043/742] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
` (115 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <ja@ssi.bg>
[ Upstream commit aa9afc79f57ba5ef4385aa85cfb7dd50d5c484f6 ]
After we fixed the double read of cp->flags in the master with
commit 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Sashiko reports that we should also read the cp->flags and the seqs
atomically. So if the SEQ_MASK is set, re-read the flags and the
seqs under cp->lock to provide a snapshot when sending the sync
message.
Fixes: 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260927220816.268206-1-pablo%40netfilter.org
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/ipvs/ip_vs_sync.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 1a30817fbbafe..05096de1cc956 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -539,6 +539,7 @@ static int ip_vs_sync_conn_needed(struct netns_ipvs *ipvs,
static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
int pkts)
{
+ struct ip_vs_sync_conn_options opts;
struct ip_vs_sync_mesg_v0 *m;
struct ip_vs_sync_conn_v0 *s;
struct ip_vs_sync_buff *buff;
@@ -557,6 +558,14 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
return;
+ if (flags & IP_VS_CONN_F_SEQ_MASK) {
+ /* Take atomic snapshot of flags and seqs */
+ spin_lock_bh(&cp->lock);
+ flags = cp->flags;
+ memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+ spin_unlock_bh(&cp->lock);
+ }
+
spin_lock_bh(&ipvs->sync_buff_lock);
if (!(ipvs->sync_state & IP_VS_STATE_MASTER)) {
spin_unlock_bh(&ipvs->sync_buff_lock);
@@ -604,7 +613,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
if (seq_mask) {
struct ip_vs_sync_conn_options *opt =
(struct ip_vs_sync_conn_options *)&s[1];
- memcpy(opt, &cp->sync_conn_opt, sizeof(*opt));
+ memcpy(opt, &opts, sizeof(*opt));
}
m->nr_conns++;
@@ -630,6 +639,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
*/
void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
{
+ struct ip_vs_sync_conn_options opts;
struct ip_vs_sync_mesg *m;
union ip_vs_sync_conn *s;
struct ip_vs_sync_buff *buff;
@@ -651,6 +661,13 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
goto control;
flags = READ_ONCE(cp->flags);
+ if (flags & IP_VS_CONN_F_SEQ_MASK) {
+ /* Take atomic snapshot of flags and seqs */
+ spin_lock_bh(&cp->lock);
+ flags = cp->flags;
+ memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+ spin_unlock_bh(&cp->lock);
+ }
/* Sanity checks */
pe_name_len = 0;
@@ -752,9 +769,9 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
if (seq_mask) {
*(p++) = IPVS_OPT_SEQ_DATA;
*(p++) = sizeof(struct ip_vs_sync_conn_options);
- hton_seq(&cp->in_seq, (struct ip_vs_seq *)p);
+ hton_seq(&opts.in_seq, (struct ip_vs_seq *)p);
p += sizeof(struct ip_vs_seq);
- hton_seq(&cp->out_seq, (struct ip_vs_seq *)p);
+ hton_seq(&opts.out_seq, (struct ip_vs_seq *)p);
p += sizeof(struct ip_vs_seq);
}
/* Handle pe data */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 043/742] ipvs: honor the overload state and do not enter it forever
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (41 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 042/742] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 044/742] btrfs: fix the fsverity callback where unexpected range is verified Greg Kroah-Hartman
` (114 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <ja@ssi.bg>
[ Upstream commit 567ca80d77baf4c9ab635865375956084c8bb52a ]
Sashiko warns that we may enter the dest overload state forever
if setting the u_threshold to 1 races with the ip_vs_unbind_dest()
call for the last connection for dest. The problem is that we
prefer ip_vs_unbind_dest() to avoid using locks while reading the
threshold.
To avoid the race, add a smp_mb() in __ip_vs_dest_update_overload()
that is paired with the atomic_fetch_dec() in ip_vs_unbind_dest()
which allows to re-read the totalconns and to leave the overload
state if we are below l_threshold_val.
Also, remove the overload parameter from ip_vs_dest_update_overload()
because we just need to know the current state while deciding
which threshold ranges to use. This ip_vs_dest_is_overloaded() check
can be in __ip_vs_dest_update_overload() instead.
To avoid ip_vs_bind_dest() to enter lock just to initialize
u_threshold_val to INT_MAX, do it in ip_vs_new_dest().
The LBLC and LBLCR schedulers do not honor the global overload state
for cached dests, so add a ip_vs_dest_is_overloaded() check for
the situations where we may fallback from overloaded dest (LBLC and
LBLCR) or when we hit a cached dest (LBLC).
Also, move the ip_vs_dest_set_min() call in LBLCR after the
ip_vs_dest_set_erase() call that removes the most-loaded
server because due to races we may work with dest that is
in process of removing, i.e. ip_vs_dest_set_min() and
ip_vs_dest_set_max() may return same dest.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019150249.1879516-2-pablo%40netfilter.org
Fixes: 3ba20137287f ("ipvs: fix more races around the overload flag")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 4 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 30 ++++++++++++++++++------------
net/netfilter/ipvs/ip_vs_lblc.c | 8 +++++---
net/netfilter/ipvs/ip_vs_lblcr.c | 13 +++++++------
5 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a83bff32569d..53d680ba8790f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1923,7 +1923,7 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
kfree(dest);
}
-void ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload);
+void ip_vs_dest_update_overload(struct ip_vs_dest *dest);
/* Check if dest is in overloaded state */
static inline bool ip_vs_dest_is_overloaded(const struct ip_vs_dest *dest)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 94f25fb7d87e4..6998872634345 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1154,7 +1154,7 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
atomic_inc(&dest->activeconns);
tc = atomic_inc_return(&dest->totalconns);
if (tc >= READ_ONCE(dest->u_threshold_val))
- ip_vs_dest_update_overload(dest, true);
+ ip_vs_dest_update_overload(dest);
} else {
/* It is a persistent connection/template, so increase
the persistent connection counter */
@@ -1247,7 +1247,7 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
atomic_dec(&dest->activeconns);
tc = atomic_fetch_dec(&dest->totalconns);
if (tc <= READ_ONCE(dest->l_threshold_val))
- ip_vs_dest_update_overload(dest, false);
+ ip_vs_dest_update_overload(dest);
} else {
/* It is a persistent connection/template, so decrease
the persistent connection counter */
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 3003547dcabe5..2d005d3cd2de7 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1304,12 +1304,12 @@ void ip_vs_stats_free(struct ip_vs_stats *stats)
}
}
-/* Update overload flag based on number of dest conns and lower/upper
+/* Update overload state based on number of dest conns and lower/upper
* connection thresholds:
- * - conns reach u_threshold and exceed it: set the flag
- * - conns go below l_threshold (or 75% of u_threshold): clear the flag
+ * - conns reach u_threshold and exceed it: set the overload state
+ * - conns go below l_threshold (or 75% of u_threshold): clear the state
*/
-static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
+static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest)
{
int conns;
u32 l, u;
@@ -1320,10 +1320,18 @@ static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
/* Low threshold defaults to 75% of upper threshold */
l = READ_ONCE(dest->l_threshold) ? : (u - (u >> 2));
conns = atomic_read(&dest->totalconns);
- if (conns >= (overload ? l : u)) {
+ if (conns >= (ip_vs_dest_is_overloaded(dest) ? l : u)) {
WRITE_ONCE(dest->u_threshold_val, INT_MAX);
WRITE_ONCE(dest->l_threshold_val, l);
- return;
+ /* Commit thresholds before repeating the check,
+ * it is paired with atomic_fetch_dec() in
+ * ip_vs_unbind_dest() to avoid entering the
+ * overload state forever.
+ */
+ smp_mb();
+ conns = atomic_read(&dest->totalconns);
+ if (conns >= l)
+ return;
}
}
@@ -1331,10 +1339,10 @@ static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
WRITE_ONCE(dest->l_threshold_val, 0);
}
-void ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
+void ip_vs_dest_update_overload(struct ip_vs_dest *dest)
{
spin_lock_bh(&dest->dst_lock);
- __ip_vs_dest_update_overload(dest, overload);
+ __ip_vs_dest_update_overload(dest);
spin_unlock_bh(&dest->dst_lock);
}
@@ -1406,13 +1414,10 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
if (READ_ONCE(dest->u_threshold) != udest->u_threshold ||
READ_ONCE(dest->l_threshold) != udest->l_threshold) {
- bool overload;
-
spin_lock_bh(&dest->dst_lock);
WRITE_ONCE(dest->u_threshold, udest->u_threshold);
WRITE_ONCE(dest->l_threshold, udest->l_threshold);
- overload = ip_vs_dest_is_overloaded(dest);
- __ip_vs_dest_update_overload(dest, overload);
+ __ip_vs_dest_update_overload(dest);
spin_unlock_bh(&dest->dst_lock);
}
@@ -1477,6 +1482,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
if (ret < 0)
goto err_stats;
+ dest->u_threshold_val = INT_MAX;
dest->af = udest->af;
dest->protocol = svc->protocol;
dest->vaddr = svc->addr;
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index e1111c3b27211..f5ce1f2afb860 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -467,10 +467,11 @@ is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
struct ip_vs_dest *d;
list_for_each_entry_rcu(d, &svc->destinations, n_list) {
- if (atomic_read(&d->activeconns)*2
- < atomic_read(&d->weight)) {
+ if (ip_vs_dest_is_overloaded(d))
+ continue;
+ if (atomic_read(&d->activeconns) * 2 <
+ atomic_read(&d->weight))
return 1;
- }
}
}
return 0;
@@ -507,6 +508,7 @@ ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
dest = en->dest;
if ((dest->cflags & IP_VS_DEST_CF_AVAILABLE) &&
+ !ip_vs_dest_is_overloaded(dest) &&
atomic_read(&dest->weight) > 0 && !is_overloaded(dest, svc))
goto out;
}
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index dfb5bf83750db..4046608922e7c 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -630,10 +630,11 @@ is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
struct ip_vs_dest *d;
list_for_each_entry_rcu(d, &svc->destinations, n_list) {
- if (atomic_read(&d->activeconns)*2
- < atomic_read(&d->weight)) {
+ if (ip_vs_dest_is_overloaded(d))
+ continue;
+ if (atomic_read(&d->activeconns) * 2 <
+ atomic_read(&d->weight))
return 1;
- }
}
}
return 0;
@@ -658,9 +659,6 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
if (en) {
en->lastuse = jiffies;
- /* Get the least loaded destination */
- dest = ip_vs_dest_set_min(&en->set);
-
/* More than one destination + enough time passed by, cleanup */
if (atomic_read(&en->set.size) > 1 &&
time_after(jiffies, en->set.lastmod +
@@ -676,6 +674,9 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
spin_unlock_bh(&svc->sched_lock);
}
+ /* Get the least loaded destination */
+ dest = ip_vs_dest_set_min(&en->set);
+
/* If the destination is not overloaded, use it */
if (dest && !is_overloaded(dest, svc))
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 044/742] btrfs: fix the fsverity callback where unexpected range is verified
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (42 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 043/742] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 045/742] usb: xhci: fix typos in comments Greg Kroah-Hartman
` (113 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Roger Alasà, Eric Biggers,
Tito Duarte, Qu Wenruo, David Sterba, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <wqu@suse.com>
[ Upstream commit 254e15591ee4590064e0c55285cdcb4f4519133c ]
[BUG]
There is a bug report that on v7.2 kernel, compressed extents with
fsverity enabled can lead to warnings like the following:
fs-verity (dm-3, inode 257): FILE CORRUPTED! pos=7471104, level=-1, want_hash=sha256:bedf0e7bc93b48694db719001a8d3e79229cc58ee638b41d4149193505090774, real_hash=sha256:ad7facb2586fc6e966c004d7d1d16b024f5805ff7cb47c7a85dabd8b48892ca7
The read itself eventually succeeds, and no read error is returned to
user space.
[CAUSE]
Since v7.2 btrfs has enabled large data folio support, now a folio can
contain multiple blocks even if the page size matches the fs block size.
And even before that, btrfs already has block size < page size support,
thus all involved code should assume a folio can contain multiple
blocks.
However the function btrfs_verify_folio() calls fsverity_verify_folio(),
which verifies the whole folio, even if the read range only covers part
of the folio.
This forces fsverity to verify garbage data that is not yet read from
disk, and causes verification failure.
This is a long-standing bug, but previously it only affected bs < ps
cases which is not that common.
Now with the large folio support, it's much easier to trigger with bs ==
ps cases.
[FIX]
Instead of calling fsverity_verify_folio(), call
fsverity_verify_blocks() to verify only the read range.
Reported-by: Roger Alasà <vonbloom@gmail.com>
Link: https://lore.kernel.org/linux-btrfs/CAELqY9==Ter2XQPRp=gjW5T75T+7kcZCXpn5roF2L6tY6mQNxw@mail.gmail.com/
Fixes: 146054090b08 ("btrfs: initial fsverity support")
Tested-by: Roger Alasà <vonbloom@gmail.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Tested-by: Tito Duarte <duartito@gmail.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/extent_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index d7600e5fa3d95..fe4c87dc61ba8 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -504,7 +504,7 @@ static bool btrfs_verify_folio(struct fsverity_info *vi, struct folio *folio,
if (!vi || btrfs_folio_test_uptodate(fs_info, folio, start, len))
return true;
- return fsverity_verify_folio(vi, folio);
+ return fsverity_verify_blocks(vi, folio, len, offset_in_folio(folio, start));
}
static void end_folio_read(struct fsverity_info *vi, struct folio *folio,
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 045/742] usb: xhci: fix typos in comments
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (43 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 044/742] btrfs: fix the fsverity callback where unexpected range is verified Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 046/742] xhci: give back TDs and clean up ep0 after disconnect Greg Kroah-Hartman
` (112 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zain Aboobacker, Mathias Nyman,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zain Aboobacker <zainaboobacker33@gmail.com>
[ Upstream commit d7458590f585aea58f24047195f163adc6ecb045 ]
Fix various spelling mistakes in comments found by codespell.
Assisted-by: Claude:claude-opus-5-5 codespell
Signed-off-by: Zain Aboobacker <zainaboobacker33@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20261009151624.618967-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 6895dbdc19d9 ("xhci: give back TDs and clean up ep0 after disconnect")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/host/xhci-ring.c | 14 +++++++-------
drivers/usb/host/xhci.c | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index fffd901b59e7f..aedb2af01e2f7 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -243,7 +243,7 @@ static void inc_enq_past_link(struct xhci_hcd *xhci, struct xhci_ring *ring, u32
* fixed in the 0.96 specification errata, but we have to assume that all 0.95
* xHCI hardware can't handle the chain bit being cleared on a link TRB.
*
- * On 0.95 and some 0.96 HCs the chain bit is set once at segment initalization
+ * On 0.95 and some 0.96 HCs the chain bit is set once at segment initialization
* and never changed here. On all others, modify it as requested by the caller.
*/
if (!xhci_link_chain_quirk(xhci, ring->type)) {
@@ -661,7 +661,7 @@ struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
* Get the hw dequeue pointer xHC stopped on, either directly from the
* endpoint context, or if streams are in use from the stream context.
* The returned hw_dequeue contains the lowest four bits with cycle state
- * and possbile stream context type.
+ * and possible stream context type.
*/
static u64 xhci_get_hw_deq(struct xhci_hcd *xhci, struct xhci_virt_device *vdev,
unsigned int ep_index, unsigned int stream_id)
@@ -989,7 +989,7 @@ static int xhci_handle_halted_endpoint(struct xhci_hcd *xhci,
int err;
/*
- * Avoid resetting endpoint if link is inactive or device disonnected.
+ * Avoid resetting endpoint if link is inactive or device disconnected.
* Can cause host hang.
* Device will be reset to recover an inactive link, so don't do anything
*/
@@ -1384,7 +1384,7 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
* held for the URBs to finish during device disconnect, blocking host remove.
*
* Call with xhci->lock held.
- * lock is relased and re-acquired while giving back urb.
+ * lock is released and re-acquired while giving back urb.
*/
void xhci_hc_died(struct xhci_hcd *xhci)
{
@@ -1969,7 +1969,7 @@ static void handle_device_notification(struct xhci_hcd *xhci,
}
/*
- * Quirk hanlder for errata seen on Cavium ThunderX2 processor XHCI
+ * Quirk handler for errata seen on Cavium ThunderX2 processor XHCI
* Controller.
* As per ThunderX2errata-129 USB 2 device may come up as USB 1
* If a connection to a USB 1 device is followed by another connection
@@ -3087,7 +3087,7 @@ static void xhci_clear_interrupt_pending(struct xhci_interrupter *ir)
/*
* Handle all OS-owned events on an interrupter event ring. It may drop
- * and reaquire xhci->lock between event processing.
+ * and reacquire xhci->lock between event processing.
*/
static int xhci_handle_events(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
bool skip_events)
@@ -3798,7 +3798,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
/*
* If next available TRB is the Link TRB in the ring segment then
* enqueue a No Op TRB, this can prevent the Setup and Data Stage
- * TRB to be breaked by the Link TRB.
+ * TRB to be broken by the Link TRB.
*/
if (last_trb_on_seg(ep_ring->enq_seg, ep_ring->enqueue + 1)) {
field = TRB_TYPE(TRB_TR_NOOP) | ep_ring->cycle_state;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ec9ae4e15b5b8..d6dc696b385ac 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -406,7 +406,7 @@ static void compliance_mode_recovery(struct timer_list *t)
* The quirk creates a timer that polls every 2 seconds the link state of
* each host controller's port and recovers it by issuing a Warm reset
* if Compliance mode is detected, otherwise the port will become "dead" (no
- * device connections or disconnections will be detected anymore). Becasue no
+ * device connections or disconnections will be detected anymore). Because no
* status event is generated when entering compliance mode (per xhci spec),
* this quirk is needed on systems that have the failing hardware installed.
*/
@@ -796,7 +796,7 @@ static void xhci_save_registers(struct xhci_hcd *xhci)
xhci->s3.config_reg = readl(&xhci->op_regs->config_reg);
/* save both primary and all secondary interrupters */
- /* fixme, shold we lock to prevent race with remove secondary interrupter? */
+ /* fixme, should we lock to prevent race with remove secondary interrupter? */
for (i = 0; i < xhci->max_interrupters; i++) {
ir = xhci->interrupters[i];
if (!ir)
@@ -2047,7 +2047,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
/*
* Configuration and alternate setting changes must be done in
- * process context, not interrupt context (or so documenation
+ * process context, not interrupt context (or so documentation
* for usb_set_interface() and usb_set_configuration() claim).
*/
if (xhci_endpoint_init(xhci, virt_dev, udev, ep, GFP_NOIO) < 0) {
@@ -3303,7 +3303,7 @@ static void xhci_endpoint_disable(struct usb_hcd *hcd,
* state. For software that wishes to reset the data toggle or sequence number
* of an endpoint that isn't in the halted state this function will issue a
* configure endpoint command with the Drop and Add bits set for the target
- * endpoint. Refer to the additional note in xhci spcification section 4.6.8.
+ * endpoint. Refer to the additional note in xhci specification section 4.6.8.
*
* vdev may be lost due to xHC restore error and re-initialization during S3/S4
* resume. A new vdev will be allocated later by xhci_discover_or_reset_device()
@@ -4297,7 +4297,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
pm_runtime_get_noresume(hcd->self.controller);
/* Is this a LS or FS device under a HS hub? */
- /* Hub or peripherial? */
+ /* Hub or peripheral? */
return 1;
disable_slot:
@@ -4516,7 +4516,7 @@ static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev)
/*
* Transfer the port index into real index in the HW port status
- * registers. Caculate offset between the port's PORTSC register
+ * registers. Calculate offset between the port's PORTSC register
* and port status base. Divide the number of per port register
* to get the real index. The raw port number bases 1.
*/
@@ -5398,7 +5398,7 @@ static void xhci_hcd_init_usb3_data(struct xhci_hcd *xhci, struct usb_hcd *hcd)
/*
* Early xHCI 1.1 spec did not mention USB 3.1 capable hosts
* should return 0x31 for sbrn, or that the minor revision
- * is a two digit BCD containig minor and sub-minor numbers.
+ * is a two digit BCD containing minor and sub-minor numbers.
* This was later clarified in xHCI 1.2.
*
* Some USB 3.1 capable hosts therefore have sbrn 0x30, and
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 046/742] xhci: give back TDs and clean up ep0 after disconnect
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (44 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 045/742] usb: xhci: fix typos in comments Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 047/742] xhci: keep port link_inactive and connected flags in sync when polled Greg Kroah-Hartman
` (111 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Yiyu Zhou, Dennis Wissel,
Mathias Nyman, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiyu Zhou <yiyu@yiyuzhou.io>
[ Upstream commit 6895dbdc19d927a2872bd4f111e1911874d5dce4 ]
Fix a regression in v7.3 introduced by the commits in the Fixes tags.
Those patches avoid endpoint recovery and rapid state changes after
the root port link is lost.
This caused a regression in device enumeration.
It turns out that a subset of USB HID devices briefly disconnect during
enumeration. USB core manages to resuscitate these devices without
reallocating them, and thus continue using the same udev, xhci vdev and
default control endpoint (ep0) of the device.
xhci didn't give back or clean up halted TDs behind disconnected ports
as it assumed that the disconnect cancels all URBs, and drops and frees
all endpoints.
This is not the case, so cancel and give back TDs on halted endpoint
behind disconnected ports, make sure ep0 is cleared and in a proper state
to continue working even after a link error or disconnect is detected.
Also prevent new URBs until device is reset.
One issue related to the TDs not being given back was seen on a PFU
HHKB Professional HYBRID Type-S keyboard (04fe:0021).
It drops off the bus about 300 ms after its first enumeration, while
usbhid is still probing its third interface. The probe runs in hub_wq,
so the disconnect is not handled until the probe returns.
On a root port the HID descriptor request and its four retries in
hid_get_class_descriptor() each wait for the full 5 second
USB_CTRL_GET_TIMEOUT:
[57685.006036] usb 3-2: new full-speed USB device number 24 using xhci_hcd
...
[57685.291304] hid-generic 0003:04FE:0021.0017: input,hidraw1: USB HID v1.11 Keyboard [PFU Limited HHKB-Hybrid] on usb-0000:00:14.0-2/input1
[57711.221083] usbhid 3-2:1.2: can't add hid device: -110
[57711.221613] usbhid 3-2:1.2: probe with driver usbhid failed with error -110
[57711.221842] usb 3-2: USB disconnect, device number 24
[mn: merge EP_DROP_PENDING and link_inactive checks in xhci_urb_enqueue(),
return TDs and clean up ep0 on disconnect, rewrite commit message]
Fixes: 042aad8d0db6 ("xhci: prevent endpoint recovery after roothub disconnect")
Fixes: 7e0ef4332ed9 ("xhci: avoid xHC endpoint changes after disconnect or link error.")
Cc: stable <stable@kernel.org>
Closes: https://lore.kernel.org/all/20261010071811.20483-1-yiyu@yiyuzhou.io/
Closes: https://lore.kernel.org/linux-usb/4MjB9K-2SoiA85WbI9iEig@dsine.de/
Tested-by: Yiyu Zhou <yiyu@yiyuzhou.io>
Tested-by: Dennis Wissel <dennis@dsine.de>
Signed-off-by: Yiyu Zhou <yiyu@yiyuzhou.io>
Co-developed-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20261029204324.658845-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/host/xhci-ring.c | 73 ++++++++++++++++++++++++++++++------
drivers/usb/host/xhci.c | 13 ++++---
2 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index aedb2af01e2f7..2a8585581aa8a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -65,6 +65,7 @@
static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
u32 field1, u32 field2,
u32 field3, u32 field4, bool command_must_succeed);
+static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci, int slot_id, int ep_index);
/*
* Returns zero if the TRB isn't in this segment, otherwise it returns the DMA
@@ -955,6 +956,24 @@ static void xhci_giveback_invalidated_tds(struct xhci_hcd *xhci, struct xhci_vir
}
}
+static void xhci_cancel_ring_tds(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,
+ struct xhci_ring *ring, int td_status)
+{
+ struct xhci_td *tmp_td;
+ struct xhci_td *td;
+
+ /* Add all TDs on ring to cancelled td list */
+ list_for_each_entry_safe(td, tmp_td, &ring->td_list, td_list) {
+ if (list_empty(&td->cancelled_td_list)) {
+ list_add_tail(&td->cancelled_td_list,
+ &ep->cancelled_td_list);
+ td->cancel_status = TD_DIRTY;
+ if (!td->status)
+ td->status = td_status;
+ }
+ }
+}
+
static int xhci_reset_halted_ep(struct xhci_hcd *xhci, unsigned int slot_id,
unsigned int ep_index, enum xhci_ep_reset_type reset_type)
{
@@ -986,25 +1005,53 @@ static int xhci_handle_halted_endpoint(struct xhci_hcd *xhci,
{
struct xhci_port *rhub_port = ep->vdev->rhub_port;
unsigned int slot_id = ep->vdev->slot_id;
+ bool disconnected = false;
+ struct xhci_ring *ring;
int err;
- /*
- * Avoid resetting endpoint if link is inactive or device disconnected.
- * Can cause host hang.
- * Device will be reset to recover an inactive link, so don't do anything
- */
+ /* link is inactive or device disconnected */
if (rhub_port->link_inactive || !rhub_port->connected) {
ep->ep_state |= EP_DROP_PENDING;
- return -ENODEV;
+ disconnected = true;
+ if (!td && ep->ep_index != 0) {
+ xhci_kill_endpoint_urbs(xhci, slot_id, ep->ep_index);
+ return -ENODEV;
+ }
}
- /* add td to cancelled list and let reset ep handler take care of it */
- if (reset_type == EP_HARD_RESET) {
- ep->ep_state |= EP_HARD_CLEAR_TOGGLE;
+ /* Add halted td to cancelled list and let reset ep handler take care of it */
+ if (reset_type == EP_HARD_RESET || disconnected) {
if (td && list_empty(&td->cancelled_td_list)) {
list_add_tail(&td->cancelled_td_list, &ep->cancelled_td_list);
td->cancel_status = TD_HALTED;
+ if (disconnected && !td->status)
+ td->status = -EPROTO;
+ }
+ }
+
+ /*
+ * Avoid resetting non-ep0 endpoints if link is inactive or device
+ * disconnected. Can cause host hang.
+ * Endpoints other than ep0 won't restart before the device is reset or
+ * the endpoint is dropped, so cancel all TDs, and give back non-ep0 TDs
+ * now instead of letting them time out. Ep0 can survive a short device
+ * disconnect during enumeration so reset ep0 normally and clean it up.
+ */
+ if (disconnected) {
+ ring = td ? xhci_urb_to_transfer_ring(xhci, td->urb) : ep->ring;
+ xhci_cancel_ring_tds(xhci, ep, ring, -ESHUTDOWN);
+ if (ep->ep_index != 0) {
+ xhci_dbg(xhci, "Not resetting ep %u slot %u after disconnect\n",
+ ep->ep_index, slot_id);
+
+ xhci_process_cancelled_tds(xhci, ep);
+ xhci_kill_endpoint_urbs(xhci, slot_id, ep->ep_index);
+ return -ENODEV;
}
+ /* hard-reset a halted disconnected ep0 */
+ xhci_dbg(xhci, "Reset and clean up ep0 slot %u after disconnect\n",
+ slot_id);
+ reset_type = EP_HARD_RESET;
}
if (ep->ep_state & EP_HALTED) {
@@ -1013,6 +1060,9 @@ static int xhci_handle_halted_endpoint(struct xhci_hcd *xhci,
return 0;
}
+ if (reset_type == EP_HARD_RESET)
+ ep->ep_state |= EP_HARD_CLEAR_TOGGLE;
+
err = xhci_reset_halted_ep(xhci, slot_id, ep->ep_index, reset_type);
if (err)
return err;
@@ -1063,8 +1113,9 @@ static int xhci_invalidate_cancelled_tds(struct xhci_hcd *xhci, struct xhci_virt
continue;
}
- /* device disconnected or link error, ep will be dropped */
- if (ep->ep_state & EP_DROP_PENDING) {
+ /* device disconnected or link error, non-ep0 endpoints will be dropped */
+ if (ep->ep_state & EP_DROP_PENDING && ep->ep_index != 0) {
+ td_to_noop(xhci, ep, td, false);
td->cancel_status = TD_CLEARED;
continue;
}
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d6dc696b385ac..c5000b82b1078 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1666,12 +1666,6 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
goto free_priv;
}
- if (xhci->devs[slot_id]->rhub_port->link_inactive) {
- xhci_dbg(xhci, "Can't queue urb, port error, link inactive\n");
- ret = -ENODEV;
- goto free_priv;
- }
-
if (xhci->xhc_state & XHCI_STATE_DYING) {
xhci_dbg(xhci, "Ep 0x%x: URB %p submitted for non-responsive xHCI host.\n",
urb->ep->desc.bEndpointAddress, urb);
@@ -1681,6 +1675,13 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
ep_state = &xhci->devs[slot_id]->eps[ep_index].ep_state;
+ if (xhci->devs[slot_id]->rhub_port->link_inactive ||
+ *ep_state & EP_DROP_PENDING) {
+ xhci_dbg(xhci, "Can't queue urb, port disconnect or link inactive\n");
+ ret = -ENODEV;
+ goto free_priv;
+ }
+
if (*ep_state & (EP_GETTING_STREAMS | EP_GETTING_NO_STREAMS)) {
xhci_warn(xhci, "WARN: Can't enqueue URB, ep in streams transition state %x\n",
*ep_state);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 047/742] xhci: keep port link_inactive and connected flags in sync when polled
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (45 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 046/742] xhci: give back TDs and clean up ep0 after disconnect Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 048/742] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
` (110 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Mathias Nyman, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <mathias.nyman@linux.intel.com>
[ Upstream commit bb261776d1a29768b8fd84eb4f42d99dafa29c93 ]
Update port 'link_inactive' and 'connected' flags even if xHC isn't
generating port change events.
xHC only generates port change events on port changes after old port
change bits are cleared. Hub driver is often kept up to date
by polling the port status.
Sashiko reported a possible case where all port changes after a port
reset take place before hub driver clears the reset change bit.
This way the port can end up connected and fully running with link
in u0 without a port event clearing the 'link_inactive' or setting
the 'connected' flags.
A protocol STALL in this state would set EP_DROP_PENDING, and
prevent all future URBs for the endpoint.
Fix this by also updating the flags during get_port_status(), when
hub driver is polling the port state.
Fixes: 6895dbdc19d9 ("xhci: give back TDs and clean up ep0 after disconnect")
Link: https://lore.kernel.org/linux-usb/sashiko-outbox-190046@kernel.org/
Cc: stable <stable@kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20261105175106.241182-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/host/xhci-hub.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 470bafe1802be..55430b673f1e9 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1166,6 +1166,12 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, struct xhci_bus_state *bus_
if (portsc & PORT_RESET)
status |= USB_PORT_STAT_RESET;
+ /* track connect and link error status when hub is polling */
+ if (!(portsc & PORT_RESET)) {
+ port->link_inactive = (portsc & PORT_PLS_MASK) == XDEV_INACTIVE;
+ port->connected = !!(portsc & PORT_CONNECT);
+ }
+
/* USB2 and USB3 specific bits, including Port Link State */
if (hcd->speed >= HCD_USB3)
xhci_get_usb3_port_status(port, &status, portsc);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 048/742] Revert "wifi: ath10k: Stop unanswered temperature reads"
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (46 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 047/742] xhci: keep port link_inactive and connected flags in sync when polled Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 049/742] tpm: Call cmd_ready/go_idle for each command transmission Greg Kroah-Hartman
` (109 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jeff Johnson
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
commit b1ed5a45b994a6473ca1cf34f35a1bf87f1d8e2a upstream.
As reported by Nicolas Escande [1] this will break some setups where
temperature reporting is supported but there are occasional requests where
there isn't a response. Revert this implementation where a single
unreported temperature read at any time will stop all future requests.
Alternate solutions are being discussed.
Link: https://lore.kernel.org/all/DMRPC2GCD51O.S4DMHZFDKRFG@gmail.com/ # [1]
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/ath/ath10k/core.c | 1 -
drivers/net/wireless/ath/ath10k/thermal.c | 9 +--------
drivers/net/wireless/ath/ath10k/thermal.h | 2 --
3 files changed, 1 insertion(+), 11 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2985,7 +2985,6 @@ int ath10k_core_start(struct ath10k *ar,
clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
ar->running_fw = fw;
- ar->thermal.broken = false;
if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
ar->running_fw->fw_file.fw_features)) {
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -75,12 +75,6 @@ static ssize_t ath10k_thermal_show_temp(
goto out;
}
- /* Don't stall every read on firmware that never answers */
- if (ar->thermal.broken) {
- ret = -EOPNOTSUPP;
- goto out;
- }
-
reinit_completion(&ar->thermal.wmi_sync);
ret = ath10k_wmi_pdev_get_temperature(ar);
if (ret) {
@@ -96,8 +90,7 @@ static ssize_t ath10k_thermal_show_temp(
time_left = wait_for_completion_timeout(&ar->thermal.wmi_sync,
ATH10K_THERMAL_SYNC_TIMEOUT_HZ);
if (!time_left) {
- ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
- ar->thermal.broken = true;
+ ath10k_warn(ar, "failed to synchronize thermal read\n");
ret = -ETIMEDOUT;
goto out;
}
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -19,8 +19,6 @@ struct ath10k_thermal {
/* protected by conf_mutex */
u32 throttle_state;
u32 quiet_period;
- /* the running firmware did not answer a temperature request */
- bool broken;
/* temperature value in Celsius degree
* protected by data_lock
*/
^ permalink raw reply [flat|nested] 159+ messages in thread* [PATCH 7.3 049/742] tpm: Call cmd_ready/go_idle for each command transmission
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (47 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 048/742] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 050/742] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale Greg Kroah-Hartman
` (108 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mario Limonciello, Jarkko Sakkinen
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <mario.limonciello@amd.com>
commit 313acd594a799d6b4b3af937eaca7bf4a1803c4a upstream.
Some TPM implementations, particularly fTPM using the CRB interface,
require the TPM to transition through idle and ready states for each
command rather than once per session.
The current implementation calls cmd_ready once during tpm_chip_start()
and go_idle once during tpm_chip_stop(). For fTPM, when multiple commands
are sent without per-command idle transitions, subsequent commands timeout
as the TPM is waiting for the transition.
Fix this by calling cmd_ready before each command and go_idle on all exit
paths in tpm_try_transmit(). For TPM implementations that don't require
per-command transitions, the callbacks return immediately based on the
start method.
Remove the now-redundant per-session calls from tpm_chip_start() and
tpm_chip_stop() along with their helpers.
This resolves timeout errors during TPM initialization on systems where
BIOS has already performed TPM startup.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260901213723.3017371-1-mario.limonciello@amd.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/tpm-chip.c | 24 ------------------------
drivers/char/tpm/tpm-interface.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 24 deletions(-)
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -66,22 +66,6 @@ static void tpm_relinquish_locality(stru
chip->locality = -1;
}
-static int tpm_cmd_ready(struct tpm_chip *chip)
-{
- if (!chip->ops->cmd_ready)
- return 0;
-
- return chip->ops->cmd_ready(chip);
-}
-
-static int tpm_go_idle(struct tpm_chip *chip)
-{
- if (!chip->ops->go_idle)
- return 0;
-
- return chip->ops->go_idle(chip);
-}
-
static void tpm_clk_enable(struct tpm_chip *chip)
{
if (chip->ops->clk_enable)
@@ -116,13 +100,6 @@ int tpm_chip_start(struct tpm_chip *chip
}
}
- ret = tpm_cmd_ready(chip);
- if (ret) {
- tpm_relinquish_locality(chip);
- tpm_clk_disable(chip);
- return ret;
- }
-
return 0;
}
EXPORT_SYMBOL_GPL(tpm_chip_start);
@@ -137,7 +114,6 @@ EXPORT_SYMBOL_GPL(tpm_chip_start);
*/
void tpm_chip_stop(struct tpm_chip *chip)
{
- tpm_go_idle(chip);
tpm_relinquish_locality(chip);
tpm_clk_disable(chip);
}
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -19,6 +19,7 @@
* calls to msleep.
*/
+#include <linux/cleanup.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/mutex.h>
@@ -89,8 +90,17 @@ static bool tpm_transmit_completed(u8 st
return status_masked == chip->ops->req_complete_val;
}
+static void tpm_go_idle(struct tpm_chip *chip)
+{
+ if (chip->ops->go_idle)
+ chip->ops->go_idle(chip);
+}
+
+DEFINE_FREE(tpm_go_idle, struct tpm_chip *, if (_T) tpm_go_idle(_T))
+
static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz)
{
+ struct tpm_chip *chip_idle __free(tpm_go_idle) = NULL;
struct tpm_header *header = buf;
int rc;
ssize_t len = 0;
@@ -113,6 +123,18 @@ static ssize_t tpm_try_transmit(struct t
return -E2BIG;
}
+ if (chip->ops->cmd_ready) {
+ rc = chip->ops->cmd_ready(chip);
+ if (rc) {
+ dev_err(&chip->dev,
+ "%s: cmd_ready(): error %d\n", __func__, rc);
+ return rc;
+ }
+ }
+
+ /* Ensure go_idle() is called on every exit path from here on. */
+ chip_idle = chip;
+
rc = chip->ops->send(chip, buf, bufsiz, count);
if (rc < 0) {
if (rc != -EPIPE)
^ permalink raw reply [flat|nested] 159+ messages in thread* [PATCH 7.3 050/742] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (48 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 049/742] tpm: Call cmd_ready/go_idle for each command transmission Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 051/742] arm64: dts: arm: corstone1000-a320: Fix GIC redistributor region size Greg Kroah-Hartman
` (107 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Geert Uytterhoeven, Sudeep Holla,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <geert+renesas@glider.be>
[ Upstream commit e637b774416775d09540070ceecf972c59070d90 ]
Not enabling any transports no longer breaks the build.
Fixes: c0397c85b53d0bc6 ("firmware: arm_scmi: Use WARN_ON() to check configured transports")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/48c4bed8036dcb55f554f513ce2ae61807c5677d.1790684637.git.geert+renesas@glider.be
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/transports/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/transports/Kconfig b/drivers/firmware/arm_scmi/transports/Kconfig
index 57eccf316e26b..66b10f511827c 100644
--- a/drivers/firmware/arm_scmi/transports/Kconfig
+++ b/drivers/firmware/arm_scmi/transports/Kconfig
@@ -5,7 +5,7 @@ config ARM_SCMI_HAVE_TRANSPORT
bool
help
This declares whether at least one SCMI transport has been configured.
- Used to trigger a build bug when trying to build SCMI without any
+ Used to trigger a runtime warning when enabling SCMI without any
configured transport.
config ARM_SCMI_HAVE_SHMEM
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 051/742] arm64: dts: arm: corstone1000-a320: Fix GIC redistributor region size
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (49 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 050/742] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 052/742] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks Greg Kroah-Hartman
` (106 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Liviu Dudau, Rob Herring (Arm),
Sudeep Holla, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <robh@kernel.org>
[ Upstream commit 5ac351938cae58c5cd1b356f9d0aae2e243c11ad ]
The Arm Corstone1000-A320 has a GICv4 which means the redistributor
region should be 4x256KB rather than 512KB. This issue didn't become
apparent as SMP was disabled as a work-around in early versions of the
FVP.
Fixes: 87599f1843d3 ("arm64: dts: arm/corstone1000: Add corstone-1000-a320")
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20261005210506.2118052-2-robh@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/arm/corstone1000-a320.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/arm/corstone1000-a320.dtsi b/arch/arm64/boot/dts/arm/corstone1000-a320.dtsi
index f0937914350c5..f895a024fc920 100644
--- a/arch/arm64/boot/dts/arm/corstone1000-a320.dtsi
+++ b/arch/arm64/boot/dts/arm/corstone1000-a320.dtsi
@@ -73,7 +73,7 @@ gic: interrupt-controller@1c000000 {
#size-cells = <1>;
interrupt-controller;
reg = <0x1c000000 0x10000>,
- <0x1c040000 0x80000>;
+ <0x1c040000 0x100000>;
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 052/742] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (50 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 051/742] arm64: dts: arm: corstone1000-a320: Fix GIC redistributor region size Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 053/742] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
` (105 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, David Cemin, Sudeep Holla,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Cemin <dcemin@nvidia.com>
[ Upstream commit 8ab2e426762d199ce8b799d029edafbfb981f5c6 ]
The notifier callbacks are kept in a hash table keyed by notification ID,
but struct notifier_cb_info does not store the ID and none of the lookup
helpers compare it. hash_for_each_possible() walks the whole bucket, so
any two IDs that hash to the same bucket are treated as the same
registration.
With the 64-bucket table, hash_32() maps IDs 2 and 36 to the same
bucket. A driver that requests notifications sequentially therefore
fails at the 37th request:
ARM FF-A: Failed to register callback for 36 - -22
because update_notifier_cb() finds the node registered for ID 2 and
rejects the new registration as a duplicate. The same lookup is used on
the delivery path, so a notification for a colliding ID can also be
dispatched to the callback registered for the other ID.
Store the notification ID in the node and compare it in all three
lookup helpers.
This was found on an arm64 laptop whose embedded controller partition
declares 38 notifications: the EC driver failed to probe and every
EC event (AC, battery, lid, hotkeys) was lost.
Fixes: e0573444edbf ("firmware: arm_ffa: Add interfaces to request notification callbacks")
Fixes: c10debfe7f02 ("firmware: arm_ffa: Add support for {un,}registration of framework notifications")
Signed-off-by: David Cemin <dcemin@nvidia.com>
Link: https://patch.msgid.link/20261020220902.611138-1-dcemin@nvidia.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_ffa/driver.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 28abc808fd32d..ae8cc3a2ba2e7 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1223,6 +1223,7 @@ struct notifier_cb_info {
ffa_fwk_notifier_cb fwk_cb;
ffa_notifier_cb cb;
void *cb_data;
+ u16 notify_id;
};
static int
@@ -1302,7 +1303,8 @@ notifier_hnode_get_by_vmid(u16 notify_id, int vmid)
struct notifier_cb_info *node;
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->fwk_cb && vmid == node->dev->vm_id)
+ if (node->notify_id == notify_id && node->fwk_cb &&
+ vmid == node->dev->vm_id)
return node;
return NULL;
@@ -1317,7 +1319,8 @@ notifier_hnode_get_by_vmid_uuid(u16 notify_id, int vmid, const uuid_t *uuid)
return notifier_hnode_get_by_vmid(notify_id, vmid);
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->fwk_cb && vmid == node->dev->vm_id &&
+ if (node->notify_id == notify_id && node->fwk_cb &&
+ vmid == node->dev->vm_id &&
uuid_equal(&node->dev->uuid, uuid))
return node;
@@ -1330,7 +1333,8 @@ notifier_hnode_get_by_type(u16 notify_id, enum notify_type type)
struct notifier_cb_info *node;
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->cb && type == ffa_notify_type_get(node->dev->vm_id))
+ if (node->notify_id == notify_id && node->cb &&
+ type == ffa_notify_type_get(node->dev->vm_id))
return node;
return NULL;
@@ -1422,6 +1426,7 @@ static int __ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
cb_info->dev = dev;
cb_info->cb_data = cb_data;
+ cb_info->notify_id = notify_id;
if (is_framework)
cb_info->fwk_cb = cb;
else
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 053/742] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (51 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 052/742] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 054/742] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64 Greg Kroah-Hartman
` (104 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Zyngier, Julian Braha,
Sudeep Holla, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Braha <julianbraha@gmail.com>
[ Upstream commit 6cc03818814aa98c3584a346b82165f1b561f2b7 ]
Add fallbacks for callers to avoid needing #ifdef guards when
HAVE_ARM_SMCCC_DISCOVERY is disabled (32-bit arm).
Fixes: 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://patch.msgid.link/20261020222817.1231643-2-julianbraha@gmail.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/arm-smccc.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index 4de81848fe2ee..75f9d3f1723b5 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -324,6 +324,7 @@ enum arm_smccc_conduit {
SMCCC_CONDUIT_HVC,
};
+#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
/**
* arm_smccc_1_1_get_conduit()
*
@@ -363,6 +364,12 @@ s32 arm_smccc_get_soc_id_version(void);
* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED.
*/
s32 arm_smccc_get_soc_id_revision(void);
+#else /* CONFIG_HAVE_ARM_SMCCC_DISCOVERY */
+#define arm_smccc_1_1_get_conduit() SMCCC_CONDUIT_NONE
+#define arm_smccc_get_version() 0
+#define arm_smccc_get_soc_id_version() SMCCC_RET_NOT_SUPPORTED
+#define arm_smccc_get_soc_id_revision() SMCCC_RET_NOT_SUPPORTED
+#endif /* CONFIG_HAVE_ARM_SMCCC_DISCOVERY */
#ifndef __ASSEMBLY__
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 054/742] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (52 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 053/742] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 055/742] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
` (103 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Zyngier, Thomas Gleixner,
Julian Braha, Sudeep Holla, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Braha <julianbraha@gmail.com>
[ Upstream commit 40b097fdfd00516ba9a568ccc10e9f166358ddca ]
ARM_PSCI_FW is always enabled for arm64, and the GICv3 driver only
uses HAVE_ARM_SMCCC_DISCOVERY to identify the NVIDIA T241, which is
arm64 anyway.
For ARM_GIC_V3, let's only select HAVE_ARM_SMCCC_DISCOVERY on arm64.
Fixes: 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4")
Suggested-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Acked-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20261020222817.1231643-3-julianbraha@gmail.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 01f8415f62fc7..0f3bbf14c8432 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -37,7 +37,7 @@ config ARM_GIC_V3
bool
select IRQ_DOMAIN_HIERARCHY
select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
- select HAVE_ARM_SMCCC_DISCOVERY
+ select HAVE_ARM_SMCCC_DISCOVERY if ARM64
select IRQ_MSI_IOMMU
config ARM_GIC_ITS_PARENT
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 055/742] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (53 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 054/742] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64 Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 056/742] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
` (102 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Torokhov, Tzung-Bi Shih,
Sean OBrien, Shashikirana H K, Benjamin Tissoires, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashikirana H K <shashikiranah@chromium.org>
[ Upstream commit 8dbf66b011135422a28ee32da1d6aacbe08ddd7a ]
Currently vivaldi_feature_mapping() passes the raw buffer returned by
hid_hw_raw_request() to hid_report_raw_event() with the descriptor-declared
report_len just to populate field->value[usage->usage_index].
Since vivaldi_feature_mapping() already has the target report, field, and
usage in hand, and nothing else consumes field->value[] for this report,
verify that hid_hw_raw_request() returns the expected report_len, ensure
usage->usage_index is within field->report_count, and extract the value
directly using hid_field_extract(). Also use __free(kfree) to simplify
buffer cleanup.
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 33bbe04a15f2 ("HID: google: extract Vivaldi hid feature mapping for use in hid-hammer")
Cc: Tzung-Bi Shih <tzungbi@chromium.org>
Cc: Sean O'Brien <seobrien@chromium.org>
Signed-off-by: Shashikirana H K <shashikiranah@chromium.org>
Link: https://patch.msgid.link/20261013-upstream-vivaldi-fix-v2-1-ecc20329d24c@chromium.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-vivaldi-common.c | 72 ++++++++++++--------------------
1 file changed, 26 insertions(+), 46 deletions(-)
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index b12bb5cc091aa..1359a107e63bd 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -5,11 +5,13 @@
* Copyright (C) 2022 Google, Inc
*/
+#include <linux/cleanup.h>
#include <linux/export.h>
#include <linux/hid.h>
#include <linux/input/vivaldi-fmap.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <linux/types.h>
#include "hid-vivaldi-common.h"
@@ -33,13 +35,14 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
{
struct vivaldi_data *data = hid_get_drvdata(hdev);
struct hid_report *report = field->report;
- u8 *report_data, *buf;
- u32 report_len;
unsigned int fn_key;
+ unsigned int offset;
+ u32 report_len;
int ret;
if (field->logical != HID_USAGE_FN_ROW_PHYSMAP ||
- (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL)
+ (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL ||
+ usage->usage_index >= field->report_count)
return;
fn_key = usage->hid & HID_USAGE;
@@ -49,54 +52,31 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
if (fn_key > data->num_function_row_keys)
data->num_function_row_keys = fn_key;
- report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL);
- if (!report_data)
+ u8 *buf __free(kfree) = hid_alloc_report_buf(report, GFP_KERNEL);
+ if (!buf)
return;
- report_len = hid_report_len(report);
- if (!report->id) {
- /*
- * hid_hw_raw_request() will stuff report ID (which will be 0)
- * into the first byte of the buffer even for unnumbered
- * reports, so we need to account for this to avoid getting
- * -EOVERFLOW in return.
- * Note that hid_alloc_report_buf() adds 7 bytes to the size
- * so we can safely say that we have space for an extra byte.
- */
- report_len++;
- }
-
- ret = hid_hw_raw_request(hdev, report->id, report_data,
- report_len, HID_FEATURE_REPORT,
- HID_REQ_GET_REPORT);
- if (ret < 0) {
- dev_warn(&hdev->dev, "failed to fetch feature %d\n",
- field->report->id);
- goto out;
- }
-
- if (!report->id) {
- /*
- * Undo the damage from hid_hw_raw_request() for unnumbered
- * reports.
- */
- report_data++;
- report_len--;
- }
-
- ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data,
- report_len, report_len, 0);
- if (ret) {
- dev_warn(&hdev->dev, "failed to report feature %d\n",
- field->report->id);
- goto out;
+ /*
+ * hid_hw_raw_request() will stuff report ID (which will be 0)
+ * into the first byte of the buffer even for unnumbered
+ * reports, so we need to account for this to avoid getting
+ * -EOVERFLOW in return.
+ * Note that hid_alloc_report_buf() adds 7 bytes to the size
+ * so we can safely say that we have space for an extra byte.
+ */
+ report_len = hid_report_len(report) + !report->id;
+
+ ret = hid_hw_raw_request(hdev, report->id, buf, report_len,
+ HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
+ if (ret != report_len) {
+ dev_warn(&hdev->dev, "failed to fetch feature %d: %d\n",
+ report->id, ret);
+ return;
}
+ offset = field->report_offset + usage->usage_index * field->report_size;
data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
- field->value[usage->usage_index];
-
-out:
- kfree(buf);
+ hid_field_extract(hdev, buf + 1, offset, field->report_size);
}
EXPORT_SYMBOL_GPL(vivaldi_feature_mapping);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 056/742] HID: vivaldi: avoid redundant feature report reads per usage
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (54 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 055/742] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 057/742] firmware: arm_scmi: imx: Track copied syslog words Greg Kroah-Hartman
` (101 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhengping Jiang, Benjamin Tissoires,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengping Jiang <jiangzp@google.com>
[ Upstream commit 720806515cb6921ab05caaa6f470f7054b56385e ]
vivaldi_feature_mapping() is invoked by report_features() in ascending
usage_index order for each usage in the top-row physical keymap field.
Because fetching the feature report at usage_index == 0 already reads
the entire report from hardware, calling hid_hw_raw_request() again for
subsequent usages redundantly reads the same report N times (e.g., 12
sequential BLE GATT reads taking ~2s on Vivaldi BLE keyboards).
Bail out immediately when usage->usage_index != 0, fetch the feature
report once at usage_index == 0, and iterate over all usages in the
field to populate data->function_row_physmap[].
Fixes: 33bbe04a15f2 ("HID: google: extract Vivaldi hid feature mapping for use in hid-hammer")
Signed-off-by: Zhengping Jiang <jiangzp@google.com>
Link: https://patch.msgid.link/20261015064223.1939367-1-jiangzp@google.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-vivaldi-common.c | 33 +++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index 1359a107e63bd..973393d093561 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -39,19 +39,11 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
unsigned int offset;
u32 report_len;
int ret;
+ int i;
- if (field->logical != HID_USAGE_FN_ROW_PHYSMAP ||
- (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL ||
- usage->usage_index >= field->report_count)
+ if (field->logical != HID_USAGE_FN_ROW_PHYSMAP || usage->usage_index)
return;
- fn_key = usage->hid & HID_USAGE;
- if (fn_key < MIN_FN_ROW_KEY || fn_key > MAX_FN_ROW_KEY)
- return;
-
- if (fn_key > data->num_function_row_keys)
- data->num_function_row_keys = fn_key;
-
u8 *buf __free(kfree) = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf)
return;
@@ -74,9 +66,24 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
return;
}
- offset = field->report_offset + usage->usage_index * field->report_size;
- data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
- hid_field_extract(hdev, buf + 1, offset, field->report_size);
+ for (i = 0; i < field->maxusage && i < field->report_count; i++) {
+ usage = &field->usage[i];
+
+ if ((usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL)
+ continue;
+
+ fn_key = usage->hid & HID_USAGE;
+ if (fn_key < MIN_FN_ROW_KEY || fn_key > MAX_FN_ROW_KEY)
+ continue;
+
+ if (fn_key > data->num_function_row_keys)
+ data->num_function_row_keys = fn_key;
+
+ offset = field->report_offset + i * field->report_size;
+ data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
+ hid_field_extract(hdev, buf + 1, offset,
+ field->report_size);
+ }
}
EXPORT_SYMBOL_GPL(vivaldi_feature_mapping);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 057/742] firmware: arm_scmi: imx: Track copied syslog words
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (55 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 056/742] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 058/742] firmware: arm_scmi: imx: Validate MISC control response size Greg Kroah-Hartman
` (100 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit 3baf579ba76613f65b03f43a2f2642340e5fb717 ]
The MISC syslog iterator records the number of returned words plus
firmware-reported remaining words in the caller's size output.
The debugfs consumer uses that value to dump its fixed-size buffer. A
malformed or inconsistent response can therefore make it read beyond
the copied data and allocation.
Return the accumulated number of words copied into the caller's buffer
instead. The generic iterator bounds this count to the initial buffer
capacity before processing each response.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-67e325a9-473e-450a-a2a0-bf4c0c720624
Fixes: 4fa62e80c7db ("firmware: arm_scmi: imx: Support getting syslog of MISC protocol")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261028130502.2999676-1-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
index 637973fb45e65..0c708b2dd4967 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
@@ -438,7 +438,7 @@ static int iter_misc_syslog_update_state(struct scmi_iterator_state *st,
st->num_returned = RETURNED(r->numlogflags);
st->num_remaining = REMAINING(r->numlogflags);
- *p->size = st->num_returned + st->num_remaining;
+ *p->size = st->desc_index + st->num_returned;
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 058/742] firmware: arm_scmi: imx: Validate MISC control response size
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (56 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 057/742] firmware: arm_scmi: imx: Track copied syslog words Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 059/742] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
` (99 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit 4e3652a0ac715ba7387b072b72eaff76e761aaf9 ]
scmi_imx_misc_ctrl_get() uses @num to report the number of
values returned by firmware, but it did not retain the caller's value
as the capacity of @val.
A response with more values than the caller allocated was copied into
@val unchecked. For example, the MQS regmap callback supplies storage
for one value. Retain the input capacity and reject responses exceeding
it before copying, then update @num only after a successful copy.
Document the in/out @num contract of the exported helper.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-6897b44a-57fb-4964-95f8-447d0ce526e4
Fixes: 61c9f03e22fc ("firmware: arm_scmi: Add initial support for i.MX MISC protocol")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261028130502.2999676-2-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 16 ++++++++++++----
include/linux/firmware/imx/sm.h | 6 ++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
index 0c708b2dd4967..f00f7acba845a 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
@@ -273,10 +273,16 @@ static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle *ph,
{
struct scmi_imx_misc_ctrl_get_out *out;
struct scmi_xfer *t;
+ u32 num_values, max_values;
int ret, i;
int max_msg_size = ph->hops->get_max_msg_size(ph);
int max_num = (max_msg_size - sizeof(*out)) / sizeof(__le32);
+ if (!num || !val || !*num)
+ return -EINVAL;
+
+ max_values = *num;
+
ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
if (ret)
return ret;
@@ -290,16 +296,18 @@ static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle *ph,
ret = ph->xops->do_xfer(ph, t);
if (!ret) {
out = t->rx.buf;
- *num = le32_to_cpu(out->num);
+ num_values = le32_to_cpu(out->num);
- if (*num >= max_num ||
- *num * sizeof(__le32) > t->rx.len - sizeof(__le32)) {
+ if (num_values > max_values || num_values >= max_num ||
+ num_values * sizeof(__le32) > t->rx.len - sizeof(__le32)) {
ph->xops->xfer_put(ph, t);
return -EINVAL;
}
- for (i = 0; i < *num; i++)
+ for (i = 0; i < num_values; i++)
val[i] = le32_to_cpu(out->val[i]);
+
+ *num = num_values;
}
ph->xops->xfer_put(ph, t);
diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h
index ba5d93bd6158f..0aec7da0ae784 100644
--- a/include/linux/firmware/imx/sm.h
+++ b/include/linux/firmware/imx/sm.h
@@ -29,6 +29,12 @@
#define SCMI_IMX952_CTRL_BYPASS_AUDMIX 8U /* WAKE AUDMIX */
#if IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV)
+/**
+ * scmi_imx_misc_ctrl_get() - Read an i.MX MISC control
+ * @id: Control identifier
+ * @num: On entry, capacity of @val in words; on return, words read
+ * @val: Buffer for the control value
+ */
int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
int scmi_imx_misc_ctrl_set(u32 id, u32 val);
#else
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 059/742] firmware: arm_scmi: Unregister notifier on enable failure
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (57 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 058/742] firmware: arm_scmi: imx: Validate MISC control response size Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 060/742] firmware: arm_scmi: Free mailbox state on mapping failure Greg Kroah-Hartman
` (98 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit b9bb2eb88037a3823e7abd096b54d0a07d428f90 ]
scmi_notifier_register() adds the caller's notifier block before
enabling the corresponding event at the platform.
If enablement fails, the caller receives an error and can free its
notifier block. A concurrent registration can retain and later enable
the handler, leaving the failed caller's block in its notification
chain. Event delivery can then dereference the freed block.
Remove the notifier block before dropping the handler reference when
event enablement fails.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-c3c9437c-ba1a-4db6-837f-cb0950d89018
Fixes: e7c215f358a3 ("firmware: arm_scmi: Add notification callbacks-registration")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261028130502.2999676-3-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/notify.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
index fb60fb07c0ed1..e5de0d29c3460 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -1395,8 +1395,10 @@ static int scmi_notifier_register(const struct scmi_handle *handle,
/* Enable events for not pending handlers */
if (!IS_HNDL_PENDING(hndl)) {
ret = scmi_event_handler_enable_events(hndl);
- if (ret)
+ if (ret) {
+ blocking_notifier_chain_unregister(&hndl->chain, nb);
scmi_put_handler(ni, hndl);
+ }
}
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 060/742] firmware: arm_scmi: Free mailbox state on mapping failure
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (58 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 059/742] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 061/742] drm/msm: Fix GMEM_BASE on a8xx Greg Kroah-Hartman
` (97 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Sudeep Holla, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit 38b6268eae651de1ca31c48b912a55ae3e706b94 ]
mailbox_chan_setup() allocates its private state from the SCMI base
device before mapping the shared-memory area. If mapping fails while
setting up an optional RX channel, the core ignores the RX failure and
keeps the base device bound, retaining that devres allocation.
Release the private mailbox state before returning the mapping error.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-fda9bcb5-8255-4157-bbf7-d720bbd86605
Fixes: 1ebc28e9357c ("firmware: arm_scmi: Introduce setup_shmem_iomap")
Link: https://patch.msgid.link/20261028153203.3305067-1-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/transports/mailbox.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
index 308736c3ead9c..237e04c1a0f43 100644
--- a/drivers/firmware/arm_scmi/transports/mailbox.c
+++ b/drivers/firmware/arm_scmi/transports/mailbox.c
@@ -201,8 +201,11 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
smbox->shmem = core->shmem->setup_iomap(cinfo, dev, tx, NULL,
&smbox->io_ops);
- if (IS_ERR(smbox->shmem))
- return PTR_ERR(smbox->shmem);
+ if (IS_ERR(smbox->shmem)) {
+ ret = PTR_ERR(smbox->shmem);
+ devm_kfree(dev, smbox);
+ return ret;
+ }
cl = &smbox->cl;
cl->dev = cdev;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 061/742] drm/msm: Fix GMEM_BASE on a8xx
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (59 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 060/742] firmware: arm_scmi: Free mailbox state on mapping failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 062/742] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
` (96 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Connor Abbott, Konrad Dybcio,
Rob Clark, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Connor Abbott <cwabbott0@gmail.com>
[ Upstream commit 6036663be30a411b895d4ce9ba4625abbec5943b ]
This was missed during initial bringup because GMEM_BASE is not used
anymore for textures on a8xx. However other things such as mesh shading
still use the GMEM aperture. Fix it to match the value programmed into
the registers.
Fixes: 288a93200892 ("drm/msm/adreno: Introduce A8x GPU Support")
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/764371/
Message-ID: <20261029-drm-msm-gmem-base-fix-v2-1-26b338471b46@gmail.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index dadfe4c694384..f7882bb8028d8 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -382,7 +382,9 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_context *ctx,
*value = adreno_gpu->gmem;
return 0;
case MSM_PARAM_GMEM_BASE:
- if (adreno_gpu->info->family >= ADRENO_6XX_GEN3)
+ if (adreno_gpu->info->family >= ADRENO_8XX_GEN1)
+ *value = SZ_64M;
+ else if (adreno_gpu->info->family >= ADRENO_6XX_GEN3)
*value = 0;
else
*value = 0x100000;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 062/742] soundwire: qcom: disable the interrupt before gating the clock
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (60 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 061/742] drm/msm: Fix GMEM_BASE on a8xx Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 063/742] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
` (95 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Keri, Dmitry Baryshkov,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Keri <okerixx@gmail.com>
[ Upstream commit 6c067677192f054bbfa815caf04f536bb8dcdee2 ]
swrm_runtime_suspend() gates hclk straight after the ClockStopNow
broadcast, while the interrupt thread that completed it is still
clearing the status and CLK_STOP_FINISHED is about to fire. Both touch
registers with the clock going away; on x1e80100 and glymur hclk is the
SoundWire clock itself. The next clock-stop exit then fails at random
(bus clash, parity errors, AUTO_ENUM_FAILED) and one side of the
speakers stays detached until reboot.
Disable the interrupt before gating the clock and enable it again once
the clock is back.
Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Oleg Keri <okerixx@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20261009082639.22662-1-okerixx@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soundwire/qcom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 55678a30cd4a1..c5e48e8a84429 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1730,6 +1730,7 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
}
clk_prepare_enable(ctrl->hclk);
+ enable_irq(ctrl->irq);
if (ctrl->clock_stop_not_supported) {
reinit_completion(&ctrl->enumeration);
@@ -1813,6 +1814,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
}
}
+ disable_irq(ctrl->irq);
clk_disable_unprepare(ctrl->hclk);
usleep_range(300, 305);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 063/742] memory: tegra: Shut down Tegra210 EMC timers before teardown
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (61 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 062/742] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 064/742] memory: tegra: fix device_node leak in tegra186_mc_probe_device() Greg Kroah-Hartman
` (94 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Sashiko,
Krzysztof Kozlowski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit c5f343c189aa30285e7c73dbf2f185720467794b ]
The training and refresh timers can outlive the EMC state on removal
or probe failure after clock attachment, causing use-after-free.
Shut down both timers before detaching the clock provider and releasing
the timing tables to wait for callbacks and prevent rearming. Initialize
them before clock attachment, since set_rate() can start training.
Fixes: 10de21148f7d ("memory: tegra: Add EMC scaling support code for Tegra210")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-47538f77-fb50-4a06-b49b-92dbee8b538b
Link: https://patch.msgid.link/20261015002852.2159841-1-mhun512@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/memory/tegra/tegra210-emc-core.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c
index e8d4cd8fdec26..044ec6f1bc321 100644
--- a/drivers/memory/tegra/tegra210-emc-core.c
+++ b/drivers/memory/tegra/tegra210-emc-core.c
@@ -1946,12 +1946,6 @@ static int tegra210_emc_probe(struct platform_device *pdev)
config->same_freq = true;
}
- err = tegra210_clk_emc_attach(emc->clk, &emc->provider);
- if (err < 0) {
- dev_err(&pdev->dev, "failed to attach to EMC clock: %d\n", err);
- goto release;
- }
-
emc->clkchange_delay = 100;
emc->training_interval = 100;
dev_set_drvdata(emc->dev, emc);
@@ -1963,6 +1957,12 @@ static int tegra210_emc_probe(struct platform_device *pdev)
timer_setup(&emc->training, tegra210_emc_train, 0);
+ err = tegra210_clk_emc_attach(emc->clk, &emc->provider);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to attach to EMC clock: %d\n", err);
+ goto release;
+ }
+
tegra210_emc_debugfs_init(emc);
cd = devm_thermal_of_child_cooling_device_register(emc->dev, np, "emc", emc,
@@ -1978,6 +1978,8 @@ static int tegra210_emc_probe(struct platform_device *pdev)
detach:
debugfs_remove_recursive(emc->debugfs.root);
+ timer_shutdown_sync(&emc->training);
+ timer_shutdown_sync(&emc->refresh_timer);
tegra210_clk_emc_detach(emc->clk);
release:
of_reserved_mem_device_release(emc->dev);
@@ -1990,6 +1992,8 @@ static void tegra210_emc_remove(struct platform_device *pdev)
struct tegra210_emc *emc = platform_get_drvdata(pdev);
debugfs_remove_recursive(emc->debugfs.root);
+ timer_shutdown_sync(&emc->training);
+ timer_shutdown_sync(&emc->refresh_timer);
tegra210_clk_emc_detach(emc->clk);
of_reserved_mem_device_release(emc->dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 064/742] memory: tegra: fix device_node leak in tegra186_mc_probe_device()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (62 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 063/742] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 065/742] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
` (93 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Selby Mashiki, Krzysztof Kozlowski,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selby Mashiki <mashikiselby@gmail.com>
[ Upstream commit 21250426a8469d3bc43c2f0c69ed5497ee9ff7d4 ]
tegra186_mc_probe_device() iterates over the "interconnects" phandles
using of_parse_phandle_with_args(), which increments the reference count
of args.np on each successful call, but never drops the reference with
of_node_put(args.np).
Call of_node_put(args.np) at the end of each loop iteration.
Fixes: fe3b082a6eb8 ("memory: tegra: Add SID override programming for MC clients")
Signed-off-by: Selby Mashiki <mashikiselby@gmail.com>
Link: https://patch.msgid.link/20261025190322.449324-1-mashikiselby@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/memory/tegra/tegra186.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index 442edb2b033e2..0df5b56586e89 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -146,6 +146,7 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
}
}
+ of_node_put(args.np);
index++;
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 065/742] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (63 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 064/742] memory: tegra: fix device_node leak in tegra186_mc_probe_device() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 066/742] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
` (92 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <fuad.tabba@linux.dev>
[ Upstream commit 861bebd1fac5f5a25c11e40aec3c3291542045d1 ]
The GICv4 allocation and teardown paths free their irq domains and
fwnodes but leave the pointers set, and the allocation error paths test
those pointers before removing them. struct its_vm and struct its_vpe
are embedded in KVM's per-VM and per-vCPU state, so nothing re-zeroes
them between two attempts, and an error path taken after an earlier one
already freed the domain calls irq_domain_remove() on freed memory.
Reaching this takes two allocation failures, one to leave the stale
pointer behind and one to send the next attempt down the error path.
Fixes: 7de5c0af9c7c ("irqchip/gic-v4: Add per-VM VPE domain creation")
Fixes: 6d31b6ff985d ("irqchip/gic-v4.1: Add VSGI allocation/teardown")
Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260921072958.2918477-2-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index 8455b4a5fbb0d..754839e409f88 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -147,10 +147,14 @@ static int its_alloc_vcpu_sgis(struct its_vpe *vpe, int idx)
return 0;
err:
- if (vpe->sgi_domain)
+ if (vpe->sgi_domain) {
irq_domain_remove(vpe->sgi_domain);
- if (vpe->fwnode)
+ vpe->sgi_domain = NULL;
+ }
+ if (vpe->fwnode) {
irq_domain_free_fwnode(vpe->fwnode);
+ vpe->fwnode = NULL;
+ }
kfree(name);
return -ENOMEM;
}
@@ -191,10 +195,14 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
return 0;
err:
- if (vm->domain)
+ if (vm->domain) {
irq_domain_remove(vm->domain);
- if (vm->fwnode)
+ vm->domain = NULL;
+ }
+ if (vm->fwnode) {
irq_domain_free_fwnode(vm->fwnode);
+ vm->fwnode = NULL;
+ }
return -ENOMEM;
}
@@ -215,6 +223,8 @@ static void its_free_sgi_irqs(struct its_vm *vm)
irq_domain_free_irqs(irq, 16);
irq_domain_remove(vm->vpes[i]->sgi_domain);
irq_domain_free_fwnode(vm->vpes[i]->fwnode);
+ vm->vpes[i]->sgi_domain = NULL;
+ vm->vpes[i]->fwnode = NULL;
}
}
@@ -224,6 +234,8 @@ void its_free_vcpu_irqs(struct its_vm *vm)
irq_domain_free_irqs(vm->vpes[0]->irq, vm->nr_vpes);
irq_domain_remove(vm->domain);
irq_domain_free_fwnode(vm->fwnode);
+ vm->domain = NULL;
+ vm->fwnode = NULL;
}
static int its_send_vpe_cmd(struct its_vpe *vpe, struct its_cmd_info *info)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 066/742] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (64 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 065/742] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 067/742] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
` (91 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <fuad.tabba@linux.dev>
[ Upstream commit fd86d69c951765e24e89a162c53dfe33a8aba976 ]
A failure in the its_alloc_vcpu_sgis() loop leaves behind both the SGI
domains created for the vPEs below the failing index and the vPE irqs
allocated before the loop, since irq_domain_remove() frees neither. Each
leaked vPE takes its ITS state with it, a vpe_id and an LPI pending
table.
Free both from a second label before the existing unwind. With the
freed pointers now cleared, its_free_sgi_irqs() can skip a vPE with no
SGI domain and be reused there. The check has to precede the lookup:
irq_find_mapping(NULL, 0) falls back to irq_default_domain, and the
live irq it returns would then be freed.
Fixes: 6d31b6ff985d ("irqchip/gic-v4.1: Add VSGI allocation/teardown")
Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260921072958.2918477-3-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index 754839e409f88..f707a3cb281aa 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -159,6 +159,8 @@ static int its_alloc_vcpu_sgis(struct its_vpe *vpe, int idx)
return -ENOMEM;
}
+static void its_free_sgi_irqs(struct its_vm *vm);
+
int its_alloc_vcpu_irqs(struct its_vm *vm)
{
int vpe_base_irq, i;
@@ -189,11 +191,14 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
vm->vpes[i]->irq = vpe_base_irq + i;
ret = its_alloc_vcpu_sgis(vm->vpes[i], i);
if (ret)
- goto err;
+ goto err_free_irqs;
}
return 0;
+err_free_irqs:
+ its_free_sgi_irqs(vm);
+ irq_domain_free_irqs(vpe_base_irq, vm->nr_vpes);
err:
if (vm->domain) {
irq_domain_remove(vm->domain);
@@ -215,8 +220,13 @@ static void its_free_sgi_irqs(struct its_vm *vm)
return;
for (i = 0; i < vm->nr_vpes; i++) {
- unsigned int irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0);
+ unsigned int irq;
+
+ /* irq_find_mapping() falls back to the default domain on NULL. */
+ if (!vm->vpes[i]->sgi_domain)
+ continue;
+ irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0);
if (WARN_ON(!irq))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 067/742] reset: scmi: Set the device for the reset controller
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (65 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 066/742] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 068/742] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
` (90 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kunihiko Hayashi, Sudeep Holla,
Philipp Zabel, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
[ Upstream commit e3e068a457cebe2e475535685c325d5ca305f44a ]
SCMI reset driver does not set rcdev.dev when registering its reset
controller.
If rcdev.of_node is not available, the reset core tries to obtain
the firmware node from rcdev.dev. However, rcdev.dev is also NULL,
causing a NULL pointer dereference.
Set rcdev.dev to the SCMI device.
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Fixes: c8ae9c2da1cc ("reset: Add support for resets provided by SCMI")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/reset-scmi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c
index 4335811e0cfaa..0fdf593b09e24 100644
--- a/drivers/reset/reset-scmi.c
+++ b/drivers/reset/reset-scmi.c
@@ -107,6 +107,7 @@ static int scmi_reset_probe(struct scmi_device *sdev)
data->rcdev.ops = &scmi_reset_ops;
data->rcdev.owner = THIS_MODULE;
+ data->rcdev.dev = dev;
data->rcdev.of_node = np;
data->rcdev.nr_resets = reset_ops->num_domains_get(ph);
data->ph = ph;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 068/742] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (66 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 067/742] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 069/742] reset: spacemit: Fix the RCPU2 PWM reset registers Greg Kroah-Hartman
` (89 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Colton Lewis, Marc Zyngier,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colton Lewis <coltonlewis@google.com>
[ Upstream commit 7100185bdc1162eb2eca1dd20a036314e27f1561 ]
By default, init_desc() assigns the shared irq_desc_lock_class lockdep
key to desc->lock for every struct irq_desc. Device drivers that
register an IRQ affinity notifier establish a lock dependency chain of
&irq_desc_lock_class --> &pool->lock --> &p->pi_lock --> &rq->__lock
when irq_set_affinity_locked() calls schedule_work() while holding
desc->lock.
On GICv4 systems, scheduling out a KVM vCPU calls kvm_sched_out() ->
kvm_arch_vcpu_put() -> vgic_v3_put() -> vgic_v4_put() ->
its_make_vpe_non_resident() -> irq_set_vcpu_affinity() while holding the
scheduler runqueue lock (&rq->__lock). Acquiring the vPE doorbell IRQ's
desc->lock establishes &rq->__lock --> &irq_desc_lock_class, triggering
a lockdep circular locking splat:
WARNING: possible circular locking dependency detected
------------------------------------------------------
VCPU-0/109705 is trying to acquire lock:
ffff0001e41e4cc8 (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x5c/0xb0
but task is already holding lock:
ffff00dad15fd260 (&rq->__lock){-.-.}-{2:2}, at: __schedule+0x23c/0x1850
which lock already depends on the new lock.
Chain exists of:
&irq_desc_lock_class --> &p->pi_lock --> &rq->__lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&rq->__lock);
lock(&p->pi_lock);
lock(&rq->__lock);
lock(&irq_desc_lock_class);
GICv4 vPE doorbell IRQs are internal to KVM and GICv4, set
IRQ_NO_BALANCING, and never register an affinity notifier or queue work
under desc->lock. However, under forced IRQ threading (threadirqs or
CONFIG_PREEMPT_RT), request_irq() creates an IRQ thread for the doorbell
handler, causing irq_set_affinity() -> irq_set_thread_affinity() in
vgic_v4_load() to call wake_up_process() under desc->lock and establish
a real desc->lock --> &p->pi_lock --> &rq->__lock dependency on the vPE
doorbell IRQ itself.
Mark vPE doorbell IRQs with irq_set_nothread() so they are never
force-threaded, and assign them a dedicated lockdep class in
its_alloc_vcpu_irqs() via irq_set_lockdep_class().
Fixes: 8e01d9a396e6 ("KVM: arm64: vgic-v4: Move the GICv4 residency flow to be driven by vcpu_load/put")
Signed-off-by: Colton Lewis <coltonlewis@google.com>
Link: https://patch.msgid.link/20261027180610.2840837-1-coltonlewis@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index f707a3cb281aa..019aa0ded1bf9 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -163,6 +163,8 @@ static void its_free_sgi_irqs(struct its_vm *vm);
int its_alloc_vcpu_irqs(struct its_vm *vm)
{
+ static struct lock_class_key vpe_irq_lock_class;
+ static struct lock_class_key vpe_irq_request_class;
int vpe_base_irq, i;
vm->fwnode = irq_domain_alloc_named_id_fwnode("GICv4-vpe",
@@ -189,6 +191,9 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
for (i = 0; i < vm->nr_vpes; i++) {
int ret;
vm->vpes[i]->irq = vpe_base_irq + i;
+ irq_set_lockdep_class(vm->vpes[i]->irq, &vpe_irq_lock_class,
+ &vpe_irq_request_class);
+ irq_set_nothread(vm->vpes[i]->irq);
ret = its_alloc_vcpu_sgis(vm->vpes[i], i);
if (ret)
goto err_free_irqs;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 069/742] reset: spacemit: Fix the RCPU2 PWM reset registers
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (67 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 068/742] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 070/742] reset: Fix reset_control leak when put after controller unregister Greg Kroah-Hartman
` (88 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hung-Chun Tseng, Yixun Lan,
Troy Mitchell, Philipp Zabel, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
[ Upstream commit 168cae7e87463c34758db2b51537937a29b753f1 ]
Every entry in k1_rcpu2_resets[] uses RCPU2_PWM9_CLK_RST, so asserting
or deasserting the reset of any RCPU2 PWM from 0 to 8 acts on PWM9
instead. Each PWM has its own register, RCPU2_PWMn_CLK_RST at offset
4 * n, as k1-syscon.h already defines.
On a Milk-V Jupiter running the vendor kernel, which uses RCPU2 PWM2
for the fan, the RCPU2 registers read:
0x00: 0x4 0x04: 0x4 0x08: 0x1 0x0c: 0x4 ... 0x24: 0x4
Only PWM2's register has its reset deasserted, which matches one
register per PWM.
Use the matching register for each reset. No in-tree device tree uses
the RCPU2 PWMs yet, so this has no effect on current boards, but it
would break the first one that does.
Build-tested only (riscv defconfig, W=1); the fix could not be tested
at runtime, as mainline has no RCPU2 PWM node to exercise it.
Fixes: c479d7cf06c3 ("reset: spacemit: add support for SpacemiT CCU resets")
Signed-off-by: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/spacemit/reset-spacemit-k1.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/reset/spacemit/reset-spacemit-k1.c b/drivers/reset/spacemit/reset-spacemit-k1.c
index 8f3b5329ea5f6..dbd783c138b1b 100644
--- a/drivers/reset/spacemit/reset-spacemit-k1.c
+++ b/drivers/reset/spacemit/reset-spacemit-k1.c
@@ -154,15 +154,15 @@ static const struct ccu_reset_controller_data k1_rcpu_reset_data = {
};
static const struct ccu_reset_data k1_rcpu2_resets[] = {
- [RESET_RCPU2_PWM0] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM1] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM2] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM3] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM4] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM5] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM6] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM7] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM8] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM0] = RESET_DATA(RCPU2_PWM0_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM1] = RESET_DATA(RCPU2_PWM1_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM2] = RESET_DATA(RCPU2_PWM2_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM3] = RESET_DATA(RCPU2_PWM3_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM4] = RESET_DATA(RCPU2_PWM4_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM5] = RESET_DATA(RCPU2_PWM5_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM6] = RESET_DATA(RCPU2_PWM6_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM7] = RESET_DATA(RCPU2_PWM7_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM8] = RESET_DATA(RCPU2_PWM8_CLK_RST, BIT(2), BIT(0)),
[RESET_RCPU2_PWM9] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
};
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 070/742] reset: Fix reset_control leak when put after controller unregister
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (68 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 069/742] reset: spacemit: Fix the RCPU2 PWM reset registers Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 071/742] reset: Fix circular locking dependency in reset_controller_unregister() Greg Kroah-Hartman
` (87 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tzung-Bi Shih, Philipp Zabel,
Bartosz Golaszewski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <tzungbi@kernel.org>
[ Upstream commit f06482ceb314c8dc19f3d084b29c27af237556b5 ]
After commit 8c91302a29bc ("reset: protect struct reset_control with its
own mutex"), reset_control_put_internal() returns early if `rcdev` is
NULL.
When a reset controller is unregistered while consumers still hold
reset_control handles, reset_controller_unregister() sets `rstc->rcdev`
to NULL. When consumers later release their handles via
reset_control_put(), the early return skips kref_put(), resulting in
leaking resources.
Call kref_put() in reset_control_put_internal() even if `rcdev` is NULL.
Fixes: 8c91302a29bc ("reset: protect struct reset_control with its own mutex")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/core.c | 47 ++++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 13 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 38e189d04d09b..f0ab09795ae1b 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -160,6 +160,9 @@ int reset_controller_register(struct reset_controller_dev *rcdev)
}
EXPORT_SYMBOL_GPL(reset_controller_register);
+static void __reset_control_release(struct kref *kref);
+static void __reset_control_free(struct reset_control *rstc);
+
static void reset_controller_remove(struct reset_controller_dev *rcdev,
struct reset_control *rstc)
{
@@ -185,11 +188,18 @@ void reset_controller_unregister(struct reset_controller_dev *rcdev)
/*
* Numb but don't free the remaining reset control handles that are
* still held by consumers.
+ *
+ * Hold a temporary reference on rstc before clearing rstc->rcdev:
+ * once rstc->rcdev is NULL, a concurrent reset_control_put_internal()
+ * will not acquire rcdev->lock and could otherwise free rstc.
*/
list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) {
+ kref_get(&rstc->refcnt);
rcu_assign_pointer(rstc->rcdev, NULL);
synchronize_srcu(&rstc->srcu);
reset_controller_remove(rcdev, rstc);
+ if (kref_put(&rstc->refcnt, __reset_control_release))
+ __reset_control_free(rstc);
}
}
@@ -886,14 +896,16 @@ __reset_control_get_internal(struct reset_controller_dev *rcdev,
return rstc;
}
+/*
+ * Detaches rstc from rcdev (if still attached) when refcnt reaches 0.
+ * If rstc is still attached, the caller must hold rcdev->lock.
+ */
static void __reset_control_release(struct kref *kref)
{
struct reset_control *rstc = container_of(kref, struct reset_control,
refcnt);
struct reset_controller_dev *rcdev;
- lockdep_assert_held(&rstc->srcu);
-
rcdev = rcu_replace_pointer(rstc->rcdev, NULL, true);
if (rcdev) {
lockdep_assert_held(&rcdev->lock);
@@ -903,6 +915,17 @@ static void __reset_control_release(struct kref *kref)
mutex_destroy(&rstc->lock);
}
+/*
+ * Must be called outside the rstc->srcu read-side critical section after
+ * kref_put(..., __reset_control_release) returns true.
+ */
+static void __reset_control_free(struct reset_control *rstc)
+{
+ synchronize_srcu(&rstc->srcu);
+ cleanup_srcu_struct(&rstc->srcu);
+ kfree(rstc);
+}
+
static void reset_control_put_internal(struct reset_control *rstc)
{
struct reset_controller_dev *rcdev;
@@ -913,19 +936,17 @@ static void reset_control_put_internal(struct reset_control *rstc)
scoped_guard(srcu, &rstc->srcu) {
rcdev = srcu_dereference(rstc->rcdev, &rstc->srcu);
- if (!rcdev)
- /* Already released. */
- return;
-
- guard(mutex)(&rcdev->lock);
- ret = kref_put(&rstc->refcnt, __reset_control_release);
+ if (rcdev) {
+ guard(mutex)(&rcdev->lock);
+ ret = kref_put(&rstc->refcnt, __reset_control_release);
+ } else {
+ /* Already detached from rcdev. */
+ ret = kref_put(&rstc->refcnt, __reset_control_release);
+ }
}
- if (ret) {
- synchronize_srcu(&rstc->srcu);
- cleanup_srcu_struct(&rstc->srcu);
- kfree(rstc);
- }
+ if (ret)
+ __reset_control_free(rstc);
}
static void reset_gpio_aux_device_release(struct device *dev)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 071/742] reset: Fix circular locking dependency in reset_controller_unregister()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (69 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 070/742] reset: Fix reset_control leak when put after controller unregister Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 072/742] drm/msm/gem: Fix VM_BIND range check Greg Kroah-Hartman
` (86 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tzung-Bi Shih, Philipp Zabel,
Bartosz Golaszewski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <tzungbi@kernel.org>
[ Upstream commit d1f583c1eab5e4432c7ad48a8abd27cffbc8a549 ]
reset_control_acquire() and reset_control_put_internal() acquire
`rcdev->lock` inside the `rstc->srcu` read-side critical section
(`rstc->srcu` -> `rcdev->lock`).
However, reset_controller_unregister() holds `rcdev->lock` while calling
synchronize_srcu(&rstc->srcu) (`rcdev->lock` -> `rstc->srcu`), causing a
lockdep circular locking dependency warning and a potential ABBA
deadlock.
Run synchronize_srcu() outside `rcdev->lock`.
Fixes: 44a0acb2caca ("reset: protect struct reset_controller_dev with its own mutex")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/core.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index f0ab09795ae1b..4a582721782f4 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -163,11 +163,15 @@ EXPORT_SYMBOL_GPL(reset_controller_register);
static void __reset_control_release(struct kref *kref);
static void __reset_control_free(struct reset_control *rstc);
+/*
+ * Removes rstc from its list and drops the references on rcdev's owner module
+ * and device. The caller must ensure rstc->list access is serialized (e.g.,
+ * by holding rcdev->lock or moving rstc to a private list) and that no
+ * operations on rcdev via rstc are in flight.
+ */
static void reset_controller_remove(struct reset_controller_dev *rcdev,
struct reset_control *rstc)
{
- lockdep_assert_held(&rcdev->lock);
-
list_del(&rstc->list);
module_put(rcdev->owner);
put_device(rcdev->dev);
@@ -180,6 +184,7 @@ static void reset_controller_remove(struct reset_controller_dev *rcdev,
void reset_controller_unregister(struct reset_controller_dev *rcdev)
{
struct reset_control *rstc, *pos;
+ LIST_HEAD(reset_control_head);
scoped_guard(mutex, &reset_list_mutex)
list_del(&rcdev->list);
@@ -196,13 +201,22 @@ void reset_controller_unregister(struct reset_controller_dev *rcdev)
list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) {
kref_get(&rstc->refcnt);
rcu_assign_pointer(rstc->rcdev, NULL);
- synchronize_srcu(&rstc->srcu);
- reset_controller_remove(rcdev, rstc);
- if (kref_put(&rstc->refcnt, __reset_control_release))
- __reset_control_free(rstc);
+ list_move(&rstc->list, &reset_control_head);
}
}
+ /*
+ * Run synchronize_srcu() outside rcdev->lock to avoid a circular
+ * locking dependency with paths that acquire rcdev->lock inside
+ * the rstc->srcu read-side critical section.
+ */
+ list_for_each_entry_safe(rstc, pos, &reset_control_head, list) {
+ synchronize_srcu(&rstc->srcu);
+ reset_controller_remove(rcdev, rstc);
+ if (kref_put(&rstc->refcnt, __reset_control_release))
+ __reset_control_free(rstc);
+ }
+
mutex_destroy(&rcdev->lock);
}
EXPORT_SYMBOL_GPL(reset_controller_unregister);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 072/742] drm/msm/gem: Fix VM_BIND range check
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (70 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 071/742] reset: Fix circular locking dependency in reset_controller_unregister() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 073/742] drm/msm/gem: Disallow nr_bos for VM_BIND contexts Greg Kroah-Hartman
` (85 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Konrad Dybcio, Dmitry Baryshkov,
Rob Clark, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit 4f0af27c3aef5a9480712cbac4bee14f7509ae5f ]
Use size_add() to guard against overflow.
Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Fixes: 3a3bef68a6c1 ("drm/msm: Fix missing VM_BIND offset/range validation")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765329/
Message-ID: <20261102172001.508440-2-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index 1badec3caa7b8..67de27c3ae550 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -1012,10 +1012,10 @@ lookup_op(struct msm_vm_bind_job *job, const struct drm_msm_vm_bind_op *op)
if (invalid_alignment(op->iova))
ret = UERR(EINVAL, dev, "invalid address: %016llx\n", op->iova);
- if (invalid_alignment(op->obj_offset))
+ if (invalid_alignment(op->obj_offset) || (op->obj_offset > SIZE_MAX))
ret = UERR(EINVAL, dev, "invalid bo_offset: %016llx\n", op->obj_offset);
- if (invalid_alignment(op->range))
+ if (invalid_alignment(op->range) || (op->range > SIZE_MAX) || !op->range)
ret = UERR(EINVAL, dev, "invalid range: %016llx\n", op->range);
if (!drm_gpuvm_range_valid(job->vm, op->iova, op->range))
@@ -1118,7 +1118,7 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
op->obj = obj;
cnt++;
- if ((op->range + op->obj_offset) > obj->size) {
+ if (size_add(op->range, op->obj_offset) > obj->size) {
ret = UERR(EINVAL, dev, "invalid range: %016llx + %016llx > %016zx\n",
op->range, op->obj_offset, obj->size);
goto out_unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 073/742] drm/msm/gem: Disallow nr_bos for VM_BIND contexts
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (71 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 072/742] drm/msm/gem: Fix VM_BIND range check Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 074/742] drm/msm/gem: Decrement loop idx if handle lookup fails Greg Kroah-Hartman
` (84 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Rob Clark,
Konrad Dybcio, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit b3b44f7508c7f01273ba773595b7787883ceb4e0 ]
If using VM_BIND, it is invalid to attach BOs to a GEM_SUBMIT ioctl.
Only the VM_BIND ioctl should be used for binding objects.
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765330/
Message-ID: <20261102172001.508440-3-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 5862db05297a7..c03410c568a5a 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -272,7 +272,7 @@ static int submit_lock_objects_vmbind(struct msm_gem_submit *submit)
struct drm_exec *exec = &submit->exec;
int ret = 0;
- drm_exec_init(&submit->exec, flags, submit->nr_bos);
+ drm_exec_init(&submit->exec, flags, 0);
submit->has_exec = true;
drm_exec_until_all_locked (&submit->exec) {
@@ -589,6 +589,9 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
return -EINVAL;
}
+ if (msm_context_is_vmbind(ctx) && args->nr_bos)
+ return UERR(EINVAL, dev, "invalid nr_bos, must be zero for VM_BIND contexts");
+
queue = msm_submitqueue_get(ctx, args->queueid);
if (!queue)
return -ENOENT;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 074/742] drm/msm/gem: Decrement loop idx if handle lookup fails
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (72 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 073/742] drm/msm/gem: Disallow nr_bos for VM_BIND contexts Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 7.3 075/742] drm/msm/gem: Clear nr_ops in lookup_ops() failure path Greg Kroah-Hartman
` (83 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rob Clark, Konrad Dybcio,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit 31708945d3647ad29f91def9d40dafa149ac66f1 ]
In the out_unlock unlock loop, we should skip the op which still has the
gem handle instead of gem obj ptr.
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765328/
Message-ID: <20261102172001.508440-4-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index 67de27c3ae550..f8892d78f37d2 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -1110,6 +1110,7 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
obj = idr_find(&file->object_idr, op->handle);
if (!obj) {
ret = UERR(EINVAL, dev, "invalid handle %u at index %u\n", op->handle, i);
+ i--;
goto out_unlock;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 075/742] drm/msm/gem: Clear nr_ops in lookup_ops() failure path
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (73 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 074/742] drm/msm/gem: Decrement loop idx if handle lookup fails Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 076/742] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata() Greg Kroah-Hartman
` (82 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rob Clark, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit b22f5d783eadbebe90481db0c48cecf719e71dad ]
We've already dropped the references taken in the handle lookup loop, so
we don't want to drop them again in msm_vma_job_free().
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Patchwork: https://patchwork.freedesktop.org/patch/765324/
Message-ID: <20261102172001.508440-5-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index f8892d78f37d2..c92ae0bfb66e3 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -1088,7 +1088,6 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
}
if (ret) {
- job->nr_ops = 0;
goto out;
}
@@ -1143,6 +1142,9 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
}
}
out:
+ if (ret)
+ job->nr_ops = 0;
+
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 076/742] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (74 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 7.3 075/742] drm/msm/gem: Clear nr_ops in lookup_ops() failure path Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 077/742] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
` (81 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bart Van Assche, Rob Clark,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <bvanassche@acm.org>
[ Upstream commit 1e59855738454b14021b64115f0090eafc7526ae ]
If krealloc() fails, msm_ioctl_gem_info_set_metadata() returns without
unlocking the GEM object. Fix this by jumping to a new label that
unlocks the GEM object before the buffer is freed. This bug has been
detected by the Clang thread-safety analyzer.
Fixes: 1c8c354098ea ("drm/msm: Add error handling for krealloc in metadata setup")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Patchwork: https://patchwork.freedesktop.org/patch/763272/
Message-ID: <9671164f87138a0caf5c69b66129bbd6faf932f8.1793044688.git.bvanassche@acm.org>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f3d2eaa04f142..0227f46a4963a 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -498,13 +498,14 @@ static int msm_ioctl_gem_info_set_metadata(struct drm_gem_object *obj,
krealloc(msm_obj->metadata, metadata_size, GFP_KERNEL);
if (!new_metadata) {
ret = -ENOMEM;
- goto out;
+ goto unlock;
}
msm_obj->metadata = new_metadata;
msm_obj->metadata_size = metadata_size;
memcpy(msm_obj->metadata, buf, metadata_size);
+unlock:
msm_gem_unlock(obj);
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 077/742] selftests: drivers/s390x: Select uvdevice tests using the target architecture
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (75 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 076/742] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 078/742] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
` (80 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sasha Levin, Steffen Eiden,
Christian Borntraeger
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <sashal@kernel.org>
[ Upstream commit 62aef2c04e0e69a9b88affa74ff699ce5c4e8652 ]
The uvdevice Makefile decides whether to build its test from uname -m,
which describes the build host. A cross build for s390 on another host
therefore silently omits the test, while the non-s390 branch provides
no-op build and installation targets but no emit_tests target.
Select the test from the target ARCH when it is given and from the
host's SUBARCH otherwise, accepting both the s390 and s390x spellings,
and include lib.mk unconditionally so that other architectures build,
install and emit an empty runlist. ARCH itself is left unset so that a
native LLVM=1 build keeps using the compiler's native target.
Drop the include path derived from tools/arch/$(ARCH): the test only
needs asm/uvdevice.h from the installed kernel headers, and the path
does not exist for the s390x spelling.
Fixes: cbac924200b8 ("selftests: drivers/s390x: Add uvdevice tests")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../selftests/drivers/s390x/uvdevice/Makefile | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/drivers/s390x/uvdevice/Makefile b/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
index 755d164384c46..586a9aa6fb158 100644
--- a/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
+++ b/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
@@ -1,20 +1,13 @@
include ../../../../../build/Build.include
-UNAME_M := $(shell uname -m)
-
-ifneq ($(UNAME_M),s390x)
-nothing:
-.PHONY: all clean run_tests install
-.SILENT:
-else
+top_srcdir ?= ../../../../../..
+include $(top_srcdir)/scripts/subarch.include
+ARCH_PROCESSED := $(or $(ARCH),$(SUBARCH))
+ifneq (,$(filter s390 s390x,$(ARCH_PROCESSED)))
TEST_GEN_PROGS := test_uvdevice
-top_srcdir ?= ../../../../../..
-LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
-
-CFLAGS += -Wall -Werror -static $(KHDR_INCLUDES) -I$(LINUX_TOOL_ARCH_INCLUDE)
+CFLAGS += -Wall -Werror -static $(KHDR_INCLUDES)
+endif
include ../../../lib.mk
-
-endif
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 078/742] phy: ingenic: fix unbalanced regulator disable in exit
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (76 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 077/742] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 080/742] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
` (79 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Felix Gu, Manivannan Sadhasivam,
Paul Cercueil, Olivier Louvignes, H. Nikolaus Schaller,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <ustc.gu@gmail.com>
[ Upstream commit 71c1be5cc4e083852c8437bd6afcb99ee3050e8e ]
exit() and power_off() both disable vcc_supply, so the regulator
gets disabled twice for every power cycle, causing an unbalanced
disable WARN.
Drop the regulator_disable() call from the exit callback and leave
the regulator to the power_on/power_off pair.
Fixes: 31de313dfdcf ("PHY: Ingenic: Add USB PHY driver using generic PHY framework.")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Olivier Louvignes <olivier@mgcrea.io>
Reviewed-By: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://patch.msgid.link/20260906-ingenic-v1-1-2311f3df8ddc@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ingenic/phy-ingenic-usb.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/phy/ingenic/phy-ingenic-usb.c b/drivers/phy/ingenic/phy-ingenic-usb.c
index 7e62d46850fda..d8e5ef302b748 100644
--- a/drivers/phy/ingenic/phy-ingenic-usb.c
+++ b/drivers/phy/ingenic/phy-ingenic-usb.c
@@ -124,7 +124,6 @@ static int ingenic_usb_phy_exit(struct phy *phy)
struct ingenic_usb_phy *priv = phy_get_drvdata(phy);
clk_disable_unprepare(priv->clk);
- regulator_disable(priv->vcc_supply);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 080/742] phy: ti: pipe3: Fix clock resource leak on probe errors
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (77 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 078/742] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 081/742] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
` (78 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hongling Zeng, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit 6dc01e3516d79cf4d690d892499a0bd08a14285b ]
When devm_phy_create() or devm_of_phy_provider_register() fails,
the refclk that was enabled earlier is not disabled, causing a
resource leak.
Fix this by adding an error handling path to disable the clock
when these functions fail.
Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909122630.1313205-3-zenghongling@kylinos.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ti/phy-ti-pipe3.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 0e3bc92187338..021657cbce481 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -834,21 +834,39 @@ static int ti_pipe3_probe(struct platform_device *pdev)
*/
if (phy->mode == PIPE3_MODE_SATA) {
if (!IS_ERR(phy->refclk)) {
- clk_prepare_enable(phy->refclk);
+ ret = clk_prepare_enable(phy->refclk);
+ if (ret) {
+ dev_err(dev, "Failed to enable refclk %d\n", ret);
+ goto err_pm_disable;
+ }
phy->sata_refclk_enabled = true;
}
}
generic_phy = devm_phy_create(dev, NULL, &ops);
- if (IS_ERR(generic_phy))
- return PTR_ERR(generic_phy);
+ if (IS_ERR(generic_phy)) {
+ ret = PTR_ERR(generic_phy);
+ goto err_clk_disable;
+ }
phy_set_drvdata(generic_phy, phy);
ti_pipe3_power_off(generic_phy);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
- return PTR_ERR_OR_ZERO(phy_provider);
+ if (IS_ERR(phy_provider)) {
+ ret = PTR_ERR(phy_provider);
+ goto err_clk_disable;
+ }
+
+ return 0;
+
+err_clk_disable:
+ if (phy->sata_refclk_enabled)
+ clk_disable_unprepare(phy->refclk);
+err_pm_disable:
+ pm_runtime_disable(dev);
+ return ret;
}
static void ti_pipe3_remove(struct platform_device *pdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 081/742] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (78 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 080/742] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 083/742] Revert "phy: qcom: qmp-pcie: Skip PHY reset if already up" Greg Kroah-Hartman
` (77 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manivannan Sadhasivam, Hongling Zeng,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit aeb637c73631851de0965514151f7ff7bc13f940 ]
ti_pipe3_get_clk() has two issues with -EPROBE_DEFER error handling:
1. When devm_clk_get() for sysclk fails, the function returns -EINVAL
instead of propagating the actual error code. This masks -EPROBE_DEFER
to -EINVAL, breaking the probe deferral mechanism and causing permanent
driver initialization failure on systems with non-deterministic probe
ordering.
2. For SATA PHY refclk, the function ignores all errors to support older
DTBs missing the refclk property. However, this incorrectly ignores
-EPROBE_DEFER as well, causing the driver to proceed without waiting
for the clock provider to become available.
Fix both issues:
- Return PTR_ERR(phy->sys_clk) instead of -EINVAL to propagate all
error codes including -EPROBE_DEFER
- Use devm_clk_get_optional() for SATA refclk to handle optional
clocks while propagating -EPROBE_DEFER and other errors
Fixes: a70143bbef6b ("drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework")
Fixes: 7f33912d2978 ("phy: ti-pipe3: Fix SATA across suspend/resume")
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909122630.1313205-4-zenghongling@kylinos.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ti/phy-ti-pipe3.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 021657cbce481..fdd81c935e5f3 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -608,14 +608,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
struct clk *clk;
struct device *dev = phy->dev;
- phy->refclk = devm_clk_get(dev, "refclk");
+ /*
+ * refclk is optional for SATA PHY to support older DTBs, but
+ * required for other modes. Use devm_clk_get_optional() for SATA
+ * which returns NULL for -ENOENT, allowing us to propagate all
+ * other errors including -EPROBE_DEFER.
+ */
+ if (phy->mode == PIPE3_MODE_SATA)
+ phy->refclk = devm_clk_get_optional(dev, "refclk");
+ else
+ phy->refclk = devm_clk_get(dev, "refclk");
+
if (IS_ERR(phy->refclk)) {
- dev_err(dev, "unable to get refclk\n");
- /* older DTBs have missing refclk in SATA PHY
- * so don't bail out in case of SATA PHY.
- */
- if (phy->mode != PIPE3_MODE_SATA)
- return PTR_ERR(phy->refclk);
+ return dev_err_probe(dev, PTR_ERR(phy->refclk),
+ "unable to get refclk\n");
}
if (phy->mode != PIPE3_MODE_SATA) {
@@ -631,8 +637,8 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
if (phy->mode != PIPE3_MODE_PCIE || phy->phy_power_syscon) {
phy->sys_clk = devm_clk_get(dev, "sysclk");
if (IS_ERR(phy->sys_clk)) {
- dev_err(dev, "unable to get sysclk\n");
- return -EINVAL;
+ return dev_err_probe(dev, PTR_ERR(phy->sys_clk),
+ "unable to get sysclk\n");
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 083/742] Revert "phy: qcom: qmp-pcie: Skip PHY reset if already up"
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (79 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 081/742] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 084/742] phy: rockchip: naneng-combphy: Fix overwritten PLL SSC control bit Greg Kroah-Hartman
` (76 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael Burch, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Burch <me@michaelburch.net>
[ Upstream commit 9a07dfa7f6fe34e230de183c02a8180529091649 ]
This reverts commit 910b828b22b7b91054b3bd4be676a017444b0e00.
That commit skips the no-csr reset assert/deassert (and the 200-300us
settle) whenever the bootloader already brought the PCIe QMP PHY up:
skip_reset = qmp->skip_init &&
!qphy_checkbits(pcs, cfg->regs[QPHY_PCS_STATUS],
cfg->phy_status);
and states its own assumption explicitly: "This relies on the assumption
that when skip_init is enabled and the PHY is reported as up, the
bootloader has already configured the PHY correctly and the link is in a
usable state."
That assumption does not hold on the Dell XPS 13 9345 (X1E80100). UEFI
boots from the NVMe behind pcie6a, so the PHY is always already started
when Linux takes over, skip_init is true, and the reset is skipped. The
link then never retrains and the root port comes up with no endpoint:
qcom-pcie 1bf8000.pcie: Device found, but not active
pci 0006:00:00.0: [17cb:0111] type 01 class 0x060400 PCIe Root Port
(no 0006:01:00.0, no nvme at all)
"Device found, but not active" is dw_pcie_wait_for_link() reporting LTSSM
stuck in POLL.Active/POLL.Compliance -- receiver detected, training never
completes -- so the machine cannot find its root filesystem and drops to
a dracut emergency shell. v7.2 is unaffected because it always performed
the reset.
The commit was applied on its own as patch 1/4 of "PCI: qcom: Add link
retention support"; 2/4-4/4 have not landed. Without them,
qcom_pcie_host_init() still asserts PERST# and resets the controller
before qcom_pcie_phy_power_on(), so the link is down while
QPHY_PCS_STATUS still reports the bootloader's state, and the skip's
precondition never holds. Revert it until the rest of the series lands.
Fixes: 910b828b22b7 ("phy: qcom: qmp-pcie: Skip PHY reset if already up")
Signed-off-by: Michael Burch <me@michaelburch.net>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20261013-qmp-pcie-skip-reset-revert-v1@michaelburch.net
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 31 ++++++++----------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index da83358c97ead..17c53ae62fac7 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -5677,7 +5677,6 @@ static int qmp_pcie_init(struct phy *phy)
struct qmp_pcie *qmp = phy_get_drvdata(phy);
const struct qmp_phy_cfg *cfg = qmp->cfg;
void __iomem *pcs = qmp->pcs;
- bool skip_reset;
int ret;
/*
@@ -5693,9 +5692,6 @@ static int qmp_pcie_init(struct phy *phy)
qphy_checkbits(pcs, cfg->regs[QPHY_START_CTRL], SERDES_START | PCS_START) &&
qphy_checkbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], cfg->pwrdn_ctrl);
- skip_reset = qmp->skip_init && !qphy_checkbits(pcs, cfg->regs[QPHY_PCS_STATUS],
- cfg->phy_status);
-
if (!qmp->skip_init && !cfg->tbls.serdes_num) {
dev_err(qmp->dev, "Init sequence not available\n");
return -ENODATA;
@@ -5719,16 +5715,14 @@ static int qmp_pcie_init(struct phy *phy)
}
}
- if (!skip_reset) {
- ret = reset_control_assert(qmp->nocsr_reset);
- if (ret) {
- dev_err(qmp->dev, "no-csr reset assert failed\n");
- goto err_assert_reset;
- }
-
- usleep_range(200, 300);
+ ret = reset_control_assert(qmp->nocsr_reset);
+ if (ret) {
+ dev_err(qmp->dev, "no-csr reset assert failed\n");
+ goto err_assert_reset;
}
+ usleep_range(200, 300);
+
if (!qmp->skip_init) {
ret = reset_control_bulk_deassert(cfg->num_resets, qmp->resets);
if (ret) {
@@ -5777,11 +5771,8 @@ static int qmp_pcie_power_on(struct phy *phy)
void __iomem *pcs = qmp->pcs;
void __iomem *status;
unsigned int mask, val;
- bool skip_reset;
int ret;
- skip_reset = qmp->skip_init && !qphy_checkbits(pcs, cfg->regs[QPHY_PCS_STATUS],
- cfg->phy_status);
/*
* Write CSR register for PHY that doesn't support no_csr reset or has not
* been initialized.
@@ -5805,12 +5796,10 @@ static int qmp_pcie_power_on(struct phy *phy)
if (ret)
return ret;
- if (!skip_reset) {
- ret = reset_control_deassert(qmp->nocsr_reset);
- if (ret) {
- dev_err(qmp->dev, "no-csr reset deassert failed\n");
- goto err_disable_pipe_clk;
- }
+ ret = reset_control_deassert(qmp->nocsr_reset);
+ if (ret) {
+ dev_err(qmp->dev, "no-csr reset deassert failed\n");
+ goto err_disable_pipe_clk;
}
if (qmp->skip_init)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 084/742] phy: rockchip: naneng-combphy: Fix overwritten PLL SSC control bit
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (80 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 083/742] Revert "phy: qcom: qmp-pcie: Skip PHY reset if already up" Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 085/742] phy: PHY_GOOGLE_USB should depend on ARCH_GOOGLE Greg Kroah-Hartman
` (75 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shawn Lin, Manivannan Sadhasivam,
Sebastian Reichel, Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <shawn.lin@rock-chips.com>
[ Upstream commit 96246dc6c16a5e5a6b4b9fde8f4ab9cdeb201088 ]
rk_combphy_common_cfg_ssc() first sets RK3568_PHYREG33_PLL_SSC_CTRL on the
RK3588 and RK3576 SoCs, then, for PCIe at 24MHz, programs the PLL KVCO
adjust field. The latter used a plain writel() of the FIELD_PREP() value,
which cleared all the other bits of RK3568_PHYREG33, including the
PLL_SSC_CTRL bit that had just been set a few lines above.
Use rockchip_combphy_updatel() so that only the KVCO field is updated and
the SSC control bit is preserved, as the comment and the pre-consolidation
code intended.
Fixes: 0b31f297557f ("phy: rockchip: naneng-combphy: Consolidate SSC configuration")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/1792036787-37927-1-git-send-email-shawn.lin@rock-chips.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
index 3102a99128f62..b6cc010327831 100644
--- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
@@ -526,7 +526,8 @@ static void rk_combphy_common_cfg_ssc(struct rockchip_combphy_priv *priv, unsign
val = FIELD_PREP(RK3568_PHYREG33_PLL_KVCO_MASK,
RK3576_PHYREG33_PLL_KVCO_VALUE);
- writel(val, priv->mmio + RK3568_PHYREG33);
+ rockchip_combphy_updatel(priv, RK3568_PHYREG33_PLL_KVCO_MASK,
+ val, RK3568_PHYREG33);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 085/742] phy: PHY_GOOGLE_USB should depend on ARCH_GOOGLE
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (81 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 084/742] phy: rockchip: naneng-combphy: Fix overwritten PLL SSC control bit Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 086/742] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
` (74 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Geert Uytterhoeven,
Manivannan Sadhasivam, Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <geert+renesas@glider.be>
[ Upstream commit 518d5bc7a636696969e3f4a7f9c66483e4f35e1e ]
The Google Tensor SoC USB PHY is only present on Google Tensor G5
(Laguna) SoCs. Hence add a dependency on ARCH_GOOGLE, to prevent asking
the user about this driver when configuring a kernel without Google
Tensor SoC support.
Fixes: cbce66669c82ee9a ("phy: Add Google Tensor SoC USB PHY driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/90a172c2980073a09b4f01c21a251c3d0d2d6fe5.1792499240.git.geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 19f3b7d12b7d4..d142e16bb1562 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -93,6 +93,7 @@ config PHY_ECONET_PCIE
config PHY_GOOGLE_USB
tristate "Google Tensor SoC USB PHY driver"
+ depends on ARCH_GOOGLE || COMPILE_TEST
select GENERIC_PHY
depends on TYPEC
help
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 086/742] ksmbd: sign the last response of a compound that ends early
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (82 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 085/742] phy: PHY_GOOGLE_USB should depend on ARCH_GOOGLE Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 087/742] wifi: iwlwifi: mvm: correctly check the API version Greg Kroah-Hartman
` (73 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michail Andreas Michalopoulos,
Ian Bridges, Namjae Jeon, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
[ Upstream commit 3d322b98b56628ee69e4528a52cc1f445880fa17 ]
is_chained_smb2_message() ends a compound early when the next command
does not fit in the request, or its response would not fit in the
response buffer. Since commit e2b76ab8b5c9 ("ksmbd: add support for
read compound"), __handle_ksmbd_work() then signs ksmbd_resp_buf_curr(),
which is_chained_smb2_message() only moves to the response of the
command just processed when it chains to the next command or reaches
the last one. On an early end it returns without moving it, so for a
command after the first, the previous command's response was signed
again, over the iovecs of both responses, and the response of this
command was left unsigned. Neither signature verifies at the client.
Handle an early end as the end of the compound: pad the response to 8
bytes and make it the current one. smb2_allocate_rsp_buf() leaves room
for that padding in the response buffer of a compound.
Only a compound whose NextCommand points past the end of the message,
or whose responses fill the response buffer, takes this path. Sashiko
pointed it out in its review of an unrelated series.
An AI assistant was used to draft the patch and as an independent
reviewer.
Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
Signed-off-by: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index c8e87c7c8bc21..213310bc41a18 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -702,7 +702,7 @@ bool is_chained_smb2_message(struct ksmbd_work *work)
get_rfc1002_len(work->request_buf)) {
pr_err("next command(%u) offset exceeds smb msg size\n",
next_cmd);
- return false;
+ goto last_rsp;
}
/*
@@ -719,16 +719,21 @@ bool is_chained_smb2_message(struct ksmbd_work *work)
if ((u64)ALIGN(get_rfc1002_len(work->response_buf), 8) +
next_rsp_sz > work->response_sz) {
pr_err("next response offset exceeds response buffer size\n");
- return false;
+ goto last_rsp;
}
ksmbd_debug(SMB, "got SMB2 chained command\n");
init_chained_smb2_rsp(work);
return true;
- } else if (work->next_smb2_rcv_hdr_off) {
+ }
+
+last_rsp:
+ if (work->next_smb2_rcv_hdr_off) {
/*
- * This is last request in chained command,
- * align response to 8 byte
+ * This is the last response of a compound, also when the
+ * compound ends early because the next command does not fit.
+ * Align it to 8 bytes and make it the current response, which
+ * is the one the caller signs.
*/
len = ALIGN(get_rfc1002_len(work->response_buf), 8);
len = len - get_rfc1002_len(work->response_buf);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 087/742] wifi: iwlwifi: mvm: correctly check the API version
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (83 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 086/742] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 088/742] wifi: ath9k: make sure we stop the wmi tasklet on init fail Greg Kroah-Hartman
` (72 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Miri Korenblit, Sasha Levin,
Chris Bainbridge
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
[ Upstream commit 06cfbf21b33772266a03a580182b74233f41f2b2 ]
The check for the firmware version for the reset handshake
was wrong. mvm->fw->ucode_ver is the major number itself.
No need to mask it with IWL_UCODE_MAJOR.
We could look at the major number from IWL_UCODE_TLV_FW_VERSION
but we don't remember that number and looking at fw->ucode_ver
is good enough.
Fixes: 0eaa1f245ac0 ("wifi: iwlwifi: mvm: don't support the reset handshake for old firmwares")
Reported-and-tested-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Link: https://lore.kernel.org/linux-wireless/amzVtgQb2p-_nShU@debian.local/
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20261114193144.ab54bc9717fc.I8cda260e2ef7aedd790915a17cb6832010f82aa4@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 1dd27292af9b8..c59644f258e13 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -1413,15 +1413,13 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,
sizeof(mvm->hw->wiphy->fw_version),
"%.31s", fw->fw_version);
- trans->conf.fw_reset_handshake =
- fw_has_capa(&mvm->fw->ucode_capa,
- IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE);
-
- /* Those firmware versions claim to support the fw_reset_handshake
+ /* Some firmware versions claim to support the fw_reset_handshake
* but they are buggy.
*/
- if (IWL_UCODE_MAJOR(mvm->fw->ucode_ver) <= 77)
- trans->conf.fw_reset_handshake = false;
+ trans->conf.fw_reset_handshake =
+ fw_has_capa(&mvm->fw->ucode_capa,
+ IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE) &&
+ mvm->fw->ucode_ver > 77;
trans->conf.queue_alloc_cmd_ver =
iwl_fw_lookup_cmd_ver(mvm->fw,
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 088/742] wifi: ath9k: make sure we stop the wmi tasklet on init fail
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (84 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 087/742] wifi: iwlwifi: mvm: correctly check the API version Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 089/742] scsi: lpfc: Fix race conditions in ELS retry handling Greg Kroah-Hartman
` (71 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+e91dc13b1b37759b3d9f,
Toke Høiland-Jørgensen, Eduard Zateev, Johannes Berg,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <toke@toke.dk>
[ Upstream commit ec95877e2ea1c655e914c34fa23fd51e32315fec ]
The ath9k_wmi_event_tasklet() reschedules itself until device
initialisation is complete, but if the initialisation fails it is never
interrupted. Syzbot triggered a use-after-free in tasklet_action_common
because of this.
Add a guard to the reschedule logic so it aborts if wmi->stopped is set,
and add a call to ath9k_wmi_event_drain() in ath9k_stop_wmi(), so we are
sure that the queue is drained and the tasklet is stopped on teardown.
Fixes: 1af8dc9ca726 ("wifi: ath9k: Clean up device initialisation guards")
Reported-by: syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e91dc13b1b37759b3d9f
Tested-by: syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.com
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Tested-by: Eduard Zateev <hackerowskiy@gmail.com>
Link: https://patch.msgid.link/20261021120237.481898-1-toke@toke.dk
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath9k/wmi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 44e91815a1594..520bb2347dfcd 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -118,6 +118,8 @@ void ath9k_stop_wmi(struct ath9k_htc_priv *priv)
mutex_lock(&wmi->op_mutex);
wmi->stopped = true;
mutex_unlock(&wmi->op_mutex);
+
+ ath9k_wmi_event_drain(priv);
}
void ath9k_destroy_wmi(struct ath9k_htc_priv *priv)
@@ -148,7 +150,8 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t)
/* Check if ath9k_init_device() completed. */
if (!smp_load_acquire(&priv->initialized)) {
- tasklet_schedule(t);
+ if (!READ_ONCE(wmi->stopped))
+ tasklet_schedule(t);
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 089/742] scsi: lpfc: Fix race conditions in ELS retry handling
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (85 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 088/742] wifi: ath9k: make sure we stop the wmi tasklet on init fail Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 090/742] scsi: ch: Remove the minor from ch_index_idr after device_destroy() Greg Kroah-Hartman
` (70 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Mahlkuch, Hannes Reinecke,
Paul Ely, Martin K. Petersen (Oracle), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
[ Upstream commit 7470a1f2a84d68d177560b78388e640771b6b94a ]
This patch addresses a race condition in the lpfc driver's ELS retry event
handling that can lead to a use-after-free in the
lpfc_cancel_retry_delay_tmo(), where the NLP_DELAY_TMO flag is cleared
before acquiring the lock to check if the retry event is queued. This
creates a window where the timer can be rescheduled and fire, causing both
the cancel path and the worker thread to release the same reference,
resulting in a double-put and use-after-free.
Moved capture ndlp and clear evt_arg1 under hbalock while dequeuing
LPFC_EVT_ELS_RETRY in lpfc_work_list_done().
Signed-off-by: Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
Fixes: e47c9093531d ("[SCSI] lpfc 8.2.5 : Correct ndlp referencing issues")
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Paul Ely <pely@broadcom.com>
Link: https://patch.msgid.link/dcea48dd-f76c-4bb0-9275-c12ef9bd78a2@linux.ibm.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/lpfc/lpfc_els.c | 29 +++++++++++++++++++++++------
drivers/scsi/lpfc/lpfc_hbadisc.c | 11 ++++++++++-
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 52fc5058976d9..176dccd4b6347 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4477,18 +4477,35 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t retry)
void
lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
{
- struct lpfc_work_evt *evtp;
+ struct lpfc_hba *phba = vport->phba;
+ struct lpfc_work_evt *evtp = &nlp->els_retry_evt;
+ struct lpfc_nodelist *arg_ndlp = NULL;
+ unsigned long flags;
if (!test_and_clear_bit(NLP_DELAY_TMO, &nlp->nlp_flag))
return;
timer_delete_sync(&nlp->nlp_delayfunc);
nlp->nlp_last_elscmd = 0;
- if (!list_empty(&nlp->els_retry_evt.evt_listp)) {
- list_del_init(&nlp->els_retry_evt.evt_listp);
- /* Decrement nlp reference count held for the delayed retry */
- evtp = &nlp->els_retry_evt;
- lpfc_nlp_put((struct lpfc_nodelist *)evtp->evt_arg1);
+
+ /*
+ * If retry event is queued, remove it under lock and consume
+ * its payload to prevent double-put. The event holds a reference
+ * to the nodelist that must be released exactly once.
+ */
+ spin_lock_irqsave(&phba->hbalock, flags);
+ if (!list_empty(&evtp->evt_listp)) {
+ list_del_init(&evtp->evt_listp);
+ /* Take local copy and clear to prevent reuse */
+ arg_ndlp = (struct lpfc_nodelist *)evtp->evt_arg1;
+ evtp->evt_arg1 = NULL;
+ smp_wmb(); /* Ensure NULL visible before unlock */
}
+ spin_unlock_irqrestore(&phba->hbalock, flags);
+
+ /* Drop the event-held reference outside the lock */
+ if (arg_ndlp)
+ lpfc_nlp_put(arg_ndlp);
+
if (test_and_clear_bit(NLP_NPR_2B_DISC, &nlp->nlp_flag)) {
if (vport->num_disc_nodes) {
if (vport->port_state < LPFC_VPORT_READY) {
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index c9b02d2c63054..d105b8eb53faa 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -840,12 +840,21 @@ lpfc_work_list_done(struct lpfc_hba *phba)
while (!list_empty(&phba->work_list)) {
list_remove_head((&phba->work_list), evtp, typeof(*evtp),
evt_listp);
+ /*
+ * The ELS retry event can be requeued by lpfc_els_retry_delay()
+ * as soon as hbalock is dropped. Consume the payload within the
+ * hbalock to prevent reuse or double-put.
+ */
+ if (evtp->evt == LPFC_EVT_ELS_RETRY) {
+ ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
+ evtp->evt_arg1 = NULL;
+ }
spin_unlock_irq(&phba->hbalock);
hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags);
free_evt = 1;
switch (evtp->evt) {
case LPFC_EVT_ELS_RETRY:
- ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1);
+ /* ndlp was already captured under hbalock */
if (!hba_pci_err) {
lpfc_els_retry_delay_handler(ndlp);
free_evt = 0; /* evt is part of ndlp */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 090/742] scsi: ch: Remove the minor from ch_index_idr after device_destroy()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (86 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 089/742] scsi: lpfc: Fix race conditions in ELS retry handling Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 091/742] Bluetooth: L2CAP: return LE credits from recvmsg under the conn lock Greg Kroah-Hartman
` (69 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Changyul Lee, Laurence Oberman,
Martin K. Petersen (Oracle), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changyul Lee <lcy8047@gmail.com>
[ Upstream commit 9f9e0b1e5399045982788a954d3461de894e40c7 ]
ch_remove() removes the minor from ch_index_idr before device_destroy()
removes the "sch<N>" device. A changer probed in between can get the same
minor, and its device_create() fails:
sysfs: cannot create duplicate filename '/class/scsi_changer/sch0'
...
ch 1:0:0:0: ch0: device_create failed
The new changer is then not attached.
Replace the IDR entry with NULL instead, so that ch_open() still fails with
-ENXIO for the changer being removed, and remove the minor after
device_destroy().
Fixes: da707c54c342 ("[SCSI] ch: fix device minor number management bug")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://patch.msgid.link/20261109160651.986356-1-lcy8047@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/ch.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index cc4532c7782f1..6474929f86a67 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -961,11 +961,15 @@ static void ch_remove(struct scsi_device *sd)
scsi_changer *ch = dev_get_drvdata(dev);
spin_lock(&ch_index_lock);
- idr_remove(&ch_index_idr, ch->minor);
+ idr_replace(&ch_index_idr, NULL, ch->minor);
dev_set_drvdata(dev, NULL);
spin_unlock(&ch_index_lock);
device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
+
+ spin_lock(&ch_index_lock);
+ idr_remove(&ch_index_idr, ch->minor);
+ spin_unlock(&ch_index_lock);
scsi_device_put(ch->device);
kref_put(&ch->ref, ch_destroy);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 091/742] Bluetooth: L2CAP: return LE credits from recvmsg under the conn lock
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (87 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 090/742] scsi: ch: Remove the minor from ch_index_idr after device_destroy() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 092/742] Bluetooth: L2CAP: Use a reserved ident for L2CAP_LE_CREDITS Greg Kroah-Hartman
` (68 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+9dc8780713b11155dd74,
Nguyen Ngoc Thang, Luiz Augusto von Dentz, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
[ Upstream commit 5beb86f98c3d45f6d64be5b6d6c77480487b41b4 ]
l2cap_chan_le_send_credits() allocates an ident from conn->tx_ida, sends
L2CAP_LE_CREDITS and frees the ident right away, since the command has
no response. The RX path frees idents in l2cap_put_ident() under
conn->lock. That only works if the credits path holds conn->lock too,
so that no response can be processed between the allocation and the
free.
The RX path does, but l2cap_sock_recvmsg() calls l2cap_publish_rx_avail()
-> l2cap_chan_rx_avail() -> l2cap_chan_le_send_credits() with only the
socket lock held. If the remote answers the credits packet with
L2CAP_COMMAND_REJ, l2cap_put_ident() can free the ident first, and the
credits path then frees it again:
ida_free called for id=3 which is not allocated.
WARNING: lib/idr.c:594 at ida_free+0x24c/0x2d4 lib/idr.c:594
Call trace:
ida_free+0x24c/0x2d4 lib/idr.c:594
l2cap_chan_le_send_credits+0x17c/0x29c net/bluetooth/l2cap_core.c:7113
l2cap_chan_rx_avail+0xb4/0x134 net/bluetooth/l2cap_core.c:7126
l2cap_publish_rx_avail+0x110/0x168 net/bluetooth/l2cap_sock.c
l2cap_sock_recvmsg+0x280/0x7b8 net/bluetooth/l2cap_sock.c:1317
The same unlocked call also updates chan->rx_credits and reads chan->sdu
concurrently with the RX path.
Publish rx_avail from recvmsg under conn->lock and chan->lock, taken with
l2cap_chan_lock_conn() as l2cap_sock_defer() already does, before taking
the socket lock to keep the conn->lock -> chan->lock -> sk_lock order.
Assert conn->lock in l2cap_chan_le_send_credits() so that an unlocked
caller is caught by lockdep.
Fixes: 6e1930ece855 ("Bluetooth: L2CAP: fix tx ident leak for commands without a response")
Reported-by: syzbot+9dc8780713b11155dd74@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9dc8780713b11155dd74
Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Stable-dep-of: 06b6fbe05f5c ("Bluetooth: L2CAP: Use a reserved ident for L2CAP_LE_CREDITS")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/l2cap_core.c | 3 +++
net/bluetooth/l2cap_sock.c | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7ac5dd0fb6fe4..eeeddb3ced8cd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6967,6 +6967,9 @@ static void l2cap_chan_le_send_credits(struct l2cap_chan *chan)
pkt.cid = cpu_to_le16(chan->scid);
pkt.credits = cpu_to_le16(return_credits);
+ /* Keeps l2cap_put_ident() from releasing ident before we do */
+ lockdep_assert_held(&conn->lock);
+
ident = l2cap_get_ident(conn);
l2cap_send_cmd(conn, ident, L2CAP_LE_CREDITS, sizeof(pkt), &pkt);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index f413e5beab9e4..c7fe12445df42 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1292,6 +1292,7 @@ static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
{
struct sock *sk = sock->sk;
struct l2cap_pinfo *pi = l2cap_pi(sk);
+ bool have_conn;
int err;
if (unlikely(flags & MSG_ERRQUEUE))
@@ -1312,9 +1313,12 @@ static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
pi->chan->mode != L2CAP_MODE_EXT_FLOWCTL)
return err;
- lock_sock(sk);
-
+ /* Returning credits must be serialized with the RX path */
+ have_conn = l2cap_chan_lock_conn(pi->chan);
l2cap_publish_rx_avail(pi->chan);
+ l2cap_chan_unlock_conn(pi->chan, have_conn);
+
+ lock_sock(sk);
/* Attempt to put pending rx data in the socket buffer */
while (!list_empty(&pi->rx_busy)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 092/742] Bluetooth: L2CAP: Use a reserved ident for L2CAP_LE_CREDITS
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (88 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 091/742] Bluetooth: L2CAP: return LE credits from recvmsg under the conn lock Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 093/742] kho: do not expose incoming sub-blob contents in debugfs Greg Kroah-Hartman
` (67 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+9dc8780713b11155dd74,
Nguyen Ngoc Thang, Luiz Augusto von Dentz, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
[ Upstream commit 06b6fbe05f5c81654815ec8d864d792a226cbdac ]
L2CAP_LE_CREDITS has no response, so an ident taken from conn->tx_ida for
it is never released by l2cap_put_ident() and l2cap_chan_le_send_credits()
has to free it right away after sending, otherwise the range is exhausted
after 254 packets and credits would be sent with the invalid ident 0, which
some remote stacks ignore, stalling the channel.
tx_ida only exists to track requests awaiting a response, so a command
without one has no business in it: every credit update allocates and
frees an ident, and the ident is visible in tx_ida while the credits are
in flight, so an answer to them (a L2CAP_COMMAND_REJ) is processed by
l2cap_put_ident() like the answer to a request.
Using a counter that doesn't consult tx_ida is not an option either, it can
return the ident of a request still outstanding, and a reject of the
credits would then release that request's ident and close its channel in
l2cap_le_command_rej().
Reserve ident 255 for L2CAP_LE_CREDITS instead: l2cap_get_ident() never
returns it (the BR/EDR range already ends at 128), so it can't collide with
any request, it doesn't have to be tracked in conn->tx_ida, and a reject of
it matches no outstanding request.
Fixes: 6e1930ece855 ("Bluetooth: L2CAP: fix tx ident leak for commands without a response")
Reported-by: syzbot+9dc8780713b11155dd74@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9dc8780713b11155dd74
Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/l2cap.h | 5 +++++
net/bluetooth/l2cap_core.c | 28 +++++++++++-----------------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b864d50bb5e59..9dc7fc5b2a275 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -45,6 +45,11 @@
#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
#define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */
#define L2CAP_LE_MIN_MTU 23
+
+/* Identifier used by L2CAP_LE_CREDITS, it has no response so it is not
+ * tracked in conn->tx_ida and is never allocated for any other command.
+ */
+#define L2CAP_IDENT_LE_CREDITS 255
#define L2CAP_ECRED_CONN_SCID_MAX 5
#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index eeeddb3ced8cd..59ae6ee4ff345 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1022,9 +1022,11 @@ static int l2cap_get_ident(struct l2cap_conn *conn)
u8 max;
int ident;
- /* LE link does not support tools like l2ping so use the full range */
+ /* LE link does not support tools like l2ping so use the full range,
+ * except for L2CAP_IDENT_LE_CREDITS which is reserved.
+ */
if (conn->hcon->type == LE_LINK)
- max = 255;
+ max = L2CAP_IDENT_LE_CREDITS - 1;
/* Get next available identificator.
* 1 - 128 are used by kernel.
* 129 - 199 are reserved.
@@ -6949,7 +6951,6 @@ static void l2cap_chan_le_send_credits(struct l2cap_chan *chan)
struct l2cap_conn *conn = chan->conn;
struct l2cap_le_credits pkt;
u16 return_credits = l2cap_le_rx_credits(chan);
- int ident;
if (chan->mode != L2CAP_MODE_LE_FLOWCTL &&
chan->mode != L2CAP_MODE_EXT_FLOWCTL)
@@ -6967,21 +6968,14 @@ static void l2cap_chan_le_send_credits(struct l2cap_chan *chan)
pkt.cid = cpu_to_le16(chan->scid);
pkt.credits = cpu_to_le16(return_credits);
- /* Keeps l2cap_put_ident() from releasing ident before we do */
- lockdep_assert_held(&conn->lock);
-
- ident = l2cap_get_ident(conn);
-
- l2cap_send_cmd(conn, ident, L2CAP_LE_CREDITS, sizeof(pkt), &pkt);
-
- /* L2CAP_LE_CREDITS has no response so the ident is never released by
- * l2cap_put_ident() - release it right away, otherwise the tx_ida
- * range is exhausted after 254 packets and from then on credits are
- * sent with the invalid ident 0, which some remote stacks ignore,
- * stalling the channel.
+ /* L2CAP_LE_CREDITS has no response so it uses the reserved ident rather
+ * than one from conn->tx_ida, which would have to be released right
+ * away or would be exhausted after 254 packets, and could otherwise
+ * collide with the ident of a request still outstanding. A reject of it
+ * can't match any request either.
*/
- if (ident > 0)
- ida_free(&conn->tx_ida, ident);
+ l2cap_send_cmd(conn, L2CAP_IDENT_LE_CREDITS, L2CAP_LE_CREDITS,
+ sizeof(pkt), &pkt);
}
void l2cap_chan_rx_avail(struct l2cap_chan *chan, ssize_t rx_avail)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 093/742] kho: do not expose incoming sub-blob contents in debugfs
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (89 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 092/742] Bluetooth: L2CAP: Use a reserved ident for L2CAP_LE_CREDITS Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 094/742] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
` (66 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pasha Tatashin, Long Wei,
Pratyush Yadav, Mike Rapoport (Microsoft), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Wei <longwei27@huawei.com>
[ Upstream commit fa1c0f103fd68558613d3df76e222463c6e4fc37 ]
Incoming sub-blob pages are owned by their consumers and have independent
lifetimes. Some consumers, such as LUO, restore and free their state in
early_initcall, i.e. before kho_init() (fs_initcall) builds the debugfs
view:
early_initcall: luo_early_startup()
-> kho_retrieve_subtree("LUO")
-> kho_restore_free(luo_ser) /* page is freed */
fs_initcall: kho_init()
-> kho_in_debugfs_init()
-> phys_to_virt(luo_ser_phys)
-> debugfs_create_blob("LUO", ...)
debugfs therefore ends up pointing at a page that was already handed back
to the page allocator, and reading the file triggers a use-after-free:
# cat /sys/kernel/debug/kho/in/sub_fdts/LUO
==================================================================
BUG: KASAN: use-after-free in _copy_to_user+0x37/0x60
Read of size 32 at addr ffff88810309c000 by task cat/27436
Call Trace:
<TASK>
kasan_report+0xb9/0xf0
kasan_check_range+0x100/0x1b0
_copy_to_user+0x37/0x60
simple_read_from_buffer+0x77/0xd0
read_file_blob+0x75/0xa0
vfs_read+0x12d/0x520
ksys_read+0xc3/0x160
do_syscall_64+0x97/0x4b0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1fd
pfn:0x10309c
flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
page_type: f0(buddy)
==================================================================
The page is already in the buddy allocator (page_type: f0(buddy),
refcount 0), which confirms it was freed before the debugfs view was
created.
KHO does not own these pages, so it cannot safely expose their contents at
all. Drop the in/sub_fdts directory. The incoming FDT is reserved by KHO
and remains exposed as in/fdt, where the same metadata is available.
The incoming sub-blob debugfs directory is gone, so remove its description
from the KHO admin guide as well.
Note that in/sub_fdts has exposed memory KHO does not own since
commit c609c144b0e8 ("kexec: add KHO parsing support"), but the
use-after-free only became reachable after commit d376e4b55c9a0
("liveupdate: centralize state management into struct luo_ser") which
added kho_restore_free()
Fixes: d376e4b55c9a0 ("liveupdate: centralize state management into struct luo_ser")
Acked-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Long Wei <longwei27@huawei.com>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Link: https://patch.msgid.link/20261119095937.826980-1-longwei27@huawei.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/admin-guide/mm/kho.rst | 4 --
kernel/liveupdate/kexec_handover_debugfs.c | 47 +---------------------
2 files changed, 2 insertions(+), 49 deletions(-)
diff --git a/Documentation/admin-guide/mm/kho.rst b/Documentation/admin-guide/mm/kho.rst
index 2c26e560bd78a..2f339cf152812 100644
--- a/Documentation/admin-guide/mm/kho.rst
+++ b/Documentation/admin-guide/mm/kho.rst
@@ -117,7 +117,3 @@ stabilized.
kernel's state is in this file in the format of flattened
device tree. This file may disappear when all consumers of
it finished to interpret their metadata.
-
-``/sys/kernel/debug/kho/in/sub_fdts/``
- Similar to ``kho/out/sub_fdts/``, but contains sub blobs
- of KHO producers passed from the old kernel.
diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
index 257ee8a52be66..cb330c1a01ac5 100644
--- a/kernel/liveupdate/kexec_handover_debugfs.c
+++ b/kernel/liveupdate/kexec_handover_debugfs.c
@@ -10,7 +10,6 @@
#define pr_fmt(fmt) "KHO: " fmt
#include <linux/init.h>
-#include <linux/io.h>
#include <linux/libfdt.h>
#include <linux/mm.h>
#include <linux/kho/abi/kexec_handover.h>
@@ -97,8 +96,8 @@ DEFINE_SHOW_ATTRIBUTE(scratch_len);
__init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
{
- struct dentry *dir, *sub_fdt_dir;
- int err, child;
+ struct dentry *dir;
+ int err;
INIT_LIST_HEAD(&dbg->fdt_list);
@@ -108,54 +107,12 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
goto err_out;
}
- sub_fdt_dir = debugfs_create_dir("sub_fdts", dir);
- if (IS_ERR(sub_fdt_dir)) {
- err = PTR_ERR(sub_fdt_dir);
- goto err_rmdir;
- }
-
err = __kho_debugfs_blob_add(&dbg->fdt_list, dir, "fdt", fdt,
fdt_totalsize(fdt));
if (err)
goto err_rmdir;
- fdt_for_each_subnode(child, fdt, 0) {
- int len = 0;
- const char *name = fdt_get_name(fdt, child, NULL);
- const u64 *blob_phys;
- const u64 *blob_size;
- void *blob;
-
- blob_phys = fdt_getprop(fdt, child,
- KHO_SUB_TREE_PROP_NAME, &len);
- if (!blob_phys)
- continue;
- if (len != sizeof(*blob_phys)) {
- pr_warn("node %s prop %s has invalid length: %d\n",
- name, KHO_SUB_TREE_PROP_NAME, len);
- continue;
- }
-
- blob_size = fdt_getprop(fdt, child,
- KHO_SUB_TREE_SIZE_PROP_NAME, &len);
- if (!blob_size || len != sizeof(*blob_size)) {
- pr_warn("node %s missing or invalid %s property\n",
- name, KHO_SUB_TREE_SIZE_PROP_NAME);
- continue;
- }
-
- blob = phys_to_virt(*blob_phys);
- err = __kho_debugfs_blob_add(&dbg->fdt_list, sub_fdt_dir, name,
- blob, *blob_size);
- if (err) {
- pr_warn("failed to add blob %s to debugfs: %pe\n",
- name, ERR_PTR(err));
- continue;
- }
- }
-
dbg->dir = dir;
- dbg->sub_fdt_dir = sub_fdt_dir;
return;
err_rmdir:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 094/742] phy: rockchip: snps-pcie3: Raise the SRAM init timeout
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (90 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 093/742] kho: do not expose incoming sub-blob contents in debugfs Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 095/742] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
` (65 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sebastian Reichel,
Manivannan Sadhasivam, Shawn Lin, Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <shawn.lin@rock-chips.com>
[ Upstream commit 7c2a2268bd3ddf3b2c674ebb7557ae24c22309d7 ]
The SRAM initialization of the PCIe3 PHY may take longer than the 500us
currently allowed, especially on a slow power-up such as at low
temperature. In that case the driver reports
lock failed 0x..., check input refclk and power supply
even though the input refclk and power supply are fine.
Raise the timeout to 20ms and use a named constant for it, applied to
both the RK3568 and RK3588 paths.
A non-zero sleep interval (1ms) is passed to the polling helpers so the
CPU is yielded between reads. With sleep_us == 0 the helpers tight-loop,
which would otherwise burn the CPU during the now much longer wait.
Fixes: 2e9bffc4f713 ("phy: rockchip: Support PCIe v3")
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Link: https://patch.msgid.link/20261102005129.3745527-1-shawn.lin@rock-chips.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
index 4e8ffd173096a..ce7d8db2a7c5f 100644
--- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
+++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
@@ -18,6 +18,9 @@
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>
+#include <linux/units.h>
+
+#define RK_PCIE_SRAM_INIT_TIMEOUT_US (20 * USEC_PER_MSEC)
/* Register for RK3568 */
#define GRF_PCIE30PHY_CON1 0x4
@@ -127,7 +130,7 @@ static int rockchip_p3phy_rk3568_init(struct rockchip_p3phy_priv *priv)
ret = regmap_read_poll_timeout(priv->phy_grf,
GRF_PCIE30PHY_STATUS0,
reg, SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
if (ret)
dev_err(&priv->phy->dev, "%s: lock failed 0x%x, check input refclk and power supply\n",
__func__, reg);
@@ -187,11 +190,11 @@ static int rockchip_p3phy_rk3588_init(struct rockchip_p3phy_priv *priv)
ret = regmap_read_poll_timeout(priv->phy_grf,
RK3588_PCIE3PHY_GRF_PHY0_STATUS1,
reg, RK3588_SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
ret |= regmap_read_poll_timeout(priv->phy_grf,
RK3588_PCIE3PHY_GRF_PHY1_STATUS1,
reg, RK3588_SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
if (ret)
dev_err(&priv->phy->dev, "lock failed 0x%x, check input refclk and power supply\n",
reg);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 095/742] Bluetooth: mgmt: Fix read_index_list() buffer overflow
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (91 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 094/742] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 096/742] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
` (64 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit cfdd650c5dabbd2f59a0e916aa8ef3f1965a3b4b ]
The first pass counts only configured controllers, but HCI_UNCONFIGURED
can change before the second pass, which may then write more entries than
were allocated. Size the buffer from the total number of controllers as
read_unconf_index_list() already does.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-7841362e-9b8f-465f-aa22-e99c315231e2
Fixes: 73d1df2a7a10 ("Bluetooth: Add support for Read Unconfigured Index List command")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a287dd4bb26e3..d7f54056d0918 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -444,10 +444,8 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,
read_lock(&hci_dev_list_lock);
count = 0;
- list_for_each_entry(d, &hci_dev_list, list) {
- if (!hci_dev_test_flag(d, HCI_UNCONFIGURED))
- count++;
- }
+ list_for_each_entry(d, &hci_dev_list, list)
+ count++;
rp_len = sizeof(*rp) + (2 * count);
rp = kmalloc(rp_len, GFP_ATOMIC);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 096/742] Bluetooth: hci_core: Take req_sync lock in hci_power_on()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (92 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 095/742] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 097/742] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
` (63 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 6a296a4658124490d7dddd2b751e5f9ae5c5aec7 ]
hci_powered_update_sync() issues synchronous HCI commands but was called
without hci_req_sync_lock(), racing with other request users.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-1baf7393-3aeb-4fa5-806f-19cea743b9f3
Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8784c28297ac2..6433c388050fa 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -915,7 +915,9 @@ static void hci_power_on(struct work_struct *work)
hci_dev_test_flag(hdev, HCI_MGMT) &&
hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) {
cancel_delayed_work(&hdev->power_off);
+ hci_req_sync_lock(hdev);
err = hci_powered_update_sync(hdev);
+ hci_req_sync_unlock(hdev);
mgmt_power_on(hdev, err);
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 097/742] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (93 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 096/742] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 098/742] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
` (62 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8984b72f9508b2d03c58a82d73881b5e1e5f5bc4 ]
hci_disable_ext_adv_instance_sync() calls hci_find_adv_instance() and
dereferences the instance without hdev->lock, racing with the removal of
the instance. Look the instance up under the lock and only use the values
copied while it is held.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-a364929c-cd00-492a-a83c-5425d042b09f
Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 8f90e5ffebd47..6227a07fc9566 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1224,16 +1224,26 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
struct hci_cp_ext_adv_set *set;
u8 data[sizeof(*cp) + sizeof(*set) * 1];
u8 size;
- struct adv_info *adv = NULL;
+ u8 handle = instance;
/* If request specifies an instance that doesn't exist, fail */
if (instance > 0) {
+ struct adv_info *adv;
+ bool enabled = false;
+
+ hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
+ if (adv) {
+ enabled = adv->enabled;
+ handle = adv->handle;
+ }
+ hci_dev_unlock(hdev);
+
if (!adv)
return -EINVAL;
/* If not enabled there is nothing to do */
- if (!adv->enabled)
+ if (!enabled)
return 0;
}
@@ -1246,7 +1256,7 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
cp->num_of_sets = !!instance;
cp->enable = 0x00;
- set->handle = adv ? adv->handle : instance;
+ set->handle = handle;
size = sizeof(*cp) + sizeof(*set) * cp->num_of_sets;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 098/742] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (94 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 097/742] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 099/742] Bluetooth: SMP: Serialize link key updates from smp_notify_keys() Greg Kroah-Hartman
` (61 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit c592dfe9637c65eeaff4c9f6fd869f39ad7ae472 ]
The advertising instance returned by hci_find_adv_instance() was
dereferenced without hdev->lock and could be freed concurrently.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-616b1f8e-06ec-4634-a907-5eb4e82f66df
Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6227a07fc9566..adae6e2fee1e1 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2129,9 +2129,13 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
if (hdev->adv_instance_timeout)
return -EBUSY;
+ hci_dev_lock(hdev);
+
adv = hci_find_adv_instance(hdev, instance);
- if (!adv)
+ if (!adv) {
+ hci_dev_unlock(hdev);
return -ENOENT;
+ }
/* A zero timeout means unlimited advertising. As long as there is
* only one instance, duration should be ignored. We still set a timeout
@@ -2161,6 +2165,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
secs_to_jiffies(timeout));
}
+ hci_dev_unlock(hdev);
+
/* If we're just re-scheduling the same instance again then do not
* execute any HCI commands. This happens when a single instance is
* being advertised.
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 099/742] Bluetooth: SMP: Serialize link key updates from smp_notify_keys()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (95 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 098/742] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 100/742] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
` (60 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit e428ab70fb3398e835e5d70ba4839e7c06583b83 ]
smp_notify_keys() runs from the L2CAP RX path without hdev->lock, yet
hci_add_link_key() and the debug key removal modify hdev->link_keys and
dereference entries returned by hci_find_link_key(), so a concurrent
unpair or Load Link Keys can free the entry being updated.
hdev->lock can't be taken there since it is ordered before the l2cap
channel lock held by the SMP receive path (see smp_user_confirm_reply()).
Add a dedicated link_keys_lock protecting the writers of hdev->link_keys
(add, remove and clear). SMP holds it while it adds the key, notifies
mgmt and removes a debug key, so the key can't go away meanwhile, and
the debug key removed by hci_link_key_notify_evt() is deleted by
reference with hci_del_link_key() since a lookup by address skips the
keys that are blocked.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-7482a666-d2a0-44a4-9e0d-05354860a5fa
Fixes: 6a77083af57f ("Bluetooth: Add support for LE SC key generation")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/hci_core.h | 6 ++++
net/bluetooth/hci_core.c | 62 +++++++++++++++++++++++++++++---
net/bluetooth/hci_event.c | 3 +-
net/bluetooth/smp.c | 11 ++++--
4 files changed, 74 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3a1169e19eb80..d8aa1f763f5b4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -560,6 +560,8 @@ struct hci_dev {
struct list_head accept_list;
struct list_head uuids;
struct list_head link_keys;
+ /* Serializes the writers of link_keys, see hci_add_link_key() */
+ struct mutex link_keys_lock;
struct list_head long_term_keys;
struct list_head identity_resolving_keys;
struct mutex remote_oob_lock;
@@ -1874,6 +1876,10 @@ struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
void hci_uuids_clear(struct hci_dev *hdev);
void hci_link_keys_clear(struct hci_dev *hdev);
+struct link_key *__hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent);
+void hci_del_link_key(struct hci_dev *hdev, struct link_key *key);
u8 *hci_conn_key_enc_size(struct hci_conn *conn);
struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 6433c388050fa..ed9a83777af0d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1017,10 +1017,14 @@ void hci_link_keys_clear(struct hci_dev *hdev)
{
struct link_key *key, *tmp;
+ mutex_lock(&hdev->link_keys_lock);
+
list_for_each_entry_safe(key, tmp, &hdev->link_keys, list) {
list_del_rcu(&key->list);
kfree_rcu(key, rcu);
}
+
+ mutex_unlock(&hdev->link_keys_lock);
}
void hci_smp_ltks_clear(struct hci_dev *hdev)
@@ -1237,13 +1241,16 @@ struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
return irk_to_return;
}
-struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
- bdaddr_t *bdaddr, u8 *val, u8 type,
- u8 pin_len, bool *persistent)
+/* This function requires the caller holds hdev->link_keys_lock */
+struct link_key *__hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent)
{
struct link_key *key, *old_key;
u8 old_key_type;
+ lockdep_assert_held(&hdev->link_keys_lock);
+
old_key = hci_find_link_key(hdev, bdaddr);
if (old_key) {
old_key_type = old_key->type;
@@ -1286,6 +1293,26 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
return key;
}
+/* The writers of hdev->link_keys are serialized with hdev->link_keys_lock
+ * so the list can be modified without hdev->lock (e.g. from SMP, where it
+ * can't be taken after the l2cap channel lock). The returned key is only
+ * safe to use while hdev->lock is held, callers without it must use
+ * __hci_add_link_key() and keep hdev->link_keys_lock while using the key.
+ */
+struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent)
+{
+ struct link_key *key;
+
+ mutex_lock(&hdev->link_keys_lock);
+ key = __hci_add_link_key(hdev, conn, bdaddr, val, type, pin_len,
+ persistent);
+ mutex_unlock(&hdev->link_keys_lock);
+
+ return key;
+}
+
struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type, u8 type, u8 authenticated,
u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand)
@@ -1347,18 +1374,44 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
{
struct link_key *key;
+ mutex_lock(&hdev->link_keys_lock);
+
key = hci_find_link_key(hdev, bdaddr);
- if (!key)
+ if (!key) {
+ mutex_unlock(&hdev->link_keys_lock);
return -ENOENT;
+ }
BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del_rcu(&key->list);
kfree_rcu(key, rcu);
+ mutex_unlock(&hdev->link_keys_lock);
+
return 0;
}
+/* Remove a key previously returned by hci_add_link_key(), unlike
+ * hci_remove_link_key() this also works for keys that are blocked.
+ */
+void hci_del_link_key(struct hci_dev *hdev, struct link_key *key)
+{
+ struct link_key *k;
+
+ mutex_lock(&hdev->link_keys_lock);
+
+ list_for_each_entry(k, &hdev->link_keys, list) {
+ if (k == key) {
+ list_del_rcu(&key->list);
+ kfree_rcu(key, rcu);
+ break;
+ }
+ }
+
+ mutex_unlock(&hdev->link_keys_lock);
+}
+
int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type)
{
struct smp_ltk *k, *tmp;
@@ -2501,6 +2554,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
hdev->def_page_scan_window = 0x0012;
mutex_init(&hdev->lock);
+ mutex_init(&hdev->link_keys_lock);
mutex_init(&hdev->req_lock);
mutex_init(&hdev->mgmt_pending_lock);
mutex_init(&hdev->remote_oob_lock);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index fd5c185bb10bf..91e3c2ad3898c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4957,8 +4957,7 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, void *data,
*/
if (key->type == HCI_LK_DEBUG_COMBINATION &&
!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS)) {
- list_del_rcu(&key->list);
- kfree_rcu(key, rcu);
+ hci_del_link_key(hdev, key);
goto unlock;
}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 4af7fa7f4a8e1..152ce3cfa0090 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1090,8 +1090,13 @@ static void smp_notify_keys(struct l2cap_conn *conn)
else
type = HCI_LK_UNAUTH_COMBINATION_P256;
- key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
- smp->link_key, type, 0, &persistent);
+ /* hdev->lock can't be taken here since it is ordered before
+ * the l2cap channel lock held by the caller.
+ */
+ mutex_lock(&hdev->link_keys_lock);
+
+ key = __hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
+ smp->link_key, type, 0, &persistent);
if (key) {
mgmt_new_link_key(hdev, key, persistent);
@@ -1104,6 +1109,8 @@ static void smp_notify_keys(struct l2cap_conn *conn)
kfree_rcu(key, rcu);
}
}
+
+ mutex_unlock(&hdev->link_keys_lock);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 100/742] Bluetooth: SMP: Check smp_data before using SMP_DEV()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (96 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 099/742] Bluetooth: SMP: Serialize link key updates from smp_notify_keys() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 101/742] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
` (59 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit e8764a6946341e9ee809393386e7b815179c5f5f ]
hdev->smp_data is NULL when the SMP channel could not be registered, so
receiving a Pairing Request/Response with the OOB flag set would
dereference NULL through SMP_DEV().
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-9bc9da90-02a8-4a87-a603-87d0a4cf464c
Fixes: 94f14e472812 ("Bluetooth: SMP: Fix trying to use non-existent local OOB data")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/smp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 152ce3cfa0090..ae71a754d176a 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1759,7 +1759,8 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use.
*/
- if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
+ if (req->oob_flag == SMP_OOB_PRESENT && hdev->smp_data &&
+ SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
/* SMP over BR/EDR requires special treatment */
@@ -1945,7 +1946,8 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use.
*/
- if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
+ if (rsp->oob_flag == SMP_OOB_PRESENT && hdev->smp_data &&
+ SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
smp->prsp[0] = SMP_CMD_PAIRING_RSP;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 101/742] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (97 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 100/742] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 102/742] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable Greg Kroah-Hartman
` (58 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8a119ba64f33dd9ab265d3b978f7811a80b7fe8a ]
smp_force_bredr() created a BR/EDR SMP channel even when the controller
was powered off or not LE capable, leaving a stale channel that
smp_register() later warns about and leaks. Only create it when SMP is
registered and guard the removal; smp_register() creates it on power on
if the flag is set. Since smp_unregister() runs with hdev->lock take it
around smp_register() as well so they can't race with each other nor with
smp_force_bredr().
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-a921c99c-0b41-485c-91a4-1c6e54b45b0b
Fixes: 300acfdec916 ("Bluetooth: Introduce force_bredr_smp debugfs option for testing")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 2 ++
net/bluetooth/smp.c | 20 ++++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index adae6e2fee1e1..970e16e64461f 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3814,7 +3814,9 @@ int hci_powered_update_sync(struct hci_dev *hdev)
* registration is required so that LE SMP can clearly decide if
* the public address or static address is used.
*/
+ hci_dev_lock(hdev);
smp_register(hdev);
+ hci_dev_unlock(hdev);
err = hci_write_ssp_mode_sync(hdev, 0x01);
if (err)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ae71a754d176a..ae94d33d020fa 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3368,20 +3368,28 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
return -EALREADY;
+ /* The channels are only registered while the controller is powered
+ * and LE capable. Otherwise just record the flag, smp_register() will
+ * create the BR/EDR channel on the next power on.
+ */
if (enable) {
struct l2cap_chan *chan;
- chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
- if (IS_ERR(chan))
- return PTR_ERR(chan);
+ if (hdev->smp_data && !hdev->smp_bredr_data) {
+ chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
+ if (IS_ERR(chan))
+ return PTR_ERR(chan);
- hdev->smp_bredr_data = chan;
+ hdev->smp_bredr_data = chan;
+ }
} else {
struct l2cap_chan *chan;
chan = hdev->smp_bredr_data;
- hdev->smp_bredr_data = NULL;
- smp_del_chan(chan);
+ if (chan) {
+ hdev->smp_bredr_data = NULL;
+ smp_del_chan(chan);
+ }
}
hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 102/742] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (98 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 101/742] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 103/742] s390/cert_store: Hold keyring->sem while reading the keyring Greg Kroah-Hartman
` (57 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit ad7c1f067df2772d73a3a34218a8f5db57ceb41c ]
hci_cc_le_set_ext_adv_enable() read num_of_sets and the set entries from
the last sent command without checking its length.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-42bcc244-62e6-4295-802c-f9a512ca49a3
Fixes: de181e887ac2 ("Bluetooth: Impmlement extended adv enable")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_event.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 91e3c2ad3898c..6450f8f5a5ab8 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1671,14 +1671,16 @@ static u8 hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev, void *data,
struct hci_cp_ext_adv_set *set;
struct adv_info *adv = NULL, *n;
struct hci_ev_status *rp = data;
+ size_t len;
bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
if (rp->status)
return rp->status;
- cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE);
- if (!cp)
+ cp = hci_sent_cmd_data_len(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, &len);
+ if (!cp || len < sizeof(*cp) ||
+ len < sizeof(*cp) + cp->num_of_sets * sizeof(*set))
return rp->status;
set = (void *)cp->data;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 103/742] s390/cert_store: Hold keyring->sem while reading the keyring
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (99 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 102/742] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 104/742] s390/cert_store: Fix return code handling in invalidate_keyring_keys() Greg Kroah-Hartman
` (56 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Jarkko Sakkinen,
Heiko Carstens, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
[ Upstream commit 008b903f55eb4bdb1af77070bb93e6e1dfa9145d ]
invalidate_keyring_keys() does not hold keyring->sem while calling
keyring_read(), which is contrary to what keyring assumes from its callers,
and can lead to recurring bugs.
KEY_FLAG_KEEP alone does not protect from e.g. the following call path:
1. keyctl_keyring_move()
2. key_move()
3. __key_unlink()
Address the issue by guarding the critical section.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index dc1992a675dee..7c8f694731bef 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -18,6 +18,7 @@
#include <linux/keyctl.h>
#include <linux/kobject.h>
#include <linux/module.h>
+#include <linux/rwsem.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
@@ -320,13 +321,17 @@ static int invalidate_keyring_keys(struct key *keyring)
struct key *current_key;
int rc;
- keyring_payload_len = key_type_keyring.read(keyring, NULL, 0);
- num_keys = keyring_payload_len / sizeof(key_serial_t);
- key_array = kzalloc_objs(key_serial_t, num_keys);
- if (!key_array)
- return -ENOMEM;
+ scoped_guard(rwsem_read, &keyring->sem) {
+ keyring_payload_len = key_type_keyring.read(keyring, NULL, 0);
+ num_keys = keyring_payload_len / sizeof(key_serial_t);
+
+ key_array = kzalloc_objs(key_serial_t, num_keys);
+ if (!key_array)
+ return -ENOMEM;
+
+ rc = key_type_keyring.read(keyring, (char *)key_array, keyring_payload_len);
+ }
- rc = key_type_keyring.read(keyring, (char *)key_array, keyring_payload_len);
if (rc != keyring_payload_len) {
pr_dbf_msg("Couldn't read keyring payload");
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 104/742] s390/cert_store: Fix return code handling in invalidate_keyring_keys()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (100 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 103/742] s390/cert_store: Hold keyring->sem while reading the keyring Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 105/742] s390/cert_store: Fix potential use-after-free " Greg Kroah-Hartman
` (55 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 1be070c4dc6edbfb015e72156fadb49fbaef47b9 ]
Add missing error handling in case key_type_keyring.read() returns an
error.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 7c8f694731bef..71f112c414460 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -316,15 +316,16 @@ static struct key *get_user_session_keyring(void)
static int invalidate_keyring_keys(struct key *keyring)
{
unsigned long num_keys, key_index;
- size_t keyring_payload_len;
+ long keyring_payload_len, rc;
key_serial_t *key_array;
struct key *current_key;
- int rc;
scoped_guard(rwsem_read, &keyring->sem) {
keyring_payload_len = key_type_keyring.read(keyring, NULL, 0);
- num_keys = keyring_payload_len / sizeof(key_serial_t);
+ if (keyring_payload_len <= 0)
+ return keyring_payload_len;
+ num_keys = keyring_payload_len / sizeof(key_serial_t);
key_array = kzalloc_objs(key_serial_t, num_keys);
if (!key_array)
return -ENOMEM;
@@ -334,6 +335,7 @@ static int invalidate_keyring_keys(struct key *keyring)
if (rc != keyring_payload_len) {
pr_dbf_msg("Couldn't read keyring payload");
+ rc = rc < 0 ? rc : -EINVAL;
goto out;
}
@@ -345,7 +347,7 @@ static int invalidate_keyring_keys(struct key *keyring)
key_put(current_key);
rc = key_unlink(keyring, current_key);
if (rc) {
- pr_dbf_msg("Couldn't unlink key %08x: %d", current_key->serial, rc);
+ pr_dbf_msg("Couldn't unlink key %08x: %ld", current_key->serial, rc);
break;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 105/742] s390/cert_store: Fix potential use-after-free in invalidate_keyring_keys()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (101 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 104/742] s390/cert_store: Fix return code handling in invalidate_keyring_keys() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 106/742] s390/cert_store: Check key_lookup() return code " Greg Kroah-Hartman
` (54 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 69e0c49331475082e0b92cbf320e3e5a1deb889e ]
Drop the refcount of current_key behind all users of current_key which
dereference it, like e.g. error logging.
Fixes a potential use-after-free bug.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 71f112c414460..e00d8766ffe1f 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -344,12 +344,12 @@ static int invalidate_keyring_keys(struct key *keyring)
pr_dbf_msg("Invalidating key %08x", current_key->serial);
key_invalidate(current_key);
- key_put(current_key);
rc = key_unlink(keyring, current_key);
- if (rc) {
+ if (rc)
pr_dbf_msg("Couldn't unlink key %08x: %ld", current_key->serial, rc);
+ key_put(current_key);
+ if (rc)
break;
- }
}
out:
kfree(key_array);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 106/742] s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (102 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 105/742] s390/cert_store: Fix potential use-after-free " Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 107/742] s390/cert_store: Unlink before invalidate " Greg Kroah-Hartman
` (53 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 2a102f513a68ef6771e1cf107c7f98985686ad71 ]
keyring->sem is released after writing the key serial numbers into
key_array. Keys corresponding to those serial numbers may have been
removed before key_lookup() is called.
Therefore check the return code of key_lookup() before dereferencing it.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index e00d8766ffe1f..87aced367a61f 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -339,8 +339,11 @@ static int invalidate_keyring_keys(struct key *keyring)
goto out;
}
+ rc = 0;
for (key_index = 0; key_index < num_keys; key_index++) {
current_key = key_lookup(key_array[key_index]);
+ if (IS_ERR(current_key))
+ continue;
pr_dbf_msg("Invalidating key %08x", current_key->serial);
key_invalidate(current_key);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 107/742] s390/cert_store: Unlink before invalidate in invalidate_keyring_keys()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (103 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 106/742] s390/cert_store: Check key_lookup() return code " Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 108/742] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring() Greg Kroah-Hartman
` (52 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit a1e3a45cac3d847e8ae81cc7e9db1b7b2c547a0e ]
If a key is invalidated, the key garbage collector may remove its link
from the keyring at any time. If that happens the subsequent key_unlink()
fails.
invalidate_keyring_keys() would then incorrectly return an error, which
would lead to unregistering the cert_store key type.
Unlink the key first and invalidate it afterwards to avoid this race.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 87aced367a61f..a142f46cc82b8 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -346,10 +346,10 @@ static int invalidate_keyring_keys(struct key *keyring)
continue;
pr_dbf_msg("Invalidating key %08x", current_key->serial);
- key_invalidate(current_key);
rc = key_unlink(keyring, current_key);
if (rc)
pr_dbf_msg("Couldn't unlink key %08x: %ld", current_key->serial, rc);
+ key_invalidate(current_key);
key_put(current_key);
if (rc)
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 108/742] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (104 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 107/742] s390/cert_store: Unlink before invalidate " Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 109/742] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring() Greg Kroah-Hartman
` (51 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit f992716c4c767a89b6be32e24ee6e4e41ad99da4 ]
create_cs_keyring() returns cs_keyring with a reference held. On the
success path fill_cs_keyring() never drops it, leaking the reference.
The keyring is kept alive by its link to the session keyring.
Drop the reference after add_certificates_to_keyring() returns.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index a142f46cc82b8..39545f2f3d2ea 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -723,6 +723,7 @@ static int fill_cs_keyring(void)
if (rc)
goto cleanup_cs_keyring;
+ key_put(cs_keyring);
goto out;
cleanup_cs_keyring:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 109/742] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (105 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 108/742] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 110/742] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring() Greg Kroah-Hartman
` (50 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 92d377a611766f6ab7b9a63a530aa7bbd434abbb ]
find_cs_keyring() drops the refcount of cs_keyring before returning it.
Which means that callers operate on potentially already freed memory.
Let find_cs_keyring() return cs_keyring with a reference. Since
cleanup_cs_keys() now performs a balanced put via find_cs_keyring(),
remove the separate cleanup_cs_keyring error label in fill_cs_keyring()
and drop the reference unconditionally instead.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 39545f2f3d2ea..6ff926ca039a2 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -367,17 +367,13 @@ static struct key *find_cs_keyring(void)
cs_keyring_ref = keyring_search(make_key_ref(get_user_session_keyring(), true),
&key_type_keyring, CERT_STORE_KEYRING_NAME,
false);
- if (!IS_ERR(cs_keyring_ref)) {
- cs_keyring = key_ref_to_ptr(cs_keyring_ref);
- key_ref_put(cs_keyring_ref);
- goto found;
- }
+ if (!IS_ERR(cs_keyring_ref))
+ return key_ref_to_ptr(cs_keyring_ref);
+
/* Search default locations: thread, process, session keyrings */
cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
if (IS_ERR(cs_keyring))
return NULL;
- key_put(cs_keyring);
-found:
return cs_keyring;
}
@@ -720,14 +716,12 @@ static int fill_cs_keyring(void)
goto cleanup_keys;
rc = add_certificates_to_keyring(vcssb, cs_keyring);
+ key_put(cs_keyring);
if (rc)
- goto cleanup_cs_keyring;
+ goto cleanup_keys;
- key_put(cs_keyring);
goto out;
-cleanup_cs_keyring:
- key_put(cs_keyring);
cleanup_keys:
cleanup_cs_keys();
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 110/742] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (106 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 109/742] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 111/742] s390/cert_store: Fix error handling of get_user_session_keyring() Greg Kroah-Hartman
` (49 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 1a58d930c82fcaf3a6a9e9daf21c7ae9ee088d7e ]
The local variable cs_keyring in create_cs_keyring() never reuses its
assigned value, therefore remove the static specifier. Callers are
serialized by cs_refresh_lock, so this does not fix a bug.
Even though this is not a bug fix, this contains a Fixes tag since other
commits require this as a prereq.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 6ff926ca039a2..0e084fb79aa26 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -401,7 +401,7 @@ static void cleanup_cs_keys(void)
static struct key *create_cs_keyring(void)
{
- static struct key *cs_keyring;
+ struct key *cs_keyring;
/* Cleanup previous cs_keyring and all associated keys if any. */
cleanup_cs_keys();
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 111/742] s390/cert_store: Fix error handling of get_user_session_keyring()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (107 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 110/742] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 112/742] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring() Greg Kroah-Hartman
` (48 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 8256791b74e701361398a8d0e43c55bdabadc5ca ]
create_cs_keyring(), cleanup_cs_keys(), and find_cs_keyring() all pass
the return value of get_user_session_keyring() to other functions without
checking it. This can lead to dereferencing an error pointer.
Check the return value before using it.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 0e084fb79aa26..5c1140b20012d 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -361,15 +361,18 @@ static int invalidate_keyring_keys(struct key *keyring)
static struct key *find_cs_keyring(void)
{
+ struct key *cs_keyring, *us_keyring;
key_ref_t cs_keyring_ref;
- struct key *cs_keyring;
-
- cs_keyring_ref = keyring_search(make_key_ref(get_user_session_keyring(), true),
- &key_type_keyring, CERT_STORE_KEYRING_NAME,
- false);
- if (!IS_ERR(cs_keyring_ref))
- return key_ref_to_ptr(cs_keyring_ref);
+ us_keyring = get_user_session_keyring();
+ if (!IS_ERR(us_keyring)) {
+ cs_keyring_ref = keyring_search(make_key_ref(us_keyring, true),
+ &key_type_keyring,
+ CERT_STORE_KEYRING_NAME,
+ false);
+ if (!IS_ERR(cs_keyring_ref))
+ return key_ref_to_ptr(cs_keyring_ref);
+ }
/* Search default locations: thread, process, session keyrings */
cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
if (IS_ERR(cs_keyring))
@@ -379,7 +382,7 @@ static struct key *find_cs_keyring(void)
static void cleanup_cs_keys(void)
{
- struct key *cs_keyring;
+ struct key *cs_keyring, *us_keyring;
cs_keyring = find_cs_keyring();
if (!cs_keyring)
@@ -395,21 +398,26 @@ static void cleanup_cs_keys(void)
keyring_clear(cs_keyring);
key_invalidate(cs_keyring);
+ us_keyring = get_user_session_keyring();
+ if (!IS_ERR(us_keyring))
+ key_unlink(us_keyring, cs_keyring);
key_put(cs_keyring);
- key_unlink(get_user_session_keyring(), cs_keyring);
}
static struct key *create_cs_keyring(void)
{
- struct key *cs_keyring;
+ struct key *cs_keyring, *us_keyring;
/* Cleanup previous cs_keyring and all associated keys if any. */
cleanup_cs_keys();
+ us_keyring = get_user_session_keyring();
+ if (IS_ERR(us_keyring))
+ return NULL;
cs_keyring = keyring_alloc(CERT_STORE_KEYRING_NAME, GLOBAL_ROOT_UID,
GLOBAL_ROOT_GID, current_cred(),
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_SET_KEEP,
- NULL, get_user_session_keyring());
+ NULL, us_keyring);
if (IS_ERR(cs_keyring)) {
pr_dbf_msg("Can't allocate cert_store keyring");
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 112/742] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (108 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 111/742] s390/cert_store: Fix error handling of get_user_session_keyring() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 113/742] s390/cert_store: Do not search the process keyrings for the cert_store keyring Greg Kroah-Hartman
` (47 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit aa7ee9e9cf17fcc7b0af55424aba6f0abd065fa7 ]
get_user_session_keyring() drops the reference of the looked up keyring
before returning it. Callers therefore use the keyring without holding a
reference.
Return the keyring with the reference and let callers drop the reference.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 5c1140b20012d..789edf58fa2cb 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -308,7 +308,6 @@ static struct key *get_user_session_keyring(void)
PTR_ERR(us_keyring_ref));
return ERR_PTR(-ENOKEY);
}
- key_ref_put(us_keyring_ref);
return key_ref_to_ptr(us_keyring_ref);
}
@@ -370,6 +369,7 @@ static struct key *find_cs_keyring(void)
&key_type_keyring,
CERT_STORE_KEYRING_NAME,
false);
+ key_put(us_keyring);
if (!IS_ERR(cs_keyring_ref))
return key_ref_to_ptr(cs_keyring_ref);
}
@@ -399,8 +399,10 @@ static void cleanup_cs_keys(void)
keyring_clear(cs_keyring);
key_invalidate(cs_keyring);
us_keyring = get_user_session_keyring();
- if (!IS_ERR(us_keyring))
+ if (!IS_ERR(us_keyring)) {
key_unlink(us_keyring, cs_keyring);
+ key_put(us_keyring);
+ }
key_put(cs_keyring);
}
@@ -418,6 +420,7 @@ static struct key *create_cs_keyring(void)
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_SET_KEEP,
NULL, us_keyring);
+ key_put(us_keyring);
if (IS_ERR(cs_keyring)) {
pr_dbf_msg("Can't allocate cert_store keyring");
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 113/742] s390/cert_store: Do not search the process keyrings for the cert_store keyring
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (109 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 112/742] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 114/742] s390/cert_store: Validate hash length in check_certificate_valid() Greg Kroah-Hartman
` (46 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 5ac71bb84e34337d7be280d2c06ff9cae77b7bcf ]
find_cs_keyring() first searches the user session keyring for the
cert_store keyring, and falls back to request_key(), which searches the
thread, process and session keyrings of the calling task. Any keyring
named "cert_store" found this way is accepted.
cleanup_cs_keys() then invalidates and unlinks all of its keys, and
clears and invalidates the keyring itself, without checking permissions.
If the refresh is triggered by a task which inherited a session keyring
that contains a keyring named "cert_store" not created by this code, this
keyring and its keys are destroyed.
create_cs_keyring() always links the keyring into the user session
keyring, so the first search is sufficient. Remove the request_key()
fallback.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 789edf58fa2cb..1014f62b82a0a 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -360,7 +360,7 @@ static int invalidate_keyring_keys(struct key *keyring)
static struct key *find_cs_keyring(void)
{
- struct key *cs_keyring, *us_keyring;
+ struct key *us_keyring;
key_ref_t cs_keyring_ref;
us_keyring = get_user_session_keyring();
@@ -373,11 +373,7 @@ static struct key *find_cs_keyring(void)
if (!IS_ERR(cs_keyring_ref))
return key_ref_to_ptr(cs_keyring_ref);
}
- /* Search default locations: thread, process, session keyrings */
- cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
- if (IS_ERR(cs_keyring))
- return NULL;
- return cs_keyring;
+ return NULL;
}
static void cleanup_cs_keys(void)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 114/742] s390/cert_store: Validate hash length in check_certificate_valid()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (110 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 113/742] s390/cert_store: Do not search the process keyrings for the cert_store keyring Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 115/742] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb() Greg Kroah-Hartman
` (45 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 8b4e340f7742c8c3b12353e882ad5d4d25c7acc9 ]
Validate that vc_hash_length is SHA256_DIGEST_SIZE before checking the
hash and use sizeof(hash) in memcmp(). This avoids an out-of-bounds
read if vc_hash_length is incorrect.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 1014f62b82a0a..56a16b71a8d7d 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -261,13 +261,11 @@ static int diag320(unsigned long subcode, void *addr)
static int check_certificate_hash(const struct vce *vce)
{
u8 hash[SHA256_DIGEST_SIZE];
- u16 vc_hash_length;
u8 *vce_hash;
vce_hash = (u8 *)vce + vce->vce_hdr.vc_hash_offset;
- vc_hash_length = vce->vce_hdr.vc_hash_length;
sha256((u8 *)vce + vce->vce_hdr.vc_offset, vce->vce_hdr.vc_length, hash);
- if (memcmp(vce_hash, hash, vc_hash_length) == 0)
+ if (memcmp(vce_hash, hash, sizeof(hash)) == 0)
return 0;
pr_dbf_msg("SHA256 hash of received certificate does not match");
@@ -293,6 +291,10 @@ static int check_certificate_valid(const struct vce *vce)
pr_dbf_msg("Hash type is not supported");
return -EINVAL;
}
+ if (vce->vce_hdr.vc_hash_length != SHA256_DIGEST_SIZE) {
+ pr_dbf_msg("Hash length is not supported");
+ return -EINVAL;
+ }
return check_certificate_hash(vce);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 115/742] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (111 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 114/742] s390/cert_store: Validate hash length in check_certificate_valid() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 116/742] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Greg Kroah-Hartman
` (44 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 9d263bd8ddc31c9c3ebe3612df575d70848f5772 ]
Print the correct value for max_vcxe_length.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 56a16b71a8d7d..8b7216710e187 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -225,7 +225,7 @@ static void pr_dbf_vcssb(const struct vcssb *s)
pr_dbf_msg("total_vc_index_count: %u", s->total_vc_index_count);
pr_dbf_msg("max_vc_index_count: %u", s->max_vc_index_count);
pr_dbf_msg("max_vce_length: %u", s->max_vce_length);
- pr_dbf_msg("max_vcxe_length: %u", s->max_vce_length);
+ pr_dbf_msg("max_vcxe_length: %u", s->max_vcxe_length);
pr_dbf_msg("max_single_vcb_length: %u", s->max_single_vcb_length);
pr_dbf_msg("total_vcb_length: %u", s->total_vcb_length);
pr_dbf_msg("max_single_vcxb_length: %u", s->max_single_vcxb_length);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 116/742] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (112 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 115/742] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 117/742] s390/cert_store: Initialize ism array in query_diag320_subcodes() Greg Kroah-Hartman
` (43 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 539cf27f0b090d84438b7da9045a271a947192ed ]
pr_dbf_vce() dumps the last 128 bytes of the certificate data of a
Verification Certificate Entry (VCE) into a debug area.
However the address calculation is wrong: vce_length is the length of
the whole entry including the header, while cert_data_buf starts
behind the header. Therefore the dump starts at the end of the entry
and starts reading behind it.
Dump the last 128 bytes of the entry like intended. Limit dumps to the
data length.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 8b7216710e187..ec5d82aee1c20 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -181,6 +181,7 @@ static void pr_dbf_vce(const struct vce *e)
{
unsigned char vc_name[VC_NAME_LEN_BYTES + 1];
char log_string[VC_NAME_LEN_BYTES + 40];
+ u32 data_len = 0;
pr_dbf_msg("VCE Header:");
pr_dbf_msg("vce_hdr.vce_length: %d", e->vce_hdr.vce_length);
@@ -206,11 +207,13 @@ static void pr_dbf_vce(const struct vce *e)
debug_text_event(cert_store_hexdump, 3, log_string);
/* Certificate data. */
+ if (e->vce_hdr.vce_length > sizeof(e->vce_hdr))
+ data_len = e->vce_hdr.vce_length - sizeof(e->vce_hdr);
debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data start");
- debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, 128);
+ debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, min(data_len, 128U));
debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data end");
- debug_event(cert_store_hexdump, 3,
- (u8 *)e->cert_data_buf + e->vce_hdr.vce_length - 128, 128);
+ if (data_len > 128)
+ debug_event(cert_store_hexdump, 3, (u8 *)e + e->vce_hdr.vce_length - 128, 128);
}
static void pr_dbf_vcssb(const struct vcssb *s)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 117/742] s390/cert_store: Initialize ism array in query_diag320_subcodes()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (113 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 116/742] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 118/742] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
` (42 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 2c1f57bce05244165f406e45982bbcd036071d3b ]
The Installed Subcode Block returned by DIAG 320 subcode 0 may be smaller
than the ism array. Initialize it to avoid copying uninitialized data to
the debug area.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index ec5d82aee1c20..375035da755cf 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -670,7 +670,7 @@ static int add_certificates_to_keyring(struct vcssb *vcssb, struct key *keyring)
*/
static int query_diag320_subcodes(void)
{
- unsigned long ism[ISM_LEN_DWORDS];
+ unsigned long ism[ISM_LEN_DWORDS] = {};
int rc;
rc = diag320(0, ism);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 118/742] Bluetooth: mgmt: Reject zero multi advertising rotation duration
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (114 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 117/742] s390/cert_store: Initialize ism array in query_diag320_subcodes() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 119/742] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
` (41 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 4e0dc0523bd98adbd45ce1c66dd1a96d4f6a3ec9 ]
A zero def_multi_adv_rotation_duration makes
hci_schedule_adv_instance_sync() requeue itself with no delay, spinning
the request workqueue. Reject it in Set Default System Configuration.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-24ecb695-0c5c-408a-a016-a980c3115e95
Fixes: 17896406ff35 ("Bluetooth: implement read/set default system parameters mgmt")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt_config.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/bluetooth/mgmt_config.c b/net/bluetooth/mgmt_config.c
index fdcc752c6f13f..ef1b8da539903 100644
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -224,6 +224,14 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
MGMT_STATUS_INVALID_PARAMS);
}
+ /* A zero rotation duration would make the advertising instance
+ * scheduler requeue itself with no delay.
+ */
+ if (type == 0x000c && !TLV_GET_LE16(buffer))
+ return mgmt_cmd_status(sk, hdev->id,
+ MGMT_OP_SET_DEF_SYSTEM_CONFIG,
+ MGMT_STATUS_INVALID_PARAMS);
+
buffer_left -= exp_len;
buffer += exp_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 119/742] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (115 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 118/742] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 120/742] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
` (40 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit cb3251457da29ac1118f130bf45ac696421594a8 ]
The local EFS values were copied from an on-stack struct even when the
response carried no EFS option. Track whether it was received.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-089f015e-6251-4fea-85ef-7d6761e8c457
Fixes: 66af7aaf9edf ("Bluetooth: EFS: parse L2CAP config response")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/l2cap_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 59ae6ee4ff345..6eb919f943b49 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3805,6 +3805,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
unsigned long val;
struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };
struct l2cap_conf_efs efs;
+ bool remote_efs = false;
BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data);
@@ -3860,6 +3861,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
if (olen != sizeof(efs))
break;
memcpy(&efs, (void *)val, olen);
+ remote_efs = true;
if (chan->local_stype != L2CAP_SERV_NOTRAFIC &&
efs.stype != L2CAP_SERV_NOTRAFIC &&
efs.stype != chan->local_stype)
@@ -3898,7 +3900,8 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
chan->ack_win = min_t(u16, chan->ack_win,
rfc.txwin_size);
- if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
+ if (remote_efs &&
+ test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
chan->local_msdu = le16_to_cpu(efs.msdu);
chan->local_sdu_itime =
le32_to_cpu(efs.sdu_itime);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 120/742] Bluetooth: mgmt: Fix mesh transmission locking and lifetime
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (116 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 119/742] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 121/742] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down() Greg Kroah-Hartman
` (39 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 1d7a527788584e4a88ccc532ed73bfdacd0b1e74 ]
The mesh_pending list is modified under hdev->lock by Mesh Send, but the
cmd_sync callbacks and Mesh Send Cancel add/remove entries and touch
hdev->adv_instances without it, which corrupts the list and the advertising
instances. In addition the queued mesh_send_sync entry holds a raw pointer
to the mesh_tx which a cancel of the transmission can free while the entry
is running, leading to use-after-free.
Fix this by:
- taking hdev->lock around every mesh_pending/adv_instances access in the
cmd_sync callbacks and Mesh Send Cancel, but never across HCI commands;
- queueing the cmd_sync entries with the transmission handle and looking
it up under the lock instead of passing the pointer;
- always sending the first transmission, tracked by HCI_MESH_SENDING which
is only cleared together with the removal of the transmission so Mesh
Send can't start another one in between, and making sure none is left
stranded if queueing fails;
- cancelling a transmission by dequeuing its entry, and the done entry if
it is the one in progress, stopping the done timer, which is queued
with hdev->lock held so a cancel can't miss it;
- not taking hdev->lock from callbacks invoked with -ECANCELED since
those run with the cmd_sync lock held, the transmission is removed by
whoever cancelled the entry;
- flushing the transmissions left, dequeuing the entries still queued for
them and clearing HCI_MESH_SENDING, when the controller is closed (also
when auto powered off) or the index is removed, as nothing is going to
send them and the stale entries would act on the ones started after
the controller is powered on again, and not accepting Mesh Send while
the controller is not powered so none can be left behind;
- not reporting the completion of a transmission that failed to be queued
by Mesh Send itself since userspace wasn't told about its handle;
- not reusing the handle of a transmission still pending when the handle
counter wraps around, now that it is what identifies a transmission.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-4ab89465-fc27-4d91-a870-a8ed49b22e91
Link: https://sashiko.dev/#/bug/linux-ab941894-dbe1-49da-8bac-c52efda6eaee
Link: https://sashiko.dev/#/bug/linux-4016f774-7ac7-4b8a-916f-587ec9d597d4
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_sync.c | 5 +
net/bluetooth/mgmt.c | 301 +++++++++++++++++++++++++------
net/bluetooth/mgmt_util.c | 23 ++-
4 files changed, 267 insertions(+), 63 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d8aa1f763f5b4..4d984ff3ba3a0 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2469,6 +2469,7 @@ void mgmt_index_removed(struct hci_dev *hdev);
void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
void mgmt_power_on(struct hci_dev *hdev, int err);
void __mgmt_power_off(struct hci_dev *hdev);
+void mgmt_mesh_flush(struct hci_dev *hdev);
void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
bool persistent);
void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 970e16e64461f..012ee0b6cc01c 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5782,6 +5782,11 @@ int hci_dev_close_sync(struct hci_dev *hdev)
auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF);
+ /* Nothing is going to send the mesh transmissions left, whether or not
+ * mgmt is told about the controller being powered off.
+ */
+ mgmt_mesh_flush(hdev);
+
if (!auto_off && !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
hci_dev_test_flag(hdev, HCI_MGMT))
__mgmt_power_off(hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d7f54056d0918..83a1454b85b4d 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1081,6 +1081,7 @@ static void discov_off(struct work_struct *work)
static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev);
+/* This function requires the caller holds hdev->lock */
static void mesh_send_complete(struct hci_dev *hdev,
struct mgmt_mesh_tx *mesh_tx, bool silent)
{
@@ -1093,37 +1094,95 @@ static void mesh_send_complete(struct hci_dev *hdev,
mgmt_mesh_remove(mesh_tx);
}
-static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
+/* The cmd_sync entries identify the transmission by handle rather than by
+ * pointer since the mesh_tx can be removed while the entry is queued or
+ * running.
+ */
+#define MESH_TX_DATA(_handle) ((void *)(unsigned long)(_handle))
+#define MESH_TX_HANDLE(_data) ((u8)(unsigned long)(_data))
+
+static int mesh_send_sync(struct hci_dev *hdev, void *data);
+static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err);
+
+/* Start sending the first transmission unless one is already in progress,
+ * HCI_MESH_SENDING is set while the first transmission is being sent.
+ * Completion is not reported for @new, the handle of a transmission userspace
+ * wasn't told about yet.
+ *
+ * This function requires the caller holds hdev->lock.
+ */
+static void __mesh_next(struct hci_dev *hdev, u8 new)
{
struct mgmt_mesh_tx *mesh_tx;
+ int err;
- hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
- if (list_empty(&hdev->adv_instances))
- hci_disable_advertising_sync(hdev);
- mesh_tx = mgmt_mesh_next(hdev, NULL);
-
- if (mesh_tx)
- mesh_send_complete(hdev, mesh_tx, false);
+ while (!hci_dev_test_flag(hdev, HCI_MESH_SENDING)) {
+ mesh_tx = mgmt_mesh_next(hdev, NULL);
+ if (!mesh_tx)
+ return;
- return 0;
+ err = hci_cmd_sync_queue(hdev, mesh_send_sync,
+ MESH_TX_DATA(mesh_tx->handle),
+ mesh_send_start_complete);
+ if (err < 0)
+ mesh_send_complete(hdev, mesh_tx,
+ mesh_tx->handle == new);
+ else
+ hci_dev_set_flag(hdev, HCI_MESH_SENDING);
+ }
}
-static int mesh_send_sync(struct hci_dev *hdev, void *data);
-static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err);
static void mesh_next(struct hci_dev *hdev, void *data, int err)
{
- struct mgmt_mesh_tx *mesh_tx = mgmt_mesh_next(hdev, NULL);
-
- if (!mesh_tx)
+ /* The entry is being cancelled with the cmd_sync lock held, which
+ * can't be taken before hdev->lock.
+ */
+ if (err == -ECANCELED)
return;
- err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
- mesh_send_start_complete);
+ hci_dev_lock(hdev);
+ __mesh_next(hdev, 0);
+ hci_dev_unlock(hdev);
+}
- if (err < 0)
+static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+ u8 handle;
+ bool disable;
+
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_next(hdev, NULL);
+ if (!mesh_tx || !hci_dev_test_flag(hdev, HCI_MESH_SENDING)) {
+ hci_dev_unlock(hdev);
+ return 0;
+ }
+
+ handle = mesh_tx->handle;
+ disable = list_empty(&hdev->adv_instances);
+
+ hci_dev_unlock(hdev);
+
+ if (disable)
+ hci_disable_advertising_sync(hdev);
+
+ hci_dev_lock(hdev);
+
+ /* The transmission can be cancelled meanwhile, in which case whoever
+ * did so already moved on to the next one. HCI_MESH_SENDING is only
+ * cleared with the transmission removed so Mesh Send doesn't start
+ * another one in between.
+ */
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ if (mesh_tx) {
mesh_send_complete(hdev, mesh_tx, false);
- else
- hci_dev_set_flag(hdev, HCI_MESH_SENDING);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ }
+
+ hci_dev_unlock(hdev);
+
+ return 0;
}
static void mesh_send_done(struct work_struct *work)
@@ -1137,6 +1196,33 @@ static void mesh_send_done(struct work_struct *work)
hci_cmd_sync_queue(hdev, mesh_send_done_sync, NULL, mesh_next);
}
+/* Nothing is going to send the transmissions left, e.g. when the controller
+ * is powered off.
+ *
+ * This function requires the caller holds hdev->lock.
+ */
+static void mesh_flush(struct hci_dev *hdev, bool silent)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+
+ /* Stop the timer first, it checks HCI_MESH_SENDING without hdev->lock
+ * so once it is clear and the work is not running anymore nothing can
+ * queue mesh_send_done_sync behind the dequeue below.
+ */
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ cancel_delayed_work_sync(&hdev->mesh_send_done);
+
+ /* Entries still queued would otherwise run after the controller is
+ * powered on again and act on the transmissions started by then. The
+ * destroy callbacks don't take hdev->lock when cancelled.
+ */
+ hci_cmd_sync_dequeue(hdev, mesh_send_sync, NULL, NULL);
+ hci_cmd_sync_dequeue(hdev, mesh_send_done_sync, NULL, NULL);
+
+ while ((mesh_tx = mgmt_mesh_next(hdev, NULL)))
+ mesh_send_complete(hdev, mesh_tx, silent);
+}
+
static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev)
{
if (hci_dev_test_flag(hdev, HCI_MGMT))
@@ -2304,38 +2390,71 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err)
{
- struct mgmt_mesh_tx *mesh_tx = data;
- struct mgmt_cp_mesh_send *send = (void *)mesh_tx->param;
- unsigned long mesh_send_interval;
+ struct mgmt_mesh_tx *mesh_tx;
+ struct mgmt_cp_mesh_send *send;
u8 mgmt_err = mgmt_status(err);
+ /* The entry is being cancelled with the cmd_sync lock held, which
+ * can't be taken before hdev->lock, so leave the removal of the
+ * transmission, and HCI_MESH_SENDING, to whoever cancelled it or to
+ * mgmt_power_off() if the controller is going down.
+ */
+ if (err == -ECANCELED)
+ return;
+
+ hci_dev_lock(hdev);
+
+ /* Cancelled while the entry was running, whoever did so already moved
+ * on to the next transmission.
+ */
+ mesh_tx = mgmt_mesh_find(hdev, MESH_TX_HANDLE(data));
+ if (!mesh_tx) {
+ hci_dev_unlock(hdev);
+ return;
+ }
+
/* Report any errors here, but don't report completion */
if (mgmt_err) {
- hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
/* Send Complete Error Code for handle */
mesh_send_complete(hdev, mesh_tx, false);
- if (err != -ECANCELED)
- mesh_next(hdev, NULL, 0);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ __mesh_next(hdev, 0);
+ hci_dev_unlock(hdev);
return;
}
- mesh_send_interval = msecs_to_jiffies((send->cnt) * 25);
+ /* Queued with hdev->lock held so a cancel can't miss it */
+ send = (void *)mesh_tx->param;
queue_delayed_work(hdev->req_workqueue, &hdev->mesh_send_done,
- mesh_send_interval);
+ msecs_to_jiffies((send->cnt) * 25));
+
+ hci_dev_unlock(hdev);
}
static int mesh_send_sync(struct hci_dev *hdev, void *data)
{
- struct mgmt_mesh_tx *mesh_tx = data;
- struct mgmt_cp_mesh_send *send = (void *)mesh_tx->param;
+ struct mgmt_mesh_tx *mesh_tx;
+ struct mgmt_cp_mesh_send *send;
struct adv_info *adv, *next_instance;
u8 instance = hdev->le_num_of_adv_sets + 1;
u16 timeout, duration;
int err = 0;
- if (hdev->le_num_of_adv_sets <= hdev->adv_instance_cnt)
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_find(hdev, MESH_TX_HANDLE(data));
+ if (!mesh_tx) {
+ hci_dev_unlock(hdev);
+ return -ENOENT;
+ }
+
+ send = (void *)mesh_tx->param;
+
+ if (hdev->le_num_of_adv_sets <= hdev->adv_instance_cnt) {
+ hci_dev_unlock(hdev);
return MGMT_STATUS_BUSY;
+ }
timeout = 1000;
duration = send->cnt * INTERVAL_TO_MS(hdev->le_adv_max_interval);
@@ -2373,6 +2492,8 @@ static int mesh_send_sync(struct hci_dev *hdev, void *data)
instance = 0;
}
+ hci_dev_unlock(hdev);
+
if (instance)
return hci_schedule_adv_instance_sync(hdev, instance, true);
@@ -2416,37 +2537,80 @@ static int mesh_features(struct sock *sk, struct hci_dev *hdev,
return 0;
}
+/* Cancel a single transmission, the handle is looked up again after the
+ * entry has been dequeued since it may be gone or have completed meanwhile.
+ */
+static void mesh_cancel_tx(struct hci_dev *hdev, u8 handle)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+ bool in_progress;
+
+ hci_cmd_sync_dequeue(hdev, mesh_send_sync, MESH_TX_DATA(handle), NULL);
+
+ hci_dev_lock(hdev);
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ in_progress = mesh_tx && hci_dev_test_flag(hdev, HCI_MESH_SENDING) &&
+ mesh_tx == mgmt_mesh_next(hdev, NULL);
+ hci_dev_unlock(hdev);
+
+ /* The done timer may have fired already and be waiting to complete
+ * the transmission in progress, which is being cancelled.
+ */
+ if (in_progress)
+ hci_cmd_sync_dequeue(hdev, mesh_send_done_sync, NULL, NULL);
+
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ if (mesh_tx) {
+ /* If it is the transmission in progress make sure the timer
+ * doesn't complete the next one in its place.
+ */
+ if (hci_dev_test_flag(hdev, HCI_MESH_SENDING) &&
+ mesh_tx == mgmt_mesh_next(hdev, NULL)) {
+ cancel_delayed_work(&hdev->mesh_send_done);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ }
+
+ mesh_send_complete(hdev, mesh_tx, false);
+ }
+
+ hci_dev_unlock(hdev);
+}
+
static int send_cancel(struct hci_dev *hdev, void *data)
{
struct mgmt_pending_cmd *cmd = data;
struct mgmt_cp_mesh_send_cancel *cancel = (void *)cmd->param;
struct mgmt_mesh_tx *mesh_tx;
+ u8 handle;
if (!cancel->handle) {
- do {
+ for (;;) {
+ hci_dev_lock(hdev);
mesh_tx = mgmt_mesh_next(hdev, cmd->sk);
+ handle = mesh_tx ? mesh_tx->handle : 0;
+ hci_dev_unlock(hdev);
- if (mesh_tx) {
- if (!hci_cmd_sync_dequeue(hdev, mesh_send_sync,
- mesh_tx, NULL))
- mesh_send_complete(hdev, mesh_tx, false);
- }
- } while (mesh_tx);
+ if (!mesh_tx)
+ break;
+
+ mesh_cancel_tx(hdev, handle);
+ }
} else {
+ hci_dev_lock(hdev);
mesh_tx = mgmt_mesh_find(hdev, cancel->handle);
+ handle = mesh_tx && mesh_tx->sk == cmd->sk ? mesh_tx->handle : 0;
+ hci_dev_unlock(hdev);
- if (mesh_tx && mesh_tx->sk == cmd->sk) {
- if (!hci_cmd_sync_dequeue(hdev, mesh_send_sync,
- mesh_tx, NULL))
- mesh_send_complete(hdev, mesh_tx, false);
- }
+ if (handle)
+ mesh_cancel_tx(hdev, handle);
}
mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_MESH_SEND_CANCEL,
0, NULL, 0);
- if (!hci_dev_test_flag(hdev, HCI_MESH_SENDING))
- mesh_next(hdev, NULL, 0);
+ mesh_next(hdev, NULL, 0);
return 0;
}
@@ -2497,7 +2661,6 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
struct mgmt_cp_mesh_send *send = data;
struct mgmt_rp_mesh_read_features rp;
u16 expected_len;
- bool sending;
int err = 0;
if (!lmp_le_capable(hdev) ||
@@ -2519,6 +2682,15 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
hci_dev_lock(hdev);
+ /* Transmissions are flushed when the controller is closed, which is
+ * serialized with this by hdev->lock, so none can be left behind.
+ */
+ if (!hdev_is_powered(hdev)) {
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
+ MGMT_STATUS_NOT_POWERED);
+ goto done;
+ }
+
memset(&rp, 0, sizeof(rp));
rp.max_handles = MESH_HANDLES_MAX;
@@ -2530,27 +2702,27 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
goto done;
}
- sending = hci_dev_test_flag(hdev, HCI_MESH_SENDING);
mesh_tx = mgmt_mesh_add(sk, hdev, send, len);
-
- if (!mesh_tx)
+ if (!mesh_tx) {
err = -ENOMEM;
- else if (!sending)
- err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
- mesh_send_start_complete);
+ } else {
+ u8 handle = mesh_tx->handle;
+
+ /* The first transmission is the one queued, which may not be
+ * the one just added.
+ */
+ __mesh_next(hdev, handle);
+
+ /* Queueing failed, the transmission was removed */
+ if (!mgmt_mesh_find(hdev, handle))
+ err = -EIO;
+ }
if (err < 0) {
bt_dev_err(hdev, "Send Mesh Failed %d", err);
err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
MGMT_STATUS_FAILED);
-
- if (mesh_tx) {
- if (sending)
- mgmt_mesh_remove(mesh_tx);
- }
} else {
- hci_dev_set_flag(hdev, HCI_MESH_SENDING);
-
mgmt_cmd_complete(sk, hdev->id, MGMT_OP_MESH_SEND, 0,
&mesh_tx->handle, 1);
}
@@ -9914,7 +10086,8 @@ void mgmt_index_removed(struct hci_dev *hdev)
cancel_delayed_work_sync(&hdev->discov_off);
cancel_delayed_work_sync(&hdev->service_cache);
cancel_delayed_work_sync(&hdev->rpa_expired);
- cancel_delayed_work_sync(&hdev->mesh_send_done);
+
+ mesh_flush(hdev, true);
}
void mgmt_power_on(struct hci_dev *hdev, int err)
@@ -9941,6 +10114,16 @@ void mgmt_power_on(struct hci_dev *hdev, int err)
hci_dev_unlock(hdev);
}
+/* This function requires the caller holds hdev->lock */
+void mgmt_mesh_flush(struct hci_dev *hdev)
+{
+ /* The mesh work is only initialized once mgmt is used */
+ if (!hci_dev_test_flag(hdev, HCI_MGMT))
+ return;
+
+ mesh_flush(hdev, false);
+}
+
void __mgmt_power_off(struct hci_dev *hdev)
{
struct cmd_lookup match = { NULL, hdev };
diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c
index 6ea107c0e0543..d502e6b933e81 100644
--- a/net/bluetooth/mgmt_util.c
+++ b/net/bluetooth/mgmt_util.c
@@ -409,16 +409,31 @@ struct mgmt_mesh_tx *mgmt_mesh_add(struct sock *sk, struct hci_dev *hdev,
void *data, u16 len)
{
struct mgmt_mesh_tx *mesh_tx;
+ u8 handle = hdev->mesh_send_ref;
+ int i;
+
+ /* The handle is all that identifies a transmission, so it must not be
+ * in use by one still pending when the counter wraps around.
+ */
+ for (i = 0; i < 255; i++) {
+ handle++;
+ if (!handle)
+ handle++;
+
+ if (!mgmt_mesh_find(hdev, handle))
+ break;
+ }
+
+ if (i == 255)
+ return NULL;
mesh_tx = kzalloc_obj(*mesh_tx);
if (!mesh_tx)
return NULL;
- hdev->mesh_send_ref++;
- if (!hdev->mesh_send_ref)
- hdev->mesh_send_ref++;
+ hdev->mesh_send_ref = handle;
- mesh_tx->handle = hdev->mesh_send_ref;
+ mesh_tx->handle = handle;
mesh_tx->index = hdev->id;
memcpy(mesh_tx->param, data, len);
mesh_tx->param_len = len;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 121/742] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (117 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 120/742] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 122/742] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
` (38 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 7c8dcf322b0d978c80001632c1206d5fe1ee9ba7 ]
mgmt_powering_down() looked up the Set Powered command and read its
parameters after mgmt_pending_find() dropped mgmt_pending_lock, so the
command could be unlinked and freed in between. Do the lookup and read the
parameters while holding the lock.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-e45413fa-48a6-43f1-90be-638841567534
Fixes: 302a1f674c00 ("Bluetooth: MGMT: Fix possible UAFs")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 83a1454b85b4d..502f6deb54446 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -10399,19 +10399,27 @@ bool mgmt_powering_down(struct hci_dev *hdev)
{
struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
+ bool powering_down = false;
if (hci_dev_test_flag(hdev, HCI_POWERING_DOWN))
return true;
- cmd = pending_find(MGMT_OP_SET_POWERED, hdev);
- if (!cmd)
- return false;
+ mutex_lock(&hdev->mgmt_pending_lock);
- cp = cmd->param;
- if (!cp->val)
- return true;
+ list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
+ if (hci_sock_get_channel(cmd->sk) != HCI_CHANNEL_CONTROL ||
+ cmd->opcode != MGMT_OP_SET_POWERED)
+ continue;
- return false;
+ /* cmd can only be freed after it is unlinked under the lock */
+ cp = cmd->param;
+ powering_down = !cp->val;
+ break;
+ }
+
+ mutex_unlock(&hdev->mgmt_pending_lock);
+
+ return powering_down;
}
u8 hci_to_mgmt_reason(u8 err)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 122/742] Bluetooth: MSFT: Protect the event prefix with hdev->lock
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (118 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 121/742] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 123/742] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags Greg Kroah-Hartman
` (37 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 0434cd10518c1b58ca3f5366341f0b1c469afbca ]
msft_vendor_evt() read msft->evt_prefix_len and compared evt_prefix before
taking hdev->lock, while msft_do_open() (and the supported features
reply) free and reallocate the prefix without it, so an event received
while the controller is being opened could access freed memory. Take
hdev->lock for the whole event processing and while updating the prefix.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-246df501-f32c-46fd-8779-7fa755ed7f9d
Fixes: 5031ffcc79b8 ("Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 2559c5b1bef02..ab63fee3ef597 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -170,11 +170,16 @@ static bool read_supported_features(struct hci_dev *hdev,
goto failed;
}
+ /* The event prefix is used by msft_vendor_evt() with hdev->lock held */
+ hci_dev_lock(hdev);
+
if (rp->evt_prefix_len > 0) {
msft->evt_prefix = kmemdup(rp->evt_prefix, rp->evt_prefix_len,
GFP_KERNEL);
- if (!msft->evt_prefix)
+ if (!msft->evt_prefix) {
+ hci_dev_unlock(hdev);
goto failed;
+ }
}
msft->evt_prefix_len = rp->evt_prefix_len;
@@ -183,6 +188,8 @@ static bool read_supported_features(struct hci_dev *hdev,
if (msft->features & MSFT_FEATURE_MASK_CURVE_VALIDITY)
hdev->msft_curve_validity = true;
+ hci_dev_unlock(hdev);
+
kfree_skb(skb);
return true;
@@ -648,10 +655,12 @@ void msft_do_open(struct hci_dev *hdev)
bt_dev_dbg(hdev, "Initialize MSFT extension");
/* Reset existing MSFT data before re-reading */
+ hci_dev_lock(hdev);
kfree(msft->evt_prefix);
msft->evt_prefix = NULL;
msft->evt_prefix_len = 0;
msft->features = 0;
+ hci_dev_unlock(hdev);
if (!read_supported_features(hdev, msft)) {
hci_dev_lock(hdev);
@@ -1078,12 +1087,15 @@ static void msft_monitor_device_evt(struct hci_dev *hdev, struct sk_buff *skb)
void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
{
- struct msft_data *msft = hdev->msft_data;
+ struct msft_data *msft;
u8 *evt_prefix;
u8 *evt;
+ hci_dev_lock(hdev);
+
+ msft = hdev->msft_data;
if (!msft)
- return;
+ goto unlock;
/* When the extension has defined an event prefix, check that it
* matches, and otherwise just return.
@@ -1091,23 +1103,21 @@ void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
if (msft->evt_prefix_len > 0) {
evt_prefix = msft_skb_pull(hdev, skb, 0, msft->evt_prefix_len);
if (!evt_prefix)
- return;
+ goto unlock;
if (memcmp(evt_prefix, msft->evt_prefix, msft->evt_prefix_len))
- return;
+ goto unlock;
}
/* Every event starts at least with an event code and the rest of
* the data is variable and depends on the event code.
*/
if (skb->len < 1)
- return;
+ goto unlock;
evt = msft_skb_pull(hdev, skb, 0, sizeof(*evt));
if (!evt)
- return;
-
- hci_dev_lock(hdev);
+ goto unlock;
switch (*evt) {
case MSFT_EV_LE_MONITOR_DEVICE:
@@ -1121,6 +1131,7 @@ void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
break;
}
+unlock:
hci_dev_unlock(hdev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 123/742] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (119 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 122/742] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 124/742] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
` (36 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit b49abf5f92ea0e03ebc0fe41ce4af87b094fe9b5 ]
The debugfs writers checked the current state of the flag, then blindly
inverted it with hci_dev_change_flag(). Two concurrent writers both pass
the check and the second inversion undoes the first one, leaving the flag
out of sync with the actual controller/SMP channel state (e.g. DUT mode
flag vs controller, or the BR/EDR SMP channel being leaked or removed
twice).
Set or clear the flag explicitly instead, redo the dut_mode check under
hci_req_sync_lock() and serialize smp_force_bredr() with hdev->lock. The
same applies to the quirk attributes.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-442108d5-76ce-44a1-a84d-16b44d6a26a6
Fixes: 4b4148e9acc1 ("Bluetooth: Add support for setting DUT mode")
Fixes: b55d1abf568c ("Bluetooth: Expose quirks through debugfs")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_debugfs.c | 32 +++++++++++++++++++++++++-------
net/bluetooth/smp.c | 25 +++++++++++++++++++------
2 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c
index cd5ef398f2382..1af68bfc2257a 100644
--- a/net/bluetooth/hci_debugfs.c
+++ b/net/bluetooth/hci_debugfs.c
@@ -59,7 +59,7 @@ static ssize_t __name ## _write(struct file *file, \
if (enable == test_bit(__quirk, hdev->quirk_flags)) \
return -EALREADY; \
\
- change_bit(__quirk, hdev->quirk_flags); \
+ assign_bit(__quirk, hdev->quirk_flags, enable); \
\
return count; \
} \
@@ -777,7 +777,10 @@ static ssize_t force_static_address_write(struct file *file,
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR))
return -EALREADY;
- hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_STATIC_ADDR);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_STATIC_ADDR);
return count;
}
@@ -1177,7 +1180,10 @@ static ssize_t force_no_mitm_write(struct file *file,
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_NO_MITM))
return -EALREADY;
- hci_dev_change_flag(hdev, HCI_FORCE_NO_MITM);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_NO_MITM);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_NO_MITM);
return count;
}
@@ -1303,20 +1309,32 @@ static ssize_t dut_mode_write(struct file *file, const char __user *user_buf,
return -EALREADY;
hci_req_sync_lock(hdev);
+
+ /* Check again now that concurrent writers are excluded */
+ if (enable == hci_dev_test_flag(hdev, HCI_DUT_MODE)) {
+ hci_req_sync_unlock(hdev);
+ return -EALREADY;
+ }
+
if (enable)
skb = __hci_cmd_sync(hdev, HCI_OP_ENABLE_DUT_MODE, 0, NULL,
HCI_CMD_TIMEOUT);
else
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL,
HCI_CMD_TIMEOUT);
- hci_req_sync_unlock(hdev);
-
- if (IS_ERR(skb))
+ if (IS_ERR(skb)) {
+ hci_req_sync_unlock(hdev);
return PTR_ERR(skb);
+ }
kfree_skb(skb);
- hci_dev_change_flag(hdev, HCI_DUT_MODE);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_DUT_MODE);
+ else
+ hci_dev_clear_flag(hdev, HCI_DUT_MODE);
+
+ hci_req_sync_unlock(hdev);
return count;
}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ae94d33d020fa..33445d1988a26 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3365,8 +3365,14 @@ static void smp_del_chan(struct l2cap_chan *chan)
int smp_force_bredr(struct hci_dev *hdev, bool enable)
{
- if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
- return -EALREADY;
+ int err = 0;
+
+ hci_dev_lock(hdev);
+
+ if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) {
+ err = -EALREADY;
+ goto unlock;
+ }
/* The channels are only registered while the controller is powered
* and LE capable. Otherwise just record the flag, smp_register() will
@@ -3377,8 +3383,10 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
if (hdev->smp_data && !hdev->smp_bredr_data) {
chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
- if (IS_ERR(chan))
- return PTR_ERR(chan);
+ if (IS_ERR(chan)) {
+ err = PTR_ERR(chan);
+ goto unlock;
+ }
hdev->smp_bredr_data = chan;
}
@@ -3392,9 +3400,14 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
}
}
- hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_BREDR_SMP);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_BREDR_SMP);
- return 0;
+unlock:
+ hci_dev_unlock(hdev);
+ return err;
}
int smp_register(struct hci_dev *hdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 124/742] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (120 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 123/742] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 125/742] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
` (35 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 7f08b6ef44fa17f1a5ad3926663ddb5abe6ff68a ]
hci_remove_single_adv_monitor() and hci_remove_all_adv_monitor() only
require hci_req_sync_lock, yet they look up and free monitors, modifying
hdev->adv_monitors_idr and adv_monitors_cnt, which Read Advertisement
Monitor Features iterates under hdev->lock. Take hdev->lock around the
IDR accesses and the freeing, but not across the HCI commands sent to the
controller.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-8b358899-5ac9-4687-af16-58420a4d9bba
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ed9a83777af0d..110d2ec51f411 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2028,7 +2028,10 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
if (status == -ENOENT)
bt_dev_warn(hdev, "Removing monitor with no matching handle %d",
monitor->handle);
+
+ hci_dev_lock(hdev);
hci_free_adv_monitor(hdev, monitor);
+ hci_dev_unlock(hdev);
return status;
}
@@ -2036,7 +2039,11 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
/* This function requires the caller holds hci_req_sync_lock */
int hci_remove_single_adv_monitor(struct hci_dev *hdev, u16 handle)
{
- struct adv_monitor *monitor = idr_find(&hdev->adv_monitors_idr, handle);
+ struct adv_monitor *monitor;
+
+ hci_dev_lock(hdev);
+ monitor = idr_find(&hdev->adv_monitors_idr, handle);
+ hci_dev_unlock(hdev);
if (!monitor)
return -EINVAL;
@@ -2052,7 +2059,10 @@ int hci_remove_all_adv_monitor(struct hci_dev *hdev)
int status = 0;
while (1) {
+ hci_dev_lock(hdev);
monitor = idr_get_next(&hdev->adv_monitors_idr, &idr_next_id);
+ hci_dev_unlock(hdev);
+
if (!monitor)
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 125/742] Bluetooth: MSFT: Free the response of the monitor commands
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (121 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 124/742] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 126/742] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
` (34 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 775eca0c3df2f0272f21ebc8c812ad010fd47243 ]
msft_add_monitor_sync() and msft_remove_monitor_sync() send the MSFT
command with __hci_cmd_sync() and pass the returned skb to the callbacks,
which only parse it, so it is never freed. Free it once the callback
returns.
While at it initialize the RSSI fields of the handle data when it is
created instead of after the command completed, so they are never exposed
uninitialized, and do the lookup of the handle map in
msft_remove_monitor_sync() with hdev->lock held.
Found by the sashiko.dev review of the previous revision of this series.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261117185737.3758255-1-luiz.dentz%40gmail.com
Fixes: b747a83690c8 ("Bluetooth: hci_sync: Refactor add Adv Monitor")
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index ab63fee3ef597..7a06c2b8974b7 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -297,6 +297,10 @@ static int msft_le_monitor_advertisement_cb(struct hci_dev *hdev, u16 opcode,
handle_data->mgmt_handle = monitor->handle;
handle_data->msft_handle = rp->handle;
handle_data->cond_type = MSFT_MONITOR_ADVERTISEMENT_TYPE_PATTERN;
+ handle_data->rssi_high = monitor->rssi.high_threshold;
+ handle_data->rssi_low = monitor->rssi.low_threshold;
+ handle_data->rssi_low_interval = (u8)monitor->rssi.low_threshold_timeout;
+ handle_data->rssi_sampling_period = monitor->rssi.sampling_period;
INIT_LIST_HEAD(&handle_data->list);
list_add(&handle_data->list, &msft->handle_map);
@@ -438,23 +442,30 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
struct msft_cp_le_cancel_monitor_advertisement cp;
struct msft_monitor_advertisement_handle_data *handle_data;
struct sk_buff *skb;
+ int err;
+ hci_dev_lock(hdev);
handle_data = msft_find_handle_data(hdev, monitor->handle, true);
+ if (handle_data)
+ cp.handle = handle_data->msft_handle;
+ hci_dev_unlock(hdev);
/* If no matched handle, just remove without telling controller */
if (!handle_data)
return -ENOENT;
cp.sub_opcode = MSFT_OP_LE_CANCEL_MONITOR_ADVERTISEMENT;
- cp.handle = handle_data->msft_handle;
skb = __hci_cmd_sync(hdev, hdev->msft_opcode, sizeof(cp), &cp,
HCI_CMD_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);
- return msft_le_cancel_monitor_advertisement_cb(hdev, hdev->msft_opcode,
- monitor, skb);
+ err = msft_le_cancel_monitor_advertisement_cb(hdev, hdev->msft_opcode,
+ monitor, skb);
+ kfree_skb(skb);
+
+ return err;
}
/* This function requires the caller holds hci_req_sync_lock */
@@ -519,7 +530,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
{
struct msft_cp_le_monitor_advertisement *cp;
struct msft_le_monitor_advertisement_pattern_data *pattern_data;
- struct msft_monitor_advertisement_handle_data *handle_data;
struct msft_le_monitor_advertisement_pattern *pattern;
struct adv_pattern *entry;
size_t total_size = sizeof(*cp) + sizeof(*pattern_data);
@@ -571,19 +581,7 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
err = msft_le_monitor_advertisement_cb(hdev, hdev->msft_opcode,
monitor, skb);
- if (err)
- goto out_free;
-
- handle_data = msft_find_handle_data(hdev, monitor->handle, true);
- if (!handle_data) {
- err = -ENODATA;
- goto out_free;
- }
-
- handle_data->rssi_high = cp->rssi_high;
- handle_data->rssi_low = cp->rssi_low;
- handle_data->rssi_low_interval = cp->rssi_low_interval;
- handle_data->rssi_sampling_period = cp->rssi_sampling_period;
+ kfree_skb(skb);
out_free:
kfree(cp);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 126/742] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (122 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 125/742] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 127/742] Bluetooth: hci_sync: Fix remaining advertising instance UAFs Greg Kroah-Hartman
` (33 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8d3e5e6fe6d0be5634b28788abf5685d571b13a4 ]
hci_remove_adv_monitor() frees the monitor when the controller has no
matching handle for it but still returned -ENOENT, so callers took it for
a failure of a monitor that is gone, and hci_remove_all_adv_monitor()
stopped at the first one leaving the others behind. Return success since
the monitor was removed.
Found by the sashiko.dev review of the previous revision of this series.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261117185737.3758255-1-luiz.dentz%40gmail.com
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 110d2ec51f411..4b8538f8eca1c 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2033,7 +2033,10 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
hci_free_adv_monitor(hdev, monitor);
hci_dev_unlock(hdev);
- return status;
+ /* The monitor is gone, not having been known by the controller is not
+ * an error for the caller.
+ */
+ return status == -ENOENT ? 0 : status;
}
/* This function requires the caller holds hci_req_sync_lock */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 127/742] Bluetooth: hci_sync: Fix remaining advertising instance UAFs
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (123 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 126/742] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 128/742] Bluetooth: hci_sync: Use controller handles for periodic advertising Greg Kroah-Hartman
` (32 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit d7e77168da348d8ac0fdb3b3aa7ce1ccc83208a7 ]
hci_enable_ext_advertising_sync() looks up the advertising instance
without hdev->lock and then reads it, while HCI event processing can
free the instance under the lock:
Request work HCI event work
hci_enable_ext_advertising_sync()
adv = hci_find_adv_instance()
hci_cc_le_clear_adv_sets()
hci_dev_lock(hdev)
hci_remove_adv_instance()
kfree(adv)
hci_dev_unlock(hdev)
reads adv->enabled
Since the conversion to hci_sync, the advertising request paths run
without hdev->lock, and the periodic advertising, advertising timeout
and mesh code added later does the same, while management commands and
HCI event processing still add and free instances under the lock. The
same unlocked use exists in:
- hci_set_adv_data_sync(), hci_disable_ext_adv_instance_sync(),
the periodic advertising enable
and disable helpers, hci_schedule_adv_instance_sync(),
adv_expire_sync() and set_advertising_complete()
- hci_enable_advertising_sync() and hci_start_per_adv_sync(), which
keep the instance across HCI commands
- hci_remove_advertising_sync() and hci_clear_adv_instance_sync(),
which keep the next instance as a pointer
- mesh_send_sync(), which adds the mesh instance
- the walks of hdev->adv_instances in hci_dev_open_sync(),
hci_dev_close_sync(), hci_resume_advertising_sync() and
hci_powered_update_adv_sync()
Fix them as commit cdc36db204ff ("Bluetooth: hci_sync: Fix advertising
data UAFs") does for the extended advertising data paths: look the
instance up under hdev->lock, copy what is needed, and release the lock
before a command is sent, since command completion handlers take it.
Keep the next instance as an instance number. Walks that send no command
hold the lock, as hci_clear_adv_sync() does. The resume and power on
walks send a command per instance and cannot hold it, so they copy the
instance numbers under the lock into a fixed stack array first. Instance
identifiers are nonzero u8 values, so 255 bytes cover the whole
namespace. This preserves list order without adding an allocation
failure after the resume path consumes its pause state.
Use a u32 for the timeout-to-milliseconds conversion before converting
to the controller's 10 ms units, and clamp the result to U16_MAX. The
old u16 intermediate wrapped timeouts longer than 65 seconds.
KASAN report as below:
BUG: KASAN: slab-use-after-free in
hci_enable_ext_advertising_sync+0x2fd/0x330
Read of size 1 at addr ffff88811673b810 by task kworker/u17:0/492
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
hci_enable_ext_advertising_sync+0x2fd/0x330
add_ext_adv_data_sync+0x1f8/0x250
hci_cmd_sync_work+0x1b3/0x450
Allocated by task 490:
hci_add_adv_instance+0x627/0x960
add_ext_adv_params+0x4d4/0xaf0
hci_sock_sendmsg+0x128b/0x22e0
Freed by task 495:
kfree+0x307/0x580
hci_remove_adv_instance+0x226/0x4f0
hci_cc_le_clear_adv_sets+0x2a5/0x400
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
The buggy address belongs to the object at ffff88811673b800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 16 bytes inside of
freed 1024-byte region [ffff88811673b800, ffff88811673bc00)
Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
Fixes: c249ea9b4309 ("Bluetooth: Move Adv Instance timer to hci_sync")
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 245 +++++++++++++++++++++++++++++----------
net/bluetooth/mgmt.c | 29 +++--
2 files changed, 203 insertions(+), 71 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 012ee0b6cc01c..d1f2929bb8772 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -499,7 +499,8 @@ static void cancel_adv_timeout(struct hci_dev *hdev)
int hci_clear_adv_instance_sync(struct hci_dev *hdev, struct sock *sk,
u8 instance, bool force)
{
- struct adv_info *adv_instance, *n, *next_instance = NULL;
+ struct adv_info *adv_instance, *n;
+ u8 next_instance = 0;
int err;
u8 rem_inst;
@@ -507,12 +508,20 @@ int hci_clear_adv_instance_sync(struct hci_dev *hdev, struct sock *sk,
if (!instance || hdev->cur_adv_instance == instance)
cancel_adv_timeout(hdev);
+ /* This is safe as long as there is no command send while the
+ * lock is held.
+ */
+ hci_dev_lock(hdev);
+
/* Get the next instance to advertise BEFORE we remove
* the current one. This can be the same instance again
* if there is only one instance.
*/
- if (instance && hdev->cur_adv_instance == instance)
- next_instance = hci_get_next_instance(hdev, instance);
+ if (instance && hdev->cur_adv_instance == instance) {
+ adv_instance = hci_get_next_instance(hdev, instance);
+ if (adv_instance)
+ next_instance = adv_instance->instance;
+ }
if (instance == 0x00) {
list_for_each_entry_safe(adv_instance, n, &hdev->adv_instances,
@@ -531,9 +540,8 @@ int hci_clear_adv_instance_sync(struct hci_dev *hdev, struct sock *sk,
if (force || (adv_instance && adv_instance->timeout &&
!adv_instance->remaining_time)) {
/* Don't advertise a removed instance. */
- if (next_instance &&
- next_instance->instance == instance)
- next_instance = NULL;
+ if (next_instance == instance)
+ next_instance = 0;
err = hci_remove_adv_instance(hdev, instance);
if (!err)
@@ -541,12 +549,13 @@ int hci_clear_adv_instance_sync(struct hci_dev *hdev, struct sock *sk,
}
}
+ hci_dev_unlock(hdev);
+
if (!hdev_is_powered(hdev) || hci_dev_test_flag(hdev, HCI_ADVERTISING))
return 0;
if (next_instance && !ext_adv_capable(hdev))
- return hci_schedule_adv_instance_sync(hdev,
- next_instance->instance,
+ return hci_schedule_adv_instance_sync(hdev, next_instance,
false);
return 0;
@@ -1394,14 +1403,21 @@ static int hci_set_ext_adv_data_sync(struct hci_dev *hdev, u8 instance)
}
static int hci_set_adv_data_sync(struct hci_dev *hdev, u8 instance)
+ __context_unsafe(/* conditional locking */)
{
struct hci_cp_le_set_adv_data cp;
u8 len;
memset(&cp, 0, sizeof(cp));
+ if (instance)
+ hci_dev_lock(hdev);
+
len = eir_create_adv_data(hdev, instance, cp.data, sizeof(cp.data));
+ if (instance)
+ hci_dev_unlock(hdev);
+
/* There's nothing to do if the data hasn't changed */
if (hdev->adv_data_len == len &&
memcmp(cp.data, hdev->adv_data, len) == 0)
@@ -1690,17 +1706,33 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)
struct hci_cp_le_set_ext_adv_enable *cp;
struct hci_cp_ext_adv_set *set;
u8 data[sizeof(*cp) + sizeof(*set) * 1];
- struct adv_info *adv;
+ u8 handle = instance;
+ u32 duration = 0;
if (instance > 0) {
+ struct adv_info *adv;
+
+ hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
- if (!adv)
+ if (!adv) {
+ hci_dev_unlock(hdev);
return -EINVAL;
+ }
/* If already enabled there is nothing to do */
- if (adv->enabled)
+ if (adv->enabled) {
+ hci_dev_unlock(hdev);
return 0;
- } else {
- adv = NULL;
+ }
+
+ handle = adv->handle;
+
+ /* Set duration per instance since controller is
+ * responsible for scheduling it.
+ */
+ if (adv->timeout)
+ duration = adv->mesh ? adv->timeout :
+ adv->timeout * MSEC_PER_SEC;
+ hci_dev_unlock(hdev);
}
cp = (void *)data;
@@ -1713,18 +1745,10 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)
memset(set, 0, sizeof(*set));
- set->handle = adv ? adv->handle : instance;
-
- /* Set duration per instance since controller is responsible for
- * scheduling it.
- */
- if (adv && adv->timeout) {
- u16 duration = adv->mesh ? adv->timeout :
- adv->timeout * MSEC_PER_SEC;
+ set->handle = handle;
- /* Time = N * 10 ms */
- set->duration = cpu_to_le16(duration / 10);
- }
+ /* Time = N * 10 ms */
+ set->duration = cpu_to_le16(min_t(u32, duration / 10, U16_MAX));
/* Track which instance owns the advertising set since the handle
* alone is ambiguous when instances share handle 0x00, see
@@ -1756,11 +1780,15 @@ int hci_start_ext_adv_sync(struct hci_dev *hdev, u8 instance)
int hci_disable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
{
struct hci_cp_le_set_per_adv_enable cp;
- struct adv_info *adv = NULL;
+ struct adv_info *adv;
+ bool enabled;
/* If periodic advertising already disabled there is nothing to do. */
+ hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
- if (!adv || !adv->periodic_enabled)
+ enabled = adv && adv->periodic_enabled;
+ hci_dev_unlock(hdev);
+ if (!enabled)
return 0;
memset(&cp, 0, sizeof(cp));
@@ -1829,11 +1857,15 @@ static int hci_set_per_adv_data_sync(struct hci_dev *hdev, u8 instance)
static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
{
struct hci_cp_le_set_per_adv_enable cp;
- struct adv_info *adv = NULL;
+ struct adv_info *adv;
+ bool enabled;
/* If periodic advertising already enabled there is nothing to do. */
+ hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
- if (adv && adv->periodic_enabled)
+ enabled = adv && adv->periodic_enabled;
+ hci_dev_unlock(hdev);
+ if (enabled)
return 0;
memset(&cp, 0, sizeof(cp));
@@ -1848,25 +1880,36 @@ static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
/* Checks if periodic advertising data contains a Basic Announcement and if it
* does generates a Broadcast ID and add Broadcast Announcement.
*/
-static int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv)
+static int hci_adv_bcast_annoucement(struct hci_dev *hdev, u8 instance)
{
+ struct adv_info *adv;
u8 bid[3];
u8 ad[HCI_MAX_EXT_AD_LENGTH];
u8 len;
+ int err = 0;
- /* Skip if NULL adv as instance 0x00 is used for general purpose
+ /* Skip if instance 0x00 as it is used for general purpose
* advertising so it cannot used for the likes of Broadcast Announcement
* as it can be overwritten at any point.
*/
- if (!adv)
+ if (!instance)
return 0;
+ hci_dev_lock(hdev);
+
+ /* The instance may have been removed while waiting for the
+ * controller, in which case there is nothing to announce.
+ */
+ adv = hci_find_adv_instance(hdev, instance);
+ if (!adv)
+ goto unlock;
+
/* Check if PA data doesn't contains a Basic Audio Announcement then
* there is nothing to do.
*/
if (!eir_get_service_data(adv->per_adv_data, adv->per_adv_data_len,
0x1851, NULL))
- return 0;
+ goto unlock;
/* Check if advertising data already has a Broadcast Announcement since
* the process may want to control the Broadcast ID directly and in that
@@ -1874,34 +1917,44 @@ static int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv)
*/
if (eir_get_service_data(adv->adv_data, adv->adv_data_len, 0x1852,
NULL))
- return 0;
+ goto unlock;
/* Generate Broadcast ID */
get_random_bytes(bid, sizeof(bid));
len = eir_append_service_data(ad, 0, 0x1852, bid, sizeof(bid));
if (adv->adv_data_len > sizeof(ad) - len) {
bt_dev_err(hdev, "No room for Broadcast Announcement");
- return -EINVAL;
+ err = -EINVAL;
+ goto unlock;
}
memcpy(ad + len, adv->adv_data, adv->adv_data_len);
- hci_set_adv_instance_data(hdev, adv->instance, len + adv->adv_data_len,
+ hci_set_adv_instance_data(hdev, instance, len + adv->adv_data_len,
ad, 0, NULL);
- return hci_update_adv_data_sync(hdev, adv->instance);
+ hci_dev_unlock(hdev);
+
+ return hci_update_adv_data_sync(hdev, instance);
+
+unlock:
+ hci_dev_unlock(hdev);
+ return err;
}
int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 sid,
u8 data_len, u8 *data, u32 flags, u16 min_interval,
u16 max_interval, u16 sync_interval)
{
- struct adv_info *adv = NULL;
+ struct adv_info *adv;
+ u8 bcast_instance = 0;
int err;
bool added = false;
hci_disable_per_advertising_sync(hdev, instance);
if (instance) {
+ hci_dev_lock(hdev);
+
adv = hci_find_adv_instance(hdev, instance);
if (adv) {
if (sid != HCI_SID_INVALID && adv->sid != sid) {
@@ -1910,6 +1963,7 @@ int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 sid,
*/
adv = hci_find_adv_sid(hdev, sid);
if (!adv) {
+ hci_dev_unlock(hdev);
bt_dev_err(hdev,
"Unable to find adv_info");
return -EINVAL;
@@ -1928,11 +1982,17 @@ int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 sid,
data_len, data,
sync_interval,
sync_interval);
- if (IS_ERR(adv))
+ if (IS_ERR(adv)) {
+ hci_dev_unlock(hdev);
return PTR_ERR(adv);
+ }
adv->pending = false;
added = true;
}
+
+ bcast_instance = adv->instance;
+
+ hci_dev_unlock(hdev);
}
/* Start advertising */
@@ -1940,7 +2000,7 @@ int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 sid,
if (err < 0)
goto fail;
- err = hci_adv_bcast_annoucement(hdev, adv);
+ err = hci_adv_bcast_annoucement(hdev, bcast_instance);
if (err < 0)
goto fail;
@@ -1960,8 +2020,11 @@ int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 sid,
return 0;
fail:
- if (added)
+ if (added) {
+ hci_dev_lock(hdev);
hci_remove_adv_instance(hdev, instance);
+ hci_dev_unlock(hdev);
+ }
return err;
}
@@ -1991,6 +2054,7 @@ int hci_enable_advertising_sync(struct hci_dev *hdev)
u8 own_addr_type, enable = 0x01;
bool connectable;
u16 adv_min_interval, adv_max_interval;
+ bool scannable;
u32 flags;
u8 status;
@@ -1998,8 +2062,25 @@ int hci_enable_advertising_sync(struct hci_dev *hdev)
return hci_enable_ext_advertising_sync(hdev,
hdev->cur_adv_instance);
+ /* Snapshot the instance under hdev->lock since it may be removed
+ * while waiting for the commands below to complete.
+ */
+ hci_dev_lock(hdev);
+
flags = hci_adv_instance_flags(hdev, hdev->cur_adv_instance);
+ scannable = hci_adv_instance_is_scannable(hdev,
+ hdev->cur_adv_instance);
+
adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);
+ if (adv_instance) {
+ adv_min_interval = adv_instance->min_interval;
+ adv_max_interval = adv_instance->max_interval;
+ } else {
+ adv_min_interval = hdev->le_adv_min_interval;
+ adv_max_interval = hdev->le_adv_max_interval;
+ }
+
+ hci_dev_unlock(hdev);
/* If the "connectable" instance flag was not set, then choose between
* ADV_IND and ADV_NONCONN_IND based on the global connectable setting.
@@ -2033,18 +2114,10 @@ int hci_enable_advertising_sync(struct hci_dev *hdev)
memset(&cp, 0, sizeof(cp));
- if (adv_instance) {
- adv_min_interval = adv_instance->min_interval;
- adv_max_interval = adv_instance->max_interval;
- } else {
- adv_min_interval = hdev->le_adv_min_interval;
- adv_max_interval = hdev->le_adv_max_interval;
- }
-
if (connectable) {
cp.type = LE_ADV_IND;
} else {
- if (hci_adv_instance_is_scannable(hdev, hdev->cur_adv_instance))
+ if (scannable)
cp.type = LE_ADV_SCAN_IND;
else
cp.type = LE_ADV_NONCONN_IND;
@@ -2264,7 +2337,7 @@ static int hci_remove_adv_sync(struct hci_dev *hdev, u8 instance,
int hci_remove_advertising_sync(struct hci_dev *hdev, struct sock *sk,
u8 instance, bool force)
{
- struct adv_info *next = NULL;
+ u8 next_instance = 0;
int err;
/* Cancel any timeout concerning the removed instance(s). */
@@ -2275,20 +2348,34 @@ int hci_remove_advertising_sync(struct hci_dev *hdev, struct sock *sk,
* the current one. This can be the same instance again
* if there is only one instance.
*/
- if (hdev->cur_adv_instance == instance)
+ if (hdev->cur_adv_instance == instance) {
+ struct adv_info *next;
+
+ hci_dev_lock(hdev);
next = hci_get_next_instance(hdev, instance);
+ if (next)
+ next_instance = next->instance;
+ hci_dev_unlock(hdev);
+ }
if (!instance) {
err = hci_clear_adv_sync(hdev, sk, force);
if (err)
return err;
} else {
- struct adv_info *adv = hci_find_adv_instance(hdev, instance);
+ struct adv_info *adv;
+ bool remove;
- if (force || (adv && adv->timeout && !adv->remaining_time)) {
+ hci_dev_lock(hdev);
+ adv = hci_find_adv_instance(hdev, instance);
+ remove = force ||
+ (adv && adv->timeout && !adv->remaining_time);
+ hci_dev_unlock(hdev);
+
+ if (remove) {
/* Don't advertise a removed instance. */
- if (next && next->instance == instance)
- next = NULL;
+ if (next_instance == instance)
+ next_instance = 0;
err = hci_remove_adv_sync(hdev, instance, sk);
if (err)
@@ -2299,8 +2386,8 @@ int hci_remove_advertising_sync(struct hci_dev *hdev, struct sock *sk,
if (!hdev_is_powered(hdev) || hci_dev_test_flag(hdev, HCI_ADVERTISING))
return 0;
- if (next && !ext_adv_capable(hdev))
- hci_schedule_adv_instance_sync(hdev, next->instance, false);
+ if (next_instance && !ext_adv_capable(hdev))
+ hci_schedule_adv_instance_sync(hdev, next_instance, false);
return 0;
}
@@ -2765,10 +2852,28 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
return 0;
}
+/* Copy the instance identifiers in list order under hdev->lock.
+ * There are at most U8_MAX instances, with identifiers 1..U8_MAX.
+ * Callers can then wait for commands without retaining list pointers.
+ */
+static size_t adv_instance_list_copy(struct hci_dev *hdev, u8 *ids)
+{
+ struct adv_info *adv;
+ size_t n = 0;
+
+ hci_dev_lock(hdev);
+
+ list_for_each_entry(adv, &hdev->adv_instances, list)
+ ids[n++] = adv->instance;
+
+ hci_dev_unlock(hdev);
+
+ return n;
+}
+
/* This function enables all user advertising instances */
static int hci_resume_advertising_sync(struct hci_dev *hdev)
{
- struct adv_info *adv, *tmp;
int err = 0;
/* If advertising has not been paused there is nothing to do. */
@@ -2785,15 +2890,20 @@ static int hci_resume_advertising_sync(struct hci_dev *hdev)
bt_dev_dbg(hdev, "Resuming advertising instances");
if (ext_adv_capable(hdev)) {
+ u8 ids[U8_MAX];
+ size_t i, n;
+
+ n = adv_instance_list_copy(hdev, ids);
+
/* Call for each tracked instance to be re-enabled */
- list_for_each_entry_safe(adv, tmp, &hdev->adv_instances, list) {
+ for (i = 0; i < n; i++) {
err = hci_enable_ext_advertising_sync(hdev,
- adv->instance);
+ ids[i]);
if (!err)
continue;
/* If the instance cannot be resumed remove it */
- hci_remove_ext_adv_instance_sync(hdev, adv->instance,
+ hci_remove_ext_adv_instance_sync(hdev, ids[i],
NULL);
}
@@ -3618,7 +3728,8 @@ int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul)
static int hci_powered_update_adv_sync(struct hci_dev *hdev)
{
- struct adv_info *adv, *tmp;
+ u8 ids[U8_MAX];
+ size_t i, n;
int err;
if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED))
@@ -3654,9 +3765,11 @@ static int hci_powered_update_adv_sync(struct hci_dev *hdev)
hci_enable_advertising_sync(hdev);
}
+ n = adv_instance_list_copy(hdev, ids);
+
/* Call for each tracked instance to be scheduled */
- list_for_each_entry_safe(adv, tmp, &hdev->adv_instances, list)
- hci_schedule_adv_instance_sync(hdev, adv->instance, true);
+ for (i = 0; i < n; i++)
+ hci_schedule_adv_instance_sync(hdev, ids[i], true);
return 0;
}
@@ -5608,7 +5721,9 @@ int hci_dev_open_sync(struct hci_dev *hdev)
if (!ret) {
hci_dev_hold(hdev);
hci_dev_set_flag(hdev, HCI_RPA_EXPIRED);
+ hci_dev_lock(hdev);
hci_adv_instances_set_rpa_expired(hdev, true);
+ hci_dev_unlock(hdev);
set_bit(HCI_UP, &hdev->flags);
hci_sock_dev_event(hdev, HCI_DEV_UP);
hci_leds_update_powered(hdev, true);
@@ -5767,8 +5882,10 @@ int hci_dev_close_sync(struct hci_dev *hdev)
cancel_delayed_work_sync(&hdev->rpa_expired);
+ hci_dev_lock(hdev);
list_for_each_entry(adv_instance, &hdev->adv_instances, list)
cancel_delayed_work_sync(&adv_instance->rpa_expired_cb);
+ hci_dev_unlock(hdev);
}
/* Avoid potential lockdep warnings from the *_flush() calls by
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 502f6deb54446..2e696787aeab8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4183,22 +4183,34 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev,
static int adv_expire_sync(struct hci_dev *hdev, u32 flags)
{
struct adv_info *adv_instance;
+ u8 instance;
+
+ hci_dev_lock(hdev);
adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);
if (!adv_instance)
- return 0;
+ goto unlock;
/* stop if current instance doesn't need to be changed */
if (!(adv_instance->flags & flags))
- return 0;
+ goto unlock;
cancel_adv_timeout(hdev);
adv_instance = hci_get_next_instance(hdev, adv_instance->instance);
if (!adv_instance)
- return 0;
+ goto unlock;
- hci_schedule_adv_instance_sync(hdev, adv_instance->instance, true);
+ instance = adv_instance->instance;
+
+ hci_dev_unlock(hdev);
+
+ hci_schedule_adv_instance_sync(hdev, instance, true);
+
+ return 0;
+
+unlock:
+ hci_dev_unlock(hdev);
return 0;
}
@@ -6797,12 +6809,15 @@ static void set_advertising_complete(struct hci_dev *hdev, void *data, int err)
instance = hdev->cur_adv_instance;
if (!instance) {
+ hci_dev_lock(hdev);
adv_instance = list_first_entry_or_null(&hdev->adv_instances,
struct adv_info, list);
- if (!adv_instance)
- return;
+ if (adv_instance)
+ instance = adv_instance->instance;
+ hci_dev_unlock(hdev);
- instance = adv_instance->instance;
+ if (!instance)
+ return;
}
err = hci_schedule_adv_instance_sync(hdev, instance, true);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 128/742] Bluetooth: hci_sync: Use controller handles for periodic advertising
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (124 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 127/742] Bluetooth: hci_sync: Fix remaining advertising instance UAFs Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 129/742] HID: corsair: use disable_work_sync() to tear down the LED workers Greg Kroah-Hartman
` (31 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit a7d2c94ba2995b5fb766d5ec7086f5e6a2774745 ]
Management instance numbers and controller advertising handles differ on
controllers with a single set: instance 1 uses handle 0x00. Periodic
advertising data already sends adv->handle, but the parameters and
enable commands send the instance number. The completion handler also
treats the command's handle as an instance number:
Request worker Controller / completion
create instance 1 on handle 0
send periodic parameters for 1
Unknown Advertising Identifier
Snapshot the handle under hdev->lock for periodic parameters, enable and
disable. For instance 1 using handle 0, update periodic_enabled under
the mutex after the command succeeds. Its completion handler cannot
distinguish that instance from global advertising by the handle alone;
keep the software instance number in the request, as the existing
remove-set and random-address paths do. Use the same mapping for the
advertising set in periodic transfer and both BIG creation commands,
which obtain the instance number from the same broadcast QoS field as
hci_start_per_adv_sync(). Keep the instance number in software state,
and send no HCI command with the mutex held.
Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 68 +++++++++++++++++++++++++++++++++++-----
1 file changed, 61 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index d1f2929bb8772..54ecb0a79f946 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1782,11 +1782,15 @@ int hci_disable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
struct hci_cp_le_set_per_adv_enable cp;
struct adv_info *adv;
bool enabled;
+ u8 handle = instance;
+ int err;
/* If periodic advertising already disabled there is nothing to do. */
hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
enabled = adv && adv->periodic_enabled;
+ if (adv)
+ handle = adv->handle;
hci_dev_unlock(hdev);
if (!enabled)
return 0;
@@ -1794,10 +1798,39 @@ int hci_disable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
memset(&cp, 0, sizeof(cp));
cp.enable = 0x00;
- cp.handle = instance;
+ cp.handle = handle;
- return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PER_ADV_ENABLE,
- sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+ err = __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PER_ADV_ENABLE,
+ sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+ if (err || handle == instance)
+ return err;
+
+ /* Handle 0 is shared with global advertising, so the completion
+ * cannot identify the software instance from the command alone.
+ */
+ hci_dev_lock(hdev);
+ adv = hci_find_adv_instance(hdev, instance);
+ if (adv)
+ adv->periodic_enabled = false;
+ hci_dev_unlock(hdev);
+
+ return 0;
+}
+
+/* Map a management instance number to its controller handle. */
+static u8 hci_adv_instance_handle(struct hci_dev *hdev, u8 instance)
+ __must_not_hold(&hdev->lock)
+{
+ struct adv_info *adv;
+ u8 handle = instance;
+
+ hci_dev_lock(hdev);
+ adv = hci_find_adv_instance(hdev, instance);
+ if (adv)
+ handle = adv->handle;
+ hci_dev_unlock(hdev);
+
+ return handle;
}
static int hci_set_per_adv_params_sync(struct hci_dev *hdev, u8 instance,
@@ -1813,7 +1846,7 @@ static int hci_set_per_adv_params_sync(struct hci_dev *hdev, u8 instance,
if (!max_interval)
max_interval = DISCOV_LE_PER_ADV_INT_MAX;
- cp.handle = instance;
+ cp.handle = hci_adv_instance_handle(hdev, instance);
cp.min_interval = cpu_to_le16(min_interval);
cp.max_interval = cpu_to_le16(max_interval);
cp.periodic_properties = 0x0000;
@@ -1859,11 +1892,15 @@ static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
struct hci_cp_le_set_per_adv_enable cp;
struct adv_info *adv;
bool enabled;
+ u8 handle = instance;
+ int err;
/* If periodic advertising already enabled there is nothing to do. */
hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
enabled = adv && adv->periodic_enabled;
+ if (adv)
+ handle = adv->handle;
hci_dev_unlock(hdev);
if (enabled)
return 0;
@@ -1871,10 +1908,23 @@ static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
memset(&cp, 0, sizeof(cp));
cp.enable = 0x01;
- cp.handle = instance;
+ cp.handle = handle;
- return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PER_ADV_ENABLE,
- sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+ err = __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PER_ADV_ENABLE,
+ sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+ if (err || handle == instance)
+ return err;
+
+ /* Handle 0 is shared with global advertising, so the completion
+ * cannot identify the software instance from the command alone.
+ */
+ hci_dev_lock(hdev);
+ adv = hci_find_adv_instance(hdev, instance);
+ if (adv)
+ adv->periodic_enabled = true;
+ hci_dev_unlock(hdev);
+
+ return 0;
}
/* Checks if periodic advertising data contains a Basic Announcement and if it
@@ -8152,6 +8202,7 @@ static int hci_le_past_set_info_sync(struct hci_dev *hdev, void *data)
{
struct past_data *past = data;
struct hci_cp_le_past_set_info cp;
+ struct adv_info *adv;
hci_dev_lock(hdev);
@@ -8164,6 +8215,9 @@ static int hci_le_past_set_info_sync(struct hci_dev *hdev, void *data)
memset(&cp, 0, sizeof(cp));
cp.handle = cpu_to_le16(past->le->handle);
cp.adv_handle = past->conn->iso_qos.bcast.bis;
+ adv = hci_find_adv_instance(hdev, cp.adv_handle);
+ if (adv)
+ cp.adv_handle = adv->handle;
hci_dev_unlock(hdev);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 129/742] HID: corsair: use disable_work_sync() to tear down the LED workers
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (125 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 128/742] Bluetooth: hci_sync: Use controller handles for periodic advertising Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 130/742] HID: magicmouse: disable the multitouch work on removal Greg Kroah-Hartman
` (30 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+abcedffc9201f2bb66c2,
Danish Khateeb, Chen Changcheng, Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <danishkhateeb03@gmail.com>
[ Upstream commit cc8d022e8679e34b4892fa6c0a3fa2db917a6283 ]
Tearing down the K90 LEDs races with their brightness workers in two
different ways, and swapping cancel_work_sync() and
led_classdev_unregister() around only trades one for the other.
Cancelling before the unregister, as k90_cleanup_backlight() and
k90_cleanup_macro_functions() have done since
commit eb51c9f8cb4f ("HID: corsair: cancel worker before
unregistering LED to fix use-after-free"), leaves
led_classdev_unregister() free to re-arm the worker: it calls
led_set_brightness(led_cdev, LED_OFF), which reaches
k90_brightness_set() and schedule_work()s the item again. The structure
holding that work is then freed while it is still linked into the
worklist:
BUG: KASAN: slab-use-after-free in __list_add_valid_or_report+0x186/0x210
Read of size 8 at addr ffff888102a1ead0 by task kworker/0:1/11
__queue_work+0xade/0x1350
queue_work_on+0xb6/0xc0
led_classdev_unregister+0x26b/0x340
corsair_remove+0x1c2/0x2d0
hid_device_remove+0xba/0x1e0
usbhid_disconnect+0xa0/0xe0
Allocated by task 129:
corsair_probe+0x560/0xd50
Freed by task 11:
corsair_remove+0xec/0x2d0
Cancelling after the unregister avoids that, but reintroduces precisely
the use-after-free that commit set out to fix: a worker that has
already tested led->removed and found it false goes on to dereference
led->cdev.dev, which led_classdev_unregister() has meanwhile freed via
device_unregister().
Use disable_work_sync(), which provides both halves at once. It waits
for a worker that is already executing, so nothing can be sitting
between the led->removed test and the led->cdev.dev dereference when the
device goes away, and it makes the subsequent schedule_work() from the
LED_OFF callback fail rather than queue, so nothing is left on the
worklist to be freed. The ordering then stops mattering. The removed
flag is left alone; it is redundant for these paths now but harmless.
The fail_sysfs error path in k90_init_macro_functions() unregisters
before cancelling, and so still carries the dereference-after-free that
was fixed in the teardown paths, so convert it too.
Fixes: eb51c9f8cb4f ("HID: corsair: cancel worker before unregistering LED to fix use-after-free")
Reported-by: syzbot+abcedffc9201f2bb66c2@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=abcedffc9201f2bb66c2
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Reviewed-by: Chen Changcheng <chenchangcheng@kylinos.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-corsair.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c
index 278c6efb565df..f966005d69dd6 100644
--- a/drivers/hid/hid-corsair.c
+++ b/drivers/hid/hid-corsair.c
@@ -507,8 +507,8 @@ static int k90_init_macro_functions(struct hid_device *dev)
fail_sysfs:
k90->record_led.removed = true;
+ disable_work_sync(&k90->record_led.work);
led_classdev_unregister(&k90->record_led.cdev);
- cancel_work_sync(&k90->record_led.work);
fail_record_led:
kfree(k90->record_led.cdev.name);
fail_record_led_alloc:
@@ -524,7 +524,7 @@ static void k90_cleanup_backlight(struct hid_device *dev)
if (drvdata->backlight) {
drvdata->backlight->removed = true;
- cancel_work_sync(&drvdata->backlight->work);
+ disable_work_sync(&drvdata->backlight->work);
led_classdev_unregister(&drvdata->backlight->cdev);
kfree(drvdata->backlight->cdev.name);
kfree(drvdata->backlight);
@@ -540,7 +540,7 @@ static void k90_cleanup_macro_functions(struct hid_device *dev)
sysfs_remove_group(&dev->dev.kobj, &k90_attr_group);
k90->record_led.removed = true;
- cancel_work_sync(&k90->record_led.work);
+ disable_work_sync(&k90->record_led.work);
led_classdev_unregister(&k90->record_led.cdev);
kfree(k90->record_led.cdev.name);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 130/742] HID: magicmouse: disable the multitouch work on removal
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (126 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 129/742] HID: corsair: use disable_work_sync() to tear down the LED workers Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 131/742] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
` (29 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Jiri Kosina,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit 348597b22005a8f20d267cdcc503a41dcc658acf ]
During USB runtime reset-resume, usbhid can call magicmouse_reset_resume()
without serialization against HID driver unbind. The USB interface
remains bound to usbhid, so this callback can queue msc->work after
magicmouse_remove() cancels it. The delayed work can then run after
devres frees msc.
Use disable_delayed_work_sync() to drain the work and reject later
queueing. Probe initializes fresh work on rebind.
Found by a static analysis tool under development.
Fixes: 4253fe22b137 ("HID: magicmouse: re-enable multitouch after reset-resume")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-magicmouse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index e6d4d49305268..0448cb2d07115 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -1032,7 +1032,7 @@ static void magicmouse_remove(struct hid_device *hdev)
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
if (msc) {
- cancel_delayed_work_sync(&msc->work);
+ disable_delayed_work_sync(&msc->work);
if (is_usb_magicmouse2(hdev->vendor, hdev->product) ||
is_usb_magictrackpad2(hdev->vendor, hdev->product))
timer_delete_sync(&msc->battery_timer);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 131/742] HID: sensor-hub: Synchronize callback removal with raw events
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (127 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 130/742] HID: magicmouse: disable the multitouch work on removal Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 133/742] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
` (28 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit abe10ad9c5fd868553b1262df403d5aaea3eff64 ]
Raw-event processing holds pdata->lock across callback lookup and
invocation, and takes dyn_callback_lock during lookup. Removal must
prevent both active callbacks and future lookups before client state can
be released.
Take pdata->lock before dyn_callback_lock, matching raw-event order,
and unlink the callback while holding both locks. This ensures active
raw-event callbacks have finished and prevents future lookups.
Fixes: 401ca24fb34a ("HID: sensors: introduce sensor framework")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-hub.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 6470a290ebfc5..0c4884c5821fd 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -173,7 +173,9 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
unsigned long flags;
- spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
+ /* Serialize callback removal with raw-event callback execution. */
+ spin_lock_irqsave(&pdata->lock, flags);
+ spin_lock(&pdata->dyn_callback_lock);
list_for_each_entry(callback, &pdata->dyn_callback_list, list)
if (callback->usage_id == usage_id &&
callback->hsdev == hsdev) {
@@ -181,7 +183,8 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
kfree(callback);
break;
}
- spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
+ spin_unlock(&pdata->dyn_callback_lock);
+ spin_unlock_irqrestore(&pdata->lock, flags);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 133/742] HID: sensor: custom: Disable sensor before hub close on removal
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (128 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 131/742] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 134/742] xsk: reject TX checksum requests that overflow skb->csum_start Greg Kroah-Hartman
` (27 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 6e66d69837cf07a00cbcdeb6198e08332b422b6c ]
When removing an enabled sensor, set its power and reporting states to
off before closing the hub. Keep the field descriptors alive until the
state update has completed, and release the hub's open reference.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 72e5639cb1d9a..8375697b459da 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -1053,6 +1053,13 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
/* Remove enable_sensor first as it uses fields via power_state/report_state. */
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
&enable_sensor_attr_group);
+ mutex_lock(&sensor_inst->mutex);
+ if (sensor_inst->enable) {
+ set_power_report_state(sensor_inst, false);
+ sensor_hub_device_close(hsdev);
+ sensor_inst->enable = false;
+ }
+ mutex_unlock(&sensor_inst->mutex);
hid_sensor_custom_remove_attributes(sensor_inst);
sensor_hub_remove_callback(hsdev, hsdev->usage);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 134/742] xsk: reject TX checksum requests that overflow skb->csum_start
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (129 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 133/742] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 7.3 135/742] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle Greg Kroah-Hartman
` (26 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tianyi Gao,
Stanislav Fomichev, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyi Gao <tianyi@cloudflare.com>
[ Upstream commit 4fdfed6d0990c82ce3c268814ba1b2c6ad0ce49d ]
xsk_skb_metadata() sets the u16 skb->csum_start to hr + csum_start. With
64K pages, csum_start can be close to U16_MAX, so the sum can overflow.
The checksum offset then becomes negative. With XDP_UMEM_TX_SW_CSUM,
skb_checksum_help() triggers a warning. Without it, the device gets a
CHECKSUM_PARTIAL skb with a negative offset.
Reject this with -EINVAL. Use the limit of skb_partial_csum_set(), which
also rejects U16_MAX, the "not set" value of transport_header. That
helper cannot be used here, as the skb built for an IFF_TX_SKB_NO_LINEAR
device has no linear data.
Fixes: 48eb03dd2630 ("xsk: Add TX timestamp and TX checksum offload support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-203545@kernel.org/
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20261116162834.30087-1-tianyi@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xdp/xsk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 7d31e06cc0d1e..c4ba5b98bd816 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -1005,7 +1005,8 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,
csum_offset = READ_ONCE(meta->request.csum_offset);
if (unlikely(csum_start + csum_offset +
- sizeof(__sum16) > desc->len))
+ sizeof(__sum16) > desc->len ||
+ hr + csum_start >= U16_MAX))
return -EINVAL;
skb->csum_start = hr + csum_start;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 135/742] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (130 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 134/742] xsk: reject TX checksum requests that overflow skb->csum_start Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 142/742] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
` (25 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Duyck, Jakub Kicinski,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <alexanderduyck@fb.com>
[ Upstream commit 6ada0c2769666140dff8e808ff21e8f9544ddc99 ]
The fbnic_wait_all_queues_idle function treats the Tx path as idle once
the QM idle registers report every queue idle. Those registers do not
cover the TMI completion path, so they can report idle while a PTP
timestamp request is still outstanding in the MAC or queued in the TMI
completion FIFO.
The check can then pass without a flush, and the completion arrives
after the rings have been flushed, where the fbnic_clean_tsq function
either reports "Tx timestamp without matching packet" or, if the
interface has come back up and a new timestamped frame is already
waiting, matches the stale completion to that frame and hands an
SO_TIMESTAMPING user the wrong Tx timestamp. After a forced flush it can
also turn FBNIC_TMI_DROP_CTRL_CMPL_DIS back off before the queued
completions have drained, as the completion FIFO is only drained while
that bit is set.
Split the Tx wait out into the fbnic_wait_tx_idle function and have its
idle check require the TCE PTP in-flight count to read zero in addition
to the QM idle registers. The count tracks each timestamp request from
when its frame enters the TCE until its completion leaves the TMI
completion FIFO, so the Tx path is only treated as idle once none are
outstanding, and a forced flush keeps the completion disable set until
they have drained. The Rx wait still checks only the QM idle registers.
The count is printed with the other Tx idle registers on failure.
Waiting on the in-flight count means the Tx idle check can now keep
reading the full set of QM idle registers for the whole timeout, and the
poll timeout only counts the delay between polls, not the time spent in
the register reads. Raise the delay between polls of the Tx and Rx waits
from 2us to 20us so the PCIe read latency stays a small part of each
interval and the 500ms timeout stays close to wall time.
Define the register inside the TCE CSR section and move
FBNIC_CSR_END_TCE to the last register of the TCE block (0x040B4,
TCE_SPARE2 in the CSR map), so that the ethtool register dump covers it.
The section previously ended at 0x04050, short of the TXB, PTP and TCAM
status registers. Per the CSR map, every register in the added range is
read-only or read/write, so reading them for the dump has no side
effects.
A device that has dropped off the bus, or whose CSR access the driver
has disabled after a failed read, reads all ones. The QM idle bits treat
that as idle, and so does the in-flight check: the count is bounded by
the timestamp requests the Tx path can hold and can never reach all
ones, so teardown of a lost device, or during DPC recovery, does not
wait out the idle timeouts.
The issue was found by code review and confirmed against the RTL.
Fixes: ad3d9f8bc66c ("eth: fbnic: add TX packets timestamping support")
Fixes: 7d4568edce74 ("fbnic: Disable PTP completions during the Tx force-flush")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/179460248693.8819.282933709034208845.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 3 +-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 73 ++++++++++++++++----
2 files changed, 62 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index 85ad53829bef8..d65dfb1d73329 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -440,7 +440,8 @@ enum {
#define FBNIC_TCE_TXB_NTWRK_DWRR_CTRL_EXT \
0x0404E /* 0x10138 */
#define FBNIC_TCE_TXB_BMC_DWRR_CTRL_EXT 0x0404F /* 0x1013c */
-#define FBNIC_CSR_END_TCE 0x04050 /* CSR section delimiter */
+#define FBNIC_TCE_PTP_INFLIGHT 0x040A7 /* 0x1029c */
+#define FBNIC_CSR_END_TCE 0x040B4 /* CSR section delimiter */
/* TCE RAM registers */
#define FBNIC_CSR_START_TCE_RAM 0x04200 /* CSR section delimiter */
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index c869b88db81ac..17d75ec6e3342 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -2358,38 +2358,85 @@ static void fbnic_idle_dump(struct fbnic_dev *fbd,
fbnic_rd32(fbd, regs[i].reg_base + j));
}
-int fbnic_wait_all_queues_idle(struct fbnic_dev *fbd, bool may_fail)
+/* The poll timeout only accounts for the delay between polls, not for
+ * the time spent in the poll itself, and each poll is a series of
+ * non-posted PCIe register reads that take on the order of a
+ * microsecond each. Space the polls out so that the reads stay a small
+ * part of each interval and the timeout stays close to wall time.
+ */
+#define FBNIC_IDLE_POLL_US 20
+#define FBNIC_IDLE_TIMEOUT_US 500000
+
+static bool fbnic_tx_idle(struct fbnic_dev *fbd,
+ const struct fbnic_idle_regs *regs,
+ unsigned int nregs)
+{
+ u32 inflight;
+
+ if (!fbnic_all_idle(fbd, regs, nregs))
+ return false;
+
+ /* The QM idle bits do not cover the TMI completion path, so a
+ * timestamp request can still be waiting on its completion. The
+ * count is bounded by the timestamp requests the Tx path can hold,
+ * so all ones is a failed read, as for the idle bits, not a count.
+ */
+ inflight = fbnic_rd32(fbd, FBNIC_TCE_PTP_INFLIGHT);
+
+ return !inflight || !~inflight;
+}
+
+static int fbnic_wait_tx_idle(struct fbnic_dev *fbd)
{
static const struct fbnic_idle_regs tx[] = {
{ FBNIC_QM_TWQ_IDLE(0), FBNIC_QM_TWQ_IDLE_CNT, },
{ FBNIC_QM_TQS_IDLE(0), FBNIC_QM_TQS_IDLE_CNT, },
{ FBNIC_QM_TDE_IDLE(0), FBNIC_QM_TDE_IDLE_CNT, },
{ FBNIC_QM_TCQ_IDLE(0), FBNIC_QM_TCQ_IDLE_CNT, },
- }, rx[] = {
- { FBNIC_QM_HPQ_IDLE(0), FBNIC_QM_HPQ_IDLE_CNT, },
- { FBNIC_QM_PPQ_IDLE(0), FBNIC_QM_PPQ_IDLE_CNT, },
- { FBNIC_QM_RCQ_IDLE(0), FBNIC_QM_RCQ_IDLE_CNT, },
};
bool idle;
int err;
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle, 2, 500000,
- false, fbd, tx, ARRAY_SIZE(tx));
+ err = read_poll_timeout_atomic(fbnic_tx_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
+ fbd, tx, ARRAY_SIZE(tx));
if (err == -ETIMEDOUT) {
fbnic_tx_flush(fbd);
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle,
- 2, 500000, false,
+ err = read_poll_timeout_atomic(fbnic_tx_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
fbd, tx, ARRAY_SIZE(tx));
fbnic_tx_flush_off(fbd);
}
if (err) {
fbnic_idle_dump(fbd, tx, ARRAY_SIZE(tx), "Tx", err);
- if (may_fail)
- return err;
+ netdev_err(fbd->netdev, "0x%04x: %08x\n",
+ FBNIC_TCE_PTP_INFLIGHT,
+ fbnic_rd32(fbd, FBNIC_TCE_PTP_INFLIGHT));
}
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle, 2, 500000,
- false, fbd, rx, ARRAY_SIZE(rx));
+ return err;
+}
+
+int fbnic_wait_all_queues_idle(struct fbnic_dev *fbd, bool may_fail)
+{
+ static const struct fbnic_idle_regs rx[] = {
+ { FBNIC_QM_HPQ_IDLE(0), FBNIC_QM_HPQ_IDLE_CNT, },
+ { FBNIC_QM_PPQ_IDLE(0), FBNIC_QM_PPQ_IDLE_CNT, },
+ { FBNIC_QM_RCQ_IDLE(0), FBNIC_QM_RCQ_IDLE_CNT, },
+ };
+ bool idle;
+ int err;
+
+ err = fbnic_wait_tx_idle(fbd);
+ if (err && may_fail)
+ return err;
+
+ err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
+ fbd, rx, ARRAY_SIZE(rx));
if (err)
fbnic_idle_dump(fbd, rx, ARRAY_SIZE(rx), "Rx", err);
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 142/742] net: bcm4908_enet: unmap the buffer of a dropped RX frame
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (131 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 7.3 135/742] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 143/742] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
` (24 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 1b48d619448c8425bd907722784f08e4e8fa4c5b ]
When poll_rx() drops a frame (too short, or not in a single buffer),
it frees the buffer without unmapping it first, so the memory goes
back to the page allocator while still mapped for the device. Unmap it
as the path for good frames does.
Found by reading the code.
Fixes: 4dc7f09b8bec ("net: broadcom: bcm4908_enet: fix RX path possible mem leak")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-5-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index bb42b6ecde16a..03de65d9bbfd6 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -661,6 +661,8 @@ static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight)
if (len < ETH_ZLEN ||
(ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
+ dma_unmap_single(dev, slot.dma_addr,
+ ENET_RX_BUF_DMA_SIZE, DMA_FROM_DEVICE);
skb_free_frag(slot.buf);
enet->netdev->stats.rx_dropped++;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 143/742] net: bcm4908_enet: unmap RX buffers on stop with their mapped size
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (132 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 142/742] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 144/742] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
` (23 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 1da02595e8d2647a04c2cdd4f668dee0b8ac1ae9 ]
Since the switch to build_skb() the RX buffers are mapped with
ENET_RX_BUF_DMA_SIZE and slot->len is no longer set for them, but
bcm4908_enet_dma_uninit() still unmaps them with slot->len. Use the
size they were mapped with.
Found by reading the code.
Fixes: 3a1cc23a75ab ("net: broadcom: bcm4908_enet: use build_skb()")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-6-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 03de65d9bbfd6..4065769da9660 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -334,7 +334,8 @@ static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
slot = &rx_ring->slots[i];
if (!slot->buf)
continue;
- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE);
+ dma_unmap_single(dev, slot->dma_addr, ENET_RX_BUF_DMA_SIZE,
+ DMA_FROM_DEVICE);
skb_free_frag(slot->buf);
slot->buf = NULL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 144/742] net: bcm4908_enet: publish the buffer address before OWN
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (133 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 143/742] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 145/742] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
` (22 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 4d47e6c2f3ceb638d4ea5c21e304b20f526255bd ]
bcm4908_enet_dma_alloc_rx_buf() hands a descriptor to the DMA by
writing its control word, with DMA_CTL_STATUS_OWN, first and the new
buffer address second. If the DMA read the descriptor between the two
stores, it would write the next frame into the old buffer, which
poll_rx() is turning into an skb. start_xmit() writes the address
first, but nothing orders the two stores, and the descriptors live in
coherent memory, where arm64 may make them visible in either order.
Write the address first on both paths and order it before the control
word with dma_wmb(). In poll_rx(), read what the DMA wrote only after
seeing OWN clear (dma_rmb()), as Documentation/memory-barriers.txt
describes for descriptors shared with a device.
Found by reading the code; I have no test that shows the DMA reading a
descriptor while it is being refilled.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-7-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 4065769da9660..4139dad3a18d0 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -291,8 +291,10 @@ static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int
tmp |= DMA_CTL_STATUS_OWN;
if (idx == enet->rx_ring.length - 1)
tmp |= DMA_CTL_STATUS_WRAP;
- buf_desc->ctl = cpu_to_le32(tmp);
buf_desc->addr = cpu_to_le32(slot->dma_addr);
+ /* Hand the descriptor to the DMA only once it holds the new buffer */
+ dma_wmb();
+ buf_desc->ctl = cpu_to_le32(tmp);
return 0;
}
@@ -613,6 +615,8 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
netdev_sent_queue(enet->netdev, skb->len);
buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
+ /* The DMA must not see OWN before the buffer address */
+ dma_wmb();
buf_desc->ctl = cpu_to_le32(tmp);
bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
@@ -647,6 +651,8 @@ static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight)
ctl = le32_to_cpu(buf_desc->ctl);
if (ctl & DMA_CTL_STATUS_OWN)
break;
+ /* Read the rest only after the DMA gave the descriptor back */
+ dma_rmb();
slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 145/742] net: bcm4908_enet: order the TX ring index accesses
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (134 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 144/742] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 146/742] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector Greg Kroah-Hartman
` (21 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kordian Chmielewski, Jakub Kicinski,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit ebe31472ad0a08e19a31a6647b99c6b51f90026c ]
Since the TX interrupt was added, poll_tx() runs in its own NAPI and
does not take the TX queue lock, so it and start_xmit() share the TX
ring with only the two indexes between them. Nothing orders the
accesses around those indexes:
- poll_tx() reads write_idx, then the descriptor and the slot. On arm64
the later loads may be satisfied first, so poll_tx() may see the new
write_idx together with the previous lap's descriptor, which has no
OWN, and the previous lap's slot. It would then unmap and free a
frame the DMA has not sent yet, or free the old skb a second time.
- poll_tx() publishes read_idx once it is done with the slots it
freed, but that store is not ordered after its loads from those
slots, so start_xmit() may refill a slot before poll_tx() has read
it.
Publish each index with smp_store_release() and read the other side's
index with smp_load_acquire() before touching the slots. start_xmit()
now publishes write_idx right after the descriptor, before the MMIO
write that kicks the DMA rather than after it, which narrows the window
in which the DMA can complete a frame that poll_tx() cannot see yet.
Sashiko's review of the previous version of this series pointed this
out; I have not seen it on the hardware.
Fixes: 12bb508bfe5a ("net: broadcom: bcm4908_enet: support TX interrupt")
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-8-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 26 ++++++++++++++------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 4139dad3a18d0..8bc620de2ef0d 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -566,7 +566,9 @@ static int bcm4908_enet_stop(struct net_device *netdev)
*/
static int bcm4908_enet_tx_free_descs(struct bcm4908_enet_dma_ring *ring)
{
- int free = READ_ONCE(ring->read_idx) - READ_ONCE(ring->write_idx) - 1;
+ /* Pairs with smp_store_release() in bcm4908_enet_poll_tx() */
+ int free = smp_load_acquire(&ring->read_idx) -
+ READ_ONCE(ring->write_idx) - 1;
return free < 0 ? free + ring->length : free;
}
@@ -619,12 +621,14 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
dma_wmb();
buf_desc->ctl = cpu_to_le32(tmp);
- bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
+ /* Publish the slot and the descriptor before the index; pairs with
+ * smp_load_acquire() in bcm4908_enet_poll_tx()
+ */
+ smp_store_release(&ring->write_idx,
+ ring->write_idx < ring->length - 1 ?
+ ring->write_idx + 1 : 0);
- if (ring->write_idx == ring->length - 1)
- WRITE_ONCE(ring->write_idx, 0);
- else
- WRITE_ONCE(ring->write_idx, ring->write_idx + 1);
+ bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
/* poll_tx() wakes the queue once there is room again */
netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1);
@@ -718,7 +722,10 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
unsigned int bytes = 0;
int handled = 0;
- while (handled < weight && read_idx != READ_ONCE(tx_ring->write_idx)) {
+ while (handled < weight) {
+ /* Pairs with the release in bcm4908_enet_start_xmit() */
+ if (read_idx == smp_load_acquire(&tx_ring->write_idx))
+ break;
buf_desc = &tx_ring->buf_desc[read_idx];
if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
break;
@@ -733,7 +740,10 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
if (++read_idx == tx_ring->length)
read_idx = 0;
}
- WRITE_ONCE(tx_ring->read_idx, read_idx);
+ /* Be done with the slots before start_xmit() may reuse them; pairs
+ * with smp_load_acquire() in bcm4908_enet_tx_free_descs()
+ */
+ smp_store_release(&tx_ring->read_idx, read_idx);
enet->netdev->stats.tx_packets += handled;
enet->netdev->stats.tx_bytes += bytes;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 146/742] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (135 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 145/742] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 147/742] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Greg Kroah-Hartman
` (20 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Terrence Adams, Bart Van Assche,
Martin K. Petersen (Oracle), Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terrence Adams <tadamsjr@google.com>
[ Upstream commit 3ad578b22f7a34a2391ca8910dfc931b01cc94f6 ]
When MSI-X interrupt vectors are configured in pm8001_setup_msix(), the
driver requests vector affinity with .pre_vectors = 1 to reserve Vector 0
for non-affinitized housekeeping interrupts.
blk_mq_map_hw_queues() maps hardware queues (hwq 0 to nr_hw_queues - 1)
with an offset of 1, mapping hwq 0 to Vector 1, hwq 1 to Vector 2, etc.
However, pm80xx_chip_get_q_index() retrieves the queue index directly from
blk_mq_unique_tag_to_hwq(tag) without adding 1 for the pre-vector
offset. Consequently, commands on hwq 0 are issued with responseQueue 0
(firing unmanaged Vector 0 on CPU 0), while hwq k fires Vector k (the CPU
affinitized to hwq k-1).
This results in 100% of I/O completion interrupts being delivered to the
wrong CPU core, causing heavy cross-CPU IPIs, cache line bouncing, and
increased kernel and IRQ CPU processing overhead.
Define PM8001_PRE_VECTORS for the reserved housekeeping vector and use it
consistently across MSI-X vector allocation, hardware queue setup and
mapping, and queue index lookup. Update pm80xx_chip_get_q_index() to accept
pm8001_ha and add PM8001_PRE_VECTORS to blk_mq_unique_tag_to_hwq() whenever
multi-queue is enabled (number_of_intr > PM8001_PRE_VECTORS), routing
completion interrupts to their affinitized CPU cores.
Note that offsetting completions by PM8001_PRE_VECTORS routes the highest
hardware queue to outbound queue max_q_num - 1, which pm80xx_chip_init()
also programs as the fatal error interrupt vector. As a result,
process_oq() now reads MSGU_SCRATCH_PAD_1 (and MSGU_SCRATCH_PAD_RSVD_0 when
no fatal error is reported) on every interrupt for that queue, matching the
behavior before commit 42f22fe36d51 ("scsi: pm8001: Expose hardware queues
for pm80xx").
Fixes: 42f22fe36d51 ("scsi: pm8001: Expose hardware queues for pm80xx")
Signed-off-by: Terrence Adams <tadamsjr@google.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20261118180344.1159617-1-tadamsjr@google.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/pm8001/pm8001_defs.h | 1 +
drivers/scsi/pm8001/pm8001_init.c | 15 +++++++++------
drivers/scsi/pm8001/pm80xx_hwi.c | 13 +++++++++----
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h
index a9605ca317f34..9b37a76d8b744 100644
--- a/drivers/scsi/pm8001/pm8001_defs.h
+++ b/drivers/scsi/pm8001/pm8001_defs.h
@@ -178,6 +178,7 @@ enum port_type {
#define PM8001_MAX_INB_NUM 64
#define PM8001_MAX_OUTB_NUM 64
#define PM8001_CAN_QUEUE 508 /* SCSI Queue depth */
+#define PM8001_PRE_VECTORS 1 /* non-affinitized housekeeping vector */
/* Inbound/Outbound queue size */
#define IOMB_SIZE_SPC 64
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 5af81c73a8f87..b1788788b7ed9 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -104,8 +104,9 @@ static void pm8001_map_queues(struct Scsi_Host *shost)
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
- if (pm8001_ha->number_of_intr > 1) {
- blk_mq_map_hw_queues(qmap, &pm8001_ha->pdev->dev, 1);
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS) {
+ blk_mq_map_hw_queues(qmap, &pm8001_ha->pdev->dev,
+ PM8001_PRE_VECTORS);
return;
}
@@ -977,10 +978,11 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
* include in the affinity spreading.
*/
struct irq_affinity desc = {
- .pre_vectors = 1,
+ .pre_vectors = PM8001_PRE_VECTORS,
};
rc = pci_alloc_irq_vectors_affinity(
- pm8001_ha->pdev, 2, PM8001_MAX_MSIX_VEC,
+ pm8001_ha->pdev, PM8001_PRE_VECTORS + 1,
+ PM8001_MAX_MSIX_VEC,
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, &desc);
}
@@ -1183,8 +1185,9 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
PM8001_CHIP_DISP->chip_post_init(pm8001_ha);
- if (pm8001_ha->number_of_intr > 1) {
- shost->nr_hw_queues = pm8001_ha->number_of_intr - 1;
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS) {
+ shost->nr_hw_queues = pm8001_ha->number_of_intr -
+ PM8001_PRE_VECTORS;
/*
* For now, ensure we're not sent too many commands by setting
* host_tagset. This is also required if we start using request
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 659dbd603a033..7cf24b2f09f6f 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4326,14 +4326,19 @@ static int check_enc_sat_cmd(struct sas_task *task)
return ret;
}
-static u32 pm80xx_chip_get_q_index(struct sas_task *task)
+static u32 pm80xx_chip_get_q_index(struct pm8001_hba_info *pm8001_ha,
+ struct sas_task *task)
{
struct request *rq = sas_task_find_rq(task);
if (!rq)
return 0;
- return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq));
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS)
+ return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq)) +
+ PM8001_PRE_VECTORS;
+
+ return 0;
}
/**
@@ -4369,7 +4374,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
task->ssp_task.cmd->cmd_len);
- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);
/* Check if encryption is set */
if (pm8001_ha->chip->encrypt &&
@@ -4508,7 +4513,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
u32 opc = OPC_INB_SATA_HOST_OPSTART;
memset(&sata_cmd, 0, sizeof(sata_cmd));
- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);
if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) {
ATAP = 0x04; /* no data*/
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 147/742] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (136 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 146/742] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 148/742] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Greg Kroah-Hartman
` (19 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tariq Toukan, Gal Pressman,
Cosmin Ratiu, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <tariqt@nvidia.com>
[ Upstream commit e421df3c838692c0c3503768ec3c9183f6df77aa ]
HW-GRO (SHAMPO) sessions are not terminated by HW when the kTLS RX
offload indication in the CQE changes. The driver applies the offload
metadata of the first packet in the session only, so ciphertext and
plaintext can end up in the same skb under a single skb->decrypted
indication, and resync requests carried by non-first packets are lost.
Do not merge a CQE whose decryption state differs from skb->decrypted,
which the first packet of the session sets. Never merge a CQE that
carries a resync request or a TLS error, so that each of them starts a
session and is handled.
The failure was reproduced on ConnectX-7 with HW GRO and kTLS RX offload
on and 0.3% loss added by netem on the sender's egress: TlsDecryptError
increased and the receiving sockets failed with EBADMSG. With this
patch, TlsDecryptError stays 0.
Fixes: 92552d3abd32 ("net/mlx5e: HW_GRO cqe handler implementation")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Link: https://patch.msgid.link/20261118144042.1916204-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/en_accel/en_accel.h | 5 +++--
.../mellanox/mlx5/core/en_accel/ktls_txrx.h | 21 +++++++++++++++++++
.../net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +-
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
index 5a340f1435e6b..554c225f73767 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
@@ -219,9 +219,10 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq,
}
static inline bool
-mlx5e_accel_shampo_can_merge(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
+mlx5e_accel_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
{
- return mlx5e_psp_shampo_can_merge(rq->hw_gro_data->skb, cqe);
+ return mlx5e_psp_shampo_can_merge(skb, cqe) &&
+ mlx5e_ktls_shampo_can_merge(skb, cqe);
}
static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
index 93bd383a23d8c..20e5dc6a718e1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
@@ -60,6 +60,21 @@ mlx5e_ktls_handle_tx_wqe(struct mlx5_wqe_ctrl_seg *cseg,
{
cseg->tis_tir_num = cpu_to_be32(state->tls_tisn << 8);
}
+
+/* The first CQE of a HW-GRO session sets skb->decrypted. A resync request or
+ * a TLS error is handled on the first CQE only, so it starts a new session.
+ */
+static inline bool
+mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
+{
+ u8 tls_offload = get_cqe_tls_offload(cqe);
+
+ if (unlikely(tls_offload > CQE_TLS_OFFLOAD_DECRYPTED))
+ return false;
+
+ return (tls_offload == CQE_TLS_OFFLOAD_DECRYPTED) ==
+ skb_is_decrypted(skb);
+}
#else
static inline bool
mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
@@ -93,6 +108,12 @@ static inline void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq,
u32 *cqe_bcnt)
{
}
+
+static inline bool
+mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
+{
+ return true;
+}
#endif /* CONFIG_MLX5_EN_TLS */
#endif /* __MLX5E_TLS_TXRX_H__ */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index d49f26323b1e2..ffcb6ec760a57 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -2271,7 +2271,7 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq
if (*skb &&
!(match &&
mlx5e_hw_gro_skb_has_enough_space(*skb, data_bcnt, page_size) &&
- mlx5e_accel_shampo_can_merge(rq, cqe))) {
+ mlx5e_accel_shampo_can_merge(*skb, cqe))) {
match = false;
mlx5e_shampo_flush_skb(rq, cqe, match);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 148/742] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (137 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 147/742] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 149/742] tcp: accecn: initialize AccECN fields in syncookie path Greg Kroah-Hartman
` (18 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thaison Phan, Eric Dumazet,
Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thaison Phan <thaisonphan@google.com>
[ Upstream commit 7411fb1929075884648e9db0b9ec7e424c095185 ]
Commit a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()") moved
the LOOPBACK4_IPV6 initialization for passive IPv6 TCP sockets from
tcp_v6_syn_recv_sock() to tcp_v6_init_req().
IPv6 SYN cookie connections allocate a fresh request_sock without
__GFP_ZERO and call tcp_v6_syn_recv_sock() without tcp_v6_init_req(),
leaving ireq->ir_rmt_addr and ireq->ir_loc_addr uninitialized in
cookie_v6_check(). inet_csk_clone_lock() then copies uninitialized slab
bytes into sk_daddr, sk_rcv_saddr, and inet_saddr, exposing them to
tracepoints and bpf_sock and causing inet_daddr != LOOPBACK4_IPV6 checks
(such as IP_OPTIONS in do_ip_setsockopt()) to misclassify native IPv6
child sockets as IPv4-mapped.
This was originally noticed via an out-of-tree socket hook observing
inet_sk(sk)->inet_saddr != LOOPBACK4_IPV6 on KASAN test runs. KASAN
enables SLUB_RCU_DEBUG by default, introducing an RCU grace period that
prevents cookie_v6_check() from reusing the warm request_sock initialized
during the initial SYN. Upstream, with tcp_syncookies=2,
SLUB_RCU_DEBUG=y, and slub_debug=P, sock:inet_sock_set_state shows slab
poison instead of 127.0.0.6:
... sock:inet_sock_set_state: family=AF_INET6 protocol=IPPROTO_TCP \
sport=59839 dport=41050 \
saddr=90.90.90.90 daddr=90.90.90.90 \
saddrv6=::1 daddrv6=::1 \
oldstate=TCP_LISTEN newstate=TCP_SYN_RECV
Initialize ireq->ir_rmt_addr and ireq->ir_loc_addr to LOOPBACK4_IPV6 in
cookie_v6_check() to match tcp_v6_init_req(). Tested against a QEMU
reproducer checking inet_sock_set_state and IP_OPTIONS, as well as the
packetdrill syncookie selftests.
Fixes: a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()")
Signed-off-by: Thaison Phan <thaisonphan@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261118210933.2477423-2-thaisonphan@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/syncookies.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index b581cb1ee2e8a..b33011b71fff6 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -17,6 +17,7 @@
#include <net/ipv6.h>
#include <net/tcp.h>
#include <net/tcp_ecn.h>
+#include <net/transp_v6.h>
#define COOKIEBITS 24 /* Upper bits store count */
#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
@@ -205,6 +206,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
+ ireq->ir_rmt_addr = LOOPBACK4_IPV6;
+ ireq->ir_loc_addr = LOOPBACK4_IPV6;
if (security_inet_conn_request(sk, skb, req)) {
SKB_DR_SET(reason, SECURITY_HOOK);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 149/742] tcp: accecn: initialize AccECN fields in syncookie path
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (138 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 148/742] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 150/742] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
` (17 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thaison Phan, Matthieu Baerts (NGI0),
Eric Dumazet, Jakub Kicinski, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thaison Phan <thaisonphan@google.com>
[ Upstream commit ce28b1a4d137842e428a578269c35d6c84109438 ]
cookie_tcp_reqsk_alloc() and bpf_sk_assign_tcp_reqsk() allocate struct
request_sock without __GFP_ZERO, leaving saw_accecn_opt,
accecn_fail_mode, syn_ect_rcv, and syn_ect_snt uninitialized. When
accecn_ok is negotiated in cookie_{v4,v6}_check(),
tcp_ecn_openreq_child() reads all four fields to initialize the child
socket's AccECN state.
In addition, because the temporary request_sock used to send a cookie
SYN-ACK is immediately freed, treq->syn_ect_snt is lost. For AccECN
connections where the listener marks ECT on the SYN-ACK, leaving
syn_ect_snt as 0 causes tcp_accecn_third_ack() to see a mismatch between
the expected Not-ECT and the peer's reflected ECT in the ACE field,
erroneously flagging TCP_ACCECN_ACE_FAIL_RECV in accecn_fail_mode. Refer
to Table 4 of RFC 9768 for more details.
Initialize the AccECN fields in cookie_tcp_reqsk_init() to match
tcp_openreq_init(). For kernel-generated cookies (!req->syncookie), set
syn_ect_snt from the listener's TOS/tclass in cookie_{v4,v6}_check() to
match tcp_{v4,v6}_send_synack(); for BPF custom syncookies
(req->syncookie), leave syn_ect_snt at 0 (Not-ECT) since the SYN-ACK was
built by the BPF program rather than the kernel and bpf_tcp_req_attrs
does not report the SYN-ACK ECN codepoint.
Found by AI-assisted code inspection comparing tcp_openreq_init() and
cookie_tcp_reqsk_init() while investigating the cookie_v6_check()
LOOPBACK4_IPV6 bug. Reproduced in a QEMU VM with tcp_syncookies=2,
tcp_ecn=3, SLUB_RCU_DEBUG=y, and slub_debug=P, observing bogus
tcpi_accecn_fail_mode and tcpi_accecn_opt_seen values in TCP_INFO on the
accepted child socket (and tcpi_accecn_fail_mode=0x2 on ECT(0)
listeners), and tested with packetdrill AccECN and syncookie selftests.
Fixes: 3cae34274c79 ("tcp: accecn: AccECN negotiation")
Fixes: b40671b5ee58 ("tcp: accecn: AccECN option failure handling")
Signed-off-by: Thaison Phan <thaisonphan@google.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261118210933.2477423-3-thaisonphan@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/syncookies.c | 7 +++++++
net/ipv6/syncookies.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 4e0ff3b820627..89169c82431c1 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -290,6 +290,10 @@ static int cookie_tcp_reqsk_init(struct sock *sk, struct sk_buff *skb,
*/
treq->txhash = treq->snt_isn;
treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield;
+ treq->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN;
+ treq->accecn_fail_mode = 0;
+ treq->syn_ect_rcv = 0;
+ treq->syn_ect_snt = 0;
#if IS_ENABLED(CONFIG_MPTCP)
treq->is_mptcp = sk_is_mptcp(sk);
@@ -502,6 +506,9 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
ireq->rcv_wscale = rcv_wscale;
ireq->ecn_ok &= cookie_ecn_ok(net, &rt->dst);
treq->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th);
+ /* SYN-ACK was not sent by the kernel if req->syncookie is set. */
+ if (!req->syncookie)
+ treq->syn_ect_snt = READ_ONCE(inet_sk(sk)->tos) & INET_ECN_MASK;
ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst);
/* ip_queue_xmit() depends on our flow being setup
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index b33011b71fff6..e8d45a627ca26 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -276,6 +276,9 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq->rcv_wscale = rcv_wscale;
ireq->ecn_ok &= cookie_ecn_ok(net, dst);
tcp_rsk(req)->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th);
+ /* SYN-ACK was not sent by the kernel if req->syncookie is set. */
+ if (!req->syncookie)
+ tcp_rsk(req)->syn_ect_snt = READ_ONCE(np->tclass) & INET_ECN_MASK;
ret = tcp_get_cookie_sock(sk, skb, req, dst);
if (!ret) {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 150/742] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (139 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 149/742] tcp: accecn: initialize AccECN fields in syncookie path Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 151/742] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
` (16 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiangwu Lai, Frank Li,
Amelie Delaunay, Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
[ Upstream commit 34c8c2ea213aab7b452df93e5b7547f4459a49e9 ]
stm32_mdma_pm_suspend() increments the runtime PM usage counter with
pm_runtime_resume_and_get(), but when a channel is still enabled it
returns -EBUSY directly without dropping the reference. The matching
pm_runtime_put_sync() only runs on the success path.
Each failed suspend attempt therefore leaks one runtime PM reference,
so the device can never runtime suspend afterwards. Drop the
reference before returning -EBUSY.
Fixes: 7cb819c856d9 ("dmaengine: stm32-mdma: add suspend/resume power management support")
Signed-off-by: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20261102104432.873-1-laixiangwu@cmss.chinamobile.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/stm32/stm32-mdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
index e3bbdc9ee36ed..fe1ff4a009fd3 100644
--- a/drivers/dma/stm32/stm32-mdma.c
+++ b/drivers/dma/stm32/stm32-mdma.c
@@ -1785,6 +1785,7 @@ static int stm32_mdma_pm_suspend(struct device *dev)
ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id));
if (ccr & STM32_MDMA_CCR_EN) {
dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
+ pm_runtime_put_sync(dev);
return -EBUSY;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 151/742] dmaengine: idxd: Free the minor number when cdev setup fails
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (140 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 150/742] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 152/742] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
` (15 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, SeungUk Nam, Frank Li, Vinod Koul,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungUk Nam <tmddnr49449@gmail.com>
[ Upstream commit 56cbd7f69ce6037738410a5c50efb7cacf52b0ae ]
idxd_wq_add_cdev() allocates a minor number from cdev_ctx->minor_ida for
the new struct idxd_cdev. When dev_set_name() or cdev_device_add()
fails, the error path calls put_device(), and the release callback
idxd_cdev_dev_release() only frees idxd_cdev, so the minor number is
never returned to the ida. Leaked numbers accumulate across bind/unbind
cycles, up to MINORMASK, for as long as the module stays loaded.
Free the minor number before put_device() drops the last reference on
that path.
Fixes: c311f5e92484 ("dmaengine: idxd: Fix freeing the allocated ida too late")
Signed-off-by: SeungUk Nam <tmddnr49449@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260910074832.15729-1-tmddnr49449@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/idxd/cdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index 82b07cf942ef8..f1af7f0d25d34 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -573,6 +573,7 @@ int idxd_wq_add_cdev(struct idxd_wq *wq)
return 0;
err:
+ ida_free(&cdev_ctx->minor_ida, minor);
put_device(dev);
wq->idxd_cdev = NULL;
return rc;
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 152/742] dmaengine: rcar-dmac: Fix PM usage counter imbalance
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (141 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 151/742] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 153/742] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
` (14 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhang Shurong, Geert Uytterhoeven,
Frank Li, Laurent Pinchart, Wolfram Sang, Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <zhang_shurong@foxmail.com>
[ Upstream commit d3c108c095712a3b7eab292ef7ea9a57ff5cd5d7 ]
pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here. We
fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.
Fixes: 87244fe5abdf ("dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://patch.msgid.link/20261012123020.11320-6-wsa+renesas@sang-engineering.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/sh/rcar-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 44eab2d21d54f..2d2baa36feeae 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1068,7 +1068,7 @@ static int rcar_dmac_alloc_chan_resources(struct dma_chan *chan)
if (ret < 0)
return -ENOMEM;
- return pm_runtime_get_sync(chan->device->dev);
+ return pm_runtime_resume_and_get(chan->device->dev);
}
static void rcar_dmac_free_chan_resources(struct dma_chan *chan)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 153/742] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (142 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 152/742] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 154/742] usb: gadget: f_hid: fix report_list entries leak Greg Kroah-Hartman
` (13 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Koichiro Den, Wolfram Sang, Frank Li,
Vinod Koul, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <den@valinux.co.jp>
[ Upstream commit 0ca154b10168d8874b871edf5510640c51b326c3 ]
Call dma_descriptor_unmap() right before dma_cookie_complete() in the
threaded IRQ completion path. Without this, streaming DMA mappings
attached to the descriptor are never released and may eventually exhaust
DMA mapping resources (e.g. IOVA with an IOMMU or bounce-buffer slots
with SWIOTLB), leading to dma_map_* failures.
Also ensure dma_descriptor_unmap() is called in rcar_dmac_chan_reinit()
(error/terminate path) to avoid the same type of leaks.
Fixes: 87244fe5abdf ("dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
[wsa: moved unmap before cookie completion, added Fixes tag]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261012123020.11320-7-wsa+renesas@sang-engineering.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/sh/rcar-dmac.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 2d2baa36feeae..8d9fcb0bd809a 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -842,6 +842,7 @@ static void rcar_dmac_chan_reinit(struct rcar_dmac_chan *chan)
list_for_each_entry_safe(desc, _desc, &descs, node) {
list_del(&desc->node);
+ dma_descriptor_unmap(&desc->async_tx);
rcar_dmac_desc_put(chan, desc);
}
}
@@ -1651,6 +1652,7 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
while (!list_empty(&chan->desc.done)) {
desc = list_first_entry(&chan->desc.done, struct rcar_dmac_desc,
node);
+ dma_descriptor_unmap(&desc->async_tx);
dma_cookie_complete(&desc->async_tx);
list_del(&desc->node);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 154/742] usb: gadget: f_hid: fix report_list entries leak
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (143 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 153/742] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 155/742] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response Greg Kroah-Hartman
` (12 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit 19e8981057fb5947697f99a3c6a3f6ff4a2d85a1 ]
Each GADGET_HID_WRITE_GET_REPORT ioctl for a report ID that is not
yet in hidg->report_list allocates a report_entry and adds it to
the list. hidg_release() frees report_desc and set_report_buf, but
never walks report_list, so every accumulated entry leaks on
function destroy (e.g. when the HID gadget is unbound and the
device is removed).
Free the entries in hidg_release(). This is safe without extra
locking: at release time the function is unbound (the workqueue is
already destroyed and userspace has no way to reach the ioctl).
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-2-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 3c6b43d06a6d1..670ae7959bbd7 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -121,6 +121,12 @@ static inline struct f_hidg *func_to_hidg(struct usb_function *f)
static void hidg_release(struct device *dev)
{
struct f_hidg *hidg = container_of(dev, struct f_hidg, dev);
+ struct report_entry *entry, *tmp;
+
+ list_for_each_entry_safe(entry, tmp, &hidg->report_list, node) {
+ list_del(&entry->node);
+ kfree(entry);
+ }
kfree(hidg->report_desc);
kfree(hidg->set_report_buf);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 155/742] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (144 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 154/742] usb: gadget: f_hid: fix report_list entries leak Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 156/742] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails Greg Kroah-Hartman
` (11 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit 07ec204e8aecbfee425008832b18d5d720daca6d ]
The GET_REPORT response is served by pointing get_req->buf at the
data[] array of a report_list entry and calling usb_ep_queue().
The request completes asynchronously, so the controller may still
be reading the entry's buffer after get_report_workqueue_handler()
drops get_report_spinlock.
At the same time, userspace can update that same entry via the
GADGET_HID_WRITE_GET_REPORT ioctl: f_hidg_get_report() copies new
report data into the entry while holding the spinlock, but the
transfer reading the entry is not serialized against that update
(the lock was already released by the work handler).
The result is that the host can receive a GET_REPORT response that
mixes bytes of the old and the new report (a torn write), with no
memory-safety violation but corrupted report data on the wire.
Serve the response from a dedicated buffer allocated once in
hidg_alloc() and freed in hidg_release().
This also removes the now unused get_report member from struct
f_hidg.
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-3-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 670ae7959bbd7..e29e7d1da924a 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -94,7 +94,7 @@ struct f_hidg {
/* get report */
struct usb_request *get_req;
- struct usb_hidg_report get_report;
+ void *get_req_buf;
bool get_report_returned;
int get_report_req_report_id;
int get_report_req_report_length;
@@ -128,6 +128,7 @@ static void hidg_release(struct device *dev)
kfree(entry);
}
+ kfree(hidg->get_req_buf);
kfree(hidg->report_desc);
kfree(hidg->set_report_buf);
kfree(hidg);
@@ -587,7 +588,7 @@ static void get_report_workqueue_handler(struct work_struct *work)
ptr = f_hidg_search_for_report(hidg, hidg->get_report_req_report_id);
if (ptr && !ptr->report_data.userspace_req) {
/* Report exists in list and it is to be used for immediate response */
- req->buf = ptr->report_data.data;
+ memcpy(req->buf, ptr->report_data.data, req->length);
status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
hidg->get_report_returned = true;
spin_unlock_irqrestore(&hidg->get_report_spinlock, flags);
@@ -622,10 +623,9 @@ static void get_report_workqueue_handler(struct work_struct *work)
* Either get an updated response just serviced by userspace
* or send the latest response in the list
*/
- req->buf = ptr->report_data.data;
+ memcpy(req->buf, ptr->report_data.data, req->length);
} else {
/* If there are no prevoiusly sent reports send empty report */
- req->buf = hidg->get_report.data;
memset(req->buf, 0x0, req->length);
}
@@ -1161,6 +1161,15 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
if (!hidg->get_req)
return -ENOMEM;
+ /*
+ * The GET_REPORT response is served from a dedicated buffer
+ * (allocated in hidg_alloc()), not from the report_list
+ * entries: userspace may update an entry while the controller
+ * is still reading the previous response, which would corrupt
+ * the data on the wire.
+ */
+ hidg->get_req->buf = hidg->get_req_buf;
+
hidg->get_req->zero = 0;
hidg->get_req->complete = hidg_get_report_complete;
hidg->get_req->context = hidg;
@@ -1647,6 +1656,18 @@ static struct usb_function *hidg_alloc(struct usb_function_instance *fi)
}
hidg->use_out_ep = !opts->no_out_endpoint;
+ /*
+ * Dedicated buffer for GET_REPORT responses, allocated once for
+ * the whole lifetime of this function instance: hidg_release()
+ * is the only safe free point, as it runs after all USB
+ * activity has ceased and all file references are gone.
+ */
+ hidg->get_req_buf = kmalloc(MAX_REPORT_LENGTH, GFP_KERNEL);
+ if (!hidg->get_req_buf) {
+ ret = -ENOMEM;
+ goto err_put_device;
+ }
+
++opts->refcnt;
mutex_unlock(&opts->lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 156/742] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (145 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 155/742] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 157/742] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
` (10 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit f11175ece1250557ec595ea7a2854f0391cab53d ]
In hidg_bind(), hidg->get_req is allocated early; if
usb_gstrings_attach() subsequently fails, the function returns
directly without freeing the request, leaking it. Unwind through
the fail path instead.
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-4-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index e29e7d1da924a..53ea214280b95 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -1178,8 +1178,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
/* maybe allocate device-global string IDs, and patch descriptors */
us = usb_gstrings_attach(c->cdev, ct_func_strings,
ARRAY_SIZE(ct_func_string_defs));
- if (IS_ERR(us))
- return PTR_ERR(us);
+ if (IS_ERR(us)) {
+ status = PTR_ERR(us);
+ goto fail;
+ }
hidg_interface_desc.iInterface = us[CT_FUNC_HID_IDX].id;
/* allocate instance-specific interface IDs, and patch descriptors */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 157/742] HID: sensor: custom: Fix state lifetime during removal
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (146 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 156/742] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 158/742] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
` (9 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit ac6c19392c7996ac8135dba6907c391a4be5beaf ]
Open misc device files can outlive platform-device removal. Since the
devm-allocated state can be freed while a reader is queued on its wait
queue, subsequent file operations may access freed memory.
Allocate the state independently of devres and give every open
file a reference to keep the FIFO and state alive after removal.
On removal, mark the device as disconnected and wake readers; make reads
return -ENODEV and polls report hangup and error. Free the FIFO and state
when the final reference is released. Unregister the sensor hub callback
before tearing down the interface so in-flight raw-event processing
finishes before the sensor state can be freed.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 82 ++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 26 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 8375697b459da..c940630d76db5 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/kfifo.h>
+#include <linux/kref.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/poll.h>
@@ -37,6 +38,8 @@ struct hid_sensor_custom_field {
struct hid_sensor_custom {
struct mutex mutex;
+ struct kref ref;
+ bool removed;
struct platform_device *pdev;
struct hid_sensor_hub_device *hsdev;
struct hid_sensor_hub_callbacks callbacks;
@@ -643,6 +646,15 @@ static void hid_sensor_custom_remove_attributes(struct hid_sensor_custom *
kfree(sensor_inst->fields);
}
+static void hid_sensor_custom_free(struct kref *ref)
+{
+ struct hid_sensor_custom *sensor_inst =
+ container_of(ref, struct hid_sensor_custom, ref);
+
+ kfifo_free(&sensor_inst->data_fifo);
+ kfree(sensor_inst);
+}
+
static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
size_t count, loff_t *f_ps)
{
@@ -656,22 +668,27 @@ static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
if (count < sizeof(struct hid_sensor_sample))
return -EINVAL;
- do {
- if (kfifo_is_empty(&sensor_inst->data_fifo)) {
- if (file->f_flags & O_NONBLOCK)
- return -EAGAIN;
+ for (;;) {
+ if (READ_ONCE(sensor_inst->removed))
+ return -ENODEV;
- ret = wait_event_interruptible(sensor_inst->wait,
- !kfifo_is_empty(&sensor_inst->data_fifo));
- if (ret)
- return ret;
- }
ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
&copied);
+ if (ret || copied)
+ break;
+
+ if (file->f_flags & O_NONBLOCK)
+ return -EAGAIN;
+
+ ret = wait_event_interruptible(sensor_inst->wait,
+ READ_ONCE(sensor_inst->removed) ||
+ !kfifo_is_empty(&sensor_inst->data_fifo));
if (ret)
return ret;
+ }
- } while (copied == 0);
+ if (ret)
+ return ret;
return copied;
}
@@ -684,6 +701,7 @@ static int hid_sensor_custom_release(struct inode *inode, struct file *file)
struct hid_sensor_custom, custom_dev);
clear_bit(0, &sensor_inst->misc_opened);
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
return 0;
}
@@ -691,14 +709,25 @@ static int hid_sensor_custom_release(struct inode *inode, struct file *file)
static int hid_sensor_custom_open(struct inode *inode, struct file *file)
{
struct hid_sensor_custom *sensor_inst;
+ int ret;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
+ if (READ_ONCE(sensor_inst->removed))
+ return -ENODEV;
+
/* We essentially have single reader and writer */
if (test_and_set_bit(0, &sensor_inst->misc_opened))
return -EBUSY;
- return stream_open(inode, file);
+ kref_get(&sensor_inst->ref);
+ ret = stream_open(inode, file);
+ if (ret) {
+ clear_bit(0, &sensor_inst->misc_opened);
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
+ }
+
+ return ret;
}
static __poll_t hid_sensor_custom_poll(struct file *file,
@@ -712,6 +741,9 @@ static __poll_t hid_sensor_custom_poll(struct file *file,
poll_wait(file, &sensor_inst->wait, wait);
+ if (READ_ONCE(sensor_inst->removed))
+ return EPOLLHUP | EPOLLERR;
+
if (!kfifo_is_empty(&sensor_inst->data_fifo))
mask = EPOLLIN | EPOLLRDNORM;
@@ -741,21 +773,15 @@ static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
sensor_inst->custom_dev.minor = MISC_DYNAMIC_MINOR;
sensor_inst->custom_dev.name = dev_name(&sensor_inst->pdev->dev);
sensor_inst->custom_dev.fops = &hid_sensor_custom_fops;
- ret = misc_register(&sensor_inst->custom_dev);
- if (ret) {
- kfifo_free(&sensor_inst->data_fifo);
- return ret;
- }
- return 0;
+ return misc_register(&sensor_inst->custom_dev);
}
static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
*sensor_inst)
{
- wake_up(&sensor_inst->wait);
+ WRITE_ONCE(sensor_inst->removed, true);
+ wake_up_interruptible_all(&sensor_inst->wait);
misc_deregister(&sensor_inst->custom_dev);
- kfifo_free(&sensor_inst->data_fifo);
-
}
/*
@@ -978,8 +1004,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
int ret;
const struct hid_sensor_custom_match *match;
- sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
- GFP_KERNEL);
+ sensor_inst = kzalloc(sizeof(*sensor_inst), GFP_KERNEL);
if (!sensor_inst)
return -ENOMEM;
@@ -989,6 +1014,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
sensor_inst->hsdev = hsdev;
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
+ kref_init(&sensor_inst->ref);
platform_set_drvdata(pdev, sensor_inst);
ret = hid_sensor_custom_get_known(hsdev, &match);
@@ -1000,7 +1026,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"register_platform_device failed\n");
- return ret;
+ goto err_put;
}
return 0;
@@ -1010,7 +1036,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
&sensor_inst->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
- return ret;
+ goto err_put;
}
ret = hid_sensor_custom_add_attributes(sensor_inst);
@@ -1035,6 +1061,8 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
hid_sensor_custom_remove_attributes(sensor_inst);
err_remove_callback:
sensor_hub_remove_callback(hsdev, hsdev->usage);
+err_put:
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
return ret;
}
@@ -1046,9 +1074,10 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
if (sensor_inst->custom_pdev) {
platform_device_unregister(sensor_inst->custom_pdev);
- return;
+ goto out;
}
+ sensor_hub_remove_callback(hsdev, hsdev->usage);
hid_sensor_custom_dev_if_remove(sensor_inst);
/* Remove enable_sensor first as it uses fields via power_state/report_state. */
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
@@ -1061,7 +1090,8 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
}
mutex_unlock(&sensor_inst->mutex);
hid_sensor_custom_remove_attributes(sensor_inst);
- sensor_hub_remove_callback(hsdev, hsdev->usage);
+out:
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
}
static const struct platform_device_id hid_sensor_custom_ids[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 158/742] HID: sensor: custom: Serialize misc device reads
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (147 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 157/742] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 159/742] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
` (8 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit fecb7895fbb1b7891e81a033f0dd1f5f7876dc07 ]
The misc device permits only one open file, but threads sharing that
file can still read concurrently. Serialize readers to preserve the
single-reader assumption of the FIFO while keeping removal independent
of a stalled user copy.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index c940630d76db5..f9e604920ea76 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -38,6 +38,7 @@ struct hid_sensor_custom_field {
struct hid_sensor_custom {
struct mutex mutex;
+ struct mutex read_mutex;
struct kref ref;
bool removed;
struct platform_device *pdev;
@@ -668,25 +669,39 @@ static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
if (count < sizeof(struct hid_sensor_sample))
return -EINVAL;
+ if (file->f_flags & O_NONBLOCK) {
+ if (!mutex_trylock(&sensor_inst->read_mutex))
+ return -EAGAIN;
+ } else {
+ ret = mutex_lock_interruptible(&sensor_inst->read_mutex);
+ if (ret)
+ return ret;
+ }
+
for (;;) {
- if (READ_ONCE(sensor_inst->removed))
- return -ENODEV;
+ if (READ_ONCE(sensor_inst->removed)) {
+ ret = -ENODEV;
+ break;
+ }
ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
&copied);
if (ret || copied)
break;
- if (file->f_flags & O_NONBLOCK)
- return -EAGAIN;
+ if (file->f_flags & O_NONBLOCK) {
+ ret = -EAGAIN;
+ break;
+ }
ret = wait_event_interruptible(sensor_inst->wait,
READ_ONCE(sensor_inst->removed) ||
!kfifo_is_empty(&sensor_inst->data_fifo));
if (ret)
- return ret;
+ break;
}
+ mutex_unlock(&sensor_inst->read_mutex);
if (ret)
return ret;
@@ -1014,6 +1029,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
sensor_inst->hsdev = hsdev;
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
+ mutex_init(&sensor_inst->read_mutex);
kref_init(&sensor_inst->ref);
platform_set_drvdata(pdev, sensor_inst);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 159/742] HID: sensor: custom: Register enable attribute after misc device
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (148 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 158/742] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 160/742] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
` (7 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit c6ebe27e3ba09edf956139c741b38e8432be3f67 ]
Register the enable_sensor sysfs group only after misc-device setup
succeeds. This prevents userspace from opening the sensor hub while
probe can still fail, which would otherwise leave the hub open reference
unbalanced on unwind.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index f9e604920ea76..4d7cb7994dd81 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -1059,20 +1059,19 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
if (ret)
goto err_remove_callback;
- ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
- &enable_sensor_attr_group);
+ ret = hid_sensor_custom_dev_if_add(sensor_inst);
if (ret)
goto err_remove_attributes;
- ret = hid_sensor_custom_dev_if_add(sensor_inst);
+ ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
+ &enable_sensor_attr_group);
if (ret)
- goto err_remove_group;
+ goto err_remove_dev_if;
return 0;
-err_remove_group:
- sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
- &enable_sensor_attr_group);
+err_remove_dev_if:
+ hid_sensor_custom_dev_if_remove(sensor_inst);
err_remove_attributes:
hid_sensor_custom_remove_attributes(sensor_inst);
err_remove_callback:
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 160/742] HID: sensor-hub: Remove clients before stopping hardware
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (149 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 159/742] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 161/742] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
` (6 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 41cb3076a221afba052ae1624ccf62e500706b20 ]
Remove MFD clients before stopping the HID hardware so their close calls
remain valid. Runtime-PM teardown may cancel a pending autosuspend without
running the client suspend callback, leaving hub references after child
removal.
Clients share one HID open while ref_cnt is nonzero. After removing the
children, drain any remaining references and call hid_hw_close() once if
the count is nonzero. Then stop the HID hardware. This avoids both a
leaked open and the underflow caused by an unconditional close.
The pending-request walk runs before hid_hw_stop() disconnects HID-core
children such as hidraw. Skip non-platform children and platform children
without sensor-hub data before checking pending request state.
Fixes: 1df3a401154a ("HID: Delay opening HID device")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-hub.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 0c4884c5821fd..e9d6eb3b38314 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -10,6 +10,7 @@
#include <linux/slab.h>
#include <linux/mfd/core.h>
#include <linux/list.h>
+#include <linux/platform_device.h>
#include <linux/hid-sensor-ids.h>
#include <linux/hid-sensor-hub.h>
#include "hid-ids.h"
@@ -806,7 +807,14 @@ static int sensor_hub_probe(struct hid_device *hdev,
static int sensor_hub_finalize_pending_fn(struct device *dev, void *data)
{
- struct hid_sensor_hub_device *hsdev = dev->platform_data;
+ struct hid_sensor_hub_device *hsdev;
+
+ if (!dev_is_platform(dev))
+ return 0;
+
+ hsdev = to_platform_device(dev)->dev.platform_data;
+ if (!hsdev)
+ return 0;
if (hsdev->pending.status)
complete(&hsdev->pending.ready);
@@ -820,8 +828,6 @@ static void sensor_hub_remove(struct hid_device *hdev)
unsigned long flags;
hid_dbg(hdev, " hardware removed\n");
- hid_hw_close(hdev);
- hid_hw_stop(hdev);
spin_lock_irqsave(&data->lock, flags);
device_for_each_child(&hdev->dev, NULL,
@@ -829,6 +835,14 @@ static void sensor_hub_remove(struct hid_device *hdev)
spin_unlock_irqrestore(&data->lock, flags);
mfd_remove_devices(&hdev->dev);
+ /* Clients share one HID open; release it if references remain. */
+ mutex_lock(&data->mutex);
+ if (data->ref_cnt) {
+ data->ref_cnt = 0;
+ hid_hw_close(hdev);
+ }
+ mutex_unlock(&data->mutex);
+ hid_hw_stop(hdev);
mutex_destroy(&data->mutex);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 161/742] HID: letsketch: skip string descriptors the firmware does not implement
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (150 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 160/742] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 162/742] HID: Intel-thc-hid: Fix REGMAP dependency Greg Kroah-Hartman
` (5 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eren Çakar, Hans de Goede,
Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eren Çakar <hey@erencakar.com>
[ Upstream commit f2f69bbddd34801cbf6af2e89235ca427f3811c5 ]
The Starcom GC-422 is a rebranded LetSketch WP9620C with the same USB
ID (6161:4d15), so it binds to this driver. Its firmware
("Vision_V201_180530") does not implement every string descriptor index
that the raw mode handshake reads. For those indices usb_string() keeps
returning an empty string or -EPIPE, letsketch_get_string() gives up
after its retries, and the probe fails:
letsketch ...: probe with driver letsketch failed with error -5
The tablet then does not work at all.
The handshake only needs the reads to happen, not their contents. Once
the retries are used up, report an index that still reads as empty or
STALLs as missing with -ENOENT, and let the probe skip it. Other errors
still fail the probe as before, and the retries stay in place, so
firmware that only fails a read now and then behaves as it did.
With this change the GC-422 completes the handshake, switches to raw
mode and reports pen position, pressure and the five pad buttons.
The change and this message were written with the help of an AI coding
assistant (Claude Code); I reviewed them and tested the result on the
hardware.
Fixes: 33a5c2793451 ("HID: Add new Letsketch tablet driver")
Signed-off-by: Eren Çakar <hey@erencakar.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-letsketch.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-letsketch.c b/drivers/hid/hid-letsketch.c
index b52e93a91ae54..6a93245b7ac1e 100644
--- a/drivers/hid/hid-letsketch.c
+++ b/drivers/hid/hid-letsketch.c
@@ -213,6 +213,12 @@ static int letsketch_raw_event(struct hid_device *hdev,
* string descriptors. But the firmware is buggy and does not like it if
* we do this too fast. Even if we go slow sometimes the usb_string() call
* fails. Ignore errors and retry it a couple of times if necessary.
+ *
+ * Some firmware revisions (e.g. "Vision_V201_180530", sold as the Starcom
+ * GC-422) do not implement every string descriptor index the handshake
+ * reads. For those indices usb_string() keeps returning an empty string or
+ * -EPIPE (STALL). Report such an index as missing with -ENOENT once the
+ * retries are used up, so that the caller can skip it.
*/
static int letsketch_get_string(struct usb_device *udev, int index, char *buf, int size)
{
@@ -225,9 +231,14 @@ static int letsketch_get_string(struct usb_device *udev, int index, char *buf, i
return 0;
}
+ if (ret == 0 || ret == -EPIPE) {
+ dev_dbg(&udev->dev, "String descriptor %d not implemented\n", index);
+ return -ENOENT;
+ }
+
dev_err(&udev->dev, "Max retries (%d) exceeded reading string descriptor %d\n",
LETSKETCH_GET_STRING_RETRIES, index);
- return ret ? ret : -EIO;
+ return ret;
}
static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -256,6 +267,8 @@ static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *
*/
for (i = LETSKETCH_INFO_STR_IDX_BEGIN; i <= LETSKETCH_INFO_STR_IDX_END; i++) {
ret = letsketch_get_string(udev, i, buf, sizeof(buf));
+ if (ret == -ENOENT)
+ continue;
if (ret)
return ret;
@@ -264,16 +277,16 @@ static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *
for (i = 1; i <= 250; i++) {
ret = letsketch_get_string(udev, i, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
}
ret = letsketch_get_string(udev, 0x64, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
ret = letsketch_get_string(udev, LETSKETCH_INFO_STR_IDX_BEGIN, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 162/742] HID: Intel-thc-hid: Fix REGMAP dependency
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (151 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 161/742] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 163/742] HID: nintendo: release the player ID when LED setup fails Greg Kroah-Hartman
` (4 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mathias Krause, Even Xu, Jiri Kosina,
Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <minipli@grsecurity.net>
[ Upstream commit 914d46521de1bdd999fb4c6263172c13b2164218 ]
intel-thc-{dev,dma}.c make use of the regmap API and related data
structures, breaking the build if CONFIG_REGMAP isn't set.
Fix that by forcibly enabling REGMAP when this driver gets build.
Fixes: 1b2d05384c29 ("HID: intel-thc-hid: Add basic THC driver skeleton")
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Reviewed-by: Even Xu <even.xu@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/intel-thc-hid/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/intel-thc-hid/Kconfig b/drivers/hid/intel-thc-hid/Kconfig
index 9d74e53b8c62b..57a1e51cb512e 100644
--- a/drivers/hid/intel-thc-hid/Kconfig
+++ b/drivers/hid/intel-thc-hid/Kconfig
@@ -8,6 +8,7 @@ config INTEL_THC_HID
tristate "Intel Touch Host Controller"
depends on ACPI
select SGL_ALLOC
+ select REGMAP
help
THC (Touch Host Controller) is the name of the IP block in PCH that
interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 163/742] HID: nintendo: release the player ID when LED setup fails
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (152 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 162/742] HID: Intel-thc-hid: Fix REGMAP dependency Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 164/742] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
` (3 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Changyul Lee, Sang-Hoon Choi,
Jiri Kosina, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sang-Hoon Choi <csh0052@gmail.com>
[ Upstream commit 10bc1d627c297097cfdc099377f8a13efdfffd86 ]
joycon_leds_create() allocates a player ID before allocating the LED
names and registering the LEDs. If one of those later steps fails,
nintendo_hid_probe() jumps to err_io_stop and skips the ID cleanup.
The failed probe leaves the allocated ID in nintendo_player_id_allocator.
Use err_ida for this failure, as the power supply and input setup error
paths already do. If the ID allocation itself failed, player_id is
U32_MAX and ida_free() leaves the allocator untouched.
Fixes: 5307de63d71d ("HID: nintendo: use ida for LED player id")
Reported-by: Changyul Lee <lcy8047@gmail.com>
Assisted-by: LLM
Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-nintendo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index b1fcf3e5767ba..23b836a766f30 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -2784,7 +2784,7 @@ static int nintendo_hid_probe(struct hid_device *hdev,
ret = joycon_leds_create(ctlr);
if (ret) {
hid_err(hdev, "Failed to create leds; ret=%d\n", ret);
- goto err_io_stop;
+ goto err_ida;
}
/* Initialize the battery power supply */
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 164/742] usb: cdns3: report endpoint reset timeout
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (153 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 163/742] HID: nintendo: release the player ID when LED setup fails Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 165/742] Bluetooth: MSFT: Record the filter state on Command Disallowed Greg Kroah-Hartman
` (2 subsequent siblings)
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Peter Chen, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
[ Upstream commit 8f51823de3c9184fd8b7a4430a030eb071f39dae ]
cdns3_gadget_ep_disable() discards the endpoint reset poll result and
then tests ret, which is still zero. A reset timeout is therefore
neither reported nor returned to the caller.
Store the poll result in ret so the existing diagnostic and return path
expose the timeout.
Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Add: stable@kernel.org
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://patch.msgid.link/20261003081152.433499-1-yaojiale02@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/cdns3/cdns3-gadget.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 0d272e9c556ca..e79340e1d2471 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -2530,9 +2530,9 @@ static int cdns3_gadget_ep_disable(struct usb_ep *ep)
!(val & EP_STS_DBUSY), 1, 10);
writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
- readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
- !(val & (EP_CMD_CSTALL | EP_CMD_EPRST)),
- 1, 1000);
+ ret = readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
+ !(val & (EP_CMD_CSTALL | EP_CMD_EPRST)),
+ 1, 1000);
if (unlikely(ret))
dev_err(priv_dev->dev, "Timeout: %s resetting failed.\n",
priv_ep->name);
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 165/742] Bluetooth: MSFT: Record the filter state on Command Disallowed
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (154 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 164/742] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 166/742] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 167/742] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Greg Kroah-Hartman
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas de Gruijter,
Luiz Augusto von Dentz, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas de Gruijter <thomasdegruijter@pm.me>
[ Upstream commit 75d6b9d82c35d35dad9fdd783975be1edd32fe2f ]
msft_le_set_advertisement_filter_enable_cb() treats status 0x0C (Command
Disallowed) as success: a controller returns it when the advertisement
filter is already in the requested state, and some controllers start
with the filter enabled.
Since commit 493ea69970e2 ("Bluetooth: Convert MSFT filter HCI cmd to
hci_sync") the callback is passed the return value of
__hci_cmd_sync_status() instead of the HCI status. That function reports
Command Disallowed as -EBUSY, so the 0x0C branch is never taken and
msft->filter_enabled keeps its old value whenever the filter was already
in the requested state. msft_set_filter_enable() also always returns 0,
hiding real errors from its callers.
Pass the error code to the callback, treat -EBUSY as the filter already
being in the requested state, and return real errors from
msft_set_filter_enable(). Nothing reads msft->filter_enabled yet, but
the next patch relies on it to decide when to change the filter state.
The problem was found, with the help of an AI coding assistant
(Claude Code with Claude Opus 5.5).
Fixes: 493ea69970e2 ("Bluetooth: Convert MSFT filter HCI cmd to hci_sync")
Signed-off-by: Thomas de Gruijter <thomasdegruijter@pm.me>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 7a06c2b8974b7..f372df9a98311 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -1142,26 +1142,27 @@ __u64 msft_get_features(struct hci_dev *hdev)
static void msft_le_set_advertisement_filter_enable_cb(struct hci_dev *hdev,
void *user_data,
- u8 status)
+ int err)
{
struct msft_cp_le_set_advertisement_filter_enable *cp = user_data;
struct msft_data *msft = hdev->msft_data;
- /* Error 0x0C would be returned if the filter enabled status is
+ /* Error 0x0C (Command Disallowed), which __hci_cmd_sync_status()
+ * reports as -EBUSY, would be returned if the filter enabled status is
* already set to whatever we were trying to set.
* Although the default state should be disabled, some controller set
* the initial value to enabled. Because there is no way to know the
* actual initial value before sending this command, here we also treat
* error 0x0C as success.
*/
- if (status != 0x00 && status != 0x0C)
+ if (err && err != -EBUSY)
return;
hci_dev_lock(hdev);
msft->filter_enabled = cp->enable;
- if (status == 0x0C)
+ if (err == -EBUSY)
bt_dev_warn(hdev, "MSFT filter_enable is already %s",
cp->enable ? "on" : "off");
@@ -1212,7 +1213,7 @@ int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
msft_le_set_advertisement_filter_enable_cb(hdev, &cp, err);
- return 0;
+ return err == -EBUSY ? 0 : err;
}
bool msft_curve_validity(struct hci_dev *hdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 166/742] Bluetooth: MSFT: Only enable the advertisement filter with monitors
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (155 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 165/742] Bluetooth: MSFT: Record the filter state on Command Disallowed Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 7.3 167/742] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Greg Kroah-Hartman
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas de Gruijter,
Luiz Augusto von Dentz, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas de Gruijter <thomasdegruijter@pm.me>
[ Upstream commit 4a8f9b7fb4f503f48e2ccfc67caa8b07d303f8a8 ]
msft_do_open() unconditionally enables the MSFT LE advertisement filter
on every power on, whether or not any advertisement monitor is
registered.
On MediaTek MT7922 (USB 0e8d:0616, firmware build 20260724) the
controller then drops every LE advertisement: LE Set Extended Scan
Enable succeeds, but no LE Extended Advertising Report is ever
delivered, so LE discovery and passive scanning find nothing. BR/EDR
inquiry is not affected. Sending LE Set Advertisement Filter Enable with
Enable set to 0x00 restores reporting immediately. The Microsoft HCI
extension specification defines the filter as disabled by default and
does not specify what a controller reports while the filter is enabled
without any monitor condition.
Only enable the filter while at least one monitor is offloaded to the
controller, and update it after a monitor is added or removed and after
the monitors are re-registered on power on and resume. Like the
monitors, the filter state does not survive a power off, so reset the
tracked state in msft_do_close() instead of sending a redundant disable
on power on. A command is only sent when the wanted state differs from
msft->filter_enabled, so this depends on the previous patch keeping
that state accurate when the controller reports the filter as already
being in the requested state.
Fixes: 394566bf1e37 ("Bluetooth: advmon offload MSFT handle filter enablement")
Signed-off-by: Thomas de Gruijter <thomasdegruijter@pm.me>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 46 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index f372df9a98311..db7b40ab5fc16 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -468,6 +468,30 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
return err;
}
+/* Keep the advertisement filter enabled only while at least one monitor is
+ * offloaded to the controller. With the filter enabled and no monitors, some
+ * controllers (e.g. MediaTek MT7922) drop every advertisement, which breaks
+ * LE discovery and passive scanning entirely.
+ *
+ * This function requires the caller holds hci_req_sync_lock
+ */
+static void msft_update_filter_enable(struct hci_dev *hdev)
+{
+ struct msft_data *msft = hdev->msft_data;
+ bool enable, update;
+
+ if (!msft)
+ return;
+
+ hci_dev_lock(hdev);
+ enable = !list_empty(&msft->handle_map);
+ update = enable != msft->filter_enabled;
+ hci_dev_unlock(hdev);
+
+ if (update)
+ msft_set_filter_enable(hdev, enable);
+}
+
/* This function requires the caller holds hci_req_sync_lock */
int msft_suspend_sync(struct hci_dev *hdev)
{
@@ -493,6 +517,8 @@ int msft_suspend_sync(struct hci_dev *hdev)
/* All monitors have been removed */
msft->suspending = false;
+ msft_update_filter_enable(hdev);
+
return 0;
}
@@ -633,6 +659,7 @@ int msft_resume_sync(struct hci_dev *hdev)
hci_dev_unlock(hdev);
reregister_monitor(hdev);
+ msft_update_filter_enable(hdev);
return 0;
}
@@ -670,11 +697,11 @@ void msft_do_open(struct hci_dev *hdev)
if (msft_monitor_supported(hdev)) {
msft->resuming = true;
- msft_set_filter_enable(hdev, true);
/* Monitors get removed on power off, so we need to explicitly
* tell the controller to re-monitor.
*/
reregister_monitor(hdev);
+ msft_update_filter_enable(hdev);
}
}
@@ -706,6 +733,11 @@ void msft_do_close(struct hci_dev *hdev)
kfree(handle_data);
}
+ /* The advertisement filter is back to its default, disabled state
+ * after power off as well.
+ */
+ msft->filter_enabled = false;
+
hci_dev_unlock(hdev);
mutex_lock(&msft->filter_lock);
@@ -1173,6 +1205,7 @@ static void msft_le_set_advertisement_filter_enable_cb(struct hci_dev *hdev,
int msft_add_monitor_pattern(struct hci_dev *hdev, struct adv_monitor *monitor)
{
struct msft_data *msft = hdev->msft_data;
+ int err;
if (!msft)
return -EOPNOTSUPP;
@@ -1180,13 +1213,17 @@ int msft_add_monitor_pattern(struct hci_dev *hdev, struct adv_monitor *monitor)
if (msft->resuming || msft->suspending)
return -EBUSY;
- return msft_add_monitor_sync(hdev, monitor);
+ err = msft_add_monitor_sync(hdev, monitor);
+ msft_update_filter_enable(hdev);
+
+ return err;
}
/* This function requires the caller holds hci_req_sync_lock */
int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)
{
struct msft_data *msft = hdev->msft_data;
+ int err;
if (!msft)
return -EOPNOTSUPP;
@@ -1194,7 +1231,10 @@ int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)
if (msft->resuming || msft->suspending)
return -EBUSY;
- return msft_remove_monitor_sync(hdev, monitor);
+ err = msft_remove_monitor_sync(hdev, monitor);
+ msft_update_filter_enable(hdev);
+
+ return err;
}
int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread* [PATCH 7.3 167/742] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
2026-12-04 9:57 [PATCH 7.3 000/742] 7.3.8-rc1 review Greg Kroah-Hartman
` (156 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 7.3 166/742] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
157 siblings, 0 replies; 159+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paul Menzel, Kiran K,
Luiz Augusto von Dentz, Sasha Levin
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <kiran.k@intel.com>
[ Upstream commit b535edbf51782cc38acc2e7a6f5ff590ab865c27 ]
btintel_pcie_mac_init() is called prior to reading device memory via
target access. To acquire MAC access, only the MAC_INIT and
MAC_ACCESS_REQ bits in the function control register need to be
programmed.
Currently, btintel_pcie_mac_init() also modifies FUNC_ENA, FUNC_INIT,
BUS_MASTER_DISCON, and SW_RESET, which are not relevant to MAC access
(though doing so had no observed side effects). Leave those bits
untouched and only set MAC_INIT if it is not already set.
Fixes: b9465e6670a2 ("Bluetooth: btintel_pcie: Read hardware exception data")
Assisted-by: Copilot:Gemini 4 Argon
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btintel_pcie.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 85141532de602..7dcb515cf0f26 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -589,14 +589,11 @@ static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
{
u32 reg;
- /* Set MAC_INIT bit to start primary bootloader */
reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
- reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
- BTINTEL_PCIE_CSR_FUNC_CTRL_BUS_MASTER_DISCON |
- BTINTEL_PCIE_CSR_FUNC_CTRL_SW_RESET);
- reg |= (BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_ENA |
- BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT);
- btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+ if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT)) {
+ reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT;
+ btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+ }
}
static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
--
2.53.0
^ permalink raw reply related [flat|nested] 159+ messages in thread