* [PATCH 6.1 0001/1059] RDMA/erdma: Use IRQ-safe XArray helpers for QP and CQ tables
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0002/1059] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
` (997 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cheng Xu, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Xu <chengyou@linux.alibaba.com>
[ Upstream commit 00baeade709fb66da647e8327e8398bb532e30f7 ]
Locked QP and CQ lookups from EQ interrupts can deadlock with
create-path XArray updates. If an interrupt arrives while the create
path holds the plain xa_lock, the lookup spins forever trying to
acquire the same lock.
Use IRQ-safe XArray helpers for all QP and CQ create-path updates,
including the GSI QP store and error paths. Initialize both arrays with
XA_FLAGS_LOCK_IRQ so sleeping allocations preserve interrupt state.
[ The GSI QP create path is not present in 6.1.y, so omit that hunk. ]
Fixes: 98df2aee1459 ("RDMA/erdma: Hold CQ references when processing EQ events")
Fixes: a52eeff32024 ("RDMA/erdma: Hold QP references for AE and CM processing")
Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
Link: https://patch.msgid.link/20260828030344.88021-1-chengyou@linux.alibaba.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/erdma/erdma_main.c | 4 ++--
drivers/infiniband/hw/erdma/erdma_verbs.c | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/erdma/erdma_main.c b/drivers/infiniband/hw/erdma/erdma_main.c
index 49d9319217414..ca93686b03784 100644
--- a/drivers/infiniband/hw/erdma/erdma_main.c
+++ b/drivers/infiniband/hw/erdma/erdma_main.c
@@ -500,8 +500,8 @@ static int erdma_ib_device_add(struct pci_dev *pdev)
INIT_LIST_HEAD(&dev->cep_list);
spin_lock_init(&dev->lock);
- xa_init_flags(&dev->qp_xa, XA_FLAGS_ALLOC1);
- xa_init_flags(&dev->cq_xa, XA_FLAGS_ALLOC1);
+ xa_init_flags(&dev->qp_xa, XA_FLAGS_ALLOC1 | XA_FLAGS_LOCK_IRQ);
+ xa_init_flags(&dev->cq_xa, XA_FLAGS_ALLOC1 | XA_FLAGS_LOCK_IRQ);
dev->next_alloc_cqn = 1;
dev->next_alloc_qpn = 1;
diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
index 2ddc56335b9a6..b848828287d19 100644
--- a/drivers/infiniband/hw/erdma/erdma_verbs.c
+++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
@@ -693,9 +693,9 @@ int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
kref_init(&qp->ref);
init_completion(&qp->safe_free);
- ret = xa_alloc_cyclic(&dev->qp_xa, &qp->ibqp.qp_num, qp,
- XA_LIMIT(1, dev->attrs.max_qp - 1),
- &dev->next_alloc_qpn, GFP_KERNEL);
+ ret = xa_alloc_cyclic_irq(&dev->qp_xa, &qp->ibqp.qp_num, qp,
+ XA_LIMIT(1, dev->attrs.max_qp - 1),
+ &dev->next_alloc_qpn, GFP_KERNEL);
if (ret < 0) {
ret = -ENOMEM;
goto err_out;
@@ -750,7 +750,7 @@ int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
else
free_kernel_qp(qp);
err_out_xa:
- xa_erase(&dev->qp_xa, QP_ID(qp));
+ xa_erase_irq(&dev->qp_xa, QP_ID(qp));
err_out:
return ret;
}
@@ -1433,9 +1433,9 @@ int erdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
refcount_set(&cq->refcount, 1);
init_completion(&cq->free);
- ret = xa_alloc_cyclic(&dev->cq_xa, &cq->cqn, cq,
- XA_LIMIT(1, dev->attrs.max_cq - 1),
- &dev->next_alloc_cqn, GFP_KERNEL);
+ ret = xa_alloc_cyclic_irq(&dev->cq_xa, &cq->cqn, cq,
+ XA_LIMIT(1, dev->attrs.max_cq - 1),
+ &dev->next_alloc_cqn, GFP_KERNEL);
if (ret < 0)
return ret;
@@ -1482,7 +1482,7 @@ int erdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
}
err_out_xa:
- xa_erase(&dev->cq_xa, cq->cqn);
+ xa_erase_irq(&dev->cq_xa, cq->cqn);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0002/1059] netfilter: nft_ct: expectation timeouts are passed in milliseconds
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0001/1059] RDMA/erdma: Use IRQ-safe XArray helpers for QP and CQ tables Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0003/1059] netfilter: nft_ct: move custom expectation support to helper Greg Kroah-Hartman
` (996 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Westphal, Pablo Neira Ayuso,
Mark Bundschuh, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@strlen.de>
[ Upstream commit 6fb421bd07f156cdf0cdede062d31f1c21def326 ]
Userspace passes '5000' in case user asks for 5 seconds.
Allowing for sub-second expectation lifetimes makes sense to me. so
fix up the kernel side instead of munging nft to send a value rounded
up to next second.
Also note that this violates nft convention of passing integers in
network byte order, but we can't change this anymore.
Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Stable-dep-of: 3679da4ad8be ("netfilter: nft_ct: move custom expectation support to helper")
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nft_ct.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index f789c6c8f146b..fbe83e879654e 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -1229,11 +1229,23 @@ struct nft_ct_expect_obj {
u32 timeout;
};
+static int nft_ct_expect_timeout_get(const struct nlattr *attr, u32 *val)
+{
+ unsigned long jiffies_val = msecs_to_jiffies(nla_get_u32(attr));
+
+ if (jiffies_val > UINT_MAX)
+ return -ERANGE;
+
+ *val = jiffies_val;
+ return 0;
+}
+
static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[],
struct nft_object *obj)
{
struct nft_ct_expect_obj *priv = nft_obj_data(obj);
+ int err;
if (!tb[NFTA_CT_EXPECT_L4PROTO] ||
!tb[NFTA_CT_EXPECT_DPORT] ||
@@ -1269,8 +1281,11 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
return -EOPNOTSUPP;
}
+ err = nft_ct_expect_timeout_get(tb[NFTA_CT_EXPECT_TIMEOUT], &priv->timeout);
+ if (err)
+ return err;
+
priv->dport = nla_get_be16(tb[NFTA_CT_EXPECT_DPORT]);
- priv->timeout = nla_get_u32(tb[NFTA_CT_EXPECT_TIMEOUT]);
priv->size = nla_get_u8(tb[NFTA_CT_EXPECT_SIZE]);
return nf_ct_netns_get(ctx->net, ctx->family);
@@ -1290,7 +1305,7 @@ static int nft_ct_expect_obj_dump(struct sk_buff *skb,
if (nla_put_be16(skb, NFTA_CT_EXPECT_L3PROTO, htons(priv->l3num)) ||
nla_put_u8(skb, NFTA_CT_EXPECT_L4PROTO, priv->l4proto) ||
nla_put_be16(skb, NFTA_CT_EXPECT_DPORT, priv->dport) ||
- nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, priv->timeout) ||
+ nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, jiffies_to_msecs(priv->timeout)) ||
nla_put_u8(skb, NFTA_CT_EXPECT_SIZE, priv->size))
return -1;
@@ -1340,7 +1355,7 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
&ct->tuplehash[!dir].tuple.src.u3,
&ct->tuplehash[!dir].tuple.dst.u3,
priv->l4proto, NULL, &priv->dport);
- exp->timeout += priv->timeout * HZ;
+ exp->timeout += priv->timeout;
if (nf_ct_expect_related(exp, 0) != 0)
regs->verdict.code = NF_DROP;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0003/1059] netfilter: nft_ct: move custom expectation support to helper
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0001/1059] RDMA/erdma: Use IRQ-safe XArray helpers for QP and CQ tables Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0002/1059] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0004/1059] mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs Greg Kroah-Hartman
` (995 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jaeyeong Lee, Pablo Neira Ayuso,
Mark Bundschuh, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <pablo@netfilter.org>
[ Upstream commit 3679da4ad8be84cddaf40bc307fef1fe13e051ff ]
Originally, the ct expectation support called nf_ct_helper_ext_add() for
confirmed conntracks, which is invalid, triggering a splat. This was
fixed by commit 1710eb913bdc ("netfilter: nft_ct: skip expectations for
confirmed conntrack") which restricted it to unconfirmed conntracks.
However, early insertion of expectations into the expectations list when
the conntrack is unconfirmed leads to stale entries pointing to the
wrong hlist_head through .pprev due to ct extension reallocation.
Commit 7c9664351980 ("netfilter: move nat hlist_head to nf_conn") moved
the nat hlist_head to nf_conn for this reason:
1. ...
2. When reallocation of extension area occurs we need to fixup the
bysource hash head via hlist_replace_rcu.
I'd rather not increase the size of the struct nf_conn for this feature
has very limited scope: only one expectation can be created at a time
given expect_clash() will make nf_ct_expect_related() reports EBUSY.
For this reason, relax nf_ct_expect_related() not to drop packets in
case expectation creation fails, therefore, expectation creation becomes
best effort.
To address this issue, add an internal ct helper and attach it to the
conntrack entry to streamline the custom ct expectation support with
existing ct helpers.
Expose a new nf_conntrack_helper_release() function to release the
internal helper that is allocated and attached to the conntrack entry to
create the custom expectations. The nft_ct module removal always waits
for rcu grace period, then the NULL helper callback is observed after
this.
This patch also restricts the creation of expectations to different
helpers other than this custom helper that is created for this type of
expectations.
Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
Reported-by: Jaeyeong Lee <iostreampy@proton.me>
Link: https://patch.msgid.link/20260715144755.00ea7dfcd9f@proton.me
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ - ac46f3f35b6e ("netfilter: nf_conntrack_helper: add refcounting from
datapath") is not backported because it reworks helper lifetime
around a datapath ct_refcnt in 9 files, so one static nft_ct_expect
helper is unhelped at nft_ct module exit.
- d4beefc90a66 ("netfilter: nft_ct: support expectation creation for
natted flows") is not backported because it adds expectation support
for NATed flows, so the moved expectation code has no NAT
follow-master part.
- Context differs due to commit: 6031487d4e27 ]
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/netfilter/nf_conntrack_helper.h | 1 +
net/netfilter/nf_conntrack_helper.c | 20 ++--
net/netfilter/nft_ct.c | 100 +++++++++++++++-----
3 files changed, 89 insertions(+), 32 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 2435039434ea9..9340029739476 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -105,6 +105,7 @@ void nf_ct_helper_init(struct nf_conntrack_helper *helper,
int nf_conntrack_helper_register(struct nf_conntrack_helper *);
void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
+void nf_conntrack_helper_release(struct nf_conntrack_helper *);
int nf_conntrack_helpers_register(struct nf_conntrack_helper *, unsigned int);
void nf_conntrack_helpers_unregister(struct nf_conntrack_helper *,
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index b16a45856bdcc..6be6588b572e6 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -428,6 +428,18 @@ static bool expect_iter_me(struct nf_conntrack_expect *exp, void *data)
return this == me;
}
+void nf_conntrack_helper_release(struct nf_conntrack_helper *me)
+{
+ nf_ct_expect_iterate_destroy(expect_iter_me, me);
+ nf_ct_iterate_destroy(unhelp, me);
+
+ /* nf_ct_iterate_destroy() does an unconditional synchronize_rcu() as
+ * last step, this ensures rcu readers of exp->helper are done.
+ * No need for another synchronize_rcu() here.
+ */
+}
+EXPORT_SYMBOL_GPL(nf_conntrack_helper_release);
+
void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
{
mutex_lock(&nf_ct_helper_mutex);
@@ -440,13 +452,7 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
*/
synchronize_rcu();
- nf_ct_expect_iterate_destroy(expect_iter_me, me);
- nf_ct_iterate_destroy(unhelp, me);
-
- /* nf_ct_iterate_destroy() does an unconditional synchronize_rcu() as
- * last step, this ensures rcu readers of exp->helper are done.
- * No need for another synchronize_rcu() here.
- */
+ nf_conntrack_helper_release(me);
}
EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index fbe83e879654e..87630eb0a9f47 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -1240,6 +1240,65 @@ static int nft_ct_expect_timeout_get(const struct nlattr *attr, u32 *val)
return 0;
}
+struct nft_ct_expect_data {
+ struct nft_ct_expect_obj obj;
+ enum ip_conntrack_dir dir;
+};
+
+static int ct_expect_help(struct sk_buff *skb, unsigned int protoff,
+ struct nf_conn *ct, enum ip_conntrack_info ctinfo)
+{
+ enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
+ struct nft_ct_expect_data *expect_data;
+ struct nf_conntrack_expect *exp;
+ int ret = NF_ACCEPT;
+ u16 l3num;
+
+ if (nf_ct_is_confirmed(ct))
+ return NF_ACCEPT;
+
+ expect_data = nfct_help_data(ct);
+ if (!expect_data)
+ return NF_ACCEPT;
+
+ if (expect_data->dir != dir)
+ return NF_ACCEPT;
+
+ exp = nf_ct_expect_alloc(ct);
+ if (!exp)
+ return NF_DROP;
+
+ if (expect_data->obj.l3num == NFPROTO_INET)
+ l3num = nf_ct_l3num(ct);
+ else
+ l3num = expect_data->obj.l3num;
+
+ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, l3num,
+ &ct->tuplehash[!dir].tuple.src.u3,
+ &ct->tuplehash[!dir].tuple.dst.u3,
+ expect_data->obj.l4proto, NULL, &expect_data->obj.dport);
+ exp->timeout += expect_data->obj.timeout;
+
+ if (nf_ct_expect_related(exp, 0) != 0)
+ ret = NF_ACCEPT;
+
+ nf_ct_expect_put(exp);
+
+ return ret;
+}
+
+static const struct nf_conntrack_expect_policy nft_ct_expect_helper_policy = {
+ .max_expected = NF_CT_EXPECT_MAX_CNT,
+};
+
+/* No need to register this helper, this is internal. */
+static struct nf_conntrack_helper nft_ct_expect_helper = {
+ .name = "nft_ct_expect",
+ .me = THIS_MODULE,
+ .expect_policy = &nft_ct_expect_helper_policy,
+ .help = ct_expect_help,
+};
+
static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[],
struct nft_object *obj)
@@ -1247,6 +1306,8 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
struct nft_ct_expect_obj *priv = nft_obj_data(obj);
int err;
+ NF_CT_HELPER_BUILD_BUG_ON(sizeof(struct nft_ct_expect_data));
+
if (!tb[NFTA_CT_EXPECT_L4PROTO] ||
!tb[NFTA_CT_EXPECT_DPORT] ||
!tb[NFTA_CT_EXPECT_TIMEOUT] ||
@@ -1292,7 +1353,7 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
}
static void nft_ct_expect_obj_destroy(const struct nft_ctx *ctx,
- struct nft_object *obj)
+ struct nft_object *obj)
{
nf_ct_netns_put(ctx->net, ctx->family);
}
@@ -1317,11 +1378,9 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
const struct nft_pktinfo *pkt)
{
const struct nft_ct_expect_obj *priv = nft_obj_data(obj);
- struct nf_conntrack_expect *exp;
+ struct nft_ct_expect_data *expect_data;
enum ip_conntrack_info ctinfo;
struct nf_conn_help *help;
- enum ip_conntrack_dir dir;
- u16 l3num = priv->l3num;
struct nf_conn *ct;
ct = nf_ct_get(pkt->skb, &ctinfo);
@@ -1329,38 +1388,28 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
regs->verdict.code = NFT_BREAK;
return;
}
- dir = CTINFO2DIR(ctinfo);
help = nfct_help(ct);
- if (!help)
- help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
- if (!help) {
- regs->verdict.code = NF_DROP;
- return;
- }
-
- if (help->expecting[NF_CT_EXPECT_CLASS_DEFAULT] >= priv->size) {
+ if (help) {
regs->verdict.code = NFT_BREAK;
return;
}
- if (l3num == NFPROTO_INET)
- l3num = nf_ct_l3num(ct);
- exp = nf_ct_expect_alloc(ct);
- if (exp == NULL) {
+ help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
+ if (!help) {
regs->verdict.code = NF_DROP;
return;
}
- nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, l3num,
- &ct->tuplehash[!dir].tuple.src.u3,
- &ct->tuplehash[!dir].tuple.dst.u3,
- priv->l4proto, NULL, &priv->dport);
- exp->timeout += priv->timeout;
- if (nf_ct_expect_related(exp, 0) != 0)
- regs->verdict.code = NF_DROP;
+ expect_data = nfct_help_data(ct);
+ if (!expect_data) {
+ regs->verdict.code = NFT_BREAK;
+ return;
+ }
+ expect_data->obj = *priv;
+ expect_data->dir = CTINFO2DIR(ctinfo);
- nf_ct_expect_put(exp);
+ rcu_assign_pointer(help->helper, &nft_ct_expect_helper);
}
static const struct nla_policy nft_ct_expect_policy[NFTA_CT_EXPECT_MAX + 1] = {
@@ -1440,6 +1489,7 @@ static void __exit nft_ct_module_exit(void)
nft_unregister_obj(&nft_ct_helper_obj_type);
nft_unregister_expr(&nft_notrack_type);
nft_unregister_expr(&nft_ct_type);
+ nf_conntrack_helper_release(&nft_ct_expect_helper);
}
module_init(nft_ct_module_init);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0004/1059] mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (2 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0003/1059] netfilter: nft_ct: move custom expectation support to helper Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0005/1059] drm/amdgpu: Check cs flags Greg Kroah-Hartman
` (994 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Pedro Falcato,
Gregory Price (Meta), Muhammad Usama Anjum, Lance Yang,
Baolin Wang, David Hildenbrand (Arm), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit fe2817e3d5ea347214342c9a5cd8bcbff20c0574 ]
try_collapse_pte_mapped_thp() clears PTEs without transferring their dirty
bits to the folio. A shmem read fault can map a clean folio writable, so
a later store only dirties the PTE. Losing that dirty bit allows reclaim
to discard modified data.
The assumption that regular files are read-only is also obsolete since
commit 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse
for writable files"). In any case, transferring PTE dirty bits to the folio
when removing mappings (and while the folio is still mapped) is the right
thing to do.
Use get_and_clear_ptes() to collect the dirty bits and mark the folio
dirty before unmapping it. Update the comment.
This was reproduced with shmem using MADV_COLLAPSE followed by
MADV_PAGEOUT.
Fix generated by an LLM and sent by Chris Mason in private.
Fixes: 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP")
Fixes: 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Mason <mason@kernel.org>
[ david: adjust comment; simplify description; cover file-thp as well ]
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>
Link: https://patch.msgid.link/20261031-fixes_core-v3-17-d6437171ecc3@kernel.org
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
[ sashal: adapted batched PTE and folio handling to the existing per-PTE loop using ptep_get_and_clear() and set_page_dirty() ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/khugepaged.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index c9ee735a2b1d9..ba41de673bc15 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1562,12 +1562,16 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr,
for (i = 0, addr = haddr, pte = start_pte;
i < HPAGE_PMD_NR; i++, addr += PAGE_SIZE, pte++) {
struct page *page;
+ pte_t ptent;
if (pte_none(*pte))
continue;
page = vm_normal_page(vma, addr, *pte);
if (WARN_ON_ONCE(page && is_zone_device_page(page)))
goto abort;
+ ptent = ptep_get_and_clear(mm, addr, pte);
+ if (pte_dirty(ptent))
+ set_page_dirty(hpage);
page_remove_rmap(page, vma, false);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0005/1059] drm/amdgpu: Check cs flags.
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (3 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0004/1059] mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0006/1059] bpf: Drop inet_conn_established from lsm sleepable hooks Greg Kroah-Hartman
` (993 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bas Nieuwenhuizen, Faith Ekstrand,
Alex Deucher, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
[ Upstream commit f5ea64f9fcd921bc4e2307a262e19450b8a58524 ]
Had no validation before. libdrm_amdgpu memsets this, even
for the raw/raw2 functions.
We have a lot of functions touching the ioctl struct, no
strong opinion on where this is placed, but I thought
early would be good.
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 4d01e15e76358f60ef6734462d2b6d9972b9dfbc)
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 710bf84e2ab48..d086c2a2329db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -202,6 +202,9 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
int ret;
int i;
+ if (cs->in.flags)
+ return -EINVAL;
+
chunk_array = memdup_array_user(u64_to_user_ptr(cs->in.chunks),
cs->in.num_chunks,
sizeof(uint64_t));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0006/1059] bpf: Drop inet_conn_established from lsm sleepable hooks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (4 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0005/1059] drm/amdgpu: Check cs flags Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0007/1059] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES Greg Kroah-Hartman
` (992 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, BoBppy, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
The backport of commit beaf0e96b1da ("bpf: Drop task_to_inode and
inet_conn_established from lsm sleepable hooks") to this tree removed
only bpf_lsm_task_to_inode from sleepable_lsm_hooks.
bpf_lsm_inet_conn_established is still listed there, although the hook
is called from softirq context and cannot be used by sleepable LSM
programs.
Remove it too, which completes the backport.
Fixes: f0fc2a982817 ("bpf: Drop task_to_inode and inet_conn_established from lsm sleepable hooks")
Reported-by: BoBppy <inkxiao12@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/bpf_lsm.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
index f26faa9a35db1..6fcf1e02a9d38 100644
--- a/kernel/bpf/bpf_lsm.c
+++ b/kernel/bpf/bpf_lsm.c
@@ -305,10 +305,6 @@ BTF_ID(func, bpf_lsm_file_lock)
BTF_ID(func, bpf_lsm_file_open)
BTF_ID(func, bpf_lsm_file_receive)
-#ifdef CONFIG_SECURITY_NETWORK
-BTF_ID(func, bpf_lsm_inet_conn_established)
-#endif /* CONFIG_SECURITY_NETWORK */
-
BTF_ID(func, bpf_lsm_inode_create)
BTF_ID(func, bpf_lsm_inode_free_security)
BTF_ID(func, bpf_lsm_inode_getattr)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0007/1059] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (5 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0006/1059] bpf: Drop inet_conn_established from lsm sleepable hooks Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0008/1059] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Greg Kroah-Hartman
` (991 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Johannes Weiner, Andrew Morton,
Balbir Singh, Vlastimil Babka (SUSE), Matthew Wilcox (Oracle),
Salvatore Dipietro, Christoph Hellwig, Dave Chinner, Matt Fleming,
Mel Gorman, Michal Hocko, Suren Baghdasaryan, Brendan Jackman,
Zi Yan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <hannes@cmpxchg.org>
[ Upstream commit fe21f930d1e64d121191673076fc4ebe79fc82d5 ]
1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH
non-blocking allocations accesses reserves") stopped handing out reserve
access for ALLOC_NON_BLOCK on its own: the extra 25% below the min
watermark is now only granted on top of ALLOC_MIN_RESERVE. But the flag
was left in ALLOC_RESERVES, which produces something odd:
With the ALLOC_RESERVES match, __zone_watermark_unusable_free() doesn't
subtract the free highatomic pages for them. So in the slowpath, they get
to consume regular blocks below the min watermark by the number of free
highatomic pages. The highatomic reserve is capped at 1% of the zone,
which on any decently sized machine is a multiple of the min watermark:
GFP_NOWAIT can drain regular memory to zero.
The user-visible result is brutal hiccups during bursts of GFP_NOWAIT
allocations under memory pressure. This was found in review and
reproduced with a synthetic burst, not observed in production, but the
sequence of events is a realistic one: On a 32G box with an anonymous
working set, swap, and a filled 290M highatomic reserve, a GFP_NOWAIT
burst drove regular free memory in the 28G Normal zone (min=60M) to 28M,
0.8M and 0.6M in three runs. Swapout failed to allocate its swap table,
reclaim scanned 13M pages to reclaim 200k, page faults stalled for tens to
hundreds of milliseconds. The machine survives it, but not by design:
direct reclaimers eventually fail and start unreserving highatomic blocks,
until the allocation succeeds or the reserve is gone and the OOM killer
runs. That reserve exists for high-order atomic allocations; here it is
destroyed to bail out a GFP_NOWAIT consumer that was never entitled to the
memory.
Remove ALLOC_NON_BLOCK from ALLOC_RESERVES. With that, the GFP_NOWAIT
burst is stopped short at the min watermark. No direct reclaim, no
stalls, no failed allocations, and the highatomic reserve stays intact for
the requests it exists for.
__zone_watermark_ok() is unaffected, since everything it keys on
ALLOC_NON_BLOCK is already nested under ALLOC_MIN_RESERVE. Update the
flag comments accordingly: ALLOC_NON_BLOCK just means the caller can't
block; the reserve math belongs with ALLOC_MIN_RESERVE.
GFP_ATOMIC order-0 requests have a milder version of the same problem.
Through ALLOC_MIN_RESERVE they also count the free highatomic pages in
their watermark check, but rmqueue_buddy() serves them regular pages first
and only falls back to the reserve once those are gone. They can still
push regular free memory to 37.5% of min minus the free highatomic pages
before the reserve is touched. Unlike GFP_NOWAIT they are entitled to the
reserve, so this needs the watermark check and the freelist order reworked
together, and is left to a separate patch.
Link: https://lore.kernel.org/20261028171719.2043421-3-hannes@cmpxchg.org
Fixes: 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves")
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Balbir Singh <balbirs@nvidia.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Salvatore Dipietro <dipiets@amazon.it>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <dgc@kernel.org>
Cc: Matt Fleming <matt@readmodwrite.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
[ sashal: Moved ALLOC_* flag edits from the nonexistent mm/page_alloc.h to mm/internal.h, with hunk context adjusted for the missing ALLOC_NO_CODETAG flag. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/internal.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index 92051c970ac1c..a94aae7f6c8df 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -776,12 +776,11 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone,
#define ALLOC_OOM ALLOC_NO_WATERMARKS
#endif
-#define ALLOC_NON_BLOCK 0x10 /* Caller cannot block. Allow access
- * to 25% of the min watermark or
- * 62.5% if __GFP_HIGH is set.
- */
+#define ALLOC_NON_BLOCK 0x10 /* Caller cannot block. */
#define ALLOC_MIN_RESERVE 0x20 /* __GFP_HIGH set. Allow access to 50%
- * of the min watermark.
+ * of the min watermark, or 62.5% if
+ * the caller cannot block either
+ * (ALLOC_NON_BLOCK).
*/
#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
#define ALLOC_CMA 0x80 /* allow allocations from CMA areas */
@@ -794,7 +793,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone,
#define ALLOC_KSWAPD 0x800 /* allow waking of kswapd, __GFP_KSWAPD_RECLAIM set */
/* Flags that allow allocations below the min watermark. */
-#define ALLOC_RESERVES (ALLOC_NON_BLOCK|ALLOC_MIN_RESERVE|ALLOC_HIGHATOMIC|ALLOC_OOM)
+#define ALLOC_RESERVES (ALLOC_MIN_RESERVE|ALLOC_HIGHATOMIC|ALLOC_OOM)
/* Flags that mean GFP_ATOMIC */
#define ALLOC_MASK_ATOMIC (ALLOC_NON_BLOCK|ALLOC_MIN_RESERVE)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0008/1059] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (6 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0007/1059] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0009/1059] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Greg Kroah-Hartman
` (990 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Thomas Gleixner,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 0f214e5bbee59d5952d3c061fd65ed9a1e175981 ]
__plic_toggle() builds a 32-bit interrupt enable mask using a signed
integer literal. A valid interrupt selecting bit 31 evaluates 1 << 31,
which shifts a signed int into its sign bit.
Use BIT(), matching the equivalent mask construction in plic_irq_eoi().
The resulting mask remains representable in u32 on both RV32 and RV64.
The issue was found by our static-analysis tool.
Fixes: 8237f8bc4f6e ("irqchip: add a SiFive PLIC driver")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: gpt 5
Link: https://patch.msgid.link/caplitmus-rv.v2.plic.87a8fc444de44e109889ba28703c76f3@163.com
[ sashal: Context lines adapted to the older __plic_toggle() signature and direct register write, applying only the 1 << (hwirq % 32) to BIT(hwirq % 32) change. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-sifive-plic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index fb1dae22ab17f..396fb37abf611 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -89,7 +89,7 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type);
static void __plic_toggle(void __iomem *enable_base, int hwirq, int enable)
{
u32 __iomem *reg = enable_base + (hwirq / 32) * sizeof(u32);
- u32 hwirq_mask = 1 << (hwirq % 32);
+ u32 hwirq_mask = BIT(hwirq % 32);
if (enable)
writel(readl(reg) | hwirq_mask, reg);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0009/1059] fs: aio: reject partial mremap to avoid Null-pointer-dereference error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (7 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0008/1059] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0010/1059] Revert "SUNRPC: svcauth_gss: enforce krb5 token minimum length" Greg Kroah-Hartman
` (989 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zizhi Wo, Jan Kara,
Christian Brauner, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <wozizhi@huawei.com>
[ Upstream commit 3adf7ae18bf42601246031002287c103a27df307 ]
[BUG]
Recently, our internal syzkaller testing uncovered a null pointer
dereference issue:
BUG: kernel NULL pointer dereference, address: 0000000000000000
...
[ 51.111664] filemap_read_folio+0x25/0xe0
[ 51.112410] filemap_fault+0xad7/0x1250
[ 51.113112] __do_fault+0x4b/0x460
[ 51.113699] do_pte_missing+0x5bc/0x1db0
[ 51.114250] ? __pte_offset_map+0x23/0x170
[ 51.114822] __handle_mm_fault+0x9f8/0x1680
...
Crash analysis showed the file involved was an AIO ring file. The
phenomenon triggered is the same as the issue described in [1].
[CAUSE]
Consider the following scenario: userspace sets up an AIO context via
io_setup(), which creates a VMA covering the entire ring buffer. Then
userspace calls mremap() with the AIO ring address as the source, a smaller
old_len (less than the full ring size), MREMAP_MAYMOVE set, and without
MREMAP_DONTUNMAP. The kernel will relocate the requested portion to a new
destination address.
During this move, __split_vma() splits the original AIO ring VMA. The
requested portion is unmapped from the source and re-established at the
destination, while the remainder stays at the original source address as
an orphan VMA. The aio_ring_mremap() callback fires on the new destination
VMA, updating ctx->mmap_base to the destination address. But the callback
is unaware that only a partial region was moved and that an orphan VMA
still exists at the source:
source(AIO):
+-------------------+---------------------+
| moved to dest | orphan VMA (AIO) |
+-------------------+---------------------+
A A+partial_len A+ctx->mmap_size
dest:
+-------------------+
| moved VMA (AIO) |
+-------------------+
B B+partial_len
Later, io_destroy() calls vm_munmap(ctx->mmap_base, ctx->mmap_size), which
unmaps the destination. This not only fails to unmap the orphan VMA at the
source, but also overshoots the destination VMA and may unmap unrelated
mappings adjacent to it! After put_aio_ring_file() calls truncate_setsize()
to remove all pages from the pagecache, any subsequent access to the orphan
VMA triggers filemap_fault(), which calls a_ops->read_folio(). Since aio
does not implement read_folio, this results in a NULL pointer dereference.
[FIX]
Note that expanding mremap (new_len > old_len) is already rejected because
AIO ring VMAs are created with VM_DONTEXPAND. The only problematic case is
a partial move where "old_len == new_len" but both are smaller than the
full ring size.
Fix this by checking in aio_ring_mremap() that the new VMA covers the
entire ring. This ensures the AIO ring is always moved as a whole,
preventing orphan VMAs and the subsequent crash.
[1]: https://lore.kernel.org/all/20260413010814.548568-1-wozizhi@huawei.com/
Signed-off-by: Zizhi Wo <wozizhi@huaweicloud.com>
Link: https://patch.msgid.link/20260418060634.3713620-1-wozizhi@huaweicloud.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/aio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/aio.c b/fs/aio.c
index 3c3770d8e2637..535757e11f67f 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -369,7 +369,8 @@ static int aio_ring_mremap(struct vm_area_struct *vma)
ctx = rcu_dereference(table->table[i]);
if (ctx && ctx->aio_ring_file == file) {
- if (!atomic_read(&ctx->dead)) {
+ if (!atomic_read(&ctx->dead) &&
+ (ctx->mmap_size == (vma->vm_end - vma->vm_start))) {
ctx->user_id = ctx->mmap_base = vma->vm_start;
res = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0010/1059] Revert "SUNRPC: svcauth_gss: enforce krb5 token minimum length"
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (8 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0009/1059] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0011/1059] Revert "SUNRPC: Convert unwrap_priv_data() to use xdr_stream" Greg Kroah-Hartman
` (988 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 2188232509f1559cb8fcb0c9a4b1e04317fa0f15.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/auth_gss/svcauth_gss.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 5ae15e3b40094..3d417548dc508 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1009,8 +1009,6 @@ svcauth_gss_unwrap_priv(struct svc_rqst *rqstp, u32 seq, struct gss_ctx *ctx)
}
if (len > xdr_stream_remaining(xdr))
goto unwrap_failed;
- if (len <= GSS_KRB5_TOK_HDR_LEN)
- goto unwrap_failed;
offset = xdr_stream_pos(xdr);
saved_len = buf->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0011/1059] Revert "SUNRPC: Convert unwrap_priv_data() to use xdr_stream"
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (9 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0010/1059] Revert "SUNRPC: svcauth_gss: enforce krb5 token minimum length" Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0012/1059] SUNRPC: svcauth_gss: enforce krb5 token minimum length Greg Kroah-Hartman
` (987 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 82cf21374fb7ee55b37be9afb6704ba0eeffb236.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/sunrpc/xdr.h | 1 +
net/sunrpc/auth_gss/svcauth_gss.c | 64 +++++++++++++++++++++----------
net/sunrpc/xdr.c | 7 ++++
3 files changed, 51 insertions(+), 21 deletions(-)
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f7e2850c8638f..f84e2a1358e17 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -188,6 +188,7 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p)
/*
* XDR buffer helper functions
*/
+extern void xdr_shift_buf(struct xdr_buf *, size_t);
extern void xdr_buf_from_iov(const struct kvec *, struct xdr_buf *);
extern int xdr_buf_subsegment(const struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
extern void xdr_buf_trim(struct xdr_buf *, unsigned int);
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 3d417548dc508..64fba16d8afc1 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -978,6 +978,17 @@ total_buf_len(struct xdr_buf *buf)
return buf->head[0].iov_len + buf->page_len + buf->tail[0].iov_len;
}
+static void
+fix_priv_head(struct xdr_buf *buf, int pad)
+{
+ if (buf->page_len == 0) {
+ /* We need to adjust head and buf->len in tandem in this
+ * case to make svc_defer() work--it finds the original
+ * buffer start using buf->len - buf->head[0].iov_len. */
+ buf->head[0].iov_len -= pad;
+ }
+}
+
/*
* RFC 2203, Section 5.3.2.3
*
@@ -990,37 +1001,49 @@ total_buf_len(struct xdr_buf *buf)
* proc_req_arg_t arg;
* };
*/
-static noinline_for_stack int
-svcauth_gss_unwrap_priv(struct svc_rqst *rqstp, u32 seq, struct gss_ctx *ctx)
+static int
+svcauth_gss_unwrap_priv(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq,
+ struct gss_ctx *ctx)
{
- struct xdr_stream *xdr = &rqstp->rq_arg_stream;
- u32 len, maj_stat, seq_num, offset;
- struct xdr_buf *buf = xdr->buf;
- unsigned int saved_len;
+ u32 len, seq_num, maj_stat;
+ int pad, remaining_len, offset;
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
- if (xdr_stream_decode_u32(xdr, &len) < 0)
- goto unwrap_failed;
+ len = svc_getnl(&buf->head[0]);
if (rqstp->rq_deferred) {
/* Already decrypted last time through! The sequence number
* check at out_seq is unnecessary but harmless: */
goto out_seq;
}
- if (len > xdr_stream_remaining(xdr))
+ /* buf->len is the number of bytes from the original start of the
+ * request to the end, where head[0].iov_len is just the bytes
+ * not yet read from the head, so these two values are different: */
+ remaining_len = total_buf_len(buf);
+ if (len > remaining_len)
goto unwrap_failed;
- offset = xdr_stream_pos(xdr);
-
- saved_len = buf->len;
- maj_stat = gss_unwrap(ctx, offset, offset + len, buf);
+ pad = remaining_len - len;
+ buf->len -= pad;
+ fix_priv_head(buf, pad);
+
+ maj_stat = gss_unwrap(ctx, 0, len, buf);
+ pad = len - buf->len;
+ /* The upper layers assume the buffer is aligned on 4-byte boundaries.
+ * In the krb5p case, at least, the data ends up offset, so we need to
+ * move it around. */
+ /* XXX: This is very inefficient. It would be better to either do
+ * this while we encrypt, or maybe in the receive code, if we can peak
+ * ahead and work out the service and mechanism there. */
+ offset = xdr_pad_size(buf->head[0].iov_len);
+ if (offset) {
+ buf->buflen = RPCSVC_MAXPAYLOAD;
+ xdr_shift_buf(buf, offset);
+ fix_priv_head(buf, pad);
+ }
if (maj_stat != GSS_S_COMPLETE)
goto bad_unwrap;
- xdr->nwords -= XDR_QUADLEN(saved_len - buf->len);
-
out_seq:
- /* gss_unwrap() decrypted the sequence number. */
- if (xdr_stream_decode_u32(xdr, &seq_num) < 0)
- goto unwrap_failed;
+ seq_num = svc_getnl(&buf->head[0]);
if (seq_num != seq)
goto bad_seqno;
return 0;
@@ -1656,9 +1679,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp)
/* placeholders for length and seq. number: */
svc_putnl(resv, 0);
svc_putnl(resv, 0);
- svcxdr_init_decode(rqstp);
- if (svcauth_gss_unwrap_priv(rqstp, gc->gc_seq,
- rsci->mechctx))
+ if (svcauth_gss_unwrap_priv(rqstp, &rqstp->rq_arg,
+ gc->gc_seq, rsci->mechctx))
goto garbage_args;
rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE * 2;
break;
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 7c4e966a6aad2..612b1a5572ebc 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -863,6 +863,13 @@ static unsigned int xdr_shrink_pagelen(struct xdr_buf *buf, unsigned int len)
return shift;
}
+void
+xdr_shift_buf(struct xdr_buf *buf, size_t len)
+{
+ xdr_shrink_bufhead(buf, buf->head->iov_len - len);
+}
+EXPORT_SYMBOL_GPL(xdr_shift_buf);
+
/**
* xdr_stream_pos - Return the current offset from the start of the xdr_stream
* @xdr: pointer to struct xdr_stream
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0012/1059] SUNRPC: svcauth_gss: enforce krb5 token minimum length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (10 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0011/1059] Revert "SUNRPC: Convert unwrap_priv_data() to use xdr_stream" Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0013/1059] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE Greg Kroah-Hartman
` (986 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Jeff Layton,
Chuck Lever, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <clm@meta.com>
[ Upstream commit a919c5c88769cf8fb3ec071e6078d830bf512489 ]
svcauth_gss_unwrap_priv() validates only an upper bound on the
wire-supplied opaque length before handing the buffer to
gss_unwrap():
if (len > xdr_stream_remaining(xdr))
goto unwrap_failed;
offset = xdr_stream_pos(xdr);
...
maj_stat = gss_unwrap(ctx, offset, offset + len, buf);
The wire value `len` flows unchanged as the upper bound into the
krb5 unwrap path, so a len in [0, 16] passes this check and is
handed to gss_unwrap(). For a krb5 v2 context that lands in
gss_krb5_unwrap_v2(), which reads the 16-byte RFC 4121 token
header fields at ptr+4 and ptr+6 and then calls rotate_left()
before any integrity check. With a sub-header length the header
reads run past the token, and _rotate_left()'s `shift %= buf->len`
path can divide by zero when buf->len has been driven to zero by
the truncated token. A header-only token (len == 16) is equally
invalid: with a non-zero RRC field and the opaque blob ending at
the XDR buffer boundary, rotate_left() builds a zero-length
subbuffer, reaching the same division.
Reject the token at the server entry point before it reaches the
krb5 unwrap core. A valid sealed RFC 4121 token must contain
the 16-byte header plus at least some encrypted payload.
Fix by adding a minimum-length check immediately after the
existing upper-bound check:
if (len <= GSS_KRB5_TOK_HDR_LEN)
goto unwrap_failed;
Fixes: 7c9fdcfb1b64 ("[PATCH] knfsd: svcrpc: gss: server-side implementation of rpcsec_gss privacy")
Cc: stable@vger.kernel.org
Assisted-by: kres (claude-opus-4-7)
Signed-off-by: Chris Mason <clm@meta.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260524010213.557424-2-cel@kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
[ sashal: Kept the older pre-xdr_stream code and inserted the two-line len <= GSS_KRB5_TOK_HDR_LEN check after the existing len > remaining_len check, since upstream's xdr_stream context lines don't exist. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/auth_gss/svcauth_gss.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 64fba16d8afc1..cc92e28c1a27d 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1022,6 +1022,8 @@ svcauth_gss_unwrap_priv(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq,
remaining_len = total_buf_len(buf);
if (len > remaining_len)
goto unwrap_failed;
+ if (len <= GSS_KRB5_TOK_HDR_LEN)
+ goto unwrap_failed;
pad = remaining_len - len;
buf->len -= pad;
fix_priv_head(buf, pad);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0013/1059] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (11 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0012/1059] SUNRPC: svcauth_gss: enforce krb5 token minimum length Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0014/1059] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE Greg Kroah-Hartman
` (985 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Hildenbrand, Peter Xu,
Andrea Arcangeli, Hugh Dickins, Jason Gunthorpe, John Hubbard,
Matthew Wilcox (Oracle), Shuah Khan, Vlastimil Babka,
Andrew Morton, Lance Yang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <david@redhat.com>
[ Upstream commit 58f595c6659198e1ad0ed431a408ddd79b21e579 ]
Now that GUP no longer requires VM_FAULT_WRITE, break_ksm() is the sole
remaining user of VM_FAULT_WRITE. As we also want to stop triggering a
fake write fault and instead use FAULT_FLAG_UNSHARE -- similar to
GUP-triggered unsharing when taking a R/O pin on a shared anonymous page
(including KSM pages), let's stop relying on VM_FAULT_WRITE.
Let's rework break_ksm() to not rely on the return value of
handle_mm_fault() anymore to figure out whether COW-breaking was
successful. Simply perform another follow_page() lookup to verify the
result.
While this makes break_ksm() slightly less efficient, we can simplify
handle_mm_fault() a little and easily switch to FAULT_FLAG_UNSHARE without
introducing similar KSM-specific behavior for FAULT_FLAG_UNSHARE.
In my setup (AMD Ryzen 9 3900X), running the KSM selftest to test unmerge
performance on 2 GiB (taskset 0x8 ./ksm_tests -D -s 2048), this results in
a performance degradation of ~4% -- 5% (old: ~5250 MiB/s, new: ~5010
MiB/s).
I don't think that we particularly care about that performance drop when
unmerging. If it ever turns out to be an actual performance issue, we can
think about a better alternative for FAULT_FLAG_UNSHARE -- let's just keep
it simple for now.
Link: https://lkml.kernel.org/r/20221021101141.84170-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/ksm.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 22b991218f403..b35485868d5b8 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -442,26 +442,27 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
vm_fault_t ret = 0;
do {
+ bool ksm_page = false;
+
cond_resched();
page = follow_page(vma, addr,
FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE);
if (IS_ERR_OR_NULL(page))
break;
if (PageKsm(page))
- ret = handle_mm_fault(vma, addr,
- FAULT_FLAG_WRITE | FAULT_FLAG_REMOTE,
- NULL);
- else
- ret = VM_FAULT_WRITE;
+ ksm_page = true;
put_page(page);
- } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)));
+
+ if (!ksm_page)
+ return 0;
+ ret = handle_mm_fault(vma, addr,
+ FAULT_FLAG_WRITE | FAULT_FLAG_REMOTE,
+ NULL);
+ } while (!(ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)));
/*
- * We must loop because handle_mm_fault() may back out if there's
- * any difficulty e.g. if pte accessed bit gets updated concurrently.
- *
- * VM_FAULT_WRITE is what we have been hoping for: it indicates that
- * COW has been broken, even if the vma does not permit VM_WRITE;
- * but note that a concurrent fault might break PageKsm for us.
+ * We must loop until we no longer find a KSM page because
+ * handle_mm_fault() may back out if there's any difficulty e.g. if
+ * pte accessed bit gets updated concurrently.
*
* VM_FAULT_SIGBUS could occur if we race with truncation of the
* backing file, which also invalidates anonymous pages: that's
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0014/1059] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (12 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0013/1059] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0015/1059] mm/ksm: fix userfaultfd protection during merge and unmerge Greg Kroah-Hartman
` (984 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Hildenbrand, Peter Xu,
Andrea Arcangeli, Hugh Dickins, Jason Gunthorpe, John Hubbard,
Matthew Wilcox (Oracle), Shuah Khan, Vlastimil Babka,
Andrew Morton, Lance Yang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <david@redhat.com>
[ Upstream commit 6cce3314b928b2db7d5f48171e18314226551c3f ]
Let's stop breaking COW via a fake write fault and let's use
FAULT_FLAG_UNSHARE instead. This avoids any wrong side effects of the
fake write fault, such as mapping the PTE writable and marking the pte
dirty/softdirty.
Consequently, we will no longer trigger a fake write fault and break COW
without any such side-effects.
Also, this fixes KSM interaction with userfaultfd-wp: when we have a KSM
page that's write-protected by userfaultfd, break_ksm()->handle_mm_fault()
will fail with VM_FAULT_SIGBUS and will simply return in break_ksm() with
0 instead of actually breaking COW.
For now, the KSM unmerge tests can trigger that:
$ sudo ./ksm_functional_tests
TAP version 13
1..3
# [RUN] test_unmerge
ok 1 Pages were unmerged
# [RUN] test_unmerge_discarded
ok 2 Pages were unmerged
# [RUN] test_unmerge_uffd_wp
not ok 3 Pages were unmerged
Bail out! 1 out of 3 tests failed
# Planned tests != run tests (2 != 3)
# Totals: pass:2 fail:1 xfail:0 xpass:0 skip:0 error:0
The warning in dmesg also indicates this wrong handling:
[ 230.096368] FAULT_FLAG_ALLOW_RETRY missing 881
[ 230.100822] CPU: 1 PID: 1643 Comm: ksm-uffd-wp [...]
[ 230.110124] Hardware name: [...]
[ 230.117775] Call Trace:
[ 230.120227] <TASK>
[ 230.122334] dump_stack_lvl+0x44/0x5c
[ 230.126010] handle_userfault.cold+0x14/0x19
[ 230.130281] ? tlb_finish_mmu+0x65/0x170
[ 230.134207] ? uffd_wp_range+0x65/0xa0
[ 230.137959] ? _raw_spin_unlock+0x15/0x30
[ 230.141972] ? do_wp_page+0x50/0x590
[ 230.145551] __handle_mm_fault+0x9f5/0xf50
[ 230.149652] ? mmput+0x1f/0x40
[ 230.152712] handle_mm_fault+0xb9/0x2a0
[ 230.156550] break_ksm+0x141/0x180
[ 230.159964] unmerge_ksm_pages+0x60/0x90
[ 230.163890] ksm_madvise+0x3c/0xb0
[ 230.167295] do_madvise.part.0+0x10c/0xeb0
[ 230.171396] ? do_syscall_64+0x67/0x80
[ 230.175157] __x64_sys_madvise+0x5a/0x70
[ 230.179082] do_syscall_64+0x58/0x80
[ 230.182661] ? do_syscall_64+0x67/0x80
[ 230.186413] entry_SYSCALL_64_after_hwframe+0x63/0xcd
This is primarily a fix for KSM+userfaultfd-wp, however, the fake write
fault was always questionable. As this fix is not easy to backport and
it's not very critical, let's not cc stable.
Link: https://lkml.kernel.org/r/20221021101141.84170-6-david@redhat.com
Fixes: 529b930b87d9 ("userfaultfd: wp: hook userfault handler to write protection fault")
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/ksm.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index b35485868d5b8..99147df91a69c 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -422,17 +422,15 @@ static inline bool ksm_test_exit(struct mm_struct *mm)
}
/*
- * We use break_ksm to break COW on a ksm page: it's a stripped down
+ * We use break_ksm to break COW on a ksm page by triggering unsharing,
+ * such that the ksm page will get replaced by an exclusive anonymous page.
*
- * if (get_user_pages(addr, 1, FOLL_WRITE, &page, NULL) == 1)
- * put_page(page);
- *
- * but taking great care only to touch a ksm page, in a VM_MERGEABLE vma,
+ * We take great care only to touch a ksm page, in a VM_MERGEABLE vma,
* in case the application has unmapped and remapped mm,addr meanwhile.
* Could a ksm page appear anywhere else? Actually yes, in a VM_PFNMAP
* mmap of /dev/mem, where we would not want to touch it.
*
- * FAULT_FLAG/FOLL_REMOTE are because we do this outside the context
+ * FAULT_FLAG_REMOTE/FOLL_REMOTE are because we do this outside the context
* of the process that owns 'vma'. We also do not want to enforce
* protection keys here anyway.
*/
@@ -456,7 +454,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
if (!ksm_page)
return 0;
ret = handle_mm_fault(vma, addr,
- FAULT_FLAG_WRITE | FAULT_FLAG_REMOTE,
+ FAULT_FLAG_UNSHARE | FAULT_FLAG_REMOTE,
NULL);
} while (!(ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)));
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0015/1059] mm/ksm: fix userfaultfd protection during merge and unmerge
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (13 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0014/1059] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0016/1059] udf: validate VAT inode size for old VAT format Greg Kroah-Hartman
` (983 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Samarth Narang, Lance Yang,
Andrew Morton, Lorenzo Stoakes (ARM), Kiryl Shutsemau (Meta),
David Hildenbrand (Arm), Mel Gorman, Chengming Zhou,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jérôme Glisse,
Andrea Arcangeli, Peter Xu, Bobby Powers, Brian Geffon,
Denis Plotnikov, Doug Gilbert, Hugh Dickins, Johannes Weiner,
Martin Cracauer, Marty McFadden, Maya Gokhale, Pavel Emelyanov,
Rik van Riel, Shaohua Li, James Houghton, Jonathan Corbet,
Paolo Bonzini, Sean Christopherson, SJ Park, Zi Yan,
Mohammed EL Kadiri, Sasha Levin, Xu Xin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lance Yang <lance.yang@linux.dev>
[ Upstream commit 990d6c2194a938a19a8cf94c6cfd75171345089b ]
KSM loses userfaultfd protection when replace_page() builds a new PTE from
vma->vm_page_prot. Dropping its uffd bit lets a subsequent write go
through ordinary COW instead of userfaultfd write protection handling.
For RWP, a merged page also becomes readable without faulting.
Keeping the uffd bit and restoring PAGE_NONE fixes merging, but we also
have to handle unmerging. An existing KSM page can be protected with RWP
before MADV_UNMERGEABLE, so unmerging already needs fixing independently
of preserving RWP during merging.
Unsharing replaces a shared page with a private one and should leave
userfaultfd protection in place, as do_wp_page() already does for write
protection. Currently, an unshare fault reaches do_uffd_rwp() before it
can proceed to do_wp_page().
- With synchronous RWP, handle_userfault() returns VM_FAULT_SIGBUS.
break_ksm() then reports success with a KSM page still merged.
- With asynchronous RWP, protection is cleared before unsharing.
Preserve the uffd bit when merging, and restore PAGE_NONE for RWP. Let
FAULT_FLAG_UNSHARE skip RWP fault handling and keep PAGE_NONE on each
private copy as well. Unsharing can then complete with RWP still armed
for a subsequent access.
Link: https://lore.kernel.org/20261026130054.91461-1-lance.yang@linux.dev
Link: https://lore.kernel.org/all/20261019010934.697895-1-samarth.colleges@gmail.com/
Link: https://lore.kernel.org/all/20261020055518.36087-1-lance.yang@linux.dev/
Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
Fixes: 2d427bb01639 ("mm/userfaultfd: add RWP fault delivery and expose UFFDIO_REGISTER_MODE_RWP")
Signed-off-by: Samarth Narang <samarth.colleges@gmail.com>
Signed-off-by: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Co-developed-by: Samarth Narang <samarth.colleges@gmail.com>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Xu Xin <xu.xin@linux.dev>"
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Bobby Powers <bobbypowers@gmail.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Martin Cracauer <cracauer@cons.org>
Cc: Marty McFadden <mcfadden8@llnl.gov>
Cc: Maya Gokhale <gokhale2@llnl.gov>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Shaohua Li <shli@fb.com>
Cc: James Houghton <jthoughton@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: SJ Park <sj@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Mohammed EL Kadiri <med08elkadiri@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/ksm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/ksm.c b/mm/ksm.c
index 99147df91a69c..6b38684ce4552 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1182,6 +1182,10 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
if (pte_soft_dirty(orig_pte))
newpte = pte_mksoft_dirty(newpte);
+ /* Preserve uffd-wp when replacing the page. */
+ if (pte_uffd_wp(orig_pte))
+ newpte = pte_mkuffd_wp(newpte);
+
flush_cache_page(vma, addr, pte_pfn(*ptep));
/*
* No need to notify as we are replacing a read only page with another
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0016/1059] udf: validate VAT inode size for old VAT format
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (14 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0015/1059] mm/ksm: fix userfaultfd protection during merge and unmerge Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0017/1059] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat() Greg Kroah-Hartman
` (982 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <jack@suse.cz>
[ Upstream commit 5163e6ee1ea744d412fe516235bfd9cab15141dc ]
Validate VAT inode is large enough to contain at least the header for
pre-2.00 UDF media format.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f924a814874b3..7dfa6f97e146d 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1216,6 +1216,11 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
if (map->s_partition_type == UDF_VIRTUAL_MAP15) {
map->s_type_specific.s_virtual.s_start_offset = 0;
+ if (sbi->s_vat_inode->i_size < 36) {
+ udf_err(sb, "Too short VAT inode size %lld\n",
+ sbi->s_vat_inode->i_size);
+ return -EFSCORRUPTED;
+ }
map->s_type_specific.s_virtual.s_num_entries =
(sbi->s_vat_inode->i_size - 36) >> 2;
} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0017/1059] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (15 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0016/1059] udf: validate VAT inode size for old VAT format Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0018/1059] io_uring: enable toggle of iowait usage when waiting on CQEs Greg Kroah-Hartman
` (981 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hui Peng, Jan Kara, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <benquike@gmail.com>
[ Upstream commit 49f771d14578733a350c45e34e1bc6ad14f56952 ]
In udf_load_vat() (fs/udf/super.c), validate that vat20->lengthHeader is
at least sizeof(struct virtualAllocationTable20) and does not exceed the
mapped buffer or VAT inode size so computing the VAT table pointer and
entry count cannot underflow or read out of bounds.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://patch.msgid.link/20260919222600.3793513-1-benquike@gmail.com
Signed-off-by: Hui Peng <benquike@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7dfa6f97e146d..16a213542582a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1225,6 +1225,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
(sbi->s_vat_inode->i_size - 36) >> 2;
} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
vati = UDF_I(sbi->s_vat_inode);
+ if (sbi->s_vat_inode->i_size <
+ sizeof(struct virtualAllocationTable20)) {
+ udf_err(sb, "Too short VAT inode size %lld\n",
+ sbi->s_vat_inode->i_size);
+ return -EFSCORRUPTED;
+ }
if (vati->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
pos = udf_block_map(sbi->s_vat_inode, 0);
bh = sb_bread(sb, pos);
@@ -1238,8 +1244,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
map->s_type_specific.s_virtual.s_start_offset =
le16_to_cpu(vat20->lengthHeader);
- if (map->s_type_specific.s_virtual.s_start_offset
- > sbi->s_vat_inode->i_size) {
+ if (map->s_type_specific.s_virtual.s_start_offset <
+ sizeof(struct virtualAllocationTable20) ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sb->s_blocksize ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sbi->s_vat_inode->i_size) {
udf_err(sb, "Corrupted VAT header length %u (VAT inode size %lld)\n",
map->s_type_specific.s_virtual.s_start_offset,
sbi->s_vat_inode->i_size);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0018/1059] io_uring: enable toggle of iowait usage when waiting on CQEs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (16 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0017/1059] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat() Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0019/1059] io_uring: fail soft links on negative IOU_COMPLETE results Greg Kroah-Hartman
` (980 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <axboe@kernel.dk>
Commit 07754bfd9aee59063f8549f6e4d455eae636ecc7 upstream.
By default, io_uring marks a waiting task as being in iowait, if it's
sleeping waiting on events and there are pending requests. This isn't
necessarily always useful, and may be confusing on non-storage setups
where iowait isn't expected. It can also cause extra power usage, by
preventing the CPU from entering lower sleep states.
This adds a new enter flag, IORING_ENTER_NO_IOWAIT. If set, then
io_uring will not account the sleeping task as being in iowait. If the
kernel supports this feature, then it will be marked by having the
IORING_FEAT_NO_IOWAIT feature flag set.
As the kernel currently does not support separating the iowait
accounting and CPU frequency boosting, the IORING_ENTER_NO_IOWAIT
controls both of these at the same time. In the future, if those do end
up being split, then it'd be possible to control them separately.
However, it seems more likely that the kernel will decouple iowait and
CPU frequency boosting anyway.
[ 6.1: no struct ext_arg here. Pass the enter flags to io_cqring_wait()
and keep the setting in struct io_wait_queue. Flag bits match
upstream. ]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/uapi/linux/io_uring.h | 2 ++
io_uring/io_uring.c | 15 +++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index aeed98cb5c1c8..f49ac2a5afa45 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -434,6 +434,7 @@ struct io_cqring_offsets {
#define IORING_ENTER_SQ_WAIT (1U << 2)
#define IORING_ENTER_EXT_ARG (1U << 3)
#define IORING_ENTER_REGISTERED_RING (1U << 4)
+#define IORING_ENTER_NO_IOWAIT (1U << 7)
/*
* Passed in for io_uring_setup(2). Copied back with updated info on success
@@ -467,6 +468,7 @@ struct io_uring_params {
#define IORING_FEAT_RSRC_TAGS (1U << 10)
#define IORING_FEAT_CQE_SKIP (1U << 11)
#define IORING_FEAT_LINKED_FILE (1U << 12)
+#define IORING_FEAT_NO_IOWAIT (1U << 17)
/*
* io_uring_register(2) opcodes and arguments
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 866c6ad29e4c9..c59fbe6905de9 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2354,6 +2354,7 @@ struct io_wait_queue {
struct io_ring_ctx *ctx;
unsigned cq_tail;
unsigned nr_timeouts;
+ bool iowait;
};
static inline bool io_has_work(struct io_ring_ctx *ctx)
@@ -2439,7 +2440,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
* to be important for low QD IO.
*/
io_wait = current->in_iowait;
- if (current_pending_io())
+ if (iowq->iowait && current_pending_io())
current->in_iowait = 1;
ret = 1;
if (!schedule_hrtimeout(timeout, HRTIMER_MODE_ABS))
@@ -2452,7 +2453,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
* Wait until events become available, if we don't already have some. The
* application must reap them itself, as they reside on the shared cq ring.
*/
-static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
+static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,
const sigset_t __user *sig, size_t sigsz,
struct __kernel_timespec __user *uts)
{
@@ -2501,6 +2502,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
iowq.wq.private = current;
INIT_LIST_HEAD(&iowq.wq.entry);
iowq.ctx = ctx;
+ iowq.iowait = !(flags & IORING_ENTER_NO_IOWAIT);
iowq.nr_timeouts = atomic_read(&ctx->cq_timeouts);
iowq.cq_tail = READ_ONCE(ctx->rings->cq.head) + min_events;
@@ -3427,7 +3429,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
if (unlikely(flags & ~(IORING_ENTER_GETEVENTS | IORING_ENTER_SQ_WAKEUP |
IORING_ENTER_SQ_WAIT | IORING_ENTER_EXT_ARG |
- IORING_ENTER_REGISTERED_RING)))
+ IORING_ENTER_REGISTERED_RING |
+ IORING_ENTER_NO_IOWAIT)))
return -EINVAL;
/*
@@ -3530,8 +3533,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
if (likely(!ret2)) {
min_complete = min(min_complete,
ctx->cq_entries);
- ret2 = io_cqring_wait(ctx, min_complete, sig,
- argsz, ts);
+ ret2 = io_cqring_wait(ctx, min_complete, flags,
+ sig, argsz, ts);
}
}
@@ -3785,7 +3788,7 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
IORING_FEAT_POLL_32BITS | IORING_FEAT_SQPOLL_NONFIXED |
IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS |
IORING_FEAT_RSRC_TAGS | IORING_FEAT_CQE_SKIP |
- IORING_FEAT_LINKED_FILE;
+ IORING_FEAT_LINKED_FILE | IORING_FEAT_NO_IOWAIT;
if (copy_to_user(params, p, sizeof(*p))) {
ret = -EFAULT;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0019/1059] io_uring: fail soft links on negative IOU_COMPLETE results
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (17 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0018/1059] io_uring: enable toggle of iowait usage when waiting on CQEs Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0020/1059] io_uring/rw: fail soft links on IOPOLL short or error IO Greg Kroah-Hartman
` (979 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Xiuwei, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Commit 9ed19503a7b34e1ffb2b81236843204c473b0ae0 upstream.
Handlers such as fsync return IOU_COMPLETE with a negative cqe.res.
The old io_req_complete() path called req_set_fail() for res < 0.
After completions moved into the core, that check was dropped,
so IOSQE_IO_LINK dependents kept running after the head failed.
Fixes: 97b388d70b53 ("io_uring: handle completions in the core")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20261114041123.109163-1-yangxiuwei@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[axboe: 6.1 has IOU_OK rather than IOU_COMPLETE]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/io_uring.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index c59fbe6905de9..cedb21c1295ef 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1756,9 +1756,11 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
}
if (ret == IOU_OK) {
- /* not all handlers take care of the internal restart codes */
- if (unlikely(req->cqe.res <= -ERESTARTSYS))
- req->cqe.res = io_fixup_restart_res(req->cqe.res);
+ if (unlikely(req->cqe.res < 0)) {
+ if (req->cqe.res <= -ERESTARTSYS)
+ req->cqe.res = io_fixup_restart_res(req->cqe.res);
+ req_set_fail(req);
+ }
if (issue_flags & IO_URING_F_COMPLETE_DEFER)
io_req_complete_defer(req);
else
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0020/1059] io_uring/rw: fail soft links on IOPOLL short or error IO
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (18 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0019/1059] io_uring: fail soft links on negative IOU_COMPLETE results Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0021/1059] io_uring/rsrc: keep the old file when a file update fails Greg Kroah-Hartman
` (978 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Xiuwei, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Commit 4d3db66c5363dcf42c3d43ebaea330ac2d1888bb upstream.
io_complete_rw_iopoll() updates cqe.res when the transfer does not
match the requested length, but it does not call req_set_fail().
Soft linked requests then still run after a short or failed IOPOLL
read or write.
Fixes: b66ceaf324b3 ("io_uring: move iopoll reissue into regular IO path")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20261114072246.741950-3-yangxiuwei@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[axboe: 6.1 reissues from inside the res != cqe.res branch, fail the
request after the reissue check there]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/rw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 8c38449dd7da0..268f4e923997b 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -304,6 +304,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)
req->flags |= REQ_F_REISSUE | REQ_F_PARTIAL_IO;
return;
}
+ req_set_fail(req);
req->cqe.res = res;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0021/1059] io_uring/rsrc: keep the old file when a file update fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (19 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0020/1059] io_uring/rw: fail soft links on IOPOLL short or error IO Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0022/1059] Input: destroy force-feedback device on input unregistration Greg Kroah-Hartman
` (977 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cheng Yongkang, Jens Axboe,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
Commit e5a346e4309d720c47fe8331a00068608fad47dd upstream.
__io_sqe_files_update() resets the slot before it calls fget() on the
new fd. If fget() fails, the fd is an io_uring file, or the node
allocation fails, the update stops and reports that entry as not done,
but the old file has already been removed. Later requests that use the
slot fail with -EBADF, and if the old file was registered with a tag,
its tag CQE is posted as if it had been removed on purpose.
Reset the slot only after the new file has been checked and its node
allocated, as io_install_fixed_file() does. Removal with fd == -1 still
resets the slot right away.
Fixes: c3a31e605620 ("io_uring: add support for IORING_REGISTER_FILES_UPDATE")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/20261116044531.281978-1-teel4res@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[axboe: 6.1 has no rsrc nodes for files, the old file is queued for
removal with io_queue_rsrc_removal(), which can fail. Get and check the
new file first, and only remove the old one once that has succeeded]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/rsrc.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index eb91f5b289244..485e6571172c3 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -438,7 +438,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
__s32 __user *fds = u64_to_user_ptr(up->data);
struct io_rsrc_data *data = ctx->file_data;
struct io_fixed_file *file_slot;
- struct file *file;
int fd, i, err = 0;
unsigned int done;
bool needs_switch = false;
@@ -449,6 +448,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
return -EINVAL;
for (done = 0; done < nr_args; done++) {
+ struct file *file = NULL;
u64 tag = 0;
if ((tags && copy_from_user(&tag, &tags[done], sizeof(tag))) ||
@@ -466,15 +466,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
i = array_index_nospec(up->offset + done, ctx->nr_user_files);
file_slot = io_fixed_file_slot(&ctx->file_table, i);
- if (file_slot->file_ptr) {
- file = (struct file *)(file_slot->file_ptr & FFS_MASK);
- err = io_queue_rsrc_removal(data, i, ctx->rsrc_node, file);
- if (err)
- break;
- file_slot->file_ptr = 0;
- io_file_bitmap_clear(&ctx->file_table, i);
- needs_switch = true;
- }
if (fd != -1) {
file = fget(fd);
if (!file) {
@@ -494,6 +485,21 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
err = -EBADF;
break;
}
+ }
+ if (file_slot->file_ptr) {
+ struct file *old = (struct file *)(file_slot->file_ptr & FFS_MASK);
+
+ err = io_queue_rsrc_removal(data, i, ctx->rsrc_node, old);
+ if (err) {
+ if (file)
+ fput(file);
+ break;
+ }
+ file_slot->file_ptr = 0;
+ io_file_bitmap_clear(&ctx->file_table, i);
+ needs_switch = true;
+ }
+ if (file) {
*io_get_tag_slot(data, i) = tag;
io_fixed_file_set(file_slot, file);
io_file_bitmap_set(&ctx->file_table, i);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0022/1059] Input: destroy force-feedback device on input unregistration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (20 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0021/1059] io_uring/rsrc: keep the old file when a file update fails Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0023/1059] staging: media: atomisp: use array3_size() for overflow-safe allocation Greg Kroah-Hartman
` (976 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gideon Heinz, Dmitry Torokhov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit 2ae35f090d029d2d8491b0a7f98a04c5c05d0a44 ]
When an input device is unregistered while userspace holds an open file
descriptor to its event node, input_dev_release() is deferred until the
last file descriptor is closed. Because input_ff_destroy() was only
called from input_dev_release(), force-feedback teardown (ff->destroy
and freeing ff->private) could run after the parent driver had already
unbound, freed its device state, or even been unloaded via rmmod,
causing use-after-free errors or page faults in unmapped module text.
Commit ef166ce08801 ("Input: stop force-feedback timer when
unregistering input devices") added a separate ff->stop callback for
ff-memless, but left ff->destroy invoked from input_dev_release().
Once __input_unregister_device() has disconnected all input handlers
(which flushes effects, closes the device, and marks evdev dead) and
deleted the device from sysfs, nothing accesses dev->ff anymore. Call
input_ff_destroy() directly in __input_unregister_device() so that
ff->destroy() always runs synchronously while the driver and its module
are still active, and remove the now-redundant ff->stop callback. Keep
input_ff_destroy() in input_dev_release() (where it is a no-op once
dev->ff is NULL) to handle input_free_device() on devices that were
never registered.
Fixes: 509ca1a93836 ("Input: implement new force feedback interface")
Reported-by: Gideon Heinz <gideonheinz02@gmail.com>
Closes: https://lore.kernel.org/r/CAPb1+K2BxnfQ7VUQ15td5f9pVhn-ARSM9EjfOU8WuW72o+cvPg@mail.gmail.com
Tested-by: Gideon Heinz <gideonheinz02@gmail.com>
Link: https://patch.msgid.link/2f722967b6db0692d4dd4164aff39b62@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ sashal: Dropped the upstream hunks that remove the ff->stop infrastructure (including ml_ff_stop()), since it doesn't exist in this tree, and adjusted context in input.c and ff-core.c. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/input/ff-core.c | 2 +-
drivers/input/input.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index 609a5f01761bd..624f8defa5432 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -358,7 +358,7 @@ EXPORT_SYMBOL_GPL(input_ff_create);
*
* This function is only needed in error path as input core will
* automatically free force feedback structures when device is
- * destroyed.
+ * unregistered or destroyed.
*/
void input_ff_destroy(struct input_dev *dev)
{
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78be582b5766d..ef029c3c96c58 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2304,6 +2304,8 @@ static void __input_unregister_device(struct input_dev *dev)
mutex_unlock(&input_mutex);
device_del(&dev->dev);
+
+ input_ff_destroy(dev);
}
static void devm_input_device_unregister(struct device *dev, void *res)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0023/1059] staging: media: atomisp: use array3_size() for overflow-safe allocation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (21 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0022/1059] Input: destroy force-feedback device on input unregistration Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0024/1059] fs/9p: switch vfsmount to use v9fs_get_new_inode Greg Kroah-Hartman
` (975 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Feng Ning, Sakari Ailus, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feng Ning <feng@innora.ai>
commit d178c7ca8fefc28115d35b94c3b1f4d653e34182 upstream.
Replace open-coded width * height * sizeof() multiplications with
array3_size() to prevent integer overflow in buffer allocations.
The atomisp driver computes DVS, morphing table, shading table and
statistics buffer sizes using unchecked arithmetic. When dimensions
are attacker-controlled or simply large, the product can silently wrap,
causing kvmalloc() to allocate an undersized buffer.
array3_size() saturates to SIZE_MAX on overflow, so kvmalloc() returns
NULL instead of succeeding with too few bytes.
Signed-off-by: Feng Ning <feng@innora.ai>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../media/atomisp/pci/sh_css_param_dvs.c | 11 +++---
.../media/atomisp/pci/sh_css_param_shading.c | 4 ++-
.../staging/media/atomisp/pci/sh_css_params.c | 35 +++++++++++--------
3 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
index ff0082d02af3e..0d08629797a47 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
@@ -13,6 +13,7 @@
* more details.
*/
+#include <linux/overflow.h>
#include "sh_css_param_dvs.h"
#include <assert_support.h>
#include <type_support.h>
@@ -58,7 +59,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
}
/* Generate Y buffers */
- dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->xcoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_y) {
IA_CSS_ERROR("out of memory");
@@ -66,7 +67,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
goto exit;
}
- dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->ycoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_y) {
IA_CSS_ERROR("out of memory");
@@ -77,7 +78,8 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
/* Generate UV buffers */
IA_CSS_LOG("UV W %d H %d", width_uv, height_uv);
- dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t),
+ dvs_config->xcoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_uv) {
IA_CSS_ERROR("out of memory");
@@ -85,7 +87,8 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
goto exit;
}
- dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t),
+ dvs_config->ycoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_uv) {
IA_CSS_ERROR("out of memory");
diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
index 41a4c91623196..c62c3fea0944b 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
@@ -13,6 +13,7 @@
* more details.
*/
+#include <linux/overflow.h>
#include <linux/slab.h>
#include <math_support.h>
@@ -349,7 +350,8 @@ ia_css_shading_table_alloc(
me->fraction_bits = 0;
for (i = 0; i < IA_CSS_SC_NUM_COLORS; i++) {
me->data[i] =
- kvmalloc(width * height * sizeof(*me->data[0]),
+ kvmalloc(array3_size(width, height,
+ sizeof(*me->data[0])),
GFP_KERNEL);
if (!me->data[i]) {
unsigned int j;
diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index 34113bea31d58..8d1d4d808bd72 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -13,6 +13,7 @@
* more details.
*/
+#include <linux/overflow.h>
#include "gdc_device.h" /* gdc_lut_store(), ... */
#include "isp.h" /* ISP_VEC_ELEMBITS */
#include "vamem.h"
@@ -1381,11 +1382,11 @@ struct ia_css_morph_table *ia_css_morph_table_allocate(
}
for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
- me->coordinates_x[i] = kvmalloc(height * width *
- sizeof(*me->coordinates_x[i]),
+ me->coordinates_x[i] = kvmalloc(array3_size(height, width,
+ sizeof(*me->coordinates_x[i])),
GFP_KERNEL);
- me->coordinates_y[i] = kvmalloc(height * width *
- sizeof(*me->coordinates_y[i]),
+ me->coordinates_y[i] = kvmalloc(array3_size(height, width,
+ sizeof(*me->coordinates_y[i])),
GFP_KERNEL);
if ((!me->coordinates_x[i]) ||
@@ -4171,13 +4172,17 @@ ia_css_dvs_statistics_allocate(const struct ia_css_dvs_grid_info *grid)
goto err;
me->grid = *grid;
- me->hor_proj = kvmalloc(grid->height * IA_CSS_DVS_NUM_COEF_TYPES *
- sizeof(*me->hor_proj), GFP_KERNEL);
+ me->hor_proj = kvmalloc(array3_size(grid->height,
+ IA_CSS_DVS_NUM_COEF_TYPES,
+ sizeof(*me->hor_proj)),
+ GFP_KERNEL);
if (!me->hor_proj)
goto err;
- me->ver_proj = kvmalloc(grid->width * IA_CSS_DVS_NUM_COEF_TYPES *
- sizeof(*me->ver_proj), GFP_KERNEL);
+ me->ver_proj = kvmalloc(array3_size(grid->width,
+ IA_CSS_DVS_NUM_COEF_TYPES,
+ sizeof(*me->ver_proj)),
+ GFP_KERNEL);
if (!me->ver_proj)
goto err;
@@ -4444,24 +4449,26 @@ ia_css_dvs2_6axis_config_allocate(const struct ia_css_stream *stream)
params->pipe_dvs_6axis_config[IA_CSS_PIPE_ID_VIDEO]->height_uv;
IA_CSS_LOG("table Y: W %d H %d", width_y, height_y);
IA_CSS_LOG("table UV: W %d H %d", width_uv, height_uv);
- dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->xcoords_y = kvmalloc(array3_size(width_y, height_y,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_y)
goto err;
- dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->ycoords_y = kvmalloc(array3_size(width_y, height_y,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_y)
goto err;
- dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv *
- sizeof(uint32_t),
+ dvs_config->xcoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_uv)
goto err;
- dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv *
- sizeof(uint32_t),
+ dvs_config->ycoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_uv)
goto err;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0024/1059] fs/9p: switch vfsmount to use v9fs_get_new_inode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (22 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0023/1059] staging: media: atomisp: use array3_size() for overflow-safe allocation Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0025/1059] fs/9p: rework qid2ino logic Greg Kroah-Hartman
` (974 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Eric Van Hensbergen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Van Hensbergen <ericvh@kernel.org>
[ Upstream commit fe1371d0f8c6a9aa4441ddd09ea6d4f31b975a81 ]
In the process of cleaning up inode number allocation, I noticed several functions which didn't use the standard helper
allocators. This patch fixes the allocation in the mount entrypoint.
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Stable-dep-of: 8bb0279930cc ("9p: skip intermediate directory entry name copy in p9dirent_read()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_super.c | 29 +----------------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 7c35347f1d9be..1266b80ba1032 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -113,7 +113,6 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
struct inode *inode = NULL;
struct dentry *root = NULL;
struct v9fs_session_info *v9ses = NULL;
- umode_t mode = 0777 | S_ISVTX;
struct p9_fid *fid;
int retval = 0;
@@ -143,7 +142,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
else
sb->s_d_op = &v9fs_dentry_operations;
- inode = v9fs_get_inode(sb, S_IFDIR | mode, 0);
+ inode = v9fs_get_new_inode_from_fid(v9ses, fid, sb);
if (IS_ERR(inode)) {
retval = PTR_ERR(inode);
goto release_sb;
@@ -155,32 +154,6 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
goto release_sb;
}
sb->s_root = root;
- if (v9fs_proto_dotl(v9ses)) {
- struct p9_stat_dotl *st = NULL;
-
- st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
- if (IS_ERR(st)) {
- retval = PTR_ERR(st);
- goto release_sb;
- }
- d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
- v9fs_stat2inode_dotl(st, d_inode(root), 0);
- kfree(st);
- } else {
- struct p9_wstat *st = NULL;
-
- st = p9_client_stat(fid);
- if (IS_ERR(st)) {
- retval = PTR_ERR(st);
- goto release_sb;
- }
-
- d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
- v9fs_stat2inode(st, d_inode(root), sb, 0);
-
- p9stat_free(st);
- kfree(st);
- }
retval = v9fs_get_acl(inode, fid);
if (retval)
goto release_sb;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0025/1059] fs/9p: rework qid2ino logic
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (23 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0024/1059] fs/9p: switch vfsmount to use v9fs_get_new_inode Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0026/1059] 9p: skip intermediate directory entry name copy in p9dirent_read() Greg Kroah-Hartman
` (973 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Eric Van Hensbergen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Van Hensbergen <ericvh@kernel.org>
[ Upstream commit b91a26696ef38eae1442aa03104e60bb49d2ac99 ]
This changes from a function to a macro because we can
figure out if we are 32 or 64 bit at compile time.
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Stable-dep-of: 8bb0279930cc ("9p: skip intermediate directory entry name copy in p9dirent_read()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/v9fs_vfs.h | 7 ++++++-
fs/9p/vfs_dir.c | 4 ++--
fs/9p/vfs_inode.c | 26 ++------------------------
fs/9p/vfs_inode_dotl.c | 6 ++----
4 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 633fe4f527b84..76b15e5261695 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -50,7 +50,12 @@ void v9fs_set_netfs_context(struct inode *inode);
int v9fs_init_inode(struct v9fs_session_info *v9ses,
struct inode *inode, umode_t mode, dev_t rdev);
void v9fs_evict_inode(struct inode *inode);
-ino_t v9fs_qid2ino(struct p9_qid *qid);
+#if (BITS_PER_LONG == 32)
+#define QID2INO(q) ((ino_t) (((q)->path+2) ^ (((q)->path) >> 32)))
+#else
+#define QID2INO(q) ((ino_t) ((q)->path+2))
+#endif
+
void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
struct super_block *sb, unsigned int flags);
void v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 3be09b94a8e24..7ccfbef41bc82 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -135,7 +135,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx)
}
over = !dir_emit(ctx, st.name, strlen(st.name),
- v9fs_qid2ino(&st.qid), dt_type(&st));
+ QID2INO(&st.qid), dt_type(&st));
p9stat_free(&st);
if (over)
return 0;
@@ -197,7 +197,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)
if (!dir_emit(ctx, curdirent.d_name,
strlen(curdirent.d_name),
- v9fs_qid2ino(&curdirent.qid),
+ QID2INO(&curdirent.qid),
curdirent.d_type))
return 0;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index ba670d86894a9..ddf11ead64a59 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -456,7 +456,6 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
dev_t rdev;
int retval;
umode_t umode;
- unsigned long i_ino;
struct inode *inode;
struct v9fs_session_info *v9ses = sb->s_fs_info;
int (*test)(struct inode *inode, void *data);
@@ -466,8 +465,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
else
test = v9fs_test_inode;
- i_ino = v9fs_qid2ino(qid);
- inode = iget5_locked(sb, i_ino, test, v9fs_set_inode, st);
+ inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode, st);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
@@ -477,7 +475,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
* FIXME!! we may need support for stale inodes
* later.
*/
- inode->i_ino = i_ino;
+ inode->i_ino = QID2INO(qid);
umode = p9mode2unixmode(v9ses, st, &rdev);
retval = v9fs_init_inode(v9ses, inode, umode, rdev);
if (retval)
@@ -1221,26 +1219,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
}
-/**
- * v9fs_qid2ino - convert qid into inode number
- * @qid: qid to hash
- *
- * BUG: potential for inode number collisions?
- */
-
-ino_t v9fs_qid2ino(struct p9_qid *qid)
-{
- u64 path = qid->path + 2;
- ino_t i = 0;
-
- if (sizeof(ino_t) == sizeof(path))
- memcpy(&i, &path, sizeof(ino_t));
- else
- i = (ino_t) (path ^ (path >> 32));
-
- return i;
-}
-
/**
* v9fs_vfs_get_link - follow a symlink path
* @dentry: dentry for symlink
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 7c261b354379a..795a3aee5901d 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -102,7 +102,6 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
int new)
{
int retval;
- unsigned long i_ino;
struct inode *inode;
struct v9fs_session_info *v9ses = sb->s_fs_info;
int (*test)(struct inode *inode, void *data);
@@ -112,8 +111,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
else
test = v9fs_test_inode_dotl;
- i_ino = v9fs_qid2ino(qid);
- inode = iget5_locked(sb, i_ino, test, v9fs_set_inode_dotl, st);
+ inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode_dotl, st);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
@@ -123,7 +121,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
* FIXME!! we may need support for stale inodes
* later.
*/
- inode->i_ino = i_ino;
+ inode->i_ino = QID2INO(qid);
retval = v9fs_init_inode(v9ses, inode,
st->st_mode, new_decode_dev(st->st_rdev));
if (retval)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0026/1059] 9p: skip intermediate directory entry name copy in p9dirent_read()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (24 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0025/1059] fs/9p: rework qid2ino logic Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0027/1059] xfrm: zero-initialise km_event in the replay-notify path Greg Kroah-Hartman
` (972 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haobin Wu, Christian Schoenebeck,
Dominique Martinet, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haobin Wu <853555@gmail.com>
[ Upstream commit 8bb0279930cc90975f03bad4d83282613e5f57fa ]
v9fs_dir_readdir_dotl() decodes each entry of a Rreaddir reply with
p9dirent_read(), which parses it through p9pdu_readf("Qqbs"). The 's'
conversion in p9pdu_vreadf() already allocates a NUL-terminated copy
of the name from the wire buffer; p9dirent_read() then strscpy()s that
copy into the fixed 256-byte p9_dirent::d_name and frees the original.
The wire format carries the name length in 16 bits, so a name longer
than 255 bytes is valid on the wire and may well be valid on the
server's filesystem, but it makes strscpy() return -E2BIG.
v9fs_dir_readdir_dotl() turns that into -EIO and aborts getdents64(),
so every entry after the long one disappears from the listing.
Drop the second copy: keep the string allocated by p9pdu_vreadf() in
p9_dirent and let v9fs_dir_readdir_dotl(), its only user, free it once
dir_emit() has consumed it. p9_dirent is a short-lived stack object, so
the string's lifetime does not change.
Note that the VFS only rejects names of PATH_MAX bytes or more in
verify_dirent_name(), so after this change a name between NAME_MAX and
PATH_MAX is returned by getdents64() even though any later lookup on it
fails with -ENAMETOOLONG. The next patch skips such entries.
Fixes: 7751bdb3a095 ("9p: readdir implementation for 9p2000.L")
Closes: https://github.com/microsoft/WSL/issues/41192
Signed-off-by: Haobin Wu <853555@gmail.com>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Message-ID: <20260918024851.51229-2-853555@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_dir.c | 6 +++++-
include/net/9p/client.h | 2 +-
net/9p/protocol.c | 12 ++----------
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 7ccfbef41bc82..6c075ec88b3cc 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -198,8 +198,12 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)
if (!dir_emit(ctx, curdirent.d_name,
strlen(curdirent.d_name),
QID2INO(&curdirent.qid),
- curdirent.d_type))
+ curdirent.d_type)) {
+ kfree(curdirent.d_name);
return 0;
+ }
+
+ kfree(curdirent.d_name);
ctx->pos = curdirent.d_off;
rdir->head += err;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 78ebcf782ce57..d0fc8046cbaa5 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -172,7 +172,7 @@ struct p9_dirent {
struct p9_qid qid;
u64 d_off;
unsigned char d_type;
- char d_name[256];
+ char *d_name;
};
struct iov_iter;
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 0e6603b1ec906..0a97b4de243ab 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -771,7 +771,7 @@ int p9dirent_read(struct p9_client *clnt, char *buf, int len,
{
struct p9_fcall fake_pdu;
int ret;
- char *nameptr;
+ char *nameptr = NULL;
fake_pdu.size = len;
fake_pdu.capacity = len;
@@ -786,15 +786,7 @@ int p9dirent_read(struct p9_client *clnt, char *buf, int len,
return ret;
}
- ret = strscpy(dirent->d_name, nameptr, sizeof(dirent->d_name));
- if (ret < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "On the wire dirent name too long: %s\n",
- nameptr);
- kfree(nameptr);
- return ret;
- }
- kfree(nameptr);
+ dirent->d_name = nameptr;
return fake_pdu.offset;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0027/1059] xfrm: zero-initialise km_event in the replay-notify path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (25 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0026/1059] 9p: skip intermediate directory entry name copy in p9dirent_read() Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0028/1059] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Greg Kroah-Hartman
` (971 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giovanni Vignone, Shubham Antil,
Steffen Klassert, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shubham Antil <shubham@octane.security>
[ Upstream commit e35a12dffd5da67b6ca12bd23eebdd0570592205 ]
xfrm_replay_notify(), xfrm_replay_notify_bmp() and
xfrm_replay_notify_esn() declare a struct km_event on the stack and
initialise only its .event and .data.aevent fields, leaving .seq and
.portid uninitialised. build_aevent() then builds the XFRM_MSG_NEWAE
message with those fields:
nlmsg_put(skb, c->portid, c->seq, ...)
so the netlink header of a replay event carries uninitialised stack
values rather than defined ones. This was confirmed at runtime rather
than by inspection alone: the .seq and .portid carried in that header
hold values that nothing in the replay path assigns.
The request-driven paths set these header fields from the requester
(xfrm_get_ae() / xfrm_new_ae()); only the kernel-originated replay path
leaves them unset. Zero-initialise the event so the header fields are 0,
the correct value for a kernel-originated notification.
Fixes: f8cd54884e67 ("[IPSEC]: Sync series - core changes")
Reported-by: Giovanni Vignone <gio@octane.security>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Shubham Antil <shubham@octane.security>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_replay.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 7f52bb2e14c13..ad54fe0b89ada 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -40,7 +40,7 @@ static void xfrm_replay_notify_esn(struct xfrm_state *x, int event);
void xfrm_replay_notify(struct xfrm_state *x, int event)
{
- struct km_event c;
+ struct km_event c = {};
/* we send notify messages in case
* 1. we updated on of the sequence numbers, and the seqno difference
* is at least x->replay_maxdiff, in this case we also update the
@@ -304,7 +304,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
{
- struct km_event c;
+ struct km_event c = {};
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
@@ -356,7 +356,7 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
static void xfrm_replay_notify_esn(struct xfrm_state *x, int event)
{
u32 seq_diff, oseq_diff;
- struct km_event c;
+ struct km_event c = {};
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0028/1059] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (26 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0027/1059] xfrm: zero-initialise km_event in the replay-notify path Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0029/1059] wifi: ath9k_htc: start ANI when an AP interface begins to beacon Greg Kroah-Hartman
` (970 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+a079f084653164a652d1,
Deepanshu Kartikey, Sven Eckelmann, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <kartikey406@gmail.com>
[ Upstream commit dfa953ba5366b0a80c303700dab2bbcbdc5c27e9 ]
batadv_orig_ifinfo_new() returns NULL only when its GFP_ATOMIC
allocation fails, which is a normal runtime condition and not a bug.
batadv_v_ogm_forward() already handles this the same way, simply
checking for NULL without a WARN_ON.
Do the same in batadv_iv_ogm_update_seqnos() to avoid a spurious
WARN_ON splat when the allocation fails (e.g. under fault injection).
Fixes: 7351a4822d42 ("batman-adv: split out router from orig_node")
Reported-by: syzbot+a079f084653164a652d1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a079f084653164a652d1
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/batman-adv/bat_iv_ogm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 82685a0a9397e..5a84785613b4c 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1297,7 +1297,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
return BATADV_NO_DUP;
orig_ifinfo = batadv_orig_ifinfo_new(orig_node, if_outgoing);
- if (WARN_ON(!orig_ifinfo)) {
+ if (!orig_ifinfo) {
batadv_orig_node_put(orig_node);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0029/1059] wifi: ath9k_htc: start ANI when an AP interface begins to beacon
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (27 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0028/1059] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0030/1059] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts Greg Kroah-Hartman
` (969 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mehmet Fide,
Toke Høiland-Jørgensen, Jeff Johnson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
[ Upstream commit 5c1b202d67a212c87e7389aaa093ce77828fa98f ]
ath9k_htc_vif_reconfig() re-arms ANI after a channel change when an AP
interface beacons. mac80211 configures the channel before it enables
the beacon, so during a normal AP start that never triggers, and the
start from add_interface that the previous patch removed was cancelled
by the same channel configuration: with hostapd, ANI and the periodic
calibration it drives did not run in AP mode until a later channel
change.
Start ANI when the beacon is enabled. The channel and its calibration
data are in place by then, which is the state vif_reconfig() re-arms
it in, and remove_interface() already stops it with the last AP
interface.
Fixes: a236254c35f0 ("ath9k_htc: Add ANI for AP mode")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20261005072209.4101009-3-mehmet.fide@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 61875c45366b7..7d1d37df74a6d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1553,6 +1553,9 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
ath9k_htc_set_tsfadjust(priv, vif);
priv->cur_beacon_conf.enable_beacon = 1;
ath9k_htc_beacon_config(priv, vif);
+ if (priv->ah->opmode == NL80211_IFTYPE_AP &&
+ !test_bit(ATH_OP_ANI_RUN, &common->op_flags))
+ ath9k_htc_start_ani(priv);
}
if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0030/1059] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (28 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0029/1059] wifi: ath9k_htc: start ANI when an AP interface begins to beacon Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0031/1059] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Greg Kroah-Hartman
` (968 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Imre Kaloz,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <kaloz@kernel.org>
[ Upstream commit 9a2690eb4bbea8d7fbc3dfe478fca75fe956abb4 ]
The REQUEST SENSE length was taken from sg->len after the AHC_DMA_LAST_SEG
flag was or-ed in and the value converted to little-endian, so the 8-bit
field is 0x80 on big-endian hosts and the target is asked for 128 bytes
into a 32-byte buffer. Use the buffer size, as aic79xx does. On an SGI O2
with a Fujitsu MAX3147NC, the sense data of its CHECK CONDITIONs during
probe was lost.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
Link: https://patch.msgid.link/20261013094253.2956-1-kaloz@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index d747d0b72a13a..989e8c9bda4ac 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1097,7 +1097,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
sc->byte2 = SCB_GET_LUN(scb) << 5;
sc->unused[0] = 0;
sc->unused[1] = 0;
- sc->length = sg->len;
+ sc->length = ahc_get_sense_bufsize(ahc, scb);
sc->control = 0;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0031/1059] scsi: aha1542: Remove unneeded scsi_dma_unmap() call
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (29 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0030/1059] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0032/1059] wifi: ath10k: Stop unanswered temperature reads Greg Kroah-Hartman
` (967 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Laurence Oberman, Matthew Whitehead,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Whitehead <tedheadster@gmail.com>
[ Upstream commit 9ec6671b137de06f0345962fb8091466b7d56a96 ]
aha1542 never DMA maps the command's scatterlist. Data is bounced
through a per-command buffer allocated with dma_alloc_coherent() in
aha1542_init_cmd_priv(), the adapter is programmed with
acmd->data_buffer_handle, and the payload is copied to and from the
request segments in aha1542_queuecommand() and aha1542_free_cmd().
The scsi_dma_unmap() call left in aha1542_free_cmd() therefore unmaps
a scatterlist that was never mapped. With CONFIG_DMA_API_DEBUG enabled
this results in:
device driver tries to free DMA memory it has not allocated
[device address=0x0000000000000000] [size=0 bytes]
Remove the call.
Verified by testing on real hardware.
Fixes: 2f2fef022c3e ("aha1542: use a local bounce buffer")
Suggested-by: Laurence Oberman <loberman@redhat.com>
Assisted-by: LLM
Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://patch.msgid.link/20260929144528.7061-1-tedheadster@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/aha1542.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 552ca95157da8..eef61bc6cd609 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -271,8 +271,6 @@ static void aha1542_free_cmd(struct scsi_cmnd *cmd)
buf += bv.bv_len;
}
}
-
- scsi_dma_unmap(cmd);
}
static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0032/1059] wifi: ath10k: Stop unanswered temperature reads
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (30 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0031/1059] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0033/1059] seg6: fix transport header for inner IPv4 with IP options Greg Kroah-Hartman
` (966 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Filippo Falezza, Loic Poulain,
Jeff Johnson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filippo Falezza <effeffe99@gmail.com>
[ Upstream commit 2a87e367c62856b87a90f745c6b7d2eb91e0c51f ]
Reading the ath10k hwmon temperature sends WMI_PDEV_GET_TEMPERATURE and
waits up to 5 s (ATH10K_THERMAL_SYNC_TIMEOUT_HZ) for the reply event,
holding conf_mutex. Not all firmware answers: the WCN3990 firmware
WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1 on a Motorola Moto G 5G Plus
codename nairo (SM7250) never sends the event, so every read of
temp1_input stalls for 5 s, logs
ath10k_snoc 18800000.wifi: failed to synchronize thermal read
and returns -ETIMEDOUT. Tools that read all hwmon sensors, such as
lm-sensors, hang for 5 s on every run, and configuration changes of the
interface wait for conf_mutex in the meantime.
Whether the firmware answers cannot be told from the chip: firmware that
answers and firmware that does not both advertise
WMI_SERVICE_THERM_THROT, and WCN3990 firmware differs between devices.
Instead, remember that the running firmware did not answer, and return
-EOPNOTSUPP right away on later reads. Forget it when the firmware
starts, so that a restarted or updated firmware is asked again.
The first read after each firmware start still takes 5 s when the
firmware does not answer. Reads on firmware that answers are unchanged.
Fixes: e98199a8c27f ("ath10k: enable QCA6174/QCA9377 to read the chip temperature")
Signed-off-by: Filippo Falezza <effeffe99@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-ath10k-temperature-v2-1-0793e80d73bc@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.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, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 81058be3598f1..6dd20eda491cf 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2926,6 +2926,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
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)) {
diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
index cefd97323dfe5..51484c986298c 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -74,6 +74,12 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
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) {
@@ -89,7 +95,8 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
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\n");
+ ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
+ ar->thermal.broken = true;
ret = -ETIMEDOUT;
goto out;
}
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
index 1f4de9fbf2b30..d1fb5b958c37c 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -19,6 +19,8 @@ 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
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0033/1059] seg6: fix transport header for inner IPv4 with IP options
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (31 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0032/1059] wifi: ath10k: Stop unanswered temperature reads Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0034/1059] gpio: omap: Propagate runtime PM failures in probe and request Greg Kroah-Hartman
` (965 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hazley Samsudin, David Ahern,
Hangbin Liu, Andrea Mayer, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <andrea.mayer@uniroma2.it>
[ Upstream commit 5838f10563d58afca6711edb5e4eda968ca181d9 ]
The End.DT4, End.DT46 (its IPv4 path only) and End.DX4 behaviors set the
transport header of the decapsulated IPv4 packet at a fixed 20 bytes, the
size of an IPv4 header without options. They do not validate the header
length either. With options, the transport header points at the first
option byte. The effects include:
- ping -R sends an echo request with a 60-byte IPv4 header to a local
address through an End.DT4 or an End.DX4 SID. Since icmp_rcv()
computes the ICMP checksum from the first option byte, the request
fails the check and is counted in IcmpInCsumErrors.
- A UDP datagram can reach a port that an iptables rule drops. The rule
checks the UDP header after the full IPv4 header, while the socket
lookup reads it at the fixed 20-byte offset.
- With an inbound AH state, ah_input() reads the AH header at the fixed
20-byte offset, but copies the IPv4 header over it with the length in
the IHL field. A packet shorter than that length can make ah_input()
write past the end of the data, into skb_shared_info when the skb has
no tailroom.
Validate the inner IPv4 header length with the new helper
seg6_validate_iphdr_len() and set the transport header at that length. A
packet that is not IPv4, whose header length field is below 5, or whose
header is truncated, is dropped with a drop reason. The fix is limited to
the header length, which the transport header relies on. Other checks done
on IPv4 input, such as the header checksum, the total length and the IP
options, are not addressed here.
Found by code inspection while reviewing commit 44930446dde4 ("ipv6: seg6:
clear IPv4 control block on IPIP decapsulation"), as a pre-existing issue
that Sashiko also reported on v2 of that patch. Without this patch, a
bpftrace probe on ah_input() shows the reporter's reproducer packet
written into skb_shared_info. With it, that packet is dropped before
ah_input(), ping -R no longer fails the ICMP checksum, the UDP datagram
reaches its real port, and the SRv6 selftests still pass. These effects
reproduce on an unmodified kernel, without error injection.
Fixes: 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")
Fixes: 664d6f86868b ("seg6: add support for the SRv6 End.DT4 behavior")
Reported-by: Hazley Samsudin <hazleycryilis@gmail.com>
Closes: https://lore.kernel.org/netdev/20260809221915.2ffc1ecd0f445fcb70270e31@uniroma2.it/
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/20261028171511.35-1-andrea.mayer@uniroma2.it
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/seg6_local.c | 69 +++++++++++++++++++++++++++++++++----------
1 file changed, 53 insertions(+), 16 deletions(-)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index b73c7ee3acd90..d138ae182d0c2 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -138,9 +138,7 @@ struct seg6_end_dt_info {
int vrf_ifindex;
int vrf_table;
- /* tunneled packet family (IPv4 or IPv6).
- * Protocol and header length are inferred from family.
- */
+ /* tunneled packet family (IPv4 or IPv6) */
u16 family;
};
@@ -582,6 +580,40 @@ static int input_action_end_dx6(struct sk_buff *skb,
return -EINVAL;
}
+/* Validate the length of the IPv4 header at skb->data (which must point to
+ * the network header) and report that length, options included.
+ * Only the version, the header length and the presence of the whole header
+ * are checked.
+ * The length is written only when SKB_NOT_DROPPED_YET is returned.
+ *
+ * skb pointers may change: after this call, the caller must evaluate again
+ * any pointer into the packet data.
+ */
+static enum skb_drop_reason
+seg6_validate_iphdr_len(struct sk_buff *skb, int *hdrlen)
+{
+ enum skb_drop_reason reason;
+ const struct iphdr *iph;
+ int len;
+
+ reason = pskb_may_pull_reason(skb, sizeof(struct iphdr));
+ if (reason)
+ return reason;
+
+ iph = ip_hdr(skb);
+ if (iph->version != 4 || iph->ihl < 5)
+ return SKB_DROP_REASON_IP_INHDR;
+
+ len = ip_hdrlen(skb);
+
+ reason = pskb_may_pull_reason(skb, len);
+ if (reason)
+ return reason;
+
+ *hdrlen = len;
+ return SKB_NOT_DROPPED_YET;
+}
+
static int input_action_end_dx4_finish(struct net *net, struct sock *sk,
struct sk_buff *skb)
{
@@ -611,14 +643,18 @@ static int input_action_end_dx4_finish(struct net *net, struct sock *sk,
static int input_action_end_dx4(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
{
+ SKB_DR(reason);
+ int hdrlen;
+
if (!decap_and_validate(skb, IPPROTO_IPIP))
goto drop;
- if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+ reason = seg6_validate_iphdr_len(skb, &hdrlen);
+ if (reason)
goto drop;
skb->protocol = htons(ETH_P_IP);
- skb_set_transport_header(skb, sizeof(struct iphdr));
+ skb_set_transport_header(skb, hdrlen);
nf_reset_ct(skb);
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
@@ -628,7 +664,7 @@ static int input_action_end_dx4(struct sk_buff *skb,
return input_action_end_dx4_finish(dev_net(skb->dev), NULL, skb);
drop:
- kfree_skb(skb);
+ kfree_skb_reason(skb, reason);
return -EINVAL;
}
@@ -763,16 +799,24 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
struct seg6_end_dt_info *info = &slwt->dt_info;
struct net_device *vrf;
__be16 protocol;
+ SKB_DR(reason);
int hdrlen;
vrf = end_dt_get_vrf_rcu(skb, info);
if (unlikely(!vrf))
goto drop;
+ if (unlikely(info->family != AF_UNSPEC && info->family != family)) {
+ pr_warn_once("seg6local: SRv6 End.DT* family mismatch");
+ goto drop;
+ }
+
switch (family) {
case AF_INET:
protocol = htons(ETH_P_IP);
- hdrlen = sizeof(struct iphdr);
+ reason = seg6_validate_iphdr_len(skb, &hdrlen);
+ if (unlikely(reason))
+ goto drop;
break;
case AF_INET6:
protocol = htons(ETH_P_IPV6);
@@ -784,11 +828,6 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
goto drop;
}
- if (unlikely(info->family != AF_UNSPEC && info->family != family)) {
- pr_warn_once("seg6local: SRv6 End.DT* family mismatch");
- goto drop;
- }
-
skb->protocol = protocol;
skb_dst_drop(skb);
@@ -799,7 +838,7 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
return end_dt_vrf_rcv(skb, family, vrf);
drop:
- kfree_skb(skb);
+ kfree_skb_reason(skb, reason);
return ERR_PTR(-EINVAL);
}
@@ -812,9 +851,7 @@ static int input_action_end_dt4(struct sk_buff *skb,
if (!decap_and_validate(skb, IPPROTO_IPIP))
goto drop;
- if (!pskb_may_pull(skb, sizeof(struct iphdr)))
- goto drop;
-
+ /* end_dt_vrf_core() validates the inner IPv4 header length */
skb = end_dt_vrf_core(skb, slwt, AF_INET);
if (!skb)
/* packet has been processed and consumed by the VRF */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0034/1059] gpio: omap: Propagate runtime PM failures in probe and request
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (32 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0033/1059] seg6: fix transport header for inner IPv4 with IP options Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0035/1059] btrfs: verity: propagate orphan insertion errors when enabling verity Greg Kroah-Hartman
` (964 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 05be1a99d6d68b24cbe24a191e1af67c70193ac3 ]
pm_runtime_get_sync() can fail when the OMAP PM domain cannot
resume a GPIO controller, but omap_gpio_probe() and
omap_gpio_request() ignore its return value.
Consequently, probe can register a GPIO controller despite a failed
resume, while a GPIO request can report success and modify GPIO
state even though runtime-PM acquisition failed.
Use pm_runtime_resume_and_get() in both paths and propagate
resume errors. On probe failure, disable runtime PM and unprepare
the debounce clock when applicable.
Reproduced both failures on QEMU N800 by injecting -EIO from the
OMAP PM-domain resume callback. The original driver continues
probe and accepts the GPIO request - while the patched driver
rejects both operations with -EIO. Normal GPIO controller
registration continues to work without fault injection.
Fixes: 77640aabd755 ("OMAP: GPIO: Implement GPIO as a platform device")
Fixes: 55b93c32520d ("gpio/omap: use pm-runtime framework")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261029103626.1527919-2-thnkslprpt@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-omap.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 7f19af08f91c6..80aa94700a476 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -777,8 +777,11 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank = gpiochip_get_data(chip);
unsigned long flags;
+ int ret;
- pm_runtime_get_sync(chip->parent);
+ ret = pm_runtime_resume_and_get(chip->parent);
+ if (ret < 0)
+ return ret;
raw_spin_lock_irqsave(&bank->lock, flags);
omap_enable_gpio_module(bank, offset);
@@ -1463,7 +1466,13 @@ static int omap_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, bank);
pm_runtime_enable(dev);
- pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0) {
+ pm_runtime_disable(dev);
+ if (bank->dbck_flag)
+ clk_unprepare(bank->dbck);
+ return ret;
+ }
if (bank->is_mpuio)
omap_mpuio_init(bank);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0035/1059] btrfs: verity: propagate orphan insertion errors when enabling verity
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (33 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0034/1059] gpio: omap: Propagate runtime PM failures in probe and request Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0036/1059] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing Greg Kroah-Hartman
` (963 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, guolingxing, Qu Wenruo, David Sterba,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: guolingxing <guolingxing@tju.edu.cn>
[ Upstream commit 45a686dff6b91c3667cd8188d3a02c69f62f4d00 ]
btrfs_begin_enable_verity() ignores the return value of
btrfs_orphan_add() and unconditionally returns 0. If orphan insertion
fails, btrfs_orphan_add() aborts the transaction, but the generic
fs-verity code still proceeds with Merkle tree construction because
the begin_enable_verity callback reported success.
Return the error so that fs-verity stops immediately instead of
continuing after the initialization failure.
The transaction is already aborted by btrfs_orphan_add() and the
handle is released by btrfs_end_transaction(), so no additional
cleanup is needed.
Fixes: 705242538ff3 ("btrfs: verity metadata orphan items")
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/verity.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index 264d92a9a535c..b2efb1693a04e 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -599,7 +599,7 @@ static int btrfs_begin_enable_verity(struct file *filp)
set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_end_transaction(trans);
- return 0;
+ return ret;
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0036/1059] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (34 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0035/1059] btrfs: verity: propagate orphan insertion errors when enabling verity Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0037/1059] btrfs: zoned: fix double free of bitmaps on clone failure Greg Kroah-Hartman
` (962 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit bda65e5115fe66ee0d8cf4ade11807f9fca4f0e1 ]
When scrub finishes, it does a wakeup on the fs_info->scrub_pause_wait
wait queue and then sets dev->scrub_sctx to NULL. On the other hand the
scrub cancel code (btrfs_scrub_cancel_dev()) waits on that wait queue
for dev->scrub_sctx to be NULL. So this means if btrfs_scrub_cancel_dev()
is called right when scrub is finishing and sees the wakeup before the
NULL is assigned to dev->scrub_sctx by btrfs_scrub_dev(), it hangs.
Fix this by doing the wakeup in btrfs_scrub_dev() after setting
dev->scrub_sctx to NULL.
Fixes: a2de733c78fa ("btrfs: scrub")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/scrub.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index d06b26e1dbea7..77569b363a3e7 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -4424,7 +4424,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0);
atomic_dec(&fs_info->scrubs_running);
- wake_up(&fs_info->scrub_pause_wait);
wait_event(sctx->list_wait, atomic_read(&sctx->workers_pending) == 0);
@@ -4439,6 +4438,13 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
dev->scrub_ctx = NULL;
mutex_unlock(&fs_info->scrub_lock);
+ /*
+ * We have set dev->scrub_ctx to NULL, now do the wakeup as a concurrent
+ * scrub cancel (btrfs_scrub_cancel_dev()) waits for dev->scrub_ctx to
+ * be set to NULL.
+ */
+ wake_up(&fs_info->scrub_pause_wait);
+
scrub_workers_put(fs_info);
scrub_put_ctx(sctx);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0037/1059] btrfs: zoned: fix double free of bitmaps on clone failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (35 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0036/1059] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0038/1059] ptp: drain virtual clock sysfs operations before unregistering children Greg Kroah-Hartman
` (961 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Johannes Thumshirn, Thomas Fourier,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <fourier.thomas@gmail.com>
[ Upstream commit 8c66a6aa59a5df1d672d72b7cd379d897ff73200 ]
btrfs_clone_dev_zone_info() duplicates the original orig_dev->zone_info
with kmemdup(), which also copies the seq_zones, empty_zones and
active_zones pointers. The clone then replaces them one by one with
fresh bitmaps. If one of the allocations fails, the error path frees all
three pointers, including those not yet replaced, which still point to
the bitmaps owned by the original device.
Clear the three pointers right after kmemdup() so the error path only frees
what this function allocated.
Fixes: 21e61ec6d0bb ("btrfs: zoned: clone zoned device info when cloning a device")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 2f9c6540b2655..d3f320e4dc7ce 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -652,6 +652,11 @@ struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *o
if (!zone_info)
return NULL;
+ /* Don't let the error path free the bitmaps still owned by @orig_dev. */
+ zone_info->seq_zones = NULL;
+ zone_info->empty_zones = NULL;
+ zone_info->active_zones = NULL;
+
zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
if (!zone_info->seq_zones)
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0038/1059] ptp: drain virtual clock sysfs operations before unregistering children
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (36 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0037/1059] btrfs: zoned: fix double free of bitmaps on clone failure Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0039/1059] ptp: unwind partially completed virtual clock creation Greg Kroah-Hartman
` (960 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vadim Fedorenko, James Hilliard,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 0e4a135aebc7686286d87e286499ce55e5bd5aad ]
Parent clock removal walks its virtual clocks before removing the
n_vclocks sysfs attribute. The mutex taken by ptp_vclock_in_use() is
released before that walk, so a concurrent sysfs deletion can pick the
same child and unregister and free its ptp_vclock a second time. A
reference held by the device iterator does not protect that separately
allocated virtual clock.
Remove n_vclocks before walking the children. Removing the attribute
prevents new stores and drains stores already running, without holding
n_vclocks_mux across a callback that needs that mutex. Skip virtual
clocks, which do not have this attribute.
This race was found by code inspection of virtual-clock registration
failure cleanup and parent removal.
Fixes: bfcbb76b0f59 ("ptp: unregister virtual clocks when unregistering physical clock.")
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-1-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_clock.c | 5 +++++
drivers/ptp/ptp_private.h | 1 +
drivers/ptp/ptp_sysfs.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 850ae55596850..f0b08061f395a 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -372,6 +372,11 @@ static int unregister_vclock(struct device *dev, void *data)
int ptp_clock_unregister(struct ptp_clock *ptp)
{
+ /*
+ * Stop and drain virtual-clock creation and deletion before walking the
+ * children. Do not hold n_vclocks_mux while waiting for sysfs callbacks.
+ */
+ ptp_vclock_remove_sysfs(ptp);
if (ptp_vclock_in_use(ptp)) {
device_for_each_child(&ptp->dev, NULL, unregister_vclock);
}
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index ef6b9ef145efa..7da867424b586 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -153,6 +153,7 @@ extern const struct attribute_group *ptp_groups[];
int ptp_populate_pin_groups(struct ptp_clock *ptp);
void ptp_cleanup_pin_groups(struct ptp_clock *ptp);
+void ptp_vclock_remove_sysfs(struct ptp_clock *ptp);
struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock);
void ptp_vclock_unregister(struct ptp_vclock *vclock);
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 4ff6afb15d913..df43f40482e4b 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -250,6 +250,12 @@ static ssize_t n_vclocks_store(struct device *dev,
}
static DEVICE_ATTR_RW(n_vclocks);
+void ptp_vclock_remove_sysfs(struct ptp_clock *ptp)
+{
+ if (!ptp->is_virtual_clock)
+ device_remove_file(&ptp->dev, &dev_attr_n_vclocks);
+}
+
static ssize_t max_vclocks_show(struct device *dev,
struct device_attribute *attr, char *page)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0039/1059] ptp: unwind partially completed virtual clock creation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (37 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0038/1059] ptp: drain virtual clock sysfs operations before unregistering children Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0040/1059] ptp: prevent possible ABBA deadlock in ptp_clock_freerun() Greg Kroah-Hartman
` (959 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 3dea778260e3dddf30651a6913d87a42861346a2 ]
n_vclocks_store() publishes the new clock count only after every child
has been registered. If a later registration fails, it returns without
unregistering the children already created by that request. Those clocks
are left out of n_vclocks, and a subsequent request can overwrite their
index entries without removing them.
Unregister the newly created children in reverse order and clear their
index entries on failure. Leave the previously installed clocks and
their count unchanged. The n_vclocks mutex serializes this rollback with
other sysfs changes, and parent removal drains the store before walking
the children.
This was found by code inspection while adding initial PHC sample error
handling to virtual clock registration.
Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-2-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index df43f40482e4b..f723fefa4eeea 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -212,7 +212,7 @@ static ssize_t n_vclocks_store(struct device *dev,
for (i = 0; i < num - ptp->n_vclocks; i++) {
vclock = ptp_vclock_register(ptp);
if (!vclock)
- goto out;
+ goto err_register;
*(ptp->vclock_index + ptp->n_vclocks + i) =
vclock->clock->index;
@@ -244,6 +244,12 @@ static ssize_t n_vclocks_store(struct device *dev,
mutex_unlock(&ptp->n_vclocks_mux);
return count;
+err_register:
+ num = i;
+ if (num)
+ device_for_each_child_reverse(dev, &num, unregister_vclock);
+ for (num = 0; num < i; num++)
+ ptp->vclock_index[ptp->n_vclocks + num] = -1;
out:
mutex_unlock(&ptp->n_vclocks_mux);
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0040/1059] ptp: prevent possible ABBA deadlock in ptp_clock_freerun()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (38 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0039/1059] ptp: unwind partially completed virtual clock creation Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0041/1059] ptp: vclock: propagate physical clock sampling errors Greg Kroah-Hartman
` (958 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+7cfb66a237c4a5fb22ad,
Jeongjun Park, Richard Cochran, Vladimir Oltean, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <aha310510@gmail.com>
[ Upstream commit 2efe41234dbd0a83fdb7cd38226c2f70039a2cd3 ]
syzbot reported the following ABBA deadlock:
CPU0 CPU1
---- ----
n_vclocks_store()
lock(&ptp->n_vclocks_mux) [1]
(physical clock)
pc_clock_adjtime()
lock(&clk->rwsem) [2]
(physical clock)
...
ptp_clock_freerun()
ptp_vclock_in_use()
lock(&ptp->n_vclocks_mux) [3]
(physical clock)
ptp_clock_unregister()
posix_clock_unregister()
lock(&clk->rwsem) [4]
(virtual clock)
Since ptp virtual clock is registered only under ptp physical clock, both
ptp_clock and posix_clock must be physical clocks for ptp_vclock_in_use()
to lock &ptp->n_vclocks_mux and check ptp->n_vclocks.
However, when unregistering vclocks in n_vclocks_store(), the locking
ptp->n_vclocks_mux is a physical clock lock, but clk->rwsem of
ptp_clock_unregister() called through device_for_each_child_reverse()
is a virtual clock lock.
Therefore, clk->rwsem used in CPU0 and clk->rwsem used in CPU1 are
different locks, but in lockdep, a false positive occurs because the
possibility of deadlock is determined through lock-class.
To solve this, lock subclass annotation must be added to the posix_clock
rwsem of the vclock.
Reported-by: syzbot+7cfb66a237c4a5fb22ad@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=7cfb66a237c4a5fb22ad
Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20250728062649.469882-1-aha310510@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: d1bdfdafd663 ("ptp: vclock: propagate physical clock sampling errors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_private.h | 5 +++++
drivers/ptp/ptp_vclock.c | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index 7da867424b586..5f3697c61e2b7 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -21,6 +21,11 @@
#define PTP_DEFAULT_MAX_VCLOCKS 20
#define PTP_MAX_VCLOCKS_LIMIT (KMALLOC_MAX_SIZE/(sizeof(int)))
+enum {
+ PTP_LOCK_PHYSICAL = 0,
+ PTP_LOCK_VIRTUAL,
+};
+
struct timestamp_event_queue {
struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
int head;
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index eb57338a32414..a88c424593732 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -156,6 +156,11 @@ static long ptp_vclock_refresh(struct ptp_clock_info *ptp)
return PTP_VCLOCK_REFRESH_INTERVAL;
}
+static void ptp_vclock_set_subclass(struct ptp_clock *ptp)
+{
+ lockdep_set_subclass(&ptp->clock.rwsem, PTP_LOCK_VIRTUAL);
+}
+
static const struct ptp_clock_info ptp_vclock_info = {
.owner = THIS_MODULE,
.name = "ptp virtual clock",
@@ -215,6 +220,8 @@ struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock)
return NULL;
}
+ ptp_vclock_set_subclass(vclock->clock);
+
timecounter_init(&vclock->tc, &vclock->cc, 0);
ptp_schedule_worker(vclock->clock, PTP_VCLOCK_REFRESH_INTERVAL);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0041/1059] ptp: vclock: propagate physical clock sampling errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (39 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0040/1059] ptp: prevent possible ABBA deadlock in ptp_clock_freerun() Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0042/1059] ptp: vclock: serialize extended samples with counter updates Greg Kroah-Hartman
` (957 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit d1bdfdafd663dd00b01d43eb3391f87718f2a09d ]
The cyclecounter read callback cannot report errors. ptp_vclock_read()
ignores the return from the physical clock and consumes its output even
if the read failed. A zero sample followed by the real counter can add
an extra 32-bit wrap to virtual time. This was found by code inspection
of reset-time PHC access and the virtual clock callers.
Sample the parent before calling timecounter_read() or timecounter_init()
and have the cyclecounter callback return the cached successful sample.
On failure, leave the counter and frequency adjustment unchanged and
return the PHC error to the caller.
Retry the first failed refresh after 10 ms instead of waiting another two
seconds. With the existing 32-bit nanosecond mask, timecounter_cyc2time()
can interpret a fresh timestamp as being in the past once the last
successful refresh is about 2.147 seconds old. An isolated read failure
should not deliberately defer the next attempt until that sample is four
seconds old.
Double the retry delay after consecutive failures, up to the normal
two-second refresh interval, and reset it after a successful refresh.
Each virtual clock has its own worker, and a failed parent read can involve
bus traffic and error logging. Backoff limits that repeated work during a
persistent failure while retaining a prompt first retry.
Limit each retry delay to the next regular refresh deadline. Otherwise,
backoff can skip the next two-second refresh opportunity and lose a full
counter wrap even when the parent has recovered before that refresh was
due. Advance the deadline when an attempt reaches it without resetting the
backoff, so sustained failures still settle at the normal refresh interval.
Keep the retry state private to each clock's auxiliary worker.
Take the initial sample and initialize the counter before publishing the
clock. Return an error pointer from registration and propagate its errno
through n_vclocks, including when the initial sample fails. Queue the first
refresh immediately after registration so registration latency is not
followed by another full refresh interval.
Keep the existing cyclecounter mask and scaling. These scheduling changes
do not guarantee timely samples: prolonged read failures or worker delays
can still exceed the half-wrap conversion window, and a gap of about
4.295 seconds between successful samples can lose a full counter wrap.
Do not assume that getcycles64() exposes a full-width nanosecond counter.
Fixes: 5d43f951b1ac ("ptp: add ptp virtual clock driver framework")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-3-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_private.h | 6 ++-
drivers/ptp/ptp_sysfs.c | 4 +-
drivers/ptp/ptp_vclock.c | 89 ++++++++++++++++++++++++++++++---------
3 files changed, 76 insertions(+), 23 deletions(-)
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index 5f3697c61e2b7..d69ab0106c9c3 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -72,7 +72,11 @@ struct ptp_vclock {
struct hlist_node vclock_hash_node;
struct cyclecounter cc;
struct timecounter tc;
- struct mutex lock; /* protects tc/cc */
+ u64 cycles;
+ struct mutex lock; /* protects tc/cc and the cached sample */
+ /* Owned by the auxiliary worker. */
+ unsigned long retry_delay;
+ unsigned long refresh_deadline;
};
/*
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index f723fefa4eeea..3306ebd60f9ef 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -211,8 +211,10 @@ static ssize_t n_vclocks_store(struct device *dev,
if (num > ptp->n_vclocks) {
for (i = 0; i < num - ptp->n_vclocks; i++) {
vclock = ptp_vclock_register(ptp);
- if (!vclock)
+ if (IS_ERR(vclock)) {
+ err = PTR_ERR(vclock);
goto err_register;
+ }
*(ptp->vclock_index + ptp->n_vclocks + i) =
vclock->clock->index;
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index a88c424593732..d112934351dc9 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -4,6 +4,7 @@
*
* Copyright 2021 NXP
*/
+#include <linux/jiffies.h>
#include <linux/slab.h>
#include <linux/hashtable.h>
#include "ptp_private.h"
@@ -13,6 +14,7 @@
#define PTP_VCLOCK_FADJ_SHIFT 9
#define PTP_VCLOCK_FADJ_DENOMINATOR 15625ULL
#define PTP_VCLOCK_REFRESH_INTERVAL (HZ * 2)
+#define PTP_VCLOCK_RETRY_INTERVAL msecs_to_jiffies(10)
/* protects vclock_hash addition/deletion */
static DEFINE_SPINLOCK(vclock_hash_lock);
@@ -42,21 +44,39 @@ static void ptp_vclock_hash_del(struct ptp_vclock *vclock)
synchronize_srcu(&vclock_srcu);
}
+/* The caller holds vclock->lock, or has not published the clock yet. */
+static int ptp_vclock_sample(struct ptp_vclock *vclock)
+{
+ struct ptp_clock *ptp = vclock->pclock;
+ struct timespec64 ts;
+ int err;
+
+ err = ptp->info->getcycles64(ptp->info, &ts);
+ if (!err)
+ vclock->cycles = timespec64_to_ns(&ts);
+
+ return err;
+}
+
static int ptp_vclock_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
s64 adj;
+ int err;
adj = (s64)scaled_ppm << PTP_VCLOCK_FADJ_SHIFT;
adj = div_s64(adj, PTP_VCLOCK_FADJ_DENOMINATOR);
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- timecounter_read(&vclock->tc);
- vclock->cc.mult = PTP_VCLOCK_CC_MULT + adj;
+ err = ptp_vclock_sample(vclock);
+ if (!err) {
+ timecounter_read(&vclock->tc);
+ vclock->cc.mult = PTP_VCLOCK_CC_MULT + adj;
+ }
mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_adjtime(struct ptp_clock_info *ptp, s64 delta)
@@ -75,15 +95,16 @@ static int ptp_vclock_gettime(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
- u64 ns;
+ int err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_read(&vclock->tc);
+ err = ptp_vclock_sample(vclock);
+ if (!err)
+ *ts = ns_to_timespec64(timecounter_read(&vclock->tc));
mutex_unlock(&vclock->lock);
- *ts = ns_to_timespec64(ns);
- return 0;
+ return err;
}
static int ptp_vclock_gettimex(struct ptp_clock_info *ptp,
@@ -115,13 +136,16 @@ static int ptp_vclock_settime(struct ptp_clock_info *ptp,
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
u64 ns = timespec64_to_ns(ts);
+ int err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- timecounter_init(&vclock->tc, &vclock->cc, ns);
+ err = ptp_vclock_sample(vclock);
+ if (!err)
+ timecounter_init(&vclock->tc, &vclock->cc, ns);
mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_getcrosststamp(struct ptp_clock_info *ptp,
@@ -151,8 +175,24 @@ static long ptp_vclock_refresh(struct ptp_clock_info *ptp)
struct ptp_vclock *vclock = info_to_vclock(ptp);
struct timespec64 ts;
- ptp_vclock_gettime(&vclock->info, &ts);
+ /* Retry transient failures promptly, but back off during long outages. */
+ if (ptp_vclock_gettime(&vclock->info, &ts)) {
+ unsigned long now = jiffies;
+
+ /* Retries must not postpone the next regular refresh attempt. */
+ if (!vclock->retry_delay || time_after_eq(now, vclock->refresh_deadline))
+ vclock->refresh_deadline = now + PTP_VCLOCK_REFRESH_INTERVAL;
+
+ if (!vclock->retry_delay)
+ vclock->retry_delay = PTP_VCLOCK_RETRY_INTERVAL;
+ else
+ vclock->retry_delay = min_t(unsigned long,
+ vclock->retry_delay * 2,
+ PTP_VCLOCK_REFRESH_INTERVAL);
+ return min(vclock->retry_delay, vclock->refresh_deadline - now);
+ }
+ vclock->retry_delay = 0;
return PTP_VCLOCK_REFRESH_INTERVAL;
}
@@ -174,12 +214,9 @@ static const struct ptp_clock_info ptp_vclock_info = {
static u64 ptp_vclock_read(const struct cyclecounter *cc)
{
struct ptp_vclock *vclock = cc_to_vclock(cc);
- struct ptp_clock *ptp = vclock->pclock;
- struct timespec64 ts = {};
-
- ptp->info->getcycles64(ptp->info, &ts);
- return timespec64_to_ns(&ts);
+ /* The cyclecounter callback cannot report a failed PHC read. */
+ return vclock->cycles;
}
static const struct cyclecounter ptp_vclock_cc = {
@@ -192,10 +229,11 @@ static const struct cyclecounter ptp_vclock_cc = {
struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock)
{
struct ptp_vclock *vclock;
+ int err;
vclock = kzalloc(sizeof(*vclock), GFP_KERNEL);
if (!vclock)
- return NULL;
+ return ERR_PTR(-ENOMEM);
vclock->pclock = pclock;
vclock->info = ptp_vclock_info;
@@ -214,20 +252,29 @@ struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock)
mutex_init(&vclock->lock);
+ err = ptp_vclock_sample(vclock);
+ if (err)
+ goto free_vclock;
+ timecounter_init(&vclock->tc, &vclock->cc, 0);
+
vclock->clock = ptp_clock_register(&vclock->info, &pclock->dev);
- if (IS_ERR_OR_NULL(vclock->clock)) {
- kfree(vclock);
- return NULL;
+ if (IS_ERR(vclock->clock)) {
+ err = PTR_ERR(vclock->clock);
+ goto free_vclock;
}
ptp_vclock_set_subclass(vclock->clock);
- timecounter_init(&vclock->tc, &vclock->cc, 0);
- ptp_schedule_worker(vclock->clock, PTP_VCLOCK_REFRESH_INTERVAL);
+ /* The initial sample predates registration; refresh without more delay. */
+ ptp_schedule_worker(vclock->clock, 0);
ptp_vclock_hash_add(vclock);
return vclock;
+
+free_vclock:
+ kfree(vclock);
+ return ERR_PTR(err);
}
void ptp_vclock_unregister(struct ptp_vclock *vclock)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0042/1059] ptp: vclock: serialize extended samples with counter updates
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (40 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0041/1059] ptp: vclock: propagate physical clock sampling errors Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0043/1059] scsi: target: Validate REGISTER AND MOVE TransportID length Greg Kroah-Hartman
` (956 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit d3fcce5afe3bb62e8f7a2efb29e43da4fe4ae1f3 ]
The extended and cross-timestamp callbacks sample the physical clock
before taking the virtual clock mutex. A concurrent frequency adjustment
can advance the timecounter and change its multiplier in between, so the
older sample is converted using a different frequency than the one in
effect when it was taken.
Take the mutex before sampling and keep it held through the conversion.
Retain timecounter_cyc2time() and its existing conversion window. A PHC
sample need not advance the counter: for example, e1000e explicitly
allows non-monotonic SYSTIM readings. Treating a slightly older sample
as a forward delta would instead advance virtual time by nearly a full
counter wrap.
This race was found by code inspection of the virtual clock sampling
paths.
Fixes: f0067ebfc42b ("ptp: add gettimex64() to virtual clocks.")
Fixes: 21fad63084c2 ("ptp: add getcrosststamp() to virtual clocks.")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-4-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_vclock.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index d112934351dc9..16c6eca5d2c16 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -115,20 +115,18 @@ static int ptp_vclock_gettimex(struct ptp_clock_info *ptp,
struct ptp_clock *pptp = vclock->pclock;
struct timespec64 pts;
int err;
- u64 ns;
-
- err = pptp->info->getcyclesx64(pptp->info, &pts, sts);
- if (err)
- return err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_cyc2time(&vclock->tc, timespec64_to_ns(&pts));
- mutex_unlock(&vclock->lock);
+ err = pptp->info->getcyclesx64(pptp->info, &pts, sts);
+ if (!err) {
+ u64 ns = timecounter_cyc2time(&vclock->tc, timespec64_to_ns(&pts));
- *ts = ns_to_timespec64(ns);
+ *ts = ns_to_timespec64(ns);
+ }
+ mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_settime(struct ptp_clock_info *ptp,
@@ -154,20 +152,18 @@ static int ptp_vclock_getcrosststamp(struct ptp_clock_info *ptp,
struct ptp_vclock *vclock = info_to_vclock(ptp);
struct ptp_clock *pptp = vclock->pclock;
int err;
- u64 ns;
-
- err = pptp->info->getcrosscycles(pptp->info, xtstamp);
- if (err)
- return err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_cyc2time(&vclock->tc, ktime_to_ns(xtstamp->device));
- mutex_unlock(&vclock->lock);
+ err = pptp->info->getcrosscycles(pptp->info, xtstamp);
+ if (!err) {
+ u64 ns = timecounter_cyc2time(&vclock->tc, ktime_to_ns(xtstamp->device));
- xtstamp->device = ns_to_ktime(ns);
+ xtstamp->device = ns_to_ktime(ns);
+ }
+ mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static long ptp_vclock_refresh(struct ptp_clock_info *ptp)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0043/1059] scsi: target: Validate REGISTER AND MOVE TransportID length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (41 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0042/1059] ptp: vclock: serialize extended samples with counter updates Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0044/1059] tipc: reject attaching bearer of different media to the same occupied device Greg Kroah-Hartman
` (955 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Martin K. Petersen (Oracle),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit 5d5913710c81eed6fa275b6a24773059d9dbfdfa ]
REGISTER AND MOVE has a 24-byte parameter-list header followed by a
TransportID. A 24-byte parameter list with a zero TransportID length
passes the existing tid_len + 24 check, then the handler reads buf[24] for
the TransportID protocol identifier, one byte past the received parameter
list.
A TransportID is at least 24 bytes. Reject shorter TransportIDs and
compare the declared length with the bytes following the header before
reading buf[24].
A malformed PR OUT sent through vhost-scsi triggered this read on a KASAN
kernel. The command is now rejected with INVALID PARAMETER LIST before
buf[24] is accessed.
Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Link: https://patch.msgid.link/20261021094334.198599-1-physicalmtea@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/target/target_core_pr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 742f5b11456fd..2a201841aa943 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -3219,10 +3219,11 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
transport_kunmap_data_sg(cmd);
buf = NULL;
- if ((tid_len + 24) != cmd->data_length) {
- pr_err("SPC-3 PR: Illegal tid_len: %u + 24 byte header"
- " does not equal CDB data_length: %u\n", tid_len,
- cmd->data_length);
+ /* TransportID is at least 24 bytes. buf[24] is its first byte. */
+ if (tid_len < 24 ||
+ tid_len != cmd->data_length - 24) {
+ pr_err("SPC-3 PR: Illegal tid_len: %u for data_length: %u\n",
+ tid_len, cmd->data_length);
ret = TCM_INVALID_PARAMETER_LIST;
goto out_put_pr_reg;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0044/1059] tipc: reject attaching bearer of different media to the same occupied device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (42 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0043/1059] scsi: target: Validate REGISTER AND MOVE TransportID length Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0045/1059] spi: pic32-sqi: fail transfer when the BD ring is exhausted Greg Kroah-Hartman
` (954 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiakai Xu, Tung Nguyen,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tung Nguyen <tung.quang.nguyen@est.tech>
[ Upstream commit 0a0257228be902ff09608bcaf19ae7c6d58b028f ]
Currently, two bearers of different media types can be added to the
same device (e.g., "eth:eth0" and "ib:eth0") via tipc command:
tipc bearer enable media eth dev eth0
tipc bearer enable media ib dev eth0
For each command execution, tipc_enable_l2_media() is called:
tipc_enable_l2_media()
dev_get_by_name()
dev_hold()
As a result, device->dev_refcnt is incremented twice, but the second
bearer replaces the first one. This causes a leak in device->dev_refcnt.
Fix this by rejecting a bearer with a different media type when the
device is already occupied.
Fixes: cb30a63384bc ("tipc: refactor function tipc_enable_bearer()")
Reported-by: Jiakai Xu <xujiakai24@mails.ucas.ac.cn>
Closes: http://lore.kernel.org/netdev/20260918013509.1853952-1-xujiakai24@mails.ucas.ac.cn/
Signed-off-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20261029030522.8306-1-tung.quang.nguyen@est.tech
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tipc/bearer.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index e0104f9690a3b..fc64261e7f871 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -287,17 +287,50 @@ static int tipc_enable_bearer(struct net *net, const char *name,
bearer_id = MAX_BEARERS;
i = MAX_BEARERS;
while (i-- != 0) {
+ struct net_device *dev;
+
b = rtnl_dereference(tn->bearer_list[i]);
if (!b) {
bearer_id = i;
continue;
}
if (!strcmp(name, b->name)) {
+duplicate:
errstr = "already enabled";
NL_SET_ERR_MSG(extack, "Already enabled");
goto rejected;
}
+ /* udp media can be used together with any media */
+ if (b->media->type_id == TIPC_MEDIA_TYPE_UDP ||
+ m->type_id == TIPC_MEDIA_TYPE_UDP)
+ goto priority;
+
+ dev = __dev_get_by_name(net, b_names.if_name);
+
+ if (!dev) {
+ res = -ENODEV;
+ errstr = "no device for the media";
+ NL_SET_ERR_MSG(extack, "No device for the media");
+ goto rejected;
+ }
+
+ if (rtnl_dereference(b->media_ptr) == dev) {
+ char *dev_name = strchr((const char *)b->name, ':') + 1;
+
+ /* Not allow altname of occupied device */
+ if (strcmp(dev_name, b_names.if_name) &&
+ b->media->type_id == m->type_id)
+ goto duplicate;
+
+ /* Not allow eth and ib to attach to the same device */
+ errstr = "same dev for different media";
+ NL_SET_ERR_MSG(extack,
+ "Same dev for different media");
+ goto rejected;
+ }
+
+priority:
if (b->priority == prio &&
(++with_this_prio > 2)) {
pr_warn("Bearer <%s>: already 2 bearers with priority %u\n",
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0045/1059] spi: pic32-sqi: fail transfer when the BD ring is exhausted
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (43 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0044/1059] tipc: reject attaching bearer of different media to the same occupied device Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0046/1059] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS Greg Kroah-Hartman
` (953 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hongjian Dai, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongjian Dai <daihongjian@kylinsec.com.cn>
[ Upstream commit 2066970324a1439e5a2e08c4599098367f8f82cc ]
pic32_sqi_one_transfer() silently stopped programming buffer descriptors
when ring_desc_get() returned NULL and still returned success. The caller
then marked the last programmed descriptor as the end of the list and
started the DMA engine, so the hardware transferred only a prefix of the
requested data while the message completed with status 0.
The ring holds PESQI_BD_COUNT (256) descriptors of at most
PESQI_BD_BUF_LEN_MAX (256) bytes each, so messages larger than 64 KiB (or
with enough SG entries) can exhaust it. Since the driver sets no
max_message_size/max_transfer_size, the SPI core does not prevent this.
Return -ENOMEM instead, and set msg->status so the failure reaches the
caller rather than being silently truncated.
Fixes: 3270ac230f66 ("spi: pic32-sqi: add SPI driver for PIC32 SQI controller.")
Signed-off-by: Hongjian Dai <daihongjian@kylinsec.com.cn>
Link: https://patch.msgid.link/F5276982A630220B+20261017075545.95854-1-daihongjian@kylinsec.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-pic32-sqi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c
index 5035b82d528c4..08b4c8bb200cc 100644
--- a/drivers/spi/spi-pic32-sqi.c
+++ b/drivers/spi/spi-pic32-sqi.c
@@ -297,7 +297,7 @@ static int pic32_sqi_one_transfer(struct pic32_sqi *sqi,
/* get ring descriptor */
rdesc = ring_desc_get(sqi);
if (!rdesc)
- break;
+ return -ENOMEM;
bd = rdesc->bd;
@@ -387,6 +387,7 @@ static int pic32_sqi_one_message(struct spi_master *master,
ret = pic32_sqi_one_transfer(sqi, msg, xfer);
if (ret) {
dev_err(&spi->dev, "xfer %p err\n", xfer);
+ msg->status = ret;
goto xfer_out;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0046/1059] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (44 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0045/1059] spi: pic32-sqi: fail transfer when the BD ring is exhausted Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0047/1059] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6 Greg Kroah-Hartman
` (952 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 6d8118937ba477e03fa2e94e9bd9abac7291a2a2 ]
When bpf_skb_adjust_room() shrinks a TCP GSO skb, it adds the number of
removed bytes to gso_size. gso_size has 16 bits, and nothing checks the
sum. Thus gso_size can wrap to 0 or to a small size, or it can be
GSO_BY_FRAGS. GSO_BY_FRAGS is not a size. It tells skb_segment() to read
the length of each segment from the frag_list. If the TCP GSO skb has no
frag_list, skb_segment() dereferences a NULL pointer.
Return -ENOTSUPP and do not change the skb if the sum is GSO_BY_FRAGS or
larger. With BPF_F_ADJ_ROOM_FIXED_GSO the helper does not change gso_size,
so it shrinks the skb as before.
Fixes: 2be7e212d541 ("bpf: add bpf_skb_adjust_room helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-16-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 4872f5c27cf5b..b3582a59e3dda 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3653,6 +3653,14 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff,
return -ENOTSUPP;
}
+ /*
+ * The MSS is raised by len_diff. It has 16 bits, and GSO_BY_FRAGS is
+ * not a size.
+ */
+ if (skb_is_gso(skb) && !(flags & BPF_F_ADJ_ROOM_FIXED_GSO) &&
+ skb_shinfo(skb)->gso_size + len_diff >= GSO_BY_FRAGS)
+ return -ENOTSUPP;
+
ret = skb_unclone(skb, GFP_ATOMIC);
if (unlikely(ret < 0))
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0047/1059] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (45 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0046/1059] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:52 ` [PATCH 6.1 0048/1059] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
` (951 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 58e39f8d58b141b96c030008a20dde9d625ec997 ]
The mode BPF_LWT_ENCAP_SEG6 of bpf_lwt_push_encap() pushes an IPv6 header
and an SRH, and it replaces the dst. The SRH says that IPv6 follows, and
skb->protocol does not change. Thus the mode assumes an IPv6 packet, but an
lwt_in prog also runs for IPv4 packets. After the prog, bpf_input() calls
orig_input() of the old dst. This IPv4 handler reads the pushed headers as
IPv4. It can write after the packet data, and the kernel crashes.
after the push orig_input() expects
--------------------- --------------------
skb->protocol ETH_P_IP ETH_P_IP
dst rt6_info rtable
packet | IPv6 | SRH | IPv4 | | IPv4 |
The mode BPF_LWT_ENCAP_SEG6_INLINE returns -EBADMSG for non-IPv6 packets.
Apply this check to both modes. End.BPF does not change, because
seg6_local_input() drops non-IPv6 packets.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-17-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index b3582a59e3dda..b480d4d17f47c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6381,11 +6381,15 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len
if (!seg6_validate_srh(srh, len, false))
return -EINVAL;
+ /*
+ * The encap mode names IPv6 as the inner protocol, and neither mode
+ * updates skb->protocol.
+ */
+ if (skb->protocol != htons(ETH_P_IPV6))
+ return -EBADMSG;
+
switch (type) {
case BPF_LWT_ENCAP_SEG6_INLINE:
- if (skb->protocol != htons(ETH_P_IPV6))
- return -EBADMSG;
-
err = seg6_do_srh_inline(skb, srh);
break;
case BPF_LWT_ENCAP_SEG6:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0048/1059] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (46 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0047/1059] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6 Greg Kroah-Hartman
@ 2026-12-04 9:52 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0049/1059] bpf: Dont look for the SRH again in the End.BPF helpers Greg Kroah-Hartman
` (950 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:52 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit ac159f39b252971141c49b68a27de0b637debfad ]
bpf_lwt_seg6_adjust_srh() lets an End.BPF prog change the size of the TLVs
in the SRH. The helper keeps the SRH length in srh_state->hdrlen, in bytes
and without the first 8 bytes. Later seg6_bpf_has_valid_srh() writes it to
srh->hdrlen, an 8-bit field in units of 8 bytes. But srh_state->hdrlen has
no upper limit, and the cast to u8 can truncate it. After that,
seg6_validate_srh() gets the SRH length from srh->hdrlen, and thus it can
accept the SRH. Then srh->hdrlen is too small, and a parser reads TLVs as
the subsequent header.
Return -EFAULT when the new srh_state->hdrlen is larger than 2040, the
largest length that srh->hdrlen can hold. To replace a TLV in the largest
SRH, a prog can no longer add bytes first. It must remove bytes first.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-19-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index b480d4d17f47c..ff0d53e1aa2d9 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6630,6 +6630,9 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
return -EFAULT;
if (unlikely(len < 0 && (void *)((char *)ptr - len) > srh_end))
return -EFAULT;
+ /* The length field of the SRH has 8 bits, in units of 8 bytes. */
+ if (unlikely(len > (U8_MAX << 3) - srh_state->hdrlen))
+ return -EFAULT;
if (len > 0) {
ret = skb_cow_head(skb, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0049/1059] bpf: Dont look for the SRH again in the End.BPF helpers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (47 preceding siblings ...)
2026-12-04 9:52 ` [PATCH 6.1 0048/1059] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0050/1059] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
` (949 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 45bcc58d576705d2c001332766e10313f1c55bad ]
A packet can have two SRHs. Thus input_action_end_bpf() uses
IP6_FH_F_SKIP_RH to skip routing headers with segments_left 0. The helpers
bpf_lwt_seg6_store_bytes() and bpf_lwt_seg6_adjust_srh() can reallocate the
head of the skb. Thus they look for the SRH again, but without this flag.
+------------------------+ <- the helpers: srh_state->srh
| SRH 1, segments_left 0 |
+------------------------+ <- input_action_end_bpf(): srh_state->srh
| SRH 2 | and srh_state->hdrlen
+------------------------+
Then the helpers check offset against the wrong limits. If a helper changes
TLVs, seg6_bpf_has_valid_srh() writes the length of SRH 2 to SRH 1.
Neither helper changes the offset of the SRH from skb->data. Calculate the
new address from this offset. To add IP6_FH_F_SKIP_RH is not sufficient,
because advance_nextseg() can set segments_left of SRH 2 to 0. The helper
bpf_lwt_seg6_action() can change the headers and still looks for the SRH.
Fixes: fbbc5bc2ab8c ("seg6: ignore routing header with segments left equal to 0")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-20-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index ff0d53e1aa2d9..c3b8561433a85 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6478,11 +6478,12 @@ BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset,
this_cpu_ptr(&seg6_bpf_srh_states);
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_tlvs, *srh_end, *ptr;
- int srhoff = 0;
+ int srhoff;
if (srh == NULL)
return -EINVAL;
+ srhoff = (unsigned char *)srh - skb->data;
srh_tlvs = (void *)((char *)srh + ((srh->first_segment + 1) << 4));
srh_end = (void *)((char *)srh + sizeof(*srh) + srh_state->hdrlen);
@@ -6495,8 +6496,7 @@ BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset,
if (unlikely(bpf_try_make_writable(skb, offset + len)))
return -EFAULT;
- if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, NULL) < 0)
- return -EINVAL;
+ /* The head may have moved. */
srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
memcpy(skb->data + offset, from, len);
@@ -6614,12 +6614,13 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_end, *srh_tlvs, *ptr;
struct ipv6hdr *hdr;
- int srhoff = 0;
+ int srhoff;
int ret;
if (unlikely(srh == NULL))
return -EINVAL;
+ srhoff = (unsigned char *)srh - skb->data;
srh_tlvs = (void *)((unsigned char *)srh + sizeof(*srh) +
((srh->first_segment + 1) << 4));
srh_end = (void *)((unsigned char *)srh + sizeof(*srh) +
@@ -6651,8 +6652,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
hdr = (struct ipv6hdr *)skb->data;
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
- if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, NULL) < 0)
- return -EINVAL;
+ /* The bytes in front of offset have moved together with skb->data. */
srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
srh_state->hdrlen += len;
srh_state->valid = false;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0050/1059] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (48 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0049/1059] bpf: Dont look for the SRH again in the End.BPF helpers Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0051/1059] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap() Greg Kroah-Hartman
` (948 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 0fcb3f11a93d740e7f9ae1aeb48fe4d25838be18 ]
bpf_skb_net_hdr_push() and bpf_skb_net_hdr_pop() change skb->data and
skb->mac_header by len. That is correct in a tc prog, where skb->data is
the MAC header. But bpf_lwt_seg6_adjust_srh() calls them in an End.BPF
prog, where skb->data is the network header. The MAC header does not move:
before push | free | MAC header | IPv6 | SRH | payload
^ head ^ mac_header ^ data
today | free | MAC h| IPv6 | SRH + len | payload
^ head ^ mac_header ^ data
this patch | free | MAC header | IPv6 | SRH + len | payload
^ head ^ mac_header ^ data
Users of skb_mac_header() get incorrect bytes until __dev_queue_xmit() sets
skb->mac_header again. skb_cow_head() reserves only len bytes. Thus the
16-bit offset skb->mac_header can wrap. A push also changes the "not set"
value. In both cases skb_mac_header() points after the skb.
Move the MAC header too. Pass len + skb->mac_len to skb_cow_head(). Keep
the "not set" value. The second Fixes tag is for this case. Since that
commit an End.BPF prog can get an skb with skb->mac_header not set.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Fixes: 20a081b7984c ("seg6: add VRF support for SRv6 End.DT6 behavior")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-21-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index c3b8561433a85..bbf96dfbcb95b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6611,6 +6611,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
{
struct seg6_bpf_srh_state *srh_state =
this_cpu_ptr(&seg6_bpf_srh_states);
+ bool mac_set = skb_mac_header_was_set(skb);
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_end, *srh_tlvs, *ptr;
struct ipv6hdr *hdr;
@@ -6635,20 +6636,38 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
if (unlikely(len > (U8_MAX << 3) - srh_state->hdrlen))
return -EFAULT;
+ /*
+ * skb->data is the network header here. The MAC header is in front of
+ * it, so bpf_skb_net_hdr_push() and bpf_skb_net_hdr_pop() do not move
+ * it with the other headers.
+ */
if (len > 0) {
- ret = skb_cow_head(skb, len);
+ ret = skb_cow_head(skb, len + skb->mac_len);
if (unlikely(ret < 0))
return ret;
+ /* The push can write over the MAC header, so move it first. */
+ if (mac_set)
+ memmove(skb->data - len - skb->mac_len,
+ skb_mac_header(skb), skb->mac_len);
ret = bpf_skb_net_hdr_push(skb, offset, len);
} else {
ret = bpf_skb_net_hdr_pop(skb, offset, -1 * len);
+ /* The pop has added -len to skb->mac_header. */
+ if (likely(!ret) && mac_set)
+ memmove(skb->data - skb->mac_len,
+ skb_mac_header(skb) + len, skb->mac_len);
}
bpf_compute_data_pointers(skb);
if (unlikely(ret < 0))
return ret;
+ if (mac_set)
+ skb_set_mac_header(skb, -skb->mac_len);
+ else
+ skb_unset_mac_header(skb);
+
hdr = (struct ipv6hdr *)skb->data;
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0051/1059] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (49 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0050/1059] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0052/1059] ipv4: Unmask upper DSCP bits in input route lookup Greg Kroah-Hartman
` (947 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 701ffd202b9e32942c8cfc065c9fe76ceaccc302 ]
With BPF_LWT_ENCAP_IP, bpf_lwt_push_encap() pushes a new IP header. The new
header overwrites the MAC header of a received skb. But skb->mac_header
continues to point to the same bytes. Code that reads the MAC header after
the push, for example netfilter, gets bytes of the new header.
before the push | MAC header | old IP | payload
^ mac_header ^ network_header
today | new header | old IP | payload
network_header ^ ^ mac_header
this patch, lwt_in | MAC header | new header | old IP | payload
^ mac_header ^ network_header
this patch, lwt_xmit | new header | old IP | payload
network_header ^ mac_header is not set
For lwt_in, move the MAC header in front of the new header before the
memcpy(), as __seg6_do_srh_encap() does. skb_cow_head() already reserves
len + skb->mac_len bytes.
For lwt_xmit, the output path makes a new MAC header. Thus mark
skb->mac_header as not set. This is the state of a locally generated skb.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-22-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 8c83b34ed58af..87a892c1a587b 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -640,6 +640,14 @@ int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len, bool ingress)
if (ingress)
skb_postpush_rcsum(skb, iph, len);
skb_reset_network_header(skb);
+ /*
+ * The new header goes over the MAC header. On ingress move it first.
+ * On egress the packet gets a new one, so forget the old one.
+ */
+ if (ingress)
+ skb_mac_header_rebuild(skb);
+ else
+ skb_unset_mac_header(skb);
if (is_udp_tunnel) {
size_t iph_sz = ipv4 ? iph->ihl * 4 : sizeof(struct ipv6hdr);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0052/1059] ipv4: Unmask upper DSCP bits in input route lookup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (50 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0051/1059] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0053/1059] ipv4: Convert ip_route_input_noref() to dscp_t Greg Kroah-Hartman
` (946 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ido Schimmel, Guillaume Nault,
Florian Westphal, David Ahern, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <idosch@nvidia.com>
[ Upstream commit df9131c7fafdc0d4c85686f5c7711a4dd4f3ae60 ]
Unmask the upper DSCP bits in input route lookup so that in the future
the lookup could be performed according to the full DSCP value.
No functional changes intended since the upper DSCP bits are masked when
comparing against the TOS selectors in FIB rules and routes.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20240821125251.1571445-9-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: b3ad42f61832 ("bpf: Reset skb->cb after an lwt prog pushes an IP header")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bd8ea5b8fa583..0ba1313651503 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2553,7 +2553,7 @@ int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
struct fib_result res;
int err;
- tos &= IPTOS_RT_MASK;
+ tos &= INET_DSCP_MASK;
rcu_read_lock();
err = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res);
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0053/1059] ipv4: Convert ip_route_input_noref() to dscp_t.
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (51 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0052/1059] ipv4: Unmask upper DSCP bits in input route lookup Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0054/1059] bpf: Reset skb->cb after an lwt prog pushes an IP header Greg Kroah-Hartman
` (945 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guillaume Nault, David Ahern,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <gnault@redhat.com>
[ Upstream commit 66fb6386d358a04edd5c640e38b4a02b323b89d8 ]
Pass a dscp_t variable to ip_route_input_noref(), instead of a plain
u8, to prevent accidental setting of ECN bits in ->flowi4_tos.
Callers of ip_route_input_noref() to consider are:
* arp_process() in net/ipv4/arp.c. This function sets the tos
parameter to 0, which is already a valid dscp_t value, so it
doesn't need to be adjusted for the new prototype.
* ip_route_input(), which already has a dscp_t variable to pass as
parameter. We just need to remove the inet_dscp_to_dsfield()
conversion.
* ipvlan_l3_rcv(), bpf_lwt_input_reroute(), ip_expire(),
ip_rcv_finish_core(), xfrm4_rcv_encap_finish() and
xfrm4_rcv_encap(), which get the DSCP directly from IPv4 headers
and can simply use the ip4h_dscp() helper.
While there, declare the IPv4 header pointers as const in
ipvlan_l3_rcv() and bpf_lwt_input_reroute().
Also, modify the declaration of ip_route_input_noref() in
include/net/route.h so that it matches the prototype of its
implementation in net/ipv4/route.c.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/a8a747bed452519c4d0cc06af32c7e7795d7b627.1727807926.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: b3ad42f61832 ("bpf: Reset skb->cb after an lwt prog pushes an IP header")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ipvlan/ipvlan_l3s.c | 6 ++++--
include/net/route.h | 7 +++----
net/core/lwt_bpf.c | 5 +++--
net/ipv4/ip_fragment.c | 4 ++--
net/ipv4/ip_input.c | 2 +-
net/ipv4/route.c | 6 +++---
net/ipv4/xfrm4_input.c | 2 +-
net/ipv4/xfrm4_protocol.c | 2 +-
8 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_l3s.c b/drivers/net/ipvlan/ipvlan_l3s.c
index ca35a50bb6405..7c017fe35522a 100644
--- a/drivers/net/ipvlan/ipvlan_l3s.c
+++ b/drivers/net/ipvlan/ipvlan_l3s.c
@@ -2,6 +2,8 @@
/* Copyright (c) 2014 Mahesh Bandewar <maheshb@google.com>
*/
+#include <net/ip.h>
+
#include "ipvlan.h"
static unsigned int ipvlan_netid __read_mostly;
@@ -48,11 +50,11 @@ static struct sk_buff *ipvlan_l3_rcv(struct net_device *dev,
switch (proto) {
case AF_INET:
{
- struct iphdr *ip4h = ip_hdr(skb);
+ const struct iphdr *ip4h = ip_hdr(skb);
int err;
err = ip_route_input_noref(skb, ip4h->daddr, ip4h->saddr,
- ip4h->tos, sdev);
+ ip4h_dscp(ip4h), sdev);
if (unlikely(err))
goto out;
break;
diff --git a/include/net/route.h b/include/net/route.h
index 4e2f8c3e1f98e..2f807010558a5 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -190,8 +190,8 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev,
struct in_device *in_dev, u32 *itag);
-int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin);
+int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
+ dscp_t dscp, struct net_device *dev);
int ip_route_use_hint(struct sk_buff *skb, __be32 dst, __be32 src,
u8 tos, struct net_device *devin,
const struct sk_buff *hint);
@@ -202,8 +202,7 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
int err;
rcu_read_lock();
- err = ip_route_input_noref(skb, dst, src, inet_dscp_to_dsfield(dscp),
- devin);
+ err = ip_route_input_noref(skb, dst, src, dscp, devin);
if (!err) {
skb_dst_force(skb);
if (!skb_dst(skb))
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 87a892c1a587b..ed5bafe584128 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -10,6 +10,7 @@
#include <linux/bpf.h>
#include <net/lwtunnel.h>
#include <net/gre.h>
+#include <net/ip.h>
#include <net/ip6_route.h>
#include <net/ipv6_stubs.h>
@@ -89,12 +90,12 @@ static int bpf_lwt_input_reroute(struct sk_buff *skb)
if (skb->protocol == htons(ETH_P_IP)) {
struct net_device *dev = skb_dst(skb)->dev;
- struct iphdr *iph = ip_hdr(skb);
+ const struct iphdr *iph = ip_hdr(skb);
dev_hold(dev);
skb_dst_drop(skb);
err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, dev);
+ ip4h_dscp(iph), dev);
dev_put(dev);
} else if (skb->protocol == htons(ETH_P_IPV6)) {
skb_dst_drop(skb);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index be83c4b74036b..e50740dfe0092 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -179,8 +179,8 @@ static void ip_expire(struct timer_list *t)
/* skb has no dst, perform route lookup again */
iph = ip_hdr(head);
- err = ip_route_input_noref(head, iph->daddr, iph->saddr,
- iph->tos, head->dev);
+ err = ip_route_input_noref(head, iph->daddr, iph->saddr, ip4h_dscp(iph),
+ head->dev);
if (err)
goto out;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index e7196ecffafc6..30b814663eae1 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -363,7 +363,7 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk,
*/
if (!skb_valid_dst(skb)) {
err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, dev);
+ ip4h_dscp(iph), dev);
if (unlikely(err))
goto drop_error;
} else {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0ba1313651503..dd3ab1b5fdfe4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2548,14 +2548,14 @@ static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
}
int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
- u8 tos, struct net_device *dev)
+ dscp_t dscp, struct net_device *dev)
{
struct fib_result res;
int err;
- tos &= INET_DSCP_MASK;
rcu_read_lock();
- err = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res);
+ err = ip_route_input_rcu(skb, daddr, saddr, inet_dscp_to_dsfield(dscp),
+ dev, &res);
rcu_read_unlock();
return err;
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index d05e8ff9c37bf..490d54a58d2f5 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -31,7 +31,7 @@ static inline int xfrm4_rcv_encap_finish(struct net *net, struct sock *sk,
const struct iphdr *iph = ip_hdr(skb);
if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, skb->dev))
+ ip4h_dscp(iph), skb->dev))
goto drop;
}
diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
index b146ce88c5d0c..4ee624d8e66fc 100644
--- a/net/ipv4/xfrm4_protocol.c
+++ b/net/ipv4/xfrm4_protocol.c
@@ -76,7 +76,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
const struct iphdr *iph = ip_hdr(skb);
if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, skb->dev))
+ ip4h_dscp(iph), skb->dev))
goto drop;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0054/1059] bpf: Reset skb->cb after an lwt prog pushes an IP header
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (52 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0053/1059] ipv4: Convert ip_route_input_noref() to dscp_t Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0055/1059] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol Greg Kroah-Hartman
` (944 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiang Mei, Daniel Borkmann,
Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit b3ad42f6183286ab376389a5d26edf7ee3bdba27 ]
IPCB(skb)->opt holds the offsets from the network header to the IPv4
options. But bpf_lwt_push_ip_encap() moves the network header and does not
change IPCB(skb). Then ip_forward_options() and __ip_options_echo() use the
old offsets on the pushed header. Thus the kernel corrupts the skb and the
stack. If the family changes, the kernel also reads IP6CB(skb) as
IPCB(skb), or the reverse. With CONFIG_IPV6_MIP6, it reads IPSKB_FORWARDED
as frag_max_size and adds a needless fragment header.
Reset skb->cb after the prog. bpf_lwt_push_ip_encap() cannot do it, because
bpf_prog_run_save_cb() can restore skb->cb. For IPv4 in IPv4, clear
IPCB(skb)->opt as ip_tunnel_xmit() does. If the family changes, clear the
cb of the new family but keep iif, because ip6_forward() gets the input
device from it. Behind a VRF, skb->skb_iif is the VRF device and cannot
replace iif. Do nothing for IPv6 in IPv6, as in seg6_do_srh_encap().
Do the reset in bpf_input() only after a push. Without a push,
ip_forward_options() needs the offsets. Do it in bpf_xmit() before each
reroute, because an lwt_xmit prog can also change the options. Thus after a
reroute without a push, ip_options_fragment() leaves the options in all
fragments, and ICMP errors echo none. After BPF_OK or BPF_REDIRECT the skb
goes to a device, thus bpf_xmit() does no reset. The inner IPv4 checksum
can still be wrong after ip_rcv_options() changes an option.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Reported-by: Xiang Mei <xmei5@asu.edu>
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-23-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index ed5bafe584128..fde1b4a2f4aac 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -84,6 +84,32 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
return ret;
}
+/*
+ * skb->cb still describes the IP header that was the first one before the
+ * prog ran. The option offsets in IPCB(skb)->opt are wrong for a pushed
+ * header, and a header of the other family needs the other layout. iif
+ * stays: behind a VRF skb->skb_iif is the L3 master and not the port.
+ * bpf_lwt_push_encap() cannot do this, because bpf_prog_run_save_cb() can
+ * restore skb->cb after the prog.
+ */
+static void bpf_lwt_reset_cb(struct sk_buff *skb, __be16 proto)
+{
+ int iif;
+
+ if (skb->protocol == proto) {
+ if (proto == htons(ETH_P_IP))
+ memset(&IPCB(skb)->opt, 0, sizeof(IPCB(skb)->opt));
+ } else if (skb->protocol == htons(ETH_P_IP)) {
+ iif = IP6CB(skb)->iif;
+ memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
+ IPCB(skb)->iif = iif;
+ } else {
+ iif = IPCB(skb)->iif;
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
+ IP6CB(skb)->iif = iif;
+ }
+}
+
static int bpf_lwt_input_reroute(struct sk_buff *skb)
{
int err = -EINVAL;
@@ -116,6 +142,8 @@ static int bpf_lwt_input_reroute(struct sk_buff *skb)
static int bpf_input(struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
+ __be16 proto = skb->protocol;
+ unsigned int len = skb->len;
struct bpf_lwt *bpf;
int ret;
@@ -124,6 +152,9 @@ static int bpf_input(struct sk_buff *skb)
ret = run_lwt_bpf(skb, &bpf->in, dst, NO_REDIRECT);
if (ret < 0)
return ret;
+ /* An lwt_in prog can change the length only with a push. */
+ if (skb->len != len)
+ bpf_lwt_reset_cb(skb, proto);
if (ret == BPF_LWT_REROUTE)
return bpf_lwt_input_reroute(skb);
}
@@ -303,6 +334,8 @@ static int bpf_xmit(struct sk_buff *skb)
case BPF_REDIRECT:
return LWTUNNEL_XMIT_DONE;
case BPF_LWT_REROUTE:
+ /* An lwt_xmit prog can also write to the options. */
+ bpf_lwt_reset_cb(skb, proto);
return bpf_lwt_xmit_reroute(skb);
default:
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0055/1059] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (53 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0054/1059] bpf: Reset skb->cb after an lwt prog pushes an IP header Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0056/1059] bpf: Move the transport header with the moved headers Greg Kroah-Hartman
` (943 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit d9618a6196953718f7470de5d2e84121bed063f7 ]
When an lwt_in prog returns BPF_OK, bpf_input() calls orig_input(), the
input handler of the route. This handler is for one IP version and needs a
dst of the same family. But BPF_LWT_ENCAP_IP lets the prog push a header of
the other IP version and thus change skb->protocol. Then the handler reads
and changes a header of the other IP version. The push of an SRH also
replaces the dst, because seg6_lookup_nexthop() puts an rt6_info into the
skb. Then ip_forward() uses the rt6_info as a struct rtable.
Drop the skb with -EINVAL when skb->protocol changes, as bpf_xmit() does.
Drop it also when the family of the dst changes, because skb->protocol does
not always show this change. Today no such skb leaves as the prog made it.
A prog works as before if it returns BPF_LWT_REROUTE, or if it pushes an
SRH on an IPv6 route.
The commit in the first Fixes tag lets a prog change skb->protocol. The
commit in the second tag adds the check to bpf_xmit() only.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Fixes: 3bd0b15281af ("bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-24-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index fde1b4a2f4aac..87fae6fdeeba8 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -157,6 +157,16 @@ static int bpf_input(struct sk_buff *skb)
bpf_lwt_reset_cb(skb, proto);
if (ret == BPF_LWT_REROUTE)
return bpf_lwt_input_reroute(skb);
+ /*
+ * orig_input() is for the old protocol only, see bpf_xmit().
+ * It also needs a dst of the old family. BPF_LWT_ENCAP_SEG6
+ * puts an IPv6 dst into the skb.
+ */
+ if (skb->protocol != proto ||
+ skb_dst(skb)->ops->family != dst->ops->family) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
}
if (unlikely(!dst->lwtstate->orig_input)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0056/1059] bpf: Move the transport header with the moved headers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (54 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0055/1059] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0057/1059] bpf: Check the offset in bpf_skb_generic_{push,pop}() Greg Kroah-Hartman
` (942 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit a9d08fe60fa728ce0e3a99085241e8e790fb14c6 ]
bpf_skb_net_hdr_pop() removes len bytes at offset off.
bpf_skb_net_hdr_push() does the opposite.
skb->data off
before | A | removed | B |
after | A | B |
skb->data off
mac_header and network_header move with A. transport_header moves only when
it is equal to network_header. inner_transport_header never moves. This is
correct only for a header in B. In bpf_lwt_seg6_adjust_srh()
transport_header is in A. bpf_skb_adjust_room() can remove both transport
headers. With an incorrect header offset, the stack can drop the skb or
read outside of it.
Also move transport_header with A when it is in A. Set it to offset off
when it is in the removed bytes. In BPF_ADJ_ROOM_MAC mode it is then equal
to network_header. Do not unset it, because skb_gso_validate_mac_len() uses
it without a check. After a removal, set inner_transport_header to off when
it is not in B and skb->encapsulation is set. A has only outer headers.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Fixes: 868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-26-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index bbf96dfbcb95b..5a7ec964f740b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3320,9 +3320,25 @@ static int bpf_skb_generic_pop(struct sk_buff *skb, u32 off, u32 len)
return 0;
}
+/*
+ * bpf_skb_net_hdr_push() inserts bytes at @off, bpf_skb_net_hdr_pop() removes
+ * bytes at @off. Both move the bytes in front of @off together with skb->data,
+ * and leave the rest of the packet where it is. Return true if the transport
+ * header is in the part that moves. A transport header that is equal to the
+ * network header stays equal to it.
+ */
+static bool bpf_skb_trans_hdr_moves(const struct sk_buff *skb, u32 off)
+{
+ if (skb->transport_header == skb->network_header)
+ return true;
+
+ return skb_transport_header_was_set(skb) &&
+ (u32)skb_transport_offset(skb) < off;
+}
+
static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
{
- bool trans_same = skb->transport_header == skb->network_header;
+ bool trans_moves = bpf_skb_trans_hdr_moves(skb, off);
int ret;
/* There's no need for __skb_push()/__skb_pull() pair to
@@ -3333,8 +3349,8 @@ static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
if (likely(!ret)) {
skb->mac_header -= len;
skb->network_header -= len;
- if (trans_same)
- skb->transport_header = skb->network_header;
+ if (trans_moves)
+ skb->transport_header -= len;
}
return ret;
@@ -3342,7 +3358,7 @@ static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
static int bpf_skb_net_hdr_pop(struct sk_buff *skb, u32 off, u32 len)
{
- bool trans_same = skb->transport_header == skb->network_header;
+ bool trans_moves = bpf_skb_trans_hdr_moves(skb, off);
int ret;
/* Same here, __skb_push()/__skb_pull() pair not needed. */
@@ -3350,8 +3366,17 @@ static int bpf_skb_net_hdr_pop(struct sk_buff *skb, u32 off, u32 len)
if (likely(!ret)) {
skb->mac_header += len;
skb->network_header += len;
- if (trans_same)
- skb->transport_header = skb->network_header;
+ if (trans_moves) {
+ skb->transport_header += len;
+ } else if (skb_transport_header_was_set(skb) &&
+ skb_transport_offset(skb) < (int)off) {
+ /* It was in the removed bytes or before skb->data. */
+ skb_set_transport_header(skb, off);
+ }
+ /* Do not leave the inner transport header in front of @off. */
+ if (skb->encapsulation &&
+ skb_inner_transport_offset(skb) < (int)off)
+ skb_set_inner_transport_header(skb, off);
}
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0057/1059] bpf: Check the offset in bpf_skb_generic_{push,pop}()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (55 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0056/1059] bpf: Move the transport header with the moved headers Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0058/1059] spi: Fix ACPI SPI resources using relative path Greg Kroah-Hartman
` (941 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit ee36c9aa44ef300cd651074bd97552b229337f85 ]
To make room for len bytes at offset off, bpf_skb_generic_push() moves the
first off bytes and clears len bytes after them. It assumes that the first
off bytes are in the linear part. But in bpf_skb_adjust_room() off can be
the end of the IP header, and this header can be in a frag. Then the
function reads and writes after skb->tail, and can damage skb_shared_info.
bpf_skb_generic_pop() checks off + len, but this u32 sum can wrap to a
small value. bpf_skb_adjust_room() and bpf_skb_change_proto() calculate off
from skb_mac_header_len(). This length is a very large u32 when
network_header < mac_header. Then the check can pass, and memmove() reads
and writes far outside the skb.
Return -ENOMEM from both functions, like the present check, when
off > skb->len. Thus the sum cannot wrap. In bpf_skb_generic_push() also
pull the first off bytes into the linear part. Now bpf_skb_adjust_room()
fails when a prog grows an skb that ends before off. network_header stays
wrong.
Fixes: 6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")
Fixes: 2be7e212d541 ("bpf: add bpf_skb_adjust_room helper")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-28-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 5a7ec964f740b..bdb60caa7b36b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3287,6 +3287,10 @@ static void bpf_skb_change_protocol(struct sk_buff *skb, u16 proto)
static int bpf_skb_generic_push(struct sk_buff *skb, u32 off, u32 len)
{
+ /* The bytes in front of @off are moved with skb->data. */
+ if (unlikely(off > skb->len || !pskb_may_pull(skb, off)))
+ return -ENOMEM;
+
/* Caller already did skb_cow() with meta_len+len as headroom,
* so no need to do it here.
*/
@@ -3307,9 +3311,10 @@ static int bpf_skb_generic_pop(struct sk_buff *skb, u32 off, u32 len)
void *old_data;
/* skb_ensure_writable() is not needed here, as we're
- * already working on an uncloned skb.
+ * already working on an uncloned skb. The first test
+ * keeps off + len from wrapping.
*/
- if (unlikely(!pskb_may_pull(skb, off + len)))
+ if (unlikely(off > skb->len || !pskb_may_pull(skb, off + len)))
return -ENOMEM;
old_data = skb->data;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0058/1059] spi: Fix ACPI SPI resources using relative path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (56 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0057/1059] bpf: Check the offset in bpf_skb_generic_{push,pop}() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0059/1059] spi: acpi: only look up the IRQ of confirmed SPI devices Greg Kroah-Hartman
` (940 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alban Bedel, Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alban Bedel <alban.bedel@lht.dlh.de>
[ Upstream commit 4825287f6d2346e9273f35a928d1ef40e68bc58b ]
ACPI resources can use relative path when pointing to other
resources. This didn't work with SPISerialBus resources because the
device defining the resource was not passed to acpi_get_handle().
Pass the ACPI device handle through the lookup context to also allow
for relative paths.
Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
Link: https://patch.msgid.link/20261001153507.2011806-1-alban.bedel@lht.dlh.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 2d0953ab69d3 ("spi: acpi: only look up the IRQ of confirmed SPI devices")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 9658d4100c40f..411d2aee9ecec 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2464,6 +2464,7 @@ EXPORT_SYMBOL_GPL(spi_new_ancillary_device);
#ifdef CONFIG_ACPI
struct acpi_spi_lookup {
struct spi_controller *ctlr;
+ acpi_handle device_handle;
u32 max_speed_hz;
u32 mode;
int irq;
@@ -2560,7 +2561,7 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
if (lookup->index != -1 && lookup->n++ != lookup->index)
return 1;
- status = acpi_get_handle(NULL,
+ status = acpi_get_handle(lookup->device_handle,
sb->resource_source.string_ptr,
&parent_handle);
@@ -2652,6 +2653,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
return ERR_PTR(-EINVAL);
lookup.ctlr = ctlr;
+ lookup.device_handle = acpi_device_handle(adev);
lookup.irq = -1;
lookup.index = index;
lookup.n = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0059/1059] spi: acpi: only look up the IRQ of confirmed SPI devices
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (57 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0058/1059] spi: Fix ACPI SPI resources using relative path Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0060/1059] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom Greg Kroah-Hartman
` (939 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rosen Penev, Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 2d0953ab69d316589624b0517fdce01f8e630bf0 ]
When an SPI controller is registered, acpi_register_spi_device() is
called for every present ACPI device in the namespace and
acpi_spi_device_alloc() walks each device's _CRS. While doing so,
acpi_spi_add_resource() converts the first interrupt resource it finds,
even for devices that have no SpiSerialBus resource at all and are
discarded right afterwards. Converting an interrupt resource registers
its GSI, so this maps IRQs for arbitrary unrelated ACPI devices.
On a Dell Precision M4800 (Lynx Point, 24-pin IOAPIC) the DSDT reports
Haswell-ULT LPSS child devices (\_SB.PCI0.I2C0.ACD0 and
\_SB.PCI0.SDHC.WI01) as present with interrupts on GSI 37 and 38.
Registering the intel-spi controller then results in:
ERROR: Unable to locate IOAPIC for GSI 37
ERROR: Unable to locate IOAPIC for GSI 38
Do what the I2C core does and only parse the interrupt resource once the
device has been identified as an SPI device on this controller.
Fixes: 4c3c59544f33 ("spi/acpi: enumerate all SPI slaves in the namespace")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261101200155.15740-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 411d2aee9ecec..4dedf4cdc78c0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2467,7 +2467,6 @@ struct acpi_spi_lookup {
acpi_handle device_handle;
u32 max_speed_hz;
u32 mode;
- int irq;
u8 bits_per_word;
u8 chip_select;
int n;
@@ -2612,17 +2611,25 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
if (sb->device_polarity == ACPI_SPI_ACTIVE_HIGH)
lookup->mode |= SPI_CS_HIGH;
}
- } else if (lookup->irq < 0) {
- struct resource r;
-
- if (acpi_dev_resource_interrupt(ares, 0, &r))
- lookup->irq = r.start;
}
/* Always tell the ACPI core to skip this resource */
return 1;
}
+static int acpi_spi_add_irq_resource(struct acpi_resource *ares, void *data)
+{
+ int *irq = data;
+ struct resource r;
+
+ if (*irq < 0 && ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS &&
+ acpi_dev_resource_interrupt(ares, 0, &r))
+ *irq = r.start;
+
+ /* Always tell the ACPI core to skip this resource */
+ return 1;
+}
+
/**
* acpi_spi_device_alloc - Allocate a spi device, and fill it in with ACPI information
* @ctlr: controller to which the spi device belongs
@@ -2647,6 +2654,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
struct list_head resource_list;
struct acpi_spi_lookup lookup = {};
struct spi_device *spi;
+ int irq = -1;
int ret;
if (!ctlr && index == -1)
@@ -2654,7 +2662,6 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
lookup.ctlr = ctlr;
lookup.device_handle = acpi_device_handle(adev);
- lookup.irq = -1;
lookup.index = index;
lookup.n = 0;
@@ -2677,6 +2684,19 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
if (!lookup.max_speed_hz)
return ERR_PTR(-ENODEV);
+ /*
+ * Only look up the IRQ once we know this is an SPI device for us.
+ * Parsing an interrupt resource maps its GSI, which must not be done
+ * for every unrelated ACPI device walked during enumeration.
+ */
+ INIT_LIST_HEAD(&resource_list);
+ ret = acpi_dev_get_resources(adev, &resource_list,
+ acpi_spi_add_irq_resource, &irq);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ acpi_dev_free_resource_list(&resource_list);
+
spi = spi_alloc_device(lookup.ctlr);
if (!spi) {
dev_err(&lookup.ctlr->dev, "failed to allocate SPI device for %s\n",
@@ -2687,7 +2707,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
ACPI_COMPANION_SET(&spi->dev, adev);
spi->max_speed_hz = lookup.max_speed_hz;
spi->mode |= lookup.mode;
- spi->irq = lookup.irq;
+ spi->irq = irq;
spi->bits_per_word = lookup.bits_per_word;
spi_set_chipselect(spi, 0, lookup.chip_select);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0060/1059] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (58 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0059/1059] spi: acpi: only look up the IRQ of confirmed SPI devices Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0061/1059] tcp: do not let tcp_collapse() drive sk_forward_alloc negative Greg Kroah-Hartman
` (938 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuqiang Sun, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuqiang Sun <izaiahsun@gmail.com>
[ Upstream commit 5e96760b25fdedbbf9312827f1f237d6b18b03e8 ]
When an LWT xmit program returns BPF_OK, bpf_xmit() makes sure that
the skb still has room for the link layer header. If
pskb_expand_head() fails there, bpf_xmit() returns -ENOMEM without
freeing the skb. Its callers, lwtunnel_xmit() and then
ip_finish_output2() or ip6_finish_output2(), take any return value
other than LWTUNNEL_XMIT_CONTINUE to mean that the skb has been
consumed, so nothing frees it.
Each such failure leaks the skb, together with what it holds: its dst
and its charge to the sending socket, so the socket is never freed
either. The other error paths of bpf_xmit() (BPF_DROP, an illegal
return code, a changed protocol, a failed reroute) all free the skb.
Free it here too.
The leak was found with kbound, a static analysis prototype for
ownership mismatches at kernel interfaces, on v7.2.12; it is present in
mainline.
Build-tested with x86_64 and arm64 allmodconfig (W=1, sparse): no new
warnings. Run-tested on QEMU (x86_64, KVM) with KASAN: a route through a
dummy device with an LWT xmit program that pushes one byte with
bpf_skb_change_head(), so the headroom check has to expand the head, and
failslab limited to allocations under bpf_xmit(). Each of 10 pings then
fails with ENOMEM. Without this patch each leaves a raw socket behind
(RAW slab objects 6 -> 16); with it none does (6 -> 6), and nothing else
is reported. Without injection both kernels go from 6 to 6.
Fixes: 3a0af8fd61f9 ("bpf: BPF for lightweight tunnel infrastructure")
Signed-off-by: Yuqiang Sun <izaiahsun@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101182343.17991-1-izaiahsun@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 87fae6fdeeba8..14d76b527e134 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -337,8 +337,10 @@ static int bpf_xmit(struct sk_buff *skb)
* made before LWT xmit.
*/
ret = xmit_check_headroom(skb, hroom);
- if (unlikely(ret))
+ if (unlikely(ret)) {
+ kfree_skb(skb);
return ret;
+ }
return LWTUNNEL_XMIT_CONTINUE;
case BPF_REDIRECT:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0061/1059] tcp: do not let tcp_collapse() drive sk_forward_alloc negative
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (59 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0060/1059] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0062/1059] net: stmmac: Set dma_sync_size to zero for discarded frames Greg Kroah-Hartman
` (937 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kuniyuki Iwashima,
Octavian Purdila, Dave Miller, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 031c403d13e5046750e2abebd4e770631e7c4627 ]
tcp_collapse() charges each newly allocated skb with skb_set_owner_r()
before the skbs it replaces are freed, without scheduling memory first.
Since sk_mem_uncharge() reclaims eagerly, sk->sk_forward_alloc has no
cushion and can become negative. This can be durable when the collapsed
skbs had a high payload/truesize ratio or were partially read, because
the new skbs can have a bigger total truesize than the old ones.
A negative sk_forward_alloc then confuses tcp_wmem_schedule(), which
can return a negative length to tcp_sendmsg_locked(), triggering
a WARN_ON_ONCE(bytes > INT_MAX) in check_copy_size().
Call sk_forced_mem_schedule() before charging nskb.
Fixes: 4890b686f408 ("net: keep sk->sk_forward_alloc as small as possible")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Octavian Purdila <tavip@google.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 125deb05e76ef..cdd918198d0e6 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5377,6 +5377,10 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, struct rb_root *root,
__skb_queue_before(list, skb, nskb);
else
__skb_queue_tail(&tmp, nskb); /* defer rbtree insertion */
+ /* nskb is charged before the skbs it replaces are freed.
+ * Make sure sk->sk_forward_alloc can not become negative.
+ */
+ sk_forced_mem_schedule(sk, nskb->truesize);
skb_set_owner_r(nskb, sk);
mptcp_skb_ext_move(nskb, skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0062/1059] net: stmmac: Set dma_sync_size to zero for discarded frames
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (60 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0061/1059] tcp: do not let tcp_collapse() drive sk_forward_alloc negative Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0063/1059] net: stmmac: drop split frames on AF_XDP zero-copy RX Greg Kroah-Hartman
` (936 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Furong Xu, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Furong Xu <0x1207@gmail.com>
[ Upstream commit 51cfbed198ca4aa140babde816387db0e71f09e7 ]
If a frame is going to be discarded by driver, this frame is never touched
by driver and the cache lines never become dirty obviously,
page_pool_recycle_direct() wastes CPU cycles on unnecessary calling of
page_pool_dma_sync_for_device() to sync entire frame.
page_pool_put_page() with sync_size setting to 0 is the proper method.
Signed-off-by: Furong Xu <0x1207@gmail.com>
Link: https://patch.msgid.link/20250103093733.3872939-1-0x1207@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 834ec9530832 ("net: stmmac: drop split frames on AF_XDP zero-copy RX")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index acb0ec94c70ae..11f9a8b3ab8bf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5375,7 +5375,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
status);
}
if (unlikely(status == discard_frame)) {
- page_pool_recycle_direct(rx_q->page_pool, buf->page);
+ page_pool_put_page(rx_q->page_pool, buf->page, 0, true);
buf->page = NULL;
error = 1;
if (!priv->hwts_rx_en)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0063/1059] net: stmmac: drop split frames on AF_XDP zero-copy RX
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (61 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0062/1059] net: stmmac: Set dma_sync_size to zero for discarded frames Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0064/1059] net: stmmac: copy XDP metadata in " Greg Kroah-Hartman
` (935 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Lorenzo Bianconi,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 834ec95308320cbd8c162d86788ab95cc3fd6bf8 ]
stmmac_rx_zc() assumes a 1:1 mapping between a received frame and an
XSK pool buffer and drops any frame that spans more than one RX
descriptor:
/* XSK pool expects RX frame 1:1 mapped to XSK buffer */
if (likely(status & rx_not_ls)) {
xsk_buff_free(buf->xdp);
buf->xdp = NULL;
dirty++;
count++;
goto read_again;
}
The non-last descriptors are freed and dropped, but the frame is not
marked as errored. When the poll reaches the last descriptor of the
same frame, error is still 0, so the fragment is handled as a complete
frame: it is passed to the XDP program, copied into an skb on XDP_PASS,
or converted for XDP_TX. The tail starts in the middle of the original
payload at a predictable offset and, parsed as a fresh frame (len == 0),
stmmac_rx_buf1_len() reports the full dma_buf_sz length for it even
though the DMA engine only wrote the tail remainder into that buffer, so
the reads extend past the received bytes and can reach beyond the end of
the XSK pool buffer. GMAC4 always enables jumbo frames (GMAC_CONFIG_JE
in GMAC_CORE_INIT), so an on-link peer can trigger such a split even
when the interface MTU is left at 1500.
Set error when the 1:1 mapping check drops a descriptor, so the
remaining descriptors of the frame - including the last one - are
drained and released with xsk_buff_free() instead of being processed as
a new frame. Account every freed buffer with dirty and count the
dropped frame once in the poll budget / rx_pkt_n. The direct 1:1
mapping drop also increments rx_dropped.
Use a bit test instead of an equality test for discard_frame.
Commit 644b8437ccef9e ("net: stmmac: dwmac4: report Rx checksum errors
in status") made dwmac4_wrback_get_rx_status() set discard_frame on
RDES3_ERROR_SUMMARY and OR in csum_none on RDES1_IP_HDR_ERROR or
RDES1_IP_PAYLOAD_ERROR, so it can return discard_frame | csum_none.
The old "status == discard_frame" test missed that value and delivered
frames with CRC, overflow, watchdog or giant errors to the stack in
stmmac_rx() - or to XDP/XSK in stmmac_rx_zc() - when they also failed
the IP checksum. The change therefore affects the regular RX path, not
only zero-copy. The bit test is also required for the
discard_frame | rx_not_ls value returned for non-last legacy
descriptors below.
Normalize the legacy normal and enhanced descriptor callbacks to report
rx_not_ls together with discard_frame for non-last descriptors. This
allows both stmmac_rx_zc() and stmmac_rx() to drain split frames on
dwmac100 and dwmac1000 instead of reparsing the final fragment as a new
packet.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Fixes: 644b8437ccef9e ("net: stmmac: dwmac4: report Rx checksum errors in status")
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-2-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/enh_desc.c | 2 +-
.../net/ethernet/stmicro/stmmac/norm_desc.c | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++-------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 963579518405c..9833db1fed0c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -210,7 +210,7 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
x->rx_length++;
- return discard_frame;
+ return discard_frame | rx_not_ls;
}
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 68a7cfcb1d8f3..c08846da03eb7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -77,7 +77,7 @@ static int ndesc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
x->rx_length++;
- return discard_frame;
+ return discard_frame | rx_not_ls;
}
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 11f9a8b3ab8bf..97b4f04ded839 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5181,18 +5181,21 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
&rx_q->dma_erx[entry],
status);
}
- if (unlikely(status == discard_frame)) {
- xsk_buff_free(buf->xdp);
- buf->xdp = NULL;
- dirty++;
+
+ if (unlikely(!error && (status & discard_frame))) {
error = 1;
if (!priv->hwts_rx_en)
rx_errors++;
}
- if (unlikely(error && (status & rx_not_ls)))
- goto read_again;
if (unlikely(error)) {
+ xsk_buff_free(buf->xdp);
+ buf->xdp = NULL;
+ dirty++;
+
+ if (status & rx_not_ls)
+ goto read_again;
+
count++;
continue;
}
@@ -5201,8 +5204,9 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
if (likely(status & rx_not_ls)) {
xsk_buff_free(buf->xdp);
buf->xdp = NULL;
+ rx_dropped++;
+ error = 1;
dirty++;
- count++;
goto read_again;
}
@@ -5374,7 +5378,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
&rx_q->dma_erx[entry],
status);
}
- if (unlikely(status == discard_frame)) {
+
+ if (unlikely(status & discard_frame)) {
page_pool_put_page(rx_q->page_pool, buf->page, 0, true);
buf->page = NULL;
error = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0064/1059] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (62 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0063/1059] net: stmmac: drop split frames on AF_XDP zero-copy RX Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0065/1059] sfc: ptp: drop the stale frequency reset in efx_ptp_start() Greg Kroah-Hartman
` (934 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 41d78e9ac0984f0e9577e5312e62400b5a6760c8 ]
stmmac_construct_skb_zc() reserves headroom for the XDP metadata and
records the length reported by the XDP program, but only copies the
packet data starting at xdp->data. The bytes in
[xdp->data_meta, xdp->data) are never copied into the new skb, so the
skb advertises metadata that is not there: after eth_type_trans()
anchors mac_header, data_meta points at uninitialized headroom instead
of what the program wrote.
Copy the metadata together with the packet data starting at
xdp->data_meta, leaving skb->data at the start of the frame and the
metadata immediately before it, and record its length. This keeps
data_meta valid for the stack and TC BPF after eth_type_trans() anchors
mac_header.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-4-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 97b4f04ded839..a4eb6089dfbb1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4981,7 +4981,8 @@ static struct sk_buff *stmmac_construct_skb_zc(struct stmmac_channel *ch,
return NULL;
skb_reserve(skb, xdp->data - xdp->data_hard_start);
- memcpy(__skb_put(skb, datasize), xdp->data, datasize);
+ __skb_put(skb, datasize);
+ memcpy(skb->data - metasize, xdp->data_meta, datasize + metasize);
if (metasize)
skb_metadata_set(skb, metasize);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0065/1059] sfc: ptp: drop the stale frequency reset in efx_ptp_start()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (63 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0064/1059] net: stmmac: copy XDP metadata in " Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0066/1059] sfc: ptp: serialize host and MC synchronization transactions Greg Kroah-Hartman
` (933 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Austin, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit 21d4917cfc8b6837c44d8aa186941a6a16ec17a0 ]
FW does not touch the clock frequency state on MC_CMD_PTP_OP_DISABLE or
MC_CMD_PTP_OP_ENABLE, so the driver doesn't need to either. Doing so
just desyncs the driver's cached current_adjfreq from what FW still has
programmed.
Resetting current_adjfreq to 0 here means the first efx_phc_adjtime()
call after efx_ptp_start() reprograms the NIC's clock frequency to 0,
since efx_phc_adjtime() always sends current_adjfreq to FW alongside
the time step. efx_ptp_start() runs on every SIOCSHWTSTAMP mode change,
on ifup, and on the reset_required path in efx_ptp_worker(), so each of
those silently drops any frequency correction the PTP servo had already
applied.
efx_ptp_start() is also reached from reset recovery, but that is fine:
on an FLR or PCIe reset FW does not touch the NIC clock, and on a full
MC reboot the clock is reset to 1970, so a stale current_adjfreq from
before the reset is hardly consequential - especially as it is bound to
MAX_PPB, 1000000 ppb.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Link: https://patch.msgid.link/20261026123023.3566549-2-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 4eb6234292b1e..3af6ed5de2ad2 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1415,7 +1415,6 @@ static int efx_ptp_start(struct efx_nic *efx)
goto fail;
ptp->evt_frag_idx = 0;
- ptp->current_adjfreq = 0;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0066/1059] sfc: ptp: serialize host and MC synchronization transactions
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (64 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0065/1059] sfc: ptp: drop the stale frequency reset in efx_ptp_start() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0067/1059] sfc: ptp: avoid racing PPS timestamp updates Greg Kroah-Hartman
` (932 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alex Austin, Alejandro Lucero,
Pieter Jansen van Vuuren, Edward Cree, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit f707347b33feebdd67633bccea52f96807c18d6e ]
efx_ptp_synchronize() clears the MC-ready DMA flag before
efx_mcdi_rpc_start() acquires the MCDI interface, and processes results
into ptp->timeset[] after efx_mcdi_rpc_finish() has released it. The PPS
worker and the hwtstamp enable path can therefore clobber each other's
handshake flag and timesets.
Hold a PHC mutex across the whole transaction and over the clock
operations, so efx_phc_settime() reads and adjusts atomically and
current_adjfreq is consistently read and written under one lock. Also
bail out when efx_mcdi_rpc_start() fails rather than finishing an RPC
that was never acquired.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Reviewed-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/20261026123023.3566549-3-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 81 +++++++++++++++++++++++-----------
1 file changed, 55 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 3af6ed5de2ad2..3c257d4d16831 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -35,6 +35,7 @@
#include <linux/time.h>
#include <linux/ktime.h>
#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/pps_kernel.h>
#include <linux/ptp_clock_kernel.h>
#include "net_driver.h"
@@ -268,6 +269,8 @@ struct efx_ptp_timeset {
* frequency adjustment into a fixed point fractional nanosecond format.
* @current_adjfreq: Current ppb adjustment.
* @phc_clock: Pointer to registered phc device (if primary function)
+ * @phc_lock: Serializes PHC commands and synchronization, and protects
+ * @current_adjfreq
* @phc_clock_info: Registration structure for phc device
* @pps_work: pps work task for handling pps events
* @pps_workwq: pps work queue
@@ -331,6 +334,7 @@ struct efx_ptp_data {
unsigned int adjfreq_ppb_shift;
s64 current_adjfreq;
struct ptp_clock *phc_clock;
+ struct mutex phc_lock;
struct ptp_clock_info phc_clock_info;
struct work_struct pps_work;
struct workqueue_struct *pps_workwq;
@@ -1031,7 +1035,14 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
return 0;
}
-/* Synchronize times between the host and the MC */
+/* Synchronize times between the host and the MC.
+ *
+ * The MC serializes PTP requests, so MC_CMD_PTP_OP_ADJUST cannot be applied
+ * while MC_CMD_PTP_OP_SYNCHRONIZE is collecting timesets. This holds across
+ * functions of a controller, which share the clock but adjust it only through
+ * the function that registered it, so a secondary function can capture here
+ * without serializing against the primary.
+ */
static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
{
struct efx_ptp_data *ptp = efx->ptp_data;
@@ -1050,11 +1061,14 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
MCDI_SET_QWORD(synch_buf, PTP_IN_SYNCHRONIZE_START_ADDR,
ptp->start.dma_addr);
+ mutex_lock(&ptp->phc_lock);
+
/* Clear flag that signals MC ready */
WRITE_ONCE(*start, 0);
rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
- EFX_WARN_ON_ONCE_PARANOID(rc);
+ if (rc)
+ goto out;
/* Wait for start from MCDI (or timeout) */
timeout = jiffies + msecs_to_jiffies(MAX_SYNCHRONISE_WAIT_MS);
@@ -1085,11 +1099,13 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
++ptp->no_time_syncs;
}
+out:
/* Increment the bad syncs counter if the synchronize fails, whatever
* the reason.
*/
if (rc != 0)
++ptp->bad_syncs;
+ mutex_unlock(&ptp->phc_lock);
return rc;
}
@@ -1532,6 +1548,7 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
if (!efx->ptp_data)
return -ENOMEM;
+ mutex_init(&ptp->phc_lock);
ptp->efx = efx;
ptp->channel = channel;
ptp->rx_ts_inline = efx_nic_rev(efx) >= EFX_REV_HUNT_A0;
@@ -1606,6 +1623,7 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
efx_nic_free_buffer(efx, &ptp->start);
fail1:
+ mutex_destroy(&ptp->phc_lock);
kfree(efx->ptp_data);
efx->ptp_data = NULL;
@@ -1659,6 +1677,7 @@ void efx_ptp_remove(struct efx_nic *efx)
destroy_workqueue(efx->ptp_data->workwq);
efx_nic_free_buffer(efx, &efx->ptp_data->start);
+ mutex_destroy(&efx->ptp_data->phc_lock);
kfree(efx->ptp_data);
efx->ptp_data = NULL;
}
@@ -2163,23 +2182,23 @@ static int efx_phc_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
MCDI_SET_QWORD(inadj, PTP_IN_ADJUST_FREQ, adjustment_ns);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_SECONDS, 0);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_NANOSECONDS, 0);
+ mutex_lock(&ptp_data->phc_lock);
rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inadj, sizeof(inadj),
NULL, 0, NULL);
- if (rc != 0)
- return rc;
-
- ptp_data->current_adjfreq = adjustment_ns;
- return 0;
+ if (!rc)
+ ptp_data->current_adjfreq = adjustment_ns;
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
}
-static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
+static int _efx_phc_adjtime(struct efx_ptp_data *ptp_data, s64 delta)
+ __must_hold(&ptp_data->phc_lock)
{
- u32 nic_major, nic_minor;
- struct efx_ptp_data *ptp_data = container_of(ptp,
- struct efx_ptp_data,
- phc_clock_info);
- struct efx_nic *efx = ptp_data->efx;
MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ADJUST_LEN);
+ struct efx_nic *efx = ptp_data->efx;
+ u32 nic_major, nic_minor;
+
+ lockdep_assert_held(&ptp_data->phc_lock);
efx->ptp_data->ns_to_nic_time(delta, &nic_major, &nic_minor);
@@ -2192,6 +2211,18 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
NULL, 0, NULL);
}
+static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+ struct efx_ptp_data *ptp_data = container_of(ptp, struct efx_ptp_data,
+ phc_clock_info);
+ int rc;
+
+ mutex_lock(&ptp_data->phc_lock);
+ rc = _efx_phc_adjtime(ptp_data, delta);
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
+}
+
static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
struct efx_ptp_data *ptp_data = container_of(ptp,
@@ -2223,23 +2254,21 @@ static int efx_phc_settime(struct ptp_clock_info *ptp,
{
/* Get the current NIC time, efx_phc_gettime.
* Subtract from the desired time to get the offset
- * call efx_phc_adjtime with the offset
+ * call _efx_phc_adjtime with the offset
*/
+ struct efx_ptp_data *ptp_data = container_of(ptp, struct efx_ptp_data,
+ phc_clock_info);
+ struct timespec64 time_now, delta;
int rc;
- struct timespec64 time_now;
- struct timespec64 delta;
+ mutex_lock(&ptp_data->phc_lock);
rc = efx_phc_gettime(ptp, &time_now);
- if (rc != 0)
- return rc;
-
- delta = timespec64_sub(*e_ts, time_now);
-
- rc = efx_phc_adjtime(ptp, timespec64_to_ns(&delta));
- if (rc != 0)
- return rc;
-
- return 0;
+ if (!rc) {
+ delta = timespec64_sub(*e_ts, time_now);
+ rc = _efx_phc_adjtime(ptp_data, timespec64_to_ns(&delta));
+ }
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
}
static int efx_phc_enable(struct ptp_clock_info *ptp,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0067/1059] sfc: ptp: avoid racing PPS timestamp updates
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (65 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0066/1059] sfc: ptp: serialize host and MC synchronization transactions Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0068/1059] vhost-scsi: preserve event ordering Greg Kroah-Hartman
` (931 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alex Austin, Alejandro Lucero,
Pieter Jansen van Vuuren, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit 23d23e6c6517d0fea4f64340a23e33c89f82c03c ]
efx_ptp_pps_worker() can race with SIOCHWTSTAMP via
efx_ptp_change_mode(). After the worker completes synchronization, the
ioctl can start another synchronization and update host_time_pps while
the worker copies it into the PPS event. This can report a partially
updated timestamp. Serializing synchronization transactions alone does
not protect this copy, which happens after phc_lock is released.
Return the timestamp through the caller's own pps_event_time rather
than the shared field in efx_ptp_data, so the worker reads storage no
one else can write.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Reviewed-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Link: https://patch.msgid.link/20261026123023.3566549-4-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 3c257d4d16831..c9ded92df5d74 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -264,7 +264,6 @@ struct efx_ptp_timeset {
* @evt_frag_idx: Current fragment number
* @evt_code: Last event code
* @start: Address at which MC indicates ready for synchronisation
- * @host_time_pps: Host time at last PPS
* @adjfreq_ppb_shift: Shift required to convert scaled parts-per-billion
* frequency adjustment into a fixed point fractional nanosecond format.
* @current_adjfreq: Current ppb adjustment.
@@ -330,7 +329,6 @@ struct efx_ptp_data {
int evt_frag_idx;
int evt_code;
struct efx_buffer start;
- struct pps_event_time host_time_pps;
unsigned int adjfreq_ppb_shift;
s64 current_adjfreq;
struct ptp_clock *phc_clock;
@@ -935,7 +933,8 @@ static void efx_ptp_read_timeset(MCDI_DECLARE_STRUCT_PTR(data),
static int
efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
size_t response_length,
- const struct pps_event_time *last_time)
+ const struct pps_event_time *last_time,
+ struct pps_event_time *host_time_pps)
{
unsigned number_readings =
MCDI_VAR_ARRAY_LEN(response_length,
@@ -1013,6 +1012,10 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
"PTP bad synchronisation seconds\n");
return -EAGAIN;
}
+
+ if (!host_time_pps)
+ return 0;
+
delta.tv_sec = (last_sec - start_sec) & 1;
delta.tv_nsec =
last_time->ts_real.tv_nsec -
@@ -1029,8 +1032,8 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
delta.tv_nsec += ktime_to_timespec64(mc_time).tv_nsec;
/* Set PPS timestamp to match NIC top of second */
- ptp->host_time_pps = *last_time;
- pps_sub_ts(&ptp->host_time_pps, delta);
+ *host_time_pps = *last_time;
+ pps_sub_ts(host_time_pps, delta);
return 0;
}
@@ -1043,7 +1046,8 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
* the function that registered it, so a secondary function can capture here
* without serializing against the primary.
*/
-static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
+static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings,
+ struct pps_event_time *host_time_pps)
{
struct efx_ptp_data *ptp = efx->ptp_data;
MCDI_DECLARE_BUF(synch_buf, MC_CMD_PTP_OUT_SYNCHRONIZE_LENMAX);
@@ -1092,7 +1096,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
&response_length);
if (rc == 0) {
rc = efx_ptp_process_times(efx, synch_buf, response_length,
- &last_time);
+ &last_time, host_time_pps);
if (rc == 0)
++ptp->good_syncs;
else
@@ -1478,14 +1482,15 @@ static void efx_ptp_pps_worker(struct work_struct *work)
{
struct efx_ptp_data *ptp =
container_of(work, struct efx_ptp_data, pps_work);
+ struct pps_event_time host_time_pps = {};
struct efx_nic *efx = ptp->efx;
struct ptp_clock_event ptp_evt;
- if (efx_ptp_synchronize(efx, PTP_SYNC_ATTEMPTS))
+ if (efx_ptp_synchronize(efx, PTP_SYNC_ATTEMPTS, &host_time_pps))
return;
ptp_evt.type = PTP_CLOCK_PPSUSR;
- ptp_evt.pps_times = ptp->host_time_pps;
+ ptp_evt.pps_times = host_time_pps;
ptp_clock_event(ptp->phc_clock, &ptp_evt);
}
@@ -1847,7 +1852,8 @@ int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
rc = efx_ptp_start(efx);
if (rc == 0) {
rc = efx_ptp_synchronize(efx,
- PTP_SYNC_ATTEMPTS * 2);
+ PTP_SYNC_ATTEMPTS * 2,
+ NULL);
if (rc != 0)
efx_ptp_stop(efx);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0068/1059] vhost-scsi: preserve event ordering
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (66 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0067/1059] sfc: ptp: avoid racing PPS timestamp updates Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0069/1059] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit() Greg Kroah-Hartman
` (930 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Mike Christie,
Michael S. Tsirkin, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit a9a428115b7d8aa45e12e41899f90f60551bfa82 ]
vhost_scsi_send_evt() uses llist_add(), so pending events are LIFO.
vhost_scsi_complete_events() walks the detached list directly.
This can deliver a later hotplug or hotunplug event before an earlier
one.
Reverse the detached list before processing it.
This keeps delivery in enqueue order.
Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260915094244.7900-2-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index ade822a8c1a3d..8d33e694d318e 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -522,7 +522,7 @@ static void vhost_scsi_evt_work(struct vhost_work *work)
struct llist_node *llnode;
mutex_lock(&vq->mutex);
- llnode = llist_del_all(&vs->vs_event_list);
+ llnode = llist_reverse_order(llist_del_all(&vs->vs_event_list));
llist_for_each_entry_safe(evt, t, llnode, list) {
vhost_scsi_do_evt_work(vs, evt);
vhost_scsi_free_evt(vs, evt);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0069/1059] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (67 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0068/1059] vhost-scsi: preserve event ordering Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0070/1059] vhost: reject invalid IOTLB update permissions Greg Kroah-Hartman
` (929 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, co+6dcbccedc9ec6452, Xiang Mei,
Michael S. Tsirkin, Paul Moses, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <xmei5@asu.edu>
[ Upstream commit 1f8824fe7f6eaaf2355404db08d3cd05a28aa576 ]
genlmsg_reply() consumes the reply skb on every outcome: netlink_unicast()
frees it whether it queues it, drops it, or bails out early.
vdpa_nl_cmd_dev_config_get_doit() lets its return value fall through to the
shared error label, which calls nlmsg_free(msg) again and double-frees the
sk_buff on any reply failure. The failure is reachable unprivileged:
VDPA_CMD_DEV_CONFIG_GET carries no GENL_ADMIN_PERM, so batching several
requests into one sendto() on a socket with a shrunken SO_RCVBUF fills the
receive queue, and netlink_attachskb() then takes its MSG_DONTWAIT path,
freeing the skb and returning -EAGAIN.
Set msg to NULL once genlmsg_reply() has consumed it so the shared exit
path frees the skb only on the early error gotos that still own it;
nlmsg_free(NULL) is a no-op.
BUG: KASAN: slab-use-after-free in sk_skb_reason_drop (net/core/skbuff.c:1220)
Read of size 4 at addr ffff88800d99d49c by task exploit/147
Call Trace:
sk_skb_reason_drop (net/core/skbuff.c:1220)
vdpa_nl_cmd_dev_config_get_doit (drivers/vdpa/vdpa.c:1324)
genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)
genl_rcv_msg (net/netlink/genetlink.c:1194)
netlink_rcv_skb (net/netlink/af_netlink.c:2556)
genl_rcv (net/netlink/genetlink.c:1218)
netlink_unicast (net/netlink/af_netlink.c:1345)
netlink_sendmsg (net/netlink/af_netlink.c:1900)
__sys_sendto (net/socket.c:2281)
__x64_sys_sendto (net/socket.c:2284)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The buggy address belongs to the object at ffff88800d99d3c0
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 220 bytes inside of
freed 232-byte region [ffff88800d99d3c0, ffff88800d99d4a8)
Fixes: ad69dd0bf26b ("vdpa: Introduce query of device config layout")
Reported-by: co+6dcbccedc9ec6452@bugs.sh
Closes: https://lore.kernel.org/all/ILTHcT8oe1HP47sY25JVxssvKmkCTjYlX9Hs%40bugs.sh/
Assisted-by: Claude:claude-opus-5
Signed-off-by: Xiang Mei <xmei5@asu.edu>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Paul Moses <p@1g4.org>
Message-ID: <20260912215401.126194-1-xmei5@asu.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vdpa/vdpa.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 908b3f98ecbee..ee1a6fdcb30c2 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1062,15 +1062,16 @@ static int vdpa_nl_cmd_dev_config_get_doit(struct sk_buff *skb, struct genl_info
}
err = vdpa_dev_config_fill(vdev, msg, info->snd_portid, info->snd_seq,
0, info->extack);
- if (!err)
+ if (!err) {
err = genlmsg_reply(msg, info);
+ msg = NULL;
+ }
mdev_err:
put_device(dev);
dev_err:
up_read(&vdpa_dev_lock);
- if (err)
- nlmsg_free(msg);
+ nlmsg_free(msg);
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0070/1059] vhost: reject invalid IOTLB update permissions
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (68 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0069/1059] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit() Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0071/1059] virtio_blk: Reset device on probe error paths after DRIVER_OK Greg Kroah-Hartman
` (928 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit b179f21d2d8a60ede29a00472bffdefb0284ef39 ]
vhost_chr_write_iter() validates the type and size of an IOTLB update, but
does not validate its permission field. An invalid permission can therefore
reach perm_to_iommu_flags() and trigger its warning in vhost_vdpa_map().
Reject IOTLB UPDATE messages whose permission field is empty or contains
bits outside VHOST_ACCESS_RW before dispatching them to a backend.
Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260913-fix-vhost_chr_write_iter-v1-1-76bf1f436cfe@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/vhost.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index d68f61cef67e2..3e0ed85898b90 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1208,7 +1208,8 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
goto done;
}
- if (msg.type == VHOST_IOTLB_UPDATE && msg.size == 0) {
+ if (msg.type == VHOST_IOTLB_UPDATE &&
+ (!msg.size || !msg.perm || (msg.perm & ~VHOST_ACCESS_RW))) {
ret = -EINVAL;
goto done;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0071/1059] virtio_blk: Reset device on probe error paths after DRIVER_OK
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (69 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0070/1059] vhost: reject invalid IOTLB update permissions Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0072/1059] regulator: qcom_spmi: Drop unnecessary of_find_property() call Greg Kroah-Hartman
` (927 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuho Choi, Stefan Hajnoczi,
Michael S. Tsirkin, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <oss.patchbox@gmail.com>
[ Upstream commit f4f6e9a9cb349003d333f0776de94f12ac95b8d2 ]
virtblk_probe() marks the device ready before revalidating zones and
adding the disk, and either of those can fail. The out_cleanup_disk path
they take goes on to delete the virtqueues, but nothing tells the device
to stop first, so it is still live when the rings are freed.
Reset the device at out_cleanup_disk, which is only reachable after
virtio_device_ready(). virtblk_remove() and virtblk_freeze_priv() both
reset before deleting the virtqueues for the same reason.
Fixes: dbb301f91fc8 ("virtio_blk: add error handling support for add_disk()")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260922211207.523999-1-oss.patchbox@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/virtio_blk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 4e43de5724108..8e20eb74c0594 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1157,6 +1157,7 @@ static int virtblk_probe(struct virtio_device *vdev)
return 0;
out_cleanup_disk:
+ virtio_reset_device(vdev);
put_disk(vblk->disk);
out_free_tags:
blk_mq_free_tag_set(&vblk->tag_set);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0072/1059] regulator: qcom_spmi: Drop unnecessary of_find_property() call
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (70 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0071/1059] virtio_blk: Reset device on probe error paths after DRIVER_OK Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0073/1059] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Greg Kroah-Hartman
` (926 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rob Herring (Arm), Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <robh@kernel.org>
[ Upstream commit 7540bd3398675e54cbd7324c47be8cd3c7a6d9c5 ]
There's no need to check for presence of "qcom,saw-reg" before parsing
it. If the property doesn't exist, parsing it will return NULL.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240828130056.3481050-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 053c50a70525 ("regulator: qcom_spmi: don't take a sleeping lock in the SAW IPI")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/regulator/qcom_spmi-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 3e312729741e7..873f5c1b829fa 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -2399,8 +2399,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
if (!match)
return -ENODEV;
- if (of_find_property(node, "qcom,saw-reg", &lenp)) {
- syscon = of_parse_phandle(node, "qcom,saw-reg", 0);
+ syscon = of_parse_phandle(node, "qcom,saw-reg", 0);
+ if (syscon) {
saw_regmap = syscon_node_to_regmap(syscon);
of_node_put(syscon);
if (IS_ERR(saw_regmap))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0073/1059] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (71 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0072/1059] regulator: qcom_spmi: Drop unnecessary of_find_property() call Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0074/1059] net: sparx5/lan969x: release the in-flight slot of a stale TX skb Greg Kroah-Hartman
` (925 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Konrad Dybcio,
Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[ Upstream commit 053c50a7052549aab0d310ad505947db3e211592 ]
The SAW voltage change runs on CPU 0 from an IPI, but it reaches the SAW
registers through the syscon regmap, which is protected by a spinlock_t.
That is a sleeping lock on PREEMPT_RT, and lockdep complains as soon as
VDD_APCC actually changes voltage:
BUG: Invalid wait context
...
regmap_lock_spinlock+0x18/0x30
regmap_read+0x3c/0x78
spmi_saw_set_vdd+0x50/0x1ac
__flush_smp_call_function_queue+0x1ac/0x334
Map the SAW with a regmap of our own that uses a raw spinlock, and fail
the probe when that cannot be done instead of carrying an error pointer
around as the SAW regmap.
Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20261019-fix-qcom-saw-v1-3-9c7ba3fc2493@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/regulator/Kconfig | 1 +
drivers/regulator/qcom_spmi-regulator.c | 35 +++++++++++++++++++------
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 070e4403c6c24..4aaae1ba4062e 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -998,6 +998,7 @@ config REGULATOR_QCOM_SMD_RPM
config REGULATOR_QCOM_SPMI
tristate "Qualcomm SPMI regulator driver"
depends on SPMI || COMPILE_TEST
+ select REGMAP_MMIO
help
If you say yes to this option, support will be included for the
regulators found in Qualcomm SPMI PMICs.
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 873f5c1b829fa..5c725c8706a52 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -12,13 +12,13 @@
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/ktime.h>
#include <linux/regulator/driver.h>
#include <linux/regmap.h>
#include <linux/list.h>
-#include <linux/mfd/syscon.h>
#include <linux/io.h>
/* Pin control enable input pins. */
@@ -1332,6 +1332,14 @@ static irqreturn_t spmi_regulator_vs_ocp_isr(int irq, void *data)
static struct regmap *saw_regmap;
+static const struct regmap_config saw_regmap_config = {
+ .name = "saw",
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .use_raw_spinlock = true,
+};
+
static void spmi_saw_set_vdd(void *data)
{
u32 vctl, data3, avs_ctl, pmic_sts;
@@ -2380,7 +2388,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
const char *name;
struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node;
- struct device_node *syscon, *reg_node;
+ struct device_node *saw, *reg_node;
+ void __iomem *saw_base;
struct property *reg_prop;
int ret, lenp;
struct list_head *vreg_list;
@@ -2399,12 +2408,22 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
if (!match)
return -ENODEV;
- syscon = of_parse_phandle(node, "qcom,saw-reg", 0);
- if (syscon) {
- saw_regmap = syscon_node_to_regmap(syscon);
- of_node_put(syscon);
- if (IS_ERR(saw_regmap))
- dev_err(dev, "ERROR reading SAW regmap\n");
+ saw = of_parse_phandle(node, "qcom,saw-reg", 0);
+ if (saw) {
+ saw_base = devm_of_iomap(dev, saw, 0, NULL);
+ of_node_put(saw);
+ if (IS_ERR(saw_base))
+ return dev_err_probe(dev, PTR_ERR(saw_base),
+ "failed to map the SAW\n");
+
+ saw_regmap = devm_regmap_init_mmio(dev, saw_base,
+ &saw_regmap_config);
+ if (IS_ERR(saw_regmap)) {
+ ret = PTR_ERR(saw_regmap);
+ saw_regmap = NULL;
+ return dev_err_probe(dev, ret,
+ "failed to set the SAW regmap up\n");
+ }
}
for (reg = match->data; reg->name; reg++) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0074/1059] net: sparx5/lan969x: release the in-flight slot of a stale TX skb
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (72 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0073/1059] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0075/1059] gpio: mpc8xxx: Convert to platform remove callback returning void Greg Kroah-Hartman
` (924 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Machon, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Machon <daniel.machon@microchip.com>
[ Upstream commit 873363ac591a1774aa3ced84f7ea3d93a3eb9b07 ]
sparx5_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in sparx5->ptp_skbs, and refuses new ones once
SPARX5_MAX_PTP_ID are in flight. sparx5_ptp_txtstamp_old_release()
frees the skbs that have waited longer than SPARX5_PTP_TIMEOUT.
Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once SPARX5_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.
Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.
This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.
Found by an AI code review agent. Reproduced on a lan9696 board with a
modified kernel that drops the TX timestamps of two step frames, after
which two step timestamping stopped working on the port. With the fix,
timestamping keeps working on that board and on a sparx5 PCB135 board.
Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029-sparx5-ptp-stale-tx-slot-v1-1-ec15f391bbb7@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
index 9c602f19d43b0..943ad6028449a 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
@@ -202,9 +202,10 @@ static void sparx5_ptp_classify(struct sparx5_port *port, struct sk_buff *skb,
*rew_op = IFH_REW_OP_TWO_STEP_PTP;
}
-static void sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
+static unsigned int sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
{
struct sk_buff *skb, *skb_tmp;
+ unsigned int purged = 0;
unsigned long flags;
spin_lock_irqsave(&port->tx_skbs.lock, flags);
@@ -215,8 +216,11 @@ static void sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
__skb_unlink(skb, &port->tx_skbs);
dev_kfree_skb_any(skb);
+ purged++;
}
spin_unlock_irqrestore(&port->tx_skbs.lock, flags);
+
+ return purged;
}
int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
@@ -224,6 +228,7 @@ int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
{
struct sparx5 *sparx5 = port->sparx5;
u8 rew_op, pdu_type, pdu_w16_offset;
+ unsigned int purged;
unsigned long flags;
sparx5_ptp_classify(port, skb, &rew_op, &pdu_type, &pdu_w16_offset);
@@ -234,9 +239,10 @@ int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
if (rew_op != IFH_REW_OP_TWO_STEP_PTP)
return 0;
- sparx5_ptp_txtstamp_old_release(port);
+ purged = sparx5_ptp_txtstamp_old_release(port);
spin_lock_irqsave(&sparx5->ptp_ts_id_lock, flags);
+ sparx5->ptp_skbs -= purged;
if (sparx5->ptp_skbs == SPARX5_MAX_PTP_ID) {
spin_unlock_irqrestore(&sparx5->ptp_ts_id_lock, flags);
return -EBUSY;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0075/1059] gpio: mpc8xxx: Convert to platform remove callback returning void
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (73 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0074/1059] net: sparx5/lan969x: release the in-flight slot of a stale TX skb Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0076/1059] gpio: mpc8xxx: Add wake on GPIO support Greg Kroah-Hartman
` (923 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Uwe Kleine-König, Linus Walleij,
Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[ Upstream commit 7a222f57d856c30433e5a526fc1bcc42fc8d92b1 ]
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Stable-dep-of: 9e4b35c95fed ("gpio: mpc8xxx: Fix potential use-after-free of IRQ domain")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mpc8xxx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 3eb08cd1fdc08..5a91044f86f2c 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -418,7 +418,7 @@ static int mpc8xxx_probe(struct platform_device *pdev)
return ret;
}
-static int mpc8xxx_remove(struct platform_device *pdev)
+static void mpc8xxx_remove(struct platform_device *pdev)
{
struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
@@ -426,8 +426,6 @@ static int mpc8xxx_remove(struct platform_device *pdev)
irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
irq_domain_remove(mpc8xxx_gc->irq);
}
-
- return 0;
}
#ifdef CONFIG_ACPI
@@ -440,7 +438,7 @@ MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
- .remove = mpc8xxx_remove,
+ .remove_new = mpc8xxx_remove,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0076/1059] gpio: mpc8xxx: Add wake on GPIO support
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (74 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0075/1059] gpio: mpc8xxx: Convert to platform remove callback returning void Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0077/1059] gpio: mpc8xxx: use a helper variable to store the address of pdev->dev Greg Kroah-Hartman
` (922 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Martyn Welch, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martyn Welch <martyn.welch@collabora.com>
[ Upstream commit e9482dc50ab2cb81b7735180345c48ada87205a5 ]
The mpc8xxx GPIO can generate an interrupt on state change. This
interrupt can be used to wake up the device from its sleep state if
enabled to do so. Add required support to the driver so that the GPIO
can be used in this way.
In order for the GPIO to actually function in this way, it is necessary
to also set the GPIO bit in the RCPM. This can be done via the device
tree fsl,rcpm-wakeup property.
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Link: https://lore.kernel.org/r/20240820143328.1987442-1-martyn.welch@collabora.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Stable-dep-of: 9e4b35c95fed ("gpio: mpc8xxx: Fix potential use-after-free of IRQ domain")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mpc8xxx.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 5a91044f86f2c..82641263d8067 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -412,6 +412,8 @@ static int mpc8xxx_probe(struct platform_device *pdev)
goto err;
}
+ device_init_wakeup(&pdev->dev, true);
+
return 0;
err:
irq_domain_remove(mpc8xxx_gc->irq);
@@ -428,6 +430,31 @@ static void mpc8xxx_remove(struct platform_device *pdev)
}
}
+#ifdef CONFIG_PM
+static int mpc8xxx_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev))
+ enable_irq_wake(mpc8xxx_gc->irqn);
+
+ return 0;
+}
+
+static int mpc8xxx_resume(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev))
+ disable_irq_wake(mpc8xxx_gc->irqn);
+
+ return 0;
+}
+#else
+#define mpc8xxx_suspend NULL
+#define mpc8xxx_resume NULL
+#endif
+
#ifdef CONFIG_ACPI
static const struct acpi_device_id gpio_acpi_ids[] = {
{"NXP0031",},
@@ -439,6 +466,8 @@ MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove_new = mpc8xxx_remove,
+ .suspend = mpc8xxx_suspend,
+ .resume = mpc8xxx_resume,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0077/1059] gpio: mpc8xxx: use a helper variable to store the address of pdev->dev
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (75 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0076/1059] gpio: mpc8xxx: Add wake on GPIO support Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0078/1059] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain Greg Kroah-Hartman
` (921 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
[ Upstream commit 2707a028c9b9c54a6dff22c9dcfebf3083ea095e ]
Instead of repeatedly dereferencing pdev, just store the address of the
embedded struct device in a local variable and use it instead for
improved readability.
While at it: rearrange variable declarations.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20241009162910.33477-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Stable-dep-of: 9e4b35c95fed ("gpio: mpc8xxx: Fix potential use-after-free of IRQ domain")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mpc8xxx.c | 48 +++++++++++++++++--------------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 82641263d8067..ae4815197184c 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -301,14 +301,15 @@ static const struct of_device_id mpc8xxx_gpio_ids[] = {
static int mpc8xxx_probe(struct platform_device *pdev)
{
+ const struct mpc8xxx_gpio_devtype *devtype = NULL;
struct device_node *np = pdev->dev.of_node;
struct mpc8xxx_gpio_chip *mpc8xxx_gc;
- struct gpio_chip *gc;
- const struct mpc8xxx_gpio_devtype *devtype = NULL;
+ struct device *dev = &pdev->dev;
struct fwnode_handle *fwnode;
+ struct gpio_chip *gc;
int ret;
- mpc8xxx_gc = devm_kzalloc(&pdev->dev, sizeof(*mpc8xxx_gc), GFP_KERNEL);
+ mpc8xxx_gc = devm_kzalloc(dev, sizeof(*mpc8xxx_gc), GFP_KERNEL);
if (!mpc8xxx_gc)
return -ENOMEM;
@@ -321,32 +322,28 @@ static int mpc8xxx_probe(struct platform_device *pdev)
return PTR_ERR(mpc8xxx_gc->regs);
gc = &mpc8xxx_gc->gc;
- gc->parent = &pdev->dev;
-
- if (device_property_read_bool(&pdev->dev, "little-endian")) {
- ret = bgpio_init(gc, &pdev->dev, 4,
- mpc8xxx_gc->regs + GPIO_DAT,
- NULL, NULL,
- mpc8xxx_gc->regs + GPIO_DIR, NULL,
- BGPIOF_BIG_ENDIAN);
+ gc->parent = dev;
+
+ if (device_property_read_bool(dev, "little-endian")) {
+ ret = bgpio_init(gc, dev, 4, mpc8xxx_gc->regs + GPIO_DAT,
+ NULL, NULL, mpc8xxx_gc->regs + GPIO_DIR,
+ NULL, BGPIOF_BIG_ENDIAN);
if (ret)
return ret;
- dev_dbg(&pdev->dev, "GPIO registers are LITTLE endian\n");
+ dev_dbg(dev, "GPIO registers are LITTLE endian\n");
} else {
- ret = bgpio_init(gc, &pdev->dev, 4,
- mpc8xxx_gc->regs + GPIO_DAT,
- NULL, NULL,
- mpc8xxx_gc->regs + GPIO_DIR, NULL,
- BGPIOF_BIG_ENDIAN
+ ret = bgpio_init(gc, dev, 4, mpc8xxx_gc->regs + GPIO_DAT,
+ NULL, NULL, mpc8xxx_gc->regs + GPIO_DIR,
+ NULL, BGPIOF_BIG_ENDIAN
| BGPIOF_BIG_ENDIAN_BYTE_ORDER);
if (ret)
return ret;
- dev_dbg(&pdev->dev, "GPIO registers are BIG endian\n");
+ dev_dbg(dev, "GPIO registers are BIG endian\n");
}
mpc8xxx_gc->direction_output = gc->direction_output;
- devtype = device_get_match_data(&pdev->dev);
+ devtype = device_get_match_data(dev);
if (!devtype)
devtype = &mpc8xxx_gpio_devtype_default;
@@ -371,16 +368,16 @@ static int mpc8xxx_probe(struct platform_device *pdev)
* associated input enable must be set (GPIOxGPIE[IEn]=1) to propagate
* the port value to the GPIO Data Register.
*/
- fwnode = dev_fwnode(&pdev->dev);
+ fwnode = dev_fwnode(dev);
if (of_device_is_compatible(np, "fsl,qoriq-gpio") ||
of_device_is_compatible(np, "fsl,ls1028a-gpio") ||
of_device_is_compatible(np, "fsl,ls1088a-gpio") ||
is_acpi_node(fwnode))
gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
- ret = devm_gpiochip_add_data(&pdev->dev, gc, mpc8xxx_gc);
+ ret = devm_gpiochip_add_data(dev, gc, mpc8xxx_gc);
if (ret) {
- dev_err(&pdev->dev,
+ dev_err(dev,
"GPIO chip registration failed with status %d\n", ret);
return ret;
}
@@ -401,18 +398,17 @@ static int mpc8xxx_probe(struct platform_device *pdev)
gc->write_reg(mpc8xxx_gc->regs + GPIO_IER, 0xffffffff);
gc->write_reg(mpc8xxx_gc->regs + GPIO_IMR, 0);
- ret = devm_request_irq(&pdev->dev, mpc8xxx_gc->irqn,
+ ret = devm_request_irq(dev, mpc8xxx_gc->irqn,
mpc8xxx_gpio_irq_cascade,
IRQF_NO_THREAD | IRQF_SHARED, "gpio-cascade",
mpc8xxx_gc);
if (ret) {
- dev_err(&pdev->dev,
- "failed to devm_request_irq(%d), ret = %d\n",
+ dev_err(dev, "failed to devm_request_irq(%d), ret = %d\n",
mpc8xxx_gc->irqn, ret);
goto err;
}
- device_init_wakeup(&pdev->dev, true);
+ device_init_wakeup(dev, true);
return 0;
err:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0078/1059] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (76 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0077/1059] gpio: mpc8xxx: use a helper variable to store the address of pdev->dev Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0079/1059] net/iucv: take a private, writable frame before rewriting it in place Greg Kroah-Hartman
` (920 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
[ Upstream commit 9e4b35c95fede87bad36f68b7ff1eae94ea6b910 ]
GPIO chip cleanup can call the to_irq callback while releasing requested
GPIOs. Removing the IRQ domain first leaves that callback using a freed
domain, both on removal and after an IRQ request failure.
Register domain cleanup before GPIO chip registration so devres removes
the chip before freeing the domain.
This issue was found by our static analysis tool under development.
Fixes: 257e10752c13 ("gpio: mpc8xxx: Use of_mm_gpiochip_remove")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
Link: https://patch.msgid.link/a4fec7fe970d6fc9135b488f57ba7e145b809359.1793377433.git.liguangshuo@mail.sdu.edu.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mpc8xxx.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ae4815197184c..494770b7fae20 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -299,6 +299,14 @@ static const struct of_device_id mpc8xxx_gpio_ids[] = {
{}
};
+static void mpc8xxx_irq_domain_remove(void *data)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = data;
+
+ if (mpc8xxx_gc->irq)
+ irq_domain_remove(mpc8xxx_gc->irq);
+}
+
static int mpc8xxx_probe(struct platform_device *pdev)
{
const struct mpc8xxx_gpio_devtype *devtype = NULL;
@@ -375,6 +383,11 @@ static int mpc8xxx_probe(struct platform_device *pdev)
is_acpi_node(fwnode))
gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
+ /* GPIO chip cleanup still needs the IRQ domain. */
+ ret = devm_add_action_or_reset(dev, mpc8xxx_irq_domain_remove, mpc8xxx_gc);
+ if (ret)
+ return ret;
+
ret = devm_gpiochip_add_data(dev, gc, mpc8xxx_gc);
if (ret) {
dev_err(dev,
@@ -405,25 +418,20 @@ static int mpc8xxx_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "failed to devm_request_irq(%d), ret = %d\n",
mpc8xxx_gc->irqn, ret);
- goto err;
+ return ret;
}
device_init_wakeup(dev, true);
return 0;
-err:
- irq_domain_remove(mpc8xxx_gc->irq);
- return ret;
}
static void mpc8xxx_remove(struct platform_device *pdev)
{
struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
- if (mpc8xxx_gc->irq) {
+ if (mpc8xxx_gc->irq)
irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
- irq_domain_remove(mpc8xxx_gc->irq);
- }
}
#ifdef CONFIG_PM
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0079/1059] net/iucv: take a private, writable frame before rewriting it in place
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (77 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0078/1059] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0080/1059] ASoC: meson: axg-fifo: request the irq with the clock enabled Greg Kroah-Hartman
` (919 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bryam Vargas, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryam Vargas <hexlabsecurity@proton.me>
[ Upstream commit f38bce9af9e2a3cced7d303a1476f21c1f42bcb7 ]
afiucv_hs_rcv() rewrites the frame in place -- EBCASC() on four name
fields, then afiucv_swap_src_dest() swaps them and pushes an Ethernet
header -- and can hand the same skb to dev_queue_xmit(), without making
it private first, so a packet socket that also gets the frame reads the
rewritten names. An ETH_P_ALL tap runs first and leaves af_iucv a
cloned skb; a socket opened for ETH_P_AF_IUCV sits on a ptype_specific
list, walked after ptype_base[], so deliver_skb() takes a reference and
af_iucv runs on an skb that is shared but not cloned.
Unshare, then cow, in that order: skb_cow() can reach
pskb_expand_head(), which has BUG_ON(skb_shared()). skb_cow() tests
skb_cloned(), which is what a rewrite of the data needs; skb_cow_head()
tests only the header. Asking for ETH_HLEN also covers the unchecked
push in afiucv_swap_src_dest(); on the ordinary path eth_type_trans()
has already pulled that much, so it only compares.
Fixes: 3881ac441f64 ("af_iucv: add HiperSockets transport")
Closes: https://sashiko.dev/#/patchset/20260813-b4-disp-60433a46-v1-1-509e1200533e@proton.me?part=1
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261028-b4-disp-1edbbc34-v3-1-13495411f5b9@proton.me
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/iucv/af_iucv.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index c56bf6d96ac01..ae459478c1eca 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -2073,11 +2073,20 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
int err = NET_RX_SUCCESS;
char nullstring[8];
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (!skb)
+ return NET_RX_SUCCESS;
+
if (!pskb_may_pull(skb, sizeof(*trans_hdr))) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
+ if (skb_cow(skb, ETH_HLEN)) {
+ kfree_skb(skb);
+ return NET_RX_SUCCESS;
+ }
+
trans_hdr = iucv_trans_hdr(skb);
EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName));
EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0080/1059] ASoC: meson: axg-fifo: request the irq with the clock enabled
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (78 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0079/1059] net/iucv: take a private, writable frame before rewriting it in place Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0081/1059] Bluetooth: hci_core: Initialize IRK before publication Greg Kroah-Hartman
` (918 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jerome Brunet, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <jbrunet@baylibre.com>
[ Upstream commit 82fa7bfab6b961a03d6575348334e0ec15fdc712 ]
The fifo irq handler accesses registers which need pclk, but the irq is
requested before pclk is enabled on open and freed after it is disabled
on close.
Request the irq after enabling pclk and masking the fifo irqs.
Free it before disabling pclk.
Fixes: 6dc4fa179fb8 ("ASoC: meson: add axg fifo base driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-30e88a8a-f33a-40f0-92aa-9ea62c5b7299
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patch.msgid.link/20261030-asoc-axg-fifo-irq-clock-v1-1-f8c170ac8b0d@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/meson/axg-fifo.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c
index 5218e40aeb1bb..4a81aa3f384f0 100644
--- a/sound/soc/meson/axg-fifo.c
+++ b/sound/soc/meson/axg-fifo.c
@@ -244,17 +244,10 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
if (ret)
return ret;
- /* Use the threaded irq handler only with non-atomic links */
- ret = request_threaded_irq(fifo->irq, NULL,
- axg_fifo_pcm_irq_block,
- IRQF_ONESHOT, dev_name(dev), ss);
- if (ret)
- return ret;
-
/* Enable pclk to access registers and clock the fifo ip */
ret = clk_prepare_enable(fifo->pclk);
if (ret)
- goto free_irq;
+ return ret;
/* Setup status2 so it reports the memory pointer */
regmap_update_bits(fifo->map, FIFO_CTRL1,
@@ -271,17 +264,24 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
/* Clear any pending interrupt */
axg_fifo_ack_irq(fifo, FIFO_INT_MASK);
+ /* Use the threaded irq handler only with non-atomic links */
+ ret = request_threaded_irq(fifo->irq, NULL,
+ axg_fifo_pcm_irq_block,
+ IRQF_ONESHOT, dev_name(dev), ss);
+ if (ret)
+ goto free_clk;
+
/* Take memory arbitror out of reset */
ret = reset_control_deassert(fifo->arb);
if (ret)
- goto free_clk;
+ goto free_irq;
return 0;
-free_clk:
- clk_disable_unprepare(fifo->pclk);
free_irq:
free_irq(fifo->irq, ss);
+free_clk:
+ clk_disable_unprepare(fifo->pclk);
return ret;
}
EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
@@ -295,12 +295,12 @@ int axg_fifo_pcm_close(struct snd_soc_component *component,
/* Put the memory arbitror back in reset */
ret = reset_control_assert(fifo->arb);
- /* Disable fifo ip and register access */
- clk_disable_unprepare(fifo->pclk);
-
/* remove IRQ */
free_irq(fifo->irq, ss);
+ /* Disable fifo ip and register access */
+ clk_disable_unprepare(fifo->pclk);
+
return ret;
}
EXPORT_SYMBOL_GPL(axg_fifo_pcm_close);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0081/1059] Bluetooth: hci_core: Initialize IRK before publication
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (79 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0080/1059] ASoC: meson: axg-fifo: request the irq with the clock enabled Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0082/1059] Bluetooth: hci_core: Initialize link key " Greg Kroah-Hartman
` (917 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit f0cf5a24cefeb629876bd15d668ff062c8655e28 ]
hci_add_irk() initializes the identity address and address type of a newly
allocated IRK, publishes it on hdev->identity_resolving_keys, and only then
initializes its value and RPA. RCU readers such as hci_find_irk_by_rpa()
and the debugfs identity_resolving_keys_show() can traverse the new entry
during that window and see a zero or partially initialized IRK.
The race is reachable by racing an IRK addition with another CPU resolving
or dumping IRKs. In particular, userspace can issue MGMT_OP_LOAD_IRKS
while another process reads the corresponding debugfs file or triggers RPA
resolution.
Initialize the IRK value and RPA before publishing a newly allocated IRK.
Existing IRKs remain published and continue to be updated in place.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: adae20cb2d20 ("Bluetooth: Convert IRK list to RCU")
Assisted-by: GLM-5.3 coccinelle
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 7ec3af3a4d0b4..da6c3520de262 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1347,9 +1347,10 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type, u8 val[16], bdaddr_t *rpa)
{
- struct smp_irk *irk;
+ struct smp_irk *irk, *old_irk;
- irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type);
+ old_irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type);
+ irk = old_irk;
if (!irk) {
irk = kzalloc(sizeof(*irk), GFP_KERNEL);
if (!irk)
@@ -1358,12 +1359,14 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
bacpy(&irk->bdaddr, bdaddr);
irk->addr_type = addr_type;
- list_add_rcu(&irk->list, &hdev->identity_resolving_keys);
}
memcpy(irk->val, val, 16);
bacpy(&irk->rpa, rpa);
+ if (!old_irk)
+ list_add_rcu(&irk->list, &hdev->identity_resolving_keys);
+
return irk;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0082/1059] Bluetooth: hci_core: Initialize link key before publication
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (80 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0081/1059] Bluetooth: hci_core: Initialize IRK before publication Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0083/1059] Bluetooth: hci_core: Initialize LTK " Greg Kroah-Hartman
` (916 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit ae9c8df1ffb84560ac01cbdc26cfb19027f4d25f ]
hci_add_link_key() allocates a new link key with kzalloc(), inserts it into
hdev->link_keys with list_add_rcu(), and only then initializes its address,
value, type, and PIN length. RCU readers such as hci_find_link_key()
and the debugfs link_keys_show() do not take hci_dev_lock, so they can
traverse the new entry during that initialization window and observe
a zero or partially initialized key.
This can be triggered by racing a link-key update with another CPU looking
up or dumping keys. In particular, userspace can issue
MGMT_OP_LOAD_LINK_KEYS while another process reads the corresponding
debugfs file.
Complete all fields of a newly allocated key before publishing it with
list_add_rcu(). Existing keys remain visible and keep their current
in-place update behavior.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: 0378b5977013 ("Bluetooth: Convert link keys list to use RCU")
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index da6c3520de262..a8ad99664f910 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1284,7 +1284,6 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
key = kzalloc(sizeof(*key), GFP_KERNEL);
if (!key)
return NULL;
- list_add_rcu(&key->list, &hdev->link_keys);
}
BT_DBG("%s key for %pMR type %u", hdev->name, bdaddr, type);
@@ -1308,6 +1307,9 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
else
key->type = type;
+ if (!old_key)
+ list_add_rcu(&key->list, &hdev->link_keys);
+
if (persistent)
*persistent = hci_persistent_key(hdev, conn, type,
old_key_type);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0083/1059] Bluetooth: hci_core: Initialize LTK before publication
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (81 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0082/1059] Bluetooth: hci_core: Initialize link key " Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0084/1059] Bluetooth: btintel: fix buffer over-read in fw payload Greg Kroah-Hartman
` (915 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit 4335849380aa1081ee9a1c2b934cbdda0961fa57 ]
hci_add_ltk() publishes a newly allocated LTK on hdev->long_term_keys
before initializing its address, type, value, authentication state,
encryption size, EDIV, and random value. hci_find_ltk() and the debugfs
long_term_keys_show() traverse this list under RCU and can therefore see
a zero or partially initialized key before those stores complete.
The race is reachable by racing an LTK addition with another CPU looking
up or dumping long-term keys. For example, userspace can issue
MGMT_OP_LOAD_LONG_TERM_KEYS while another process reads the corresponding
debugfs file.
Initialize all fields of a new LTK before list_add_rcu() makes it visible
to RCU readers. Existing LTKs remain published and continue to be updated
in place.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: 970d0f1b2803 ("Bluetooth: Convert LTK list to RCU")
Assisted-by: GLM-5.3 coccinelle
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index a8ad99664f910..b6fbf6c44a1fe 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1331,7 +1331,6 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
key = kzalloc(sizeof(*key), GFP_KERNEL);
if (!key)
return NULL;
- list_add_rcu(&key->list, &hdev->long_term_keys);
}
bacpy(&key->bdaddr, bdaddr);
@@ -1343,6 +1342,9 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
key->enc_size = enc_size;
key->type = type;
+ if (!old_key)
+ list_add_rcu(&key->list, &hdev->long_term_keys);
+
return key;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0084/1059] Bluetooth: btintel: fix buffer over-read in fw payload
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (82 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0083/1059] Bluetooth: hci_core: Initialize LTK " Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0085/1059] Bluetooth: hci_event: Clear explicit connect state on LE connection Greg Kroah-Hartman
` (914 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Catherine L, Kiran K,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catherine L <catherine.l@intel.com>
[ Upstream commit f92b7bca985205082c86140d0bd7c86c5be00efc ]
The firmware decoder cast fw_ptr + frag_len to struct
hci_command_hdr and read cmd->plen before confirming the
header and payload still fit in the remaining firmware
buffer.
Add explicit bounds checks before each dereference:
1. Reject if the command header is not fully contained
in remain.
2. Reject if the full command including payload exceeds
remain.
3. Log the offending fragment length and remaining size
before returning -EINVAL.
Fixes: fbbe83c52bc0d ("Bluetooth: btintel: Create common function for firmware download")
Signed-off-by: Catherine L <catherine.l@intel.com>
Tested-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.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 3adfe01166c5e..fca0c25cd4662 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1002,7 +1002,29 @@ static int btintel_download_firmware_payload(struct hci_dev *hdev,
err = -EINVAL;
while (fw_ptr - fw->data < fw->size) {
- struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len);
+ struct hci_command_hdr *cmd;
+ size_t remain = fw->size - (fw_ptr - fw->data);
+
+ /* Ensure the header fits before dereferencing */
+ if (frag_len + sizeof(*cmd) > remain) {
+ bt_dev_err(hdev,
+ "Firmware buffer overrun at header (frag_len %u, need %zu, remain %zu)",
+ frag_len, frag_len + sizeof(*cmd), remain);
+ err = -EINVAL;
+ goto done;
+ }
+
+ cmd = (void *)(fw_ptr + frag_len);
+
+ /* Ensure the full command (header + payload) fits before use */
+ if (frag_len + sizeof(*cmd) + cmd->plen > remain) {
+ bt_dev_err(hdev,
+ "Firmware buffer overrun at payload (frag_len %u, plen %u, need %zu, remain %zu)",
+ frag_len, cmd->plen,
+ frag_len + sizeof(*cmd) + cmd->plen, remain);
+ err = -EINVAL;
+ goto done;
+ }
frag_len += sizeof(*cmd) + cmd->plen;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0085/1059] Bluetooth: hci_event: Clear explicit connect state on LE connection
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (83 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0084/1059] Bluetooth: btintel: fix buffer over-read in fw payload Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0086/1059] Bluetooth: hci_sync: Protect resolving-list lookups Greg Kroah-Hartman
` (913 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit f5cd268af1c6f87fb3847e98274e22b8c6324aa4 ]
Since commit 6cd29ec6ae5e ("Bluetooth: hci_sync: Wait for proper events
when connecting LE"), create_le_conn_complete() only runs once the LE
Connection Complete event has been handled, and le_conn_complete_evt()
has already removed the connection parameters from pend_le_conns by
then. hci_connect_le_scan_cleanup() looks the parameters up in
pend_le_conns, so after a successful connection it no longer clears
explicit_connect, nor deletes the parameters that were only created for
the explicit connect.
The parameters of every device connected through an explicit connect,
such as an L2CAP or ATT connect or MGMT Pair Device, are thus left with
explicit_connect set. MGMT Remove Device for all devices then keeps
them as HCI_AUTO_CONN_EXPLICIT instead of freeing them, and if the
device was set to auto-connect and is disconnected, they also stay on
pend_le_conns: the kernel keeps scanning for the device and connects to
it as soon as it advertises, although no one asked for it any more.
Do the cleanup in le_conn_complete_evt() instead, where the explicit
connect request is fulfilled: clear explicit_connect, delete the
parameters if they only existed for it, and put report parameters back
on pend_le_reports. Auto-connect parameters are added back to
pend_le_conns on disconnection, as before. Update the comment in
hci_explicit_conn_params_set() that names hci_connect_le_scan_cleanup()
as the only place deleting them.
Fixes: 6cd29ec6ae5e ("Bluetooth: hci_sync: Wait for proper events when connecting LE")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_conn.c | 5 +++--
net/bluetooth/hci_event.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0c0c052294fc7..327c73431fb96 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1476,8 +1476,9 @@ static int hci_explicit_conn_params_set(struct hci_dev *hdev,
if (!params)
return -ENOMEM;
- /* If we created new params, mark them to be deleted in
- * hci_connect_le_scan_cleanup. It's different case than
+ /* If we created new params, mark them to be deleted once the
+ * explicit connect is done, see le_conn_complete_evt() and
+ * hci_connect_le_scan_cleanup(). It's different case than
* existing disabled params, those will stay after cleanup.
*/
params->auto_connect = HCI_AUTO_CONN_EXPLICIT;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 1fd012fa118f4..26b859c2c9c58 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5839,6 +5839,28 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status,
hci_conn_put(params->conn);
params->conn = NULL;
}
+
+ /* An explicit connect request is complete once connected, so
+ * clean it up here: hci_connect_le_scan_cleanup() no longer
+ * finds the params since they have just been removed from
+ * pend_le_conns.
+ */
+ if (params->explicit_connect) {
+ params->explicit_connect = false;
+
+ switch (params->auto_connect) {
+ case HCI_AUTO_CONN_EXPLICIT:
+ hci_conn_params_del(hdev, &conn->dst,
+ conn->dst_type);
+ break;
+ case HCI_AUTO_CONN_REPORT:
+ hci_pend_le_list_add(params,
+ &hdev->pend_le_reports);
+ break;
+ default:
+ break;
+ }
+ }
}
unlock:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0086/1059] Bluetooth: hci_sync: Protect resolving-list lookups
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (84 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0085/1059] Bluetooth: hci_event: Clear explicit connect state on LE connection Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0087/1059] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping Greg Kroah-Hartman
` (912 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit f05bd61a3213613de7848c8df2865492d5225023 ]
The host resolving list is updated under hdev->lock, and each
bdaddr_list_with_irk entry must remain alive throughout a lookup.
hci_le_del_resolve_list_sync() and hci_le_add_resolve_list_sync()
traverse that list without taking the lock.
On an LE privacy-capable controller with a programmed entry, passive
scan reconciliation can reach hci_le_del_resolve_list_sync() while a
privileged HCI_RAW client sends LE Clear Resolving List. The raw
command does not take req_lock, and its successful completion runs
on the controller workqueue independently of request work:
Request work Raw HCI / event work
hci_le_del_resolve_list_sync()
lookup loads a list node
hci_sock_sendmsg()
queue LE Clear Resolving List
hci_cc_le_clear_resolv_list()
take hdev->lock
unlink and free the node
release hdev->lock
read the node's address/type
The clear can free the node after the lookup loads it and before its
address/type read, causing a use-after-free. The report below shows
this access with the delete helper on the faulting stack. The add
helper uses the same unprotected lookup.
Take hdev->lock around each resolving-list membership lookup and
retain only a boolean result. This serializes traversal with clear
completion and keeps entry pointers inside the protected section.
Release the lock before issuing a synchronous HCI command, whose
completion also needs the lock.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in
hci_bdaddr_list_lookup_with_irk+0x106/0x120
Read of size 1 at addr ffff88810b036e16 by task kworker/u17:0/495
CPU: 2 UID: 0 PID: 495 Comm: kworker/u17:0 Not tainted
7.2.0-rc6-pmb-bt-functional-v1+ #3 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix,
1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
kasan_report+0xe0/0x110
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
hci_bdaddr_list_lookup_with_irk+0x106/0x120
hci_le_del_resolve_list_sync.isra.0+0xd6/0x3f0
? __pfx_hci_le_del_resolve_list_sync.isra.0+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
hci_le_del_accept_list_sync.isra.0+0x11c/0x290
? __pfx_hci_le_del_accept_list_sync.isra.0+0x10/0x10
? hci_passive_scan_sync+0x551/0x1e80
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x280
hci_passive_scan_sync+0x71c/0x1e80
? __pfx_hci_passive_scan_sync+0x10/0x10
? find_held_lock+0x2b/0x80
? hci_lookup_le_connect+0xe1/0x3c0
? srso_alias_return_thunk+0x5/0xfbef5
? find_held_lock+0x2b/0x80
? hci_update_passive_scan_sync+0x437/0x950
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x280
hci_update_passive_scan_sync+0x461/0x950
hci_cmd_sync_work+0x1b3/0x450
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 495:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_bdaddr_list_add_with_irk+0x183/0x3e0
hci_cc_le_add_to_resolv_list+0x18c/0x240
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
Freed by task 497:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x307/0x580
hci_bdaddr_list_clear+0x134/0x230
hci_cc_le_clear_resolv_list+0x13d/0x240
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
The buggy address belongs to the object at ffff88810b036e00
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 22 bytes inside of
freed 64-byte region [ffff88810b036e00, ffff88810b036e40)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
pfn:0x10b036
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100
dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000
0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810b036d00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
ffff88810b036d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88810b036e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810b036e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b036f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Disabling lock debugging due to kernel taint
Fixes: e8907f76544f ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
Assisted-by: LLM
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 | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 95605e5c2a694..71526e35a219d 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2493,15 +2493,17 @@ static int hci_le_del_resolve_list_sync(struct hci_dev *hdev,
bdaddr_t *bdaddr, u8 bdaddr_type)
{
struct hci_cp_le_del_from_resolv_list cp;
- struct bdaddr_list_with_irk *entry;
+ bool exists;
if (!use_ll_privacy(hdev))
return 0;
/* Check if the IRK has been programmed */
- entry = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list, bdaddr,
- bdaddr_type);
- if (!entry)
+ hci_dev_lock(hdev);
+ exists = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list,
+ bdaddr, bdaddr_type);
+ hci_dev_unlock(hdev);
+ if (!exists)
return 0;
cp.bdaddr_type = bdaddr_type;
@@ -2557,8 +2559,8 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
{
struct hci_cp_le_add_to_resolv_list cp;
struct smp_irk *irk;
- struct bdaddr_list_with_irk *entry;
struct hci_conn_params *p;
+ bool exists;
if (!use_ll_privacy(hdev))
return 0;
@@ -2580,10 +2582,11 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
return 0;
/* Check if the IK has _not_ been programmed yet. */
- entry = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list,
- ¶ms->addr,
- params->addr_type);
- if (entry)
+ hci_dev_lock(hdev);
+ exists = hci_bdaddr_list_lookup_with_irk(
+ &hdev->le_resolv_list, ¶ms->addr, params->addr_type);
+ hci_dev_unlock(hdev);
+ if (exists)
return 0;
cp.bdaddr_type = params->addr_type;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0087/1059] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (85 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0086/1059] Bluetooth: hci_sync: Protect resolving-list lookups Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0088/1059] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Greg Kroah-Hartman
` (911 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shuai Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
[ Upstream commit c0bb764fc082672678d371c375597a6a9f614cf9 ]
The kernel sets HCI_AUTO_OFF when a controller is first registered and
starts a 2-second timer. On slower boots bluetoothd and the HCI_AUTO_OFF
timer can race: hci_power_off() is already queued while bluetoothd is
still in the middle of its adapter setup sequence. hci_cmd_sync_clear()
then cancels any pending mgmt commands with -ECANCELED, including the
MGMT_OP_REMOVE_ADV_MONITOR sent by reset_adv_monitors() early in the
setup sequence.
When auto_off=1, hci_dev_close_sync() skips __mgmt_power_off() entirely,
so there is no fallback path to reply to the cancelled commands.
mgmt_remove_adv_monitor_complete() silently returns on -ECANCELED, leaving
the command with no reply. Since bluez's mgmt queue is strictly serialised,
this stalls all subsequent commands indefinitely, leaving bluetoothd unable
to register the adapter.
Fix by mapping -ECANCELED to MGMT_STATUS_CANCELLED in mgmt_errno_status()
and replying to the cancelled command in mgmt_remove_adv_monitor_complete()
instead of returning early.
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Stable-dep-of: 7eac80614300 ("Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 574ef8bc7845d..e4f78685fb6d1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -304,6 +304,8 @@ static u8 mgmt_errno_status(int err)
return MGMT_STATUS_ALREADY_CONNECTED;
case -ENOTCONN:
return MGMT_STATUS_DISCONNECTED;
+ case -ECANCELED:
+ return MGMT_STATUS_CANCELLED;
}
return MGMT_STATUS_FAILED;
@@ -5557,8 +5559,18 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
struct mgmt_pending_cmd *cmd = data;
struct mgmt_cp_remove_adv_monitor *cp;
- if (status == -ECANCELED)
+ /* Reply to a cancelled command so bluetoothd's serialised mgmt queue
+ * is not blocked.
+ */
+ if (status == -ECANCELED) {
+ cp = cmd->param;
+ rp.monitor_handle = cp->monitor_handle;
+
+ mgmt_cmd_complete(cmd->sk, cmd->hdev->id, cmd->opcode,
+ mgmt_status(status), &rp, sizeof(rp));
+ mgmt_pending_free(cmd);
return;
+ }
hci_dev_lock(hdev);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0088/1059] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (86 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0087/1059] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0089/1059] Bluetooth: hci_core: Keep link-key filtering inside RCU Greg Kroah-Hartman
` (910 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tobias Wilken,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Wilken <tooangel@tooangel.de>
[ Upstream commit 7eac80614300563470cffabf4df2b63616787ee7 ]
Since MGMT_OP_SET_POWERED runs through hci_cmd_sync, powering on a
controller that is blocked by rfkill fails with -ERFKILL from
hci_dev_open_sync(), and mgmt_set_powered_complete() reports it with
mgmt_status(err). mgmt_errno_status() has no case for -ERFKILL, so
userspace gets MGMT_STATUS_FAILED instead of MGMT_STATUS_RFKILLED.
Before that conversion, power on went through hci_power_on(), whose
error path mgmt_set_powered_failed() still maps -ERFKILL to
MGMT_STATUS_RFKILLED. bluetoothd relies on that status: for
RFKILLED it sets the adapter PowerState to "off-blocked" and returns
org.bluez.Error.Blocked for the Powered property, for any other status
it returns org.bluez.Error.Failed.
With the controller soft blocked, "bluetoothctl power on" printed
"Failed to set power on: org.bluez.Error.Failed" and btmon showed
"Set Powered (0x0005) Status: Failed (0x03)". With this change it
prints org.bluez.Error.Blocked and btmon shows "Status: RFKilled
(0x12)".
Map -ERFKILL to MGMT_STATUS_RFKILLED in mgmt_errno_status().
Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED")
Assisted-by: LLM
Signed-off-by: Tobias Wilken <tooangel@tooangel.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e4f78685fb6d1..8bc08445b57ce 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -306,6 +306,8 @@ static u8 mgmt_errno_status(int err)
return MGMT_STATUS_DISCONNECTED;
case -ECANCELED:
return MGMT_STATUS_CANCELLED;
+ case -ERFKILL:
+ return MGMT_STATUS_RFKILLED;
}
return MGMT_STATUS_FAILED;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0089/1059] Bluetooth: hci_core: Keep link-key filtering inside RCU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (87 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0088/1059] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0090/1059] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU Greg Kroah-Hartman
` (909 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 281ddc4e01ab54cab07995f2a1b72cf81bf90eb5 ]
hci_find_link_key() must keep the matching link key allocated while it
checks the key against the blocked-key list. It currently leaves the
key-list RCU read-side section before passing k->val to
hci_is_blocked_key(). That helper's own RCU section protects the
blocked-key list, but it cannot keep an unlinked link key from being
reclaimed.
The SMP receive path calls the finder without hdev->lock: Secure
Connections key distribution over BR/EDR reaches it through
smp_distribute_keys() and sc_generate_ltk(). With a stored peer link
key and a link-key entry in the blocked-key list,
MGMT_OP_LOAD_LINK_KEYS can free the selected key before the comparison:
HCI RX worker (SMP) Management / RCU reclamation
hci_find_link_key()
rcu_read_lock()
select k
rcu_read_unlock()
load_link_keys()
hci_dev_lock(hdev)
hci_link_keys_clear(hdev)
list_del_rcu(), kfree_rcu()
hci_dev_unlock(hdev)
grace period ends, k is freed
hci_is_blocked_key(hdev, ..., k->val)
memcmp() reads the freed key
Keep the RCU read-side section active through the blocked-key
comparison and the warning that prints k->bdaddr, and release it before
returning on both matched-key paths. hci_find_ltk() already handles its
blocked-key check this way.
KASAN reported this on a test kernel whose scheduling hook paused the
receive worker after the lookup until the key had been freed.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in hci_is_blocked_key+0x2db/0x300
Read of size 1 at addr ffff88810b5f89a7 by task kworker/u17:0/502
CPU: 1 UID: 0 PID: 502 Comm: kworker/u17:0 Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #5 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci1 hci_rx_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_is_blocked_key+0x2db/0x300
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_is_blocked_key+0x2db/0x300
kasan_report+0xe0/0x110
? hci_is_blocked_key+0x2db/0x300
hci_is_blocked_key+0x2db/0x300
hci_find_link_key+0x12e/0x400
smp_distribute_keys+0x1830/0x2950
? trace_hardirqs_on+0x18/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? queue_delayed_work_on+0xb3/0xf0
? __pfx_smp_distribute_keys+0x10/0x10
? __pfx_smp_send_cmd.isra.0+0x10/0x10
? __cancel_work+0x1b0/0x290
? __entry_text_end+0x1020f7/0x1020f9
? lockdep_hardirqs_on_prepare+0xea/0x1a0
? srso_alias_return_thunk+0x5/0xfbef5
? __asan_memset+0x23/0x50
? smp_recv_cb+0x12c7/0x8d80
? srso_alias_return_thunk+0x5/0xfbef5
smp_recv_cb+0x12c7/0x8d80
? __pfx_smp_recv_cb+0x10/0x10
? __pfx___might_resched+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? stack_depot_save_flags+0x29/0x9a0
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_lock+0x182c/0x2590
? kasan_save_stack+0x42/0x60
? l2cap_recv_frame+0x9ef/0x8830
? __kasan_slab_free+0x5f/0x80
? kmem_cache_free+0x242/0x580
? kfree_skbmem+0x15e/0x1d0
? sk_skb_reason_drop+0x12f/0x490
? hci_event_packet+0x556/0xc70
? hci_rx_work+0x367/0xf00
? process_one_work+0x908/0x19c0
? worker_thread+0x65c/0xe40
? __pfx___mutex_lock+0x10/0x10
? __lock_acquire+0x466/0x2260
? __pfx_l2cap_chan_hold_unless_zero+0x10/0x10
? l2cap_recv_frame+0x13cc/0x8830
? __pfx_smp_recv_cb+0x10/0x10
l2cap_recv_frame+0x13cc/0x8830
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_lock+0x182c/0x2590
? __pfx_l2cap_recv_frame+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? find_held_lock+0x2b/0x80
? l2cap_recv_acldata+0x1eb/0x10e0
? __pfx___mutex_lock+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_unlock_slowpath+0x147/0x920
? __pfx_l2cap_conn_hold_unless_zero+0x10/0x10
? __pfx_hci_conn_enter_active_mode+0x10/0x10
? l2cap_recv_acldata+0x13d/0x10e0
? srso_alias_return_thunk+0x5/0xfbef5
l2cap_recv_acldata+0xe9f/0x10e0
? srso_alias_return_thunk+0x5/0xfbef5
hci_rx_work+0x5a6/0xf00
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 504:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_add_link_key+0x474/0x840
hci_link_key_notify_evt+0x492/0xce0
hci_event_packet+0x894/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
Freed by task 29:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
__rcu_free_sheaf_prepare+0x65/0x2a0
rcu_free_sheaf_nobarn+0x1d/0x50
rcu_core+0x661/0x1d10
handle_softirqs+0x201/0x930
run_ksoftirqd+0x33/0x60
smpboot_thread_fn+0x3bd/0x9a0
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
The buggy address belongs to the object at ffff88810b5f8980
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 39 bytes inside of
freed 64-byte region [ffff88810b5f8980, ffff88810b5f89c0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b5f8
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810b5f8880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b5f8900: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
>ffff88810b5f8980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810b5f8a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b5f8a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Fixes: 600a87490ff9 ("Bluetooth: Implementation of MGMT_OP_SET_BLOCKED_KEYS.")
Assisted-by: LLM
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_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b6fbf6c44a1fe..ef8cb26bc3994 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1105,17 +1105,16 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
rcu_read_lock();
list_for_each_entry_rcu(k, &hdev->link_keys, list) {
if (bacmp(bdaddr, &k->bdaddr) == 0) {
- rcu_read_unlock();
-
if (hci_is_blocked_key(hdev,
HCI_BLOCKED_KEY_TYPE_LINKKEY,
k->val)) {
bt_dev_warn_ratelimited(hdev,
"Link key blocked for %pMR",
&k->bdaddr);
- return NULL;
+ k = NULL;
}
+ rcu_read_unlock();
return k;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0090/1059] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (88 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0089/1059] Bluetooth: hci_core: Keep link-key filtering inside RCU Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0091/1059] Bluetooth: hci_core: Initialize advertising RPA work only once Greg Kroah-Hartman
` (908 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 9ff737119177a6c1ce6083ef8c0fc06355f11869 ]
hci_le_add_resolve_list_sync() copies the peer IRK into the LE Add
Device To Resolving List command after hci_find_irk_by_addr() has
returned. The finder ends its RCU read-side section before returning
the borrowed entry, and neither the request worker nor
interleave_scan_work() holds hdev->lock here. The resolving-list
membership check between the lookup and the copy takes hdev->lock and
may sleep on it, which widens the window.
When LL privacy programs a peer with address resolution enabled,
MGMT_OP_LOAD_IRKS can free its IRK before the copy:
Request worker Management / RCU reclamation
hci_le_add_resolve_list_sync()
irk = hci_find_irk_by_addr()
load_irks()
hci_dev_lock(hdev)
hci_smp_irks_clear(hdev)
list_del_rcu(), kfree_rcu()
hci_dev_unlock(hdev)
grace period ends, irk is freed
resolving-list membership check
memcpy(cp.peer_irk, irk->val, 16)
Copy the IRK value in an RCU read-side section right after the lookup,
as hci_le_set_privacy_mode_sync() does for the identity address. The
section ends before hdev->lock is taken and before the synchronous HCI
command is sent.
KASAN reported this on a test kernel with scheduling hooks, whose
frames appear in the trace. The report predates the hdev->lock taken
by the membership check.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in hci_le_add_resolve_list_sync+0x8d9/0x910
Read of size 16 at addr ffff88810d21452d by task kworker/u17:0/504
CPU: 2 UID: 0 PID: 504 Comm: kworker/u17:0 Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #2 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci0 interleave_scan_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_le_add_resolve_list_sync+0x8d9/0x910
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_le_add_resolve_list_sync+0x8d9/0x910
kasan_report+0xe0/0x110
? hci_le_add_resolve_list_sync+0x8d9/0x910
hci_le_add_resolve_list_sync+0x8d9/0x910
? __pfx_hci_le_add_resolve_list_sync+0x10/0x10
? pmbd_probe_hit_cookie+0xe7/0x1c0
? srso_alias_return_thunk+0x5/0xfbef5
? pmbd_probe_hit_cookie+0xee/0x1c0
? __pfx_pmbd_probe_hit_cookie+0x10/0x10
hci_le_add_accept_list_sync+0x18e/0x820
? conn_params_copy+0x36e/0x650
? __pfx_hci_le_add_accept_list_sync+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? conn_params_copy+0x3a0/0x650
hci_passive_scan_sync+0x95f/0x1f10
? __pfx_hci_passive_scan_sync+0x10/0x10
? debug_object_deactivate+0x2f8/0x3c0
? pwq_dec_nr_in_flight+0x880/0xdf0
? srso_alias_return_thunk+0x5/0xfbef5
? lock_acquire+0x17b/0x2f0
? process_one_work+0x895/0x19c0
interleave_scan_work+0x11b/0x470
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 535:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_add_irk+0xb6/0x220
load_irks+0x5f9/0x840
hci_sock_sendmsg+0x128b/0x22e0
__sys_sendto+0x425/0x470
__x64_sys_sendto+0xe5/0x1c0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 0:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
__rcu_free_sheaf_prepare+0x65/0x2a0
rcu_free_sheaf+0x1f/0xe0
rcu_core+0x661/0x1d10
handle_softirqs+0x201/0x930
__irq_exit_rcu+0x110/0x1e0
irq_exit_rcu+0xe/0x20
sysvec_apic_timer_interrupt+0x6c/0x80
asm_sysvec_apic_timer_interrupt+0x1a/0x20
The buggy address belongs to the object at ffff88810d214500
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 45 bytes inside of
freed 64-byte region [ffff88810d214500, ffff88810d214540)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10d214
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810d214400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810d214480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88810d214500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810d214580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810d214600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Fixes: e8907f76544f ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
Assisted-by: LLM
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 | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 71526e35a219d..2884ca241b526 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2577,9 +2577,17 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
goto done;
}
+ rcu_read_lock();
+
irk = hci_find_irk_by_addr(hdev, ¶ms->addr, params->addr_type);
- if (!irk)
+ if (!irk) {
+ rcu_read_unlock();
return 0;
+ }
+
+ memcpy(cp.peer_irk, irk->val, 16);
+
+ rcu_read_unlock();
/* Check if the IK has _not_ been programmed yet. */
hci_dev_lock(hdev);
@@ -2591,7 +2599,6 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
cp.bdaddr_type = params->addr_type;
bacpy(&cp.bdaddr, ¶ms->addr);
- memcpy(cp.peer_irk, irk->val, 16);
/* Default privacy mode is always Network */
params->privacy_mode = HCI_NETWORK_PRIVACY;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0091/1059] Bluetooth: hci_core: Initialize advertising RPA work only once
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (89 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0090/1059] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0092/1059] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server Greg Kroah-Hartman
` (907 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit a7c5c18b7cc30dcd2a9ae5a0fb38378d3998417e ]
hci_add_adv_instance() also updates existing instances and calls
INIT_DELAYED_WORK() on their rpa_expired_cb every time, even when the
work is pending or running. cancel_delayed_work_sync() then no longer
finds the work, so hci_remove_adv_instance() can free the instance
under it:
hdev->workqueue MGMT_OP_ADD_EXT_ADV_PARAMS
adv_instance_rpa_expired()
hci_dev_lock(hdev)
hci_add_adv_instance()
INIT_DELAYED_WORK()
mgmt_pending_new() fails
hci_remove_adv_instance()
cancel_delayed_work_sync()
returns without waiting
kfree(adv)
hci_dev_unlock(hdev)
adv->rpa_expired = true
The work has been initialized on every update since it was added.
Initialize it only when the instance is allocated.
KASAN report as below:
BUG: KASAN: slab-use-after-free in adv_instance_rpa_expired+0x139/0x160
Write of size 1 at addr ffff888108d84b2e by task kworker/u17:0/504
Workqueue: hci0 adv_instance_rpa_expired
Call Trace:
adv_instance_rpa_expired+0x139/0x160
Allocated by task 560:
hci_add_adv_instance+0x68d/0x9d0
add_ext_adv_params+0x4d4/0xb60
hci_sock_sendmsg+0x128b/0x22e0
Freed by task 594:
kfree+0x307/0x580
hci_remove_adv_instance+0x230/0x540
add_ext_adv_params+0xa43/0xb60
hci_sock_sendmsg+0x128b/0x22e0
Last potentially related work creation:
insert_work+0x37/0x210
__queue_work+0xaba/0x1270
call_timer_fn+0x171/0x500
The buggy address belongs to the object at ffff888108d84800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 814 bytes inside of
freed 1024-byte region [ffff888108d84800, ffff888108d84c00)
Fixes: a73c046a2869 ("Bluetooth: Implement Set ADV set random address")
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_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ef8cb26bc3994..ff31509ea4728 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1719,6 +1719,9 @@ struct adv_info *hci_add_adv_instance(struct hci_dev *hdev, u8 instance,
if (!adv)
return ERR_PTR(-ENOMEM);
+ INIT_DELAYED_WORK(&adv->rpa_expired_cb,
+ adv_instance_rpa_expired);
+
adv->pending = true;
adv->instance = instance;
@@ -1755,8 +1758,6 @@ struct adv_info *hci_add_adv_instance(struct hci_dev *hdev, u8 instance,
else
adv->duration = duration;
- INIT_DELAYED_WORK(&adv->rpa_expired_cb, adv_instance_rpa_expired);
-
BT_DBG("%s for %dMR", hdev->name, instance);
return adv;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0092/1059] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (90 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0091/1059] Bluetooth: hci_core: Initialize advertising RPA work only once Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0093/1059] ksmbd: require NUL-terminated EA names Greg Kroah-Hartman
` (906 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aaditya Kansal, Namjae Jeon,
Steve French, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaditya Kansal <aadityakansal390@gmail.com>
[ Upstream commit e4442b2e95baf0901830c924d0a197b100aca970 ]
Add STATUS_INFO_LENGTH_MISMATCH mapping to EMSGSIZE.
Currently, STATUS_INFO_LENGTH_MISMATCH has no mapping to any error code,
making it difficult to distinguish between invalid parameters and length
mismatch.
Map STATUS_INFO_LENGTH_MISMATCH to EMSGSIZE while keeping the EINVAL for
invalid parameters. Although the buf_len check only checks for buf_size
being less than required, there was no error code for lower buf_size.
Hence, EMSGSIZE is used.
Signed-off-by: Aaditya Kansal <aadityakansal390@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: e49296d51ccb ("ksmbd: require NUL-terminated EA names")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 5f86f9d81f1e3..b00a575cd9fb6 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -6231,7 +6231,6 @@ static int set_file_mode_info(struct ksmbd_file *fp,
* @share: ksmbd_share_config pointer
*
* Return: 0 on success, otherwise error
- * TODO: need to implement an error handling for STATUS_INFO_LENGTH_MISMATCH
*/
static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
struct smb2_set_info_req *req,
@@ -6244,14 +6243,14 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_BASIC_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_basic_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_basic_info(fp, (struct smb2_file_basic_info *)buffer, share);
}
case FILE_ALLOCATION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_alloc_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_allocation_info(work, fp,
(struct smb2_file_alloc_info *)buffer);
@@ -6259,7 +6258,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_END_OF_FILE_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_eof_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_end_of_file_info(work, fp,
(struct smb2_file_eof_info *)buffer);
@@ -6267,7 +6266,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_RENAME_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_rename_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_rename_info(work, fp,
(struct smb2_file_rename_info *)buffer,
@@ -6278,7 +6277,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
struct smb2_file_link_info *file_info;
if (buf_len < sizeof(struct smb2_file_link_info))
- return -EINVAL;
+ return -EMSGSIZE;
file_info = (struct smb2_file_link_info *)buffer;
if (file_info->ReplaceIfExists && !(fp->daccess & FILE_DELETE_LE)) {
@@ -6293,7 +6292,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_DISPOSITION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_disposition_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_disposition_info(work, fp,
(struct smb2_file_disposition_info *)buffer);
@@ -6307,7 +6306,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
}
if (buf_len < sizeof(struct smb2_ea_info))
- return -EINVAL;
+ return -EMSGSIZE;
return smb2_set_ea((struct smb2_ea_info *)buffer,
buf_len, &fp->filp->f_path, true);
@@ -6315,14 +6314,14 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_POSITION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_pos_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_position_info(fp, (struct smb2_file_pos_info *)buffer);
}
case FILE_MODE_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_mode_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_mode_info(fp, (struct smb2_file_mode_info *)buffer);
}
@@ -6430,6 +6429,8 @@ int smb2_set_info(struct ksmbd_work *work)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
else if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EMSGSIZE)
+ rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
else if (rc == -ESHARE)
rsp->hdr.Status = STATUS_SHARING_VIOLATION;
else if (rc == -ENOENT)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0093/1059] ksmbd: require NUL-terminated EA names
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (91 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0092/1059] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0094/1059] soreuseport: annotate data-races around reuse->socks[] and num_socks Greg Kroah-Hartman
` (905 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Yifan Zhang,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit e49296d51ccbf2ad0ed0484db1382f1d7217bd6e ]
smb2_set_ea() verifies that the byte reserved for the declared EA-name
terminator lies inside the request, but it does not verify that the byte is
zero. With SMB debug logging enabled, the name is passed to %s and the
diagnostic reads beyond the request allocation.
KASAN reports:
BUG: KASAN: slab-out-of-bounds in string
Read of size 1
string
vsnprintf
_printk
smb2_set_ea
smb2_set_info
Reject an EA entry whose declared terminator byte is nonzero. Return
-EBADMSG for the malformed buffer, and map that error to
STATUS_EA_LIST_INCONSISTENT for both SET_INFO and CREATE.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Suggested-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index b00a575cd9fb6..5f9b9deb8b819 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2446,6 +2446,11 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
if (!eabuf->EaNameLength)
goto next;
+ if (eabuf->name[eabuf->EaNameLength]) {
+ rc = -EBADMSG;
+ break;
+ }
+
ksmbd_debug(SMB,
"name : <%s>, name_len : %u, value_len : %u, next : %u\n",
eabuf->name, eabuf->EaNameLength,
@@ -3603,6 +3608,8 @@ int smb2_open(struct ksmbd_work *work)
if (rc) {
if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EBADMSG)
+ rsp->hdr.Status = STATUS_EA_LIST_INCONSISTENT;
else if (rc == -EOPNOTSUPP)
rsp->hdr.Status = STATUS_NOT_SUPPORTED;
else if (rc == -EACCES || rc == -ESTALE || rc == -EXDEV) {
@@ -6429,6 +6436,8 @@ int smb2_set_info(struct ksmbd_work *work)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
else if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EBADMSG)
+ rsp->hdr.Status = STATUS_EA_LIST_INCONSISTENT;
else if (rc == -EMSGSIZE)
rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
else if (rc == -ESHARE)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0094/1059] soreuseport: annotate data-races around reuse->socks[] and num_socks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (92 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0093/1059] ksmbd: require NUL-terminated EA names Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0095/1059] vhost-scsi: validate event queue descriptor direction Greg Kroah-Hartman
` (904 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Eric Dumazet,
Jiayuan Chen, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 213d491308b99d026514c93980cf8dd572226b1b ]
reuseport_select_sock() and reuseport_migrate_sock() read
reuse->num_socks and reuse->socks[] locklessly under RCU, while
writers holding reuseport_lock can change them.
Readers snapshot num_socks once, then index socks[] with it.
Meanwhile, writers can perform several operations, storing into
slots below the reader's stale count:
- __reuseport_detach_sock() moves the last socket into slot i.
- __reuseport_add_sock() then writes the new socket at the
(now smaller) num_socks index.
- reuseport_stop_listen_sock() calls __reuseport_detach_sock()
then __reuseport_add_closed_sock(), which writes slot
max_socks - num_closed_socks - 1. This can be the slot a reader
still considers part of the listener region when the array is full.
- __reuseport_detach_closed_sock() can then rewrite that slot.
All pointers stored in socks[] remain valid for the RCU grace period,
but without annotations the compiler is allowed to tear or reload
these accesses. For instance, reuseport_select_sock_by_hash() could
reload reuse->socks[i] between the sk_state/sk_incoming_cpu checks
and the return, returning a socket that did not pass them.
Use WRITE_ONCE() for all socks[] stores done while the array is
visible to readers, and for num_socks updates (readers already use
READ_ONCE()). Use READ_ONCE() in the two lockless readers.
Fixes: ef456144da8e ("soreuseport: define reuseport groups")
Link: https://lore.kernel.org/netdev/20260902071900.395567-1-ruanjinjie@huawei.com/
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261030120956.3026324-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock_reuseport.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
index 5a165286e4d8e..e7685956b09d7 100644
--- a/net/core/sock_reuseport.c
+++ b/net/core/sock_reuseport.c
@@ -124,10 +124,10 @@ static int reuseport_sock_index(struct sock *sk,
static void __reuseport_add_sock(struct sock *sk,
struct sock_reuseport *reuse)
{
- reuse->socks[reuse->num_socks] = sk;
+ WRITE_ONCE(reuse->socks[reuse->num_socks], sk);
/* paired with smp_rmb() in reuseport_(select|migrate)_sock() */
smp_wmb();
- reuse->num_socks++;
+ WRITE_ONCE(reuse->num_socks, reuse->num_socks + 1);
reuseport_get_incoming_cpu(sk, reuse);
}
@@ -139,8 +139,8 @@ static bool __reuseport_detach_sock(struct sock *sk,
if (i == -1)
return false;
- reuse->socks[i] = reuse->socks[reuse->num_socks - 1];
- reuse->num_socks--;
+ WRITE_ONCE(reuse->socks[i], reuse->socks[reuse->num_socks - 1]);
+ WRITE_ONCE(reuse->num_socks, reuse->num_socks - 1);
reuseport_put_incoming_cpu(sk, reuse);
return true;
@@ -149,7 +149,7 @@ static bool __reuseport_detach_sock(struct sock *sk,
static void __reuseport_add_closed_sock(struct sock *sk,
struct sock_reuseport *reuse)
{
- reuse->socks[reuse->max_socks - reuse->num_closed_socks - 1] = sk;
+ WRITE_ONCE(reuse->socks[reuse->max_socks - reuse->num_closed_socks - 1], sk);
/* paired with READ_ONCE() in inet_csk_bind_conflict() */
WRITE_ONCE(reuse->num_closed_socks, reuse->num_closed_socks + 1);
reuseport_get_incoming_cpu(sk, reuse);
@@ -163,7 +163,8 @@ static bool __reuseport_detach_closed_sock(struct sock *sk,
if (i == -1)
return false;
- reuse->socks[i] = reuse->socks[reuse->max_socks - reuse->num_closed_socks];
+ WRITE_ONCE(reuse->socks[i],
+ reuse->socks[reuse->max_socks - reuse->num_closed_socks]);
/* paired with READ_ONCE() in inet_csk_bind_conflict() */
WRITE_ONCE(reuse->num_closed_socks, reuse->num_closed_socks - 1);
reuseport_put_incoming_cpu(sk, reuse);
@@ -522,7 +523,7 @@ static struct sock *run_bpf_filter(struct sock_reuseport *reuse, u16 socks,
if (index >= socks)
return NULL;
- return reuse->socks[index];
+ return READ_ONCE(reuse->socks[index]);
}
static struct sock *reuseport_select_sock_by_hash(struct sock_reuseport *reuse,
@@ -533,7 +534,7 @@ static struct sock *reuseport_select_sock_by_hash(struct sock_reuseport *reuse,
i = j = reciprocal_scale(hash, num_socks);
do {
- struct sock *sk = reuse->socks[i];
+ struct sock *sk = READ_ONCE(reuse->socks[i]);
if (sk->sk_state != TCP_ESTABLISHED) {
/* Paired with WRITE_ONCE() in __reuseport_(get|put)_incoming_cpu(). */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0095/1059] vhost-scsi: validate event queue descriptor direction
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (93 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0094/1059] soreuseport: annotate data-races around reuse->socks[] and num_socks Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0096/1059] vhost-scsi: reject delayed virtqueue setup Greg Kroah-Hartman
` (903 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Linfeng Sun,
Michael S. Tsirkin, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 3d8c5b714c186d08c8fe8c8cfd1f9b89525ab067 ]
vhost_get_vq_desc() returns the number of device readable (output) and
device writable (input) iovec segments. A guest can submit an eventq
descriptor chain that fills vq->iov with output segments, setting out
to ARRAY_SIZE(vq->iov) and in to zero.
When the host later queues a vhost-scsi event, vhost_scsi_do_evt_work()
uses out as the index of the first input segment. This accesses one element
beyond vq->iov and triggers an array-index-out-of-bounds report. With
panic_on_warn enabled, the report panics the host.
The event queue accepts device writable buffers only. Reject chains that
contain output segments or lack an input segment before using out as an
index. The input check prevents the out-of-bounds access, while the output
check validates the eventq descriptor direction.
I found the descriptor direction issue myself, though the patch was
written with AI assistance. The out-of-bounds read with an
output-only chain was separately reported by Jia Jia.
Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support")
Reported-by: Jia Jia <physicalmtea@gmail.com>
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20261009-fix-arrary-index-out-of-bounds-in-vhost_scsi_complete_events-v2-1-1f7689a54735@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 8d33e694d318e..8974bb13f8e18 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -493,6 +493,16 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
return;
}
+ /*
+ * Eventq buffers are device-writable only. A nonzero in count
+ * guarantees that out is within the bounds of vq->iov.
+ */
+ if (unlikely(out || !in)) {
+ vq_err(vq, "Invalid event buffer: out %u, in %u\n", out, in);
+ vs->vs_events_missed = true;
+ return;
+ }
+
if ((vq->iov[out].iov_len != sizeof(struct virtio_scsi_event))) {
vq_err(vq, "Expecting virtio_scsi_event, got %zu bytes\n",
vq->iov[out].iov_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0096/1059] vhost-scsi: reject delayed virtqueue setup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (94 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0095/1059] vhost-scsi: validate event queue descriptor direction Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0097/1059] vhost: reject backend enable without a kick file Greg Kroah-Hartman
` (902 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit a543346b96a174fcee6812ac2764acc8dc993358 ]
vhost_scsi_set_endpoint() allocates command pools only for I/O
virtqueues that are already set up, but publishes the backend for every
virtqueue. Userspace can complete a skipped queue after attaching the
endpoint, then kick it with scsi_tags uninitialized and trigger the
alloc_hint warning in sbitmap_get().
Delayed virtqueue setup is not supported. Leave skipped I/O virtqueues
inactive and reject changes to the vring size or addresses while an
endpoint is attached. Userspace must clear the endpoint before changing
the vring configuration.
I found this bug myself, though the patch was written with AI assistance.
Fixes: 25b98b64e284 ("vhost scsi: alloc cmds per vq instead of session")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261010-fix-warning-in-sbitmap_get-v3-1-33de562d1359@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 8974bb13f8e18..516962d53169f 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1646,6 +1646,9 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
for (i = 0; i < vs->dev.nvqs; i++) {
vq = &vs->vqs[i].vq;
+ if (i >= VHOST_SCSI_VQ_IO && !vs->vqs[i].scsi_cmds)
+ continue;
+
mutex_lock(&vq->mutex);
vhost_vq_set_backend(vq, vs_tpg);
vhost_vq_init_access(vq);
@@ -1958,10 +1961,16 @@ vhost_scsi_ioctl(struct file *f,
default:
mutex_lock(&vs->dev.mutex);
r = vhost_dev_ioctl(&vs->dev, ioctl, argp);
- if (r == -ENOIOCTLCMD)
- r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
- else
+ if (r == -ENOIOCTLCMD) {
+ if (vs->vs_tpg &&
+ (ioctl == VHOST_SET_VRING_NUM ||
+ ioctl == VHOST_SET_VRING_ADDR))
+ r = -EBUSY;
+ else
+ r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
+ } else {
vhost_scsi_flush(vs);
+ }
mutex_unlock(&vs->dev.mutex);
return r;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0097/1059] vhost: reject backend enable without a kick file
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (95 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0096/1059] vhost-scsi: reject delayed virtqueue setup Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0098/1059] block: partitions: reject GPT entries with starting_lba > ending_lba Greg Kroah-Hartman
` (901 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 509f6bd229e94fc39506e01be692c4aa22338b49 ]
Enabling a backend without VHOST_SET_VRING_KICK dereferences a NULL
vq->kick in vhost_poll_start(). Reject the request with -EINVAL.
Fixes: 264ee5aa81ec ("tools/virtio: Add --reset")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261011-fix-null-pointer-in-vhost_test_set_backend-v1-1-60b2f12d64c6@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index bc8e7fb1e6357..7518df9f94c53 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -281,6 +281,10 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd)
r = -EFAULT;
goto err_vq;
}
+ if (enable && !vq->kick) {
+ r = -EINVAL;
+ goto err_vq;
+ }
if (!enable) {
vhost_poll_stop(&vq->poll);
backend = vhost_vq_get_backend(vq);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0098/1059] block: partitions: reject GPT entries with starting_lba > ending_lba
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (96 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0097/1059] vhost: reject backend enable without a kick file Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0099/1059] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT Greg Kroah-Hartman
` (900 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zizhi Wo, Christoph Hellwig,
Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <wozizhi@huawei.com>
[ Upstream commit 7e3801d12ebabaa3db6e2685ccc80b6e6f6d1ff7 ]
A GPT entry whose starting_lba is greater than its ending_lba is accepted,
and the kernel creates a partition with a bogus size. The bogus sector
count defeats the end-of-device check, so I/O through that partition is not
confined to it and can access sectors outside the partition on the same
disk.
is_pte_valid() only rejects an entry when its type is NULL or when
starting_lba or ending_lba is greater than lastlba; it never checks that
starting_lba <= ending_lba. For a reversed entry both field checks still
pass, but efi_partition() computes size = ending_lba - starting_lba + 1 in
u64, which underflows to a huge value. That value also wraps in the
end-of-device check in blk_add_partition() (from + size) and does not fit
the signed i_size, which turns negative.
Reject entries with starting_lba > ending_lba in is_pte_valid(), matching
the head-level check against last_usable_lba < first_usable_lba.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261102080442.3775061-1-wozizhi@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/partitions/efi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 7acba66eed481..d88321f6400ab 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -461,6 +461,7 @@ static inline int
is_pte_valid(const gpt_entry *pte, const u64 lastlba)
{
if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
+ le64_to_cpu(pte->starting_lba) > le64_to_cpu(pte->ending_lba) ||
le64_to_cpu(pte->starting_lba) > lastlba ||
le64_to_cpu(pte->ending_lba) > lastlba)
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0099/1059] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (97 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0098/1059] block: partitions: reject GPT entries with starting_lba > ending_lba Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0100/1059] null_blk: fix opening closed zones at the active zone limit Greg Kroah-Hartman
` (899 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nguyen Dinh Phi, Stefano Garzarella,
Bobby Eshleman, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Dinh Phi <phind.uet@gmail.com>
[ Upstream commit c0ef6144b4d60afb90bc6d8db3ffdac043cd6ffc ]
The timeval validation checks tv_usec < USEC_PER_SEC but not
tv_usec >= 0, so a negative tv_usec makes the timeout computation
wrap into a bogus value, later tripping "schedule_timeout: wrong
timeout value" instead of being rejected.
Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20261030064428.73930-1-phind.uet@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/vmw_vsock/af_vsock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 5675f224ea7d8..9d8d4174beda6 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1779,7 +1779,8 @@ static int vsock_connectible_setsockopt(struct socket *sock,
optname == SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD);
if (err)
break;
- if (tv.tv_sec >= 0 && tv.tv_usec < USEC_PER_SEC &&
+ if (tv.tv_sec >= 0 && tv.tv_usec >= 0 &&
+ tv.tv_usec < USEC_PER_SEC &&
tv.tv_sec < (MAX_SCHEDULE_TIMEOUT / HZ - 1)) {
vsk->connect_timeout = tv.tv_sec * HZ +
DIV_ROUND_UP((unsigned long)tv.tv_usec, (USEC_PER_SEC / HZ));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0100/1059] null_blk: fix opening closed zones at the active zone limit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (98 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0099/1059] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0101/1059] null_blk: dont finish zones to set them read-only or offline Greg Kroah-Hartman
` (898 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 6f2b59737bf9cf3623719857ac149f0d431db109 ]
When the open zone limit is reached, null_check_open() closes an
implicitly open zone only if the active zone limit is not reached.
Closing an implicitly open zone does not change the number of active
zones, so this check is wrong. For an empty zone, the active zone limit
was already checked by null_check_zone_resources(). For a closed zone,
the check makes writing to, opening or finishing the zone fail with
BLK_STS_ZONE_OPEN_RESOURCE at the active zone limit, whereas ZBC-3
(4.5.3.2.7.2) and NVMe ZNS (2.1.1.4.1) require closing an implicitly
open zone instead.
Remove the check, and update the comment above
null_check_zone_resources() accordingly.
Fixes: dc4d137ee3b7 ("null_blk: add support for max open/active zone limit for zoned devices")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20261022092158.2248831-6-cassel@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/null_blk/zoned.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 78efccc77caa4..643fe80a43fb0 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -341,10 +341,8 @@ static blk_status_t null_check_open(struct nullb_device *dev)
return BLK_STS_OK;
if (dev->nr_zones_imp_open) {
- if (null_check_active(dev) == BLK_STS_OK) {
- null_close_imp_open_zone(dev);
- return BLK_STS_OK;
- }
+ null_close_imp_open_zone(dev);
+ return BLK_STS_OK;
}
return BLK_STS_ZONE_OPEN_RESOURCE;
@@ -360,8 +358,11 @@ static blk_status_t null_check_open(struct nullb_device *dev)
*
* ZBC states that an implicit open zone shall be closed only if there is not
* room within the open limit. However, with the addition of an active limit,
- * it is not certain that closing an implicit open zone will allow a new zone
- * to be opened, since we might already be at the active limit capacity.
+ * it is not certain that closing an implicit open zone will allow an empty
+ * zone to be opened, since we might already be at the active limit capacity.
+ * Therefore, the active limit is checked first for an empty zone. A closed
+ * zone already holds an active zone resource, so only the open limit has to
+ * be checked for a closed zone.
*/
static blk_status_t null_check_zone_resources(struct nullb_device *dev,
struct nullb_zone *zone)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0101/1059] null_blk: dont finish zones to set them read-only or offline
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (99 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0100/1059] null_blk: fix opening closed zones at the active zone limit Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0102/1059] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash Greg Kroah-Hartman
` (897 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 973bf587d79f061beffdd392e77012a07f25fcd6 ]
null_set_zone_cond() calls null_finish_zone() to release the zone
resources held by a zone before setting it read-only or offline.
For an empty or closed zone, null_finish_zone() first runs the zone
resource checks, which can close an unrelated implicitly open zone, or
fail. As the error is ignored, a failure for a closed zone leaks
nr_zones_closed, permanently lowering the effective active zone limit.
Setting a zone read-only or offline requires no zone resources, so
release the zone resources held by the zone directly instead, using a
new helper, null_release_zone_resources().
Fixes: d3a5738849e0 ("null_blk: support read-only and offline zone conditions")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20261022092158.2248831-7-cassel@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/null_blk/zoned.c | 35 +++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 643fe80a43fb0..df4d253f6ce9e 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -713,6 +713,33 @@ blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op,
}
}
+/*
+ * Release the zone resources held by a zone, before changing the condition of
+ * the zone to a condition that does not hold any zone resources.
+ */
+static void null_release_zone_resources(struct nullb_device *dev,
+ struct nullb_zone *zone)
+{
+ if (!dev->need_zone_res_mgmt)
+ return;
+
+ spin_lock(&dev->zone_res_lock);
+ switch (zone->cond) {
+ case BLK_ZONE_COND_IMP_OPEN:
+ dev->nr_zones_imp_open--;
+ break;
+ case BLK_ZONE_COND_EXP_OPEN:
+ dev->nr_zones_exp_open--;
+ break;
+ case BLK_ZONE_COND_CLOSED:
+ dev->nr_zones_closed--;
+ break;
+ default:
+ break;
+ }
+ spin_unlock(&dev->zone_res_lock);
+}
+
/*
* Set a zone in the read-only or offline condition.
*/
@@ -729,8 +756,8 @@ static void null_set_zone_cond(struct nullb_device *dev,
* If the read-only condition is requested again to zones already in
* read-only condition, restore back normal empty condition. Do the same
* if the offline condition is requested for offline zones. Otherwise,
- * set the specified zone condition to the zones. Finish the zones
- * beforehand to free up zone resources.
+ * set the specified zone condition to the zones. Release the zone
+ * resources held by the zones beforehand.
*/
if (zone->cond == cond) {
zone->cond = BLK_ZONE_COND_EMPTY;
@@ -738,9 +765,7 @@ static void null_set_zone_cond(struct nullb_device *dev,
if (dev->memory_backed)
null_handle_discard(dev, zone->start, zone->len);
} else {
- if (zone->cond != BLK_ZONE_COND_READONLY &&
- zone->cond != BLK_ZONE_COND_OFFLINE)
- null_finish_zone(dev, zone);
+ null_release_zone_resources(dev, zone);
zone->cond = cond;
zone->wp = (sector_t)-1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0102/1059] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (100 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0101/1059] null_blk: dont finish zones to set them read-only or offline Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0103/1059] net: dsa: b53: Enable IGMP and MLD control packet CPU copies Greg Kroah-Hartman
` (896 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jiayuan Chen, Kuniyuki Iwashima, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 647b81ddefc6364290e67bf33c89d54971f8995e ]
inet_twsk_kill() removes a TIME_WAIT socket from the established hash
before it finishes using the ehash lock, hashinfo and bind tables, and
before it drops the death-row reference. A running timer can therefore
unhash its socket before inet_twsk_purge() reaches it. The purge cannot
synchronize with that timer, and tcp_sk_exit_batch() can free the
private ehash and hashinfo while inet_twsk_kill() is still using them.
An unprivileged reproducer using user and network namespaces, a private
TCP ehash and a FIN_WAIT2 timer triggers a KASAN slab-use-after-free in
inet_twsk_kill(). The allocation and free stacks point to
inet_pernet_hashinfo_alloc() and inet_pernet_hashinfo_free().
Wait for an RCU grace period after purging the whole batch, if one
netns in the batch uses a private ehash. TIME_WAIT removal runs with
bottom halves disabled, so this also waits for removers that were
already invisible to the purge. Keep the wait under
tcp_exit_batch_mutex, before freeing any private hashinfo.
The same window exists with the shared tcp_hashinfo. There, the
hashinfo memory stays valid, but tcp_sk_exit_batch() can decrement
tcp_death_row.tw_refcount from 2 to 1 before inet_twsk_kill() drops its
own reference. This triggers the WARN_ON_ONCE() in tcp_sk_exit_batch(),
then a refcount_t "decrement hit 0" warning from inet_twsk_kill().
Adding a grace period for the shared case would be costly on busy
hosts. It is not needed: struct net is freed by a later cleanup_net(),
after the synchronize_rcu() in ops_undo_list(), so inet_twsk_kill()
can safely drop the last tw_refcount reference itself.
Use refcount_dec_if_one() and only warn if tw_refcount is not 1
after a grace period.
Fixes: d1e5e6408b30 ("tcp: Introduce optional per-netns ehash.")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[edumazet: only call synchronize_net() if one netns in the batch uses a private ehash,
use refcount_dec_if_one() to avoid a false WARN with the shared ehash]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261030075843.2567707-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_ipv4.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0e6d03af09e5b..c88228c76920d 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -3392,6 +3392,7 @@ static int __net_init tcp_sk_init(struct net *net)
static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
{
+ bool synced = false;
struct net *net;
/* make sure concurrent calls to tcp_sk_exit_batch from net_cleanup_work
@@ -3406,9 +3407,27 @@ static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
tcp_twsk_purge(net_exit_list);
+ /* inet_twsk_kill() unhashes a twsk before it is done with ehash
+ * and bhash, and before it drops its tw_refcount reference,
+ * so tcp_twsk_purge() can miss it. Such callers run with BH
+ * disabled: wait for them before freeing a private ehash.
+ */
+ list_for_each_entry(net, net_exit_list, exit_list) {
+ if (net->ipv4.tcp_death_row.hashinfo->pernet) {
+ synchronize_net();
+ synced = true;
+ break;
+ }
+ }
+
list_for_each_entry(net, net_exit_list, exit_list) {
inet_pernet_hashinfo_free(net->ipv4.tcp_death_row.hashinfo);
- WARN_ON_ONCE(!refcount_dec_and_test(&net->ipv4.tcp_death_row.tw_refcount));
+ /* Without a grace period, a concurrent inet_twsk_kill() might
+ * still hold a tw_refcount reference. Let it drop it: struct net
+ * is freed by a later cleanup_net(), after an RCU grace period.
+ */
+ if (!refcount_dec_if_one(&net->ipv4.tcp_death_row.tw_refcount))
+ WARN_ON_ONCE(synced);
tcp_fastopen_ctx_destroy(net);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0103/1059] net: dsa: b53: Enable IGMP and MLD control packet CPU copies
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (101 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0102/1059] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0104/1059] net: ethernet: mediatek: preserve sibling PPE bindings Greg Kroah-Hartman
` (895 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 3362cb822ea750399a15b741713181fd8560bd17 ]
IGMPv2 reports and MLDv1 reports are addressed to the multicast group
itself. Once the first listener is installed in the ARL table, subsequent
reports can follow that entry without reaching the CPU. The bridge then
fails to learn additional listeners, although static MDB forwarding works.
Enable the high-level protocol classifiers so that IGMP and MLD control
packets are copied to the CPU independently of the multicast ARL lookup.
Retain normal L2 forwarding by clearing the CPU-only forwarding modes,
and preserve unrelated protocol-control fields.
Handle the BCM5395's 16-bit register and different classifier fields
separately from the 32-bit layout on the BCM531xx, BCM5301x and newer
integrated RoboSwitch families, including BCM7445, BCM7278 and BCM4908.
Export the helper and call it from bcm_sf2_sw_setup() as well, since SF2
uses its own setup operation instead of b53_setup(). This also restores
the classifiers after the switch reset on resume. Leave older devices
with different IGMP controls untouched, and propagate register access
failures during setup.
The SF2 setup integration and BCM4908 chip gate were updated with
assistance from OpenAI Codex in response to review feedback.
Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20261028235100.3892374-2-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 57 ++++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 1 +
drivers/net/dsa/b53/b53_regs.h | 17 ++++++++++
drivers/net/dsa/bcm_sf2.c | 5 +++
4 files changed, 80 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 7777d4cef351f..2e40e30d1c612 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -709,6 +709,59 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
}
EXPORT_SYMBOL(b53_brcm_hdr_setup);
+int b53_enable_mcast_snooping(struct b53_device *dev)
+{
+ u16 val16;
+ u32 val;
+ int ret;
+
+ /* Older switches use different IGMP controls, not HL_PRTC_CTRL. */
+ if (is5325(dev) || is5365(dev) || dev->chip_id == BCM5389_DEVICE_ID ||
+ is5397_98(dev) || is63xx(dev))
+ return 0;
+
+ /* IGMPv2 and MLDv1 reports use the group's destination MAC. Once
+ * the first listener is offloaded, ordinary multicast forwarding
+ * can keep subsequent reports from reaching the bridge CPU.
+ */
+
+ /* BCM5395 has a narrower register and a single IGMP classifier.
+ * Its ICMPv6 classifier also covers MLD.
+ */
+ if (dev->chip_id == BCM5395_DEVICE_ID) {
+ ret = b53_read16(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, &val16);
+ if (ret)
+ return ret;
+
+ val16 |= HL_PRTC_IGMP_IP_EN_5395 | HL_PRTC_ICMPV6_EN;
+ /* Zero forwarding modes copy control traffic to the CPU
+ * independently of the ARL lookup, retaining L2 forwarding.
+ */
+ val16 &= ~(HL_PRTC_IGMP_FWD_MODE_5395 |
+ HL_PRTC_ICMPV6_FWD_MODE);
+
+ return b53_write16(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL,
+ val16);
+ }
+
+ ret = b53_read32(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, &val);
+ if (ret)
+ return ret;
+
+ val |= HL_PRTC_IGMP_RPTLVE_EN | HL_PRTC_IGMP_QRY_EN |
+ HL_PRTC_IGMP_UKN_EN | HL_PRTC_MLD_RPTDONE_EN |
+ HL_PRTC_MLD_QRY_EN;
+ /* Zero forwarding modes copy control traffic to the CPU
+ * independently of the ARL lookup, retaining L2 forwarding.
+ */
+ val &= ~(HL_PRTC_IGMP_RPTLVE_FWD_MODE | HL_PRTC_IGMP_QRY_FWD_MODE |
+ HL_PRTC_IGMP_UKN_FWD_MODE | HL_PRTC_MLD_RPTDONE_FWD_MODE |
+ HL_PRTC_MLD_QRY_FWD_MODE);
+
+ return b53_write32(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, val);
+}
+EXPORT_SYMBOL(b53_enable_mcast_snooping);
+
static void b53_enable_cpu_port(struct b53_device *dev, int port)
{
u8 port_ctrl;
@@ -1159,6 +1212,10 @@ static int b53_setup(struct dsa_switch *ds)
b53_disable_port(ds, port);
}
+ ret = b53_enable_mcast_snooping(dev);
+ if (ret)
+ return ret;
+
return b53_setup_devlink_resources(ds);
}
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 795cbffd5c2be..30a1b563c24ce 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -323,6 +323,7 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
/* Exported functions towards other drivers */
void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
int b53_configure_vlan(struct dsa_switch *ds);
+int b53_enable_mcast_snooping(struct b53_device *dev);
void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
uint8_t *data);
void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index 95f70248c194d..0b4343fcfcfd8 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -255,6 +255,23 @@
/* Revision ID register (8 bit) */
#define B53_REV_ID 0x40
+/* High-level protocol control (16 bit on BCM5395, otherwise 32 bit) */
+#define B53_HL_PRTC_CTRL 0x50
+#define HL_PRTC_ICMPV6_EN BIT(4)
+#define HL_PRTC_ICMPV6_FWD_MODE BIT(5)
+#define HL_PRTC_IGMP_IP_EN_5395 BIT(6)
+#define HL_PRTC_IGMP_FWD_MODE_5395 BIT(8)
+#define HL_PRTC_IGMP_RPTLVE_EN BIT(9)
+#define HL_PRTC_IGMP_RPTLVE_FWD_MODE BIT(10)
+#define HL_PRTC_IGMP_QRY_EN BIT(11)
+#define HL_PRTC_IGMP_QRY_FWD_MODE BIT(12)
+#define HL_PRTC_IGMP_UKN_EN BIT(13)
+#define HL_PRTC_IGMP_UKN_FWD_MODE BIT(14)
+#define HL_PRTC_MLD_RPTDONE_EN BIT(15)
+#define HL_PRTC_MLD_RPTDONE_FWD_MODE BIT(16)
+#define HL_PRTC_MLD_QRY_EN BIT(17)
+#define HL_PRTC_MLD_QRY_FWD_MODE BIT(18)
+
/* Broadcom header RX control (16 bit) */
#define B53_BRCM_HDR_RX_DIS 0x60
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 7defcfd1c213f..b3feb6e36629a 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1050,6 +1050,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
unsigned int port;
+ int ret;
/* Enable all valid ports and disable those unused */
for (port = 0; port < priv->hw_params.num_ports; port++) {
@@ -1065,6 +1066,10 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
b53_configure_vlan(ds);
bcm_sf2_enable_acb(ds);
+ ret = b53_enable_mcast_snooping(priv->dev);
+ if (ret)
+ return ret;
+
return b53_setup_devlink_resources(ds);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0104/1059] net: ethernet: mediatek: preserve sibling PPE bindings
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (102 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0103/1059] net: dsa: b53: Enable IGMP and MLD control packet CPU copies Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0105/1059] nvmet-rdma: disconnect only established queues Greg Kroah-Hartman
` (894 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Goodkind, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Goodkind <alex@goodkind.io>
[ Upstream commit 34cc22a9ce6ae0228dcd09a57df23aea62e22b04 ]
__mtk_ppe_check_skb() clears entry->hash for flows bound to other
hardware slots in the same software hash bucket. mtk_flow_offload_stats()
then skips their hardware counter updates. L2 cleanup also frees sibling
subflows without invalidating their hardware rules.
Restrict both cleanup paths to entries assigned to the inspected slot.
Two UDP trials reproduced the counter failure on a GL-MT3000/MT7981
running unmodified OpenWrt 25.12.5 with Linux 6.12.94:
1. Start a UDP connection.
2. Add a control connection in a different hash bucket.
3. Add a connection in the first connection's hash bucket.
AI code review of the original patch identified the cleanup problem
in L2 subflows.
Full ARM64 builds with allmodconfig and allyesconfig passed before
and after the patch using GCC 14.2.0 and W=1, without new warnings.
The builds used CONFIG_WERROR=n because the unmodified ARM64 kernel
already emits warnings. Hardware testing has not run for this revision.
Fixes: c4f033d9e03e ("net: ethernet: mtk_eth_soc: rework hardware flow table management")
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Link: https://github.com/openwrt/openwrt/pull/26107
Signed-off-by: Alexander Goodkind <alex@goodkind.io>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261030010517.45639-1-alex@goodkind.io
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index c64211e22ae70..baf9754999fd0 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -645,8 +645,7 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
hlist_for_each_entry_safe(entry, n, head, list) {
if (entry->type == MTK_FLOW_TYPE_L2_SUBFLOW) {
- if (unlikely(FIELD_GET(MTK_FOE_IB1_STATE, hwe->ib1) ==
- MTK_FOE_STATE_BIND))
+ if (entry->hash != hash)
continue;
entry->hash = 0xffff;
@@ -655,7 +654,7 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
}
if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) {
- if (entry->hash != 0xffff)
+ if (entry->hash == hash)
entry->hash = 0xffff;
continue;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0105/1059] nvmet-rdma: disconnect only established queues
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (103 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0104/1059] net: ethernet: mediatek: preserve sibling PPE bindings Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0106/1059] nvmet-tcp: limit the connections accepted per work run Greg Kroah-Hartman
` (893 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 000a9f4492abad6008682b55571ddc31941963e3 ]
Over iWARP, rdma_disconnect() sleeps in iw_cm_disconnect() until the
ESTABLISHED event of the connection has been handled, and iw_cm handles
all events of all connections one at a time on iw_cm_wq.
nvmet_rdma_destroy_port_queues(), nvmet_rdma_remove_one() and
nvmet_rdma_delete_ctrl() walk the queue list with
nvmet_rdma_queue_mutex held and call rdma_disconnect() for each, while
nvmet_rdma_cm_handler() takes the same mutex. If the walk sleeps on a
queue whose ESTABLISHED is queued behind another queue's event, both
are stuck and iWARP connection handling is dead until reboot. A peer
sets that up by connecting in a loop, or over siw by asking for MPA
peer-to-peer mode and then staying silent, which delays ESTABLISHED
indefinitely.
Only call rdma_disconnect() for a queue in NVMET_RDMA_Q_LIVE, which the
handler sets when it gets ESTABLISHED. A queue that never got there is
left to the release work: ib_drain_qp() moves the QP to the error
state, which ends the connection, and rdma_destroy_id() tells the peer.
Over IB and RoCE the skipped call did nothing more than that.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Fixes: fcf73a804c7d ("nvmet-rdma: fix use-after-free when a port is removed")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 87f1a4b6f4b9e..7e595b8dcdc75 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1691,7 +1691,7 @@ static void nvmet_rdma_queue_established(struct nvmet_rdma_queue *queue)
static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
{
- bool disconnect = false;
+ bool disconnect = false, live = false;
unsigned long flags;
pr_debug("cm_id= %p queue->state= %d\n", queue->cm_id, queue->state);
@@ -1710,6 +1710,7 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
}
fallthrough;
case NVMET_RDMA_Q_LIVE:
+ live = queue->state == NVMET_RDMA_Q_LIVE;
queue->state = NVMET_RDMA_Q_DISCONNECTING;
disconnect = true;
break;
@@ -1719,7 +1720,17 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
spin_unlock_irqrestore(&queue->state_lock, flags);
if (disconnect) {
- rdma_disconnect(queue->cm_id);
+ /*
+ * Over iWARP rdma_disconnect() sleeps until the CM has handled
+ * the ESTABLISHED event of this connection. The CM handles the
+ * events of all connections one at a time, and our handler
+ * takes nvmet_rdma_queue_mutex, which callers of this function
+ * hold. So a queue that has not seen the event is left to the
+ * release work: ib_drain_qp() moves the queue pair to the error
+ * state, which ends the connection.
+ */
+ if (live)
+ rdma_disconnect(queue->cm_id);
queue_work(nvmet_wq, &queue->release_work);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0106/1059] nvmet-tcp: limit the connections accepted per work run
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (104 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0105/1059] nvmet-rdma: disconnect only established queues Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0107/1059] nvmet-rdma: take a device off the list last Greg Kroah-Hartman
` (892 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Hannes Reinecke, Josef Bacik, Jens Axboe,
Keith Busch, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit a029f1b2fb13e6ac6e1c2f27fba1d80b6e7cac51 ]
nvmet_tcp_accept_work() loops until there's nothing left to accept, and
anyone opening and closing connections fast enough keeps it running
indefinitely, since tearing down a dead connection takes long enough for
more to arrive. Whoever flushes nvmet_wq waits for it: removing any
other port of the target does in nvmet_port_release(), and so does
unloading the rdma and fc modules.
Accept a bounded number of connections per run and requeue the work. A
flush doesn't wait for work queued behind it.
Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/tcp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 608464d2f308b..e01eb43c7fbab 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -43,6 +43,7 @@ MODULE_PARM_DESC(idle_poll_period_usecs,
#define NVMET_TCP_RECV_BUDGET 8
#define NVMET_TCP_SEND_BUDGET 8
#define NVMET_TCP_IO_WORK_BUDGET 64
+#define NVMET_TCP_ACCEPT_BUDGET 16
enum nvmet_tcp_send_state {
NVMET_TCP_SEND_DATA_PDU,
@@ -1765,9 +1766,9 @@ static void nvmet_tcp_accept_work(struct work_struct *w)
struct nvmet_tcp_port *port =
container_of(w, struct nvmet_tcp_port, accept_work);
struct socket *newsock;
- int ret;
+ int ret, i;
- while (true) {
+ for (i = 0; i < NVMET_TCP_ACCEPT_BUDGET; i++) {
ret = kernel_accept(port->sock, &newsock, O_NONBLOCK);
if (ret < 0) {
if (ret != -EAGAIN)
@@ -1780,6 +1781,9 @@ static void nvmet_tcp_accept_work(struct work_struct *w)
sock_release(newsock);
}
}
+
+ /* There may be more. Come to an end for those who flush nvmet_wq. */
+ queue_work(nvmet_wq, &port->accept_work);
}
static void nvmet_tcp_listen_data_ready(struct sock *sk)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0107/1059] nvmet-rdma: take a device off the list last
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (105 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0106/1059] nvmet-tcp: limit the connections accepted per work run Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:53 ` [PATCH 6.1 0108/1059] nvmet-rdma: queue the release work under the mutex Greg Kroah-Hartman
` (891 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 86ae3841aea4e29d7ac08d5614ca3823dc8dfbc9 ]
nvmet_rdma_remove_one() disconnects the queues of a device and flushes
nvmet-wq, but since commit a3dd7d0022c3 it returns right away if the
device isn't on device_list. nvmet_rdma_free_dev(), run by the release
work of the last queue, takes the device off that list first and frees
the SRQs and the PD afterwards. A device removal in between finds
nothing on the list, returns, and the RDMA core frees the device under
ib_dealloc_pd().
Free the SRQs and the PD first and unlist the device last, so the
remove callback finds it and its flush waits for the release work.
Fixes: a3dd7d0022c3 ("nvmet-rdma: Don't flush system_wq by default during remove_one")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 7e595b8dcdc75..53214a092c62f 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1200,13 +1200,18 @@ static void nvmet_rdma_free_dev(struct kref *ref)
struct nvmet_rdma_device *ndev =
container_of(ref, struct nvmet_rdma_device, ref);
+ nvmet_rdma_destroy_srqs(ndev);
+ ib_dealloc_pd(ndev->pd);
+
+ /*
+ * Only delete from the device list once all RDMA resources are torn
+ * down because nvmet_rdma_remove_one waits for the release work only
+ * if the device still is on the list.
+ */
mutex_lock(&device_list_mutex);
list_del(&ndev->entry);
mutex_unlock(&device_list_mutex);
- nvmet_rdma_destroy_srqs(ndev);
- ib_dealloc_pd(ndev->pd);
-
kfree(ndev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0108/1059] nvmet-rdma: queue the release work under the mutex
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (106 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0107/1059] nvmet-rdma: take a device off the list last Greg Kroah-Hartman
@ 2026-12-04 9:53 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0109/1059] nvme: fix various comment typos Greg Kroah-Hartman
` (890 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:53 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 80095787f776967361cca76357f19e5445e0cd75 ]
nvmet_rdma_remove_one() takes the queue mutex, unlists each queue of
the device and queues its release work, then flushes nvmet-wq. So a
queue that still holds objects on the device must either be on the
list or have its release work queued. nvmet_rdma_queue_disconnect()
breaks that: it unlists the queue under the mutex, drops it, and only
then calls __nvmet_rdma_queue_disconnect() to queue the work. A device
removal in that window finds nothing to wait for, and the release work
then destroys the QP and CQ share on a freed device.
Queue the work before dropping the mutex, as nvmet_rdma_remove_one()
itself does. That's safe now that rdma_disconnect() no longer sleeps on
an iWARP event that needs the same mutex.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 53214a092c62f..d99d76a327559 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1742,17 +1742,17 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
{
- bool disconnect = false;
-
+ /*
+ * Queue the release work with &nvmet_rdma_queue_mutex held, so that
+ * nvmet_rdma_remove_one() either finds the queue on the list or the
+ * work has already been queued.
+ */
mutex_lock(&nvmet_rdma_queue_mutex);
if (!list_empty(&queue->queue_list)) {
list_del_init(&queue->queue_list);
- disconnect = true;
+ __nvmet_rdma_queue_disconnect(queue);
}
mutex_unlock(&nvmet_rdma_queue_mutex);
-
- if (disconnect)
- __nvmet_rdma_queue_disconnect(queue);
}
static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0109/1059] nvme: fix various comment typos
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (107 preceding siblings ...)
2026-12-04 9:53 ` [PATCH 6.1 0108/1059] nvmet-rdma: queue the release work under the mutex Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0110/1059] nvmet-rdma: disconnect a queue on device removal Greg Kroah-Hartman
` (889 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bjorn Helgaas, Chaitanya Kulkarni,
Christoph Hellwig, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <bhelgaas@google.com>
[ Upstream commit 367c240b0a99c7ada700a44345dd3144a02b6164 ]
Fix typos in comments.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: a4387799d422 ("nvmet-rdma: disconnect a queue on device removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/fc.c | 4 ++--
drivers/nvme/host/tcp.c | 2 +-
drivers/nvme/target/fc.c | 6 +++---
drivers/nvme/target/rdma.c | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index d18b2dae1ba8c..c57b209744f61 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1405,7 +1405,7 @@ nvme_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status)
* down, and the related FC-NVME Association ID and Connection IDs
* become invalid.
*
- * The behavior of the fc-nvme initiator is such that it's
+ * The behavior of the fc-nvme initiator is such that its
* understanding of the association and connections will implicitly
* be torn down. The action is implicit as it may be due to a loss of
* connectivity with the fc-nvme target, so you may never get a
@@ -2800,7 +2800,7 @@ nvme_fc_queue_rq(struct blk_mq_hw_ctx *hctx,
* as WRITE ZEROES will return a non-zero rq payload_bytes yet
* there is no actual payload to be transferred.
* To get it right, key data transmission on there being 1 or
- * more physical segments in the sg list. If there is no
+ * more physical segments in the sg list. If there are no
* physical segments, there is no payload.
*/
if (blk_rq_nr_phys_segments(rq)) {
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d434c24e035d5..35ff25745d818 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1983,7 +1983,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
/*
* Only start IO queues for which we have allocated the tagset
- * and limitted it to the available queues. On reconnects, the
+ * and limited it to the available queues. On reconnects, the
* queue number might have changed.
*/
nr_queues = min(ctrl->tagset->nr_hw_queues + 1, ctrl->queue_count);
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 4539e25963afc..cdc1a8b7897ab 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -460,7 +460,7 @@ nvmet_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status)
* down, and the related FC-NVME Association ID and Connection IDs
* become invalid.
*
- * The behavior of the fc-nvme target is such that it's
+ * The behavior of the fc-nvme target is such that its
* understanding of the association and connections will implicitly
* be torn down. The action is implicit as it may be due to a loss of
* connectivity with the fc-nvme host, so the target may never get a
@@ -2290,7 +2290,7 @@ nvmet_fc_transfer_fcp_data(struct nvmet_fc_tgtport *tgtport,
ret = tgtport->ops->fcp_op(&tgtport->fc_target_port, fod->fcpreq);
if (ret) {
/*
- * should be ok to set w/o lock as its in the thread of
+ * should be ok to set w/o lock as it's in the thread of
* execution (not an async timer routine) and doesn't
* contend with any clearing action
*/
@@ -2608,7 +2608,7 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
* and the api of the FC LLDD which may issue a hw command to send the
* response, but the LLDD may not get the hw completion for that command
* and upcall the nvmet_fc layer before a new command may be
- * asynchronously received - its possible for a command to be received
+ * asynchronously received - it's possible for a command to be received
* before the LLDD and nvmet_fc have recycled the job structure. It gives
* the appearance of more commands received than fits in the sq.
* To alleviate this scenario, a temporary queue is maintained in the
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index d99d76a327559..9bf61e7448e41 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1782,7 +1782,7 @@ static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
* We registered an ib_client to handle device removal for queues,
* so we only need to handle the listening port cm_ids. In this case
* we nullify the priv to prevent double cm_id destruction and destroying
- * the cm_id implicitely by returning a non-zero rc to the callout.
+ * the cm_id implicitly by returning a non-zero rc to the callout.
*/
static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
struct nvmet_rdma_queue *queue)
@@ -1793,7 +1793,7 @@ static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
/*
* This is a queue cm_id. we have registered
* an ib_client to handle queues removal
- * so don't interfear and just return.
+ * so don't interfere and just return.
*/
return 0;
}
@@ -1811,7 +1811,7 @@ static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
/*
* We need to return 1 so that the core will destroy
- * it's own ID. What a great API design..
+ * its own ID. What a great API design..
*/
return 1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0110/1059] nvmet-rdma: disconnect a queue on device removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (108 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0109/1059] nvme: fix various comment typos Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0111/1059] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer Greg Kroah-Hartman
` (888 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit a4387799d4228866dc1746b466cd17e1c638d050 ]
cma_remove_one() sends DEVICE_REMOVAL to the owner of every cm_id on
the device and then waits, without timeout, until they're all
destroyed. nvmet_rdma_device_removal() does nothing for a queue cm_id
and leaves the queues to nvmet_rdma_remove_one(), which only works if
that runs first. As a module it does, nvmet-rdma registers after
rdma_cm. Built in, both register at the same initcall level and
drivers/Makefile lists nvme/ ahead of infiniband/, so cma_remove_one()
runs first and waits for cm_ids that only the later callback would
destroy. Since the RDMA CM drops all later events for a cm_id once it
has sent DEVICE_REMOVAL, a peer closing its connection doesn't help
either. One connection from anyone who can reach the port hangs "rdma
link delete" until something else ends the queue.
Call nvmet_rdma_queue_disconnect() for the queue. It unlists the queue
and queues the release work, which destroys the cm_id. Don't wait for
it, rdma_destroy_id() waits for the handler to return, which was the
deadlock before commit f1d4ef7d8883.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 9bf61e7448e41..f3a4123b1d69b 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1779,10 +1779,13 @@ static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
* queue cm_id and/or a device bound listener cm_id (where in this
* case queue will be null).
*
- * We registered an ib_client to handle device removal for queues,
- * so we only need to handle the listening port cm_ids. In this case
- * we nullify the priv to prevent double cm_id destruction and destroying
- * the cm_id implicitly by returning a non-zero rc to the callout.
+ * The RDMA CM waits until each cm_id of the device is destroyed, so a queue
+ * has to go now. Our ib_client also removes the queues, but it cannot be
+ * relied on here: built in, it is called after the RDMA CM's client.
+ *
+ * For a listening port cm_id we nullify the priv to prevent double cm_id
+ * destruction and destroying the cm_id implicitly by returning a non-zero
+ * rc to the callout.
*/
static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
struct nvmet_rdma_queue *queue)
@@ -1790,11 +1793,7 @@ static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
struct nvmet_rdma_port *port;
if (queue) {
- /*
- * This is a queue cm_id. we have registered
- * an ib_client to handle queues removal
- * so don't interfere and just return.
- */
+ nvmet_rdma_queue_disconnect(queue);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0111/1059] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer.
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (109 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0110/1059] nvmet-rdma: disconnect a queue on device removal Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0112/1059] net: skbuff: reject zero MPLS TTL before decrementing Greg Kroah-Hartman
` (887 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tom Williams, Guillaume Nault,
Kuniyuki Iwashima, Neal Cardwell, Eric Dumazet, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <gnault@redhat.com>
[ Upstream commit 11140c51df12e594d6bf2c8d2af5dec63b0219ac ]
When receiving a pure ack from a peer that also sends data, we can
have SEG.SEQ > SND.WL1, even though the segment contains no data. This
makes tcp_may_update_window() return true (because of the
"after(ack_seq, tp->snd_wl1)" condition), and tcp_ack_update_window()
then adds FLAG_WIN_UPDATE to the segment set of flags, even when
there's no window update.
Since FLAG_WIN_UPDATE prevents the segment from being considered as
dup-ack (as it's part of FLAG_NOT_DUP), this can inhibit fast
retransmit on non-SACK connections, making recovery very slow as it
now entirely relies on RTO.
The "DUPLICATE ACKNOWLEDGMENT" definition of RFC 5681, section 2,
says that lack of window update is a necessary condition for a dup ack:
"(e) the advertised window in the incoming acknowledgment equals the
advertised window in the last incoming acknowledgment.". Spurious
window updates can thus prevent dup ack detection and, in the end, fast
retransmit.
Avoid this scenario by setting FLAG_WIN_UPDATE only when a window
update actually occurs. Pure acks with SEG.SEQ > SND.WL1 can now
be detected as dup-ack and trigger fast retransmission.
Also, stop setting FLAG_WIN_UPDATE in tcp_ack()'s header prediction
path. One of the conditions for header prediction to happen is that
received segments don't trigger a window update. This flag update was
thus wrong to begin with. Now that tcp_ack_update_window() sets
FLAG_WIN_UPDATE only if a window update actually occurred, we need the
header prediction path to stop reporting spurious window updates too.
Otherwise BPF programs would get inconsistent window update information
(CA_ACK_WIN_UPDATE) between fast an slow paths.
Finally, add FLAG_SND_UNA_ADVANCED to the definition of FLAG_NOT_DUP.
This is necessary for the case where an incoming segment acknowledges
less than a full segment of the retransmit queue. Such segments were
not considered dubious by tcp_ack_is_dubious() because of the spurious
FLAG_WIN_UPDATE flag, which prevented the segment from being seen as a
duplicate ack. Now that FLAG_WIN_UPDATE doesn't cover this scenario
anymore, we need another way to mark these acks as non-duplicate.
Adding FLAG_SND_UNA_ADVANCED to FLAG_NOT_DUP is the natural way of
doing this, since, by definition, a segment advancing SND.UNA, even by
a small amount, cannot be a duplicate ack.
A side effect of this patch is that repeated zero window acks received
from peer can now be considered duplicate acks (because of the the
"|| !win" condition in tcp_may_update_window()). Therefore, they can
now trigger fast retransmission and fast recovery, including congestion
window reduction, when the peer is stalled. This is RFC compliant and
shouldn't have any negative effect.
Add packetdrill selftest. Before this patch, the 1001:2001 segment was
retransmitted upon RTO, now it's sent right after reception of the
third duplicate ack.
Thanks to Tom Williams for the investigation help and initial
reproducer.
Reported-by: Tom Williams <Tom.D.Williams@MorganStanley.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/6426d558e45fc6ab724c40af62e4a8793215dd8a.1793219189.git.gnault@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 6 +--
.../tcp_bidir_fast_retransmit_nosack.pkt | 42 +++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cdd918198d0e6..63fb1d5372030 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -103,7 +103,8 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE;
#define FLAG_DSACK_TLP 0x20000 /* DSACK for tail loss probe */
#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
-#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
+#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED| \
+ FLAG_SND_UNA_ADVANCED)
#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE|FLAG_DSACKING_ACK)
#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
@@ -3638,11 +3639,11 @@ static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32
nwin <<= tp->rx_opt.snd_wscale;
if (tcp_may_update_window(tp, ack, ack_seq, nwin)) {
- flag |= FLAG_WIN_UPDATE;
tcp_update_wl(tp, ack_seq);
if (tp->snd_wnd != nwin) {
tp->snd_wnd = nwin;
+ flag |= FLAG_WIN_UPDATE;
/* Note, it is the only place, where
* fast path is recovered for sending TCP.
@@ -3956,7 +3957,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
*/
tcp_update_wl(tp, ack_seq);
tcp_snd_una_update(tp, ack);
- flag |= FLAG_WIN_UPDATE;
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPACKS);
} else {
diff --git a/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt b/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
new file mode 100644
index 0000000000000..5c66b7171d229
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Verify that non-SACK connections properly detect duplicate acks when mixed
+// with other data segments from peer.
+
+`./defaults.sh`
+
+ 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
+ +0...0 connect(4, ..., ...) = 0
+
+ // Three-way handshake, SACK not supported by peer
+ +0 > S 0:0(0) <mss 1460,sackOK,TS val 0 ecr 0,nop,wscale 8>
+ +0 < S. 0:0(0) ack 1 win 65535 <mss 1000>
+ +0 > . 1:1(0) ack 1
+
+ // Send 1000 bytes, peer acks everything
+ +0 send(4, ..., 1000, 0) = 1000
+ +0 > P. 1:1001(1000) ack 1
+ +0 < . 1:1(0) ack 1001 win 65535
+
+ // Send 4000 more bytes
+ +0 send(4, ..., 4000, 0) = 4000
+ +0 > P. 1001:5001(4000) ack 1
+
+ // Receive first dup-ack (considering segment 1001-2001 was lost)
+ +0 < . 1:1(0) ack 1001 win 65535
+
+ // Receive unrelated data segment from peer and ack it
+ +0 < P. 1:11(10) ack 1001 win 65535
+ +0 > . 5001:5001(0) ack 11
+
+ // Receive second dup-ack
+ +0 < . 11:11(0) ack 1001 win 65535
+
+ // Receive another data segment from peer and ack it
+ +0 < P. 11:21(10) ack 1001 win 65535
+ +0 > . 5001:5001(0) ack 21
+
+ // Receive third dup-ack, which should trigger fast retransmit (without
+ // waiting for RTO)
+ +0 < . 21:21(0) ack 1001 win 65535
+ +0 > . 1001:2001(1000) ack 21
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0112/1059] net: skbuff: reject zero MPLS TTL before decrementing
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (110 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0111/1059] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0113/1059] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove Greg Kroah-Hartman
` (886 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Xia Yan, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 24614e72df484ad50ecba98aaa88c7df2448c122 ]
skb_mpls_dec_ttl() decrements the u8 TTL before checking whether it
expired. An incoming TTL of zero wraps to 255, causing the TC MPLS
dec_ttl action to pass an expired packet instead of dropping it.
Reject a zero TTL before the decrement while preserving the existing
behavior for TTL one and valid TTL values.
Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261031114135.3784868-2-thnkslprpt@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 96286a16199b0..7a1dd29e80b8e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6170,7 +6170,7 @@ int skb_mpls_dec_ttl(struct sk_buff *skb)
lse = be32_to_cpu(mpls_hdr(skb)->label_stack_entry);
ttl = (lse & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT;
- if (!--ttl)
+ if (!ttl || !--ttl)
return -EINVAL;
lse &= ~MPLS_LS_TTL_MASK;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0113/1059] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (111 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0112/1059] net: skbuff: reject zero MPLS TTL before decrementing Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0114/1059] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow() Greg Kroah-Hartman
` (885 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhou Minqiang, Rafael J. Wysocki,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Minqiang <zhouminqiang2@huawei.com>
[ Upstream commit 1f65b45f0f16e1c80a68a5757c9556f78bb39f19 ]
When a WQ_MEM_RECLAIM workqueue (e.g. iscsi_ctrl) triggers device removal
via device_del -> pm_runtime_remove, the unconditional flush_work inside
pm_runtime_remove can trigger a check_flush_dependency warning:
CPU1: pm_wq worker CPU2: iscsi_ctrl wq
-------- --------
pm_runtime_work(starget) pm_runtime_remove(starget)
spin_lock_irq(&starget->lock) __pm_runtime_disable(starget, false)
request_pending = false spin_lock_irq(&starget->lock)
(blocked, CPU1 holds the lock)
rpm_suspend(starget, RPM_NOWAIT)
status = RPM_SUSPENDING
rpm_callback(cb, starget)
spin_unlock_irq(&starget->lock)
(acquires lock)
disable_depth 0→1
__pm_runtime_barrier():
request_pending == false
→ skip cancel_work_sync
status == RPM_SUSPENDING
→ enter wait_queue, sleep
spin_unlock_irq(&starget->lock)
cb(starget) → 0
spin_lock_irq(&starget->lock)
status = RPM_SUSPENDED
wake_up_all(&wait_queue)
(woken up, waiting for lock)
spin_unlock(&starget->lock) spin_lock_irq(&starget->lock)
status == RPM_SUSPENDED
spin_lock(&parent->lock) → exit wait_queue
rpm_idle(parent, RPM_ASYNC) barrier returns
spin_unlock(&parent->lock) flush_work(&starget->work)
spin_lock(&starget->lock) __flush_work(from_cancel=false)
spin_unlock_irq(&starget->lock) check_flush_dependency()
← WARNING!
Replace flush_work with cancel_work_sync in pm_runtime_remove.
cancel_work_sync internally calls __flush_work with from_cancel=true,
which causes check_flush_dependency to return early before the warning.
This preserves the use-after-free fix from commit 29ab76827761
("PM: runtime: Fix a race condition related to device removal")
without the warning.
Fixes: 29ab76827761 ("PM: runtime: Fix a race condition related to device removal")
Signed-off-by: Zhou Minqiang <zhouminqiang2@huawei.com>
Link: https://patch.msgid.link/20261104115641.2682786-1-zhouminqiang2@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/power/runtime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index ca86d7bf804ca..b4d7fcae5e5b7 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1813,7 +1813,7 @@ void pm_runtime_reinit(struct device *dev)
void pm_runtime_remove(struct device *dev)
{
__pm_runtime_disable(dev, false);
- flush_work(&dev->power.work);
+ cancel_work_sync(&dev->power.work);
pm_runtime_reinit(dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0114/1059] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow().
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (112 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0113/1059] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0115/1059] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence Greg Kroah-Hartman
` (884 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jason Zhang, Kuniyuki Iwashima,
Ido Schimmel, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 4019af3afd72864ec6abbfde2d76e416a64456c2 ]
Since the cited commit, ip_route_input_slow() could call
rt_dst_alloc() with vrf in the local_input: path.
If res->fi != NULL and one of the following is true,
- a non-zero itag from fib_validate_source_reason()
(realms/classid)
- RTN_BROADCAST with BC_FORWARDING enabled
do_cache is set to false.
Then, the route is not added to rt_uncached_list, so the
route cannot be removed from rt_flush_dev().
If the route is cached in sk->sk_rx_dst, removing the
vrf device gets stuck. [0]
Let's call rt_add_uncached_list() if !do_cache in
ip_route_input_slow().
[0]:
unregister_netdevice: waiting for vrf0 to become free. Usage count = 2
ref_tracker: netdev@000000008b304ac4 has 1/1 users at
dst_alloc+0x14b/0x490
ip_route_input_rcu+0x1540/0x2530
ip_route_input_noref+0x5a/0x90
ip_rcv_finish_core+0x4b0/0x1140
ip_rcv_finish+0xe6/0x190
ip_rcv+0x6c/0x130
__netif_receive_skb+0x121/0x300
process_backlog+0x2df/0x5e0
__napi_poll+0x8c/0x380
net_rx_action+0x43c/0xab0
handle_softirqs+0x19f/0x520
do_softirq+0x46/0x60
__local_bh_enable_ip+0x79/0x80
__dev_queue_xmit+0x1b0e/0x24c0
ip_finish_output2+0x8b2/0xcd0
ip_output+0xf2/0x1e0
Fixes: f5a0aab84b74 ("net: ipv4: dst for local input routes should use l3mdev if relevant")
Reported-by: Jason Zhang <jdz@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261101064418.2055158-4-kuniyu@google.com
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/route.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index dd3ab1b5fdfe4..fa2d3f4490a6d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2460,6 +2460,8 @@ out: return err;
if (unlikely(!rt_cache_route(nhc, rth)))
rt_add_uncached_list(rth);
+ } else {
+ rt_add_uncached_list(rth);
}
skb_dst_set(skb, &rth->dst);
err = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0115/1059] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (113 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0114/1059] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0116/1059] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path Greg Kroah-Hartman
` (883 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nathan Blomquist, Alex Deucher,
Mario Limonciello, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <mario.limonciello@amd.com>
[ Upstream commit a26ec190925733dd205507493e936e59dbcd2b19 ]
On Navi1x/Sienna Cichlid with runtime PM, when the audio function is
enabled, BACO entry and exit are delegated to PMFW by sending
SMU_MSG_ArmD3 instead of going through smu_v11_0_baco_set_state().
Unlike the v13/v14/v15 helpers, smu_v11_0_baco_set_armd3_sequence()
does not update smu_baco->state, so the driver keeps reporting
SMU_BACO_STATE_EXIT while the ASIC is armed for / sitting in BACO.
At runtime resume amdgpu_device_baco_exit() checks
amdgpu_device_supports_baco(), which ends up in
smu_v11_0_get_bamaco_support(). Since the state never reads ENTER, the
"already in BACO" shortcut is skipped and the live BACO feature bit is
consulted instead. PMFW clears that bit once ArmD3(BACO) is armed, so
the check reports "supported but not enabled", the exit fails with
-ENOTSUPP and the ULPS ArmD3 message is never sent. The runtime resume
caller ignores the error, and a later secondary bus reset leaves the
device unreachable. This shows up on a Navi 23 being handed from amdgpu
to vfio-pci:
baco_enter: in_runpm=1 audio_enabled=1 armd3=1 baco_state=1 ret=0
bamaco: state=1 ... feat supported=1 enabled=0 in_runpm=1
baco_exit: supports=0 ...
runtime resume: baco_exit ret=-524
Update smu_baco->state in the helper, mirroring the v13 implementation,
so the capability check short-circuits while in BACO.
Reported-by: Nathan Blomquist <nblomquist@gmail.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/6076
Tested-by: Nathan Blomquist <nblomquist@gmail.com>
Fixes: 13d75eadfa1a ("drm/amd/pm: correct the runpm handling for BACO supported ASIC")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patch.msgid.link/20261103141457.2558235-1-mario.limonciello@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d515b2694eab5b35533c7fb7af5bddff53ff60d3)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 6c10140b15ccc..1e998adc7e295 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1575,7 +1575,25 @@ int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)
int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu,
enum smu_baco_seq baco_seq)
{
- return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ArmD3, baco_seq, NULL);
+ struct smu_baco_context *smu_baco = &smu->smu_baco;
+ int ret;
+
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ArmD3, baco_seq, NULL);
+ if (ret)
+ return ret;
+
+ /*
+ * PMFW owns the BACO transition once armed, so keep the driver's view
+ * in sync. Otherwise smu_v11_0_get_bamaco_support() falls back to the
+ * live BACO feature bit, which PMFW clears when armed, and the runtime
+ * resume wrongly concludes BACO is unsupported and skips the exit.
+ */
+ if (baco_seq == BACO_SEQ_BAMACO || baco_seq == BACO_SEQ_BACO)
+ smu_baco->state = SMU_BACO_STATE_ENTER;
+ else
+ smu_baco->state = SMU_BACO_STATE_EXIT;
+
+ return 0;
}
bool smu_v11_0_baco_is_support(struct smu_context *smu)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0116/1059] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (114 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0115/1059] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0117/1059] ACPI: scan: Print the offline failure message in acpi_bus_offline() Greg Kroah-Hartman
` (882 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
[ Upstream commit 39d31f76ad1b12f1b5e6ef4c15f89e6b3c3f603a ]
If cs_dsp_power_up() fails on or after cs_dsp_load() mark the controls
disabled and free the alg regions.
Fixes: f6bc909e7673c ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20261104152402.1153795-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/cirrus/cs_dsp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index e7988e29a0006..dbf80267c5f89 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -2635,6 +2635,7 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
const struct firmware *coeff_firmware, char *coeff_filename,
const char *fw_name)
{
+ struct cs_dsp_coeff_ctl *ctl;
int ret;
mutex_lock(&dsp->pwr_lock);
@@ -2679,6 +2680,11 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
return 0;
err_ena:
+ list_for_each_entry(ctl, &dsp->ctl_list, list)
+ ctl->enabled = 0;
+
+ cs_dsp_free_alg_regions(dsp);
+
if (dsp->ops->disable_core)
dsp->ops->disable_core(dsp);
err_mem:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0117/1059] ACPI: scan: Print the offline failure message in acpi_bus_offline()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (115 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0116/1059] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0118/1059] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online() Greg Kroah-Hartman
` (881 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Sasha Levin,
Rafael J. Wysocki
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b9ea1e921c2721546f53270cffdc6866e20576dd ]
When a physical node of an ACPI device being hot-removed cannot be
offlined, acpi_bus_offline() passes the physical device back to
acpi_scan_try_to_offline() through ret_p and the latter prints
"Offline failed." for it after the namespace walk. By then
physical_node_lock is not held anymore, so the device may have been
unbound from its ACPI companion and freed in the meantime.
Print the message in acpi_bus_offline() when device_offline() fails in
the second pass, while physical_node_lock keeps the device bound to its
ACPI companion and so the reference taken by acpi_bind_one() is still
held. acpi_scan_try_to_offline() only needs to know that something
could not be offlined, so pass the ACPI device back through ret_p
instead, like in the "Offline disabled." case.
Fixes: 303bfdb1a14d ("ACPI / scan: Add second pass of companion offlining to hot-remove code")
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Link: https://patch.msgid.link/20261029034507.2721580-2-sashal@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 14d1ded63f075..ad02525445d4a 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -165,8 +165,9 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
if (ret >= 0) {
pn->put_online = !ret;
} else {
- *ret_p = pn->dev;
+ *ret_p = &device->dev;
if (second_pass) {
+ dev_warn(pn->dev, "Offline failed.\n");
status = AE_ERROR;
break;
}
@@ -235,7 +236,6 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
(void **)&errdev);
if (errdev) {
- dev_warn(errdev, "Offline failed.\n");
acpi_bus_online(handle, 0, NULL, NULL);
acpi_walk_namespace(ACPI_TYPE_ANY, handle,
ACPI_UINT32_MAX, acpi_bus_online,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0118/1059] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (116 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0117/1059] ACPI: scan: Print the offline failure message in acpi_bus_offline() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0119/1059] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add() Greg Kroah-Hartman
` (880 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+cea7285bc17b76ffe39f,
syzbot+a265816368571f78ab88, Sasha Levin, Rafael J. Wysocki
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 17654aa629cba9a70e31cc1b7226a4fc1a1c801a ]
acpi_bus_offline() and acpi_bus_online() hold the physical_node_lock of
the ACPI device being hot-removed while they call device_offline() and
device_online() for its physical nodes. Offlining a CPU this way takes
cpu_add_remove_lock and the CPU hotplug lock under physical_node_lock,
and lockdep connects that to the uevent attribute of platform devices,
whose store method takes physical_node_lock in
acpi_primary_dev_companion():
physical_node_lock (acpi_bus_offline())
-> cpu_add_remove_lock -> cpu_hotplug_lock
-> cpuhp_state-down (mce_cpu_pre_down() unregistering a device)
-> device_links_lock (device_links_purge())
-> kn->active of a uevent attribute (device link unregistration)
-> physical_node_lock (uevent_store() -> acpi_companion_match())
syzbot has reported this cycle twice. The uevent attribute waited for in
the link unregistration is the device link's, not a platform device's,
and the physical_node_lock taken at the end is that of the platform
device's ACPI companion, not of the processor being ejected, so lockdep
only connects them because they share lock classes and this is unlikely
to deadlock. However, lockdep turns itself off after reporting it.
It can be reproduced in a QEMU guest by writing to the uevent attribute
of an ACPI-enumerated platform device, reading the uevent attribute of a
device link while the link is removed, offlining a CPU and ejecting one
through sysfs.
physical_node_lock protects the list of physical nodes. Since
acpi_unbind_one() blocks on it, holding it also keeps device_offline()
and device_online() from running in parallel with whatever happens to a
device after it has been unbound from its ACPI companion, but that is not
necessary: a reference to each device is held while the lock is dropped,
and the removal of the devices that can actually be taken offline here
(CPUs, memory blocks and containers) is serialized by the device hotplug
lock or acpi_scan_lock, both of which acpi_device_hotplug() holds
throughout.
So drop physical_node_lock around device_offline() and device_online().
Mark the nodes to offline with a new offline_pending flag, hold a
reference to each device while the lock is dropped, and look its node up
again afterwards to record whether it needs to be put back online,
because it may have been unbound in the meantime. Physical nodes added
while the lock is not held are not offlined by the current pass, which is
no different from adding them right after it.
Since acpi_container_offline() no longer runs under the container's
physical_node_lock, the nesting annotation added to
acpi_scan_is_offline() by commit 4c533c801d1c ("ACPI / scan: Annotate
physical_node_lock in acpi_scan_is_offline()") is not needed anymore, so
drop it.
Fixes: 683058e315f0 ("ACPI / hotplug: Use device offline/online for graceful hot-removal")
Reported-by: syzbot+cea7285bc17b76ffe39f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6ae18ed0.6200f071.51519.0f60.GAE@google.com
Reported-by: syzbot+a265816368571f78ab88@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6adf293a.67317f00.38c4bc.00af.GAE@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Link: https://patch.msgid.link/20261029034507.2721580-3-sashal@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/scan.c | 106 +++++++++++++++++++++++++++++++++-------
include/acpi/acpi_bus.h | 1 +
2 files changed, 88 insertions(+), 19 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index ad02525445d4a..328f128d1ecc9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -114,11 +114,7 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
bool offline = true;
char *envp[] = { "EVENT=offline", NULL };
- /*
- * acpi_container_offline() calls this for all of the container's
- * children under the container's physical_node_lock lock.
- */
- mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
+ mutex_lock(&adev->physical_node_lock);
list_for_each_entry(pn, &adev->physical_node_list, node)
if (device_supports_offline(pn->dev) && !pn->dev->offline) {
@@ -133,6 +129,59 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
return offline;
}
+static struct acpi_device_physical_node *
+acpi_find_physical_node(struct acpi_device *adev, struct device *dev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->dev == dev)
+ return pn;
+
+ return NULL;
+}
+
+static struct device *acpi_next_offline_pending(struct acpi_device *adev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ /*
+ * Find the first physical node that is still to be offlined, clear its
+ * offline_pending flag and return its device with a reference held.
+ */
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->offline_pending) {
+ pn->offline_pending = false;
+ return get_device(pn->dev);
+ }
+
+ return NULL;
+}
+
+static struct device *acpi_next_put_online(struct acpi_device *adev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ /*
+ * Find the first physical node that has been offlined by
+ * acpi_bus_offline(), clear its put_online flag and return its device
+ * with a reference held.
+ */
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->put_online) {
+ pn->put_online = false;
+ return get_device(pn->dev);
+ }
+
+ return NULL;
+}
+
static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
void **ret_p)
{
@@ -140,6 +189,7 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
struct acpi_device_physical_node *pn;
bool second_pass = (bool)data;
acpi_status status = AE_OK;
+ struct device *dev;
if (!device)
return AE_OK;
@@ -152,26 +202,43 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
mutex_lock(&device->physical_node_lock);
list_for_each_entry(pn, &device->physical_node_list, node) {
- int ret;
-
if (second_pass) {
/* Skip devices offlined by the first pass. */
- if (pn->put_online)
- continue;
+ pn->offline_pending = !pn->put_online;
} else {
+ pn->offline_pending = true;
pn->put_online = false;
}
- ret = device_offline(pn->dev);
+ }
+
+ /*
+ * Drop physical_node_lock around device_offline(), because the latter
+ * acquires locks, like the CPU hotplug ones, that must not nest under
+ * it.
+ */
+ while ((dev = acpi_next_offline_pending(device))) {
+ int ret;
+
+ mutex_unlock(&device->physical_node_lock);
+ ret = device_offline(dev);
+ mutex_lock(&device->physical_node_lock);
+
if (ret >= 0) {
- pn->put_online = !ret;
+ /* The device may have been unbound in the meantime. */
+ pn = acpi_find_physical_node(device, dev);
+ if (pn)
+ pn->put_online = !ret;
} else {
*ret_p = &device->dev;
if (second_pass) {
- dev_warn(pn->dev, "Offline failed.\n");
+ dev_warn(dev, "Offline failed.\n");
status = AE_ERROR;
- break;
}
}
+
+ put_device(dev);
+ if (ACPI_FAILURE(status))
+ break;
}
mutex_unlock(&device->physical_node_lock);
@@ -183,18 +250,19 @@ static acpi_status acpi_bus_online(acpi_handle handle, u32 lvl, void *data,
void **ret_p)
{
struct acpi_device *device = acpi_fetch_acpi_dev(handle);
- struct acpi_device_physical_node *pn;
+ struct device *dev;
if (!device)
return AE_OK;
mutex_lock(&device->physical_node_lock);
- list_for_each_entry(pn, &device->physical_node_list, node)
- if (pn->put_online) {
- device_online(pn->dev);
- pn->put_online = false;
- }
+ while ((dev = acpi_next_put_online(device))) {
+ mutex_unlock(&device->physical_node_lock);
+ device_online(dev);
+ mutex_lock(&device->physical_node_lock);
+ put_device(dev);
+ }
mutex_unlock(&device->physical_node_lock);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 9d2fb1cde25c5..78f9fa4164496 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -341,6 +341,7 @@ struct acpi_device_physical_node {
struct list_head node;
struct device *dev;
bool put_online:1;
+ bool offline_pending:1;
};
struct acpi_device_properties {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0119/1059] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (117 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0118/1059] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0120/1059] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path Greg Kroah-Hartman
` (879 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
[ Upstream commit 4d07af76ca41cc1a03240cd3b5f44dc428856214 ]
Check that avail does not become < 1 in wm_adsp_control_add(). This
prevents overflows during subsequent operations.
The main aim is to trap a negative value in avail, but a zero length
would mean that the control ends up without a name, so 1 is the smallest
valid value.
Fixes: b7ede5af62ab6 ("ASoC: wm_adsp: Take prefix into account in control name length")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20261104133322.1085061-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wm_adsp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index bc9798ea5a25e..74a9db5ecc8f2 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -42,6 +42,9 @@
#define adsp_dbg(_dsp, fmt, ...) \
dev_dbg(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
+#define adsp_warn_once(_dsp, fmt, ...) \
+ dev_warn_once(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
+
#define compr_err(_obj, fmt, ...) \
adsp_err(_obj->dsp, "%s: " fmt, _obj->name ? _obj->name : "legacy", \
##__VA_ARGS__)
@@ -630,6 +633,13 @@ static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
if (dsp->component->name_prefix)
avail -= strlen(dsp->component->name_prefix) + 1;
+ if (avail < 1) {
+ adsp_warn_once(dsp,
+ "%.*s: ALSA prefix too long: control not created\n",
+ cs_ctl->subname_len, cs_ctl->subname);
+ return -EINVAL;
+ }
+
/* Truncate the subname from the start if it is too long */
if (cs_ctl->subname_len > avail)
skip = cs_ctl->subname_len - avail;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0120/1059] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (118 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0119/1059] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0121/1059] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Greg Kroah-Hartman
` (878 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zijun Hu, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <zijun.hu@oss.qualcomm.com>
[ Upstream commit 3efdadae3a252b14ca1f62b16e31a9aa7c5d30cf ]
Correct (Input|Output)_Transport_Unit_Size based on Core spec v6.3,
Vol 4, Part E, 7.1.45:
"The Host shall set the Input_Transport_Unit_Size and
Output_Transport_Unit_Size to be equal. For HCI Host transport
the Host shall set them to 0."
Fixes: b2af264ad3af ("Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_conn.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 327c73431fb96..9bf200cd9b7f2 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -437,8 +437,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 1;
- cp.out_transport_unit_size = 1;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 1;
+ cp.out_transport_unit_size = 1;
+ }
break;
case BT_CODEC_TRANSPARENT:
@@ -463,8 +465,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 1;
- cp.out_transport_unit_size = 1;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 1;
+ cp.out_transport_unit_size = 1;
+ }
break;
case BT_CODEC_CVSD:
@@ -494,8 +498,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 16;
- cp.out_transport_unit_size = 16;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 16;
+ cp.out_transport_unit_size = 16;
+ }
break;
default:
goto unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0121/1059] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (119 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0120/1059] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0122/1059] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Greg Kroah-Hartman
` (877 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit 15a80cc8263abd50132a05d1b06824de8e28abcb ]
Incoming LE and ECRED channels retain the peer's request identifier
after an immediate response. The deferred LE response also leaves the
identifier set, unlike the deferred ECRED response.
A later ECRED request can reuse that identifier and include an unrelated
channel in its shared-response handling. That walk matches on the
identifier alone, so an LE channel is selected too. If the old channel is
closing, the checks can refuse the new connection. The check at request
receipt rejects it with L2CAP_CR_LE_INVALID_PARAMS; the check before a
deferred response returns L2CAP_CR_LE_AUTHORIZATION.
Store the identifier only when deferring the response, and clear it
after sending the deferred LE response. Keep deferred ECRED identifiers
until the shared response is sent, since a partially accepted group
still needs them.
AI assistance was used.
Fixes: 27e2d4c8d28b ("Bluetooth: Add basic LE L2CAP connect request receiving support")
Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
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, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d7bb1193132fe..86e229a593f83 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3891,6 +3891,7 @@ void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan)
l2cap_send_cmd(conn, chan->ident, L2CAP_LE_CONN_RSP, sizeof(rsp),
&rsp);
+ chan->ident = 0;
}
static void l2cap_ecred_list_defer(struct l2cap_chan *chan, void *data)
@@ -5166,10 +5167,10 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
__set_chan_timer(chan, chan->ops->get_sndtimeo(chan));
- chan->ident = cmd->ident;
chan->mode = L2CAP_MODE_LE_FLOWCTL;
if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
+ chan->ident = cmd->ident;
l2cap_state_change(chan, BT_CONNECT2);
/* The following result value is actually not defined
* for LE CoC but we use it to let the function know
@@ -5398,10 +5399,10 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
__set_chan_timer(chan, chan->ops->get_sndtimeo(chan));
- chan->ident = cmd->ident;
chan->mode = L2CAP_MODE_EXT_FLOWCTL;
if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
+ chan->ident = cmd->ident;
l2cap_state_change(chan, BT_CONNECT2);
defer = true;
chan->ops->defer(chan);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0122/1059] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (120 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0121/1059] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0123/1059] net: dsa: b53: Force flow control for BCM5301X CPU port(s) Greg Kroah-Hartman
` (876 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit d4f3d2c04624854d27aa948cd7bfc9d946faaac5 ]
Northstar and Northstar Plus use a 2.5 Gbps internal link between the
AMAC and the switch. BGMAC_FEAT_FORCE_SPEED_2500 makes bgmac_miiconfig()
configure that speed, but bgmac_adjust_link() subsequently replaces it
with the synthetic fixed PHY's 1 Gbps speed.
Use the forced speed when processing link changes so the MAC remains at
2.5 Gbps. Together with configuring the switch IMP port for its 2 Gbps
mode, this eliminates the output queue discards that caused approximately
1000 TCP retransmissions per second during an iperf3 transmit test.
Restrict the platform forced-speed flag to Northstar Plus using the SoC
compatible, since Hurricane2 shares the AMAC compatible. Other platform
AMACs without a phy-handle must continue following the fixed PHY speed.
The BCMA path already selects the flag only for the Northstar family.
Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029211540.4123250-2-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bgmac-platform.c | 3 ++-
drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 3f4e8bac40c19..f7ff7ddc690eb 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -243,7 +243,8 @@ static int bgmac_probe(struct platform_device *pdev)
bgmac->phy_connect = platform_phy_connect;
} else {
bgmac->phy_connect = bgmac_phy_connect_direct;
- bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
+ if (of_machine_is_compatible("brcm,nsp"))
+ bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
}
return bgmac_enet_probe(bgmac);
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 6141f9ddc8370..7fd706e029e45 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1429,11 +1429,15 @@ void bgmac_adjust_link(struct net_device *net_dev)
{
struct bgmac *bgmac = netdev_priv(net_dev);
struct phy_device *phy_dev = net_dev->phydev;
+ int speed = phy_dev->speed;
bool update = false;
+ if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500)
+ speed = SPEED_2500;
+
if (phy_dev->link) {
- if (phy_dev->speed != bgmac->mac_speed) {
- bgmac->mac_speed = phy_dev->speed;
+ if (speed != bgmac->mac_speed) {
+ bgmac->mac_speed = speed;
update = true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0123/1059] net: dsa: b53: Force flow control for BCM5301X CPU port(s)
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (121 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0122/1059] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0124/1059] net: dsa: b53: restore the NSP IMP port 2 Gbps mode Greg Kroah-Hartman
` (875 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Russell King (Oracle), Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 93a2579ed08c76835514d2a7f6e5bf3a9bc377ef ]
Just like what b53_adjust_link() does, force flow control for the
BCM5301X CPU port(s) by forcing rx_pause and tx_pause in
b53_phylink_mac_link_up(). Preparatory step for getting rid of
b53_adjust_link().
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20240423183339.1368511-5-florian.fainelli@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 41af38324341 ("net: dsa: b53: restore the NSP IMP port 2 Gbps mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 2e40e30d1c612..b7846042ddedd 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1513,6 +1513,10 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
return;
if (mode == MLO_AN_FIXED) {
+ /* Force flow control on BCM5301x's CPU port */
+ if (is5301x(dev) && dsa_is_cpu_port(ds, port))
+ tx_pause = rx_pause = true;
+
b53_force_port_config(dev, port, speed, duplex,
tx_pause, rx_pause);
b53_force_link(dev, port, true);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0124/1059] net: dsa: b53: restore the NSP IMP port 2 Gbps mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (122 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0123/1059] net: dsa: b53: Force flow control for BCM5301X CPU port(s) Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0125/1059] Bluetooth: Fix not updating of hdev->commands[] after reset Greg Kroah-Hartman
` (874 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 41af38324341df9d769641d6485abb67fd5209ed ]
The Northstar Plus IMP port uses the switch's proprietary 2 Gbps mode for
its internal link to the AMAC. Its fixed-link description reports 1 Gbps,
so applying that speed clears PORT_OVERRIDE_SPEED_2000M and leaves the two
ends of the internal link configured at different speeds.
Force the 2 Gbps mode and flow control for BCM5301x and NSP CPU ports. The
mismatch caused switch output queue discards on both copper and SerDes
ports, with one discard for every TCP retransmission. With both ends
restored to their high-speed modes, iperf3 reports no retransmissions.
Fixes: b6a8a5477fe9 ("net: dsa: b53: fix resetting speed and pause on forced link")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029211540.4123250-3-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index b7846042ddedd..5c7c75eb5a815 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1513,9 +1513,15 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
return;
if (mode == MLO_AN_FIXED) {
- /* Force flow control on BCM5301x's CPU port */
- if (is5301x(dev) && dsa_is_cpu_port(ds, port))
- tx_pause = rx_pause = true;
+ /* Force flow control and 2Gbits/sec on BCM5301x and NSP CPU
+ * ports
+ */
+ if ((is5301x(dev) || dev->chip_id == BCM58XX_DEVICE_ID) &&
+ dsa_is_cpu_port(ds, port)) {
+ tx_pause = true;
+ rx_pause = true;
+ speed = 2000;
+ }
b53_force_port_config(dev, port, speed, duplex,
tx_pause, rx_pause);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0125/1059] Bluetooth: Fix not updating of hdev->commands[] after reset
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (123 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0124/1059] net: dsa: b53: restore the NSP IMP port 2 Gbps mode Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0126/1059] spi: cadence-quadspi: Fix race between DMA completion and transfer start Greg Kroah-Hartman
` (873 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit e00aa1a33f81a5e25b510f569ab9cb9f97eb41b9 ]
Read Local Supported Commands was only read once during the INIT/SETUP
flow, but the supported commands bits may change at runtime, for
example after a firmware change applied with vendor commands, so update
hdev->commands[] every time the response is received.
Fixes: 6a070e6e81ad ("Bluetooth: Store supported commands only during setup procedure")
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 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 26b859c2c9c58..8e6017834bb59 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -785,9 +785,7 @@ static u8 hci_cc_read_local_commands(struct hci_dev *hdev, void *data,
if (rp->status)
return rp->status;
- if (hci_dev_test_flag(hdev, HCI_SETUP) ||
- hci_dev_test_flag(hdev, HCI_CONFIG))
- memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
+ memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
return rp->status;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0126/1059] spi: cadence-quadspi: Fix race between DMA completion and transfer start
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (124 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0125/1059] Bluetooth: Fix not updating of hdev->commands[] after reset Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0127/1059] ALSA: hda/core: Stop capability walk on empty capability header Greg Kroah-Hartman
` (872 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frederic Konrad, Srikanth Boyapally,
Radhey Shyam Pandey, Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Konrad <fkonrad@amd.com>
[ Upstream commit 059518f775baecc9803fc97787bd0b17558f8047 ]
In cqspi_versal_indirect_read_dma(), the DMA transfer is started by
writing CQSPI_REG_INDIRECTRD_START_MASK to the indirect read control
register. Under certain timing conditions, the DMA completion interrupt
may be triggered and complete the transfer before the completion
structure is reinitialized.
This creates a race where the completion event is lost, causing
wait_for_completion_timeout() to time out even though the transfer has
already completed, resulting in errors such as:
spi-nor spi0.0: CS0: operation failed with -110
Fix this by reinitializing the completion structure before starting the
DMA transfer, ensuring that any completion event generated after the
transfer begins is correctly observed.
Fixes: 1a6f854f7daa ("spi: cadence-quadspi: Add Xilinx Versal external DMA support")
Signed-off-by: Frederic Konrad <fkonrad@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/20261104071958.2405117-1-radhey.shyam.pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-cadence-quadspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index dccbeaf3d690f..eb7f0a56b6e5b 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -857,11 +857,11 @@ static int cqspi_versal_indirect_read_dma(struct cqspi_flash_pdata *f_pdata,
writel(CQSPI_REG_VERSAL_DMA_DST_CTRL_VAL,
reg_base + CQSPI_REG_VERSAL_DMA_DST_CTRL);
+ reinit_completion(&cqspi->transfer_complete);
+
writel(CQSPI_REG_INDIRECTRD_START_MASK,
reg_base + CQSPI_REG_INDIRECTRD);
- reinit_completion(&cqspi->transfer_complete);
-
if (!wait_for_completion_timeout(&cqspi->transfer_complete,
msecs_to_jiffies(CQSPI_READ_TIMEOUT_MS))) {
ret = -ETIMEDOUT;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0127/1059] ALSA: hda/core: Stop capability walk on empty capability header
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (125 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0126/1059] spi: cadence-quadspi: Fix race between DMA completion and transfer start Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0128/1059] net: 8139cp: keep Rx masked while NAPI is scheduled Greg Kroah-Hartman
` (871 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michał Kopeć, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Kopeć <michal.kopec@3mdeb.com>
[ Upstream commit f65c917397c77daeb7e6d0893ebe89107ddd5692 ]
snd_hdac_bus_parse_capabilities() walks the controller's linked
capability list starting at LLCH. On some platforms one of the entries
reads back as all zeros. Such a header does not describe a capability,
but the walk still treats it as one: it falls into the default case and
reports an error, printing the raw register value instead of the
capability ID:
snd_hda_intel 0000:00:1f.3: Unknown capability 0
The walk then stops anyway, because the next pointer of a zero header
is 0, so the message is only noise.
Treat an all-zero header as the end of the list, the same way a failed
read (-1) is already handled, and log it at debug level only. Also
print the capability ID in hex for a genuinely unknown capability,
instead of the full header value.
Fixes: 0b00a5615dc4 ("ALSA: hdac_ext: add hdac extended controller")
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
Link: https://patch.msgid.link/20261102114939.2182131-1-michal.kopec@3mdeb.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/hdac_controller.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 9a60bfdb39bac..525375d84747b 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -322,6 +322,13 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
break;
}
+ /* An all-zero header means no capability is present here */
+ if (!cur_cap) {
+ dev_dbg(bus->dev, "Empty capability header at offset 0x%x\n",
+ offset);
+ break;
+ }
+
switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
case AZX_ML_CAP_ID:
dev_dbg(bus->dev, "Found ML capability\n");
@@ -352,7 +359,8 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
break;
default:
- dev_err(bus->dev, "Unknown capability %d\n", cur_cap);
+ dev_err(bus->dev, "Unknown capability ID 0x%x\n",
+ (cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
cur_cap = 0;
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0128/1059] net: 8139cp: keep Rx masked while NAPI is scheduled
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (126 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0127/1059] ALSA: hda/core: Stop capability walk on empty capability header Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0129/1059] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up Greg Kroah-Hartman
` (870 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Colton Pawielski, Daniel Machon,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colton Pawielski <colton.pawielski@gmail.com>
[ Upstream commit 547b1ae5ec50b7d81b05b4219e0db7e56279d65f ]
cp_rx_poll() calls napi_complete_done() and only then takes cp->lock
with interrupts disabled to unmask the Rx interrupts. An interrupt
that is not masked while polling (TxOK, TxErr, ...) can arrive in
between. cp_interrupt() then sees the Rx status bits, which are still
set, finds NAPI no longer scheduled, masks Rx and schedules NAPI again.
cp_rx_poll() then carries on and unmasks Rx anyway.
>From that point Rx interrupts are enabled while NAPI is scheduled:
cp_interrupt() leaves the Rx bits for the poll routine, does not mask
them because napi_schedule_prep() fails, and the level-triggered
interrupt fires again as soon as it returns. On an SH7751 LANDISK
under combined Tx/Rx load this interrupt storm was captured with a RAM
trace right before the board locked up hard.
Mask Rx in cp_interrupt() whenever Rx status is pending, not only when
NAPI gets scheduled. If the race leaves Rx unmasked, the next interrupt
masks it again, and the pending poll unmasks it when it completes.
Fixes: ab1e7e1d2666 ("8139cp: use napi_complete_done()")
Signed-off-by: Colton Pawielski <colton.pawielski@gmail.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261031-b4-8139cp-napi-v2-1-5824797c0fe6@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/realtek/8139cp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 4091762275d6a..4b70a95567e45 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -600,11 +600,11 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
goto out_unlock;
}
- if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
- if (napi_schedule_prep(&cp->napi)) {
- cpw16_f(IntrMask, cp_norx_intr_mask);
+ if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr)) {
+ cpw16_f(IntrMask, cp_norx_intr_mask);
+ if (napi_schedule_prep(&cp->napi))
__napi_schedule(&cp->napi);
- }
+ }
if (status & (TxOK | TxErr | TxEmpty | SWInt))
cp_tx(cp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0129/1059] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (127 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0128/1059] net: 8139cp: keep Rx masked while NAPI is scheduled Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0130/1059] ip6mr: Serialize multicast router socket ownership Greg Kroah-Hartman
` (869 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Timur Stukan, Hangbin Liu,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Stukan <timur.stukan.linux@gmail.com>
[ Upstream commit 9a65b9c2a97594bcaaf393329807653eff895bbf ]
In 802.3ad mode, when bond_update_speed_duplex() fails on NETDEV_UP or
NETDEV_CHANGE, bond_slave_netdev_event() sets the slave link to FAIL if
the slave has ever been up (last_link_up != 0), and to DOWN otherwise,
so that miimon can set it right once speed/duplex are valid.
last_link_up is never cleared, so a slave that is currently DOWN but
was up before is set to FAIL as well. miimon then treats it as a slave
that is still in use and takes it through the full down path again:
the link failure count is incremented, "link status definitely down"
is logged and the 802.3ad port is disabled a second time, although the
slave has not been up since it went down.
Reproduced in 802.3ad mode with miimon=100 by setting a slave down and
up again. On NETDEV_UP the speed is still unknown, so the notifier sets
FAIL, and the next miimon pass sees no carrier and proposes DOWN:
ip link add bond0 type bond mode 802.3ad miimon 100 lacp_rate 1
ip link set enp0s3 down
ip link set enp0s4 down
ip link set enp0s3 master bond0
ip link set enp0s4 master bond0
ip link set enp0s3 up
ip link set enp0s4 up
ip link set bond0 up
# wait for LACP to settle
ip link set enp0s3 down
ip link set enp0s3 up
procfs then shows "Link Failure Count: 2" in enp0s3 slave part. Also in
dmesg wrote twice: "link status definitely down, disabling slave".
Fix this by setting FAIL only for a slave that is currently UP and
leaving other states alone. An up slave that loses speed/duplex still
goes through FAIL as before, and DOWN/BACK slaves are left to miimon,
as in the other modes.
Fixes: ea53abfab960 ("bonding/802.3ad: fix link_failure_count tracking")
Signed-off-by: Timur Stukan <timur.stukan.linux@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261101145653.63648-1-timur.stukan.linux@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 1bf3ba0ebdb12..635fec9e8cded 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3982,18 +3982,13 @@ static int bond_slave_netdev_event(unsigned long event,
case NETDEV_CHANGE:
/* For 802.3ad mode only:
* Getting invalid Speed/Duplex values here will put slave
- * in weird state. Mark it as link-fail if the link was
- * previously up or link-down if it hasn't yet come up, and
- * let link-monitoring (miimon) set it right when correct
- * speeds/duplex are available.
+ * in weird state. Mark an up slave as link-fail and let
+ * miimon set it right when correct speed/duplex are available.
*/
if (bond_update_speed_duplex(slave) &&
- BOND_MODE(bond) == BOND_MODE_8023AD) {
- if (slave->last_link_up)
- slave->link = BOND_LINK_FAIL;
- else
- slave->link = BOND_LINK_DOWN;
- }
+ BOND_MODE(bond) == BOND_MODE_8023AD &&
+ slave->link == BOND_LINK_UP)
+ slave->link = BOND_LINK_FAIL;
if (BOND_MODE(bond) == BOND_MODE_8023AD)
bond_3ad_adapter_speed_duplex_changed(slave);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0130/1059] ip6mr: Serialize multicast router socket ownership
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (128 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0129/1059] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0131/1059] net: bridge: disable MRP ports before the FDB flush in del_nbp() Greg Kroah-Hartman
` (868 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Ido Schimmel, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit c6b41de4dd9f2d6856d8d8d292348f7961034152 ]
MRT6_TABLE checks whether the socket owns its current table before
acquiring RTNL. MRT6_INIT also looks up its table before taking RTNL.
Consequently, concurrent TABLE and INIT calls can initialize the old
table and then change the socket's selected table. Another INIT can
register the same socket in the new table.
rawv6_close() calls ip6mr_sk_done(), which clears only the first table
owned by the socket. After the socket's RCU-delayed free, the other
table retains a dangling mroute_sk pointer. A subsequent multicast cache
report passes that pointer to sock_queue_rcv_skb_reason(). This produces
a KASAN slab-use-after-free in sk_filter_trim_cap().
Look up the selected table in ip6mr_sk_init() after acquiring RTNL.
Likewise, re-read the current table and check its owner under RTNL in
MRT6_TABLE before updating the selection. This preserves the single-table
ownership invariant shared with ip6mr_sk_done(), without changing the
locking of the other multicast socket options.
Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261030042221.73996-1-kylebot@openai.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6mr.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 45120e9c750d9..6c4ddeb48ec60 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1578,12 +1578,20 @@ static void mroute_clean_tables(struct mr_table *mrt, int flags)
}
}
-static int ip6mr_sk_init(struct mr_table *mrt, struct sock *sk)
+static int ip6mr_sk_init(struct sock *sk)
{
- int err = 0;
struct net *net = sock_net(sk);
+ struct mr_table *mrt;
+ int err = 0;
rtnl_lock();
+ mrt = __ip6mr_get_table(net,
+ raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
+ if (!mrt) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+
spin_lock(&mrt_lock);
if (rtnl_dereference(mrt->mroute_sk)) {
err = -EADDRINUSE;
@@ -1599,6 +1607,7 @@ static int ip6mr_sk_init(struct mr_table *mrt, struct sock *sk)
NETCONFA_MC_FORWARDING,
NETCONFA_IFINDEX_ALL,
net->ipv6.devconf_all);
+out_unlock:
rtnl_unlock();
return err;
@@ -1697,7 +1706,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
if (optlen < sizeof(int))
return -EINVAL;
- return ip6mr_sk_init(mrt, sk);
+ return ip6mr_sk_init(sk);
case MRT6_DONE:
return ip6mr_sk_done(sk);
@@ -1818,16 +1827,21 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
/* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */
if (v != RT_TABLE_DEFAULT && v >= 100000000)
return -EINVAL;
- if (sk == rcu_access_pointer(mrt->mroute_sk))
- return -EBUSY;
-
rtnl_lock();
ret = 0;
- mrt = ip6mr_new_table(net, v);
- if (IS_ERR(mrt))
- ret = PTR_ERR(mrt);
- else
- raw6_sk(sk)->ip6mr_table = v;
+ mrt = __ip6mr_get_table(net,
+ raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
+ if (!mrt) {
+ ret = -ENOENT;
+ } else if (sk == rtnl_dereference(mrt->mroute_sk)) {
+ ret = -EBUSY;
+ } else {
+ mrt = ip6mr_new_table(net, v);
+ if (IS_ERR(mrt))
+ ret = PTR_ERR(mrt);
+ else
+ raw6_sk(sk)->ip6mr_table = v;
+ }
rtnl_unlock();
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0131/1059] net: bridge: disable MRP ports before the FDB flush in del_nbp()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (129 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0130/1059] ip6mr: Serialize multicast router socket ownership Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0132/1059] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Greg Kroah-Hartman
` (867 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ido Schimmel, Cheng Yongkang,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
[ Upstream commit 37dfd0efbfffc20a57e41c2eb349ac49b1ca1ff8 ]
del_nbp() flushes the port's FDB entries before it unregisters the RX
handler. For a normal port, br_stp_disable_port() moves the port to
BR_STATE_DISABLED before this cleanup.
That does not hold for an MRP ring port. br_set_state() ignores state
changes while BR_MRP_AWARE_BIT is set, so br_stp_disable_port() leaves
the port state alone. br_mrp_port_del() then restores forwarding when
the bridge is up before clearing the bit. A frame received between
br_fdb_cleanup_by_dst() and netdev_rx_handler_unregister() can therefore
create a new FDB entry referencing the dying port. Nothing removes that
entry before destroy_nbp_rcu() frees the port, so a later frame to the
learned MAC can be forwarded through the freed port.
Remove the MRP and CFM instances before disabling the port, so that
br_stp_disable_port() actually transitions it to BR_STATE_DISABLED.
With CONFIG_BRIDGE_VLAN_FILTERING=y, synchronize_net() in
nbp_vlan_group_unpublish() also drains receive paths that could still
learn with the old state before the final FDB cleanup.
Found through an LLM-assisted source code analysis workflow and
reproduced on net with KASAN and CONFIG_BRIDGE_VLAN_FILTERING=y in QEMU.
A diagnostic switchdev module accepts MRP objects and delays the
NETDEV_CHANGEUPPER callback for 1.5 s, holding del_nbp() after the FDB
cleanup and before RX handler removal. The reproducer floods the MRP
port with rotating source MACs, waits for the port's RCU callback
through the module's rcu_barrier(), then sends frames to those MACs
from another port. The unpatched kernel reports:
BUG: KASAN: slab-use-after-free in br_forward+0xb1/0x820
Call Trace:
<IRQ>
br_forward+0xb1/0x820
br_handle_frame_finish+0x148b/0x1e50
br_handle_frame+0x90a/0x15c0
With this patch, three runs of six cycles each reach the delay without
a KASAN report.
Fixes: 6536993371fa ("bridge: mrp: Integrate MRP into the bridge")
Suggested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/netdev/20261012123051.GA714215@shredder/
Closes: https://lore.kernel.org/netdev/20261022090431.3641707-1-teel4res@gmail.com/
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261101044840.1595584-1-1020691186@qq.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bridge/br_if.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 169a18f099fd2..1ccd1b8dbf6d0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -339,13 +339,13 @@ static void del_nbp(struct net_bridge_port *p)
nbp_delete_promisc(p);
+ br_mrp_port_del(br, p);
+ br_cfm_port_del(br, p);
+
spin_lock_bh(&br->lock);
br_stp_disable_port(p);
spin_unlock_bh(&br->lock);
- br_mrp_port_del(br, p);
- br_cfm_port_del(br, p);
-
br_ifinfo_notify(RTM_DELLINK, NULL, p);
list_del_rcu(&p->list);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0132/1059] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (130 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0131/1059] net: bridge: disable MRP ports before the FDB flush in del_nbp() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0133/1059] netfilter: x_tables: check target name before accessing verdict Greg Kroah-Hartman
` (866 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Laveesh Bansal, Pablo Neira Ayuso,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laveesh Bansal <laveeshb@laveeshbansal.com>
[ Upstream commit 683ff28ab18accb25268741a724645eee839d41a ]
nf_ct_bridge_refrag() warns when skb->protocol is neither IPv4 nor IPv6.
A vlan filtering bridge can get there with a vlan ethertype: if the
protocol of the tag of a frame differs from the vlan_protocol of the
bridge, br_allowed_ingress() moves the tag back into the packet after
NF_BR_PRE_ROUTING, where bridge conntrack has already defragmented it.
Anyone who can send fragments into a port of such a bridge can trigger the
warning, which takes the machine down with panic_on_warn. The packet is
dropped either way, so only warn on kernels built with CONFIG_DEBUG_NET.
This only avoids the warning. Such fragmented packets are still dropped.
syzbot reported the warning. It keeps triggering on CONFIG_DEBUG_NET
kernels until the vlan tag is handled, which is left for a follow-up:
https://syzkaller.appspot.com/bug?extid=a8ba738fe2db6b4bb27f
Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system")
Assisted-by: LLM
Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bridge/netfilter/nf_conntrack_bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c
index 10b8134c22e40..e73477f5a83d2 100644
--- a/net/bridge/netfilter/nf_conntrack_bridge.c
+++ b/net/bridge/netfilter/nf_conntrack_bridge.c
@@ -359,7 +359,7 @@ nf_ct_bridge_refrag(struct sk_buff *skb, const struct nf_hook_state *state,
nf_br_ip6_fragment(state->net, state->sk, skb, &data, output);
break;
default:
- WARN_ON_ONCE(1);
+ DEBUG_NET_WARN_ON_ONCE(1);
return NF_DROP;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0133/1059] netfilter: x_tables: check target name before accessing verdict
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (131 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0132/1059] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0134/1059] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Greg Kroah-Hartman
` (865 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, VEGA, Fernando Fernandez Mancera,
Pablo Neira Ayuso, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <fmancera@suse.de>
[ Upstream commit 364b200285bb2cc518e3c5efe6591951c05b8e01 ]
Non-standard targets may contain only struct xt_entry_target.
mark_source_chains() nevertheless reads the target as an
xt_standard_target before checking its name, potentially reading four
bytes beyond a header-only target.
Check that the target is standard before reading its verdict.
Non-standard targets remain handled as fallthrough rules.
See the following KASAN trace:
BUG: KASAN: slab-out-of-bounds in translate_table+0x1660/0x1a40 [ip6_tables]
Read of size 4 at addr ffff88800ed56ff8 by task rep/432
Call Trace:
kasan_report+0xfa/0x120
translate_table+0x1660/0x1a40 [ip6_tables]
do_ip6t_set_ctl+0x667/0xa76 [ip6_tables]
nf_setsockopt+0x77/0xd0
do_sock_setsockopt+0x118/0x490
__sys_setsockopt+0xe4/0x160
__x64_sys_setsockopt+0xbd/0x190
do_syscall_64+0xde/0x4f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Allocated by task 432:
kasan_save_stack+0x2f/0x50
__kasan_kmalloc+0x7f/0x90
__kvmalloc_node_noprof+0x1b1/0x5c0
xt_alloc_table_info+0x3c/0xa0
do_ip6t_set_ctl+0x5ee/0xa76 [ip6_tables]
nf_setsockopt+0x77/0xd0
do_sock_setsockopt+0x118/0x490
__sys_setsockopt+0xe4/0x160
__x64_sys_setsockopt+0xbd/0x190
do_syscall_64+0xde/0x4f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: VEGA <vega@nebusec.ai>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/netfilter/arp_tables.c | 5 +++--
net/ipv4/netfilter/ip_tables.c | 5 +++--
net/ipv6/netfilter/ip6_tables.c | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index eeb48265208a2..e3160018287de 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -372,11 +372,12 @@ static int mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 055d5e28a44f4..7b3652b3ab07c 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -424,11 +424,12 @@ mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index ad559d4a877a3..92a4d934f5a36 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -442,11 +442,12 @@ mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0134/1059] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (132 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0133/1059] netfilter: x_tables: check target name before accessing verdict Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0135/1059] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Greg Kroah-Hartman
` (864 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Fernando Fernandez Mancera, Pablo Neira Ayuso, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
[ Upstream commit 7af52bda65c0bbbf40894aa3df36ac1bb5697984 ]
ct_sip_parse_transport() compares the value of the "transport=" header
parameter against "TCP"/"UDP" with strncasecmp(..., 3), but it never
checks that the parsed value is at least 3 bytes long.
ct_sip_parse_param() returns matchlen = end - start, where end is the
next ';' or, when there is no ';', the end of the payload buffer
(limit = dptr + datalen). If the "transport=" value is only 1 or 2
bytes long and runs exactly to the end of the payload (e.g. a REGISTER
request whose Contact header ends in ";transport=T" with no trailing
CRLF), matchlen is less than 3 while strncasecmp() still reads up to 3
bytes, reading 1-2 bytes past the end of the linearized skb data.
Add a matchlen check before the comparison, mirroring the
sdp_media_type() pattern a few lines below, so short values cannot reach
strncasecmp().
The bug was found by LLM-assisted manual review of the SIP helper's
parsers and confirmed with a userspace ASan harness built from the
verbatim parser functions, which reports a heap-buffer-overflow read of
size 2 in strncasecmp() called from ct_sip_parse_transport().
Fixes: ea45f12a2766d ("[NETFILTER]: nf_conntrack_sip: parse SIP headers properly")
Link: https://patch.msgid.link/20260815133104.50369-1-joasantonio108@gmail.com/
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_conntrack_sip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 3cab167224ec1..7b6c7023c7359 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -707,9 +707,9 @@ static int ct_sip_parse_transport(struct nf_conn *ct, const char *dptr,
if (ct_sip_parse_param(ct, dptr, dataoff, datalen, "transport=",
&matchoff, &matchlen)) {
- if (!strncasecmp(dptr + matchoff, "TCP", strlen("TCP")))
+ if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "TCP", 3))
*proto = IPPROTO_TCP;
- else if (!strncasecmp(dptr + matchoff, "UDP", strlen("UDP")))
+ else if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "UDP", 3))
*proto = IPPROTO_UDP;
else
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0135/1059] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (133 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0134/1059] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0136/1059] netfilter: nat: zero newrange before filling it in Greg Kroah-Hartman
` (863 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xingyuan Mo, Pablo Neira Ayuso,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <pablo@netfilter.org>
[ Upstream commit e95b3be75ae0652d40a48a210f0cf5197b3b3783 ]
Allocate flow rule object after transaction has been allocation and rule
deactivation has been performed, otherwise memleak is possible. Let the
transaction unwind the existing rule deactivation from the abort path,
this needs to update nft_flow_rule_destroy() to skip release if
flow_rule is null.
While at this, remove check for non-null flow_rule in newrule error path
now that nft_flow_rule_destroy() is skipped if flow_rule is null.
Fixes: 63b48c73ff56 ("netfilter: nf_tables_offload: undo updates if transaction fails")
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Link: https://patch.msgid.link/20261028062204.1079089-1-hdthky0@gmail.com/
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_tables_api.c | 21 +++++++++------------
net/netfilter/nf_tables_offload.c | 3 +++
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 99fba693ab4f6..1bf44559e00fd 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -519,16 +519,6 @@ static int nft_delrule(struct nft_ctx *ctx, struct nft_rule *rule)
if (trans == NULL)
return -ENOMEM;
- if (ctx->chain->flags & NFT_CHAIN_HW_OFFLOAD) {
- flow = nft_flow_rule_create(ctx->net, rule);
- if (IS_ERR(flow)) {
- nft_trans_destroy(trans);
- return PTR_ERR(flow);
- }
-
- nft_trans_flow_rule(trans) = flow;
- }
-
err = nf_tables_delrule_deactivate(ctx, rule);
if (err < 0) {
nft_trans_destroy(trans);
@@ -536,6 +526,14 @@ static int nft_delrule(struct nft_ctx *ctx, struct nft_rule *rule)
}
nft_rule_expr_deactivate(ctx, rule, NFT_TRANS_PREPARE);
+ if (ctx->chain->flags & NFT_CHAIN_HW_OFFLOAD) {
+ flow = nft_flow_rule_create(ctx->net, rule);
+ if (IS_ERR(flow))
+ return PTR_ERR(flow);
+
+ nft_trans_flow_rule(trans) = flow;
+ }
+
return 0;
}
@@ -3884,8 +3882,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
err_destroy_flow_rule:
nft_use_dec_restore(&chain->use);
err_destroy_flow:
- if (flow)
- nft_flow_rule_destroy(flow);
+ nft_flow_rule_destroy(flow);
err_release_rule:
nft_rule_expr_deactivate(&ctx, rule, NFT_TRANS_PREPARE_ERROR);
nf_tables_rule_destroy(&ctx, rule);
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index 27907fa6f1571..6c91cba23d13e 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -147,6 +147,9 @@ void nft_flow_rule_destroy(struct nft_flow_rule *flow)
struct flow_action_entry *entry;
int i;
+ if (!flow)
+ return;
+
flow_action_for_each(i, entry, &flow->rule->action) {
switch (entry->id) {
case FLOW_ACTION_REDIRECT:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0136/1059] netfilter: nat: zero newrange before filling it in
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (134 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0135/1059] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0137/1059] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period Greg Kroah-Hartman
` (862 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Westphal, Pablo Neira Ayuso,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@strlen.de>
[ Upstream commit d1bb235aa409a4e5aeba6c748d953d948625b1e9 ]
nf_nat_masquerade_ipv4(), nf_nat_masquerade_ipv6(), netmap_tg4() and
netmap_tg6() each build a stack-local struct nf_nat_range2 from the
caller-supplied range, inheriting range->flags unmodified. Two of them
only memset() the min_addr/max_addr members, the other two don't
memset() anything at all, so newrange.base_proto is left as stack
garbage.
If the inherited flags include NF_NAT_RANGE_PROTO_OFFSET,
nf_nat_l4proto_unique_tuple() reads range->base_proto.all to compute
the NAT port offset. Neither the NETMAP nor the MASQUERADE targets
mask the flags field in their checkentry callback, so this
uninitialized stack value can end up feeding the NAT port selection.
The per-member memset()s are not enough: they have to enumerate every
field that must be cleared, and base_proto was missed when
NF_NAT_RANGE_PROTO_OFFSET/base_proto was added to the struct. memset()
the whole struct instead, so every member is covered regardless of
which ones get explicitly assigned afterwards.
There are other places that miss this, but those hardcode .flags so
nat core won't read from the uninitialized fields.
C99 initializers would be preferrable, but this is a more intrusive
change. Lets followup in nf-next and convert others as well.
This is an LLM finding.
Fixes: 2eb0f624b709 ("netfilter: add NAT support for shifted portmap ranges")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_nat_masquerade.c | 4 ++--
net/netfilter/xt_NETMAP.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nf_nat_masquerade.c b/net/netfilter/nf_nat_masquerade.c
index 1a506b0c6511a..2506aace39bcf 100644
--- a/net/netfilter/nf_nat_masquerade.c
+++ b/net/netfilter/nf_nat_masquerade.c
@@ -62,8 +62,7 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
nat->masq_index = out->ifindex;
/* Transfer from original range. */
- memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
- memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.ip = newsrc;
newrange.max_addr.ip = newsrc;
@@ -259,6 +258,7 @@ nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
if (nat)
nat->masq_index = out->ifindex;
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.in6 = src;
newrange.max_addr.in6 = src;
diff --git a/net/netfilter/xt_NETMAP.c b/net/netfilter/xt_NETMAP.c
index cb2ee80d84fa8..591a6af6c61fa 100644
--- a/net/netfilter/xt_NETMAP.c
+++ b/net/netfilter/xt_NETMAP.c
@@ -42,6 +42,7 @@ netmap_tg6(struct sk_buff *skb, const struct xt_action_param *par)
netmask.ip6[i];
}
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr = new_addr;
newrange.max_addr = new_addr;
@@ -89,8 +90,7 @@ netmap_tg4(struct sk_buff *skb, const struct xt_action_param *par)
new_ip = ip_hdr(skb)->saddr & ~netmask;
new_ip |= mr->range[0].min_ip & netmask;
- memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
- memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = mr->range[0].flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.ip = new_ip;
newrange.max_addr.ip = new_ip;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0137/1059] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (135 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0136/1059] netfilter: nat: zero newrange before filling it in Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0138/1059] MIPS: Avoid dead code/data elimination when using recordmcount Greg Kroah-Hartman
` (861 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Eric Dumazet, Hangbin Liu,
Jiayuan Chen, Kuniyuki Iwashima, Linkui Xiao, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit fafbc4051123d5459ea6950899cec08ed946e278 ]
ireq->ipv6_opt is only set by calipso_req_setattr(), when a CALIPSO
NetLabel mapping is configured.
Request socket migration (net.ipv4.tcp_migrate_req=1, or a
BPF_SK_REUSEPORT_SELECT_OR_MIGRATE program) clones the request
socket with inet_reqsk_clone(), so that the old request socket and
its clone share the same ipv6_opt, then reqsk_migrate_reset() clears
the pointer in the old one.
Another cpu holding a reference on the old request socket can still
be using these options, sending a SYNACK from tcp_v6_send_synack()
or creating a child in tcp_v6_syn_recv_sock(), when the clone
is freed. tcp_v6_reqsk_destructor() frees ipv6_opt with a plain
kfree(), leading to a use-after-free.
Both readers already run under RCU, like their IPv4 counterparts.
Use kfree_rcu() in tcp_v6_reqsk_destructor(), as commit e3f33b0a1d89
("ipv4: free inet_opt and ireq_opt after an RCU grace period") did
for ireq_opt.
Fixes: c905dee62232 ("tcp: Migrate TCP_NEW_SYN_RECV requests at retransmitting SYN+ACKs.")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179369559062.488856.15441115725436277776@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Tested-by: Linkui Xiao <xiaolinkui@kylinos.cn>
Link: https://patch.msgid.link/20261103090011.4128420-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/tcp_ipv6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 62ed0886af74b..479a4a74d1d17 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -574,7 +574,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
static void tcp_v6_reqsk_destructor(struct request_sock *req)
{
- kfree(inet_rsk(req)->ipv6_opt);
+ kfree_rcu(inet_rsk(req)->ipv6_opt, rcu);
consume_skb(inet_rsk(req)->pktopts);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0138/1059] MIPS: Avoid dead code/data elimination when using recordmcount
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (136 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0137/1059] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0139/1059] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory Greg Kroah-Hartman
` (860 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Thomas Bogendoerfer,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 255d9dbd936f7db8b963e82429f6e57cd9d48999 ]
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION builds with -ffunction-sections,
placing every function in its own section. recordmcount refuses to use
weak symbols as section bases, as a strong definition could override
them, so a weak function alone in its section, such as the generic
pcibios_fixup_bus() stub, breaks the build:
Cannot find symbol for section 88: .text.pcibios_fixup_bus.
drivers/pci/probe.o: failed
MIPS always records mcount locations with recordmcount, so this hits
any config with the function tracer and dead code elimination enabled,
e.g. malta_defconfig built with LLVM=1.
Only offer dead code elimination when recordmcount is not used, as
powerpc does since commit f8b2336f15f3 ("powerpc: Avoid dead code/data
elimination when using recordmcount"). In practice this makes it
unavailable together with the function tracer on MIPS.
Fixes: c0436b503591 ("MIPS: Enable dead code elimination")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 585783c9907ef..3075178e28d7f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -80,7 +80,7 @@ config MIPS
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES
select HAVE_KRETPROBES
- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !FTRACE_MCOUNT_USE_RECORDMCOUNT
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PERF_EVENTS
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0139/1059] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (137 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0138/1059] MIPS: Avoid dead code/data elimination when using recordmcount Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0140/1059] MIPS: SB1250: Validate and update IRQ affinity Greg Kroah-Hartman
` (859 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Thomas Bogendoerfer, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit 792ac17faa0503448f3ef85b49f16456ac54ab84 ]
Alchemy keeps pointers into the firmware environment and looks up ethaddr
when initializing the Ethernet devices. By that point, memory allocation
can have overwritten the environment, causing prom_getenv() to pass an
invalid pointer to strchr() and panic during boot.
On the MTX-1, the struct page layout change in 9ddb3c14afba reduces struct
page from 40 to 32 bytes and exposes this unreserved firmware memory.
Bisection and boot tests confirmed that the parent boots while the change
reproduces the panic.
Parse the Ethernet address during prom_init(), before registering RAM
with memblock, and keep the six bytes in kernel-owned init data. Return
the saved address during device initialization, preserving the existing
YAMON formats and command-line fallback without reserving a fixed
low-memory region.
Fixes: b93ddc4f9156 ("mips: Reserve memory for the kernel image resources")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/alchemy/common/prom.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index b13d8adf3be47..11dc800f75663 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -45,6 +45,11 @@ int prom_argc;
char **prom_argv;
char **prom_envp;
+static char prom_ethaddr[6] __initdata;
+static bool prom_ethaddr_valid __initdata;
+
+static void __init prom_init_ethernet_addr(void);
+
void __init prom_init_cmdline(void)
{
int i;
@@ -94,6 +99,9 @@ void __init prom_init(void)
if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = SZ_64M; /* minimum memsize is 64MB RAM */
+ /* Save the MAC before the allocator can reuse the PROM environment. */
+ prom_init_ethernet_addr();
+
memblock_add(0, memsize);
}
@@ -124,7 +132,7 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
}
}
-int __init prom_get_ethernet_addr(char *ethernet_addr)
+static void __init prom_init_ethernet_addr(void)
{
char *ethaddr_str;
@@ -134,12 +142,21 @@ int __init prom_get_ethernet_addr(char *ethernet_addr)
/* Check command line */
ethaddr_str = strstr(arcs_cmdline, "ethaddr=");
if (!ethaddr_str)
- return -1;
+ return;
ethaddr_str += strlen("ethaddr=");
}
- str2eaddr(ethernet_addr, ethaddr_str);
+ str2eaddr(prom_ethaddr, ethaddr_str);
+ prom_ethaddr_valid = true;
+}
+
+int __init prom_get_ethernet_addr(char *ethernet_addr)
+{
+ if (!prom_ethaddr_valid)
+ return -1;
+
+ memcpy(ethernet_addr, prom_ethaddr, sizeof(prom_ethaddr));
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0140/1059] MIPS: SB1250: Validate and update IRQ affinity
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (138 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0139/1059] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0141/1059] vfs: preserve subsecond timestamps at filesystem time limits Greg Kroah-Hartman
` (858 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Thomas Bogendoerfer, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit 456c965ca46c59a4a241c755e6565fd883a522f4 ]
sb1250_set_affinity() selects the first online CPU in the requested
affinity mask without checking whether such a CPU exists. If the
intersection is empty, the resulting CPU index is invalid and must
not be passed to cpu_logical_map().
Reject affinity masks containing no online CPU with -EINVAL before
accessing the CPU mapping or interrupt mapper registers.
Also update the effective affinity mask to reflect the single logical
CPU selected as the interrupt target.
Fixes: 421d1563c662 ("mips: Validate online cpus in irq_set_affinity() callbacks")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/sibyte/sb1250/irq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 2f08ad267a11e..d7a656cd7ec0c 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -76,6 +76,8 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
unsigned long flags;
i = cpumask_first_and(mask, cpu_online_mask);
+ if (i >= nr_cpu_ids)
+ return -EINVAL;
/* Convert logical CPU to physical CPU */
cpu = cpu_logical_map(i);
@@ -103,6 +105,7 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
R_IMR_INTERRUPT_MASK));
}
+ irq_data_update_effective_affinity(d, cpumask_of(i));
raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0141/1059] vfs: preserve subsecond timestamps at filesystem time limits
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (139 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0140/1059] MIPS: SB1250: Validate and update IRQ affinity Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0142/1059] sched/pelt: Fix u32 truncation of the PELT period count Greg Kroah-Hartman
` (857 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hungyu Lin, Jeff Layton,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
[ Upstream commit 55a0c91000646b008261e3b1e15d1e774f3026e4 ]
timestamp_truncate() clears tv_nsec whenever the clamped seconds equal
either filesystem time limit. This also drops the fractional part of
timestamps whose seconds were already within the supported range.
For example, setting a JFS mtime to 0.123456789 produces 0.000000000,
although the filesystem can store the requested value. Utilities such
as touch and cp -p consequently lose valid subsecond timestamps when
preserving these endpoint values. Timestamps strictly between the
filesystem limits are unaffected.
Only clear tv_nsec when clamping actually changes tv_sec. Continue to
truncate in-range nanoseconds to the filesystem's timestamp granularity,
including when the seconds equal either endpoint.
Ben Hutchings suggested comparing clamped and original seconds in the
2019 utimes review. That caller was switched to timestamp_truncate(),
but the helper retained its endpoint equality check.
Link: https://lore.kernel.org/lkml/12c095e595836a7ff7f2c7b2a32cb5544dd29b55.camel@codethink.co.uk/
Fixes: 50e17c000c46 ("vfs: Add timestamp_truncate() api")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Link: https://patch.msgid.link/20261101113815.52911-1-dennylin0707@gmail.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/inode.c b/fs/inode.c
index 08fbf3648ce78..c21db9bf09d4d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2512,9 +2512,10 @@ struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode)
{
struct super_block *sb = inode->i_sb;
unsigned int gran = sb->s_time_gran;
+ time64_t seconds = t.tv_sec;
t.tv_sec = clamp(t.tv_sec, sb->s_time_min, sb->s_time_max);
- if (unlikely(t.tv_sec == sb->s_time_max || t.tv_sec == sb->s_time_min))
+ if (unlikely(t.tv_sec != seconds))
t.tv_nsec = 0;
/* Avoid division in the common cases 1 ns and 1 s. */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0142/1059] sched/pelt: Fix u32 truncation of the PELT period count
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (140 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0141/1059] vfs: preserve subsecond timestamps at filesystem time limits Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0143/1059] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND Greg Kroah-Hartman
` (856 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hui Su, Peter Zijlstra (Intel),
Ingo Molnar, Vincent Guittot, Kayra Cizmeci, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <sh_def@163.com>
[ Upstream commit a0c755e574e37fddb59edf175f27dc3877e7fe23 ]
accumulate_sum() computes the number of elapsed PELT periods in a
u64 but returns u32. When the count is a multiple of 2^32, it is
truncated to zero even though the PELT sums have been updated.
The caller interprets zero as no period boundary crossed and skips
recomputing the averages, leaving *_avg stale relative to *_sum.
Return the period count as u64 so the caller can test it without
truncation.
Fixes: a481db34b9be ("sched/fair: Optimize ___update_sched_avg()")
Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://patch.msgid.link/20261023025207.2967903-1-sh_def@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/pelt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index 0f310768260c1..e7433f87c6294 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -98,7 +98,7 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3)
* d1 y^p + 1024 \Sum y^n + d3 y^0 (Step 2)
* n=1
*/
-static __always_inline u32
+static __always_inline u64
accumulate_sum(u64 delta, struct sched_avg *sa,
unsigned long load, unsigned long runnable, int running)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0143/1059] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (141 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0142/1059] sched/pelt: Fix u32 truncation of the PELT period count Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0144/1059] locking/osq_lock: Clarify osq_wait_next() calling convention Greg Kroah-Hartman
` (855 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Eric Dumazet,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 475ff14ba558bb8857bca878f1d593784ccc4f0f ]
snd_cwnd has no practical upper bound: snd_cwnd_clamp defaults to ~0,
and RTAX_INITCWND, a locked RTAX_CWND metric, TCP_BPF_IW and
TCP_BPF_SNDCWND_CLAMP accept any positive value.
Congestion control modules do u32 arithmetic on cwnd that assumes
much smaller values. For instance, ssthresh() handlers compute:
CUBIC, BIC, ROCCET: cwnd * (BICTCP_BETA_SCALE + beta), up to 2047
DCTCP: cwnd * dctcp_alpha, up to 1024
CDG, NV, CUBIC, ...: cwnd * beta, below 1024
With a large initcwnd route or TCP_BPF_IW, cwnd is set directly to
such values, and the next RTO or recovery calls ->ssthresh() with it.
The product then wraps: DCTCP with cwnd = 2^24 and alpha = 1024 gets
ssthresh == cwnd, and CUBIC computes a wrong ssthresh and Wmax.
CUBIC bictcp_update() also expects cwnd below about one million packets.
The paths that can grow cwnd by large amounts (tcp_slow_start(),
tcp_cong_avoid_ai(), bbr_set_cwnd() and tcp_init_cwnd()) already
bound it by snd_cwnd_clamp, so give snd_cwnd_clamp a finite default
of 2^20 packets, and cap the metric and BPF paths that set it or set
cwnd directly.
2^20 packets do not limit real flows: with the maximum window scale
of 14, a peer can not advertise more than 65535 << 14 bytes (~1GB),
which is less than 2^20 packets for any MSS of 1024 bytes or more.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Chris Mason <mason@kernel.org>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261030111528.2850082-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/tcp.h | 9 +++++++++
net/core/filter.c | 3 ++-
net/ipv4/tcp.c | 2 +-
net/ipv4/tcp_metrics.c | 3 ++-
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ff8025ff25a4e..0b618584fdbcb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1250,6 +1250,15 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
#define TCP_INFINITE_SSTHRESH 0x7fffffff
+/* Default and maximum snd_cwnd_clamp, in packets.
+ * A peer can not advertise more than 65535 << 14 bytes, so a larger
+ * cwnd is useless with any MSS of 1024 bytes or more.
+ * Congestion control modules multiply cwnd by u32 factors up to 2047
+ * (cwnd * (BICTCP_BETA_SCALE + beta) in CUBIC), and CUBIC's
+ * bictcp_update() expects cwnd to stay below about one million packets.
+ */
+#define TCP_MAX_SND_CWND (1U << 20)
+
static inline u32 tcp_snd_cwnd(const struct tcp_sock *tp)
{
return tp->snd_cwnd;
diff --git a/net/core/filter.c b/net/core/filter.c
index bdb60caa7b36b..fe89172f39cb4 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5291,11 +5291,12 @@ static int bpf_sol_tcp_setsockopt(struct sock *sk, int optname,
case TCP_BPF_IW:
if (val <= 0 || tp->data_segs_out > tp->syn_data)
return -EINVAL;
- tcp_snd_cwnd_set(tp, val);
+ tcp_snd_cwnd_set(tp, min_t(u32, val, tp->snd_cwnd_clamp));
break;
case TCP_BPF_SNDCWND_CLAMP:
if (val <= 0)
return -EINVAL;
+ val = min_t(u32, val, TCP_MAX_SND_CWND);
tp->snd_cwnd_clamp = val;
tp->snd_ssthresh = val;
break;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2c9b377c4b4d7..0d0cf7848d83b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -442,7 +442,7 @@ void tcp_init_sock(struct sock *sk)
* initialization of these values.
*/
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
- tp->snd_cwnd_clamp = ~0;
+ tp->snd_cwnd_clamp = TCP_MAX_SND_CWND;
tp->mss_cache = TCP_MSS_DEFAULT;
tp->reordering = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reordering);
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 29969168f41db..e817d187af3af 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -495,7 +495,8 @@ void tcp_init_metrics(struct sock *sk)
}
if (tcp_metric_locked(tm, TCP_METRIC_CWND))
- tp->snd_cwnd_clamp = tcp_metric_get(tm, TCP_METRIC_CWND);
+ tp->snd_cwnd_clamp = min(tcp_metric_get(tm, TCP_METRIC_CWND),
+ TCP_MAX_SND_CWND);
val = READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) ?
0 : tcp_metric_get(tm, TCP_METRIC_SSTHRESH);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0144/1059] locking/osq_lock: Clarify osq_wait_next() calling convention
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (142 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0143/1059] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0145/1059] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering Greg Kroah-Hartman
` (854 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Linus Torvalds,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Laight <David.Laight@ACULAB.COM>
[ Upstream commit 563adbfc351b2af9f1406b809ba60b9f1673a882 ]
osq_wait_next() is passed 'prev' from osq_lock() and NULL from
osq_unlock() but only needs the 'cpu' value to write to lock->tail.
Just pass prev->cpu or OSQ_UNLOCKED_VAL instead.
Should have no effect on the generated code since gcc manages to assume
that 'prev != NULL' due to an earlier dereference.
Signed-off-by: David Laight <david.laight@aculab.com>
[ Changed 'old' to 'old_cpu' by request from Waiman Long - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Stable-dep-of: 1b9e01fcc47a ("locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/locking/osq_lock.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index d5610ad52b92b..ebb1493915ce9 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -37,26 +37,23 @@ static inline struct optimistic_spin_node *decode_cpu(int encoded_cpu_val)
/*
* Get a stable @node->next pointer, either for unlock() or unqueue() purposes.
* Can return NULL in case we were the last queued and we updated @lock instead.
+ *
+ * If osq_lock() is being cancelled there must be a previous node
+ * and 'old_cpu' is its CPU #.
+ * For osq_unlock() there is never a previous node and old_cpu is
+ * set to OSQ_UNLOCKED_VAL.
*/
static inline struct optimistic_spin_node *
osq_wait_next(struct optimistic_spin_queue *lock,
struct optimistic_spin_node *node,
- struct optimistic_spin_node *prev)
+ int old_cpu)
{
struct optimistic_spin_node *next = NULL;
int curr = encode_cpu(smp_processor_id());
- int old;
-
- /*
- * If there is a prev node in queue, then the 'old' value will be
- * the prev node's CPU #, else it's set to OSQ_UNLOCKED_VAL since if
- * we're currently last in queue, then the queue will then become empty.
- */
- old = prev ? prev->cpu : OSQ_UNLOCKED_VAL;
for (;;) {
if (atomic_read(&lock->tail) == curr &&
- atomic_cmpxchg_acquire(&lock->tail, curr, old) == curr) {
+ atomic_cmpxchg_acquire(&lock->tail, curr, old_cpu) == curr) {
/*
* We were the last queued, we moved @lock back. @prev
* will now observe @lock and will complete its
@@ -186,7 +183,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
* back to @prev.
*/
- next = osq_wait_next(lock, node, prev);
+ next = osq_wait_next(lock, node, prev->cpu);
if (!next)
return false;
@@ -226,7 +223,7 @@ void osq_unlock(struct optimistic_spin_queue *lock)
return;
}
- next = osq_wait_next(lock, node, NULL);
+ next = osq_wait_next(lock, node, OSQ_UNLOCKED_VAL);
if (next)
WRITE_ONCE(next->locked, 1);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0145/1059] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (143 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0144/1059] locking/osq_lock: Clarify osq_wait_next() calling convention Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0146/1059] locking/osq: Fix unlink queue corruption Greg Kroah-Hartman
` (853 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Peter Zijlstra (Intel),
Ingo Molnar, Linus Torvalds, Waiman Long, linux-kernel,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 1b9e01fcc47aff00d2fd64693c5dcd620eff5865 ]
The atomic_cmpxchg() in osq_wait_next() removes the current CPU's node
from the tail of the queue and puts @old_cpu back.
This is very much like an 'unlock', which is RELEASE, rather than
ACQUIRE.
Additionally, on success (the only case where the ordering is
effective), this returns NULL which means both callsites will do nothing
more, there are no subsequent operations to order against.
Furthermore, the osq_lock() caller will then return false, indicating
failure to acquire -- the mutex must go block. Again, not making a case
for ACQUIRE. Neither atomics nor locks provide ordering on failure.
Since ACQUIRE makes no sense, while RELEASE makes it more symmetric with
osq_unlock(), switch the ordering. This then makes osq_unlock()
consistently RELEASE.
Fixes: c55a6ffa6285 ("locking/osq: Relax atomic semantics")
Suggested-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/locking/osq_lock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index ebb1493915ce9..b3748ed287ebb 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -53,7 +53,7 @@ osq_wait_next(struct optimistic_spin_queue *lock,
for (;;) {
if (atomic_read(&lock->tail) == curr &&
- atomic_cmpxchg_acquire(&lock->tail, curr, old_cpu) == curr) {
+ atomic_cmpxchg_release(&lock->tail, curr, old_cpu) == curr) {
/*
* We were the last queued, we moved @lock back. @prev
* will now observe @lock and will complete its
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0146/1059] locking/osq: Fix unlink queue corruption
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (144 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0145/1059] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0147/1059] perf/x86/amd/uncore: Move discovery and registration Greg Kroah-Hartman
` (852 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Peter Zijlstra (Intel),
Ingo Molnar, Linus Torvalds, Waiman Long, linux-kernel,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 408b129aac48b574c0c9d11137a89eefba825d5d ]
Very similar to commit 50972fe78f24 ("locking/osq_lock: Fix osq_lock
queue corruption"), make sure to order the prev->next store against
the next->prev store.
Fixes: 50972fe78f24 ("locking/osq_lock: Fix osq_lock queue corruption")
Suggested-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/locking/osq_lock.c | 60 +++++++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index b3748ed287ebb..29597052f442c 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -84,6 +84,49 @@ osq_wait_next(struct optimistic_spin_queue *lock,
return next;
}
+/*
+ * Set prev->next; this is the counterpart of osq_wait_next() in that
+ * by setting ->next the wait is terminated and progress is resumed.
+ */
+static inline void osq_link_next(struct optimistic_spin_node *prev,
+ struct optimistic_spin_node *next)
+{
+ /*
+ * Suppose:
+ *
+ * tail
+ * |
+ * V
+ * CPU1 -> CPU2 -> CPU3:
+ * n: 2 n: 3 n: nil
+ * p: nil p: 1 p: 2
+ *
+ * And this is CPU2 doing the self-unqueue concurrent against CPU1s
+ * unlock()/unqueue(). Since 'prev->next == NULL' and CPU1 will be
+ * stuck in osq_wait_next() until the below store of 'prev->next'.
+ *
+ * CPU2 CPU1
+ *
+ * next->prev = prev; osq_wait_next()
+ * WMB MB
+ * prev->next = next; next->prev = prev
+ *
+ * Without the WMB it would be possible to have conflicting stores
+ * like:
+ *
+ * CPU2 CPU1
+ *
+ * prev->next = next // CPU1.n = 3
+ * next = osq_wait_next() // = 3
+ * next->prev = prev // CPU3.p = nil
+ * next->prev = prev // CPU3.p = 1
+ *
+ * Which would result in list corruption.
+ */
+ smp_wmb();
+ WRITE_ONCE(prev->next, next);
+}
+
bool osq_lock(struct optimistic_spin_queue *lock)
{
struct optimistic_spin_node *node = this_cpu_ptr(&osq_node);
@@ -107,20 +150,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
prev = decode_cpu(old);
node->prev = prev;
-
- /*
- * osq_lock() unqueue
- *
- * node->prev = prev osq_wait_next()
- * WMB MB
- * prev->next = node next->prev = prev // unqueue-C
- *
- * Here 'node->prev' and 'next->prev' are the same variable and we need
- * to ensure these stores happen in-order to avoid corrupting the list.
- */
- smp_wmb();
-
- WRITE_ONCE(prev->next, node);
+ osq_link_next(prev, node);
/*
* Normally @prev is untouchable after the above store; because at that
@@ -196,7 +226,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
*/
WRITE_ONCE(next->prev, prev);
- WRITE_ONCE(prev->next, next);
+ osq_link_next(prev, next);
return false;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0147/1059] perf/x86/amd/uncore: Move discovery and registration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (145 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0146/1059] locking/osq: Fix unlink queue corruption Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0148/1059] perf/x86/amd/uncore: Avoid context migration from non-owners Greg Kroah-Hartman
` (851 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sandipan Das, Peter Zijlstra (Intel),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <sandipan.das@amd.com>
[ Upstream commit 07888daa056e809de0b6b234116b575c11f9f99d ]
Uncore PMUs have traditionally been registered in the module init path.
This is fine for the existing DF and L3 PMUs since the CPUID information
does not vary across CPUs but not for the memory controller (UMC) PMUs
since information like active memory channels can vary for each socket
depending on how the DIMMs have been physically populated.
To overcome this, the discovery of PMU information using CPUID is moved
to the startup of UNCORE_STARTING. This cannot be done in the startup of
UNCORE_PREP since the hotplug callback does not run on the CPU that is
being brought online.
Previously, the startup of UNCORE_PREP was used for allocating uncore
contexts following which, the startup of UNCORE_STARTING was used to
find and reuse an existing sibling context, if possible. Any unused
contexts were added to a list for reclaimation later during the startup
of UNCORE_ONLINE.
Since all required CPUID info is now available only after the startup of
UNCORE_STARTING has completed, context allocation has been moved to the
startup of UNCORE_ONLINE. Before allocating contexts, the first CPU that
comes online has to take up the additional responsibility of registering
the PMUs. This is a one-time process though. Since sibling discovery now
happens prior to deciding whether a new context is required, there is no
longer a need to track and free up unused contexts.
The teardown of UNCORE_ONLINE and UNCORE_PREP functionally remain the
same.
Overall, the flow of control described above is achieved using the
following handlers for managing uncore PMUs. It is mandatory to define
them for each type of uncore PMU.
* scan() runs during startup of UNCORE_STARTING and collects PMU info
using CPUID.
* init() runs during startup of UNCORE_ONLINE, registers PMUs and sets
up uncore contexts.
* move() runs during teardown of UNCORE_ONLINE and migrates uncore
contexts to a shared sibling, if possible.
* free() runs during teardown of UNCORE_PREP and frees up uncore
contexts.
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/e6c447e48872fcab8452e0dd81b1c9cb09f39eb4.1696425185.git.sandipan.das@amd.com
Stable-dep-of: 0ae655bce193 ("perf/x86/amd/uncore: Avoid context migration from non-owners")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/events/amd/uncore.c | 494 +++++++++++++++++++++--------------
1 file changed, 305 insertions(+), 189 deletions(-)
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 33ccd42328207..f24122c41c430 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -26,8 +26,6 @@
#define RDPMC_BASE_LLC 10
#define COUNTER_SHIFT 16
-
-#define NUM_UNCORES_MAX 2 /* DF (or NB) and L3 (or L2) */
#define UNCORE_NAME_LEN 16
#undef pr_fmt
@@ -35,10 +33,7 @@
static int pmu_version;
-static HLIST_HEAD(uncore_unused_list);
-
struct amd_uncore_ctx {
- int id;
int refcnt;
int cpu;
struct perf_event **events;
@@ -53,11 +48,36 @@ struct amd_uncore_pmu {
cpumask_t active_mask;
struct pmu pmu;
struct amd_uncore_ctx * __percpu *ctx;
- int (*id)(unsigned int cpu);
};
-static struct amd_uncore_pmu pmus[NUM_UNCORES_MAX];
-static int num_pmus __read_mostly;
+enum {
+ UNCORE_TYPE_DF,
+ UNCORE_TYPE_L3,
+
+ UNCORE_TYPE_MAX
+};
+
+union amd_uncore_info {
+ struct {
+ u64 aux_data:32; /* auxiliary data */
+ u64 num_pmcs:8; /* number of counters */
+ u64 cid:8; /* context id */
+ } split;
+ u64 full;
+};
+
+struct amd_uncore {
+ union amd_uncore_info * __percpu info;
+ struct amd_uncore_pmu *pmus;
+ unsigned int num_pmus;
+ bool init_done;
+ void (*scan)(struct amd_uncore *uncore, unsigned int cpu);
+ int (*init)(struct amd_uncore *uncore, unsigned int cpu);
+ void (*move)(struct amd_uncore *uncore, unsigned int cpu);
+ void (*free)(struct amd_uncore *uncore, unsigned int cpu);
+};
+
+static struct amd_uncore uncores[UNCORE_TYPE_MAX];
static struct amd_uncore_pmu *event_to_amd_uncore_pmu(struct perf_event *event)
{
@@ -363,182 +383,192 @@ static const struct attribute_group *amd_uncore_l3_attr_update[] = {
NULL,
};
-static int amd_uncore_cpu_up_prepare(unsigned int cpu)
+static __always_inline
+int amd_uncore_ctx_cid(struct amd_uncore *uncore, unsigned int cpu)
{
- struct amd_uncore_pmu *pmu;
- struct amd_uncore_ctx *ctx;
- int node = cpu_to_node(cpu), i;
-
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- *per_cpu_ptr(pmu->ctx, cpu) = NULL;
- ctx = kzalloc_node(sizeof(struct amd_uncore_ctx), GFP_KERNEL,
- node);
- if (!ctx)
- goto fail;
-
- ctx->cpu = cpu;
- ctx->events = kzalloc_node(sizeof(struct perf_event *) *
- pmu->num_counters, GFP_KERNEL,
- node);
- if (!ctx->events)
- goto fail;
-
- ctx->id = -1;
- *per_cpu_ptr(pmu->ctx, cpu) = ctx;
- }
-
- return 0;
-
-fail:
- /* Rollback */
- for (; i >= 0; i--) {
- pmu = &pmus[i];
- ctx = *per_cpu_ptr(pmu->ctx, cpu);
- if (!ctx)
- continue;
-
- kfree(ctx->events);
- kfree(ctx);
- }
+ union amd_uncore_info *info = per_cpu_ptr(uncore->info, cpu);
+ return info->split.cid;
+}
- return -ENOMEM;
+static __always_inline
+int amd_uncore_ctx_num_pmcs(struct amd_uncore *uncore, unsigned int cpu)
+{
+ union amd_uncore_info *info = per_cpu_ptr(uncore->info, cpu);
+ return info->split.num_pmcs;
}
-static struct amd_uncore_ctx *
-amd_uncore_find_online_sibling(struct amd_uncore_ctx *this,
- struct amd_uncore_pmu *pmu)
+static void amd_uncore_ctx_free(struct amd_uncore *uncore, unsigned int cpu)
{
- unsigned int cpu;
- struct amd_uncore_ctx *that;
+ struct amd_uncore_pmu *pmu;
+ struct amd_uncore_ctx *ctx;
+ int i;
- for_each_online_cpu(cpu) {
- that = *per_cpu_ptr(pmu->ctx, cpu);
+ if (!uncore->init_done)
+ return;
- if (!that)
+ for (i = 0; i < uncore->num_pmus; i++) {
+ pmu = &uncore->pmus[i];
+ ctx = *per_cpu_ptr(pmu->ctx, cpu);
+ if (!ctx)
continue;
- if (this == that)
- continue;
+ if (cpu == ctx->cpu)
+ cpumask_clear_cpu(cpu, &pmu->active_mask);
- if (this->id == that->id) {
- hlist_add_head(&this->node, &uncore_unused_list);
- this = that;
- break;
+ if (!--ctx->refcnt) {
+ kfree(ctx->events);
+ kfree(ctx);
}
- }
- this->refcnt++;
- return this;
+ *per_cpu_ptr(pmu->ctx, cpu) = NULL;
+ }
}
-static int amd_uncore_cpu_starting(unsigned int cpu)
+static int amd_uncore_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
{
+ struct amd_uncore_ctx *curr, *prev;
struct amd_uncore_pmu *pmu;
- struct amd_uncore_ctx *ctx;
- int i;
+ int node, cid, i, j;
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- ctx = *per_cpu_ptr(pmu->ctx, cpu);
- ctx->id = pmu->id(cpu);
- ctx = amd_uncore_find_online_sibling(ctx, pmu);
- *per_cpu_ptr(pmu->ctx, cpu) = ctx;
- }
+ if (!uncore->init_done || !uncore->num_pmus)
+ return 0;
- return 0;
-}
+ cid = amd_uncore_ctx_cid(uncore, cpu);
-static void uncore_clean_online(void)
-{
- struct amd_uncore_ctx *ctx;
- struct hlist_node *n;
+ for (i = 0; i < uncore->num_pmus; i++) {
+ pmu = &uncore->pmus[i];
+ *per_cpu_ptr(pmu->ctx, cpu) = NULL;
+ curr = NULL;
- hlist_for_each_entry_safe(ctx, n, &uncore_unused_list, node) {
- hlist_del(&ctx->node);
- kfree(ctx->events);
- kfree(ctx);
- }
-}
+ /* Find a sibling context */
+ for_each_online_cpu(j) {
+ if (cpu == j)
+ continue;
-static int amd_uncore_cpu_online(unsigned int cpu)
-{
- struct amd_uncore_pmu *pmu;
- struct amd_uncore_ctx *ctx;
- int i;
+ prev = *per_cpu_ptr(pmu->ctx, j);
+ if (!prev)
+ continue;
- uncore_clean_online();
+ if (cid == amd_uncore_ctx_cid(uncore, j)) {
+ curr = prev;
+ break;
+ }
+ }
+
+ /* Allocate context if sibling does not exist */
+ if (!curr) {
+ node = cpu_to_node(cpu);
+ curr = kzalloc_node(sizeof(*curr), GFP_KERNEL, node);
+ if (!curr)
+ goto fail;
+
+ curr->cpu = cpu;
+ curr->events = kzalloc_node(sizeof(*curr->events) *
+ pmu->num_counters,
+ GFP_KERNEL, node);
+ if (!curr->events) {
+ kfree(curr);
+ goto fail;
+ }
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- ctx = *per_cpu_ptr(pmu->ctx, cpu);
- if (cpu == ctx->cpu)
cpumask_set_cpu(cpu, &pmu->active_mask);
+ }
+
+ curr->refcnt++;
+ *per_cpu_ptr(pmu->ctx, cpu) = curr;
}
return 0;
+
+fail:
+ amd_uncore_ctx_free(uncore, cpu);
+
+ return -ENOMEM;
}
-static int amd_uncore_cpu_down_prepare(unsigned int cpu)
+static void amd_uncore_ctx_move(struct amd_uncore *uncore, unsigned int cpu)
{
- struct amd_uncore_ctx *this, *that;
+ struct amd_uncore_ctx *curr, *next;
struct amd_uncore_pmu *pmu;
int i, j;
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- this = *per_cpu_ptr(pmu->ctx, cpu);
+ if (!uncore->init_done)
+ return;
- /* this cpu is going down, migrate to a shared sibling if possible */
- for_each_online_cpu(j) {
- that = *per_cpu_ptr(pmu->ctx, j);
+ for (i = 0; i < uncore->num_pmus; i++) {
+ pmu = &uncore->pmus[i];
+ curr = *per_cpu_ptr(pmu->ctx, cpu);
+ if (!curr)
+ continue;
- if (cpu == j)
+ /* Migrate to a shared sibling if possible */
+ for_each_online_cpu(j) {
+ next = *per_cpu_ptr(pmu->ctx, j);
+ if (!next || cpu == j)
continue;
- if (this == that) {
+ if (curr == next) {
perf_pmu_migrate_context(&pmu->pmu, cpu, j);
cpumask_clear_cpu(cpu, &pmu->active_mask);
cpumask_set_cpu(j, &pmu->active_mask);
- that->cpu = j;
+ next->cpu = j;
break;
}
}
}
+}
+
+static int amd_uncore_cpu_starting(unsigned int cpu)
+{
+ struct amd_uncore *uncore;
+ int i;
+
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ uncore->scan(uncore, cpu);
+ }
return 0;
}
-static int amd_uncore_cpu_dead(unsigned int cpu)
+static int amd_uncore_cpu_online(unsigned int cpu)
{
- struct amd_uncore_ctx *ctx;
- struct amd_uncore_pmu *pmu;
+ struct amd_uncore *uncore;
int i;
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- ctx = *per_cpu_ptr(pmu->ctx, cpu);
- if (cpu == ctx->cpu)
- cpumask_clear_cpu(cpu, &pmu->active_mask);
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ if (uncore->init(uncore, cpu))
+ break;
+ }
- if (!--ctx->refcnt) {
- kfree(ctx->events);
- kfree(ctx);
- }
+ return 0;
+}
- *per_cpu_ptr(pmu->ctx, cpu) = NULL;
+static int amd_uncore_cpu_down_prepare(unsigned int cpu)
+{
+ struct amd_uncore *uncore;
+ int i;
+
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ uncore->move(uncore, cpu);
}
return 0;
}
-static int amd_uncore_df_id(unsigned int cpu)
+static int amd_uncore_cpu_dead(unsigned int cpu)
{
- unsigned int eax, ebx, ecx, edx;
+ struct amd_uncore *uncore;
+ int i;
- cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ uncore->free(uncore, cpu);
+ }
- return ecx & 0xff;
+ return 0;
}
static int amd_uncore_df_event_init(struct perf_event *event)
@@ -578,41 +608,66 @@ static int amd_uncore_df_add(struct perf_event *event, int flags)
return 0;
}
-static int amd_uncore_df_init(void)
+static
+void amd_uncore_df_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
{
- struct attribute **df_attr = amd_uncore_df_format_attr;
- struct amd_uncore_pmu *pmu = &pmus[num_pmus];
union cpuid_0x80000022_ebx ebx;
- int ret;
+ union amd_uncore_info info;
if (!boot_cpu_has(X86_FEATURE_PERFCTR_NB))
- return 0;
+ return;
+
+ info.split.aux_data = 0;
+ info.split.num_pmcs = NUM_COUNTERS_NB;
+ info.split.cid = topology_die_id(cpu);
+
+ if (pmu_version >= 2) {
+ ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
+ info.split.num_pmcs = ebx.split.num_df_pmc;
+ }
+
+ *per_cpu_ptr(uncore->info, cpu) = info;
+}
+
+static
+int amd_uncore_df_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
+{
+ struct attribute **df_attr = amd_uncore_df_format_attr;
+ struct amd_uncore_pmu *pmu;
+
+ /* Run just once */
+ if (uncore->init_done)
+ return amd_uncore_ctx_init(uncore, cpu);
+
+ /* No grouping, single instance for a system */
+ uncore->pmus = kzalloc(sizeof(*uncore->pmus), GFP_KERNEL);
+ if (!uncore->pmus) {
+ uncore->num_pmus = 0;
+ goto done;
+ }
/*
* For Family 17h and above, the Northbridge counters are repurposed
* as Data Fabric counters. The PMUs are exported based on family as
* either NB or DF.
*/
+ pmu = &uncore->pmus[0];
strscpy(pmu->name, boot_cpu_data.x86 >= 0x17 ? "amd_df" : "amd_nb",
sizeof(pmu->name));
-
- pmu->num_counters = NUM_COUNTERS_NB;
+ pmu->num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
pmu->msr_base = MSR_F15H_NB_PERF_CTL;
pmu->rdpmc_base = RDPMC_BASE_NB;
- pmu->id = amd_uncore_df_id;
if (pmu_version >= 2) {
*df_attr++ = &format_attr_event14v2.attr;
*df_attr++ = &format_attr_umask12.attr;
- ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
- pmu->num_counters = ebx.split.num_df_pmc;
} else if (boot_cpu_data.x86 >= 0x17) {
*df_attr = &format_attr_event14.attr;
}
pmu->ctx = alloc_percpu(struct amd_uncore_ctx *);
if (!pmu->ctx)
- return -ENOMEM;
+ goto done;
pmu->pmu = (struct pmu) {
.task_ctx_nr = perf_invalid_context,
@@ -628,25 +683,22 @@ static int amd_uncore_df_init(void)
.module = THIS_MODULE,
};
- ret = perf_pmu_register(&pmu->pmu, pmu->pmu.name, -1);
- if (ret) {
+ if (perf_pmu_register(&pmu->pmu, pmu->pmu.name, -1)) {
free_percpu(pmu->ctx);
pmu->ctx = NULL;
- return ret;
+ goto done;
}
- pr_info("%d %s %s counters detected\n", pmu->num_counters,
- boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? "HYGON" : "",
+ pr_info("%d %s%s counters detected\n", pmu->num_counters,
+ boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? "HYGON " : "",
pmu->pmu.name);
- num_pmus++;
+ uncore->num_pmus = 1;
- return 0;
-}
+done:
+ uncore->init_done = true;
-static int amd_uncore_l3_id(unsigned int cpu)
-{
- return get_llc_id(cpu);
+ return amd_uncore_ctx_init(uncore, cpu);
}
static int amd_uncore_l3_event_init(struct perf_event *event)
@@ -688,27 +740,52 @@ static int amd_uncore_l3_event_init(struct perf_event *event)
return 0;
}
-static int amd_uncore_l3_init(void)
+static
+void amd_uncore_l3_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
{
- struct attribute **l3_attr = amd_uncore_l3_format_attr;
- struct amd_uncore_pmu *pmu = &pmus[num_pmus];
- int ret;
+ union amd_uncore_info info;
if (!boot_cpu_has(X86_FEATURE_PERFCTR_LLC))
- return 0;
+ return;
+
+ info.split.aux_data = 0;
+ info.split.num_pmcs = NUM_COUNTERS_L2;
+ info.split.cid = get_llc_id(cpu);
+
+ if (boot_cpu_data.x86 >= 0x17)
+ info.split.num_pmcs = NUM_COUNTERS_L3;
+
+ *per_cpu_ptr(uncore->info, cpu) = info;
+}
+
+static
+int amd_uncore_l3_ctx_init(struct amd_uncore *uncore, unsigned int cpu)
+{
+ struct attribute **l3_attr = amd_uncore_l3_format_attr;
+ struct amd_uncore_pmu *pmu;
+
+ /* Run just once */
+ if (uncore->init_done)
+ return amd_uncore_ctx_init(uncore, cpu);
+
+ /* No grouping, single instance for a system */
+ uncore->pmus = kzalloc(sizeof(*uncore->pmus), GFP_KERNEL);
+ if (!uncore->pmus) {
+ uncore->num_pmus = 0;
+ goto done;
+ }
/*
* For Family 17h and above, L3 cache counters are available instead
* of L2 cache counters. The PMUs are exported based on family as
* either L2 or L3.
*/
+ pmu = &uncore->pmus[0];
strscpy(pmu->name, boot_cpu_data.x86 >= 0x17 ? "amd_l3" : "amd_l2",
sizeof(pmu->name));
-
- pmu->num_counters = NUM_COUNTERS_L2;
+ pmu->num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
pmu->msr_base = MSR_F16H_L2I_PERF_CTL;
pmu->rdpmc_base = RDPMC_BASE_LLC;
- pmu->id = amd_uncore_l3_id;
if (boot_cpu_data.x86 >= 0x17) {
*l3_attr++ = &format_attr_event8.attr;
@@ -716,12 +793,11 @@ static int amd_uncore_l3_init(void)
*l3_attr++ = boot_cpu_data.x86 >= 0x19 ?
&format_attr_threadmask2.attr :
&format_attr_threadmask8.attr;
- pmu->num_counters = NUM_COUNTERS_L3;
}
pmu->ctx = alloc_percpu(struct amd_uncore_ctx *);
if (!pmu->ctx)
- return -ENOMEM;
+ goto done;
pmu->pmu = (struct pmu) {
.task_ctx_nr = perf_invalid_context,
@@ -738,43 +814,45 @@ static int amd_uncore_l3_init(void)
.module = THIS_MODULE,
};
- ret = perf_pmu_register(&pmu->pmu, pmu->pmu.name, -1);
- if (ret) {
+ if (perf_pmu_register(&pmu->pmu, pmu->pmu.name, -1)) {
free_percpu(pmu->ctx);
pmu->ctx = NULL;
- return ret;
+ goto done;
}
- pr_info("%d %s %s counters detected\n", pmu->num_counters,
- boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? "HYGON" : "",
+ pr_info("%d %s%s counters detected\n", pmu->num_counters,
+ boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ? "HYGON " : "",
pmu->pmu.name);
- num_pmus++;
-
- return 0;
-}
-
-static void uncore_free(void)
-{
- struct amd_uncore_pmu *pmu;
- int i;
+ uncore->num_pmus = 1;
- for (i = 0; i < num_pmus; i++) {
- pmu = &pmus[i];
- if (!pmu->ctx)
- continue;
-
- perf_pmu_unregister(&pmu->pmu);
- free_percpu(pmu->ctx);
- pmu->ctx = NULL;
- }
+done:
+ uncore->init_done = true;
- num_pmus = 0;
+ return amd_uncore_ctx_init(uncore, cpu);
}
+static struct amd_uncore uncores[UNCORE_TYPE_MAX] = {
+ /* UNCORE_TYPE_DF */
+ {
+ .scan = amd_uncore_df_ctx_scan,
+ .init = amd_uncore_df_ctx_init,
+ .move = amd_uncore_ctx_move,
+ .free = amd_uncore_ctx_free,
+ },
+ /* UNCORE_TYPE_L3 */
+ {
+ .scan = amd_uncore_l3_ctx_scan,
+ .init = amd_uncore_l3_ctx_init,
+ .move = amd_uncore_ctx_move,
+ .free = amd_uncore_ctx_free,
+ },
+};
+
static int __init amd_uncore_init(void)
{
- int ret;
+ struct amd_uncore *uncore;
+ int ret, i;
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
@@ -786,20 +864,27 @@ static int __init amd_uncore_init(void)
if (boot_cpu_has(X86_FEATURE_PERFMON_V2))
pmu_version = 2;
- ret = amd_uncore_df_init();
- if (ret)
- goto fail;
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
- ret = amd_uncore_l3_init();
- if (ret)
- goto fail;
+ BUG_ON(!uncore->scan);
+ BUG_ON(!uncore->init);
+ BUG_ON(!uncore->move);
+ BUG_ON(!uncore->free);
+
+ uncore->info = alloc_percpu(union amd_uncore_info);
+ if (!uncore->info) {
+ ret = -ENOMEM;
+ goto fail;
+ }
+ };
/*
* Install callbacks. Core will call them for each online cpu.
*/
if (cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP,
"perf/x86/amd/uncore:prepare",
- amd_uncore_cpu_up_prepare, amd_uncore_cpu_dead))
+ NULL, amd_uncore_cpu_dead))
goto fail;
if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
@@ -818,17 +903,48 @@ static int __init amd_uncore_init(void)
fail_prep:
cpuhp_remove_state(CPUHP_PERF_X86_AMD_UNCORE_PREP);
fail:
- uncore_free();
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ if (uncore->info) {
+ free_percpu(uncore->info);
+ uncore->info = NULL;
+ }
+ }
return ret;
}
static void __exit amd_uncore_exit(void)
{
+ struct amd_uncore *uncore;
+ struct amd_uncore_pmu *pmu;
+ int i, j;
+
cpuhp_remove_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE);
cpuhp_remove_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING);
cpuhp_remove_state(CPUHP_PERF_X86_AMD_UNCORE_PREP);
- uncore_free();
+
+ for (i = 0; i < UNCORE_TYPE_MAX; i++) {
+ uncore = &uncores[i];
+ if (!uncore->info)
+ continue;
+
+ free_percpu(uncore->info);
+ uncore->info = NULL;
+
+ for (j = 0; j < uncore->num_pmus; j++) {
+ pmu = &uncore->pmus[j];
+ if (!pmu->ctx)
+ continue;
+
+ perf_pmu_unregister(&pmu->pmu);
+ free_percpu(pmu->ctx);
+ pmu->ctx = NULL;
+ }
+
+ kfree(uncore->pmus);
+ uncore->pmus = NULL;
+ }
}
module_init(amd_uncore_init);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0148/1059] perf/x86/amd/uncore: Avoid context migration from non-owners
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (146 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0147/1059] perf/x86/amd/uncore: Move discovery and registration Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0149/1059] cpufreq: Force sync policy boost with global boost on sysfs update Greg Kroah-Hartman
` (850 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sandipan Das, Peter Zijlstra (Intel),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <sandipan.das@amd.com>
[ Upstream commit 0ae655bce1934857fa3e316ddcb4be38c30dbd38 ]
Each uncore context is owned by a single CPU that hosts all events for
the corresponding uncore domain and is advertised through the sysfs
cpumask attribute. When a CPU goes offline, the context is migrated to
an online sibling if the departing CPU is the owner.
Before commit d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore
management"), uncore_down_prepare() checked whether the CPU going
offline owned the context. The check was lost when the function was
replaced by amd_uncore_ctx_move(). Hence, when a CPU that is not the
owner goes offline, ownership is always handed over to the first online
sibling in the uncore domain irrespective of whether another sibling
already owns it. This goes unnoticed as long as the owner is the
lowest-numbered online CPU in the domain, since the first online
sibling is then the owner itself. Once ownership has moved, that no
longer holds.
For example, consider an L3 domain spanning CPUs 8-15,136-143 and owned
by CPU 8.
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 0 | sudo tee /sys/devices/system/cpu/cpu8/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 1 | sudo tee /sys/devices/system/cpu/cpu8/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 0 | sudo tee /sys/devices/system/cpu/cpu10/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,8-9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
Offlining CPU 8 correctly moves ownership to CPU 9 and onlining it
again leaves CPU 9 as the owner. However, offlining CPU 10 then makes
CPU 8 the owner while existing events remain on CPU 9. Both CPUs are
now advertised for the same domain, so tools that open an event on
every CPU in the cpumask count the domain twice, and the context gets
modified from two CPUs without any synchronization.
Restore the ownership check that was lost during the refactor.
Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/273135a6d33a40f442fb18e140a90689fae7cd32.1793614726.git.sandipan.das@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/events/amd/uncore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index f24122c41c430..80edb04c28c77 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -498,7 +498,7 @@ static void amd_uncore_ctx_move(struct amd_uncore *uncore, unsigned int cpu)
for (i = 0; i < uncore->num_pmus; i++) {
pmu = &uncore->pmus[i];
curr = *per_cpu_ptr(pmu->ctx, cpu);
- if (!curr)
+ if (!curr || curr->cpu != cpu)
continue;
/* Migrate to a shared sibling if possible */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0149/1059] cpufreq: Force sync policy boost with global boost on sysfs update
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (147 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0148/1059] perf/x86/amd/uncore: Avoid context migration from non-owners Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0150/1059] cpufreq: Return -EOPNOTSUPP if no policy supports boost Greg Kroah-Hartman
` (849 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lifeng Zheng, Viresh Kumar,
Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <viresh.kumar@linaro.org>
[ Upstream commit 121baab7b88ed865532dadb7ef1aee6e2bea86f5 ]
If the global boost flag is enabled and policy boost flag is disabled, a
call to `cpufreq_boost_trigger_state(true)` must enable the policy's
boost state.
The current code misses that because of an optimization. Fix it.
Suggested-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/852ff11c589e6300730d207baac195b2d9d8b95f.1745511526.git.viresh.kumar@linaro.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 3d5720dff09f ("cpufreq: Serialize global boost updates")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2746,8 +2746,10 @@ int cpufreq_boost_trigger_state(int stat
unsigned long flags;
int ret = 0;
- if (cpufreq_driver->boost_enabled == state)
- return 0;
+ /*
+ * Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
+ * make sure all policies are in sync with global boost flag.
+ */
write_lock_irqsave(&cpufreq_driver_lock, flags);
cpufreq_driver->boost_enabled = state;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0150/1059] cpufreq: Return -EOPNOTSUPP if no policy supports boost
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (148 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0149/1059] cpufreq: Force sync policy boost with global boost on sysfs update Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0151/1059] cpufreq: Preserve global boost state on failed updates Greg Kroah-Hartman
` (848 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lifeng Zheng, Viresh Kumar, Jie Zhan,
Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lifeng Zheng <zhenglifeng1@huawei.com>
[ Upstream commit 77cf053b041fe13d1fdd2e572e16ee7776ff687d ]
In cpufreq_boost_trigger_state(), if none of the the policies support
boost, policy_set_boost() will not be called and this function will
return 0.
But it is better to return an error to indicate that the platform
doesn't support boost.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20251202072727.1368285-2-zhenglifeng1@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: a0cde2b601bc ("cpufreq: Preserve global boost state on failed updates")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2744,7 +2744,7 @@ int cpufreq_boost_trigger_state(int stat
{
struct cpufreq_policy *policy;
unsigned long flags;
- int ret = 0;
+ int ret = -EOPNOTSUPP;
/*
* Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
@@ -2761,6 +2761,10 @@ int cpufreq_boost_trigger_state(int stat
if (ret)
goto err_reset_state;
}
+
+ if (ret)
+ goto err_reset_state;
+
cpus_read_unlock();
return 0;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0151/1059] cpufreq: Preserve global boost state on failed updates
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (149 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0150/1059] cpufreq: Return -EOPNOTSUPP if no policy supports boost Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0152/1059] cpufreq: Serialize global boost updates Greg Kroah-Hartman
` (847 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle, Pengjie Zhang,
Zhongqiu Han, Sumit Gupta, Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
[ Upstream commit a0cde2b601bc32b76d61e50141c619790e5e2e41 ]
cpufreq_boost_trigger_state() restores the opposite of the requested
state when updating policy boost state fails. For example, a failed
write of 0 when global boost is already disabled enables the global
flag without enabling any policies.
Save the original global boost state and restore it on failure.
Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20261105215223.1263415-2-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2744,6 +2744,7 @@ int cpufreq_boost_trigger_state(int stat
{
struct cpufreq_policy *policy;
unsigned long flags;
+ bool boost_enabled;
int ret = -EOPNOTSUPP;
/*
@@ -2752,6 +2753,7 @@ int cpufreq_boost_trigger_state(int stat
*/
write_lock_irqsave(&cpufreq_driver_lock, flags);
+ boost_enabled = cpufreq_driver->boost_enabled;
cpufreq_driver->boost_enabled = state;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
@@ -2773,7 +2775,7 @@ err_reset_state:
cpus_read_unlock();
write_lock_irqsave(&cpufreq_driver_lock, flags);
- cpufreq_driver->boost_enabled = !state;
+ cpufreq_driver->boost_enabled = boost_enabled;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
pr_err("%s: Cannot %s BOOST\n",
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0152/1059] cpufreq: Serialize global boost updates
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (150 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0151/1059] cpufreq: Preserve global boost state on failed updates Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0153/1059] Bluetooth: reject invalid LE supervision timeout relationships Greg Kroah-Hartman
` (846 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle, Pengjie Zhang,
Zhongqiu Han, Sumit Gupta, Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
[ Upstream commit 3d5720dff09f3b90d9ab2a6707e4bb8d69542f4a ]
Concurrent global boost sysfs writes can interleave their global flag
and per-policy updates. An enabling write can set the global flag, then
a disabling write can clear it and finish before the enabling write
updates the policies. Both writes succeed, leaving boost enabled on
the policies while the global flag is disabled.
Serialize the complete global boost update, including rollback on
failure, with a mutex.
Fixes: 6f19efc0a1ca ("cpufreq: Add boost frequency support in core")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20261105215223.1263415-3-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2740,6 +2740,8 @@ static int cpufreq_boost_set_sw(struct c
return 0;
}
+static DEFINE_MUTEX(cpufreq_boost_mutex);
+
int cpufreq_boost_trigger_state(int state)
{
struct cpufreq_policy *policy;
@@ -2747,6 +2749,8 @@ int cpufreq_boost_trigger_state(int stat
bool boost_enabled;
int ret = -EOPNOTSUPP;
+ guard(mutex)(&cpufreq_boost_mutex);
+
/*
* Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
* make sure all policies are in sync with global boost flag.
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0153/1059] Bluetooth: reject invalid LE supervision timeout relationships
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (151 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0152/1059] cpufreq: Serialize global boost updates Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0154/1059] net/mlx5e: IPoIB, Fix QPN lookup race Greg Kroah-Hartman
` (845 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Pepper, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Pepper <cochcoder@proton.me>
[ Upstream commit c1d50a71cdee90a0c68b7a67221d8aae96d14a0c ]
The LE parameter validator calculates an unsigned maximum latency by
subtracting one from a truncated quotient. If the quotient is zero,
this wraps and accepts invalid parameters. Exact quotient boundaries
also accept equality where the supervision timeout must be greater.
Compare the products directly after checking the field bounds. The
validated interval and latency limits keep the products within int.
This enforces the strict timeout relationship without division or
unsigned subtraction.
Sashiko identified the underflow while reviewing the soft interval
preference RFC. The bug is already present in its unpatched base; keep
this common-validator fix independent of that preference policy.
Fixes: 8757825b128e ("Bluetooth: hci_check_conn_params() check proper range")
Assisted-by: LLM
Signed-off-by: Kyle Pepper <cochcoder@proton.me>
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 | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f47a88d39c168..9e7d7ad97be9e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1964,8 +1964,6 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
u16 to_multiplier)
{
- u16 max_latency;
-
if (min > max) {
BT_WARN("min %d > max %d", min, max);
return -EINVAL;
@@ -1991,19 +1989,14 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
return -EINVAL;
}
- if (max >= to_multiplier * 8) {
- BT_WARN("max %d >= to_multiplier %d * 8", max, to_multiplier);
- return -EINVAL;
- }
-
- max_latency = (to_multiplier * 4 / max) - 1;
if (latency > 499) {
BT_WARN("latency %d > 499", latency);
return -EINVAL;
}
- if (latency > max_latency) {
- BT_WARN("latency %d > max_latency %d", latency, max_latency);
+ if ((latency + 1) * max >= to_multiplier * 4) {
+ BT_WARN("latency %d, max %d and timeout %d are incompatible",
+ latency, max, to_multiplier);
return -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0154/1059] net/mlx5e: IPoIB, Fix QPN lookup race
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (152 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0153/1059] Bluetooth: reject invalid LE supervision timeout relationships Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0155/1059] calipso: do not charge request socket options to the listener Greg Kroah-Hartman
` (844 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Prathamesh Deshpande, Tariq Toukan,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
[ Upstream commit 29066b0fc046a2965129a74325b98d9abb4647a9 ]
The parent RX completion path can load a QPN hash entry before
mlx5i_pkey_del_qpn() unlinks and frees it, then dereference freed memory.
Use RCU hlist operations and defer freeing with kfree_rcu(). The existing
RCU read-side section in mlx5e_napi_poll() covers the lookup. Keep ht_lock
for writers and acquire it before looking up the entry to delete.
Fixes: 7e7f4780c340 ("net/mlx5e: IPoIB, Use hash-table to map between QPN to child netdev")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261031225749.14214-1-prathameshdeshpande7@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/mellanox/mlx5/core/ipoib/ipoib.h | 2 +-
.../mellanox/mlx5/core/ipoib/ipoib_vlan.c | 26 +++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
index f3f2af972020a..ffdbbae87fc14 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
@@ -80,7 +80,7 @@ void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev);
int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn);
int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn);
-/* Get the net-device corresponding to the given underlay QPN */
+/* Get the net-device for a QPN. Caller must hold rcu_read_lock(). */
struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn);
/* Shared ndo functions */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
index 0cf4eaf852d2a..0f4f766d1c6a3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
@@ -31,6 +31,7 @@
*/
#include <linux/hash.h>
+#include <linux/rculist.h>
#include "ipoib.h"
#define MLX5I_MAX_LOG_PKEY_SUP 7
@@ -39,11 +40,12 @@ struct qpn_to_netdev {
struct net_device *netdev;
struct hlist_node hlist;
u32 underlay_qpn;
+ struct rcu_head rcu;
};
struct mlx5i_pkey_qpn_ht {
struct hlist_head buckets[1 << MLX5I_MAX_LOG_PKEY_SUP];
- spinlock_t ht_lock; /* Synchronise with NAPI */
+ spinlock_t ht_lock; /* Serialize hash table updates */
};
int mlx5i_pkey_qpn_ht_init(struct net_device *netdev)
@@ -68,13 +70,14 @@ void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev)
kfree(ipriv->qpn_htbl);
}
-static struct qpn_to_netdev *mlx5i_find_qpn_to_netdev_node(struct hlist_head *buckets,
- u32 qpn)
+static struct qpn_to_netdev *
+mlx5i_find_qpn_to_netdev_node(struct mlx5i_pkey_qpn_ht *ht, u32 qpn)
{
- struct hlist_head *h = &buckets[hash_32(qpn, MLX5I_MAX_LOG_PKEY_SUP)];
+ struct hlist_head *h = &ht->buckets[hash_32(qpn, MLX5I_MAX_LOG_PKEY_SUP)];
struct qpn_to_netdev *node;
- hlist_for_each_entry(node, h, hlist) {
+ hlist_for_each_entry_rcu(node, h, hlist,
+ lockdep_is_held(&ht->ht_lock)) {
if (node->underlay_qpn == qpn)
return node;
}
@@ -96,7 +99,7 @@ int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn)
new_node->netdev = netdev;
new_node->underlay_qpn = qpn;
spin_lock_bh(&ht->ht_lock);
- hlist_add_head(&new_node->hlist, &ht->buckets[key]);
+ hlist_add_head_rcu(&new_node->hlist, &ht->buckets[key]);
spin_unlock_bh(&ht->ht_lock);
return 0;
@@ -109,16 +112,17 @@ int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn)
struct mlx5i_pkey_qpn_ht *ht = ipriv->qpn_htbl;
struct qpn_to_netdev *node;
- node = mlx5i_find_qpn_to_netdev_node(ht->buckets, qpn);
+ spin_lock_bh(&ht->ht_lock);
+ node = mlx5i_find_qpn_to_netdev_node(ht, qpn);
if (!node) {
+ spin_unlock_bh(&ht->ht_lock);
mlx5_core_warn(epriv->mdev, "QPN to netdev delete from HT failed\n");
return -EINVAL;
}
- spin_lock_bh(&ht->ht_lock);
- hlist_del_init(&node->hlist);
+ hlist_del_rcu(&node->hlist);
spin_unlock_bh(&ht->ht_lock);
- kfree(node);
+ kfree_rcu(node, rcu);
return 0;
}
@@ -128,7 +132,7 @@ struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn)
struct mlx5i_priv *ipriv = netdev_priv(netdev);
struct qpn_to_netdev *node;
- node = mlx5i_find_qpn_to_netdev_node(ipriv->qpn_htbl->buckets, qpn);
+ node = mlx5i_find_qpn_to_netdev_node(ipriv->qpn_htbl, qpn);
if (!node)
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0155/1059] calipso: do not charge request socket options to the listener
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (153 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0154/1059] net/mlx5e: IPoIB, Fix QPN lookup race Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0156/1059] ipv6: ICMPV6: Use swap() instead of open coding it Greg Kroah-Hartman
` (843 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Eric Dumazet,
Kuniyuki Iwashima, Paul Moore, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit b4a2cc6d748d3056a25812dcf5f5377a59afd02f ]
calipso_req_setattr() and calipso_req_delattr() allocate ireq->ipv6_opt
with ipv6_renew_options(), which charges the listener sk_omem_alloc
through sock_kmalloc().
tcp_v6_reqsk_destructor() frees ireq->ipv6_opt without uncharging it,
so each request socket leaks its options size from the listener
budget. Once sysctl_optmem_max is reached, sock_kmalloc() fails,
calipso_req_setattr() returns -ENOBUFS, and tcp_v6_route_req() drops
all subsequent SYN packets. __sk_destruct() also reports an optmem
leakage when the listener is destroyed.
Uncharging in tcp_v6_reqsk_destructor() would not be correct: after a
migration, req->rsk_listener is no longer the socket that was charged.
These options belong to the request socket, there is no reason to
charge them to the listener. Change ipv6_renew_options() to use
kmalloc() when its sk argument is NULL, and use this from
calipso_req_setattr() and calipso_req_delattr(),
like cipso_v4_req_setattr() which uses kzalloc().
Note:
After this patch, calipso_req_setattr() and calipso_req_delattr()
no longer need the listener. Commit 10876da918fa ("calipso: Fix
null-ptr-deref in calipso_req_{set,del}attr().") could be reverted
in net-next (also removing the then unused sk variables), so that
CALIPSO works with SYN cookies.
Fixes: e1adea927080 ("calipso: Allow request sockets to be relabelled by the lsm.")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179378292255.488856.6917577451813010963@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Paul Moore <paul@paul-moore.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/20261104150318.1156620-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/calipso.c | 12 ++++--------
net/ipv6/exthdrs.c | 5 +++--
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index 583c912ffe60d..e7e85c2c1293e 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -1223,7 +1223,7 @@ static int calipso_req_setattr(struct request_sock *req,
if (IS_ERR(new))
return PTR_ERR(new);
- txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
+ txopts = ipv6_renew_options(NULL, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
kfree(new);
@@ -1231,10 +1231,8 @@ static int calipso_req_setattr(struct request_sock *req,
return PTR_ERR(txopts);
txopts = xchg(&req_inet->ipv6_opt, txopts);
- if (txopts) {
- atomic_sub(txopts->tot_len, &sk->sk_omem_alloc);
+ if (txopts)
txopt_put(txopts);
- }
return 0;
}
@@ -1264,14 +1262,12 @@ static void calipso_req_delattr(struct request_sock *req)
if (calipso_opt_del(req_inet->ipv6_opt->hopopt, &new))
return; /* Nothing to do */
- txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
+ txopts = ipv6_renew_options(NULL, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
if (!IS_ERR(txopts)) {
txopts = xchg(&req_inet->ipv6_opt, txopts);
- if (txopts) {
- atomic_sub(txopts->tot_len, &sk->sk_omem_alloc);
+ if (txopts)
txopt_put(txopts);
- }
}
kfree(new);
}
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 4bd1f9548bd7d..d7e307aa6b020 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -1317,7 +1317,7 @@ static void ipv6_renew_option(int renewtype,
* not copied into the new set of options.
*
* The new set of options is allocated from the socket option memory
- * buffer of @sk.
+ * buffer of @sk, or with kmalloc() if @sk is NULL.
*/
struct ipv6_txoptions *
ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
@@ -1345,7 +1345,8 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
return NULL;
tot_len += sizeof(*opt2);
- opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC);
+ opt2 = sk ? sock_kmalloc(sk, tot_len, GFP_ATOMIC) :
+ kmalloc(tot_len, GFP_ATOMIC);
if (!opt2)
return ERR_PTR(-ENOBUFS);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0156/1059] ipv6: ICMPV6: Use swap() instead of open coding it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (154 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0155/1059] calipso: do not charge request socket options to the listener Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0157/1059] ipv6: Check the Home Address option again before its address is used Greg Kroah-Hartman
` (842 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abaci Robot, Jiapeng Chong,
Simon Horman, David Ahern, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
[ Upstream commit bc61761394ce0f0cc35c6fc60426f08d83d0d488 ]
Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.
./net/ipv6/icmp.c:344:25-26: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3896
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20230131063456.76302-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 30c71476d842 ("ipv6: Check the Home Address option again before its address is used")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/icmp.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index e984f03b0b418..63fbc69cf0faf 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -336,7 +336,6 @@ static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt
{
struct ipv6hdr *iph = ipv6_hdr(skb);
struct ipv6_destopt_hao *hao;
- struct in6_addr tmp;
int off;
if (opt->dsthao) {
@@ -344,9 +343,7 @@ static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt
if (likely(off >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + off);
- tmp = iph->saddr;
- iph->saddr = hao->addr;
- hao->addr = tmp;
+ swap(iph->saddr, hao->addr);
}
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0157/1059] ipv6: Check the Home Address option again before its address is used
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (155 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0156/1059] ipv6: ICMPV6: Use swap() instead of open coding it Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0158/1059] ata: libata-scsi: fix MODE SELECT handling of data after the mode page Greg Kroah-Hartman
` (841 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Ido Schimmel,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 30c71476d842b094651bd7712f6c8ee8716147d0 ]
ipv6_dest_hao() checks the Home Address option and sets IP6CB(skb)->dsthao
to the offset of the destination options header. Later mip6_addr_swap() and
mip6_destopt_reject() call ipv6_find_tlv() with that offset and use the 16
address bytes. They assume that the same header is still there.
But the seg6 and ioam6 lwtunnels, the End.B6 actions, ipv6_rpl_srh_rcv()
and BPF lwt progs move or rewrite the IPv6 headers and keep IP6CB(skb).
Then ipv6_find_tlv() parses other bytes. It returns when the type matches,
before it checks that the option is inside the header. Nobody checks the
length of the option again. Thus mip6_addr_swap() can write after the data
of the skb. mip6_destopt_reject() can copy that memory to an xfrm report.
In ipv6_find_tlv(), check the length of an option before its type. The
returned option is then inside the header, and the header is inside the
linear data. In both callers, ignore an option with a length other than 16,
as if ipv6_find_tlv() found none. Then the ICMPv6 error goes to the source
address of the IPv6 header, and the xfrm report has no XFRMA_COADDR
attribute. Nothing changes for a header that ip6_parse_tlv() accepted and
that is still in its place. For the other callers an incomplete option is
now absent:
- ip6_find_1stfragopt() and mip6_rthdr_offset() can return another offset
for the fragment header or the xfrm header, also in a forwarded packet.
- calipso_skbuff_optptr() returns NULL. netlbl_skbuff_getattr() and
netlbl_cache_add() then see no option. calipso_skbuff_delattr() returns
0 and the packet continues unchanged. Today it returns -EINVAL and
SELinux drops the packet. It already returns 0 when an earlier option is
incomplete. The receiver drops such a header in ip6_parse_tlv().
The code that moves the headers still does not reset the offset or the
other fields of IP6CB(skb). If the bytes there look like a header with a
Home Address option of length 16, both callers still use its address.
The first tag also covers ipv6_find_tlv(), because its early return did no
harm before mip6_addr_swap(). The second tag is for mip6_destopt_reject().
Fixes: 793832361fe7 ("[IPV6] MIP6: Revert address to send ICMPv6 error.")
Fixes: 70182ed23d25 ("[IPV6] MIP6: Report to user-space when home address option is rejected.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261102064922.2636027-1-alexei.starovoitov@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/exthdrs_core.c | 7 ++++---
net/ipv6/icmp.c | 7 ++++++-
net/ipv6/mip6.c | 9 ++++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index ce3724f49e33a..f5b6e25580e83 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -135,9 +135,6 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
int opttype = nh[offset];
int optlen;
- if (opttype == type)
- return offset;
-
switch (opttype) {
case IPV6_TLV_PAD1:
optlen = 1;
@@ -150,6 +147,10 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
goto bad;
break;
}
+ /* Some callers read the option, so it must be in the header. */
+ if (opttype == type)
+ return offset;
+
offset += optlen;
len -= optlen;
}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 63fbc69cf0faf..f0aecbaeadd2e 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -343,7 +343,12 @@ static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt
if (likely(off >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + off);
- swap(iph->saddr, hao->addr);
+ /*
+ * The header can have moved or changed after
+ * ipv6_dest_hao() checked the length.
+ */
+ if (hao->length == 16)
+ swap(iph->saddr, hao->addr);
}
}
}
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 83d2a8be263fb..d4daadd2b72bf 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -211,9 +211,16 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
if (likely(opt->dsthao)) {
offset = ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO);
- if (likely(offset >= 0))
+ if (likely(offset >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + offset);
+ /*
+ * The header can have moved or changed after
+ * ipv6_dest_hao() checked the length.
+ */
+ if (hao->length != 16)
+ hao = NULL;
+ }
}
stamp = skb_get_ktime(skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0158/1059] ata: libata-scsi: fix MODE SELECT handling of data after the mode page
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (156 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0157/1059] ipv6: Check the Home Address option again before its address is used Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0159/1059] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit Greg Kroah-Hartman
` (840 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 6fde0444d07ec954f3d885375e0402ff2f2e5064 ]
ata_scsi_mode_select_xlat() only supports one mode page per MODE SELECT
command, and rejects a parameter list with data after the mode page with
INVALID FIELD IN PARAMETER LIST. However:
- It does not set the field pointer, so the sense data reports 0xffff as
the FIELD POINTER.
- It only checks for data after the mode page after the mode page
handler has been called. ata_mselect_control_ata_feature() has then
already updated the CDL enabled flag of the device, even though the
command is rejected and the CDL setting of the device is not changed.
- For the control mode page, ata_mselect_control_spg0() does not need an
ATA command, so the check is skipped, and the data after the mode page
is silently ignored.
Check for data after the mode page before calling the mode page
handlers, and set the FIELD POINTER to the first byte after the mode
page, i.e. to the first byte of the next mode page.
The reason why only one mode page per command is supported is that a
MODE SELECT command is translated into at most one ATA command, so
update the comment accordingly.
Fixes: 1b26d29ccd59 ("[libata] scsi: implement MODE SELECT command")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-11-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c9706ca86ac49..abefbcae4e069 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3946,6 +3946,17 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
if (pg_len > len)
goto invalid_param_len;
+ /*
+ * A MODE SELECT command is translated into at most one ATA command, so
+ * only one mode page per command is supported. Reject any data after
+ * the mode page before calling the mode page handlers, which may
+ * already update the device flags.
+ */
+ if (len > pg_len) {
+ fp = p - buffer + pg_len;
+ goto invalid_param;
+ }
+
switch (pg) {
case CACHE_MPAGE:
if (ata_mselect_caching(qc, p, pg_len, &fp) < 0) {
@@ -3966,13 +3977,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
goto invalid_param;
}
- /*
- * Only one page has changeable data, so we only support setting one
- * page at a time.
- */
- if (len > pg_len)
- goto invalid_param;
-
return 0;
invalid_fld:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0159/1059] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (157 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0158/1059] ata: libata-scsi: fix MODE SELECT handling of data after the mode page Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0160/1059] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Greg Kroah-Hartman
` (839 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Niklas Cassel, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit a1eb72c477ec1320c540f27ce1e2f717d4518e62 ]
ata_scsi_mode_select_xlat() accepts the caching and control mode pages
both in page_0 format and in sub_page format with SUBPAGE CODE 00h.
However, SAT-2 and later versions of SAT define the SPF bit of the
Caching mode page and of the Control mode page as not changeable and
set to zero (see SAT-6, 10.4.9 and 10.4.6), and SPC-7 (6.12, MODE
SELECT(10) command) requires the device server to terminate a MODE
SELECT command with INVALID FIELD IN PARAMETER LIST if the application
client sets any field that is reported as not changeable to a value
other than its current value.
Reject a mode page with the SPF bit set to one and SUBPAGE CODE 00h,
with the FIELD POINTER set to the byte containing the SPF bit. The only
mode page with the SPF bit set to one that remains accepted is the ATA
Feature Control mode page (control mode page, sub-page f2h), for which
SAT-6 (12.3.4) requires the SPF bit to be set to one. The opposite case
does not need a check: a mode page in page_0 format always has subpage
code 00h, so it can never be the ATA Feature Control mode page.
This also allows the mode page handlers to rely on the format of their
mode page, which a later patch will make use of.
Fixes: 1b26d29ccd59 ("[libata] scsi: implement MODE SELECT command")
Link: https://lore.kernel.org/r/20261103205448.931471-13-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index abefbcae4e069..167bc569859ca 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3920,7 +3920,17 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
if (len < 4)
goto invalid_param_len;
+ /*
+ * Mode pages with subpage code 00h use the page_0 format: SAT
+ * defines the SPF bit of the Caching and Control mode pages,
+ * for subpage code 00h, as not changeable and set to zero.
+ */
spg = p[1];
+ if (!spg) {
+ fp = hdr_len + bd_len;
+ goto invalid_param;
+ }
+
pg_len = get_unaligned_be16(&p[2]);
p += 4;
len -= 4;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0160/1059] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (158 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0159/1059] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0161/1059] tracing/probes: bound symstr stores to reserved length Greg Kroah-Hartman
` (838 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit a3e52dcf0fbaa1a103accef3e8861cdc250ee5d6 ]
ata_scsi_mode_select_xlat() only accepts MODE SELECT parameter lists
without block descriptors or with a single 8 byte block descriptor. For
any other BLOCK DESCRIPTOR LENGTH, it terminates the command with
INVALID FIELD IN PARAMETER LIST, and the FIELD POINTER should point at
the BLOCK DESCRIPTOR LENGTH field, i.e. at byte 3 of the mode parameter
header(6) or at byte 6 of the mode parameter header(10), as SPC requires
the FIELD POINTER of a multiple-byte field to point at its first byte.
However, the mode parameter header length and the BLOCK DESCRIPTOR
LENGTH are added to the offset of the field, so the FIELD POINTER points
3 or 6 bytes after the end of the block descriptors instead. For
example, a MODE SELECT(10) with a BLOCK DESCRIPTOR LENGTH of 16 reports
byte 30 instead of byte 6.
Do not add the mode parameter header length and the BLOCK DESCRIPTOR
LENGTH to the offset of the BLOCK DESCRIPTOR LENGTH field.
Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-15-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 167bc569859ca..e905d39930e52 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3905,7 +3905,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
goto invalid_param_len;
if (bd_len != 0 && bd_len != 8) {
fp = (six_byte) ? 3 : 6;
- fp += bd_len + hdr_len;
goto invalid_param;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0161/1059] tracing/probes: bound symstr stores to reserved length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (159 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0160/1059] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0162/1059] gpiolib: of: return -ENOENT from of_gpio_count() stub Greg Kroah-Hartman
` (837 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yifan Zhang,
Masami Hiramatsu (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit 2fc0b3070d6d5dcecfed43cd0e62aa0fd4b4315c ]
Traceprobe calculates dynamic string sizes before storing the values. A
probed pointer can change between those passes, so
fetch_store_symstrlen() can reserve space for a short symbol while
fetch_store_symstring() observes a longer one. The store path then
overwrites the trace record.
Format the symbol into a temporary KSYM_SYMBOL_LEN buffer and copy only
the bytes that fit in the reserved field, including a trailing NUL.
Update __data_loc with the length actually stored so consumers do not
read beyond the truncated value.
Link: https://lore.kernel.org/all/179378621331.55520.2052332247156241151@stu.pku.edu.cn/
Fixes: b26a124cbfa8 ("tracing/probes: Add symstr type for dynamic events")
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_probe_tmpl.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
index 3e2f5a43b974c..5c6a3fd1bd163 100644
--- a/kernel/trace/trace_probe_tmpl.h
+++ b/kernel/trace/trace_probe_tmpl.h
@@ -87,15 +87,27 @@ fetch_store_symstrlen(unsigned long addr)
static nokprobe_inline int
fetch_store_symstring(unsigned long addr, void *dest, void *base)
{
+ char namebuf[KSYM_SYMBOL_LEN];
int maxlen = get_loc_len(*(u32 *)dest);
void *__dest;
+ int len;
if (unlikely(!maxlen))
return -ENOMEM;
__dest = get_loc_data(dest, base);
+ len = sprint_symbol(namebuf, addr);
+ if (len < 0) {
+ *(u32 *)dest = make_data_loc(0, __dest - base);
+ return 0;
+ }
+
+ len = min(len, maxlen - 1);
+ memcpy(__dest, namebuf, len);
+ ((char *)__dest)[len] = '\0';
+ *(u32 *)dest = make_data_loc(len + 1, __dest - base);
- return sprint_symbol(__dest, addr);
+ return len + 1;
}
/* From the 2nd stage, routine is same */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0162/1059] gpiolib: of: return -ENOENT from of_gpio_count() stub
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (160 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0161/1059] tracing/probes: bound symstr stores to reserved length Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0163/1059] NFSv4.1: retain MDS I/O until both thresholds are met Greg Kroah-Hartman
` (836 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andy Shevchenko, Dmitry Torokhov,
Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit e20e4b8cda2b4d7dd32dbd2c0875a15d92545f04 ]
gpiod_count() and its firmware backends are expected to return either a
positive number of GPIOs or a negative error code (-ENOENT) when no
GPIOs are assigned. However, the !CONFIG_OF_GPIO stub for
of_gpio_count() returns 0 instead of -ENOENT. This causes gpiod_count()
to skip the platform_gpio_count() fallback (which triggers when
count < 0) and erroneously return 0 to callers.
Change the stub to return -ENOENT to match the real of_gpio_count()
implementation and the other error-returning stubs in gpiolib-of.h.
Fixes: f626d6dfb709 ("gpio: of: Break out OF-only code")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20261105-b4-gpiolib-free-v3-3-bb47ad58642d@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib-of.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-of.h b/drivers/gpio/gpiolib-of.h
index 8af2bc899aab2..9cab0194554eb 100644
--- a/drivers/gpio/gpiolib-of.h
+++ b/drivers/gpio/gpiolib-of.h
@@ -28,7 +28,7 @@ static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
static inline int of_gpio_get_count(struct device *dev, const char *con_id)
{
- return 0;
+ return -ENOENT;
}
static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0163/1059] NFSv4.1: retain MDS I/O until both thresholds are met
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (161 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0162/1059] gpiolib: of: return -ENOENT from of_gpio_count() stub Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0164/1059] NFS: Fix inverted cross-directory rename check Greg Kroah-Hartman
` (835 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit eab627dcd18a18a44a2cbee47df3058d3637ba0d ]
When both size and I/O thresholds are configured,
pnfs_within_mdsthreshold() uses size && io to decide whether to
keep I/O on the MDS. Both variables indicate an unmet threshold,
so reaching only one threshold returns false and may trigger
pNFS layout acquisition while the other threshold remains unmet.
Use logical OR instead of AND to stay with MDS I/O until both
thresholds are met, as recommended by RFC 8881 Section 5.12.6.
The new RFC contains the same threshold selection rule as RFC
5661 which is referenced in function comment.
Fixes: d23d61c8d351 ("NFSv4.1 test the mdsthreshold hint parameters")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/pnfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e188a2cfae419..9e1c50e0d6a53 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1927,7 +1927,7 @@ static bool pnfs_within_mdsthreshold(struct nfs_open_context *ctx,
break;
}
if (size_set && io_set) {
- if (size && io)
+ if (size || io)
ret = true;
} else if (size || io)
ret = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0164/1059] NFS: Fix inverted cross-directory rename check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (162 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0163/1059] NFSv4.1: retain MDS I/O until both thresholds are met Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0165/1059] fs/nfs: Replace kmap_atomic() with kmap_local_page() in dir.c Greg Kroah-Hartman
` (834 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit b9d518902ff1969f93d2b4787951d98e50ab0181 ]
nfs_rename_is_unsafe_cross_dir() returns false for cross-directory
renames, causing nfs_rename() to skip nfs_sync_inode() even when
filehandles may expire on rename. Same-directory renames may instead
trigger unnecessary synchronization.
Current condition directly contradicts the function name/comments.
Return false for same-directory renames so cross-directory renames
reach the existing filehandle-volatility check. Keep the conservative
fallback unchanged..
Fixes: dcd21b609d4ab ("NFS: Avoid flushing data while holding directory locks in nfs_rename()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index be793e10da830..330d747856d10 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2635,7 +2635,7 @@ static bool nfs_rename_is_unsafe_cross_dir(struct dentry *old_dentry,
{
struct nfs_server *server = NFS_SB(old_dentry->d_sb);
- if (old_dentry->d_parent != new_dentry->d_parent)
+ if (old_dentry->d_parent == new_dentry->d_parent)
return false;
if (server->fh_expire_type & NFS_FH_RENAME_UNSAFE)
return !(server->fh_expire_type & NFS_FH_NOEXPIRE_WITH_OPEN);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0165/1059] fs/nfs: Replace kmap_atomic() with kmap_local_page() in dir.c
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (163 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0164/1059] NFS: Fix inverted cross-directory rename check Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0166/1059] NFS: Convert the readdir array-of-pages into an array-of-folios Greg Kroah-Hartman
` (833 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ira Weiny, Fabio M. De Francesco,
Luis Chamberlain, Anna Schumaker, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio M. De Francesco <fmdefrancesco@gmail.com>
[ Upstream commit 1683ed16ff1a51705f58e8083ed93a7428a543f2 ]
kmap_atomic() is deprecated in favor of kmap_local_page().
With kmap_local_page() the mappings are per thread, CPU local, can take
page-faults, and can be called from any context (including interrupts).
Furthermore, the tasks can be preempted and, when they are scheduled to
run again, the kernel virtual addresses are restored and still valid.
kmap_atomic() is implemented like a kmap_local_page() which also disables
page-faults and preemption (the latter only for !PREEMPT_RT kernels,
otherwise it only disables migration).
The code within the mappings/un-mappings in the functions of dir.c don't
depend on the above-mentioned side effects of kmap_atomic(), so that mere
replacements of the old API with the new one is all that is required
(i.e., there is no need to explicitly add calls to pagefault_disable()
and/or preempt_disable()).
Therefore, replace kmap_atomic() with kmap_local_page() in fs/nfs/dir.c.
Tested in a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel with
HIGHMEM64GB enabled.
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Stable-dep-of: 89b91409b234 ("NFS: restore directory index when resuming readdir")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 330d747856d10..261031ef7895e 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -203,14 +203,14 @@ static void nfs_readdir_page_init_array(struct page *page, u64 last_cookie,
{
struct nfs_cache_array *array;
- array = kmap_atomic(page);
+ array = kmap_local_page(page);
array->change_attr = change_attr;
array->last_cookie = last_cookie;
array->size = 0;
array->page_full = 0;
array->page_is_eof = 0;
array->cookies_are_ordered = 1;
- kunmap_atomic(array);
+ kunmap_local(array);
}
/*
@@ -221,11 +221,11 @@ static void nfs_readdir_clear_array(struct page *page)
struct nfs_cache_array *array;
unsigned int i;
- array = kmap_atomic(page);
+ array = kmap_local_page(page);
for (i = 0; i < array->size; i++)
kfree(array->array[i].name);
array->size = 0;
- kunmap_atomic(array);
+ kunmap_local(array);
}
static void nfs_readdir_free_folio(struct folio *folio)
@@ -371,14 +371,14 @@ static pgoff_t nfs_readdir_page_cookie_hash(u64 cookie)
static bool nfs_readdir_page_validate(struct page *page, u64 last_cookie,
u64 change_attr)
{
- struct nfs_cache_array *array = kmap_atomic(page);
+ struct nfs_cache_array *array = kmap_local_page(page);
int ret = true;
if (array->change_attr != change_attr)
ret = false;
if (nfs_readdir_array_index_cookie(array) != last_cookie)
ret = false;
- kunmap_atomic(array);
+ kunmap_local(array);
return ret;
}
@@ -418,9 +418,9 @@ static u64 nfs_readdir_page_last_cookie(struct page *page)
struct nfs_cache_array *array;
u64 ret;
- array = kmap_atomic(page);
+ array = kmap_local_page(page);
ret = array->last_cookie;
- kunmap_atomic(array);
+ kunmap_local(array);
return ret;
}
@@ -429,9 +429,9 @@ static bool nfs_readdir_page_needs_filling(struct page *page)
struct nfs_cache_array *array;
bool ret;
- array = kmap_atomic(page);
+ array = kmap_local_page(page);
ret = !nfs_readdir_array_is_full(array);
- kunmap_atomic(array);
+ kunmap_local(array);
return ret;
}
@@ -439,9 +439,9 @@ static void nfs_readdir_page_set_eof(struct page *page)
{
struct nfs_cache_array *array;
- array = kmap_atomic(page);
+ array = kmap_local_page(page);
nfs_readdir_array_set_eof(array);
- kunmap_atomic(array);
+ kunmap_local(array);
}
static struct page *nfs_readdir_page_get_next(struct address_space *mapping,
@@ -568,14 +568,14 @@ static int nfs_readdir_search_array(struct nfs_readdir_descriptor *desc)
struct nfs_cache_array *array;
int status;
- array = kmap_atomic(desc->page);
+ array = kmap_local_page(desc->page);
if (desc->dir_cookie == 0)
status = nfs_readdir_search_for_pos(array, desc);
else
status = nfs_readdir_search_for_cookie(array, desc);
- kunmap_atomic(array);
+ kunmap_local(array);
return status;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0166/1059] NFS: Convert the readdir array-of-pages into an array-of-folios
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (164 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0165/1059] fs/nfs: Replace kmap_atomic() with kmap_local_page() in dir.c Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0167/1059] NFS: restore directory index when resuming readdir Greg Kroah-Hartman
` (832 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Anna Schumaker, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
[ Upstream commit 61f02e0ab81e7c9415dc32e36fe45fc380dce2f0 ]
This patch only converts the actual array, but doesn't touch the
individual nfs_cache_array pages and related functions (that will be
done in the next patch).
I also adjust the names of the fields in the nfs_readdir_descriptor to
say "folio" instead of "page".
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Stable-dep-of: 89b91409b234 ("NFS: restore directory index when resuming readdir")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 129 ++++++++++++++++++++++++++-------------------------
1 file changed, 65 insertions(+), 64 deletions(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 261031ef7895e..8b6215e88515f 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -154,10 +154,10 @@ struct nfs_cache_array {
struct nfs_readdir_descriptor {
struct file *file;
- struct page *page;
+ struct folio *folio;
struct dir_context *ctx;
- pgoff_t page_index;
- pgoff_t page_index_max;
+ pgoff_t folio_index;
+ pgoff_t folio_index_max;
u64 dir_cookie;
u64 last_cookie;
loff_t current_index;
@@ -312,8 +312,8 @@ static int nfs_readdir_array_can_expand(struct nfs_cache_array *array)
}
static int nfs_readdir_page_array_append(struct page *page,
- const struct nfs_entry *entry,
- u64 *cookie)
+ const struct nfs_entry *entry,
+ u64 *cookie)
{
struct nfs_cache_array *array;
struct nfs_cache_array_entry *cache_entry;
@@ -485,7 +485,7 @@ static void nfs_readdir_seek_next_array(struct nfs_cache_array *array,
desc->last_cookie = array->last_cookie;
desc->current_index += array->size;
desc->cache_entry_index = 0;
- desc->page_index++;
+ desc->folio_index++;
} else
desc->last_cookie = nfs_readdir_array_index_cookie(array);
}
@@ -494,7 +494,7 @@ static void nfs_readdir_rewind_search(struct nfs_readdir_descriptor *desc)
{
desc->current_index = 0;
desc->last_cookie = 0;
- desc->page_index = 0;
+ desc->folio_index = 0;
}
static int nfs_readdir_search_for_pos(struct nfs_cache_array *array,
@@ -568,7 +568,7 @@ static int nfs_readdir_search_array(struct nfs_readdir_descriptor *desc)
struct nfs_cache_array *array;
int status;
- array = kmap_local_page(desc->page);
+ array = kmap_local_folio(desc->folio, 0);
if (desc->dir_cookie == 0)
status = nfs_readdir_search_for_pos(array, desc);
@@ -820,16 +820,17 @@ static int nfs_readdir_entry_decode(struct nfs_readdir_descriptor *desc,
}
/* Perform conversion from xdr to cache array */
-static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc,
- struct nfs_entry *entry,
- struct page **xdr_pages, unsigned int buflen,
- struct page **arrays, size_t narrays,
- u64 change_attr)
+static int nfs_readdir_folio_filler(struct nfs_readdir_descriptor *desc,
+ struct nfs_entry *entry,
+ struct page **xdr_pages, unsigned int buflen,
+ struct folio **arrays, size_t narrays,
+ u64 change_attr)
{
struct address_space *mapping = desc->file->f_mapping;
+ struct folio *folio = *arrays;
struct xdr_stream stream;
+ struct page *scratch, *new;
struct xdr_buf buf;
- struct page *scratch, *new, *page = *arrays;
u64 cookie;
int status;
@@ -845,36 +846,36 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc,
if (status != 0)
break;
- status = nfs_readdir_page_array_append(page, entry, &cookie);
+ status = nfs_readdir_page_array_append(folio_page(folio, 0), entry, &cookie);
if (status != -ENOSPC)
continue;
- if (page->mapping != mapping) {
+ if (folio->mapping != mapping) {
if (!--narrays)
break;
new = nfs_readdir_page_array_alloc(cookie, GFP_KERNEL);
if (!new)
break;
arrays++;
- *arrays = page = new;
+ *arrays = folio = page_folio(new);
} else {
new = nfs_readdir_page_get_next(mapping, cookie,
change_attr);
if (!new)
break;
- if (page != *arrays)
- nfs_readdir_page_unlock_and_put(page);
- page = new;
+ if (folio != *arrays)
+ nfs_readdir_page_unlock_and_put(folio_page(folio, 0));
+ folio = page_folio(new);
}
- desc->page_index_max++;
- status = nfs_readdir_page_array_append(page, entry, &cookie);
+ desc->folio_index_max++;
+ status = nfs_readdir_page_array_append(folio_page(folio, 0), entry, &cookie);
} while (!status && !entry->eof);
switch (status) {
case -EBADCOOKIE:
if (!entry->eof)
break;
- nfs_readdir_page_set_eof(page);
+ nfs_readdir_page_set_eof(folio_page(folio, 0));
fallthrough;
case -EAGAIN:
status = 0;
@@ -887,8 +888,8 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc,
;
}
- if (page != *arrays)
- nfs_readdir_page_unlock_and_put(page);
+ if (folio != *arrays)
+ nfs_readdir_page_unlock_and_put(folio_page(folio, 0));
put_page(scratch);
return status;
@@ -928,11 +929,11 @@ static struct page **nfs_readdir_alloc_pages(size_t npages)
static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
__be32 *verf_arg, __be32 *verf_res,
- struct page **arrays, size_t narrays)
+ struct folio **arrays, size_t narrays)
{
u64 change_attr;
struct page **pages;
- struct page *page = *arrays;
+ struct folio *folio = *arrays;
struct nfs_entry *entry;
size_t array_size;
struct inode *inode = file_inode(desc->file);
@@ -943,7 +944,7 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
- entry->cookie = nfs_readdir_page_last_cookie(page);
+ entry->cookie = nfs_readdir_page_last_cookie(folio_page(folio, 0));
entry->fh = nfs_alloc_fhandle();
entry->fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
entry->server = NFS_SERVER(inode);
@@ -963,10 +964,10 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
pglen = status;
if (pglen != 0)
- status = nfs_readdir_page_filler(desc, entry, pages, pglen,
- arrays, narrays, change_attr);
+ status = nfs_readdir_folio_filler(desc, entry, pages, pglen,
+ arrays, narrays, change_attr);
else
- nfs_readdir_page_set_eof(page);
+ nfs_readdir_page_set_eof(folio_page(folio, 0));
desc->buffer_fills++;
free_pages:
@@ -978,21 +979,21 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
return status;
}
-static void nfs_readdir_page_put(struct nfs_readdir_descriptor *desc)
+static void nfs_readdir_folio_put(struct nfs_readdir_descriptor *desc)
{
- put_page(desc->page);
- desc->page = NULL;
+ folio_put(desc->folio);
+ desc->folio = NULL;
}
static void
-nfs_readdir_page_unlock_and_put_cached(struct nfs_readdir_descriptor *desc)
+nfs_readdir_folio_unlock_and_put_cached(struct nfs_readdir_descriptor *desc)
{
- unlock_page(desc->page);
- nfs_readdir_page_put(desc);
+ folio_unlock(desc->folio);
+ nfs_readdir_folio_put(desc);
}
-static struct page *
-nfs_readdir_page_get_cached(struct nfs_readdir_descriptor *desc)
+static struct folio *
+nfs_readdir_folio_get_cached(struct nfs_readdir_descriptor *desc)
{
struct address_space *mapping = desc->file->f_mapping;
u64 change_attr = inode_peek_iversion_raw(mapping->host);
@@ -1004,7 +1005,7 @@ nfs_readdir_page_get_cached(struct nfs_readdir_descriptor *desc)
return NULL;
if (desc->clear_cache && !nfs_readdir_page_needs_filling(page))
nfs_readdir_page_reinit_array(page, cookie, change_attr);
- return page;
+ return page_folio(page);
}
/*
@@ -1018,21 +1019,21 @@ static int find_and_lock_cache_page(struct nfs_readdir_descriptor *desc)
__be32 verf[NFS_DIR_VERIFIER_SIZE];
int res;
- desc->page = nfs_readdir_page_get_cached(desc);
- if (!desc->page)
+ desc->folio = nfs_readdir_folio_get_cached(desc);
+ if (!desc->folio)
return -ENOMEM;
- if (nfs_readdir_page_needs_filling(desc->page)) {
+ if (nfs_readdir_page_needs_filling(folio_page(desc->folio, 0))) {
/* Grow the dtsize if we had to go back for more pages */
- if (desc->page_index == desc->page_index_max)
+ if (desc->folio_index == desc->folio_index_max)
nfs_grow_dtsize(desc);
- desc->page_index_max = desc->page_index;
+ desc->folio_index_max = desc->folio_index;
trace_nfs_readdir_cache_fill(desc->file, nfsi->cookieverf,
desc->last_cookie,
- desc->page->index, desc->dtsize);
+ desc->folio->index, desc->dtsize);
res = nfs_readdir_xdr_to_array(desc, nfsi->cookieverf, verf,
- &desc->page, 1);
+ &desc->folio, 1);
if (res < 0) {
- nfs_readdir_page_unlock_and_put_cached(desc);
+ nfs_readdir_folio_unlock_and_put_cached(desc);
trace_nfs_readdir_cache_fill_done(inode, res);
if (res == -EBADCOOKIE || res == -ENOTSYNC) {
invalidate_inode_pages2(desc->file->f_mapping);
@@ -1060,7 +1061,7 @@ static int find_and_lock_cache_page(struct nfs_readdir_descriptor *desc)
res = nfs_readdir_search_array(desc);
if (res == 0)
return 0;
- nfs_readdir_page_unlock_and_put_cached(desc);
+ nfs_readdir_folio_unlock_and_put_cached(desc);
return res;
}
@@ -1085,7 +1086,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
struct nfs_cache_array *array;
unsigned int i;
- array = kmap_local_page(desc->page);
+ array = kmap_local_folio(desc->folio, 0);
for (i = desc->cache_entry_index; i < array->size; i++) {
struct nfs_cache_array_entry *ent;
@@ -1130,7 +1131,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
*/
static int uncached_readdir(struct nfs_readdir_descriptor *desc)
{
- struct page **arrays;
+ struct folio **arrays;
size_t i, sz = 512;
__be32 verf[NFS_DIR_VERIFIER_SIZE];
int status = -ENOMEM;
@@ -1141,14 +1142,14 @@ static int uncached_readdir(struct nfs_readdir_descriptor *desc)
arrays = kcalloc(sz, sizeof(*arrays), GFP_KERNEL);
if (!arrays)
goto out;
- arrays[0] = nfs_readdir_page_array_alloc(desc->dir_cookie, GFP_KERNEL);
+ arrays[0] = page_folio(nfs_readdir_page_array_alloc(desc->dir_cookie, GFP_KERNEL));
if (!arrays[0])
goto out;
- desc->page_index = 0;
+ desc->folio_index = 0;
desc->cache_entry_index = 0;
desc->last_cookie = desc->dir_cookie;
- desc->page_index_max = 0;
+ desc->folio_index_max = 0;
trace_nfs_readdir_uncached(desc->file, desc->verf, desc->last_cookie,
-1, desc->dtsize);
@@ -1160,10 +1161,10 @@ static int uncached_readdir(struct nfs_readdir_descriptor *desc)
}
for (i = 0; !desc->eob && i < sz && arrays[i]; i++) {
- desc->page = arrays[i];
+ desc->folio = arrays[i];
nfs_do_filldir(desc, verf);
}
- desc->page = NULL;
+ desc->folio = NULL;
/*
* Grow the dtsize if we have to go back for more pages,
@@ -1173,16 +1174,16 @@ static int uncached_readdir(struct nfs_readdir_descriptor *desc)
if (!desc->eob)
nfs_grow_dtsize(desc);
else if (desc->buffer_fills == 1 &&
- i < (desc->page_index_max >> 1))
+ i < (desc->folio_index_max >> 1))
nfs_shrink_dtsize(desc);
}
out_free:
for (i = 0; i < sz && arrays[i]; i++)
- nfs_readdir_page_array_free(arrays[i]);
+ nfs_readdir_page_array_free(folio_page(arrays[i], 0));
out:
if (!nfs_readdir_use_cookie(desc->file))
nfs_readdir_rewind_search(desc);
- desc->page_index_max = -1;
+ desc->folio_index_max = -1;
kfree(arrays);
dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __func__, status);
return status;
@@ -1236,11 +1237,11 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
goto out;
desc->file = file;
desc->ctx = ctx;
- desc->page_index_max = -1;
+ desc->folio_index_max = -1;
spin_lock(&file->f_lock);
desc->dir_cookie = dir_ctx->dir_cookie;
- desc->page_index = dir_ctx->page_index;
+ desc->folio_index = dir_ctx->page_index;
desc->last_cookie = dir_ctx->last_cookie;
desc->attr_gencount = dir_ctx->attr_gencount;
desc->eof = dir_ctx->eof;
@@ -1287,8 +1288,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
break;
nfs_do_filldir(desc, nfsi->cookieverf);
- nfs_readdir_page_unlock_and_put_cached(desc);
- if (desc->page_index == desc->page_index_max)
+ nfs_readdir_folio_unlock_and_put_cached(desc);
+ if (desc->folio_index == desc->folio_index_max)
desc->clear_cache = force_clear;
} while (!desc->eob && !desc->eof);
@@ -1296,7 +1297,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
dir_ctx->dir_cookie = desc->dir_cookie;
dir_ctx->last_cookie = desc->last_cookie;
dir_ctx->attr_gencount = desc->attr_gencount;
- dir_ctx->page_index = desc->page_index;
+ dir_ctx->page_index = desc->folio_index;
dir_ctx->force_clear = force_clear;
dir_ctx->eof = desc->eof;
dir_ctx->dtsize = desc->dtsize;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0167/1059] NFS: restore directory index when resuming readdir
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (165 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0166/1059] NFS: Convert the readdir array-of-pages into an array-of-folios Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:54 ` [PATCH 6.1 0168/1059] SUNRPC: wake poll waiters when an empty pipe is unlinked Greg Kroah-Hartman
` (831 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 89b91409b2342e7629b1271eba315a0f06495247 ]
nfs_readdir() restores the cached folio index and cookie when
resuming directory iteration, but leaves current_index at zero.
In 32-bit index mode, nfs_readdir_search_for_cookie() then
reports a folio-relative offset instead of the absolute entry
position.
Restore current_index from the saved logical folio index before
searching the cache.
This solution relies on the current behavior of
nfs_readdir_seek_next_array(), where folio_index advances by
one and current_index advances by nfs_readdir_array_maxentries()
for each full, nonterminal folio.
Fixes: f648022faa68e ("NFS: Convert readdir page cache to use a cookie based index")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 8b6215e88515f..82175862356cc 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1242,6 +1242,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
spin_lock(&file->f_lock);
desc->dir_cookie = dir_ctx->dir_cookie;
desc->folio_index = dir_ctx->page_index;
+ desc->current_index = (loff_t)desc->folio_index *
+ nfs_readdir_array_maxentries();
desc->last_cookie = dir_ctx->last_cookie;
desc->attr_gencount = dir_ctx->attr_gencount;
desc->eof = dir_ctx->eof;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0168/1059] SUNRPC: wake poll waiters when an empty pipe is unlinked
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (166 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0167/1059] NFS: restore directory index when resuming readdir Greg Kroah-Hartman
@ 2026-12-04 9:54 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0169/1059] SUNRPC: preserve timeout policy when cloning clients Greg Kroah-Hartman
` (830 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Jeff Layton, NeilBrown,
Anna Schumaker, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 702d55edc017632a0c39c1d4bdd579bdbadfd730 ]
When an empty rpc_pipefs pipe is unlinked, rpc_purge_list() returns
without waking the pipe wait queue. An existing epoll waiter can
remain blocked even though rpc_pipe_poll() reports EPOLLHUP and
EPOLLERR for the disconnected pipe.
Wake the wait queue after clearing RPC_I(inode)->pipe so existing
poll waiters are notified regardless of whether messages were purged.
Fixes: 9842ef3557ab ("SUNRPC: rpc_timeout_upcall_queue should not sleep")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/rpc_pipe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 0b6034fab9ab1..9930e04d47bdf 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -190,6 +190,7 @@ rpc_close_pipes(struct inode *inode)
cancel_delayed_work_sync(&pipe->queue_timeout);
rpc_inode_setowner(inode, NULL);
RPC_I(inode)->pipe = NULL;
+ wake_up(&RPC_I(inode)->waitq);
inode_unlock(inode);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0169/1059] SUNRPC: preserve timeout policy when cloning clients
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (167 preceding siblings ...)
2026-12-04 9:54 ` [PATCH 6.1 0168/1059] SUNRPC: wake poll waiters when an empty pipe is unlinked Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0170/1059] SUNRPC: Balance switch queue length on transport removal Greg Kroah-Hartman
` (829 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 5b0ac1f82201c2ab2d9c31ed568cc782bac6a399 ]
rpc_clone_client() and rpc_clone_client_set_auth() leave the
timeout argument unset, causing rpc_new_client() to use the
transport defaults instead of the parent's configured
timeout. This also affects pNFS data-server clients and
changes their request timeout and initial RTT calculations.
Use the parent's cl_timeout when no timeout is specified.
Preserve explicitly supplied timeout overrides.
Fixes: 1b63a75180c6 ("SUNRPC: Refactor rpc_clone_client()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 212e1a4705964..dac52a46c82e8 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -648,6 +648,8 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
}
args->servername = xprt->servername;
args->nodename = clnt->cl_nodename;
+ if (!args->timeout)
+ args->timeout = clnt->cl_timeout;
new = rpc_new_client(args, xps, xprt, clnt);
if (IS_ERR(new))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0170/1059] SUNRPC: Balance switch queue length on transport removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (168 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0169/1059] SUNRPC: preserve timeout policy when cloning clients Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0171/1059] SUNRPC: Balance queue accounting when relocating a task Greg Kroah-Hartman
` (828 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 8acd94f02a960c8936df25a7af9c02c8ea87064d ]
When call_connect_status() moves a task off a transport marked for
removal, it decrements xprt->queuelen but leaves the switch's
xps_queuelen unchanged. The stale count persists after the task
finishes and skews multipath transport selection.
Decrement xps_queuelen alongside xprt->queuelen, matching the normal
transport release path.
Fixes: 6f081693e7b2 ("sunrpc: remove an offlined xprt using sysfs")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index dac52a46c82e8..d29960fde3f76 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2213,6 +2213,7 @@ call_connect_status(struct rpc_task *task)
xprt_release(task);
value = atomic_long_dec_return(&xprt->queuelen);
+ atomic_long_dec(&xps->xps_queuelen);
if (value == 0)
rpc_xprt_switch_remove_xprt(xps, saved,
true);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0171/1059] SUNRPC: Balance queue accounting when relocating a task
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (169 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0170/1059] SUNRPC: Balance switch queue length on transport removal Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0172/1059] af_unix: Remove gc_in_progress check in unix_peek_fpl() Greg Kroah-Hartman
` (827 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit f14b157168ac106cfac6d577e08726488b1b886c ]
When rpc_task_set_transport() relocates a movable task from an
offline transport, it releases the request and drops the
transport reference without decrementing the old transport's
queuelen or the switch's xps_queuelen. Releasing the task
later only accounts for the replacement transport.
The stale counts affect transport selection and can prevent
xprt_delete_locked() from removing an otherwise idle transport.
Use rpc_task_release_xprt() to balance the previous assignment
before selecting a replacement. Pass clnt explicitly because
rpc_task_set_client() can assign a transport before tk_client
is initialized.
Fixes: 82ee41b85cef ("SUNRPC don't resend a task on an offlined transport")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index d29960fde3f76..cbcc4d9b7ca2f 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1159,7 +1159,7 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
(task->tk_flags & RPC_TASK_MOVEABLE)))
return;
xprt_release(task);
- xprt_put(task->tk_xprt);
+ rpc_task_release_xprt(clnt, task->tk_xprt);
}
if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
task->tk_xprt = rpc_task_get_first_xprt(clnt);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0172/1059] af_unix: Remove gc_in_progress check in unix_peek_fpl().
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (170 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0171/1059] SUNRPC: Balance queue accounting when relocating a task Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0173/1059] ipv6: ignore link state in gateway check Greg Kroah-Hartman
` (826 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qihang Tang, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 0edbc945eb9edd0086f25b151a79cfe4adc0dfa8 ]
unix_vertex_dead() and unix_peek_fpl() are synchronised
with unix_peek_seq to prevent GC from purging a live
socket's recvq.
unix_peek_fpl() skips the synchronisation if gc_in_progress
is false.
However, on weakly ordered arch, GC might have already
started working while the write to gc_in_progress is
buffered.
This does not occur on x86.
This is an unlikely path that happens only when AF_UNIX
fd is peeked so not worth complicating.
Instead of adding memory barriers in unix_gc() and
unix_peek_fpl(), let's simply remove the broken short-circuit.
Fixes: e5b31d988a41 ("af_unix: Give up GC if MSG_PEEK intervened.")
Reported-by: Qihang Tang <q.h.hack.winter@gmail.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104162858.991930-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/unix/garbage.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 338769200065e..9c1afd8507c57 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -317,9 +317,6 @@ void unix_peek_fpl(struct scm_fp_list *fpl)
if (!fpl || !fpl->count_unix)
return;
- if (!READ_ONCE(gc_in_progress))
- return;
-
/* Invalidate the final refcnt check in unix_vertex_dead(). */
spin_lock(&unix_peek_lock);
raw_write_seqcount_barrier(&unix_peek_seq);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0173/1059] ipv6: ignore link state in gateway check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (171 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0172/1059] af_unix: Remove gc_in_progress check in unix_peek_fpl() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0174/1059] team: Add matching error label for failed action Greg Kroah-Hartman
` (825 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yaroslav Dudkov, Hangbin Liu,
Ido Schimmel, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
[ Upstream commit b76bcf3fff9332076d92de47a80d12fd3d5268e2 ]
IPv6 route cannot be added in table when all
following conditions are true:
- gateway is not link-local address
- ignore_routes_with_linkdown=1 on device
- nexthop has no carrier
- gateway is not present or covered by any route in table already
Also multipath routes addition is invalidated by kernel even
if only one of added nexthops satisfies all above conditions.
Reproducer:
ip netns add t
ip -n t link add va type veth peer name vb
ip -n t link set va up
ip -n t addr add fd00::1/64 dev va nodad
ip netns exec t sysctl -w \
net.ipv6.conf.va.ignore_routes_with_linkdown=1
ip -n t -6 route add 2001:db8::/64 via fd00::2 dev va
# added
ip -n t -6 route add 2001:db8::/64 table 100 via fd00::2 dev va
# RTNETLINK answers: No route to host
ip -n t -6 route show table all
ip netns del t
Route should be added because:
- RT6_LOOKUP_F_IGNORE_LINKSTATE in commit d5d32e4b7668
("net: ipv6: Do not consider link state for nexthop validation")
was added for this
- the same route is valid in main table (when no specifying table id
while adding route)
- fib6_nh_init() initializes nexthops with no carrier
- IPv4 already does this (fib_check_nh_v4_gw() ignores link state
using the FIB_LOOKUP_IGNORE_LINKSTATE flag)
Before commit b2c709cce682 ("ipv6: Convert gateway validation to
use fib6_info") rt6_lookup() was used for checking if nexthop is
valid, rt6_lookup called rt6_device_match() which does not check the
link state. After change rt6_lookup() to fib6_lookup()
find_match() under fib6_lookup() started to invalidate linkdown
devices, because RT6_LOOKUP_F_IGNORE_LINKSTATE is not passed to it.
Adding RT6_LOOKUP_F_IGNORE_LINKSTATE to flags for ip6_route_check_nh()
solves the problem. RT6_LOOKUP_F_IGNORE_LINKSTATE is already used
inside the first search ip6_nh_lookup_table() and fixes the
bug in second search fib6_lookup(). Also RT6_LOOKUP_F_IGNORE_LINKSTATE
isn't read inside fib6_select_path().
Fixes: b2c709cce682 ("ipv6: Convert gateway validation to use fib6_info")
Signed-off-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261104195655.1406837-2-aroslavdudkov622@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 9ae14920e761a..5e2326f5c941b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3431,9 +3431,9 @@ static int ip6_route_check_nh(struct net *net,
struct net_device **_dev,
struct inet6_dev **idev)
{
+ int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
const struct in6_addr *gw_addr = &cfg->fc_gateway;
struct net_device *dev = _dev ? *_dev : NULL;
- int flags = RT6_LOOKUP_F_IFACE;
struct fib6_result res = {};
int err = -EHOSTUNREACH;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0174/1059] team: Add matching error label for failed action
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (172 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0173/1059] ipv6: ignore link state in gateway check Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0175/1059] team: fix promisc/allmulti leak in team_port_add error path Greg Kroah-Hartman
` (824 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nikola Z. Ivanov, Simon Horman,
Jiri Pirko, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikola Z. Ivanov <zlatistiv@gmail.com>
[ Upstream commit aee0f01b4f118844cb126a5f27e91c2adf087c59 ]
Follow the "action" - "err_action" pairing of labels
found across the source code of team net device.
Currently in team_port_add the err_set_slave_promisc
label is reused for exiting on error when setting
allmulti level of the new slave.
Signed-off-by: Nikola Z. Ivanov <zlatistiv@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/20251128072544.223645-1-zlatistiv@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: ff618cb00a64 ("team: fix promisc/allmulti leak in team_port_add error path")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/team/team.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 63bb2e88c1a63..27067c38962c9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1312,7 +1312,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
if (err) {
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(port_dev, -1);
- goto err_set_slave_promisc;
+ goto err_set_slave_allmulti;
}
}
@@ -1339,6 +1339,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return 0;
err_set_dev_type:
+err_set_slave_allmulti:
err_set_slave_promisc:
__team_option_inst_del_port(team, port);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0175/1059] team: fix promisc/allmulti leak in team_port_add error path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (173 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0174/1059] team: Add matching error label for failed action Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0176/1059] net/mlx5: Lag, free steering resources on LAG destroy failure Greg Kroah-Hartman
` (823 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Li RongQing, Hangbin Liu,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <lirongqing@baidu.com>
[ Upstream commit ff618cb00a645f1e3f89068c5fbda3f3a7f4ae63 ]
team_port_add() increments the port's promiscuity and allmulti
counts before calling team_dev_type_check_change(). If the latter
fails, the error path does not undo these increments, leaving the
port in promiscuous and allmulti mode even though it was not
successfully added to the team.
Undo the promiscuity increment under err_set_slave_allmulti and the
allmulti increment under err_set_dev_type, so each error label only
reverts what was successfully applied, matching the cleanup performed
by team_port_del().
With the promiscuity rollback now living under err_set_slave_allmulti,
the inline dev_set_promiscuity(port_dev, -1) in the dev_set_allmulti()
failure branch becomes redundant: that branch already jumps to
err_set_slave_allmulti, which undoes the promiscuity increment. Drop
the inline call to avoid doing it twice.
Found by source code audit.
Fixes: 0ae9cfc454ea ("team: Move team device type change at the end of team_port_add")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261104015217.2222-1-lirongqing@baidu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/team/team.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 27067c38962c9..f96b1d581716a 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1309,11 +1309,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
/* set allmulti level to new slave */
if (dev->flags & IFF_ALLMULTI) {
err = dev_set_allmulti(port_dev, 1);
- if (err) {
- if (dev->flags & IFF_PROMISC)
- dev_set_promiscuity(port_dev, -1);
+ if (err)
goto err_set_slave_allmulti;
- }
}
err = team_dev_type_check_change(dev, port_dev);
@@ -1339,7 +1336,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return 0;
err_set_dev_type:
+ if (dev->flags & IFF_ALLMULTI)
+ dev_set_allmulti(port_dev, -1);
err_set_slave_allmulti:
+ if (dev->flags & IFF_PROMISC)
+ dev_set_promiscuity(port_dev, -1);
err_set_slave_promisc:
__team_option_inst_del_port(team, port);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0176/1059] net/mlx5: Lag, free steering resources on LAG destroy failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (174 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0175/1059] team: fix promisc/allmulti leak in team_port_add error path Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0177/1059] net: protect negative destination advice with RCU Greg Kroah-Hartman
` (822 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Bloch, Shay Drori, Tariq Toukan,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Bloch <mbloch@nvidia.com>
[ Upstream commit deceb70d1303105e4368a19b251a6fd94428eb11 ]
When firmware fails to destroy LAG, driver returns before releasing the
steering resources, leaking the associated software objects.
The bond is no longer eligible for offload, and the driver cannot
prevent its teardown. Release the steering resources even if LAG
destruction fails. Preserve the error logging and return the original
error after cleanup.
Fixes: da6b0bb0fc73 ("net/mlx5: Lag, use steering to select the affinity port in LAG")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104183947.772195-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index e127cbdf2bbf7..ec1723118d34f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -676,7 +676,6 @@ static int mlx5_deactivate_lag(struct mlx5_lag *ldev)
"Failed to deactivate VF LAG; driver restart required\n"
"Make sure all VFs are unbound prior to VF LAG activation or deactivation\n");
}
- return err;
}
if (test_bit(MLX5_LAG_MODE_FLAG_HASH_BASED, &flags)) {
@@ -686,7 +685,7 @@ static int mlx5_deactivate_lag(struct mlx5_lag *ldev)
if (mlx5_lag_has_drop_rule(ldev))
mlx5_lag_drop_rule_cleanup(ldev);
- return 0;
+ return err;
}
#define MLX5_LAG_OFFLOADS_SUPPORTED_PORTS 2
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0177/1059] net: protect negative destination advice with RCU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (175 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0176/1059] net/mlx5: Lag, free steering resources on LAG destroy failure Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0178/1059] net: require a full socket in sock_confirm_neigh() Greg Kroah-Hartman
` (821 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jiayuan Chen, Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 4b77d2792c3e482afa108c08f224ea6fa396d80b ]
SO_CNX_ADVICE calls __dst_negative_advice() while holding the socket
lock. Connected UDP sends can still invalidate or replace sk_dst_cache
without that lock. A concurrent sk_dst_check() can drop the final
destination reference and allow an RCU callback to destroy it while
__dst_negative_advice() retains only a borrowed pointer. This can cause
a use-after-free while accessing dst->ops or running the negative_advice
callback.
The writer-side ordering fixed by commit 92f1655aa2b2 ("net: fix
__dst_negative_advice() race") does not protect this reader from an
independent cache replacement.
Hold an RCU read-side critical section across the lookup and callback.
This follows the datagram release callbacks and covers IPv4, IPv6, and
XFRM advice without changing cache-reset or reference-ownership rules.
Fixes: a87cb3e48ee8 ("net: Facility to report route quality of connected sockets")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104131744.1056562-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/sock.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 13c112bd2d316..c86974137a187 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2280,10 +2280,13 @@ sk_dst_get(struct sock *sk)
static inline void __dst_negative_advice(struct sock *sk)
{
- struct dst_entry *dst = __sk_dst_get(sk);
+ struct dst_entry *dst;
+ rcu_read_lock();
+ dst = __sk_dst_get(sk);
if (dst && dst->ops->negative_advice)
dst->ops->negative_advice(sk, dst);
+ rcu_read_unlock();
}
static inline void dst_negative_advice(struct sock *sk)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0178/1059] net: require a full socket in sock_confirm_neigh()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (176 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0177/1059] net: protect negative destination advice with RCU Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0179/1059] ipvlan: make outbound skb headers writable Greg Kroah-Hartman
` (820 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit c78b47704934e44442f4e48bfdcc99039e3b85a5 ]
An skb can retain dst_pending_confirm after its original output and
socket owner have changed. For example, a raw MSG_CONFIRM packet can
cross veth, have a TCP request socket assigned by TPROXY, and be bridged
into gretap. Neighbor output for the outer packet then calls
sock_confirm_neigh() with the request socket in skb->sk.
The helper unconditionally treats a non-NULL skb->sk as a full socket
when accessing sk_dst_pending_confirm. TCP request and TIME_WAIT sockets
do not contain that field. This produces an out-of-bounds four-byte read
and, if the word is nonzero, an out-of-bounds four-byte zero write. A
KASAN-enabled kernel reports:
BUG: KASAN: slab-out-of-bounds in ip_finish_output2+0xc9f/0xd60
Read of size 4 at addr ffff8880bdc3d880 by task tproxy_dst_conf/1771
Require sk_fullsock() before accessing the socket field, moving the
existing helper earlier in the header to make it available here. Keep
neigh_confirm() independent of the socket type so the skb's neighbor
confirmation still works, including for socketless packets. This also
covers the IPv6, VRF, and BPF neighbor-output callers.
Fixes: 4ff0620354f2 ("net: add dst_pending_confirm flag to skbuff")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104132900.1071940-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/sock.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index c86974137a187..1e6f7cbd022d9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2335,6 +2335,14 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
+/* This helper checks if a socket is a full socket,
+ * ie _not_ a timewait or request socket.
+ */
+static inline bool sk_fullsock(const struct sock *sk)
+{
+ return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
+}
+
static inline void sk_dst_confirm(struct sock *sk)
{
if (!READ_ONCE(sk->sk_dst_pending_confirm))
@@ -2346,7 +2354,8 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
if (skb_get_dst_pending_confirm(skb)) {
struct sock *sk = skb->sk;
- if (sk && READ_ONCE(sk->sk_dst_pending_confirm))
+ if (sk && sk_fullsock(sk) &&
+ READ_ONCE(sk->sk_dst_pending_confirm))
WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
neigh_confirm(n);
}
@@ -2951,14 +2960,6 @@ skb_sk_is_prefetched(struct sk_buff *skb)
#endif /* CONFIG_INET */
}
-/* This helper checks if a socket is a full socket,
- * ie _not_ a timewait or request socket.
- */
-static inline bool sk_fullsock(const struct sock *sk)
-{
- return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
-}
-
static inline bool
sk_is_refcounted(struct sock *sk)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0179/1059] ipvlan: make outbound skb headers writable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (177 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0178/1059] net: require a full socket in sock_confirm_neigh() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0180/1059] bonding: fix slave_cnt leak on XDP enslave failure Greg Kroah-Hartman
` (819 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit a45dbf182137275f44ad7c8bc8acd23f7af6b2cf ]
In L3 and L3S modes, ipvlan_process_v4_outbound() and
ipvlan_process_v6_outbound() hand the skb to ip_local_out() and
ip6_local_out(). The IP output path assumes it owns the network header:
__ip_local_out() rewrites tot_len and the header checksum, and
transport-mode XFRM can memmove the network header into the headroom
when xfrm_skb_check_space() finds enough room, without copying.
The skb reaching ipvlan can have its header shared with another skb,
for example after an AF_PACKET tap on the ipvlan device or a tc mirred
mirror action. pskb_network_may_pull() only makes the header linear;
it does not unshare an already linear head. The writes above then
modify the other skb. If that skb is on the receive path and its IPv4
header was already validated, IPv4 option processing can use the
modified header, write past the linear data, and corrupt
skb_shared_info.
Use skb_cow_head() before taking header pointers and entering the local
IP output path, like ip_forward() does with skb_cow() before it touches
the header. Only checking skb_header_cloned() is enough here: skbs that
TCP transmits are clones of the write-queue skb, whose header area has
been released with __skb_header_release(). Their headers are private,
so they are not copied, which avoids a reallocation for every TCP
segment sent through an ipvlan slave.
If the allocation fails, the existing error accounting and drop paths
are used. L2 mode is unaffected.
[edumazet: use skb_cow_head() instead of skb_unclone() to avoid
copying every TCP segment, reword changelog]
Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104113530.986664-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ipvlan/ipvlan_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index bf57e4427eb4f..e22a43ac194ea 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -425,7 +425,8 @@ static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb)
.flowi4_mark = skb->mark,
};
- if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+ if (!pskb_network_may_pull(skb, sizeof(struct iphdr)) ||
+ skb_cow_head(skb, 0))
goto err;
ip4h = ip_hdr(skb);
@@ -491,7 +492,8 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
struct net_device *dev = skb->dev;
int err, ret = NET_XMIT_DROP;
- if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) {
+ if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)) ||
+ skb_cow_head(skb, 0)) {
DEV_STATS_INC(dev, tx_errors);
kfree_skb(skb);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0180/1059] bonding: fix slave_cnt leak on XDP enslave failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (178 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0179/1059] ipvlan: make outbound skb headers writable Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0181/1059] tun: delete the flow entries of the moved queue on detach Greg Kroah-Hartman
` (818 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit a978095699641d4f83a32b499a981c419c94abca ]
bond_enslave() increments bond->slave_cnt before setting up XDP on the
new slave. If that setup fails (slave has no XDP support, already has
an XDP program, or dev_xdp_propagate() fails), the error path jumps to
err_sysfs_del, which never decrements slave_cnt.
Each failed enslave therefore leaves slave_cnt one too high:
- SIOCBONDINFOQUERY reports a wrong num_slaves,
- balance-rr picks slave ids beyond the end of the slave list, so
bond_get_slave_by_id() falls back to the first usable slave and
transmit is skewed toward it.
Reproducer:
ip link add bond0 type bond mode balance-rr
ip link set bond0 xdpdrv obj xdp_dummy.bpf.o sec xdp
for i in 0 1 2; do
ip link add d$i type dummy
ip link set d$i master bond0 # fails: Slave does not support XDP
done
num_slaves read via SIOCBONDINFOQUERY is 3 before this patch, 0 after.
Add an err_dec_slave_cnt label ahead of err_sysfs_del and use it from
the three XDP failure paths, which are the only failures after the
increment.
Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104092851.688361-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 635fec9e8cded..3944217d090f6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2320,7 +2320,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
SLAVE_NL_ERR(bond_dev, slave_dev, extack,
"Slave does not support XDP");
res = -EOPNOTSUPP;
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
} else if (bond->xdp_prog) {
struct netdev_bpf xdp = {
@@ -2334,14 +2334,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
SLAVE_NL_ERR(bond_dev, slave_dev, extack,
"Slave has XDP program loaded, please unload before enslaving");
res = -EOPNOTSUPP;
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
res = slave_dev->netdev_ops->ndo_bpf(slave_dev, &xdp);
if (res < 0) {
/* ndo_bpf() sets extack error message */
slave_dbg(bond_dev, slave_dev, "Error %d calling ndo_bpf\n", res);
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
if (bond->xdp_prog)
bpf_prog_inc(bond->xdp_prog);
@@ -2361,6 +2361,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
return 0;
/* Undo stages on error */
+err_dec_slave_cnt:
+ WRITE_ONCE(bond->slave_cnt, bond->slave_cnt - 1);
+
err_sysfs_del:
bond_sysfs_slave_del(new_slave);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0181/1059] tun: delete the flow entries of the moved queue on detach
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (179 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0180/1059] bonding: fix slave_cnt leak on XDP enslave failure Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0182/1059] ipv4: route: dont blackhole in-use routes when retiring fnhe routes Greg Kroah-Hartman
` (817 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Umang Pokhriyal, Willem de Bruijn,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Umang Pokhriyal <umangpokhriyall@gmail.com>
[ Upstream commit 4cc0a3f897074cea28dae38f1cd9bb230dae5d86 ]
When a queue is detached, __tun_detach() moves the last queue into the
freed slot and decrements tun->numqueues. The flow entries that point at
the old index of the moved queue, now tun->numqueues, are meant to be
deleted, but the call passes tun->numqueues + 1, an index that never
exists, so nothing is deleted.
Until those entries are refreshed by a write on their flow or age out,
tun_automq_select_queue() returns an index past the last queue, and
netdev_core_pick_tx() sends every such flow to queue 0 and warns:
tapq0 selects TX queue 3, but real number of TX queues is 3
Found with an LLM while testing how a VMM detaches tap queues when a
guest lowers its virtio-net queue pairs. With four queues, 30 flows
learned on queue 3 and queue 1 detached, all 30 went to queue 0 with the
warning; with this patch they are spread by hash and no warning is
printed (3 runs each, in a guest booted on net).
Pass tun->numqueues.
Fixes: 96442e42429e ("tuntap: choose the txq based on rxq")
Signed-off-by: Umang Pokhriyal <umangpokhriyall@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261104174240.138491-1-umangpokhriyall@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1b4700feed4db..22f35e92f5424 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -671,7 +671,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
}
synchronize_net();
- tun_flow_delete_by_queue(tun, tun->numqueues + 1);
+ tun_flow_delete_by_queue(tun, tun->numqueues);
/* Drop read queue */
tun_queue_purge(tfile);
tun_set_real_num_queues(tun);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0182/1059] ipv4: route: dont blackhole in-use routes when retiring fnhe routes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (180 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0181/1059] tun: delete the flow entries of the moved queue on detach Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0183/1059] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails Greg Kroah-Hartman
` (816 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Chase Hiltz,
Ido Schimmel, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chase Hiltz <me@chasehil.tz>
[ Upstream commit ae89f2724db1afa96a1f1b661174fc41ae1e88fa ]
When a route cached in a nexthop exception (fnhe) is replaced or
flushed, rt_bind_exception() and fnhe_flush_routes() call
dst_dev_put() on it. That sets dst->dev to blackhole_netdev and
dst->input/output to dst_discard*(), but other CPUs can still be
using the route, e.g. as a noref dst taken from the fnhe under RCU.
Packets that reach dst_input() or dst_output() after that are dropped.
If dst_dev_put() runs after a forwarded packet has entered ip_output(),
ip_skb_dst_mtu() in __ip_finish_output() can return the MTU of
blackhole_netdev (68), and ip_fragment() can then drop a DF packet and
send ICMP_FRAG_NEEDED with mtu 68 to its source.
Commit 5018c59607a5 ("ipv4: fix race condition between route lookup and
invalidation") fixed the same race in rt_cache_route() by putting the
old route on the uncached list instead of calling dst_dev_put(). Do the
same for routes retired from an fnhe. rt_flush_dev() still moves them
to blackhole_netdev when their device is unregistered.
fnhe routes are also retired on fnhe expiry (ip_del_fnhe()) and
eviction (fnhe_remove_oldest()). Those paths don't bump rt_genid, so
without the obsolete marking ipv4_dst_check() could still accept the
route. Keep marking retired routes DST_OBSOLETE_DEAD, as dst_dev_put()
did, so that users that cached them, such as sockets, look up again.
In a netns reproducer that forwards IPv4 traffic over an ip6tnl device,
with an fnhe for the destination, while the FIB keeps changing, this
patch stops the mtu 68 ICMPs and the drops.
Fixes: 95c47f9cf5e0 ("ipv4: call dst_dev_put() properly")
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Chase Hiltz <me@chasehil.tz>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261105182640.2999521-1-me@chasehil.tz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/route.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fa2d3f4490a6d..dacdbd150fba5 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -583,6 +583,17 @@ static void ip_rt_build_flow_key(struct flowi4 *fl4, const struct sock *sk,
static DEFINE_SPINLOCK(fnhe_lock);
+/* Other CPUs may still be using @rt, so don't dst_dev_put() it.
+ * rt_flush_dev() handles it if its device is unregistered.
+ * Marking it dead makes ipv4_dst_check() fail for users that cached it.
+ */
+static void fnhe_retire_route(struct rtable *rt)
+{
+ WRITE_ONCE(rt->dst.obsolete, DST_OBSOLETE_DEAD);
+ rt_add_uncached_list(rt);
+ dst_release(&rt->dst);
+}
+
static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
{
struct rtable *rt;
@@ -590,14 +601,12 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
rt = rcu_dereference(fnhe->fnhe_rth_input);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
- dst_dev_put(&rt->dst);
- dst_release(&rt->dst);
+ fnhe_retire_route(rt);
}
rt = rcu_dereference(fnhe->fnhe_rth_output);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
- dst_dev_put(&rt->dst);
- dst_release(&rt->dst);
+ fnhe_retire_route(rt);
}
}
@@ -1510,10 +1519,8 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
if (do_cache) {
dst_hold(&rt->dst);
rcu_assign_pointer(*porig, rt);
- if (orig) {
- dst_dev_put(&orig->dst);
- dst_release(&orig->dst);
- }
+ if (orig)
+ fnhe_retire_route(orig);
ret = true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0183/1059] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (181 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0182/1059] ipv4: route: dont blackhole in-use routes when retiring fnhe routes Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0184/1059] fou: gue: check IP version of held packets for direct IP encapsulation Greg Kroah-Hartman
` (815 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yuho Choi, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <oss.patchbox@gmail.com>
[ Upstream commit 6a01fb125ba6474cb97f14b68fe5435d3cdd08e5 ]
In a confidential guest, kvm_arch_ptp_init() shares the clock_pair page
with the host using set_memory_decrypted(), and kvm_arch_ptp_exit()
makes it private again with set_memory_encrypted() before freeing it.
The untrusted host can make either call fail and leave the page shared.
Both paths still free the page: the init error path with __free_page(),
and kvm_arch_ptp_exit() after only a WARN_ON(). The page allocator can
then hand a page the host can still access to an unrelated user.
Leak the page in both cases instead, as was done for the same situation
in commit b9fa16949d18 ("dma-direct: Leak pages on dma_set_decrypted()
failure") and commit 03f5a999adba ("Drivers: hv: vmbus: Leak pages if
set_memory_encrypted() fails").
Fixes: 6365ba64b4dbe ("ptp: kvm: Use decrypted memory in confidential guest on x86")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Link: https://patch.msgid.link/20261105164324.23501-2-oss.patchbox@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_kvm_x86.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c
index 5e5b2ef785474..ab35b20dfb7df 100644
--- a/drivers/ptp/ptp_kvm_x86.c
+++ b/drivers/ptp/ptp_kvm_x86.c
@@ -36,7 +36,7 @@ int kvm_arch_ptp_init(void)
clock_pair = page_address(p);
ret = set_memory_decrypted((unsigned long)clock_pair, 1);
if (ret) {
- __free_page(p);
+ /* The page may be left shared, so leak it. */
clock_pair = NULL;
goto nofree;
}
@@ -68,8 +68,9 @@ int kvm_arch_ptp_init(void)
void kvm_arch_ptp_exit(void)
{
if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
- WARN_ON(set_memory_encrypted((unsigned long)clock_pair, 1));
- free_page((unsigned long)clock_pair);
+ /* Leak the page if it cannot be made private again. */
+ if (!WARN_ON(set_memory_encrypted((unsigned long)clock_pair, 1)))
+ free_page((unsigned long)clock_pair);
clock_pair = NULL;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0184/1059] fou: gue: check IP version of held packets for direct IP encapsulation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (182 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0183/1059] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0185/1059] udp: do not use a cross-family sk_rx_dst in early demux Greg Kroah-Hartman
` (814 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit c59f004734a2a7c0e427011db13aca524e781498 ]
For GUE version 0, gue_gro_receive() compares the base GUE header and
its optional fields with every held packet. For GUE version 1 (direct
IP encapsulation), it skips this comparison and selects the next GRO
handler only from the IP version of the incoming packet.
A held version 0 GUE packet from the same outer flow therefore stays
eligible. For example, a GUE/IPv4/UDP packet can be aggregated with a
direct IPv4/TCP packet, and inet_gro_receive() then parses the held
packet's GUE header as an IPv4 header.
Clear same_flow for held packets whose first nibble does not match the
incoming IP version. A valid version 0 GUE header always has a first
nibble between 0 and 3, so this also separates the two GUE formats.
The reverse case is already handled: the version 0 path compares the
whole base GUE header, including the version bits.
Fixes: c1e48af7960e ("gue: Implement direction IP encapsulation")
Reported-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261106195615.2498766-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/fou_core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/ipv4/fou_core.c b/net/ipv4/fou_core.c
index a28084603ba8f..3c42ebed7a963 100644
--- a/net/ipv4/fou_core.c
+++ b/net/ipv4/fou_core.c
@@ -365,6 +365,18 @@ static struct sk_buff *gue_gro_receive(struct sock *sk,
default:
goto out;
}
+
+ /* Match the encapsulation format and IP version. */
+ list_for_each_entry(p, head, list) {
+ const struct iphdr *iph2;
+
+ if (!NAPI_GRO_CB(p)->same_flow)
+ continue;
+
+ iph2 = (const struct iphdr *)(p->data + off);
+ if (iph2->version != ((struct iphdr *)guehdr)->version)
+ NAPI_GRO_CB(p)->same_flow = 0;
+ }
goto next_proto;
default:
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0185/1059] udp: do not use a cross-family sk_rx_dst in early demux
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (183 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0184/1059] fou: gue: check IP version of held packets for direct IP encapsulation Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0186/1059] net: remove skb->vlan_present Greg Kroah-Hartman
` (813 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 5636e67320563be743d47706ef4914078c27edb2 ]
A dual-stack UDP socket connected to a v4-mapped address can receive
both IPv4 packets and IPv6 packets using v4-mapped addresses:
ip6_rcv_core() no longer rejects a v4-mapped source since commit
dcc32f4f183a ("ipv6: weaken the v4mapped source check"), which kept
that check only in tcp_v6_conn_request(). ipv6_portaddr_hash() hashes
v4-mapped addresses like IPv4 ones, so both early demux handlers find
the socket, and both __udp4_lib_rcv() and __udp6_lib_rcv() store their
input dst in the same sk->sk_rx_dst.
udp_v6_early_demux() validates the cached dst with dst_check(), but
ipv4_dst_check() ignores the cookie, so an IPv4 dst gets attached to
an IPv6 skb. ip6_rcv_finish_core() then skips the route lookup and
ip_local_deliver() parses the IPv6 header as an IPv4 one: the IPv6
next header and hop limit are read as a fragment offset, and the IPv4
protocol is taken from a source address byte.
The reverse direction looks possible too: per-cpu dsts of IPv6 routes
using nexthop objects have rt->sernum set, and ip6_dst_check() then
ignores the cookie, so udp_v4_early_demux() can attach an IPv6 dst to
an IPv4 skb.
Kyle Zeng reported that such a packet can reach XFRM input still
holding the prefetched, non refcounted, socket set by early demux,
which can then outlive its RCU grace period.
Only use the cached dst if its family matches the packet. Otherwise
fall back to a regular route lookup.
TCP does not have the same problem: sk_ehashfn() hashes a v4-mapped
socket with inet_ehashfn(), while IPv6 lookups use inet6_ehashfn(),
so IPv6 packets do not normally find a v4-mapped TCP socket.
Fixes: 5425077d73e0 ("net: ipv6: Add early demux handler for UDP unicast")
Fixes: c9f2c1ae123a ("udp6: fix socket leak on early demux")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261106110135.2161204-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/udp.c | 5 ++++-
net/ipv6/udp.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 3c41aed3788c0..7777568c612b9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2686,8 +2686,11 @@ int udp_v4_early_demux(struct sk_buff *skb)
skb->destructor = sock_efree;
dst = rcu_dereference(sk->sk_rx_dst);
- if (dst)
+ /* A dual-stack socket can cache an IPv6 dst. */
+ if (dst && dst->ops->family == AF_INET)
dst = dst_check(dst, 0);
+ else
+ dst = NULL;
if (dst) {
u32 itag = 0;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d335e4ff35cb3..565a0fc8f7cc1 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1188,8 +1188,11 @@ void udp_v6_early_demux(struct sk_buff *skb)
skb->destructor = sock_efree;
dst = rcu_dereference(sk->sk_rx_dst);
- if (dst)
+ /* A dual-stack socket can cache an IPv4 dst. */
+ if (dst && dst->ops->family == AF_INET6)
dst = dst_check(dst, sk->sk_rx_dst_cookie);
+ else
+ dst = NULL;
if (dst) {
/* set noref for now.
* any place which wants to hold dst has to call
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0186/1059] net: remove skb->vlan_present
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (184 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0185/1059] udp: do not use a cross-family sk_rx_dst in early demux Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0187/1059] net: gro: no longer use skb_vlan_tag_present() Greg Kroah-Hartman
` (812 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Yonghong Song,
Martin KaFai Lau, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 354259fa73e2aac92ae5e19522adb69a92c15b49 ]
skb->vlan_present seems redundant.
We can instead derive it from this boolean expression:
vlan_present = skb->vlan_proto != 0 || skb->vlan_tci != 0
Add a new union, to access both fields in a single load/store
when possible.
union {
u32 vlan_all;
struct {
__be16 vlan_proto;
__u16 vlan_tci;
};
};
This allows following patch to remove a conditional test in GRO stack.
Note:
We move remcsum_offload to keep TC_AT_INGRESS_MASK
and SKB_MONO_DELIVERY_TIME_MASK unchanged.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 511582022bfd ("net: gro: compare skb->protocol in gro_list_prepare()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/sparc/net/bpf_jit_comp_32.c | 10 ++++-----
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +-
include/linux/if_vlan.h | 9 +++-----
include/linux/skbuff.h | 18 ++++++++-------
lib/test_bpf.c | 1 -
net/core/filter.c | 22 +++++++++----------
6 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/arch/sparc/net/bpf_jit_comp_32.c b/arch/sparc/net/bpf_jit_comp_32.c
index b1dbf2fa8c0ae..a74e5004c6c89 100644
--- a/arch/sparc/net/bpf_jit_comp_32.c
+++ b/arch/sparc/net/bpf_jit_comp_32.c
@@ -555,11 +555,11 @@ void bpf_jit_compile(struct bpf_prog *fp)
emit_skb_load16(vlan_tci, r_A);
break;
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
- __emit_skb_load8(__pkt_vlan_present_offset, r_A);
- if (PKT_VLAN_PRESENT_BIT)
- emit_alu_K(SRL, PKT_VLAN_PRESENT_BIT);
- if (PKT_VLAN_PRESENT_BIT < 7)
- emit_andi(r_A, 1, r_A);
+ emit_skb_load32(vlan_all, r_A);
+ emit_cmpi(r_A, 0);
+ emit_branch_off(BE, 12);
+ emit_nop();
+ emit_loadimm(1, r_A);
break;
case BPF_LD | BPF_W | BPF_LEN:
emit_skb_load32(len, r_A);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 5daea2cc823ec..c7fdb0e1fb526 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2073,7 +2073,7 @@ u16 otx2_select_queue(struct net_device *netdev, struct sk_buff *skb,
#endif
#ifdef CONFIG_DCB
- if (!skb->vlan_present)
+ if (!skb_vlan_tag_present(skb))
goto pick_tx;
vlan_prio = skb->vlan_tci >> 13;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index e63081a9d7db8..38a74f67ff5c0 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -84,7 +84,7 @@ static inline bool is_vlan_dev(const struct net_device *dev)
return dev->priv_flags & IFF_802_1Q_VLAN;
}
-#define skb_vlan_tag_present(__skb) ((__skb)->vlan_present)
+#define skb_vlan_tag_present(__skb) (!!(__skb)->vlan_all)
#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci)
#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
#define skb_vlan_tag_get_cfi(__skb) (!!((__skb)->vlan_tci & VLAN_CFI_MASK))
@@ -482,7 +482,7 @@ static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
*/
static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
{
- skb->vlan_present = 0;
+ skb->vlan_all = 0;
}
/**
@@ -494,9 +494,7 @@ static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
*/
static inline void __vlan_hwaccel_copy_tag(struct sk_buff *dst, const struct sk_buff *src)
{
- dst->vlan_present = src->vlan_present;
- dst->vlan_proto = src->vlan_proto;
- dst->vlan_tci = src->vlan_tci;
+ dst->vlan_all = src->vlan_all;
}
/*
@@ -530,7 +528,6 @@ static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
{
skb->vlan_proto = vlan_proto;
skb->vlan_tci = vlan_tci;
- skb->vlan_present = 1;
}
/**
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c19077b1e18a0..636f7cc65cdff 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -825,7 +825,7 @@ typedef unsigned char *sk_buff_data_t;
* @mark: Generic packet mark
* @reserved_tailroom: (aka @mark) number of bytes of free space available
* at the tail of an sk_buff
- * @vlan_present: VLAN tag is present
+ * @vlan_all: vlan fields (proto & tci)
* @vlan_proto: vlan encapsulation protocol
* @vlan_tci: vlan tag control information
* @inner_protocol: Protocol (encapsulation)
@@ -955,7 +955,7 @@ struct sk_buff {
/* private: */
__u8 __pkt_vlan_present_offset[0];
/* public: */
- __u8 vlan_present:1; /* See PKT_VLAN_PRESENT_BIT */
+ __u8 remcsum_offload:1;
__u8 csum_complete_sw:1;
__u8 csum_level:2;
__u8 dst_pending_confirm:1;
@@ -970,7 +970,6 @@ struct sk_buff {
__u8 ipvs_property:1;
__u8 inner_protocol_type:1;
- __u8 remcsum_offload:1;
#ifdef CONFIG_NET_SWITCHDEV
__u8 offload_fwd_mark:1;
__u8 offload_l3_fwd_mark:1;
@@ -1003,8 +1002,13 @@ struct sk_buff {
__u32 priority;
int skb_iif;
__u32 hash;
- __be16 vlan_proto;
- __u16 vlan_tci;
+ union {
+ u32 vlan_all;
+ struct {
+ __be16 vlan_proto;
+ __u16 vlan_tci;
+ };
+ };
#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)
union {
unsigned int napi_id;
@@ -1064,15 +1068,13 @@ struct sk_buff {
#endif
#define PKT_TYPE_OFFSET offsetof(struct sk_buff, __pkt_type_offset)
-/* if you move pkt_vlan_present, tc_at_ingress, or mono_delivery_time
+/* if you move tc_at_ingress or mono_delivery_time
* around, you also must adapt these constants.
*/
#ifdef __BIG_ENDIAN_BITFIELD
-#define PKT_VLAN_PRESENT_BIT 7
#define TC_AT_INGRESS_MASK (1 << 0)
#define SKB_MONO_DELIVERY_TIME_MASK (1 << 2)
#else
-#define PKT_VLAN_PRESENT_BIT 0
#define TC_AT_INGRESS_MASK (1 << 7)
#define SKB_MONO_DELIVERY_TIME_MASK (1 << 5)
#endif
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 5820704165a64..ade9ac672adbb 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -14346,7 +14346,6 @@ static struct sk_buff *populate_skb(char *buf, int size)
skb->hash = SKB_HASH;
skb->queue_mapping = SKB_QUEUE_MAP;
skb->vlan_tci = SKB_VLAN_TCI;
- skb->vlan_present = SKB_VLAN_PRESENT;
skb->vlan_proto = htons(ETH_P_IP);
dev_net_set(&dev, &init_net);
skb->dev = &dev;
diff --git a/net/core/filter.c b/net/core/filter.c
index fe89172f39cb4..ff56fe1445d3a 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -337,11 +337,11 @@ static u32 convert_skb_access(int skb_field, int dst_reg, int src_reg,
offsetof(struct sk_buff, vlan_tci));
break;
case SKF_AD_VLAN_TAG_PRESENT:
- *insn++ = BPF_LDX_MEM(BPF_B, dst_reg, src_reg, PKT_VLAN_PRESENT_OFFSET);
- if (PKT_VLAN_PRESENT_BIT)
- *insn++ = BPF_ALU32_IMM(BPF_RSH, dst_reg, PKT_VLAN_PRESENT_BIT);
- if (PKT_VLAN_PRESENT_BIT < 7)
- *insn++ = BPF_ALU32_IMM(BPF_AND, dst_reg, 1);
+ BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_all) != 4);
+ *insn++ = BPF_LDX_MEM(BPF_W, dst_reg, src_reg,
+ offsetof(struct sk_buff, vlan_all));
+ *insn++ = BPF_JMP_IMM(BPF_JEQ, dst_reg, 0, 1);
+ *insn++ = BPF_ALU32_IMM(BPF_MOV, dst_reg, 1);
break;
}
@@ -9703,13 +9703,11 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
break;
case offsetof(struct __sk_buff, vlan_present):
- *target_size = 1;
- *insn++ = BPF_LDX_MEM(BPF_B, si->dst_reg, si->src_reg,
- PKT_VLAN_PRESENT_OFFSET);
- if (PKT_VLAN_PRESENT_BIT)
- *insn++ = BPF_ALU32_IMM(BPF_RSH, si->dst_reg, PKT_VLAN_PRESENT_BIT);
- if (PKT_VLAN_PRESENT_BIT < 7)
- *insn++ = BPF_ALU32_IMM(BPF_AND, si->dst_reg, 1);
+ *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
+ bpf_target_off(struct sk_buff,
+ vlan_all, 4, target_size));
+ *insn++ = BPF_JMP_IMM(BPF_JEQ, si->dst_reg, 0, 1);
+ *insn++ = BPF_ALU32_IMM(BPF_MOV, si->dst_reg, 1);
break;
case offsetof(struct __sk_buff, vlan_tci):
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0187/1059] net: gro: no longer use skb_vlan_tag_present()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (185 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0186/1059] net: remove skb->vlan_present Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0188/1059] net: gro: compare skb->protocol in gro_list_prepare() Greg Kroah-Hartman
` (811 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Martin KaFai Lau,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit be3ed48683f0d7ed808783fd7d919459b58b5b6b ]
We can remove a conditional test in gro_list_prepare()
by comparing vlan_all fields of the two skbs.
Notes:
While comparing the vlan_proto is not strictly needed,
because part of the following compare_ether_header() call,
using 32bit word is actually faster than using 16bit values.
napi_reuse_skb() makes sure to clear skb->vlan_all,
as it already calls __vlan_hwaccel_clear_tag()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 511582022bfd ("net: gro: compare skb->protocol in gro_list_prepare()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/gro.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/core/gro.c b/net/core/gro.c
index ae5bf8698b9e8..4c62828b45045 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -421,9 +421,7 @@ static void gro_list_prepare(const struct list_head *head,
}
diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
- diffs |= skb_vlan_tag_present(p) ^ skb_vlan_tag_present(skb);
- if (skb_vlan_tag_present(p))
- diffs |= skb_vlan_tag_get(p) ^ skb_vlan_tag_get(skb);
+ diffs |= p->vlan_all ^ skb->vlan_all;
diffs |= skb_metadata_differs(p, skb);
if (maclen == ETH_HLEN)
diffs |= compare_ether_header(skb_mac_header(p),
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0188/1059] net: gro: compare skb->protocol in gro_list_prepare()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (186 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0187/1059] net: gro: no longer use skb_vlan_tag_present() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0189/1059] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Greg Kroah-Hartman
` (810 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Willem de Bruijn,
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 511582022bfd07475d0daa209e6e6aa5a940740d ]
gro_list_prepare() checks whether a held packet may belong to the same
flow as the incoming one by comparing the device, VLAN tag, metadata
and the link-layer header, using dev->hard_header_len as its length.
On devices without a link-layer header (hard_header_len == 0), such as
L3 GRE tunnels, no compared byte carries the outer protocol:
skb->protocol comes from the tunnel header. Packets of different
protocols can then stay eligible, and the GRO handler selected from the
incoming skb->protocol parses the held packet with the wrong layout.
For example, take an IPv4/UDP packet held by UDP GRO and a
VLAN/IPv4/TCP packet received on the same ipgre device.
vlan_gro_receive() reads the first four bytes of the held IPv4 header
as a VLAN header. With crafted values, the held packet survives up to
tcp_gro_receive(), which uses its UDP header as a TCP header. With a
short linear part, the FIN/PSH update of the held packet's TCP flags
can then write into skb_shared_info.
The VLAN, GRE, IPv4 and IPv6 GRO handlers compare the next-protocol
field of their own header, so once the outer protocol matches, the
inner layers are checked too. Only the outermost protocol was not
compared.
Compare skb->protocol too. On Ethernet devices this is redundant with
compare_ether_header(), but it is cheap.
GUE direct IP encapsulation has a similar issue, but there both packets
have the same outer protocol, so it is fixed separately in
gue_gro_receive().
Fixes: 60769a5dcd87 ("ipv4: gre: add GRO capability")
Reported-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261109164540.3104392-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/gro.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/gro.c b/net/core/gro.c
index 4c62828b45045..c71cb2ff960e4 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -421,6 +421,7 @@ static void gro_list_prepare(const struct list_head *head,
}
diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
+ diffs |= p->protocol != skb->protocol;
diffs |= p->vlan_all ^ skb->vlan_all;
diffs |= skb_metadata_differs(p, skb);
if (maclen == ETH_HLEN)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0189/1059] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (187 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0188/1059] net: gro: compare skb->protocol in gro_list_prepare() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0190/1059] udp: check frag_list IP family before using skb_segment_list() Greg Kroah-Hartman
` (809 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anandu Padinhare, Lorenzo Bianconi,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
[ Upstream commit 070411c1590c8172eb4d86f045d99c372f22fe23 ]
In the AF_XDP zero-copy RX path, frames that the XDP program passes to
the stack are handed over by stmmac_dispatch_skb_zc(). That function
increments rx_pkt_n instead of rx_packets since
commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary").
stmmac_rx_zc() already adds every processed frame to rx_pkt_n, so each
XDP_PASS frame is counted twice there, and rx_packets, which
ndo_get_stats64() reports, never counts them: on a zero-copy queue
rx_bytes grows with the passed frames while rx_packets stays still.
Count the frame in rx_packets, as the regular RX path and the code
before that commit did.
Found while testing AF_XDP zero-copy on an ADSP-SC598 (adi-dwmac,
100 Mbit/s link): rx_pkt_n grew almost twice as fast as the frames the
MAC delivered, while "ip -s link" counted almost none.
Tested on that board with a 6.18-based kernel, whose zero-copy RX
accounting matches net. An AF_XDP zero-copy socket on queue 0 received
frames of one EtherType while UDP traffic was passed to the stack. In a
run with 60 s of traffic before the change, rx_pkt_n was 1.88 times the
frames that reached the driver (MAC frames minus RX FIFO overflows) and
"ip -s link" counted 55 RX packets. In the same test with the change,
rx_pkt_n equals the frames that reached the driver and rx_packets equals
the frames passed to the stack.
Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary")
Signed-off-by: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/PNYPR01MB11444552E41C2B17A992492C0FD762@PNYPR01MB11444.INDPRD01.PROD.OUTLOOK.COM
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a4eb6089dfbb1..8145518cb83a0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5023,7 +5023,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
napi_gro_receive(&ch->rxtx_napi, skb);
u64_stats_update_begin(&rxq_stats->napi_syncp);
- u64_stats_inc(&rxq_stats->napi.rx_pkt_n);
+ u64_stats_inc(&rxq_stats->napi.rx_packets);
u64_stats_add(&rxq_stats->napi.rx_bytes, len);
u64_stats_update_end(&rxq_stats->napi_syncp);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0190/1059] udp: check frag_list IP family before using skb_segment_list()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (188 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0189/1059] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0191/1059] drm/bridge: sii902x: validate I2S data lane values Greg Kroah-Hartman
` (808 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Willem de Bruijn, Dave Miller, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 22b7cb932c6a0f7566d41072be6956cb6c8af4e1 ]
UDP fraglist GRO uses SKB_GSO_UDP_L4 for both IPv4 and IPv6.
__udp_gso_segment() reuses the frag_list skbs when the geometry of
the head skb was not modified. skb_segment_list() keeps the network
header of each frag_list skb as it was at GRO time and only adjusts
the transport header offset.
Nothing guarantees that the head skb still has the IP family of the
frag_list skbs: helpers like skb_mpls_pop() let the caller choose
the new protocol. In that case __udpv6_gso_segment_list_csum()
handles the 20 byte IPv4 header of each frag_list skb as a struct
ipv6hdr, and can write IPv6 addresses beyond its linear part.
Check the IP version of the first frag_list skb. All skbs in the
list belong to the same flow, so they share the same IP family.
Use the skb_segment() fallback on a mismatch. Regular fraglist GRO
traffic keeps the fast path.
Fixes: b936a9b8d4a5 ("net: ipv6: fix UDPv6 GSO segmentation with NAT")
Fixes: c3df39ac9b0e ("udp: ipv4: manipulate network header of NATed UDP GRO fraglist")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[edumazet: simplified the fix, rewrote the comment and the changelog]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/udp_offload.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 1a920ade779f4..cf4f686d2fc3e 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -352,9 +352,14 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
}
if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) {
- /* Detect modified geometry and pass those to skb_segment. */
+ /* Detect modified geometry and pass those to skb_segment.
+ * SKB_GSO_UDP_L4 is used by both IPv4 and IPv6: also make sure
+ * the frag_list skbs still have the IP family we segment for,
+ * as their network headers are not rebuilt.
+ */
if ((skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) &&
- !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY))
+ !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY) &&
+ ip_hdr(skb_shinfo(gso_skb)->frag_list)->version == (is_ipv6 ? 6 : 4))
return __udp_gso_segment_list(gso_skb, features, is_ipv6);
ret = __skb_linearize(gso_skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0191/1059] drm/bridge: sii902x: validate I2S data lane values
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (189 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0190/1059] udp: check frag_list IP family before using skb_segment_list() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0192/1059] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync() Greg Kroah-Hartman
` (807 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Luca Ceresoli,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 444b7116e7ef1fdb5f7db3bc1f74b20098d062d4 ]
The sil,i2s-data-lanes property reader bounds the number of entries, but
does not bound each entry's value. Those values index the four-entry
i2s_lane_id table when the audio FIFO sequence is built.
Reject unsupported lane values before indexing that table. Report the
property name and invalid value with dev_err_probe() so the diagnostic
identifies the faulty configuration.
The issue was found by our static-analysis tool.
Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20260920034833.18874-1-hppiscas@163.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/sii902x.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 6359d6f53a1b6..f5a346db1a69d 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -819,9 +819,15 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x,
}
codec_data.max_i2s_channels = 2 * num_lanes;
- for (i = 0; i < num_lanes; i++)
+ for (i = 0; i < num_lanes; i++) {
+ if (lanes[i] >= ARRAY_SIZE(i2s_lane_id))
+ return dev_err_probe(dev, -EINVAL,
+ "invalid sil,i2s-data-lanes value %u\n",
+ lanes[i]);
+
sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] |
i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE;
+ }
sii902x->audio.mclk = devm_clk_get_optional(dev, "mclk");
if (IS_ERR(sii902x->audio.mclk)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0192/1059] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (190 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0191/1059] drm/bridge: sii902x: validate I2S data lane values Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0193/1059] ASoC: max98090: keep the MIC boost across mic input power-up Greg Kroah-Hartman
` (806 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kavitha Daula, Juergen Gross,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kavitha Daula <kavi@edera.dev>
[ Upstream commit 704f812cdab8bbf30987653c1c76c0d2c1e135e7 ]
Both callers of gnttab_unmap_refs_sync(), free_persistent_gnts() and
xen_blkbk_unmap_purged_grants() in blkback, keep their struct
gntab_unmap_queue_data on the stack. gnttab_unmap_refs_async() sets up
the delayed work inside it with INIT_DELAYED_WORK(), so with
CONFIG_DEBUG_OBJECTS_WORK and CONFIG_DEBUG_OBJECTS_TIMERS every
persistent grant teardown warns twice, once for the work and once for
its timer:
[ 104.366085] ODEBUG: object ffffc9004020fad8 is on stack ffffc9004020c000, but NOT annotated.
[ 104.371551] WARNING: CPU: 1 PID: 48 at lib/debugobjects.c:672 lookup_object_or_alloc.part.0+0x12b/0x1f0
Call Trace:
<TASK>
__debug_object_init+0xfe/0x1a0
debug_object_init+0x38/0x50
__init_work+0x28/0x30
gnttab_unmap_refs_async+0x18/0xa0
gnttab_unmap_refs_sync+0x61/0x90
free_persistent_gnts+0x179/0x280
xen_blkbk_free_caches+0x16/0x30
xen_blkif_disconnect+0xfa/0x2d0
frontend_changed+0x90/0x680
xenbus_otherend_changed+0x80/0xb0
frontend_changed+0x14/0x20
xenwatch_thread+0x96/0x1a0
kthread+0x11d/0x250
ret_from_fork+0x29f/0x2d0
ret_from_fork_asm+0x1a/0x30
</TASK>
gnttab_unmap_refs_sync() waits for the unmap to complete before it
returns, so the work never outlives the caller's frame. Initialise it
with INIT_DELAYED_WORK_ONSTACK() when the item is on the stack and
destroy it before returning. The function is exported, so an item that
is not on the stack keeps INIT_DELAYED_WORK().
Fixes: b44166cd46e2 ("xen/grant: introduce func gnttab_unmap_refs_sync()")
Signed-off-by: Kavitha Daula <kavi@edera.dev>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261105000137.82224-1-kavithadaula@Kavithas-MacBook-Pro.local>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/xen/grant-table.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index f13c3b76ad1eb..60f13c012ff29 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -38,6 +38,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/slab.h>
+#include <linux/sched/task_stack.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
#include <linux/io.h>
@@ -1362,12 +1363,21 @@ static void unmap_refs_callback(int result,
int gnttab_unmap_refs_sync(struct gntab_unmap_queue_data *item)
{
struct unmap_refs_callback_data data;
+ bool on_stack = object_is_on_stack(item);
init_completion(&data.completion);
item->data = &data;
item->done = &unmap_refs_callback;
- gnttab_unmap_refs_async(item);
+ /* blkback keeps @item, and so its retry work, on the stack. */
+ if (on_stack)
+ INIT_DELAYED_WORK_ONSTACK(&item->gnttab_work, gnttab_unmap_work);
+ else
+ INIT_DELAYED_WORK(&item->gnttab_work, gnttab_unmap_work);
+ item->age = 0;
+ __gnttab_unmap_refs_async(item);
wait_for_completion(&data.completion);
+ if (on_stack)
+ destroy_delayed_work_on_stack(&item->gnttab_work);
return data.result;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0193/1059] ASoC: max98090: keep the MIC boost across mic input power-up
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (191 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0192/1059] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0194/1059] amt: tear down every amt device on an unregistering lower Greg Kroah-Hartman
` (805 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, LiangCheng Wang, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: LiangCheng Wang <zaq14760@gmail.com>
[ Upstream commit 58d51fa6ff1d21e79c3c340bfb3155dfa3025ca3 ]
PA1EN/PA2EN select both the MIC1/MIC2 preamp enable and its gain
(0 = off, 1 = 0 dB, 2 = +20 dB, 3 = +30 dB). "MICn Boost Volume" keeps
the selected gain in max98090->pa1en/pa2en while the input is off, and
max98090_micinput_event() writes it to the field when the "MICn Input"
widget powers up.
The event handler also reads the field back to keep the stored gain in
sync ("Update for volatile"), but it does so on POST_PMU and POST_PMD.
The widget drives PA1EN/PA2EN as a single enable bit, the low bit of
the field, so at both points DAPM has just rewritten it:
- POST_PMU: DAPM has set the field to 1, so the read-back stores
0 dB and the handler then restores 0 dB.
- POST_PMD: DAPM has cleared the low bit, so a +30 dB (3) gain reads
back as +20 dB (2).
As a result every capture starts at 0 dB: a boost set while the input is
powered down, e.g. restored by alsactl or an audio HAL at boot, never
takes effect, and one changed during capture is lost at the next
power-up.
Read the field back on PRE_PMD instead, while it still holds the active
gain, and only restore the stored gain on POST_PMU.
Tested on i.MX95 with a MAX98090 headset mic on MIC1, running NXP's
6.18.38 vendor kernel (max98090_micinput_event() is the same as in
mainline): with MIC1 Boost Volume set to 2 (+30 dB) before capture,
register 0x10 reads 0x20 (0 dB) during capture without this change and
0x60 (+30 dB) with it, and a boost changed during capture is kept for
the next capture.
Fixes: 685e42154dcf ("ASoC: Replace max98090 Device Driver")
Signed-off-by: LiangCheng Wang <zaq14760@gmail.com>
Link: https://patch.msgid.link/20261111-max98090-mic-boost-v1-1-20b9bd8816db@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/max98090.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index e64e2352c6aa4..ab443225c1fcf 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -744,14 +744,6 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
else
val = (val & M98090_MIC_PA2EN_MASK) >> M98090_MIC_PA2EN_SHIFT;
- if (val >= 1) {
- if (w->reg == M98090_REG_MIC1_INPUT_LEVEL) {
- max98090->pa1en = val - 1; /* Update for volatile */
- } else {
- max98090->pa2en = val - 1; /* Update for volatile */
- }
- }
-
switch (event) {
case SND_SOC_DAPM_POST_PMU:
/* If turning on, set to most recently selected volume */
@@ -760,6 +752,14 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
else
val = max98090->pa2en + 1;
break;
+ case SND_SOC_DAPM_PRE_PMD:
+ if (val >= 1) {
+ if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)
+ max98090->pa1en = val - 1;
+ else
+ max98090->pa2en = val - 1;
+ }
+ return 0;
case SND_SOC_DAPM_POST_PMD:
/* If turning off, turn off */
val = 0;
@@ -1109,11 +1109,13 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
+ SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_PGA_E("MIC2 Input", M98090_REG_MIC2_INPUT_LEVEL,
M98090_MIC_PA2EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
+ SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_MIXER("LINEA Mixer", SND_SOC_NOPM, 0, 0,
&max98090_linea_mixer_controls[0],
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0194/1059] amt: tear down every amt device on an unregistering lower
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (192 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0193/1059] ASoC: max98090: keep the MIC boost across mic input power-up Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0195/1059] net: ena: Keep the RX buffer mapped if skb allocation fails Greg Kroah-Hartman
` (804 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Omar Ramadan, Simon Horman,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Ramadan <omar@blockcast.net>
[ Upstream commit 7262e999ebec0a10ecc97ba4739f12255b7c6da8 ]
amt_device_event() acts only on the amt device that
amt_lookup_upper_dev() returns, which is the first amt device bound to
the event's lower. Several amt devices can share one lower, for
example two gateways.
On NETDEV_UNREGISTER, only the first device is unlinked and
unregistered. The others stay upper-linked to the lower, and
unregister_netdevice_many_notify() warns, because the notifier chain
must detach every upper device. They also still hold a reference on
the lower, so each is torn down only when netdev_wait_allrefs_any(),
called from netdev_run_todo(), rebroadcasts NETDEV_UNREGISTER. By then
the lower's sysfs directory is gone, so unlinking it trips a kernfs
WARN, and unregistering it from inside the rebroadcast trips the WARN
in __rtnl_unlock(). On NETDEV_CHANGEMTU, only the first device is
resized.
Walk every amt device in the lower's netns and act on each one bound
to the lower. On NETDEV_UNREGISTER, queue them all and unregister them
in one batch. amt_dellink() unlinks each device but leaves it on the
netns device list until unregister_netdevice_many(), so the walk stays
valid under RTNL.
To reproduce:
ip link add lower0 type dummy
ip link add amtg1 type amt mode gateway local 192.0.2.1 \
discovery 192.0.2.2 dev lower0
ip link add amtg2 type amt mode gateway local 192.0.2.1 \
discovery 192.0.2.2 dev lower0
ip link del lower0
Without this patch, the last command logs:
WARNING: net/core/dev.c:12773 at unregister_netdevice_many_notify+0x13e5/0x1940, CPU#3: ip/216
kernfs: can not remove 'upper_amtg2', no directory
WARNING: fs/kernfs/dir.c:1784 at kernfs_remove_by_name_ns+0xc9/0xd0, CPU#0: ip/216
WARNING: net/core/rtnetlink.c:141 at __rtnl_unlock+0xb2/0xf0, CPU#0: ip/216
WARNING: net/core/rtnetlink.c:141 at __rtnl_unlock+0xb2/0xf0, CPU#0: ip/216
With it, the commands log nothing and remove both amt devices, and
tools/testing/selftests/net/amt.sh passes on a KASAN and lockdep
kernel.
Found by a selftest for our upcoming AMT offload RFC, which deletes a
lower carrying two amt gateways, on our 6.18-based driver. The
commands above reproduce it on net.
Fixes: b9022b53adad ("amt: add control plane of amt interface")
Signed-off-by: Omar Ramadan <omar@blockcast.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261105232302.494171-1-omar@blockcast.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/amt.c | 56 ++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index ad855130b4300..d318dd9bf7671 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -3377,22 +3377,6 @@ static struct rtnl_link_ops amt_link_ops __read_mostly = {
.fill_info = amt_fill_info,
};
-static struct net_device *amt_lookup_upper_dev(struct net_device *dev)
-{
- struct net_device *upper_dev;
- struct amt_dev *amt;
-
- for_each_netdev(dev_net(dev), upper_dev) {
- if (netif_is_amt(upper_dev)) {
- amt = netdev_priv(upper_dev);
- if (amt->stream_dev == dev)
- return upper_dev;
- }
- }
-
- return NULL;
-}
-
static int amt_device_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
@@ -3402,26 +3386,34 @@ static int amt_device_event(struct notifier_block *unused,
LIST_HEAD(list);
int new_mtu;
- upper_dev = amt_lookup_upper_dev(dev);
- if (!upper_dev)
- return NOTIFY_DONE;
- amt = netdev_priv(upper_dev);
+ /* amt_dellink() leaves each device on the netns device list until
+ * unregister_netdevice_many(), so the walk stays valid.
+ */
+ for_each_netdev(dev_net(dev), upper_dev) {
+ if (!netif_is_amt(upper_dev))
+ continue;
+ amt = netdev_priv(upper_dev);
+ if (amt->stream_dev != dev)
+ continue;
- switch (event) {
- case NETDEV_UNREGISTER:
- amt_dellink(amt->dev, &list);
- unregister_netdevice_many(&list);
- break;
- case NETDEV_CHANGEMTU:
- if (amt->mode == AMT_MODE_RELAY)
- new_mtu = dev->mtu - AMT_RELAY_HLEN;
- else
- new_mtu = dev->mtu - AMT_GW_HLEN;
+ switch (event) {
+ case NETDEV_UNREGISTER:
+ amt_dellink(amt->dev, &list);
+ break;
+ case NETDEV_CHANGEMTU:
+ if (amt->mode == AMT_MODE_RELAY)
+ new_mtu = dev->mtu - AMT_RELAY_HLEN;
+ else
+ new_mtu = dev->mtu - AMT_GW_HLEN;
- dev_set_mtu(amt->dev, new_mtu);
- break;
+ dev_set_mtu(amt->dev, new_mtu);
+ break;
+ }
}
+ if (event == NETDEV_UNREGISTER)
+ unregister_netdevice_many(&list);
+
return NOTIFY_DONE;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0195/1059] net: ena: Keep the RX buffer mapped if skb allocation fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (193 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0194/1059] amt: tear down every amt device on an unregistering lower Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0196/1059] net: ena: avoid RX copybreak for multi-descriptor packets Greg Kroah-Hartman
` (803 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Breno Leitao, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <leitao@debian.org>
[ Upstream commit 3e8e22a1007a6337ba2400b3ea87077947005c20 ]
We are seeing the following issue in production on arm64 EC2 hosts
(m8g.metal-24xl, 64K pages, SMMUv3 in strict mode, 6.18 based kernel).
Right after a global OOM, the SMMU reports F_TRANSLATION write faults
from the ENA device, followed by a burst of:
WARNING: CPU: 48 PID: 1656834 at drivers/iommu/dma-iommu.c:1242 iommu_dma_unmap_phys+0xf4/0x108
Call trace:
iommu_dma_unmap_phys+0xf4/0x108 (P)
dma_unmap_phys+0x194/0x2a8
dma_unmap_page_attrs+0x1c/0x38
ena_io_poll+0x7bc/0x1790 [ena]
__napi_poll+0x54/0x220
net_rx_action+0x250/0x520
ena_rx_skb() unmaps the RX buffer, or takes an extra page reference to
reuse it, before napi_build_skb() allocates the skb. If the allocation
fails, it returns NULL with rx_info->page still set. ena_clean_rx_irq()
then puts the req_id back on the free list, and ena_alloc_rx_buffer()
treats the buffer as still mapped and posts its old DMA address to the
device again.
With the IOMMU in strict mode, the device then writes to an unmapped
IOVA, and the next completion of that buffer unmaps it a second time.
If the IOVA was handed to a new mapping in between, the device can
write into that buffer instead. On the reuse path, the extra page
reference is never dropped.
Allocate the skb before touching rx_info, so that a failed allocation
leaves the buffer mapped and unchanged for the refill.
Fixes: 9e5269a915a8 ("net: ena: use build_skb() in RX path")
Fixes: f7d625adeb7b ("net: ena: Add dynamic recycling mechanism for rx buffers")
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20261109-ena-rx-skb-alloc-fail-v1-1-aee2927cb51f@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index b46bf8bf06605..87219ce075028 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1525,6 +1525,10 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
buf_len = SKB_DATA_ALIGN(len + buf_offset + tailroom);
+ skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
+ if (unlikely(!skb))
+ return NULL;
+
/* If XDP isn't loaded try to reuse part of the RX buffer */
reuse_rx_buf_page = !is_xdp_loaded &&
ena_try_rx_buf_page_reuse(rx_info, buf_len, len, pkt_offset);
@@ -1532,10 +1536,6 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
if (!reuse_rx_buf_page)
ena_unmap_rx_buff_attrs(rx_ring, rx_info, DMA_ATTR_SKIP_CPU_SYNC);
- skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
- if (unlikely(!skb))
- return NULL;
-
/* Populate skb's linear part */
skb_reserve(skb, buf_offset);
skb_put(skb, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0196/1059] net: ena: avoid RX copybreak for multi-descriptor packets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (194 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0195/1059] net: ena: Keep the RX buffer mapped if skb allocation fails Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0197/1059] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK Greg Kroah-Hartman
` (802 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit f3c790c34d228d46c4a05fe5d001d1bbea444e2b ]
ena_rx_skb() selects the copybreak path based on the first RX
descriptor's length without checking the number of descriptors. When
a packet spans multiple descriptors, this copies only the first
buffer into the skb and fails to recycle the remaining request IDs,
while RX cleanup advances by the full descriptor count.
Restrict copybreak to single-descriptor packets and apply the same
restriction to the rx_copybreak_pkt statistic. Multi-descriptor
packets then use the existing fragment-processing path.
Discovered by comparing the in-tree ENA driver with Amazon's
standalone ENA driver.
Compiled with W=1 under x86_64 defconfig.
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261109141343.920187-2-thnkslprpt@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 87219ce075028..f7c440276463b 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1502,7 +1502,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
page_offset = rx_info->page_offset;
buf_addr = page_address(rx_info->page) + page_offset;
- if (len <= rx_ring->rx_copybreak) {
+ if (len <= rx_ring->rx_copybreak && likely(descs == 1)) {
skb = ena_alloc_skb(rx_ring, NULL, len);
if (unlikely(!skb))
return NULL;
@@ -1808,7 +1808,8 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
skb_record_rx_queue(skb, rx_ring->qid);
- if (rx_ring->ena_bufs[0].len <= rx_ring->rx_copybreak)
+ if (rx_ring->ena_bufs[0].len <= rx_ring->rx_copybreak &&
+ ena_rx_ctx.descs == 1)
rx_copybreak_pkt++;
total_len += skb->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0197/1059] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (195 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0196/1059] net: ena: avoid RX copybreak for multi-descriptor packets Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0198/1059] tls: fix async encryption race on weakly ordered architectures Greg Kroah-Hartman
` (801 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+9ea34da5ca6100593c90,
Kalpesh Solanki, Willem de Bruijn, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalpesh Solanki <skalpesh942@gmail.com>
[ Upstream commit 968f2b94a5964b75d9c0da84523e42530c1891f0 ]
A userspace application can set the link type of a TUN/TAP interface
to ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, or ARPHRD_6LOWPAN
via ioctl(fd, TUNSETLINK, arg) because tun_get_addr_len() explicitly
recognized these types.
However, TUN devices cannot function as genuine IEEE 802.15.4 or 6LoWPAN
interfaces:
1. They lack wpan_phy, channels, PAN IDs, and MLME operations, and tun
never initializes dev->ieee802154_ptr or dev->ml_priv. When an
unprivileged user creates a TUN interface in a user+net namespace,
changes its link type to ARPHRD_IEEE802154, and issues a netlink dump
request (such as IEEE802154_LLSEC_LIST_KEY),
ieee802154_llsec_dump_table() unconditionally dereferences
dev->ieee802154_ptr / ieee802154_mlme_ops(dev), triggering a supervisor
null-pointer dereference / general protection fault. Similar
dereferences occur across net/ieee802154/nl-phy.c (ieee802154_del_iface)
and net/ieee802154/socket.c.
2. Similarly, the 6LoWPAN subsystem assumes via lowpan_dev(dev) that
netdev_priv(dev) is struct lowpan_dev. On a TUN device, netdev_priv(dev)
is struct tun_struct. On netdev events (such as NETDEV_DOWN in
net/6lowpan/core.c:lowpan_device_event), it clears bits in
lowpan_dev(dev)->ctx.table flags, which corrupts private memory inside
tun_struct.
Rather than scattering checks across subsystems, fix the issue at the
source: disallow setting ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, and
ARPHRD_6LOWPAN via TUNSETLINK by returning -EINVAL. Cast arg to unsigned
short in the comparison to prevent upper-bit truncation bypasses (e.g.
arg = ARPHRD_IEEE802154 | 0x10000).
Fixes: ff4cc3ac93e1 ("[TUNTAP]: Allow setting the linktype of the tap device from userspace")
Reported-by: syzbot+9ea34da5ca6100593c90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9ea34da5ca6100593c90
Signed-off-by: Kalpesh Solanki <skalpesh942@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261109083037.22337-1-skalpesh942@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 22f35e92f5424..df786382da6b1 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3244,6 +3244,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
netif_info(tun, drv, tun->dev,
"Linktype set failed because interface is up\n");
ret = -EBUSY;
+ } else if ((unsigned short)arg == ARPHRD_IEEE802154 ||
+ (unsigned short)arg == ARPHRD_IEEE802154_MONITOR ||
+ (unsigned short)arg == ARPHRD_6LOWPAN) {
+ ret = -EINVAL;
} else {
ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
tun->dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0198/1059] tls: fix async encryption race on weakly ordered architectures
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (196 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0197/1059] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0199/1059] igmp: use the joined device when leaving a multicast group Greg Kroah-Hartman
` (800 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ofri Zangi, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ofri Zangi <ofriz@xsightlabs.com>
[ Upstream commit a2fd526d644233d6a892c28173f07c61e21e4c93 ]
With async encryption, a record can be transmitted without its TLS
header on weakly ordered architectures such as arm64, because the
consumer may observe rec->tx_ready set while still seeing the old
scatterlist entry.
tls_encrypt_done() restores the TLS header in the scatterlist entry
(sge->offset -= prot->prepend_size, sge->length += prot->prepend_size)
and then publishes the record with smp_store_mb(rec->tx_ready, true).
On another CPU, tls_tx_records() checks rec->tx_ready with READ_ONCE()
and then reads the entry in tls_push_sg().
Nothing orders these accesses. The barrier in smp_store_mb() comes
after the tx_ready store, so it does not order the earlier scatterlist
update before it. On the reader side, READ_ONCE() does not order the
later loads of sge->offset and sge->length. The reader can therefore
see tx_ready set together with the old offset and length, and pushes
the record without its header.
Publish tx_ready with smp_store_release() in tls_encrypt_done() and read
it with smp_load_acquire() in tls_tx_records(), so that observing
tx_ready guarantees the restored scatterlist entry is visible. Keep the
full barrier that smp_store_mb() provided as an explicit smp_mb(), as
it is still needed to order the tx_ready store before the tx_list head
check.
The issue was discovered during development on an arm64 system.
A curl download test over kTLS failed with:
curl: (56) OpenSSL SSL_read: error:0A00010B:SSL routines::wrong version number, errno 0
Fixes: a42055e8d2c3 ("net/tls: Add support for async encryption of records for performance")
Signed-off-by: Ofri Zangi <ofriz@xsightlabs.com>
Link: https://patch.msgid.link/20261108-tls-async-tx-ordering-v1-1-f9a1844ca88e@xsightlabs.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tls/tls_sw.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 2aeeeca57da65..6354cb42cbe13 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -435,7 +435,8 @@ int tls_tx_records(struct sock *sk, int flags)
/* Tx all ready records */
list_for_each_entry_safe(rec, tmp, &ctx->tx_list, list) {
- if (READ_ONCE(rec->tx_ready)) {
+ /* Pairs with smp_store_release() in tls_encrypt_done() */
+ if (smp_load_acquire(&rec->tx_ready)) {
if (flags == -1)
tx_flags = rec->tx_flags;
else
@@ -505,8 +506,14 @@ static void tls_encrypt_done(crypto_completion_data_t *data, int err)
if (rec) {
struct tls_rec *first_rec;
- /* Mark the record as ready for transmission */
- smp_store_mb(rec->tx_ready, true);
+ /* Mark the record as ready for transmission. Pairs with
+ * smp_load_acquire() in tls_tx_records(): the sge
+ * offset/length update above must be visible before tx_ready.
+ */
+ smp_store_release(&rec->tx_ready, true);
+
+ /* Order the tx_ready store before the tx_list head check */
+ smp_mb();
/* If received record is at head of tx_list, schedule tx */
first_rec = list_first_entry(&ctx->tx_list,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0199/1059] igmp: use the joined device when leaving a multicast group
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (197 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0198/1059] tls: fix async encryption race on weakly ordered architectures Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0200/1059] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Greg Kroah-Hartman
` (799 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Junyoung Jang, Hangbin Liu,
Ido Schimmel, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junyoung Jang <graypanda.inzag@gmail.com>
[ Upstream commit 19ec8416a76c08326fe5f814410a1b43046e63be ]
When a socket joins a multicast group, the ifindex of the device is
stored in the socket's membership entry. When leaving,
ip_mc_leave_group() resolves the device again from the request. If the
request only specifies an interface address and that address is not
assigned to any device, no device is found. The membership is still
matched by address and removed from the socket, but the group is not
released on the device it was joined on.
The group is then leaked on the device until the device is unregistered.
An unprivileged user can trigger this by joining with an ifindex and a
non-local address and leaving with the address only. It can also happen
when a socket joins and leaves with the address only and the address is
removed in between.
Fix by resolving the device from the ifindex stored in the membership,
like ip_mc_drop_socket() does.
Fixes: 4eba7bb1d72d ("ipv4: igmp: Allow removing groups from a removed interface")
Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261109125312.2208874-1-graypanda.inzag@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/igmp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index f2c4dc7e24ea6..59b4907ff70f4 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2301,6 +2301,8 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
iml->multi.imr_address.s_addr)
continue;
+ /* The drop request may not resolve to the joined device. */
+ in_dev = inetdev_by_index(net, iml->multi.imr_ifindex);
(void) ip_mc_leave_src(sk, iml, in_dev);
*imlp = iml->next_rcu;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0200/1059] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (198 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0199/1059] igmp: use the joined device when leaving a multicast group Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0201/1059] amt: use ipv6_hdr() in amt_mldv1_leave_handler() Greg Kroah-Hartman
` (798 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit a9782a6f2bbd0c444689725a710d8b21eab61bc5 ]
When connection migration happens in tcp_v[46]_rcv(), a new
listener is passed to tcp_check_req().
When either of the following is true,
* the new listener queue is full and
net.ipv4.tcp_abort_on_overflow is set
* the packet has RST or (not stripped) SYN
tcp_check_req() sends RST and calls inet_csk_reqsk_queue_drop().
Here, the new listener is passed, and its qlen is decremented
wrongly while reqsk is tied to the old listener.
Once qlen underflows, inet_csk_reqsk_queue_is_full() always
return true, and the new listener stops serving.
Without the patch, this script times out while waiting for SYN+ACK
since the new listener drops SYN, but with the patch, 3WHS completes.
0 `sysctl -q net.ipv4.tcp_migrate_req=1`
+0 `sysctl -q net.ipv4.tcp_syncookies=0`
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
+0 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(4, ..., ...) = 0
+0 listen(4, 128) = 0
+0 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 listen(3, 128) = 0
+0 close(4) = 0
+.01 < R 1:1(0) win 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0 listen(5, 1) = 0
+.01 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 < . 1:1(0) ack 1 win 32792
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 accept(3, ..., ...) = 6
Let's pass req->rsk_listener instead.
Fixes: d4f2c86b2b7e ("tcp: Migrate TCP_NEW_SYN_RECV requests at receiving the final ACK.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261111020304.1532064-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_minisocks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 0b1fa4cccaae2..0b0e40c3b9f9e 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -831,7 +831,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
tcp_reset(sk, skb);
}
if (!fastopen) {
- bool unlinked = inet_csk_reqsk_queue_drop(sk, req);
+ bool unlinked = inet_csk_reqsk_queue_drop(req->rsk_listener, req);
if (unlinked)
__NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0201/1059] amt: use ipv6_hdr() in amt_mldv1_leave_handler()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (199 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0200/1059] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0202/1059] net: usb: cdc_ncm: dont underflow the NDP room check Greg Kroah-Hartman
` (797 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wenbo Sun, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
[ Upstream commit 6730fe495c35f174a424ab58cf5fdf99ce4746e9 ]
In amt_mldv1_leave_handler(), which handles IPv6 MLDv1 Done
(ICMPV6_MGM_REDUCTION) messages, the source address is mistakenly
extracted via ip_hdr(skb)->saddr into host.ip4 instead of copying the
IPv6 source address from ipv6_hdr(skb)->saddr into host.ip6 as
amt_mldv1_report_handler() does.
Because amt_lookup_group() compares the full union amt_addr for v6
groups, looking up the group with a 32-bit IPv4 header slice fails to
match the group entry created by amt_mldv1_report_handler(). As a
result, amt_del_group() is not called when an MLDv1 listener leaves,
and the AMT relay continues forwarding multicast traffic until the
group timer expires.
Use ipv6_hdr(skb) and copy ip6h->saddr into host.ip6 so that MLDv1
Done messages properly match and delete the corresponding IPv6 group.
This issue was found via LLM-assisted code review, confirmed by
reproducing the stale group forwarding in a User-Mode Linux (ARCH=um)
environment, and verified in UML by testing that AMT relay multicast
forwarding stops immediately after receiving an MLDv1 Done message.
Fixes: b75f7095d4d4 ("amt: add mld report message handler")
Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111031147.105834-1-sunwenbo@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/amt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index d318dd9bf7671..6d115a20a1a0c 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -2129,13 +2129,12 @@ static void amt_mldv1_leave_handler(struct amt_dev *amt, struct sk_buff *skb,
struct amt_tunnel_list *tunnel)
{
struct mld_msg *mld = (struct mld_msg *)icmp6_hdr(skb);
- struct iphdr *iph = ip_hdr(skb);
+ struct ipv6hdr *ip6h = ipv6_hdr(skb);
struct amt_group_node *gnode;
union amt_addr group, host;
memcpy(&group.ip6, &mld->mld_mca, sizeof(struct in6_addr));
- memset(&host, 0, sizeof(union amt_addr));
- host.ip4 = iph->saddr;
+ memcpy(&host.ip6, &ip6h->saddr, sizeof(struct in6_addr));
gnode = amt_lookup_group(tunnel, &group, &host, true);
if (gnode) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0202/1059] net: usb: cdc_ncm: dont underflow the NDP room check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (200 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0201/1059] amt: use ipv6_hdr() in amt_mldv1_leave_handler() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0203/1059] tracing: skip boot kprobe setup when no events were requested Greg Kroah-Hartman
` (796 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+1994e2ecf323ed90f255,
Jiahao Xu, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiahao Xu <xujiahao@cmss.chinamobile.com>
[ Upstream commit b507828c7b6135ff7a4b69eba6e33502b4839fb9 ]
cdc_ncm_ndp16() and cdc_ncm_ndp32() verify that the new NDP and the
datagram fit into the NTB with an unsigned subtraction:
if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
return NULL;
Nothing guarantees that skb->len plus the reserve stays below
tx_curr_size, and when it does not the subtraction wraps around to a
huge value, the check passes, and the skb_put_zero() of max_ndp_size
bytes that follows overruns the NTB:
skbuff: skb_over_panic: text:ffff80000db33558 len:428 put:172
head:ffff0000c2c66100 tail:0x1ac end:0x140
kernel BUG at net/core/skbuff.c:200
skb_put_zero include/linux/skbuff.h:2595 [inline]
cdc_ncm_ndp16 drivers/net/usb/cdc_ncm.c:1132 [inline]
cdc_ncm_fill_tx_frame+0xdf0/0x30e0 drivers/net/usb/cdc_ncm.c:1309
Here tx_curr_size is 0x140 = 320, skb->len is already 256 and the
skb_put_zero() wants another 172 bytes.
Two device controlled settings make this reachable:
- dwNtbOutMaxSize = 320 caps tx_max at 320. The lower bound computed
in cdc_ncm_check_tx_max() is max_datagram_size + max_ndp_size + the
NTH header, but cdc_ncm_setup() clamps tx_max before
cdc_ncm_set_dgram_size() runs, so max_datagram_size is still 0 and
the bound is only max_ndp_size + the NTH header. It does not
reserve room for one datagram plus one NDP.
- wNdpOutAlignment = 256 is accepted by cdc_ncm_fix_modulus() as long
as it is smaller than tx_max, and cdc_ncm_align_tail() then pads the
12 byte NTH header up to 256 bytes right before this check.
An NDP can also be added to an NTB that already holds datagrams through
cdc_mbim_tx_fixup(), which uses a different signature per MBIM session.
On plain cdc_ncm the chain lookup in cdc_ncm_ndp16() returns the
existing NDP for the single signature, so there the create path is
normally reached for the first datagram of each NTB.
Rewrite the test as an addition, which cannot underflow and gives the
same answer whenever the original subtraction did not wrap.
Fixes: c78b7c586657 ("net: cdc_ncm: refactoring for tx multiplexing")
Fixes: 0fa81b304a79 ("cdc_ncm: Implement the 32-bit version of NCM Transfer Block")
Reported-by: syzbot+1994e2ecf323ed90f255@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1994e2ecf323ed90f255
Signed-off-by: Jiahao Xu <xujiahao@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111124156.637661-1-xujiahao@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/usb/cdc_ncm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 76687d57adb97..5713fac98d02a 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1124,7 +1124,7 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp16(struct cdc_ncm_ctx *ctx, struct s
cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
/* verify that there is room for the NDP and the datagram (reserve) */
- if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
+ if (skb->len + reserve + ctx->max_ndp_size > ctx->tx_curr_size)
return NULL;
/* link to it */
@@ -1179,7 +1179,7 @@ static struct usb_cdc_ncm_ndp32 *cdc_ncm_ndp32(struct cdc_ncm_ctx *ctx, struct s
cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
/* verify that there is room for the NDP and the datagram (reserve) */
- if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
+ if (skb->len + reserve + ctx->max_ndp_size > ctx->tx_curr_size)
return NULL;
/* link to it */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0203/1059] tracing: skip boot kprobe setup when no events were requested
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (201 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0202/1059] net: usb: cdc_ncm: dont underflow the NDP room check Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0204/1059] docs, kprobes: Fix bracket Greg Kroah-Hartman
` (795 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wenwen Fu, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Fu <wenwfu@qti.qualcomm.com>
[ Upstream commit 2388a673e9276de30c7e917fce50830e497d46cc ]
setup_boot_kprobe_events() calls enable_boot_kprobe_events() even when
the kprobe_event= boot parameter was not supplied. That call takes
event_mutex without any command-line probes to enable.
Asynchronous eval-map updates also hold event_mutex. A normal boot can
therefore wait in init_kprobe_trace() for this background work despite
having no boot probes to set up.
Return early when the boot-event buffer is empty. Keep the mutex
protection in trace_event_update_all() and retain setup for explicit
kprobe_event= parameters. Bootconfig handles its own probe enablement,
and the existing trace_eval_sync() still waits for background work
before init memory is freed.
Link: https://lore.kernel.org/all/20261106021457.2648231-1-wenwfu@qti.qualcomm.com/
Fixes: 970988e19eb0 ("tracing/kprobe: Add kprobe_event= boot parameter")
Signed-off-by: Wenwen Fu <wenwfu@qti.qualcomm.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_kprobe.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a87e9eb7f37b9..4dbc2d8bc69c8 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1913,6 +1913,9 @@ static __init void setup_boot_kprobe_events(void)
char *p, *cmd = kprobe_boot_events_buf;
int ret;
+ if (!kprobe_boot_events_buf[0])
+ return;
+
strreplace(kprobe_boot_events_buf, ',', ' ');
while (cmd && *cmd != '\0') {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0204/1059] docs, kprobes: Fix bracket
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (202 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0203/1059] tracing: skip boot kprobe setup when no events were requested Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0205/1059] KEYS: do not let an unmatched key decide the search result Greg Kroah-Hartman
` (794 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manuel Ebner, Randy Dunlap,
Masami Hiramatsu (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Ebner <manuelebnerli@mailbox.org>
[ Upstream commit b91a5c16996d089cd07ceaf33b5a621cb94c2c2f ]
Remove needless ')'
Link: https://lore.kernel.org/all/20261112085511.690900-2-manuelebnerli@mailbox.org/
Fixes: a1dac767622c ("kprobes.txt: standardize document format")
Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/trace/kprobes.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/trace/kprobes.rst b/Documentation/trace/kprobes.rst
index fc7ce76eab655..7f61c2dc56913 100644
--- a/Documentation/trace/kprobes.rst
+++ b/Documentation/trace/kprobes.rst
@@ -31,7 +31,7 @@ can trap at almost any kernel code address [1]_, specifying a handler
routine to be invoked when the breakpoint is hit.
.. [1] some parts of the kernel code can not be trapped, see
- :ref:`kprobes_blacklist`)
+ :ref:`kprobes_blacklist`
There are currently two types of probes: kprobes, and kretprobes
(also called return probes). A kprobe can be inserted on virtually
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0205/1059] KEYS: do not let an unmatched key decide the search result
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (203 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0204/1059] docs, kprobes: Fix bracket Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0206/1059] ALSA: aw2-alsa: select SND_PCM Greg Kroah-Hartman
` (793 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jarkko Sakkinen, Guixiong Wei,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixiong Wei <weiguixiong@bytedance.com>
[ Upstream commit 143fe160178c73e43575bff4890d23f84e37146d ]
With the dns_resolver key type available, put a key named "foo" in a
fresh session keyring, revoke it, and search for "bar":
keyctl new_session >/dev/null
A=$(printf '127.0.0.1\0' | keyctl padd dns_resolver foo @s)
keyctl revoke "$A"
keyctl search @s dns_resolver bar
Results:
keyctl_search: Key has been revoked
The search returns -EKEYREVOKED even though there is no key named "bar".
It should return -ENOKEY.
A dns_resolver search walks the keys in the keyring and uses
dns_resolver_cmp() to compare their descriptions with the requested
name. When keyring_search_iterator() sees the revoked "foo" key, it
records -EKEYREVOKED in ctx->result and skips the key before comparing
its description. The search continues, but without a match it returns
the error recorded for "foo".
Call the match callback before checking for invalidated, revoked or
expired keys. A nonmatching key then leaves ctx->result alone.
Fixes: b2a4df200d57 ("KEYS: Expand the capacity of a keyring")
Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
Closes: https://lore.kernel.org/lkml/avDG8G-Jl1YsmfCs@kernel.org/
Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261109032931.80406-2-weiguixiong@bytedance.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyring.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 74ed1372d22cf..c339b4073ea02 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -598,6 +598,12 @@ static int keyring_search_iterator(const void *object, void *iterator_data)
return 0;
}
+ /* A key the caller did not ask for must not decide the result. */
+ if (!ctx->match_data.cmp(key, &ctx->match_data)) {
+ kleave(" = 0 [!match]");
+ return 0;
+ }
+
/* skip invalidated, revoked and expired keys */
if (ctx->flags & KEYRING_SEARCH_DO_STATE_CHECK) {
time64_t expiry = READ_ONCE(key->expiry);
@@ -617,12 +623,6 @@ static int keyring_search_iterator(const void *object, void *iterator_data)
}
}
- /* keys that don't match */
- if (!ctx->match_data.cmp(key, &ctx->match_data)) {
- kleave(" = 0 [!match]");
- return 0;
- }
-
/* key must have search permissions */
if (!(ctx->flags & KEYRING_SEARCH_NO_CHECK_PERM) &&
key_task_permission(make_key_ref(key, ctx->possessed),
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0206/1059] ALSA: aw2-alsa: select SND_PCM
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (204 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0205/1059] KEYS: do not let an unmatched key decide the search result Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0207/1059] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Greg Kroah-Hartman
` (792 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit bca568589ad118a9b0bac086760baee2a41976a5 ]
Several stanzas in sound/pci/Kconfig select SND_PCM.
SND_AW2 selects nothing at all.
aw2-alsa calls snd_pcm_new, which sound/core/pcm.c provides under SND_PCM.
aw2-alsa.c:(.text+0x554): undefined reference to `snd_pcm_new'
4 symbols are undefined in all.
The driver can be built into vmlinux while SND_PCM is a module, in which
case the symbols are not there at link time.
Select rather than depend on: SND_PCM has no prompt of its own and is only
ever enabled by a select, so a depends on would leave SND_AW2
unselectable.
Reproduced on v7.3, arm64, with CONFIG_SND_AW2=y and CONFIG_SND_PCM=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: 98f2a97f207a ("[ALSA] Emagic Audiowerk 2 ALSA driver.")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261113064614.15045-1-jude.gyimah87@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index a558362254019..fcd364c11a534 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -137,6 +137,7 @@ config SND_AU8830
config SND_AW2
tristate "Emagic Audiowerk 2"
+ select SND_PCM
help
Say Y here to include support for Emagic Audiowerk 2 soundcards.
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0207/1059] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (205 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0206/1059] ALSA: aw2-alsa: select SND_PCM Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0208/1059] kernel: Make io_thread and kthread bit fields Greg Kroah-Hartman
` (791 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Beulich, Juergen Gross,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <jbeulich@suse.com>
[ Upstream commit 2b66f2cc753243a6adb3e9a5c038b0fc59ba7ec9 ]
Both decrease-reservation and populate-physmap can succeed partially. For
the former this may be pretty unlikely, but clearly the latter can hit
both out-of-memory conditions in the hypervisor or denial because of the
allocation exceeding the domain's allowance (there's no interaction with
the balloon driver here either).
In gnttab_dma_free_pages() we simply can't give back to the system what
hasn't been re-filled with backing memory. For gnttab_dma_alloc_pages()
both parts of the overall region need dealing with differently.
While no present caller of gnttab_dma_free_pages() checks its return
value, also don't use -EFAULT there: It really is an out-of-memory
condition. (In gnttab_dma_alloc_pages() -EFAULT doesn't look quite right
either, but I couldn't think of a clearly better error code there.)
Fixes: 9bdc7304f536 ("xen/grant-table: Allow allocating buffers suitable for DMA")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110095605.369848-3-jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/xen/grant-table.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 60f13c012ff29..01950a51c151e 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -1098,6 +1098,24 @@ int gnttab_dma_alloc_pages(struct gnttab_dma_alloc_args *args)
ret = xenmem_reservation_decrease(args->nr_pages, args->frames);
if (ret != args->nr_pages) {
pr_debug("Failed to decrease reservation for DMA buffer\n");
+ if (ret >= 0) {
+ /* Free the part where decrease didn't work. */
+ size_t done = ret << PAGE_SHIFT;
+
+ if (args->coherent)
+ dma_free_coherent(args->dev, size - done,
+ args->vaddr + done,
+ args->dev_bus_addr + done);
+ else
+ dma_free_wc(args->dev, size - done,
+ args->vaddr + done,
+ args->dev_bus_addr + done);
+
+ if (!ret) /* Nothing else to do? */
+ return -EFAULT;
+
+ args->nr_pages = ret;
+ }
ret = -EFAULT;
goto fail;
}
@@ -1131,7 +1149,12 @@ int gnttab_dma_free_pages(struct gnttab_dma_alloc_args *args)
ret = xenmem_reservation_increase(args->nr_pages, args->frames);
if (ret != args->nr_pages) {
pr_debug("Failed to increase reservation for DMA buffer\n");
- ret = -EFAULT;
+ /* Can only free what has been re-filled. */
+ if (!ret)
+ return -ENOMEM;
+ if (ret > 0)
+ args->nr_pages = ret;
+ ret = -ENOMEM;
} else {
ret = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0208/1059] kernel: Make io_thread and kthread bit fields
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (206 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0207/1059] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0209/1059] fork/vm: Move common PF_IO_WORKER behavior to new flag Greg Kroah-Hartman
` (790 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Christie, Michael S. Tsirkin,
Christian Brauner (Microsoft), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <michael.christie@oracle.com>
[ Upstream commit c81cc5819faf5dd77124f5086aa654482281ac37 ]
We only set args->io_thread/kthread to 0 or 1 then test if they are set,
so make them bit fields.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Stable-dep-of: cabc249e6560 ("ptrace: refuse to change the signal mask of a user worker")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/sched/task.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index 00135a8d57737..67ea05da511dc 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -24,6 +24,8 @@ struct kernel_clone_args {
int __user *child_tid;
int __user *parent_tid;
int exit_signal;
+ u32 kthread:1;
+ u32 io_thread:1;
unsigned long stack;
unsigned long stack_size;
unsigned long tls;
@@ -31,8 +33,6 @@ struct kernel_clone_args {
/* Number of elements in *set_tid */
size_t set_tid_size;
int cgroup;
- int io_thread;
- int kthread;
int idle;
int (*fn)(void *);
void *fn_arg;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0209/1059] fork/vm: Move common PF_IO_WORKER behavior to new flag
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (207 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0208/1059] kernel: Make io_thread and kthread bit fields Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0210/1059] ptrace: refuse to change the signal mask of a user worker Greg Kroah-Hartman
` (789 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Christie, Michael S. Tsirkin,
Christian Brauner (Microsoft), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <michael.christie@oracle.com>
[ Upstream commit 54e6842d0775ba76db65cbe21311c3ca466e663d ]
This adds a new flag, PF_USER_WORKER, that's used for behavior common to
to both PF_IO_WORKER and users like vhost which will use a new helper
instead of create_io_thread because they require different behavior for
operations like signal handling.
The common behavior PF_USER_WORKER covers is the vm reclaim handling.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Stable-dep-of: cabc249e6560 ("ptrace: refuse to change the signal mask of a user worker")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/sched.h | 2 +-
include/linux/sched/task.h | 1 +
kernel/fork.c | 3 +++
mm/vmscan.c | 4 ++--
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 50fd0b4e7dd9e..38920e9c1a2ae 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1743,7 +1743,7 @@ extern struct pid __rcu *cad_pid;
#define PF_MEMALLOC 0x00000800 /* Allocating memory */
#define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */
#define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
-#define PF__HOLE__00004000 0x00004000
+#define PF_USER_WORKER 0x00004000 /* Kernel thread cloned from userspace thread */
#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
#define PF__HOLE__00010000 0x00010000
#define PF_KSWAPD 0x00020000 /* I am kswapd */
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index 67ea05da511dc..209eac4841f73 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -26,6 +26,7 @@ struct kernel_clone_args {
int exit_signal;
u32 kthread:1;
u32 io_thread:1;
+ u32 user_worker:1;
unsigned long stack;
unsigned long stack_size;
unsigned long tls;
diff --git a/kernel/fork.c b/kernel/fork.c
index 411c2b427ea85..e1bab170045b3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2200,6 +2200,8 @@ static __latent_entropy struct task_struct *copy_process(
p->flags &= ~PF_KTHREAD;
if (args->kthread)
p->flags |= PF_KTHREAD;
+ if (args->user_worker)
+ p->flags |= PF_USER_WORKER;
if (args->io_thread) {
/*
* Mark us an IO worker, and block any signal that isn't
@@ -2713,6 +2715,7 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
.fn = fn,
.fn_arg = arg,
.io_thread = 1,
+ .user_worker = 1,
};
/* A creator past its fatal signal or its coredump point gets no thread. */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 86a7bc87f55d9..da105247467e2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1130,12 +1130,12 @@ void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason)
DEFINE_WAIT(wait);
/*
- * Do not throttle IO workers, kthreads other than kswapd or
+ * Do not throttle user workers, kthreads other than kswapd or
* workqueues. They may be required for reclaim to make
* forward progress (e.g. journalling workqueues or kthreads).
*/
if (!current_is_kswapd() &&
- current->flags & (PF_IO_WORKER|PF_KTHREAD)) {
+ current->flags & (PF_USER_WORKER|PF_KTHREAD)) {
cond_resched();
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0210/1059] ptrace: refuse to change the signal mask of a user worker
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (208 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0209/1059] fork/vm: Move common PF_IO_WORKER behavior to new flag Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0211/1059] coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps Greg Kroah-Hartman
` (788 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Nesterov,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit cabc249e6560bee7bdfee9fbcb7ce4e951dcfd41 ]
A user worker is created with every signal other than SIGKILL and
SIGSTOP blocked. It never runs user code and that mask is what keeps
get_signal() from dequeuing anything else for it. complete_signal()
never picks a thread that blocks the signal, tkill() queues on the
worker but nothing dequeues it. ptrace_signal() requeues an injected
signal that the tracee blocks.
PTRACE_SETSIGMASK is the only way to change that mask from the outside.
A tracer that clears it makes the worker eligible for every signal.
Whatever the worker then dequeues it can only act on by leaving.
Refuse PTRACE_SETSIGMASK for a user worker with -EPERM, the way
ptrace_attach() refuses a kernel thread. A worker is guaranteed to only
ever dequeue SIGKILL or SIGSTOP and an injected signal stays pending on
it, which is what already happens when the mask isn't touched.
Taking the request and quietly leaving the mask alone was the other
option, the way set_current_blocked() keeps SIGKILL and SIGSTOP
unblocked whatever userspace asks for. But then a tracer gets success
back with nothing changed and no way to tell that apart from a mask that
took effect.
Fixes: e8b33b8cfafc ("Revert "kernel: treat PF_IO_WORKER like PF_KTHREAD for ptrace/signals"")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260921-work-coredump-fixes-v3-9-8e4adb1619e6@kernel.org
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/ptrace.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 435848809ebcd..5bedbeb3eaf6d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -1105,6 +1105,12 @@ int ptrace_request(struct task_struct *child, long request,
case PTRACE_SETSIGMASK: {
sigset_t new_set;
+ /* A user worker only ever takes SIGKILL and SIGSTOP. */
+ if (child->flags & PF_USER_WORKER) {
+ ret = -EPERM;
+ break;
+ }
+
if (addr != sizeof(sigset_t)) {
ret = -EINVAL;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0211/1059] coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (209 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0210/1059] ptrace: refuse to change the signal mask of a user worker Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0212/1059] driver core: take parent lock on deferred probe Greg Kroah-Hartman
` (787 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Nesterov,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit a58d647acfdc62561f3570d114025b3bf38ae41b ]
TIF_NOTIFY_SIGNAL is used to kick a task in uninterruptible sleep to
return to userspace and run task work and then go back to sleep. This
mechanism works well but breaks coredumps. dump_interrupted() only
allows fatal signals to interrupt a coredump and the whole regular write
path going to actual filesystems is impervious to TIF_NOTIFY_SIGNAL as
well.
However, both the usermodehelper pipe and the coredump socket will bail
early on TIF_NOTIFY_SIGNAL. This affects the following codepaths:
- coredump_sock_recv() -> unix_stream_read_generic()
The request/ack handshake is abandoned before any coredump data is
sent.
- anon_pipe_write() returning -ERESTARTSYS
Once the pipe is full this truncates the coredump.
- unix_stream_sendmsg() returning -ERESTARTSYS
Once the send buffer is full this truncates the coredump.
- coredump_sock_wait() -> __kernel_read()
This reports a failure that didn't happen.
- wait_for_dump_helpers() -> wait_event_interruptible()
This stops waiting for the coredump helpers.
Such truncation is entirely invisible to userspace and all uapi bits
still indicate that a successful coredump happened. A crashing process
with a bunch of file backed mappings and io_uring thrown in loses most
of the coredump data. If the NT_FILE note goes past PAGE_SIZE mappings
it's gonzo.
TIF_NOTIFY_SIGNAL is sent by io_uring for the common case. And it uses
poll without sleeping so a completion callback runs task_work_add() from
interrupt context against the task that submitted the request. This is
the task that is running the coredump. Since that task hasn't set
work_exited (it hasn't exited yet after all) TIF_NOTIFY_SIGNAL keeps
reappearing.
A coredumping task doesn't return to userspace. The task work is run at
exit. So interrupting it doesn't buy anything and just loses the
coredump which is quite valuable.
Note that this isn't specific to io_uring. There's also
klp_send_signals(), bpf_task_work_schedule_signal(), landlock's tsync
and then technically, kthread_stop() and the printk kunit test set the
bit raw.
Link: https://patch.msgid.link/20260824-work-tif_notify_signal-v2-2-6609e42b3157@kernel.org
Fixes: 12db8b690010 ("entry: Add support for TIF_NOTIFY_SIGNAL")
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: adapted the hook into the older monolithic do_coredump(), using explicit no_notify_signal_save()/restore() instead of guard() to avoid goto jumps over the cleanup variable. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/coredump.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/coredump.c b/fs/coredump.c
index f92376a45cd4f..e64fe79f0e7ec 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -584,6 +584,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
struct linux_binfmt * binfmt;
const struct cred *old_cred;
struct cred *cred;
+ unsigned int notify_flags;
int retval = 0;
int ispipe;
size_t *argv = NULL;
@@ -632,6 +633,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
if (retval < 0)
goto fail_creds;
+ /* Task work must not cut the dump short, see signal_pending(). */
+ notify_flags = no_notify_signal_save();
old_cred = override_creds(cred);
ispipe = format_corename(&cn, &cprm, &argv, &argc);
@@ -848,6 +851,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
kfree(cn.corename);
coredump_finish(core_dumped);
revert_creds(old_cred);
+ no_notify_signal_restore(notify_flags);
fail_creds:
put_cred(cred);
fail:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0212/1059] driver core: take parent lock on deferred probe
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (210 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0211/1059] coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0213/1059] driver core: take parent lock in async device attach Greg Kroah-Hartman
` (786 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mario Peter, Johan Hovold,
Danilo Krummrich, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
[ Upstream commit 4059f8986c8f50102a04335cc1da4921dfd262d8 ]
USB interfaces should be probed with the parent USB device lock held,
but this is not honoured when probe is deferred.
Add a new bus_probe_device_deferred() helper to handle deferred probe
where the parent device lock is not held.
Fixes: d1c3414c2a9d ("drivercore: Add driver probe deferral mechanism")
Reported-by: Mario Peter <mario.peter@leica-geosystems.com>
Link: https://lore.kernel.org/20261007131514.1260696-1-mario.peter@leica-geosystems.com
Cc: stable@vger.kernel.org # 3.4
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20261014133109.1392265-3-johan@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
[ sashal: Kept this tree's extern-style declaration block in base.h and added only the bus_probe_device_deferred() prototype, since the upstream context lines (bus_notify, bus_is_registered) don't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/base.h | 1 +
drivers/base/bus.c | 28 +++++++++++++++++++++-------
drivers/base/dd.c | 7 ++++---
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/drivers/base/base.h b/drivers/base/base.h
index b902d1ecc247f..062e99b891f44 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -129,6 +129,7 @@ struct kobject *virtual_device_parent(struct device *dev);
extern int bus_add_device(struct device *dev);
extern void bus_probe_device(struct device *dev);
+extern void bus_probe_device_deferred(struct device *dev);
extern void bus_remove_device(struct device *dev);
extern int bus_add_driver(struct device_driver *drv);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index b2d4c08848a8c..112e172eee1fd 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -471,13 +471,7 @@ int bus_add_device(struct device *dev)
return error;
}
-/**
- * bus_probe_device - probe drivers for a new device
- * @dev: device to probe
- *
- * - Automatically probe for a driver if the bus allows it.
- */
-void bus_probe_device(struct device *dev)
+static void __bus_probe_device(struct device *dev)
{
struct bus_type *bus = dev->bus;
struct subsys_interface *sif;
@@ -495,6 +489,26 @@ void bus_probe_device(struct device *dev)
mutex_unlock(&bus->p->mutex);
}
+/**
+ * bus_probe_device - probe drivers for a new device
+ * @dev: device to probe
+ *
+ * - Automatically probe for a driver if the bus allows it.
+ */
+void bus_probe_device(struct device *dev)
+{
+ __bus_probe_device(dev);
+}
+
+void bus_probe_device_deferred(struct device *dev)
+{
+ if (dev->type && dev->type->need_parent_lock)
+ device_lock(dev->parent);
+ __bus_probe_device(dev);
+ if (dev->type && dev->type->need_parent_lock)
+ device_unlock(dev->parent);
+}
+
/**
* bus_remove_device - remove device from bus
* @dev: device to be removed
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 71653ce21efab..dc44bc077238d 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -85,8 +85,9 @@ static void deferred_probe_work_func(struct work_struct *work)
/*
* This block processes every device in the deferred 'active' list.
* Each device is removed from the active list and passed to
- * bus_probe_device() to re-attempt the probe. The loop continues
- * until every device in the active list is removed and retried.
+ * bus_probe_device_deferred() to re-attempt the probe. The loop
+ * continues until every device in the active list is removed and
+ * retried.
*
* Note: Once the device is removed from the list and the mutex is
* released, it is possible for the device get freed by another thread
@@ -120,7 +121,7 @@ static void deferred_probe_work_func(struct work_struct *work)
device_pm_move_to_tail(dev);
dev_dbg(dev, "Retrying from deferred list\n");
- bus_probe_device(dev);
+ bus_probe_device_deferred(dev);
mutex_lock(&deferred_probe_mutex);
put_device(dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0213/1059] driver core: take parent lock in async device attach
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (211 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0212/1059] driver core: take parent lock on deferred probe Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0214/1059] ksmbd: deny access for an empty DACL instead of granting the request Greg Kroah-Hartman
` (785 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mario Peter, Dmitry Torokhov,
Johan Hovold, Danilo Krummrich, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Peter <mario.peter@leica-geosystems.com>
[ Upstream commit 187a62f99da29b1a55602b0d401a783d8dc86161 ]
For device types with need_parent_lock set (only USB interfaces),
probe() must run with the parent device locked. A synchronous attach
after device_add() gets this from the caller, e.g.
usb_set_configuration() holds the udev lock while adding interfaces.
__device_attach_async_helper() runs the probe from an async worker
instead, where that lock isn't held, and only takes device_lock(dev).
With async probing enabled for the hub driver (e.g. driver_async_probe=*
or driver_async_probe=hub), this races when a multi-TT hub is
configured. For multi-TT hubs, hub_probe() calls
usb_set_interface(hdev, 0, 1) to select the TT-per-port altsetting, and
usb_set_interface() creates the endpoint devices of the interface a
second time:
usb_set_configuration() async worker
[udev locked]
device_add(intf)
queues the probe ----------> __device_attach_async_helper()
[intf locked, udev not locked]
hub_probe()
usb_set_interface(hdev, 0, 1)
create_intf_ep_devs(intf) create_intf_ep_devs(intf)
create_intf_ep_devs() checks and sets intf->ep_devs_created without a
lock of its own. If usb_set_configuration() has created ep_81 but not
yet set the flag, usb_set_interface() skips removing the endpoint
devices of the old altsetting and creates ep_81 again. With a
synchronous probe, hub_probe() runs inside device_add() with the udev
lock held, and usb_set_configuration() then finds ep_devs_created
already set.
Single-TT hubs don't call usb_set_interface() from hub_probe() and
don't show this warning, but their probe runs without the udev lock as
well.
On an i.MX8MM board with an onboard USB2514 hub this hit 11 of 100
boots:
sysfs: cannot create duplicate filename '.../1-1/1-1:1.0/ep_81'
Call trace:
sysfs_warn_dup
usb_create_ep_devs
create_intf_ep_devs
usb_set_interface
hub_probe
usb_probe_interface
really_probe
__device_attach_async_helper
async_run_entry_fn
It also shows on v7.3-rc6 in QEMU, with dummy_hcd and a raw-gadget
program emulating a multi-TT hub: re-authorizing the hub in a loop,
while a SCHED_FIFO task preempts the writing task at random points for
3 ms, hit the warning in 29 of 6000 iterations.
Take the parent lock in __device_attach_async_helper() as well, like
__driver_attach_async_helper() does, and move
__device_driver_lock/unlock() up for that. With this the warning was
gone in 300 boots on the board and in 6000 iterations in QEMU.
Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for drivers")
Signed-off-by: Mario Peter <mario.peter@leica-geosystems.com>
Cc: stable@vger.kernel.org # 4.2
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ johan: switch to async_schedule_dev_nocall() to avoid deadlock if
async_schedule_dev() runs synchronously when parent lock is
held ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20261014133109.1392265-4-johan@kernel.org
[ Fold the nested conditions into a single if statement; correct commit
message to mention "device types" rather than "buses" for
"need_parent_lock". - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
[ sashal: Adapted device_initial_probe() to its older form without subsys_private/drivers_autoprobe handling, calling __device_attach(dev, true) and retrying with false if it returns 2. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/dd.c | 79 ++++++++++++++++++++++++++---------------------
1 file changed, 43 insertions(+), 36 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index dc44bc077238d..e2160830de813 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -966,6 +966,38 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
return ret == 0;
}
+/*
+ * __device_driver_lock - acquire locks needed to manipulate dev->drv
+ * @dev: Device we will update driver info for
+ * @parent: Parent device. Needed if the device type requires parent lock
+ *
+ * This function will take the required locks for manipulating dev->drv.
+ * Normally this will just be the @dev lock, but when called for a USB
+ * interface, @parent lock will be held as well.
+ */
+static void __device_driver_lock(struct device *dev, struct device *parent)
+{
+ if (dev->type && dev->type->need_parent_lock && parent)
+ device_lock(parent);
+ device_lock(dev);
+}
+
+/*
+ * __device_driver_unlock - release locks needed to manipulate dev->drv
+ * @dev: Device we will update driver info for
+ * @parent: Parent device. Needed if the device type requires parent lock
+ *
+ * This function will release the required locks for manipulating dev->drv.
+ * Normally this will just be the @dev lock, but when called for a
+ * USB interface, @parent lock will be released as well.
+ */
+static void __device_driver_unlock(struct device *dev, struct device *parent)
+{
+ device_unlock(dev);
+ if (dev->type && dev->type->need_parent_lock && parent)
+ device_unlock(parent);
+}
+
static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
{
struct device *dev = _dev;
@@ -975,7 +1007,7 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
.want_async = true,
};
- device_lock(dev);
+ __device_driver_lock(dev, dev->parent);
/*
* Check if device has already been removed or claimed. This may
@@ -997,7 +1029,7 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
if (dev->parent)
pm_runtime_put(dev->parent);
out_unlock:
- device_unlock(dev);
+ __device_driver_unlock(dev, dev->parent);
put_device(dev);
}
@@ -1054,8 +1086,11 @@ static int __device_attach(struct device *dev, bool allow_async)
}
out_unlock:
device_unlock(dev);
- if (async)
- async_schedule_dev(__device_attach_async_helper, dev);
+ if (async && !async_schedule_dev_nocall(__device_attach_async_helper, dev)) {
+ put_device(dev);
+ ret = 2; /* retry synchronously */
+ }
+
return ret;
}
@@ -1081,39 +1116,11 @@ EXPORT_SYMBOL_GPL(device_attach);
void device_initial_probe(struct device *dev)
{
- __device_attach(dev, true);
-}
-
-/*
- * __device_driver_lock - acquire locks needed to manipulate dev->drv
- * @dev: Device we will update driver info for
- * @parent: Parent device. Needed if the device type requires parent lock
- *
- * This function will take the required locks for manipulating dev->drv.
- * Normally this will just be the @dev lock, but when called for a USB
- * interface, @parent lock will be held as well.
- */
-static void __device_driver_lock(struct device *dev, struct device *parent)
-{
- if (dev->type && dev->type->need_parent_lock && parent)
- device_lock(parent);
- device_lock(dev);
-}
+ int ret;
-/*
- * __device_driver_unlock - release locks needed to manipulate dev->drv
- * @dev: Device we will update driver info for
- * @parent: Parent device. Needed if the device type requires parent lock
- *
- * This function will release the required locks for manipulating dev->drv.
- * Normally this will just be the @dev lock, but when called for a
- * USB interface, @parent lock will be released as well.
- */
-static void __device_driver_unlock(struct device *dev, struct device *parent)
-{
- device_unlock(dev);
- if (dev->type && dev->type->need_parent_lock && parent)
- device_unlock(parent);
+ ret = __device_attach(dev, true);
+ if (ret == 2)
+ __device_attach(dev, false);
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0214/1059] ksmbd: deny access for an empty DACL instead of granting the request
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (212 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0213/1059] driver core: take parent lock in async device attach Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0215/1059] mm/hugetlb: fix use-after-free of a new anon folio Greg Kroah-Hartman
` (784 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Aamir Ahmed, Namjae Jeon,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aamir Ahmed <elb12345@hotmail.co.uk>
[ Upstream commit de0cffef897c1c232ed973f89928cd6c93d0b1e3 ]
smb_check_perm_dacl() returns the access mask it computes to the SMB2
CREATE handler, which uses it as the granted access for the open. For a
security descriptor whose DACL is present but contains no ACEs, the
function is supposed to deny access: an empty (non-NULL) DACL grants no
access to anyone except the object owner's implicit READ_CONTROL and
WRITE_DAC (MS-DTYP 2.4.5).
The empty-DACL branch only denies when both
- the DACL has no trailing bytes (pdacl_size == sizeof(struct smb_acl)),
and
- the request contains bits beyond READ_CONTROL / WRITE_DAC.
In every other case it takes the shared "goto err_out" with rc still 0,
which returns success without modifying *pdaccess, so the caller grants
the full requested access. Three problems follow:
- The READ_CONTROL / WRITE_DAC carve-out models the owner's implicit
rights, but the check runs before is_owner is computed, so those
rights are handed to *every* caller, not just the owner. For
READ_CONTROL the SMB2 CREATE path does not fall back to
inode_permission(), so any user can read the security descriptor of
an object whose empty DACL is meant to deny them.
- A request of exactly READ_CONTROL and/or WRITE_DAC is granted to any
caller. WRITE_DAC lets the handle rewrite the DACL.
- A DACL that declares zero ACEs but carries trailing bytes
(pdacl_size > sizeof(struct smb_acl)) skips the deny entirely and is
granted whatever was requested.
On shares where the NT ACL is the authoritative access control -- e.g.
"force user" shares, where every client maps to one POSIX identity so
POSIX cannot distinguish users -- this is an access-control bypass.
Compute is_owner before the empty-DACL branch and deny access from an
empty DACL unless the caller is the owner requesting no more than
READ_CONTROL / WRITE_DAC.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Moved the owner/SID computation ahead of the empty-DACL check and adapted it to take the older user_ns argument instead of idmap, declaring the new locals in the function. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smbacl.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index d3314b516e274..cb434c7539e02 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -1455,6 +1455,8 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
struct posix_acl_entry *pa_entry;
unsigned int sid_type = SIDOWNER;
unsigned short ace_size;
+ vfsuid_t vfsuid;
+ bool is_owner;
ksmbd_debug(SMB, "check permission using windows acl\n");
pntsd_size = ksmbd_vfs_get_sd_xattr(conn, user_ns,
@@ -1475,19 +1477,27 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,
if (pdacl_size > acl_size || pdacl_size < sizeof(struct smb_acl))
goto err_out;
+ if (!uid)
+ sid_type = SIDUNIX_USER;
+ id_to_sid(uid, sid_type, &sid);
+ vfsuid = i_uid_into_vfsuid(user_ns, d_inode(path->dentry));
+ is_owner = uid == from_kuid(&init_user_ns, vfsuid_into_kuid(vfsuid));
+
if (!pdacl->num_aces) {
- if (!(pdacl_size - sizeof(struct smb_acl)) &&
- *pdaccess & ~(FILE_READ_CONTROL_LE | FILE_WRITE_DAC_LE)) {
+ /*
+ * 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.
+ */
+ if (!is_owner ||
+ (*pdaccess & ~(FILE_READ_CONTROL_LE | FILE_WRITE_DAC_LE)))
rc = -EACCES;
- goto err_out;
- }
goto err_out;
}
- if (!uid)
- sid_type = SIDUNIX_USER;
- id_to_sid(uid, sid_type, &sid);
-
if (*pdaccess & FILE_MAXIMAL_ACCESS_LE) {
access_bits = READ_CONTROL | WRITE_DAC | FILE_READ_ATTRIBUTES |
DELETE;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0215/1059] mm/hugetlb: fix use-after-free of a new anon folio
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (213 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0214/1059] ksmbd: deny access for an empty DACL instead of granting the request Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0216/1059] media: marvell: mcam: stop DMA and cancel s_bh_work before freeing DMA buffers Greg Kroah-Hartman
` (783 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Andrew Morton, Lorenzo Stoakes (ARM), Muchun Song, Lance Yang,
Liam R. Howlett, Vlastimil Babka, Jann Horn, Pedro Falcato,
Oscar Salvador, Miaohe Lin, Naoya Horiguchi, Adam Litke,
Mel Gorman, Rik van Riel, Peter Xu, Kiryl Shutsemau,
Mike Rapoport, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 824cc56bf43c714319992bad3558803cac6e77c0 ]
For a fault in a private mapping with nothing in the page cache,
hugetlb_no_page() allocates a folio, locks it and maps it. The folio has
one reference, which belongs to the page table entry from then on. After
dropping the page table lock the function still sets the migratable flag
of the folio and unlocks it.
Whoever zaps the entry in between frees the folio. The fault holds the
fault mutex and the lock of the vma. MADV_DONTNEED and the first unmap of
a hole punch, hugetlb_vmdelete_list(), do not take the fault mutex, and a
private vma only has a lock if it owns a reservation map: not with
MAP_NORESERVE, and not in the child after fork().
Then the flag is set in, and folio_unlock() is called on, a folio that is
free or has a new owner. A surplus page goes back to the page allocator
while it is locked:
BUG: Bad page state in process init pfn:108e00
flags: 0x200000000000059(locked|uptodate|dirty|head|node=0|zone=2)
page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
A page of the pool can be given to the next user, of any file, who locks
it and loses the lock to the late folio_unlock():
kernel BUG at mm/filemap.c:1532!
hugetlb_no_page+0x111b/0x23e0
hugetlb_fault+0x3a9/0x14a0
An unprivileged process is enough: threads that write to a MAP_PRIVATE |
MAP_NORESERVE hugetlb mapping, threads that call MADV_DONTNEED on it, and
one that takes the freed pages for another file.
Until commit 3a47c54f09c4 ("hugetlbfs: revert use i_mmap_rwsem for more
pmd sharing synchronization") the fault held i_mmap_rwsem for reading,
which everybody who zaps takes for writing. The lock that commit
bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private VMAs") gave
to private vmas closed the window again, but only for those with a
reservation map.
Be done with the folio before the page table lock is dropped, as
hugetlb_wp() is with its copy. The function already unlocks page cache
folios under that lock.
Original fix generated by an LLM and sent in private by Josef.
[david@kernel.org: simplify+move comment]
Link: https://lore.kernel.org/20261015-urgent_fixes-v1-2-42796911043b@kernel.org
Fixes: 3a47c54f09c4 ("hugetlbfs: revert use i_mmap_rwsem for more pmd sharing synchronization")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Muchun Song <muchun.song@linux.dev>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Adam Litke <agl@us.ibm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Rik van Riel <riel@surriel.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Kiryl Shutsemau <kas@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: <stable@vger.kernel.org>
[ sashal: Adapted to the older pre-folio code: used local ptl, struct page with SetHPageMigratable, and an unconditional unlock_page(page) since there is no folio_locked flag or vmf->ptl. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/hugetlb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7d32a2e64da72..a0372189a23d4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -6112,8 +6112,6 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
ret = hugetlb_wp(mm, vma, address, ptep, flags, page, ptl);
}
- spin_unlock(ptl);
-
/*
* Only set HPageMigratable in newly allocated pages. Existing pages
* found in the pagecache may not have HPageMigratableset if they have
@@ -6123,6 +6121,12 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
SetHPageMigratable(page);
unlock_page(page);
+
+ /*
+ * Hold the PTL until we're done with the page: the page table owns the
+ * page reference now.
+ */
+ spin_unlock(ptl);
out:
hugetlb_vma_unlock_read(vma);
mutex_unlock(&hugetlb_fault_mutex_table[hash]);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0216/1059] media: marvell: mcam: stop DMA and cancel s_bh_work before freeing DMA buffers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (214 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0215/1059] mm/hugetlb: fix use-after-free of a new anon folio Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0217/1059] mm: khugepaged: fix folio is used after pte_unmap_unlock() Greg Kroah-Hartman
` (782 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Fan Wu, Hans Verkuil, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <fanwu01@zju.edu.cn>
[ Upstream commit 0f29f84317c1e35f6a9265277be33e60d3fc8c1c ]
In vmalloc mode the frame-completion IRQ queues mcam_frame_work() on
cam->s_bh_work, which memcpy()s from the dma_bufs[] that
mcam_free_dma_bufs() frees with dma_free_coherent(). mccic_shutdown()
frees those buffers without stopping the controller, so while streaming
a late frame IRQ can re-arm the work after the buffers are gone, causing a
use-after-free.
Stop the controller in mccic_shutdown() when streaming is still active
(gated on an open fd, which holds a runtime-PM reference, so the device
is powered), cancel s_bh_work in mcam_free_dma_bufs(), and move
INIT_WORK() into mccic_register() before the device can be published.
Fixes: 67a8dbbc4e04 ("[media] marvell-cam: Basic working MMP camera driver")
Cc: stable@vger.kernel.org
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
[ sashal: Replaced the BH-workqueue cancel_work_sync(&cam->s_bh_work) and INIT_WORK with tasklet_kill(&cam->s_tasklet) and tasklet_setup(), since this tree still uses a tasklet. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/marvell/mcam-core.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/marvell/mcam-core.c b/drivers/media/platform/marvell/mcam-core.c
index 22d1d11cd195a..00b2a164dc090 100644
--- a/drivers/media/platform/marvell/mcam-core.c
+++ b/drivers/media/platform/marvell/mcam-core.c
@@ -406,6 +406,8 @@ static void mcam_free_dma_bufs(struct mcam_camera *cam)
{
int i;
+ tasklet_kill(&cam->s_tasklet);
+
for (i = 0; i < cam->nbufs; i++) {
dma_free_coherent(cam->dev, cam->dma_buf_size,
cam->dma_bufs[i], cam->dma_handles[i]);
@@ -1310,7 +1312,6 @@ static int mcam_setup_vb2(struct mcam_camera *cam)
break;
case B_vmalloc:
#ifdef MCAM_MODE_VMALLOC
- tasklet_setup(&cam->s_tasklet, mcam_frame_tasklet);
vq->ops = &mcam_vb2_ops;
vq->mem_ops = &vb2_vmalloc_memops;
cam->dma_setup = mcam_ctlr_dma_vmalloc;
@@ -1875,6 +1876,12 @@ int mccic_register(struct mcam_camera *cam)
if (ret)
goto out;
+#ifdef MCAM_MODE_VMALLOC
+ /* Init before sensor bind: armed by IRQ, cancelled on probe-error paths. */
+ if (cam->buffer_mode == B_vmalloc)
+ tasklet_setup(&cam->s_tasklet, mcam_frame_tasklet);
+#endif
+
mutex_init(&cam->s_mutex);
cam->state = S_NOTREADY;
mcam_set_config_needed(cam, 1);
@@ -1934,10 +1941,15 @@ void mccic_shutdown(struct mcam_camera *cam)
* take it down again will wedge the machine, which is frowned
* upon.
*/
+ mutex_lock(&cam->s_mutex);
if (!list_empty(&cam->vdev.fh_list)) {
cam_warn(cam, "Removing a device with users!\n");
+ /* Stop so the IRQ can't re-arm s_tasklet after the buffers are freed. */
+ if (cam->state == S_STREAMING)
+ mcam_ctlr_stop_dma(cam);
sensor_call(cam, core, s_power, 0);
}
+ mutex_unlock(&cam->s_mutex);
if (cam->buffer_mode == B_vmalloc)
mcam_free_dma_bufs(cam);
v4l2_ctrl_handler_free(&cam->ctrl_handler);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0217/1059] mm: khugepaged: fix folio is used after pte_unmap_unlock()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (215 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0216/1059] media: marvell: mcam: stop DMA and cancel s_bh_work before freeing DMA buffers Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0218/1059] smb: client: reclaim credits for decrypted reads with no matching mid Greg Kroah-Hartman
` (781 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vernon Yang, Andrew Morton,
David Hildenbrand (Arm), Lorenzo Stoakes (ARM), Barry Song,
Dev Jain, Lance Yang, Ryan Roberts, Zach OKeefe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vernon Yang <yanglincheng@kylinos.cn>
[ Upstream commit ba2f1f92ddfabd340c9248fd2380104f717ee8b1 ]
After the page table lock has dropped, the folio can be freed
concurrently. The trace_mm_khugepaged_scan_pmd() is left with a dangling
folio pointer.
So using the folio_pfn() before dropping the page table lock, closing
use-after-free window.
And other pre-existing bug, When the `for (i = 0; i < HPAGE_PMD_NR; i++)`
iteration to terminate and the folio operation preceding is normal, but
pfn will be incorrect. so we really only trace the PFN if it really was
problematic.
Link: https://lore.kernel.org/20260909025804.3233645-3-vernon2gm@gmail.com
Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")
Signed-off-by: Vernon Yang <yanglincheng@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Cc: Barry Song <baohua@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Cc: <stable@vger.kernel.org>
[ sashal: Replaced upstream's folio_pfn(folio) with folio_pfn(page_folio(page)) at the shared-PTE exit, since folio isn't assigned yet there, and kept the older function names and the tracepoint's writable argument. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/trace/events/huge_memory.h | 6 +++---
mm/khugepaged.c | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
index 23bd4c1f984e8..54a85638ab99f 100644
--- a/include/trace/events/huge_memory.h
+++ b/include/trace/events/huge_memory.h
@@ -53,10 +53,10 @@ SCAN_STATUS
TRACE_EVENT(mm_khugepaged_scan_pmd,
- TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
+ TP_PROTO(struct mm_struct *mm, unsigned long pfn, bool writable,
int referenced, int none_or_zero, int status, int unmapped),
- TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
+ TP_ARGS(mm, pfn, writable, referenced, none_or_zero, status, unmapped),
TP_STRUCT__entry(
__field(struct mm_struct *, mm)
@@ -70,7 +70,7 @@ TRACE_EVENT(mm_khugepaged_scan_pmd,
TP_fast_assign(
__entry->mm = mm;
- __entry->pfn = page ? page_to_pfn(page) : -1;
+ __entry->pfn = pfn;
__entry->writable = writable;
__entry->referenced = referenced;
__entry->none_or_zero = none_or_zero;
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index ba41de673bc15..fabbcf2d735d4 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1142,6 +1142,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
int none_or_zero = 0, shared = 0;
struct page *page = NULL;
struct folio *folio = NULL;
+ unsigned long failed_pfn = -1;
unsigned long _address;
spinlock_t *ptl;
int node = NUMA_NO_NODE, unmapped = 0;
@@ -1218,6 +1219,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
if (cc->is_khugepaged &&
shared > khugepaged_max_ptes_shared) {
result = SCAN_EXCEED_SHARED_PTE;
+ failed_pfn = folio_pfn(page_folio(page));
count_vm_event(THP_SCAN_EXCEED_SHARED_PTE);
goto out_unmap;
}
@@ -1233,19 +1235,23 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
node = folio_nid(folio);
if (hpage_collapse_scan_abort(node, cc)) {
result = SCAN_SCAN_ABORT;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
cc->node_load[node]++;
if (!folio_test_lru(folio)) {
result = SCAN_PAGE_LRU;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
if (folio_test_locked(folio)) {
result = SCAN_PAGE_LOCK;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
if (!folio_test_anon(folio)) {
result = SCAN_PAGE_ANON;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
@@ -1268,6 +1274,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
*/
if (!is_refcount_suitable(&folio->page)) {
result = SCAN_PAGE_COUNT;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
@@ -1299,7 +1306,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
*mmap_locked = false;
}
out:
- trace_mm_khugepaged_scan_pmd(mm, &folio->page, writable, referenced,
+ trace_mm_khugepaged_scan_pmd(mm, failed_pfn, writable, referenced,
none_or_zero, result, unmapped);
return result;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0218/1059] smb: client: reclaim credits for decrypted reads with no matching mid
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (216 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0217/1059] mm: khugepaged: fix folio is used after pte_unmap_unlock() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0219/1059] smb: client: reject FIND data areas that run past the received response Greg Kroah-Hartman
` (780 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 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
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 78f73985846465a25a7bd1d89904053661f3ca92 ]
When a decrypted SMB2 READ response carries a MessageId that matches no
outstanding request, both the inline receive_encrypted_read() and the
offloaded smb2_decrypt_offload() paths drop the frame without accounting
the credits the server granted in it. The plaintext unknown-frame path in
cifs_demultiplex_thread() already reclaims them with
smb2_add_credits_from_hdr(), so encrypted reads leak credits that the
plaintext path would not.
This also happens for legitimate frames - e.g. a reply that arrives after
the client has timed out and dropped the mid - so over a long-lived
connection the client's credit count drifts down and can eventually starve
it of the ability to issue requests. The frame is AEAD-authenticated, so
the granted credits in the decrypted header come from the real server and
are safe to apply.
Reclaim the credits from the decrypted header before dropping the frame,
and export smb2_add_credits_from_hdr() so the SMB2 receive paths can use it.
Fixes: c42a6abe3012 ("CIFS: Add capability to decrypt big read responses")
Fixes: 35cf94a39728 ("smb3: allow parallelizing decryption of reads")
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>
Cc: stable@vger.kernel.org
[ sashal: Context lines in the cifsproto.h prototype hunk were adjusted, since the older tree still uses extern prototypes, while the logic changes match the original. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsproto.h | 1 +
fs/smb/client/connect.c | 3 +--
fs/smb/client/smb2ops.c | 6 ++++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index 8cfa504e6bd83..7f462ba39a93d 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -160,6 +160,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
bool mark_smb_session);
extern int cifs_reconnect(struct TCP_Server_Info *server,
bool mark_smb_session);
+void smb2_add_credits_from_hdr(char *buffer, struct TCP_Server_Info *server);
extern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
extern bool is_valid_oplock_break(char *, struct TCP_Server_Info *);
extern bool backup_cred(struct cifs_sb_info *);
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 7895f0f4831e6..df8634228cbad 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -1163,8 +1163,7 @@ cifs_handle_standard(struct TCP_Server_Info *server, struct mid_q_entry *mid)
return 0;
}
-static void
-smb2_add_credits_from_hdr(char *buffer, struct TCP_Server_Info *server)
+void smb2_add_credits_from_hdr(char *buffer, struct TCP_Server_Info *server)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buffer;
int scredits, in_flight;
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 17a44992667c2..20a166e1a5b52 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -5113,9 +5113,10 @@ static void smb2_decrypt_offload(struct work_struct *work)
dw->server->lstrp = jiffies;
mid = smb2_find_dequeue_mid(dw->server, dw->buf);
- if (mid == NULL)
+ if (mid == NULL) {
cifs_dbg(FYI, "mid not found\n");
- else {
+ smb2_add_credits_from_hdr(dw->buf, dw->server);
+ } else {
mid->decrypted = true;
rc = handle_read_data(dw->server, mid, dw->buf,
dw->server->vals->read_rsp_size,
@@ -5245,6 +5246,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid,
*mid = smb2_find_mid(server, buf);
if (*mid == NULL) {
cifs_dbg(FYI, "mid not found\n");
+ smb2_add_credits_from_hdr(buf, server);
rc = -1;
} else {
cifs_dbg(FYI, "mid found\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0219/1059] smb: client: reject FIND data areas that run past the received response
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (217 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0218/1059] smb: client: reclaim credits for decrypted reads with no matching mid Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0220/1059] smb: client: reject short SESSION_SETUP responses Greg Kroah-Hartman
` (779 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Diego Oliva, David Howells,
Paulo Alcantara, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diego Oliva <diego@bynar.io>
[ Upstream commit 29bd6773187cb5c1bbbdf90d677c6add7d58af26 ]
CIFSFindFirst() and CIFSFindNext() take the directory entries of a
TRANS2_FIND_FIRST2 or TRANS2_FIND_NEXT2 response from DataOffset for
DataCount bytes. validate_t2() bounds DataOffset at 1024 and
ParameterCount + DataCount by the byte count, and nothing compares
DataOffset + DataCount with the number of bytes SendReceive() copied
into the buffer.
smb_init() places the request and the response in the same
cifs_request allocation and cifs_buf_get() clears only the start of
it, so a short response whose data area extends past its end has
srch_entries_start point at bytes of the request that was just sent,
or at whatever the allocation held before, and those bytes are parsed
as directory entries. cifs_readdir() and find_cifs_entry() walk the
entries with nxt_dir_entry(), which checks every entry but the first
of a response against the end of the SMB; cifs_query_path_info() and
cifs_backup_query_path_info() read the first entry with no check at
all. Those reads stay inside the allocation, but what they return is
not part of the response. The last entry, which LastNameOffset locates
relative to the data area, is bounded against the received response
by an earlier patch of this series, as is every entry that
cifs_fill_dirent() parses; the walk itself and the two query functions
are not.
SMB1 is not negotiated by default; reaching this code requires an
explicit vers=1.0 mount.
Reject a response whose data area extends past the received length,
with the -EINVAL that validate_t2() returns for the other malformed
transaction responses. cifs_query_path_info() and
cifs_backup_query_path_info() still read a whole entry from a data
area that may be smaller than one; that is not changed here.
A conforming server is not affected. The data block of a transaction
response is part of the SMB, so DataOffset + DataCount cannot exceed
the smbCalcSize() bytes that SendReceive() copies; coalesce_t2()
appends each secondary response to the data area and adds its length
to both DataCount and the byte count, which keeps that relation.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: Bynario AI
Signed-off-by: Diego Oliva <diego@bynar.io>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
[ sashal: Dropped the in_len references from the declaration hunks in both find functions, since that local doesn't exist here, and left the rest identical to upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifssmb.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index a64a1f44300c4..3ab798341f0f0 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -3910,8 +3910,9 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
/* level 257 SMB_ */
TRANSACTION2_FFIRST_REQ *pSMB = NULL;
TRANSACTION2_FFIRST_RSP *pSMBr = NULL;
- T2_FFIRST_RSP_PARMS *parms;
+ unsigned int data_off, data_count;
struct nls_table *nls_codepage;
+ T2_FFIRST_RSP_PARMS *parms;
unsigned int lnoff;
__u16 params, byte_count;
int bytes_returned = 0;
@@ -4030,11 +4031,19 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
return rc;
}
+ data_off = le16_to_cpu(pSMBr->t2.DataOffset);
+ data_count = le16_to_cpu(pSMBr->t2.DataCount);
+ if (data_off + data_count > (unsigned int)bytes_returned) {
+ cifs_dbg(VFS, "%s: data area offset %u count %u past response length %d\n",
+ __func__, data_off, data_count, bytes_returned);
+ cifs_buf_release(pSMB);
+ return -EINVAL;
+ }
+
psrch_inf->unicode = !!(pSMBr->hdr.Flags2 & SMBFLG2_UNICODE);
psrch_inf->ntwrk_buf_start = (char *)pSMBr;
psrch_inf->smallBuf = false;
- psrch_inf->srch_entries_start = (char *)&pSMBr->hdr.Protocol +
- le16_to_cpu(pSMBr->t2.DataOffset);
+ psrch_inf->srch_entries_start = (char *)&pSMBr->hdr.Protocol + data_off;
parms = (T2_FFIRST_RSP_PARMS *)((char *)&pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->t2.ParameterOffset));
@@ -4067,6 +4076,7 @@ int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
{
TRANSACTION2_FNEXT_REQ *pSMB = NULL;
TRANSACTION2_FNEXT_RSP *pSMBr = NULL;
+ unsigned int data_off, data_count;
T2_FNEXT_RSP_PARMS *parms;
unsigned int name_len;
unsigned int lnoff;
@@ -4151,13 +4161,22 @@ int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
cifs_buf_release(pSMB);
return rc;
}
+
+ data_off = le16_to_cpu(pSMBr->t2.DataOffset);
+ data_count = le16_to_cpu(pSMBr->t2.DataCount);
+ if (data_off + data_count > (unsigned int)bytes_returned) {
+ cifs_dbg(VFS, "%s: data area offset %u count %u past response length %d\n",
+ __func__, data_off, data_count, bytes_returned);
+ cifs_buf_release(pSMB);
+ return -EINVAL;
+ }
+
/* BB fixme add lock for file (srch_info) struct here */
psrch_inf->unicode = !!(pSMBr->hdr.Flags2 & SMBFLG2_UNICODE);
response_data = (char *)&pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->t2.ParameterOffset);
parms = (T2_FNEXT_RSP_PARMS *)response_data;
- response_data = (char *)&pSMBr->hdr.Protocol +
- le16_to_cpu(pSMBr->t2.DataOffset);
+ response_data = (char *)&pSMBr->hdr.Protocol + data_off;
if (psrch_inf->smallBuf)
cifs_small_buf_release(psrch_inf->ntwrk_buf_start);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0220/1059] smb: client: reject short SESSION_SETUP responses
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (218 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0219/1059] smb: client: reject FIND data areas that run past the received response Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0221/1059] rxrpc: Fix lack of short-send handling in rxrpc_kernel_send_data() Greg Kroah-Hartman
` (778 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abdifatah Suruur, Namjae Jeon,
Paulo Alcantara, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <suruurism@gmail.com>
[ Upstream commit 4d8930afa3446041358a7db33e7b23a0bb9459b5 ]
smb2_check_message() accepts frames shorter than struct smb2_pdu when
the SMB2 status is non-zero, before the minimum-PDU check added by
b4694f269e66d. A 64-byte STATUS_MORE_PROCESSING_REQUIRED SESSION_SETUP
response is therefore accepted even though it cannot contain the
SecurityBufferOffset and SecurityBufferLength fields.
The parser then reads those fields from stale bytes left in the reused
receive buffer by an earlier frame. With a long stale
SecurityBufferLength, decode_ntlmssp_challenge() copies up to about
64 KB from beyond the receive object and sends the data back to the
server in the NTLMv2 AUTHENTICATE target info.
Reject short MPR SESSION_SETUP responses before the short-error path,
and validate SecurityBufferOffset + SecurityBufferLength against the
received response length before decoding the challenge.
The ordering bypass is not new: the short-error early return predates
b4694f269e66d, and the unvalidated SecurityBufferLength read predates
the 2016 raw NTLMSSP split in 166cea4dc3a4, so all supported stable
trees are affected. Reproduced on 6.6.87.2; the path is unchanged on
mainline.
Fixes: 5478f9ba9a34 ("CIFS: Add session setup/logoff capability for SMB2")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/smb2misc.c | 16 ++++++++++++++++
fs/smb/client/smb2pdu.c | 18 ++++++++++++------
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/fs/smb/client/smb2misc.c b/fs/smb/client/smb2misc.c
index 27d0fc56cd825..531fd0b6eeaef 100644
--- a/fs/smb/client/smb2misc.c
+++ b/fs/smb/client/smb2misc.c
@@ -193,6 +193,22 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server)
return 1;
}
+ /*
+ * A SESSION_SETUP response that asks for more processing carries a
+ * security blob and is parsed as a normal reply. Do not let the
+ * short-error path below accept a frame that cannot hold the fixed
+ * response fields; the minimum-PDU check later is unreachable once
+ * the early return has accepted the frame.
+ */
+ if (command == SMB2_SESSION_SETUP_HE &&
+ shdr->Status == STATUS_MORE_PROCESSING_REQUIRED &&
+ len < sizeof(struct smb2_sess_setup_rsp)) {
+ cifs_server_dbg(VFS,
+ "%s: session setup response too short: %u < %zu\n",
+ __func__, len, sizeof(struct smb2_sess_setup_rsp));
+ return 1;
+ }
+
if (len < pdu_size) {
if ((len >= hdr_size)
&& (shdr->Status != 0)) {
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 75942195b619c..82052c5a0ea43 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -1657,15 +1657,21 @@ SMB2_sess_auth_rawntlmssp_negotiate(struct SMB2_sess_data *sess_data)
if (rc)
goto out;
- if (offsetof(struct smb2_sess_setup_rsp, Buffer) !=
- le16_to_cpu(rsp->SecurityBufferOffset)) {
- cifs_dbg(VFS, "Invalid security buffer offset %d\n",
- le16_to_cpu(rsp->SecurityBufferOffset));
+ u16 boff = le16_to_cpu(rsp->SecurityBufferOffset);
+ u16 blen = le16_to_cpu(rsp->SecurityBufferLength);
+
+ if (offsetof(struct smb2_sess_setup_rsp, Buffer) != boff) {
+ cifs_dbg(VFS, "Invalid security buffer offset %d\n", boff);
rc = -EIO;
goto out;
}
- rc = decode_ntlmssp_challenge(rsp->Buffer,
- le16_to_cpu(rsp->SecurityBufferLength), ses);
+ if ((u32)boff + blen > sess_data->iov[0].iov_len) {
+ cifs_dbg(VFS, "%s: invalid security buffer length: %u\n",
+ __func__, blen);
+ rc = -EINVAL;
+ goto out;
+ }
+ rc = decode_ntlmssp_challenge(rsp->Buffer, blen, ses);
if (rc)
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0221/1059] rxrpc: Fix lack of short-send handling in rxrpc_kernel_send_data()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (219 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0220/1059] smb: client: reject short SESSION_SETUP responses Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0222/1059] x86/cpuid: Mark CPUID function 0x23 as being indexed Greg Kroah-Hartman
` (777 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, David Howells,
Marc Dionne, Eric Dumazet, David S. Miller, Jakub Kicinski,
Paolo Abeni, Simon Horman, linux-afs, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <dhowells@redhat.com>
[ Upstream commit af208f36ae22440cf6011a43cb3064fd525d85b4 ]
Fix rxrpc_kernel_send_data() to loop around if it detects a short send.
David Laight suggested doing it here rather than wrapping all the calls in
loops. Further, remove the len argument and use the iterator count instead
and return 0 on success, not the amount copied.
Note this is also a prerequisite for changing the way rxrpc_send_data()
works to return a short send rather than an error if some data was
buffered.
Fixes: 651350d10f93 ("[AF_RXRPC]: Add an interface to the AF_RXRPC module for the AFS filesystem to use")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260824091645.415423-1-dhowells%40redhat.com
Suggested-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261006133011.531806-5-dhowells@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Dropped the len argument from the rxrpc_kernel_send_data() callers, omitted the rxperf.c hunk since that file doesn't exist here, and added an -EIO return when a completed call has unsent data. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/networking/rxrpc.rst | 8 ++--
fs/afs/rxrpc.c | 8 ++--
include/net/af_rxrpc.h | 3 +-
net/rxrpc/sendmsg.c | 62 ++++++++++++++++++------------
4 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/Documentation/networking/rxrpc.rst b/Documentation/networking/rxrpc.rst
index 39494a6ea739c..3b4fef0ce7428 100644
--- a/Documentation/networking/rxrpc.rst
+++ b/Documentation/networking/rxrpc.rst
@@ -866,7 +866,6 @@ The kernel interface functions are as follows:
int rxrpc_kernel_send_data(struct socket *sock,
struct rxrpc_call *call,
struct msghdr *msg,
- size_t len,
rxrpc_notify_end_tx_t notify_end_rx);
This is used to supply either the request part of a client call or the
@@ -875,14 +874,17 @@ The kernel interface functions are as follows:
exclusively to in-kernel virtual addresses. msg.msg_flags may be given
MSG_MORE if there will be subsequent data sends for this call.
- The msg must not specify a destination address, control data or any flags
- other than MSG_MORE. len is the total amount of data to transmit.
+ msg must not specify a destination address, control data or any flags
+ other than MSG_MORE or MSG_WAITALL.
notify_end_rx can be NULL or it can be used to specify a function to be
called when the call changes state to end the Tx phase. This function is
called with the call-state spinlock held to prevent any reply or final ACK
from being delivered first.
+ It returns 0 if all the provided data has been buffered and a negative
+ error code on failure.
+
(#) Receive data from a call::
int rxrpc_kernel_recv_data(struct socket *sock,
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 501a98583e810..d60f0b573dd23 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -404,8 +404,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
msg.msg_controllen = 0;
msg.msg_flags = MSG_WAITALL | (call->write_iter ? MSG_MORE : 0);
- ret = rxrpc_kernel_send_data(call->net->socket, rxcall,
- &msg, call->request_size,
+ ret = rxrpc_kernel_send_data(call->net->socket, rxcall, &msg,
afs_notify_end_request_tx);
if (ret < 0)
goto error_do_abort;
@@ -417,7 +416,6 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
ret = rxrpc_kernel_send_data(call->net->socket,
call->rxcall, &msg,
- iov_iter_count(&msg.msg_iter),
afs_notify_end_request_tx);
*call->write_iter = msg.msg_iter;
@@ -869,7 +867,7 @@ void afs_send_empty_reply(struct afs_call *call)
msg.msg_controllen = 0;
msg.msg_flags = 0;
- ret = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, 0,
+ ret = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg,
afs_notify_end_reply_tx);
if (ret < 0) {
rxrpc_kernel_abort_call(net->socket, call->rxcall,
@@ -901,7 +899,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
msg.msg_controllen = 0;
msg.msg_flags = 0;
- n = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, len,
+ n = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg,
afs_notify_end_reply_tx);
if (n >= 0) {
/* Success */
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
index b69ca695935ce..70ea6f844d0ef 100644
--- a/include/net/af_rxrpc.h
+++ b/include/net/af_rxrpc.h
@@ -50,8 +50,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
enum rxrpc_interruptibility,
unsigned int);
int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
- struct msghdr *, size_t,
- rxrpc_notify_end_tx_t);
+ struct msghdr *, rxrpc_notify_end_tx_t);
int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
struct iov_iter *, size_t *, bool, u32 *, u16 *);
bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 28cd9fe93844e..4b5ee70433039 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -781,7 +781,6 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
* @sock: The socket the call is on
* @call: The call to send data through
* @msg: The data to send
- * @len: The amount of data to send
* @notify_end_tx: Notification that the last packet is queued.
*
* Allow a kernel service to send data on a call. The call must be in an state
@@ -790,8 +789,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
* more data to come, otherwise this data will end the transmission phase.
*/
int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,
- struct msghdr *msg, size_t len,
- rxrpc_notify_end_tx_t notify_end_tx)
+ struct msghdr *msg, rxrpc_notify_end_tx_t notify_end_tx)
{
int ret;
@@ -800,31 +798,47 @@ int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,
ASSERTCMP(msg->msg_name, ==, NULL);
ASSERTCMP(msg->msg_control, ==, NULL);
- mutex_lock(&call->user_mutex);
+ for (;;) {
+ mutex_lock(&call->user_mutex);
- _debug("CALL %d USR %lx ST %d on CONN %p",
- call->debug_id, call->user_call_ID, call->state, call->conn);
-
- switch (READ_ONCE(call->state)) {
- case RXRPC_CALL_CLIENT_SEND_REQUEST:
- case RXRPC_CALL_SERVER_ACK_REQUEST:
- case RXRPC_CALL_SERVER_SEND_REPLY:
- ret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg, len,
- notify_end_tx);
- goto out;
- case RXRPC_CALL_COMPLETE:
- read_lock_bh(&call->state_lock);
- ret = call->error;
- read_unlock_bh(&call->state_lock);
- break;
- default:
- /* Request phase complete for this client call */
- trace_rxrpc_rx_eproto(call, 0, tracepoint_string("late_send"));
- ret = -EPROTO;
+ _debug("CALL %d USR %lx ST %d on CONN %p",
+ call->debug_id, call->user_call_ID, call->state, call->conn);
+
+ switch (READ_ONCE(call->state)) {
+ case RXRPC_CALL_CLIENT_SEND_REQUEST:
+ case RXRPC_CALL_SERVER_ACK_REQUEST:
+ case RXRPC_CALL_SERVER_SEND_REPLY:
+ ret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg,
+ msg_data_left(msg), notify_end_tx);
+ if (ret < 0)
+ goto out;
+ if (msg_data_left(msg) == 0) {
+ ret = 0;
+ goto out;
+ }
+ if (ret == 0) {
+ ret = -EIO;
+ goto out;
+ }
+ continue;
+ case RXRPC_CALL_COMPLETE:
+ read_lock_bh(&call->state_lock);
+ ret = call->error;
+ read_unlock_bh(&call->state_lock);
+ if (!ret && msg_data_left(msg))
+ ret = -EIO;
+ break;
+ default:
+ /* Request phase complete for this client call */
+ trace_rxrpc_rx_eproto(call, 0, tracepoint_string("late_send"));
+ ret = -EPROTO;
+ break;
+ }
+
+ mutex_unlock(&call->user_mutex);
break;
}
- mutex_unlock(&call->user_mutex);
out:
_leave(" = %d", ret);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0222/1059] x86/cpuid: Mark CPUID function 0x23 as being indexed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (220 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0221/1059] rxrpc: Fix lack of short-send handling in rxrpc_kernel_send_data() Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0223/1059] KVM: VMX: Formally define KVMs "0xdead" exit reason used for failed VM-Enter Greg Kroah-Hartman
` (776 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rick Edgecombe, Sean Christopherson,
Borislav Petkov (AMD), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <seanjc@google.com>
[ Upstream commit 108775fa28fe04a16f19a828a779689f3d0ea9f0 ]
Add function 0x23 to the set of CPUID functions that are indexed, as per
the SDM and the many sub-leafs defined in leaf_types.h.
Closes: https://lore.kernel.org/all/213d614fe73e183a230c8f4e0c8fa1cc3d45df39.camel@intel.com
Reported-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261022210134.612848-2-seanjc@google.com
[ sashal: Applied the one-line case 0x23: addition to cpuid_function_is_indexed() in arch/x86/include/asm/cpuid.h because the cpuid/api.h header split is absent, with no case 0x24: context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/include/asm/cpuid.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/include/asm/cpuid.h b/arch/x86/include/asm/cpuid.h
index 70b2db18165eb..b8309b8aeb3cd 100644
--- a/arch/x86/include/asm/cpuid.h
+++ b/arch/x86/include/asm/cpuid.h
@@ -24,6 +24,7 @@ static __always_inline bool cpuid_function_is_indexed(u32 function)
case 0x1d:
case 0x1e:
case 0x1f:
+ case 0x23:
case 0x8000001d:
return true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0223/1059] KVM: VMX: Formally define KVMs "0xdead" exit reason used for failed VM-Enter
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (221 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0222/1059] x86/cpuid: Mark CPUID function 0x23 as being indexed Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0224/1059] fs: make sure to call fsnotify_inoderemove() only once when inode is dead Greg Kroah-Hartman
` (775 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiaoyao Li, Yan Zhao, Binbin Wu,
Rick Edgecombe, Sean Christopherson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <seanjc@google.com>
[ Upstream commit d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7 ]
Add EXIT_REASON_UNDEFINED to track KVM's magic "0xdead" value that's used
to stuff the exit reason on a failed VM-Enter so that the magic can be
reused by TDX, and to make it more obvious that it's an arbitrary, KVM-
defined value (though the whole "dead" thing makes it pretty darn obvious).
Opportunistically add a compile-time assert to ensure the KVM-defined exit
reason never collides with a "real" exit reason.
No functional change intended.
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Yan Zhao <yan.y.zhao@intel.com>
Cc: Binbin Wu <binbin.wu@linux.intel.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://patch.msgid.link/20260921235656.1107929-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
[ sashal: Adapted the vmx.h define placement and moved the 0xdead replacement into vmx_vcpu_run() with vmx->exit_reason.full, since vmx_vcpu_enter_exit() and vmx->vt don't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/include/asm/vmx.h | 8 ++++++++
arch/x86/kvm/vmx/vmx.c | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 498dc600bd5c8..0830867e08cb0 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -17,6 +17,14 @@
#include <uapi/asm/vmx.h>
#include <asm/vmxfeatures.h>
+/*
+ * UNDEFINED is a KVM-defined value used to indicate that the basic exit reason
+ * is undefined/invalid, e.g. on VM-Fail or if TDX never attempted VM-Enter.
+ * The value itself is arbitrary, it just needs to not collide with a real exit
+ * reason.
+ */
+#define EXIT_REASON_UNDEFINED 0xdead
+
#define VMCS_CONTROL_BIT(x) BIT(VMX_FEATURE_##x & 0x1f)
/*
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 9fa2eb33d54d1..9f916cf791f54 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6085,6 +6085,8 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
static const int kvm_vmx_max_exit_handlers =
ARRAY_SIZE(kvm_vmx_exit_handlers);
+static_assert(EXIT_REASON_UNDEFINED >= ARRAY_SIZE(kvm_vmx_exit_handlers));
+
static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u32 *reason,
u64 *info1, u64 *info2,
u32 *intr_info, u32 *error_code)
@@ -7338,7 +7340,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags)
vmx->idt_vectoring_info = 0;
if (unlikely(vmx->fail)) {
- vmx->exit_reason.full = 0xdead;
+ vmx->exit_reason.full = EXIT_REASON_UNDEFINED;
return EXIT_FASTPATH_NONE;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0224/1059] fs: make sure to call fsnotify_inoderemove() only once when inode is dead
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (222 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0223/1059] KVM: VMX: Formally define KVMs "0xdead" exit reason used for failed VM-Enter Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0225/1059] media: microchip-isc: disable histogram and flush AWB work on teardown Greg Kroah-Hartman
` (774 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Amir Goldstein, Jan Kara,
Christian Brauner (Amutable), Sasha Levin, Daehyeon Ko
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit 669bb5af15d41a21359d00a441490f87a88eb52a ]
Daehyeon reported a race wherein fsnotify_removeinode() can be called
when inode still has a live alias. This can lead to several undesired
outcomes such as crashes in fsnotify code or avoidance of inode mark
notifications.
Check that inode is really "dead", meaning no nlink and no more aliases
before calling fsnotify_inoderemove() for final cleanup of inode marks.
Also do not allow open_by_handle() to add new aliases to a "dead" inode.
Ideally, we'd call fsnotify_inoderemove() once last inode reference is
dropped to make things simpler. Alas fsnotify inode marks currently hold
inode references and thus this doesn't work. Once we teach fsnotify to
avoid holding inode references, these games with dead inodes can go as
well.
Reported-and-tested-by: Daehyeon Ko <4ncienth@gmail.com>
Closes: https://lore.kernel.org/linux-fsdevel/20260827045007.3831259-1-4ncienth@gmail.com/
CC: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260902164924.1333135-2-jack@suse.cz
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Moved the alias recheck from __d_obtain_alias() into __d_instantiate_anon() and adapted context lines to the older dcache (d_u.d_rcu, hlist_del_init of d_u.d_alias, no waiters). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/dcache.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index a03646aff093d..5065c16af16d4 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -381,6 +381,17 @@ static void dentry_free(struct dentry *dentry)
call_rcu(&dentry->d_u.d_rcu, __d_free);
}
+/*
+ * If inode is unlinked and doesn't have any aliases (i.e., all fds pointing to
+ * it are closed), it is pretty much dead. Except that file handle lookup could
+ * still revive it which causes issues to fsnotify. So once inode reaches this
+ * state we make sure to block creating any new aliases.
+ */
+static bool inode_notify_dead(struct inode *inode)
+{
+ return !inode->i_nlink && hlist_empty(&inode->i_dentry);
+}
+
/*
* Release the dentry's inode, using the filesystem
* d_iput() operation if defined.
@@ -390,14 +401,16 @@ static void dentry_unlink_inode(struct dentry * dentry)
__releases(dentry->d_inode->i_lock)
{
struct inode *inode = dentry->d_inode;
+ bool notify_dead;
raw_write_seqcount_begin(&dentry->d_seq);
__d_clear_type_and_inode(dentry);
hlist_del_init(&dentry->d_u.d_alias);
raw_write_seqcount_end(&dentry->d_seq);
+ notify_dead = inode_notify_dead(inode);
spin_unlock(&dentry->d_lock);
spin_unlock(&inode->i_lock);
- if (!inode->i_nlink)
+ if (notify_dead)
fsnotify_inoderemove(inode);
if (dentry->d_op && dentry->d_op->d_iput)
dentry->d_op->d_iput(dentry, inode);
@@ -2096,7 +2109,10 @@ static struct dentry *__d_instantiate_anon(struct dentry *dentry,
security_d_instantiate(dentry, inode);
spin_lock(&inode->i_lock);
- res = __d_find_any_alias(inode);
+ if (!inode_notify_dead(inode))
+ res = __d_find_any_alias(inode);
+ else
+ res = ERR_PTR(-ESTALE);
if (res) {
spin_unlock(&inode->i_lock);
dput(dentry);
@@ -2143,7 +2159,12 @@ static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected)
if (IS_ERR(inode))
return ERR_CAST(inode);
- res = d_find_any_alias(inode);
+ spin_lock(&inode->i_lock);
+ if (!inode_notify_dead(inode))
+ res = __d_find_any_alias(inode); /* existing alias? */
+ else
+ res = ERR_PTR(-ESTALE);
+ spin_unlock(&inode->i_lock);
if (res)
goto out_iput;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0225/1059] media: microchip-isc: disable histogram and flush AWB work on teardown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (223 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0224/1059] fs: make sure to call fsnotify_inoderemove() only once when inode is dead Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0226/1059] crypto: omap-des - fix crypto engine cleanup Greg Kroah-Hartman
` (773 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Balakrishnan Sambath, Eugen Hristev,
Hans Verkuil, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Balakrishnan Sambath <balakrishnan.s@microchip.com>
[ Upstream commit 00d87c379915a3689b2488bd37f490875d79e20f ]
isc_stop_streaming() and the isc_start_streaming() error path dropped the
runtime PM reference with the histogram still enabled. A HISDONE firing
just before the stop, or a failed isc_update_profile() on the start path,
can queue isc_awb_work(), which reads the histogram registers before
taking its own PM reference and faults on the unclocked device.
Disable the histogram, synchronize the IRQ and flush the work before the
device is left unclocked. isc_configure() is the one enabling the
histogram and then calling isc_update_profile(), so do the cleanup in its
own failure path; isc_stop_streaming() does the same on teardown.
synchronize_irq() must come before cancel_work_sync(), so an in-flight
handler cannot re-queue awb_work after it is cancelled.
Fixes: 93d4a26c3dab ("[media] atmel-isc: add the isc pipeline function")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/atmel/atmel-isc-base.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
index 7ebd2f1cad9ae..db57077ecc31c 100644
--- a/drivers/media/platform/atmel/atmel-isc-base.c
+++ b/drivers/media/platform/atmel/atmel-isc-base.c
@@ -300,6 +300,7 @@ static int isc_configure(struct isc_device *isc)
struct regmap *regmap = isc->regmap;
u32 pfe_cfg0, dcfg, mask, pipeline;
struct isc_subdev_entity *subdev = isc->current_subdev;
+ int ret;
pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps;
pipeline = isc->config.bits_pipeline;
@@ -332,7 +333,15 @@ static int isc_configure(struct isc_device *isc)
isc_set_histogram(isc, false);
/* Update profile */
- return isc_update_profile(isc);
+ ret = isc_update_profile(isc);
+ if (ret) {
+ /* flush the histogram work before the clocks are gated */
+ isc_set_histogram(isc, false);
+ synchronize_irq(isc->irq);
+ cancel_work_sync(&isc->awb_work);
+ }
+
+ return ret;
}
static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -423,9 +432,13 @@ static void isc_stop_streaming(struct vb2_queue *vq)
/* Disable DMA interrupt */
regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE);
+ isc_set_histogram(isc, false);
+
/* let a running IRQ handler finish before the clock is disabled */
synchronize_irq(isc->irq);
+ cancel_work_sync(&isc->awb_work);
+
pm_runtime_put_sync(isc->dev);
/* Disable stream on the sub device */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0226/1059] crypto: omap-des - fix crypto engine cleanup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (224 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0225/1059] media: microchip-isc: disable histogram and flush AWB work on teardown Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0227/1059] mm/memcontrol: fix data-race on reading jiffies_64 Greg Kroah-Hartman
` (772 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Herbert Xu,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
[ Upstream commit 5d69ed4cd4f9c68ff9a6ebb2e8a1079223a4ec6e ]
omap_des_probe() allocates and starts a crypto engine, but the remove
path does not call the matching crypto_engine_exit(). The probe failure
path already performs this cleanup.
crypto_engine_alloc_init() creates a kthread worker for processing
requests. Without crypto_engine_exit() during driver removal, the
worker is left running after the device is removed.
Call crypto_engine_exit() after unregistering the algorithms and before
tearing down the remaining request handling resources. This stops the
engine and destroys its worker.
This issue was found by manual code inspection.
Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Kept the branch's tasklet_kill(&dd->done_task) as context, since upstream's cancel_work_sync() and omap_des_unregister_algs() don't exist here, and added crypto_engine_exit() before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/omap-des.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index f783769ea1107..b699b31072cfa 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1100,6 +1100,8 @@ static int omap_des_remove(struct platform_device *pdev)
crypto_unregister_skcipher(
&dd->pdata->algs_info[i].algs_list[j]);
+ crypto_engine_exit(dd->engine);
+
tasklet_kill(&dd->done_task);
omap_des_dma_cleanup(dd);
pm_runtime_disable(dd->dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0227/1059] mm/memcontrol: fix data-race on reading jiffies_64
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (225 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0226/1059] crypto: omap-des - fix crypto engine cleanup Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:55 ` [PATCH 6.1 0228/1059] mm/memcontrol: fix typo in comment Greg Kroah-Hartman
` (771 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Andrew Morton,
syzbot+ced4d9a8cadb5ef3adae, Muchun Song, Johannes Weiner,
Michal Hocko, Chris Li, Jan Kara, Jens Axboe, Roman Gushchin,
Shakeel Butt, Tejun Heo, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit c20cf1c3c8cdd98618d6fcc794003a0e003ae858 ]
KCSAN reported a data-race between tick_do_update_jiffies64() updating
jiffies_64 and mem_cgroup_flush_stats_ratelimited() reading it directly.
Unlike jiffies, jiffies_64 is not volatile, so raw reads are plain
accesses and can even be torn on 32-bit. Use get_jiffies_64() instead,
and fix the same pattern in mem_cgroup_flush_foreign().
Link: https://lore.kernel.org/20260827025457.116191-1-jiayuan.chen@linux.dev
Fixes: 508bed884767 ("mm: memcg: change flush_next_time to flush_last_time")
Fixes: 97b27821b485 ("writeback, memcg: Implement foreign dirty flushing")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: syzbot+ced4d9a8cadb5ef3adae@syzkaller.appspotmail.com
Acked-by: Muchun Song <muchun.song@linux.dev>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Tejun Heo <tj@kernel.org>
Cc: <stable@vger.kernel.org>
[ sashal: Applied the same get_jiffies_64() conversion to the older flush_next_time code, which has no flush_last_time or READ_ONCE; dropped the cosmetic whitespace change. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/memcontrol.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4a841e2a4853c..ae060f1772b11 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -631,7 +631,7 @@ static void __mem_cgroup_flush_stats(void)
if (!spin_trylock_irqsave(&stats_flush_lock, flag))
return;
- flush_next_time = jiffies_64 + 2*FLUSH_TIME;
+ flush_next_time = get_jiffies_64() + 2*FLUSH_TIME;
cgroup_rstat_flush_irqsafe(root_mem_cgroup->css.cgroup);
atomic_set(&stats_flush_threshold, 0);
spin_unlock_irqrestore(&stats_flush_lock, flag);
@@ -645,7 +645,7 @@ void mem_cgroup_flush_stats(void)
void mem_cgroup_flush_stats_delayed(void)
{
- if (time_after64(jiffies_64, flush_next_time))
+ if (time_after64(get_jiffies_64(), flush_next_time))
mem_cgroup_flush_stats();
}
@@ -4732,7 +4732,7 @@ void mem_cgroup_flush_foreign(struct bdi_writeback *wb)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);
unsigned long intv = msecs_to_jiffies(dirty_expire_interval * 10);
- u64 now = jiffies_64;
+ u64 now = get_jiffies_64();
int i;
for (i = 0; i < MEMCG_CGWB_FRN_CNT; i++) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0228/1059] mm/memcontrol: fix typo in comment
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (226 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0227/1059] mm/memcontrol: fix data-race on reading jiffies_64 Greg Kroah-Hartman
@ 2026-12-04 9:55 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0229/1059] mm/page_counter: move calculating protection values to page_counter Greg Kroah-Hartman
` (770 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:55 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haifeng Xu, Johannes Weiner,
Michal Hocko, Roman Gushchin, Shakeel Butt, Andrew Morton,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haifeng Xu <haifeng.xu@shopee.com>
[ Upstream commit 08e0f49e9991b175f2cda7ba32a7e9f1320dcbad ]
Replace 'then' with 'than'.
Link: https://lkml.kernel.org/r/20230522095233.4246-1-haifeng.xu@shopee.com
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 7809ce47b056 ("mm/page_counter: avoid integer overflow in effective_protection()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ae060f1772b11..b85e9cee6f22f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6833,7 +6833,7 @@ static unsigned long effective_protection(unsigned long usage,
protected = min(usage, setting);
/*
* If all cgroups at this level combined claim and use more
- * protection then what the parent affords them, distribute
+ * protection than what the parent affords them, distribute
* shares in proportion to utilization.
*
* We are using actual utilization rather than the statically
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0229/1059] mm/page_counter: move calculating protection values to page_counter
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (227 preceding siblings ...)
2026-12-04 9:55 ` [PATCH 6.1 0228/1059] mm/memcontrol: fix typo in comment Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0230/1059] mm/page_counter: avoid integer overflow in effective_protection() Greg Kroah-Hartman
` (769 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maarten Lankhorst, Roman Gushchin,
Shakeel Butt, Michal Hocko, Johannes Weiner, Muchun Song,
Jeff Johnson, Andrew Morton, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
[ Upstream commit a8585ac68621983587f1701b7567978fcbcd9573 ]
It's a lot of math, and there is nothing memcontrol specific about it.
This makes it easier to use inside of the drm cgroup controller.
[akpm@linux-foundation.org: fix kerneldoc, per Jeff Johnson]
Link: https://lkml.kernel.org/r/20240703112510.36424-1-maarten.lankhorst@linux.intel.com
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 7809ce47b056 ("mm/page_counter: avoid integer overflow in effective_protection()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/page_counter.h | 4 +
mm/memcontrol.c | 154 +------------------------------
mm/page_counter.c | 173 +++++++++++++++++++++++++++++++++++
3 files changed, 180 insertions(+), 151 deletions(-)
diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h
index c141ea9a95ef8..d44a250a55742 100644
--- a/include/linux/page_counter.h
+++ b/include/linux/page_counter.h
@@ -81,4 +81,8 @@ static inline void page_counter_reset_watermark(struct page_counter *counter)
counter->watermark = page_counter_read(counter);
}
+void page_counter_calculate_protection(struct page_counter *root,
+ struct page_counter *counter,
+ bool recursive_protection);
+
#endif /* _LINUX_PAGE_COUNTER_H */
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b85e9cee6f22f..10c240d017790 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6778,122 +6778,6 @@ struct cgroup_subsys memory_cgrp_subsys = {
.early_init = 0,
};
-/*
- * This function calculates an individual cgroup's effective
- * protection which is derived from its own memory.min/low, its
- * parent's and siblings' settings, as well as the actual memory
- * distribution in the tree.
- *
- * The following rules apply to the effective protection values:
- *
- * 1. At the first level of reclaim, effective protection is equal to
- * the declared protection in memory.min and memory.low.
- *
- * 2. To enable safe delegation of the protection configuration, at
- * subsequent levels the effective protection is capped to the
- * parent's effective protection.
- *
- * 3. To make complex and dynamic subtrees easier to configure, the
- * user is allowed to overcommit the declared protection at a given
- * level. If that is the case, the parent's effective protection is
- * distributed to the children in proportion to how much protection
- * they have declared and how much of it they are utilizing.
- *
- * This makes distribution proportional, but also work-conserving:
- * if one cgroup claims much more protection than it uses memory,
- * the unused remainder is available to its siblings.
- *
- * 4. Conversely, when the declared protection is undercommitted at a
- * given level, the distribution of the larger parental protection
- * budget is NOT proportional. A cgroup's protection from a sibling
- * is capped to its own memory.min/low setting.
- *
- * 5. However, to allow protecting recursive subtrees from each other
- * without having to declare each individual cgroup's fixed share
- * of the ancestor's claim to protection, any unutilized -
- * "floating" - protection from up the tree is distributed in
- * proportion to each cgroup's *usage*. This makes the protection
- * neutral wrt sibling cgroups and lets them compete freely over
- * the shared parental protection budget, but it protects the
- * subtree as a whole from neighboring subtrees.
- *
- * Note that 4. and 5. are not in conflict: 4. is about protecting
- * against immediate siblings whereas 5. is about protecting against
- * neighboring subtrees.
- */
-static unsigned long effective_protection(unsigned long usage,
- unsigned long parent_usage,
- unsigned long setting,
- unsigned long parent_effective,
- unsigned long siblings_protected)
-{
- unsigned long protected;
- unsigned long ep;
-
- protected = min(usage, setting);
- /*
- * If all cgroups at this level combined claim and use more
- * protection than what the parent affords them, distribute
- * shares in proportion to utilization.
- *
- * We are using actual utilization rather than the statically
- * claimed protection in order to be work-conserving: claimed
- * but unused protection is available to siblings that would
- * otherwise get a smaller chunk than what they claimed.
- */
- if (siblings_protected > parent_effective)
- return protected * parent_effective / siblings_protected;
-
- /*
- * Ok, utilized protection of all children is within what the
- * parent affords them, so we know whatever this child claims
- * and utilizes is effectively protected.
- *
- * If there is unprotected usage beyond this value, reclaim
- * will apply pressure in proportion to that amount.
- *
- * If there is unutilized protection, the cgroup will be fully
- * shielded from reclaim, but we do return a smaller value for
- * protection than what the group could enjoy in theory. This
- * is okay. With the overcommit distribution above, effective
- * protection is always dependent on how memory is actually
- * consumed among the siblings anyway.
- */
- ep = protected;
-
- /*
- * If the children aren't claiming (all of) the protection
- * afforded to them by the parent, distribute the remainder in
- * proportion to the (unprotected) memory of each cgroup. That
- * way, cgroups that aren't explicitly prioritized wrt each
- * other compete freely over the allowance, but they are
- * collectively protected from neighboring trees.
- *
- * We're using unprotected memory for the weight so that if
- * some cgroups DO claim explicit protection, we don't protect
- * the same bytes twice.
- *
- * Check both usage and parent_usage against the respective
- * protected values. One should imply the other, but they
- * aren't read atomically - make sure the division is sane.
- */
- if (!(cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_RECURSIVE_PROT))
- return ep;
- if (parent_effective > siblings_protected &&
- parent_usage > siblings_protected &&
- usage > protected) {
- unsigned long unclaimed;
-
- unclaimed = parent_effective - siblings_protected;
- unclaimed *= usage - protected;
- unclaimed /= parent_usage - siblings_protected;
-
- ep += unclaimed;
- }
-
- return ep;
-}
-
/**
* mem_cgroup_calculate_protection - check if memory consumption is in the normal range
* @root: the top ancestor of the sub-tree being checked
@@ -6905,8 +6789,8 @@ static unsigned long effective_protection(unsigned long usage,
void mem_cgroup_calculate_protection(struct mem_cgroup *root,
struct mem_cgroup *memcg)
{
- unsigned long usage, parent_usage;
- struct mem_cgroup *parent;
+ bool recursive_protection =
+ cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_RECURSIVE_PROT;
if (mem_cgroup_disabled())
return;
@@ -6914,39 +6798,7 @@ void mem_cgroup_calculate_protection(struct mem_cgroup *root,
if (!root)
root = root_mem_cgroup;
- /*
- * Effective values of the reclaim targets are ignored so they
- * can be stale. Have a look at mem_cgroup_protection for more
- * details.
- * TODO: calculation should be more robust so that we do not need
- * that special casing.
- */
- if (memcg == root)
- return;
-
- usage = page_counter_read(&memcg->memory);
- if (!usage)
- return;
-
- parent = parent_mem_cgroup(memcg);
-
- if (parent == root) {
- memcg->memory.emin = READ_ONCE(memcg->memory.min);
- memcg->memory.elow = READ_ONCE(memcg->memory.low);
- return;
- }
-
- parent_usage = page_counter_read(&parent->memory);
-
- WRITE_ONCE(memcg->memory.emin, effective_protection(usage, parent_usage,
- READ_ONCE(memcg->memory.min),
- READ_ONCE(parent->memory.emin),
- atomic_long_read(&parent->memory.children_min_usage)));
-
- WRITE_ONCE(memcg->memory.elow, effective_protection(usage, parent_usage,
- READ_ONCE(memcg->memory.low),
- READ_ONCE(parent->memory.elow),
- atomic_long_read(&parent->memory.children_low_usage)));
+ page_counter_calculate_protection(&root->memory, &memcg->memory, recursive_protection);
}
static int charge_memcg(struct folio *folio, struct mem_cgroup *memcg,
diff --git a/mm/page_counter.c b/mm/page_counter.c
index db20d6452b715..0153f5bb31611 100644
--- a/mm/page_counter.c
+++ b/mm/page_counter.c
@@ -262,3 +262,176 @@ int page_counter_memparse(const char *buf, const char *max,
return 0;
}
+
+
+/*
+ * This function calculates an individual page counter's effective
+ * protection which is derived from its own memory.min/low, its
+ * parent's and siblings' settings, as well as the actual memory
+ * distribution in the tree.
+ *
+ * The following rules apply to the effective protection values:
+ *
+ * 1. At the first level of reclaim, effective protection is equal to
+ * the declared protection in memory.min and memory.low.
+ *
+ * 2. To enable safe delegation of the protection configuration, at
+ * subsequent levels the effective protection is capped to the
+ * parent's effective protection.
+ *
+ * 3. To make complex and dynamic subtrees easier to configure, the
+ * user is allowed to overcommit the declared protection at a given
+ * level. If that is the case, the parent's effective protection is
+ * distributed to the children in proportion to how much protection
+ * they have declared and how much of it they are utilizing.
+ *
+ * This makes distribution proportional, but also work-conserving:
+ * if one counter claims much more protection than it uses memory,
+ * the unused remainder is available to its siblings.
+ *
+ * 4. Conversely, when the declared protection is undercommitted at a
+ * given level, the distribution of the larger parental protection
+ * budget is NOT proportional. A counter's protection from a sibling
+ * is capped to its own memory.min/low setting.
+ *
+ * 5. However, to allow protecting recursive subtrees from each other
+ * without having to declare each individual counter's fixed share
+ * of the ancestor's claim to protection, any unutilized -
+ * "floating" - protection from up the tree is distributed in
+ * proportion to each counter's *usage*. This makes the protection
+ * neutral wrt sibling cgroups and lets them compete freely over
+ * the shared parental protection budget, but it protects the
+ * subtree as a whole from neighboring subtrees.
+ *
+ * Note that 4. and 5. are not in conflict: 4. is about protecting
+ * against immediate siblings whereas 5. is about protecting against
+ * neighboring subtrees.
+ */
+static unsigned long effective_protection(unsigned long usage,
+ unsigned long parent_usage,
+ unsigned long setting,
+ unsigned long parent_effective,
+ unsigned long siblings_protected,
+ bool recursive_protection)
+{
+ unsigned long protected;
+ unsigned long ep;
+
+ protected = min(usage, setting);
+ /*
+ * If all cgroups at this level combined claim and use more
+ * protection than what the parent affords them, distribute
+ * shares in proportion to utilization.
+ *
+ * We are using actual utilization rather than the statically
+ * claimed protection in order to be work-conserving: claimed
+ * but unused protection is available to siblings that would
+ * otherwise get a smaller chunk than what they claimed.
+ */
+ if (siblings_protected > parent_effective)
+ return protected * parent_effective / siblings_protected;
+
+ /*
+ * Ok, utilized protection of all children is within what the
+ * parent affords them, so we know whatever this child claims
+ * and utilizes is effectively protected.
+ *
+ * If there is unprotected usage beyond this value, reclaim
+ * will apply pressure in proportion to that amount.
+ *
+ * If there is unutilized protection, the cgroup will be fully
+ * shielded from reclaim, but we do return a smaller value for
+ * protection than what the group could enjoy in theory. This
+ * is okay. With the overcommit distribution above, effective
+ * protection is always dependent on how memory is actually
+ * consumed among the siblings anyway.
+ */
+ ep = protected;
+
+ /*
+ * If the children aren't claiming (all of) the protection
+ * afforded to them by the parent, distribute the remainder in
+ * proportion to the (unprotected) memory of each cgroup. That
+ * way, cgroups that aren't explicitly prioritized wrt each
+ * other compete freely over the allowance, but they are
+ * collectively protected from neighboring trees.
+ *
+ * We're using unprotected memory for the weight so that if
+ * some cgroups DO claim explicit protection, we don't protect
+ * the same bytes twice.
+ *
+ * Check both usage and parent_usage against the respective
+ * protected values. One should imply the other, but they
+ * aren't read atomically - make sure the division is sane.
+ */
+ if (!recursive_protection)
+ return ep;
+
+ if (parent_effective > siblings_protected &&
+ parent_usage > siblings_protected &&
+ usage > protected) {
+ unsigned long unclaimed;
+
+ unclaimed = parent_effective - siblings_protected;
+ unclaimed *= usage - protected;
+ unclaimed /= parent_usage - siblings_protected;
+
+ ep += unclaimed;
+ }
+
+ return ep;
+}
+
+
+/**
+ * page_counter_calculate_protection - check if memory consumption is in the normal range
+ * @root: the top ancestor of the sub-tree being checked
+ * @counter: the page_counter the counter to update
+ * @recursive_protection: Whether to use memory_recursiveprot behavior.
+ *
+ * Calculates elow/emin thresholds for given page_counter.
+ *
+ * WARNING: This function is not stateless! It can only be used as part
+ * of a top-down tree iteration, not for isolated queries.
+ */
+void page_counter_calculate_protection(struct page_counter *root,
+ struct page_counter *counter,
+ bool recursive_protection)
+{
+ unsigned long usage, parent_usage;
+ struct page_counter *parent = counter->parent;
+
+ /*
+ * Effective values of the reclaim targets are ignored so they
+ * can be stale. Have a look at mem_cgroup_protection for more
+ * details.
+ * TODO: calculation should be more robust so that we do not need
+ * that special casing.
+ */
+ if (root == counter)
+ return;
+
+ usage = page_counter_read(counter);
+ if (!usage)
+ return;
+
+ if (parent == root) {
+ counter->emin = READ_ONCE(counter->min);
+ counter->elow = READ_ONCE(counter->low);
+ return;
+ }
+
+ parent_usage = page_counter_read(parent);
+
+ WRITE_ONCE(counter->emin, effective_protection(usage, parent_usage,
+ READ_ONCE(counter->min),
+ READ_ONCE(parent->emin),
+ atomic_long_read(&parent->children_min_usage),
+ recursive_protection));
+
+ WRITE_ONCE(counter->elow, effective_protection(usage, parent_usage,
+ READ_ONCE(counter->low),
+ READ_ONCE(parent->elow),
+ atomic_long_read(&parent->children_low_usage),
+ recursive_protection));
+}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0230/1059] mm/page_counter: avoid integer overflow in effective_protection()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (228 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0229/1059] mm/page_counter: move calculating protection values to page_counter Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0231/1059] serial: sc16is7xx: fix data corruption due to unexpected xon/xoff Greg Kroah-Hartman
` (768 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Barry Song, Johannes Weiner,
Ridong Chen, Andrew Morton, Axel Rasmussen, Chris Down,
David Hildenbrand, Kairui Song, Lorenzo Stoakes, Michal Hocko,
Muchun Song, Roman Gushchin, Shakeel Butt, Tejun Heo, Wei Xu,
Yuanchu Xie, Yu Zhao, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ridong Chen <chenridong@xiaomi.com>
[ Upstream commit 7809ce47b05671e1fa6d74bead892d6ad6c1403b ]
Patch series "mm/mglru: fix ineffective memory protection for non-kswapd
reclaim", v4.
For MGLRU, memory.min/low is not honored during non-kswapd global reclaim
(global direct reclaim and root-level memory.reclaim), because these paths
shrink memcgs using stale protection (emin/elow).
Patch 2 is the actual fix. Patch 1 is a prerequisite: an integer overflow
in effective_protection(), spotted by the sashiko review tool, which patch
2's new caller would also be exposed to.
This patch (of 2):
effective_protection() scales a parent's protection by a ratio of page
counts, e.g. for recursive protection:
(parent_effective - siblings_protected) * (usage - protected)
/ (parent_usage - siblings_protected)
The multiply is done at unsigned long width before dividing. On systems
with >= 16TB RAM the product can exceed 2^64 and wrap, giving a bogus
protection value and silently breaking memory.min/low enforcement.
Use mul_u64_u64_div_u64() to multiply in a 128-bit intermediate. Because
usage and parent_usage are not read atomically (a child is charged before
its parent), usage - protected can briefly exceed the divisor, making the
quotient overflow 64 bits and trap (#DE on x86). Cap it so the ratio
stays <= 1.
Reported by the sashiko review tool [1].
Link: https://lore.kernel.org/20260907025445.1836238-1-ridong.chen@linux.dev
Link: https://lore.kernel.org/20260907025445.1836238-2-ridong.chen@linux.dev
Link: https://sashiko.dev/#/patchset/20260826133054.88529-1-ridong.chen@linux.dev?part=1 [1]
Fixes: bc50bcc6e00b ("mm: memcontrol: clean up and document effective low/min calculations")
Fixes: 8a931f801340 ("mm: memcontrol: recursive memory.low protection")
Reviewed-by: Barry Song <baohua@kernel.org>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Assisted-by: Claude:claude-opus-4-8
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Chris Down <chris@chrisdown.name>
Cc: David Hildenbrand <david@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Tejun Heo <tj@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_counter.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/mm/page_counter.c b/mm/page_counter.c
index 0153f5bb31611..34f2a3ac1f32d 100644
--- a/mm/page_counter.c
+++ b/mm/page_counter.c
@@ -8,6 +8,7 @@
#include <linux/page_counter.h>
#include <linux/atomic.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/bug.h>
@@ -329,7 +330,8 @@ static unsigned long effective_protection(unsigned long usage,
* otherwise get a smaller chunk than what they claimed.
*/
if (siblings_protected > parent_effective)
- return protected * parent_effective / siblings_protected;
+ return mul_u64_u64_div_u64(protected, parent_effective,
+ siblings_protected);
/*
* Ok, utilized protection of all children is within what the
@@ -370,13 +372,20 @@ static unsigned long effective_protection(unsigned long usage,
if (parent_effective > siblings_protected &&
parent_usage > siblings_protected &&
usage > protected) {
- unsigned long unclaimed;
+ unsigned long parent_unclaimed, parent_unprotected, unprotected;
- unclaimed = parent_effective - siblings_protected;
- unclaimed *= usage - protected;
- unclaimed /= parent_usage - siblings_protected;
+ parent_unclaimed = parent_effective - siblings_protected;
+ parent_unprotected = parent_usage - siblings_protected;
- ep += unclaimed;
+ /*
+ * The usages aren't read atomically, so a child can transiently
+ * appear to use more than its parent, making the ratio exceed 1
+ * and the quotient overflow 64 bits (#DE on x86). Cap it.
+ */
+ unprotected = min(usage - protected, parent_unprotected);
+
+ ep += mul_u64_u64_div_u64(parent_unclaimed, unprotected,
+ parent_unprotected);
}
return ep;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0231/1059] serial: sc16is7xx: fix data corruption due to unexpected xon/xoff
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (229 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0230/1059] mm/page_counter: avoid integer overflow in effective_protection() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0232/1059] f2fs: read i_size once in f2fs_vm_page_mkwrite Greg Kroah-Hartman
` (767 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Martin Fuzzey, stable, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Fuzzey <martin.fuzzey@flowbird.group>
[ Upstream commit 8bb50e95c0abd44607bc60a43032c1dbf7470d5a ]
The hardware supports automatically sending XON/OFF based on the
FIFO status and that is already implemented by the driver.
However that capability was not announced with the UPF_SOFT_FLOW bit.
When the port is opened with the default of XON enabled the driver
configures that in the hardware.
If userspace does not want XON/OFF (which is normally the case) it will
use TCSETS to disactivate it. However the serial core optimises this
to only notify the driver if someting imporant has changed, and for
XON/XOFF thit is only if the driver declares UPF_SOFT_FLOW.
So we end up with unwanted XON/XOFF in the data stream.
The problem only occurs if nothing else needed to be set by termios,
ie if the user space requested values are the same as the default values,
except for XON/XOFF.
Since the default speed is 9600 this means that the problem only occurs
when requesting 9600, otherwise the call to the driver will be made to
change the speed, and that will also clear the XON/XOFF.
As 9600 is quite rare these days that probably explains why this hasn't
already been seen.
It also only occurs on the first port open after boot since the subsequent
opens will use the "logical state" set by TCSETS but not communicated to
the driver the first time.
Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Fixes: dfeae619d781 ("serial: sc16is7xx")
Cc: stable@kernel.org
Link: https://patch.msgid.link/20261001100534.1225894-1-martin.fuzzey@flowbird.group
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Added UPF_SOFT_FLOW to the inline port.flags assignment in sc16is7xx_probe(), since this tree has no sc16is7xx_setup_channel() helper. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/sc16is7xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index a5b5f879b0e98..ee4b76ce0b476 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1549,7 +1549,7 @@ static int sc16is7xx_probe(struct device *dev,
s->p[i].port.irq = irq;
s->p[i].port.type = PORT_SC16IS7XX;
s->p[i].port.fifosize = SC16IS7XX_FIFO_SIZE;
- s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY;
+ s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY | UPF_SOFT_FLOW;
s->p[i].port.iobase = i;
/*
* Use all ones as membase to make sure uart_configure_port() in
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0232/1059] f2fs: read i_size once in f2fs_vm_page_mkwrite
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (230 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0231/1059] serial: sc16is7xx: fix data corruption due to unexpected xon/xoff Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0233/1059] hwmon: (coretemp) Return -ENODATA for invalid temperature readings Greg Kroah-Hartman
` (766 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Nanzhe Zhao, Chao Yu,
Jaegeuk Kim, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
[ Upstream commit c04f209773ecb31e592cababce0d6658ee0b8d58 ]
f2fs_vm_page_mkwrite() reads i_size twice: once to check whether the
folio is partially beyond EOF, and once to calculate the offset for
folio_zero_segment(). But a concurrent buffered write can extend isize
and cause the following race condition to corrupt data:
buffered write writes [0,3500)
CPU0 (write fault) CPU1 (buffered write)
---- ----
f2fs_vm_page_mkwrite()
folio_lock(folio)
if (((loff_t)(folio->index + 1) << PAGE_SHIFT) >
i_size_read(inode))
/* i_size_read() = 3500 */
write(fd, buf, 200, 4096)
/* writes into page1, does not
wait for folio lock */
i_size_write(inode, 4296)
offset = i_size_read(inode) & ~PAGE_MASK
/* i_size_read() = 4296, offset = 200 */
folio_zero_segment(folio, offset, folio_size(folio))
/* valid data [200, 3500) is zeroed */
Fix this by reading i_size once and using the same value for both the
EOF check and the zeroing offset.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20261012030315.978375-1-zhaonanzhe%40xiaomi.com
Fixes: fbfa2cc58d53 ("f2fs: add file operations")
Cc: stable@vger.kernel.org
Signed-off-by: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
[ sashal: Adapted the fix to the page-based f2fs_vm_page_mkwrite() (lock_page, page_offset, zero_user_segment) instead of the folio API, with the need_alloc context line differing. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/f2fs/file.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index e94d30e397e2c..f1b1754fb4de4 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -58,6 +58,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct dnode_of_data dn;
bool need_alloc = true;
+ loff_t isize;
int err = 0;
if (unlikely(IS_IMMUTABLE(inode)))
@@ -115,8 +116,14 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
}
lock_page(page);
+ /*
+ * A concurrent buffered write can extend isize, so we store isize in a
+ * local variable to let the zeroing offset match the EOF check below.
+ */
+ isize = i_size_read(inode);
+
if (unlikely(page->mapping != inode->i_mapping ||
- page_offset(page) > i_size_read(inode) ||
+ page_offset(page) > isize ||
!PageUptodate(page))) {
unlock_page(page);
err = -EFAULT;
@@ -147,11 +154,10 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
f2fs_wait_on_block_writeback(inode, dn.data_blkaddr);
/* page is wholly or partially inside EOF */
- if (((loff_t)(page->index + 1) << PAGE_SHIFT) >
- i_size_read(inode)) {
+ if (((loff_t)(page->index + 1) << PAGE_SHIFT) > isize) {
loff_t offset;
- offset = i_size_read(inode) & ~PAGE_MASK;
+ offset = isize & ~PAGE_MASK;
zero_user_segment(page, offset, PAGE_SIZE);
}
set_page_dirty(page);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0233/1059] hwmon: (coretemp) Return -ENODATA for invalid temperature readings
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (231 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0232/1059] f2fs: read i_size once in f2fs_vm_page_mkwrite Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0234/1059] scsi: ufs: bsg: Complete the job on error Greg Kroah-Hartman
` (765 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guenter Roeck, Ricardo Neri,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
[ Upstream commit f63aaa529cbc73146ff0d52235e5479042285cae ]
IA32_THERM_STATUS and IA32_PACKAGE_THERM_STATUS have a valid bit, bit 31.
The Intel SDM documents it only for the former, but the package register
implements it too: x86_pkg_temp_thermal has required it since commit
f1a18a105660 ("Thermal: CPU Package temperature thermal").
This driver checked the bit for both registers as well, until
commit bf6ea084ebb5 ("hwmon: (coretemp) Do not return -EAGAIN for low
temperatures") made it ignore the bit because some CPUs clear it while
the temperature is too low to be measured. Since then, temp%d_input
reports such a reading as a real temperature. Userspace cannot tell it
apart from a genuinely low one.
Fail the read with -ENODATA while the CPU reports the reading as invalid.
On a CPU that clears the bit, reading temp%d_input now fails where it
used to return a low value. sensors(1) shows N/A in its place.
Cc: stable@vger.kernel.org
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/all/46f9f319-de71-412f-a424-6cb801478456@roeck-us.net/
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Link: https://patch.msgid.link/20261006-coretemp-enodata-v2-1-64e788acc7dc@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[ sashal: adapted show_temp() to the older rdmsr_on_cpu/sensor_device_attribute code, adding a separate temp_valid field since the existing valid flag means cache populated. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/hwmon/coretemp.rst | 3 +++
drivers/hwmon/coretemp.c | 20 +++++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/Documentation/hwmon/coretemp.rst b/Documentation/hwmon/coretemp.rst
index c609329e3bc45..6089bee1159f1 100644
--- a/Documentation/hwmon/coretemp.rst
+++ b/Documentation/hwmon/coretemp.rst
@@ -47,6 +47,9 @@ All Sysfs entries are named with their core_id (represented here by 'X').
================= ========================================================
tempX_input Core temperature (in millidegrees Celsius).
+ Reading fails with -ENODATA while the CPU reports the
+ temperature as invalid. Some CPUs do this when the
+ temperature is too low to be measured.
tempX_max All cooling devices should be turned on (on Core2).
tempX_crit Maximum junction temperature (in millidegrees Celsius).
tempX_crit_alarm Set when Out-of-spec bit is set, never clears.
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 371eb3fb8e933..23ad304fd0137 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -55,6 +55,8 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
/*
* Per-Core Temperature Data
+ * @temp_valid: Whether the CPU reported @temp as valid. @temp is not
+ * reported when this is false.
* @last_updated: The time when the current temperature value was updated
* earlier (in jiffies).
* @cpu_core_id: The CPU Core from which temperature values should be read
@@ -68,6 +70,7 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
*/
struct temp_data {
int temp;
+ bool temp_valid;
int ttarget;
int tjmax;
u64 last_updated;
@@ -153,6 +156,8 @@ static ssize_t show_temp(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct platform_data *pdata = dev_get_drvdata(dev);
struct temp_data *tdata = pdata->core_data[attr->index];
+ int temp;
+ bool temp_valid;
mutex_lock(&tdata->update_lock);
@@ -161,18 +166,23 @@ static ssize_t show_temp(struct device *dev,
time_after64(get_jiffies_64(), tdata->last_updated + HZ)) {
rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx);
/*
- * Ignore the valid bit. In all observed cases the register
- * value is either low or zero if the valid bit is 0.
- * Return it instead of reporting an error which doesn't
- * really help at all.
+ * Bit 31 indicates whether the reading is valid. Some CPUs
+ * clear it while the temperature is too low to be measured.
+ * Such a reading is not a temperature. Do not report it.
*/
+ tdata->temp_valid = (eax >> 31) & 1;
tdata->temp = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000;
tdata->valid = true;
tdata->last_updated = get_jiffies_64();
}
+ temp_valid = tdata->temp_valid;
+ temp = tdata->temp;
mutex_unlock(&tdata->update_lock);
- return sprintf(buf, "%d\n", tdata->temp);
+
+ if (!temp_valid)
+ return -ENODATA;
+ return sprintf(buf, "%d\n", temp);
}
struct tjmax_pci {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0234/1059] scsi: ufs: bsg: Complete the job on error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (232 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0233/1059] hwmon: (coretemp) Return -ENODATA for invalid temperature readings Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0235/1059] mm/hugetlb: dont clear the resv_map of a VMA whose lock is held Greg Kroah-Hartman
` (764 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stanley Jhu, Bean Huo, Peter Wang,
Bart Van Assche, Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Jhu <stanleyjhu@google.com>
[ Upstream commit cc0ce3fe8fac073ecded4f32c8ee5b89da1397e8 ]
When ufs_bsg_request() fails, it returns a non-zero status without calling
bsg_job_done(). bsg_queue_rq() then ends the request with BLK_STS_IOERR
without running bsg_complete(), leaking the job's device reference and
mapped scatterlists.
Always complete the job via bsg_job_done() and return 0, matching other BSG
transports. Requests failing with a negative errno now return it from SG_IO
with the 4-byte result in the reply, while positive status codes still
return 0 from SG_IO with the reply header.
Fixes: b13a3539eb2a ("scsi: ufs-bsg: complete ufs-bsg job only if no error")
Cc: stable@vger.kernel.org
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20261015001855.3450573-2-stanleyjhu@google.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: Replaced the RPMB-dependent reply_len ternary with sizeof(struct ufs_bsg_reply), used desc_buff instead of buff, and dropped the old unconditional reply_len assignment. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ufs/core/ufs_bsg.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c
index 89cb6825dd531..f09ebdfe711e7 100644
--- a/drivers/ufs/core/ufs_bsg.c
+++ b/drivers/ufs/core/ufs_bsg.c
@@ -163,12 +163,11 @@ static int ufs_bsg_request(struct bsg_job *job)
out:
bsg_reply->result = ret;
- job->reply_len = sizeof(struct ufs_bsg_reply);
- /* complete the job here only if no error */
if (ret == 0)
- bsg_job_done(job, ret, bsg_reply->reply_payload_rcv_len);
+ job->reply_len = sizeof(struct ufs_bsg_reply);
+ bsg_job_done(job, ret, bsg_reply->reply_payload_rcv_len);
- return ret;
+ return 0;
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0235/1059] mm/hugetlb: dont clear the resv_map of a VMA whose lock is held
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (233 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0234/1059] scsi: ufs: bsg: Complete the job on error Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0236/1059] ALSA: ua101: Bound packet copies by the PCM buffer size Greg Kroah-Hartman
` (763 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Andrew Morton, Chris Mason, Lorenzo Stoakes (ARM), Muchun Song,
Lance Yang, Liam R. Howlett, Vlastimil Babka, Jann Horn,
Pedro Falcato, Oscar Salvador, Miaohe Lin, Naoya Horiguchi,
Adam Litke, Mel Gorman, Rik van Riel, Peter Xu, Kiryl Shutsemau,
Mike Rapoport, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit d42032c0fe3ca007986c1229128775af0340fbec ]
Since commit bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private
VMAs") the lock of a private hugetlb VMA that owns a reservation is the
rw_sema of its resv_map. The hugetlb_vma_*lock*() helpers find it through
vma->vm_private_data, anew for every lock and every unlock.
At the end of mremap() the old VMA has to let go of the resv_map, which
now belongs to the new VMA: clear_vma_resv_huge_pages() stores NULL into
vm_private_data. mremap() holds mmap_lock for writing and has write
locked the VMA, which keeps away everybody who comes through the mm. It
does not keep away those who find the VMA through the file. For hole
punch and truncation hugetlb_vmdelete_list() does
hugetlb_vma_trylock_write(vma); locks resv_map->rw_sema
unmap_hugepage_range(vma, ...);
vm_private_data = NULL
hugetlb_vma_unlock_write(vma); no resv_map: does nothing
and the rw_sema stays write locked for ever:
WARNING: lock held when returning to user space!
mremap_punch/116 is leaving the kernel with locks still held!
locks held by mremap_punch/116: 1, last CPU#1:
#0: (&resv_map->rw_sema){+.+.}-{4:4}, at:
hugetlb_vmdelete_list+0x46/0x160
The next fault in the new VMA sleeps in hugetlb_vma_lock_read(),
uninterruptibly, and it holds its entry of hugetlb_fault_mutex_table[].
That table is global, so a fault of any other process on a page that
hashes to the same entry sleeps uninterruptibly as well.
All those who take the lock of a private VMA without taking the mmap/vma
lock are affected: rmap walks. So hold i_mmap_rwsem around the clearing
of the resv_map.
No change of behaviour, other than that mremap() of a hugetlb VMA takes
i_mmap_rwsem once more.
Original fix generated by an LLM and sent in private by Josef.
[david: avoid local variable, move and refine comment, description cleanups+simplifications]
Link: https://lore.kernel.org/20261015-urgent_fixes-v1-5-42796911043b@kernel.org
Fixes: bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private VMAs")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Chris Mason <mason@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Muchun Song <muchun.song@linux.dev>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Adam Litke <agl@us.ibm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Rik van Riel <riel@surriel.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Kiryl Shutsemau <kas@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: <stable@vger.kernel.org>
[ sashal: Applied the fix inline in move_vma() in mm/mremap.c, since fixup_hugetlb_reservations() doesn't exist here, wrapping clear_vma_resv_huge_pages() with i_mmap_lock_write(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/mremap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/mremap.c b/mm/mremap.c
index 75f44fc18692d..faf96e23a2cca 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -719,7 +719,14 @@ static unsigned long move_vma(struct vm_area_struct *vma,
}
if (is_vm_hugetlb_page(vma)) {
+ /*
+ * Rmap walks might still find this VMA and take the lock
+ * inside the reservation map for __vma_private_lock(). Don't clear
+ * the reservation map while that is possible.
+ */
+ i_mmap_lock_write(vma->vm_file->f_mapping);
clear_vma_resv_huge_pages(vma);
+ i_mmap_unlock_write(vma->vm_file->f_mapping);
}
/* Conceal VM_ACCOUNT so old reservation is not undone */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0236/1059] ALSA: ua101: Bound packet copies by the PCM buffer size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (234 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0235/1059] mm/hugetlb: dont clear the resv_map of a VMA whose lock is held Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0237/1059] apparmor: fix profile leak when a policy load fails Greg Kroah-Hartman
` (762 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sinan Turunc, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sinan Turunc <enscrpt@pm.me>
[ Upstream commit 493a77a9f20fca07ca5654f61c1b03bef035df25 ]
copy_capture_data() and copy_playback_data() wrap the ring buffer
position once and split the memcpy() in two at the buffer end, which is
only correct when one packet holds at most buffer_size frames. The
capture packet size is the device's (actual_length up to wMaxPacketSize,
divided by 3 * bNrChannels from its own descriptor), the playback packet
size is taken from the capture packets, and set_stream_hw() lets the
PCM client pick period_bytes_min 1, periods_min 2 and a period time of
1.5 packet intervals: 9 frames at 44.1 kHz high speed, an 18-frame
buffer. A device sending 672-byte mono 24-bit packets delivers 224
frames per packet.
After the first packet buffer_pos is 206 and stays beyond buffer_size.
On the next packet frames1 = buffer_size - buffer_pos wraps and memcpy()
runs away:
snd-ua101 2-1:1.0: invalid position: , pos = 206, buffer size = 18,
period size = 9
BUG: KASAN: slab-out-of-bounds in capture_urb_complete+0x9eb/0xcb0
Read of size 4294966732 at addr ffff88800d73e7e0 by task vhci_rx/81
and for playback:
BUG: KASAN: vmalloc-out-of-bounds in playback_work+0x789/0xac0
Read of size 4294966732 at addr ffffc9000002626a by task kworker/0:1H/80
Clamp the capture copy to buffer_size. On playback, copy at most one
buffer and fill the rest of the packet with silence, so the URB length,
the delay accounting and the data sent stay consistent. With that bound
the single wrap and both memcpy() halves stay inside the buffer. A
device whose packets do not fit the buffer never played correctly
anyway.
Reproduced on 7.3-rc7 with a USB/IP device presenting the UA-101
interface layout and a 672-byte isochronous endpoint.
Fixes: 63978ab3e3e9 ("sound: add Edirol UA-101 support")
Cc: stable@vger.kernel.org
Signed-off-by: Sinan Turunc <enscrpt@pm.me>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261026223543.620-3-enscrpt@pm.me
[ sashal: Adapted the playback_work() hunk to the older spin_lock_irqsave code and embedded urb->urb accessors, and used min_t() instead of min() to avoid a type-check warning. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/misc/ua101.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index c43f4e4a8d670..430dac0b00820 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -285,13 +285,29 @@ static void playback_work(struct work_struct *work)
/* fill packet with data or silence */
urb->urb.iso_frame_desc[0].length =
frames * ua->playback.frame_bytes;
- if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states))
+ if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) {
+ /*
+ * The packet size comes from the capture stream,
+ * i.e. from the device, while the ring buffer can
+ * be as small as two tiny periods. The single wrap
+ * in copy_playback_data() is only valid for
+ * frames <= buffer_size, so copy at most one
+ * buffer and send silence for the rest.
+ */
+ unsigned int copy_frames = min_t(unsigned int, frames,
+ ua->playback.substream->runtime->buffer_size);
+
do_period_elapsed |= copy_playback_data(&ua->playback,
&urb->urb,
- frames);
- else
+ copy_frames);
+ memset(urb->urb.transfer_buffer +
+ copy_frames * ua->playback.frame_bytes, 0,
+ (frames - copy_frames) *
+ ua->playback.frame_bytes);
+ } else {
memset(urb->urb.transfer_buffer, 0,
urb->urb.iso_frame_desc[0].length);
+ }
/* and off you go ... */
err = usb_submit_urb(&urb->urb, GFP_ATOMIC);
@@ -320,6 +336,13 @@ static bool copy_capture_data(struct ua101_stream *stream, struct urb *urb,
runtime = stream->substream->runtime;
frame_bytes = stream->frame_bytes;
+ /*
+ * A packet can carry up to max_packet_bytes, the device's
+ * wMaxPacketSize, which may exceed the whole ring buffer; keep what
+ * fits so the single wrap below stays valid.
+ */
+ if (unlikely(frames > runtime->buffer_size))
+ frames = runtime->buffer_size;
dest = runtime->dma_area + stream->buffer_pos * frame_bytes;
if (stream->buffer_pos + frames <= runtime->buffer_size) {
memcpy(dest, urb->transfer_buffer, frames * frame_bytes);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0237/1059] apparmor: fix profile leak when a policy load fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (235 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0236/1059] ALSA: ua101: Bound packet copies by the PCM buffer size Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0238/1059] fs: dont fail __d_obtain_alias() for unlinked inodes Greg Kroah-Hartman
` (761 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Georgia Garcia, John Johansen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georgia Garcia <georgia.garcia@canonical.com>
[ Upstream commit ce94927fa4173fcc1eca27bdc65a140064c8f1e6 ]
The error paths of aa_replace_profiles() and aa_unpack() do not break
the refcount cycle between label and proxy. They just aa_put_profile()
the new profiles, which drops the label refcount from 2 to 1, and the
proxy keeps the profile alive. Every failed atomic policy load
(e.g. "profile can not be replaced", or a later profile in the blob
failing to unpack) leaks every new profile in the set, along with its
proxy, rules and its loaddata reference.
The leak is usually not visible from userspace, because the raw_data
directory for a failed load is not created, but it becomes visible
when the blob is deduplicated onto an existing loaddata, which then
keeps its policy/raw_data/<rev> directory forever.
Add aa_put_unpublished_profile(), which drops the profile's own proxy
before putting the profile, and use it on those error paths. The
proxy of an unpacked profile is always freshly allocated and not
referenced by anything else before the profile is published, so
putting it is safe.
Fixes: 637f688dc3dc ("apparmor: switch from profiles to using labels on contexts")
Cc: stable@vger.kernel.org
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
[ sashal: Context adjusted for the older tree: AUDIT_MODE takes a non-const struct aa_profile *, and fail_profile: and fail: lack upstream's kfree(ns_name) and compressed_data lines; the added code is otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/include/policy.h | 20 ++++++++++++++++++++
security/apparmor/policy.c | 3 +++
security/apparmor/policy_unpack.c | 4 +++-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/security/apparmor/include/policy.h b/security/apparmor/include/policy.h
index ae8a3626ac75a..94cfb6f87a8ce 100644
--- a/security/apparmor/include/policy.h
+++ b/security/apparmor/include/policy.h
@@ -299,6 +299,26 @@ static inline void aa_put_profile(struct aa_profile *p)
kref_put(&p->label.count.count, aa_label_kref);
}
+/**
+ * aa_put_unpublished_profile - put a profile that was never made visible
+ * @p: profile (MAYBE NULL)
+ *
+ * A newly allocated profile and its proxy reference each other
+ * (proxy->label holds a label refcount). That cycle is normally broken
+ * when the profile is replaced or removed, which redirects the proxy.
+ * A profile that is discarded before being added to the policy tree
+ * never goes through either path, so break the cycle here, otherwise
+ * the profile, its proxy and its rawdata are leaked.
+ */
+static inline void aa_put_unpublished_profile(struct aa_profile *p)
+{
+ if (p && p->label.proxy) {
+ aa_put_proxy(p->label.proxy);
+ p->label.proxy = NULL;
+ }
+ aa_put_profile(p);
+}
+
static inline int AUDIT_MODE(struct aa_profile *profile)
{
if (aa_g_audit != AUDIT_NORMAL)
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index dac3fb515814d..586d70ae2b75b 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -1212,6 +1212,9 @@ ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_label *label,
}
list_for_each_entry_safe(ent, tmp, &lh, list) {
list_del_init(&ent->list);
+ /* new was never added to the policy tree */
+ aa_put_unpublished_profile(ent->new);
+ ent->new = NULL;
aa_load_ent_free(ent);
}
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 636fa078f00e6..ae98cd22a5b55 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -1261,11 +1261,13 @@ int aa_unpack(struct aa_loaddata *udata, struct list_head *lh,
return 0;
fail_profile:
- aa_put_profile(profile);
+ aa_put_unpublished_profile(profile);
fail:
list_for_each_entry_safe(ent, tmp, lh, list) {
list_del_init(&ent->list);
+ aa_put_unpublished_profile(ent->new);
+ ent->new = NULL;
aa_load_ent_free(ent);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0238/1059] fs: dont fail __d_obtain_alias() for unlinked inodes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (236 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0237/1059] apparmor: fix profile leak when a policy load fails Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0239/1059] xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks Greg Kroah-Hartman
` (760 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daehyeon Ko, Amir Goldstein,
Jan Kara, Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit a522dd871024a0f065bfa7638afdb929607f58fc ]
Commit 669bb5af15d4 ("fs: make sure to call fsnotify_inoderemove() only
once when inode is dead") did two things. It made dentry_unlink_inode()
call fsnotify_inoderemove() only once the inode has neither links nor
aliases left. And it made __d_obtain_alias() fail with -ESTALE for an
inode in that state so that open_by_handle_at() can't create a new alias
after FS_DELETE_SELF has been reported and the inode marks are gone.
The second part is wrong for network filesystems. __d_obtain_alias()
backs d_obtain_alias() and d_obtain_root(). Those are what the
->fh_to_dentry() and ->get_parent() methods use to turn the inode they
looked up into a dentry for exportfs_decode_fh_raw(), i.e., for
open_by_handle_at() and for nfsd file handle decoding.
For a local filesystem an in-core inode without links and aliases is an
orphan that goes away on the final iput(). For a network filesystem
that's not true. i_nlink is just the link count the server last
reported and whether the object is still reachable through its file
handle is up to the server. If a file is unlinked while it is still
open elsewhere, e.g., by another NFSv4 client or by a process on the
server, the server keeps the object alive and its file handle stays
valid. nfs_fh_to_dentry() fetches the attributes for such a handle,
nfs_fhget() sets i_nlink to 0 from them, the new inode has no aliases
yet and so __d_obtain_alias() now fails with -ESTALE. The same applies
to fuse_get_dentry() which takes i_nlink from the fuse server.
Filesystems that care about unlinked inodes already make that decision
themselves in ->fh_to_dentry(), e.g., ceph's __fh_to_dentry() fetches
the link count with CEPH_CAP_LINK_SHARED and only refuses an unlinked
inode if it isn't open.
Note that on a network filesystem i_nlink drops to zero through
attribute updates when another client unlinks the file. So the inode
might never have gone through dentry_unlink_inode() with i_nlink == 0,
i.e., fsnotify_inoderemove() might never have been called for it and
there's nothing for the -ESTALE to protect.
So drop the two checks from __d_obtain_alias() again and go back to the
unconditional alias lookup. While at it, update the comment above
inode_notify_dead() since it no longer blocks new aliases.
Amir sent this as v3 to replace 669bb5af15d4 but that commit was already
in mainline by then. So do it as a fix on top. The resulting code is
identical to v3.
This means open_by_handle_at() can again create a new alias for an
unlinked inode after FS_DELETE_SELF has been reported. Closing that file
reports a second FS_DELETE_SELF and the file has none of the inode marks
that were torn down. That's what Daehyeon's open_by_handle_at() LTP test
checks so it is expected to fail again. This needs to be handled
separately. A mark that is added through such a file while
fsnotify_destroy_marks() is still running is rejected with -ENOENT since
36ebddca56b9 ("fsnotify: prevent mark additions during connector
teardown") so it can't end up on a detached connector.
Christian Brauner <brauner@kernel.org> says:
Amir's v3 replaced 669bb5af15d4 as a whole. I turned it into an
incremental fix on top of mainline and wrote a new commit message.
Jan's Reviewed-by was given on v3 and the resulting code is identical.
Fixes: 669bb5af15d4 ("fs: make sure to call fsnotify_inoderemove() only once when inode is dead")
Cc: stable@vger.kernel.org
Reported-by: Daehyeon Ko <4ncienth@gmail.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/CAOQ4uxg7Qt436SiKhKEJKOjtCjeB_XyTjazYF7HMyQAGGcgx2A@mail.gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20261030-work-dcache-obtain_alias-v1-1-a1f7e44536d2@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Adapted the hunks to this tree's split helper: the recheck under i_lock went into __d_instantiate_anon(), and the initial lookup became d_find_any_alias() inside the existing out_iput flow. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/dcache.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 5065c16af16d4..111ada96c33b0 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -382,10 +382,9 @@ static void dentry_free(struct dentry *dentry)
}
/*
- * If inode is unlinked and doesn't have any aliases (i.e., all fds pointing to
- * it are closed), it is pretty much dead. Except that file handle lookup could
- * still revive it which causes issues to fsnotify. So once inode reaches this
- * state we make sure to block creating any new aliases.
+ * When inode is unlinked and doesn't have any aliases (i.e., all fds pointing
+ * to it are closed) we report FS_DELETE_SELF to fsnotify and cleanup all inode
+ * marks.
*/
static bool inode_notify_dead(struct inode *inode)
{
@@ -2109,10 +2108,7 @@ static struct dentry *__d_instantiate_anon(struct dentry *dentry,
security_d_instantiate(dentry, inode);
spin_lock(&inode->i_lock);
- if (!inode_notify_dead(inode))
- res = __d_find_any_alias(inode);
- else
- res = ERR_PTR(-ESTALE);
+ res = __d_find_any_alias(inode);
if (res) {
spin_unlock(&inode->i_lock);
dput(dentry);
@@ -2159,12 +2155,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected)
if (IS_ERR(inode))
return ERR_CAST(inode);
- spin_lock(&inode->i_lock);
- if (!inode_notify_dead(inode))
- res = __d_find_any_alias(inode); /* existing alias? */
- else
- res = ERR_PTR(-ESTALE);
- spin_unlock(&inode->i_lock);
+ res = d_find_any_alias(inode); /* existing alias? */
if (res)
goto out_iput;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0239/1059] xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (237 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0238/1059] fs: dont fail __d_obtain_alias() for unlinked inodes Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0240/1059] can: skb: make echo skb freeing safe in any IRQ context Greg Kroah-Hartman
` (759 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daejun Park, Christoph Hellwig,
Carlos Maiolino, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
[ Upstream commit bcf0b7f18ad11e1d410e82ffef678705eff0a317 ]
A client can commit a hole in a LAYOUTCOMMIT, because nfsd does not
check the extents against its layouts. xfs_iomap_write_unwritten() then
allocates written blocks there. A large hole overruns the block
reservation and shuts XFS down. A small one exposes stale data.
Refuse such a range with -EIO, using XFS_BMAPI_CONVERT_ONLY.
Link: https://lore.kernel.org/r/20261014130834.GB15773@lst.de
Fixes: 527851124d10 ("xfs: implement pNFS export operations")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
[ sashal: Applied the xfs_ioend.c hunk to the equivalent xfs_iomap_write_unwritten() call in xfs_end_ioend() in xfs_aops.c, since xfs_ioend.c doesn't exist here, passing the new final argument 0. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/xfs/xfs_aops.c | 2 +-
fs/xfs/xfs_file.c | 2 +-
fs/xfs/xfs_iomap.c | 20 +++++++++++++++++---
fs/xfs/xfs_iomap.h | 3 ++-
fs/xfs/xfs_pnfs.c | 9 ++++++++-
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 50a7f2745514b..44823f6bb21a2 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -126,7 +126,7 @@ xfs_end_ioend(
if (ioend->io_flags & IOMAP_F_SHARED)
error = xfs_reflink_end_cow(ip, offset, size);
else if (ioend->io_type == IOMAP_UNWRITTEN)
- error = xfs_iomap_write_unwritten(ip, offset, size, false);
+ error = xfs_iomap_write_unwritten(ip, offset, size, false, 0);
if (!error && xfs_ioend_is_append(ioend))
error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size);
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 3c910e36da69b..e4c6c4d80defa 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -498,7 +498,7 @@ xfs_dio_write_end_io(
* they are converted.
*/
if (flags & IOMAP_DIO_UNWRITTEN) {
- error = xfs_iomap_write_unwritten(ip, offset, size, true);
+ error = xfs_iomap_write_unwritten(ip, offset, size, true, 0);
goto out;
}
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index f2542bac50c35..deaf6a774b4b6 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -540,7 +540,8 @@ xfs_iomap_write_unwritten(
xfs_inode_t *ip,
xfs_off_t offset,
xfs_off_t count,
- bool update_isize)
+ bool update_isize,
+ uint32_t bmapi_flags)
{
xfs_mount_t *mp = ip->i_mount;
xfs_fileoff_t offset_fsb;
@@ -605,8 +606,21 @@ xfs_iomap_write_unwritten(
*/
nimaps = 1;
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
- XFS_BMAPI_CONVERT, resblks, &imap,
- &nimaps);
+ XFS_BMAPI_CONVERT | bmapi_flags,
+ resblks, &imap, &nimaps);
+ if (error == -ENOSR && (bmapi_flags & XFS_BMAPI_CONVERT_ONLY)) {
+ /*
+ * Nothing was mapped: the rest of the range starts
+ * with a hole or a delalloc extent. Nothing was
+ * changed either, but xfs_iext_count_extend() may
+ * have logged the inode, and cancelling a dirty
+ * transaction shuts the filesystem down. Commit it,
+ * as xfs_alloc_file_space() does on -ENOSR.
+ */
+ error = xfs_trans_commit(tp);
+ xfs_iunlock(ip, XFS_ILOCK_EXCL);
+ return error ? error : -EIO;
+ }
if (error)
goto error_on_bmapi_transaction;
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index 4da13440bae9b..eb70f1653776a 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -14,7 +14,8 @@ struct xfs_bmbt_irec;
int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
xfs_fileoff_t count_fsb, unsigned int flags,
struct xfs_bmbt_irec *imap, u64 *sequence);
-int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
+int xfs_iomap_write_unwritten(struct xfs_inode *ip, xfs_off_t offset,
+ xfs_off_t count, bool update_isize, uint32_t bmapi_flags);
xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
xfs_fileoff_t end_fsb);
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index c51d29ef450d5..52c2ccda7465a 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -315,7 +315,14 @@ xfs_fs_commit_blocks(
(end - 1) >> PAGE_SHIFT);
WARN_ON_ONCE(error);
- error = xfs_iomap_write_unwritten(ip, start, length, false);
+ /*
+ * A client may only write to blocks that a layout handed out,
+ * and xfs_fs_map_blocks() allocates blocks for any hole in a
+ * write layout, so refuse to allocate blocks for a hole or a
+ * delalloc extent in the committed range.
+ */
+ error = xfs_iomap_write_unwritten(ip, start, length, false,
+ XFS_BMAPI_CONVERT_ONLY);
if (error)
goto out_drop_iolock;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0240/1059] can: skb: make echo skb freeing safe in any IRQ context
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (238 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0239/1059] xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0241/1059] mm/userfaultfd: wake all waiters on unregister Greg Kroah-Hartman
` (758 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cunhao Lu, stable, Marc Kleine-Budde,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cunhao Lu <1579567540@qq.com>
[ Upstream commit d743071964920c92af598c87a9e6f4369263ee09 ]
can_put_echo_skb() can be called with hardware interrupts disabled. Its
direct drop paths use kfree_skb(), while can_create_echo_skb() uses
kfree_skb() when cloning fails and consume_skb() after a successful clone.
None of these helpers is safe in every IRQ context.
Use dev_kfree_skb_any() for all drop paths and dev_consume_skb_any() when
consuming a successfully cloned skb. This preserves the respective skb drop
and consumed semantics regardless of the caller IRQ context.
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/tencent_E84809CF236D0137885E7E4E4D58340B3208@qq.com
Cc: stable@kernel.org
Fixes: ae64438be192 ("can: dev: fix skb drop check")
Fixes: 0ae89beb283a ("can: add destructor for self generated skbs")
Fixes: 3ccd4c6167d3 ("can: Unify droping of invalid tx skbs and netdev stats")
Fixes: 39549eef3587 ("can: CAN Network device driver and Netlink interface")
[mkl: also convert can_dropped_invalid_skb(), can_dev_dropped_skb()]
[mkl: add stable on Cc + add Fixes tags]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/can/dev/skb.c | 6 +++---
include/linux/can/dev.h | 2 +-
include/linux/can/skb.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c
index 4f5eec05db220..d4111394af247 100644
--- a/drivers/net/can/dev/skb.c
+++ b/drivers/net/can/dev/skb.c
@@ -61,7 +61,7 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
(skb->protocol != htons(ETH_P_CAN) &&
skb->protocol != htons(ETH_P_CANFD) &&
skb->protocol != htons(ETH_P_CANXL))) {
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return 0;
}
@@ -87,7 +87,7 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
} else {
/* locking problem with netif_stop_queue() ?? */
netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx);
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return -EBUSY;
}
@@ -369,7 +369,7 @@ bool can_dropped_invalid_skb(struct net_device *dev, struct sk_buff *skb)
return false;
inval_skb:
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
dev->stats.tx_dropped++;
return true;
}
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 982ba245eb41c..e8b9c69563135 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -160,7 +160,7 @@ static inline bool can_dev_dropped_skb(struct net_device *dev, struct sk_buff *s
if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) {
netdev_info_once(dev,
"interface in listen only mode, dropping skb\n");
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
dev->stats.tx_dropped++;
return true;
}
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index 27d0ca115c6c1..1f0c3e8cde907 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -92,12 +92,12 @@ static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
nskb = skb_clone(skb, GFP_ATOMIC);
if (unlikely(!nskb)) {
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return NULL;
}
can_skb_set_owner(nskb, skb->sk);
- consume_skb(skb);
+ dev_consume_skb_any(skb);
return nskb;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0241/1059] mm/userfaultfd: wake all waiters on unregister
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (239 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0240/1059] can: skb: make echo skb freeing safe in any IRQ context Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0242/1059] mptcp: do not use Fast Open on MP_JOIN subflows Greg Kroah-Hartman
` (757 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik,
Mike Rapoport (Microsoft), Lorenzo Stoakes (ARM),
Muhammad Usama Anjum, David Hildenbrand (Arm), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 3afb19d68cc5e7851fdb1069c8094af97bd80417 ]
UFFDIO_UNREGISTER only wakes pending faults if VM_UFFD_MISSING is set.
Threads waiting on write-protect, minor or RWP faults can therefore remain
asleep after unregistering a range that does not track missing faults.
Wake pending faults regardless of the registration mode so they can retry
without an explicit UFFDIO_WAKE or closing the userfaultfd. This matches
the existing behavior for missing faults, including removing unread fault
messages for the woken waiters.
Fix generated by an LLM and sent by Josef Bacik in private.
Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[ david: rebase; simplify description ]
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>
Link: https://patch.msgid.link/20261031-fixes_core-v3-24-d6437171ecc3@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
[ sashal: Dropped the userfaultfd_missing() guard in fs/userfaultfd.c (the function isn't in mm/userfaultfd.c here), and kept wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range) instead of upstream's ctx. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/userfaultfd.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 00690ada9c7b0..3b75d42338846 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1642,6 +1642,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
ret = 0;
do {
+ struct userfaultfd_wake_range range;
+
cond_resched();
BUG_ON(!vma_can_userfault(vma, vma->vm_flags));
@@ -1659,18 +1661,14 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
start = vma->vm_start;
vma_end = min(end, vma->vm_end);
- if (userfaultfd_missing(vma)) {
- /*
- * Wake any concurrent pending userfault while
- * we unregister, so they will not hang
- * permanently and it avoids userland to call
- * UFFDIO_WAKE explicitly.
- */
- struct userfaultfd_wake_range range;
- range.start = start;
- range.len = vma_end - start;
- wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range);
- }
+ /*
+ * Wake any concurrent pending userfault while we unregister,
+ * so they will not hang permanently and it avoids userland to
+ * call UFFDIO_WAKE explicitly.
+ */
+ range.start = start;
+ range.len = vma_end - start;
+ wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range);
/* Reset ptes for the whole vma range if wr-protected */
if (userfaultfd_wp(vma))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0242/1059] mptcp: do not use Fast Open on MP_JOIN subflows
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (240 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0241/1059] mm/userfaultfd: wake all waiters on unregister Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0243/1059] udf: check the unallocated space table when it is loaded Greg Kroah-Hartman
` (756 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kimi Security Team, Jiayuan Chen,
Paolo Abeni, Yilin Zhang, Matthieu Baerts (NGI0), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Zhang <yilinzhang@moonshot.ai>
[ Upstream commit 6d2cf411aba2aa0bd641b49be5b1964ac5097a50 ]
tcp_fastopen_create_child() hands the SYN packet itself to
subflow_syn_recv_sock(). For an MP_JOIN request this takes the
fatal fallback: the cloned child is destroyed and handed back with
drop_req flagged, but tcp_fastopen_create_child() does not check
the flag and queues it, so accept() can expose the freed child.
MP_JOIN cannot use Fast Open: data on a subflow requires the
completed HMAC exchange (RFC 8684, sec. 3.2). Refuse it (only the
TFO path passes a SYN skb here) and let tcp_conn_request() fall
back to the regular MP_JOIN handshake; also strip the Fast Open
cookie from MP_JOIN SYN/ACKs.
Fixes: 90bf45134d55 ("mptcp: add new sock flag to deal with join subflows")
Cc: stable@vger.kernel.org
Reported-by: Kimi Security Team <bug-report@moonshot.ai>
Suggested-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Yilin Zhang <yilinzhang@moonshot.ai>
[ Moving code to avoid clearing TS and consolidating checks. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20261030-mptcp-tfo-mpj-v4-1-e6eff2027342@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: omitted the upstream hunk in subflow_prep_synack() that clears the Fast Open cookie for MP_JOIN, since that function doesn't exist here; only the subflow_syn_recv_sock() check was applied. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mptcp/subflow.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index b192a4d8b707c..034bc4186dc8d 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -782,6 +782,13 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
fallback = true;
} else if (subflow_req->mp_join) {
+ /* a SYN skb here comes from TFO, which MP_JOIN cannot use: just
+ * fall back to the regular path.
+ */
+ if ((TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_ACK)) ==
+ TCPHDR_SYN)
+ return NULL;
+
mptcp_get_options(skb, &mp_opt);
if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK))
fallback = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0243/1059] udf: check the unallocated space table when it is loaded
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (241 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0242/1059] mptcp: do not use Fast Open on MP_JOIN subflows Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0244/1059] perf evsel: Restrict incremental open error unwind Greg Kroah-Hartman
` (755 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthias Goergens, Jan Kara,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Goergens <matthias.goergens@gmail.com>
[ Upstream commit e614c3e35a6699ed691b4d17e1ec4230e34aa3eb ]
udf_table_new_block() hands out the first block of the extent closest
to its goal and trusts that the extent covers at least one whole block
inside the partition. Nothing checks that. A zero-length extent makes
it return the block the extent points at, which need not be free, and
the subtraction of one block then underflows the length into the type
bits, turning the entry into a bogus continuation. An extent running
past the end of the partition makes it return blocks behind the
partition.
Such tables are not only found on crafted images: until the previous
commit, udf_table_new_block() itself left zero-length extents behind
in tables written by mkudffs, and then converted them into extents
running past the partition.
Check every extent once when the table is loaded, and refuse
read-write access if one is empty, is not a whole number of blocks, or
does not lie inside the partition, in the same way as for other
allocation information the kernel cannot use. Check first that the
table is an Unallocated Space Entry at all: the walk starts at the
offset of the allocation descriptors in one, and for a file entry that
offset lies before the inode's in-memory copy of the descriptors.
Treat a chain of allocation extent descriptors that leads back to
itself the same way: the walk would otherwise return the same extents
forever, and the mount would never finish. Let a fatal signal
interrupt the walk and fail the mount.
Refusing read-write access to an empty extent is deliberate. It shows
that an old kernel took the last block but left the entry behind. If
consumed again, the entry returns an in-use block and turns into a huge
bogus extent. Refusing the table before that
happens avoids this second allocation; the filesystem can still be
mounted read-only. The check cannot detect every overlap that may
already exist in a damaged table.
This patch should be backported together with the previous one: that
patch stops creating new empty extents, and this one rejects existing
ones before they are consumed again.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
Link: https://patch.msgid.link/81233decd91f4a48bf4d74e3d15b547c7711e39f.1793349907.git.matthias.goergens@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
[ sashal: Replaced upstream's errno-returning udf_next_aext() check with the old != -1 return convention, so read errors end the walk silently, and initialised ret = 0. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 16a213542582a..e40ffe40a99a8 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1078,6 +1078,73 @@ static int check_partition_desc(struct super_block *sb,
return 0;
}
+/*
+ * Check the Unallocated Space Table once when it is loaded: the allocator
+ * hands out blocks from the start of each extent and trusts that every
+ * extent covers at least one whole block inside the partition.
+ */
+static int udf_check_unalloc_table(struct super_block *sb,
+ struct inode *table, u32 partition_len)
+{
+ struct extent_position epos = {
+ .block = UDF_I(table)->i_location,
+ .offset = sizeof(struct unallocSpaceEntry),
+ };
+ struct kernel_lb_addr eloc;
+ uint32_t elen, blocks;
+ struct kernel_lb_addr seen_block = {};
+ uint32_t seen_offset = 0;
+ u64 steps = 0, period = 1;
+ int8_t etype;
+ int ret = 0;
+
+ /* The walk below assumes the layout of an Unallocated Space Entry */
+ if (!UDF_I(table)->i_use) {
+ udf_err(sb, "unallocated space table is not an unallocated space entry\n");
+ return -EFSCORRUPTED;
+ }
+
+ while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
+ blocks = elen >> sb->s_blocksize_bits;
+ if (!blocks || (elen & (sb->s_blocksize - 1)) ||
+ eloc.logicalBlockNum >= partition_len ||
+ blocks > partition_len - eloc.logicalBlockNum) {
+ udf_err(sb, "invalid unallocated space table extent (block %u, length %u)\n",
+ eloc.logicalBlockNum, elen);
+ ret = -EFSCORRUPTED;
+ break;
+ }
+ /*
+ * A chain of allocation extents can lead back to itself, and
+ * then the walk returns the same extents forever. Remember a
+ * position at doubling intervals; a walk that comes back to it
+ * is in a loop.
+ */
+ if (epos.block.logicalBlockNum == seen_block.logicalBlockNum &&
+ epos.block.partitionReferenceNum ==
+ seen_block.partitionReferenceNum &&
+ epos.offset == seen_offset) {
+ udf_err(sb, "unallocated space table loops back on itself\n");
+ ret = -EFSCORRUPTED;
+ break;
+ }
+ if (++steps == period) {
+ seen_block = epos.block;
+ seen_offset = epos.offset;
+ steps = 0;
+ period <<= 1;
+ }
+ if (fatal_signal_pending(current)) {
+ udf_err(sb, "interrupted while checking the unallocated space table\n");
+ ret = -EINTR;
+ break;
+ }
+ cond_resched();
+ }
+ brelse(epos.bh);
+ return ret;
+}
+
static int udf_fill_partdesc_info(struct super_block *sb,
struct partitionDesc *p, int p_index)
{
@@ -1138,6 +1205,16 @@ static int udf_fill_partdesc_info(struct super_block *sb,
p_index);
return PTR_ERR(inode);
}
+ err = udf_check_unalloc_table(sb, inode, map->s_partition_len);
+ if (err) {
+ iput(inode);
+ if (err == -EINTR)
+ return err;
+ if (!sb_rdonly(sb))
+ return -EACCES;
+ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT);
+ return 0;
+ }
map->s_uspace.s_table = inode;
map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE;
udf_debug("unallocSpaceTable (part %d) @ %lu\n",
@@ -2267,8 +2344,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
/*
* EACCES is special - we want to propagate to
* upper layers that we cannot handle RW mount.
+ * EINTR means that a fatal signal is pending.
*/
- if (ret == -EACCES)
+ if (ret == -EACCES || ret == -EINTR)
break;
} else
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0244/1059] perf evsel: Restrict incremental open error unwind
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (242 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0243/1059] udf: check the unallocated space table when it is loaded Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0245/1059] KVM: arm64: vgic: Stop the target vcpu when disabling LPIs Greg Kroah-Hartman
` (754 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Hui Su, Namhyung Kim,
Arnaldo Carvalho de Melo, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <sh_def@163.com>
[ Upstream commit d023b2110d0d7232ba952a486c497ba8817f6f66 ]
evsel__open_cpu(), evsel__tool_pmu_open() and
evsel__hwmon_pmu_open() support opening a subrange of a CPU map, bounded
by [start_cpu_map_idx, end_cpu_map_idx).
Their error paths, however, unwind using "while (--idx >= 0)" all the way
back to CPU index 0 regardless of start_cpu_map_idx. If lower CPU indices
were opened by an earlier invocation, a later incremental open failure
therefore closes those existing file descriptors and overwrites their
slots with -1.
Before this fix, running the new incremental open test demonstrates this
corruption:
$ perf test -v "Tool PMU"
12: Tool PMU:
12.1: Tool PMU : Ok
12.2: Tool PMU leader : Ok
12.3: Incremental open error unwind boundary:
FAILED: CPU 0 FD overwritten: FD(evsel, 0, 0)=-1, expected 4
FAILED!
Stop the unwind at start_cpu_map_idx so that only file descriptors
opened by the current invocation are rolled back.
After this fix:
$ perf test -v "Tool PMU"
12: Tool PMU:
12.1: Tool PMU : Ok
12.2: Tool PMU leader : Ok
12.3: Incremental open error unwind boundary : Ok
Fixes: 4804e0111662d7d8 ("perf stat: Use affinity for opening events")
Fixes: 240505b2d0adcdc8 ("perf tool_pmu: Factor tool events into their own PMU")
Fixes: 53cc0b351ec99278 ("perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Hui Su <sh_def@163.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Dropped the tool PMU, hwmon PMU and test hunks because those files don't exist here; only the evsel.c unwind bound change (--idx >= start_cpu_map_idx) is kept. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 755da242f2670..02675d951e4ba 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2189,7 +2189,7 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
FD(evsel, idx, thread) = -1;
}
thread = nthreads;
- } while (--idx >= 0);
+ } while (--idx >= start_cpu_map_idx);
errno = old_errno;
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0245/1059] KVM: arm64: vgic: Stop the target vcpu when disabling LPIs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (243 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0244/1059] perf evsel: Restrict incremental open error unwind Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0246/1059] ocfs2/cluster: hold a reference on the heartbeat thread Greg Kroah-Hartman
` (753 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oliver Upton, Fuad Tabba,
Marc Zyngier, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <maz@kernel.org>
[ Upstream commit a1b4bd2c2c262b8094c86afb99364d16ac08cb66 ]
Disabling LPIs is pretty nasty, as it directly messes with the AP list
of the affected CPU, which could be running... This has the potential to
lead to really bad behaviours, and we should not be doing that.
Take example on the way the Active state is handled and simply pause the
the vcpu so that we are sure it is in a quiescent state, and the state be
safely manipulated.
Nobody has any expectation of performance for this anyway.
Fixes: 96085b949672d ("KVM: arm/arm64: vgic-v3: Retire pending interrupts on disabling LPIs")
Co-developed-by: Oliver Upton <oupton@kernel.org>
Signed-off-by: Oliver Upton <oupton@kernel.org>
Cc: stable@vger.kernel.org
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20261015100539.1011760-7-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
[ sashal: Replaced per-vCPU pause/resume helpers with kvm_arm_halt_guest() and kvm_arm_resume_guest(), which pause all vCPUs. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
index 33ff9fcfcfb08..1dab5298ae9e7 100644
--- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
@@ -276,9 +276,19 @@ static void vgic_mmio_write_v3r_ctlr(struct kvm_vcpu *vcpu,
if (ctlr != GICR_CTLR_ENABLE_LPIS)
return;
+ /*
+ * Yes, disabling LPIs is painful, since it can be done from
+ * a *remote* vcpu! So let's not take any chance, and make
+ * sure that the target vCPU has written their LRs back to the
+ * irq structures, and release any reference they would have.
+ *
+ * If it hurts, don't do it.
+ */
+ kvm_arm_halt_guest(vcpu->kvm);
vgic_flush_pending_lpis(vcpu);
vgic_its_invalidate_cache(vcpu->kvm);
atomic_set_release(&vgic_cpu->ctlr, 0);
+ kvm_arm_resume_guest(vcpu->kvm);
} else {
ctlr = atomic_cmpxchg_acquire(&vgic_cpu->ctlr, 0,
GICR_CTLR_ENABLE_LPIS);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0246/1059] ocfs2/cluster: hold a reference on the heartbeat thread
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (244 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0245/1059] KVM: arm64: vgic: Stop the target vcpu when disabling LPIs Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0247/1059] inet: frags: bound the wmem charge of the socket completing a reassembly Greg Kroah-Hartman
` (752 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Andrew Morton,
Sashiko, Joseph Qi, Mark Fasheh, Joel Becker, Cen Zhang,
Junxiao Bi, Heming Zhao, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit aa2e38aabaae87236290e486a2b77cfa3adfbebe ]
Since commit 688bc88e2046 ("ocfs2/cluster: keep heartbeat local node
stable"), o2hb_thread() leaves its loop and returns when the local node
changes, for example after "echo 0 > node/<name>/local". The thread was
started with kthread_run() and nothing holds a reference to its
task_struct, so the task is freed once it exits, while reg->hr_task still
points to it.
Reading the region's pid attribute then reads the freed task, and removing
the region calls kthread_stop() on it:
BUG: KASAN: slab-use-after-free in o2hb_region_pid_show+0xb3/0xc0
refcount_t: addition on 0; use-after-free.
Oops: Oops: 0000 [#1] SMP KASAN NOPTI
RIP: 0010:kthread_stop+0xb1/0x390
The thread could already return by itself before, when heartbeat start was
aborted or on an unclean stop, but the local node change makes it
reachable from userspace at any time.
Create the thread, take a reference on it and only then wake it, so the
reference cannot race with the thread exiting. Drop it with
kthread_stop_put().
Link: https://lore.kernel.org/20260923010149.14391-1-kmehltretter@gmail.com
Fixes: 688bc88e2046 ("ocfs2/cluster: keep heartbeat local node stable")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260616074931.3774929-1-zzzccc427%40gmail.com
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Assisted-by: LLM
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Cen Zhang <zzzccc427@gmail.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Heming Zhao <heming.zhao@suse.com>
[ sashal: Open-coded kthread_stop_put() as kthread_stop() plus put_task_struct() at both call sites, and placed wake_up_process() before this tree's existing hr_dev_mutex unlock. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ocfs2/cluster/heartbeat.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index e641c9c415532..12f87ee72a852 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1955,18 +1955,22 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
atomic_set(®->hr_unsteady_iterations, (live_threshold * 3));
o2hb_set_region_stopping(reg, false);
- hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s",
- reg->hr_item.ci_name);
+ hb_task = kthread_create(o2hb_thread, reg, "o2hb-%s",
+ reg->hr_item.ci_name);
if (IS_ERR(hb_task)) {
ret = PTR_ERR(hb_task);
mlog_errno(ret);
goto out3;
}
+ /* The thread may exit on its own, so pin it before it can run. */
+ get_task_struct(hb_task);
spin_lock(&o2hb_live_lock);
reg->hr_task = hb_task;
spin_unlock(&o2hb_live_lock);
+ wake_up_process(hb_task);
+
/*
* Don't hold hr_dev_mutex across the wait, which can take seconds.
* hr_bdev is already set, so other writers still get -EINVAL.
@@ -2016,8 +2020,10 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
reg->hr_task = NULL;
spin_unlock(&o2hb_live_lock);
- if (hb_task)
+ if (hb_task) {
kthread_stop(hb_task);
+ put_task_struct(hb_task);
+ }
o2hb_unmap_slot_data(reg);
@@ -2215,8 +2221,10 @@ static void o2hb_heartbeat_group_drop_item(struct config_group *group,
reg->hr_item_dropped = 1;
spin_unlock(&o2hb_live_lock);
- if (hb_task)
+ if (hb_task) {
kthread_stop(hb_task);
+ put_task_struct(hb_task);
+ }
if (o2hb_global_heartbeat_active()) {
spin_lock(&o2hb_live_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0247/1059] inet: frags: bound the wmem charge of the socket completing a reassembly
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (245 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0246/1059] ocfs2/cluster: hold a reference on the heartbeat thread Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0248/1059] libbpf: Avoid overflow in BTF.ext bounds check Greg Kroah-Hartman
` (751 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paolo Abeni, Eric Dumazet,
Ido Schimmel, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit b71c101bbb9814d163c00234d43c41f0a17907d4 ]
When a socket owned fragment completes a reassembly queue,
inet_frag_reasm_prepare() and inet_frag_reasm_finish() charge the
truesize of all other fragments to its sk_wmem_alloc. These fragments
were orphaned when queued, and might have been sent by someone else,
for instance padded TUN packets.
Commit 3ae20e4697eb ("inet: frags: limit the truesize of a reassembly
queue") bounds this charge to INT_MAX / 2 per queue, but a socket can
complete several queues while the reassembled skbs are still alive,
for instance held in a qdisc. sk_wmem_alloc can then go past INT_MAX,
refcount_add() saturates it with a WARN, and the socket is leaked.
This is reachable from an unprivileged user/network namespace, by
raising ipfrag_high_thresh.
Refuse the reassembly if the charge would push sk_wmem_alloc above
2 * sk_sndbuf, the bound ip_append_data() uses, plus 4MB of slack for
fragments inflated by a refragmentation with a small MTU, and never
above INT_MAX / 2. The cap matters for tun sockets, which use
sk_sndbuf = INT_MAX, and whose skbs are still owned when act_ct or
openvswitch reassemble them at ingress.
Several queues can complete at the same time on different cpus for
the same socket, so the charge is reserved with a cmpxchg() loop in
inet_frag_reasm_prepare(), before it modifies the queue, and settled
in inet_frag_reasm_finish(). Move the size checks of ip_frag_reasm(),
ip6_frag_reasm() and nf_ct_frag6_reasm() before
inet_frag_reasm_prepare(), using the first fragment which becomes the
head, so that a successful inet_frag_reasm_prepare() is always followed
by inet_frag_reasm_finish(). All callers already kill the queue when
inet_frag_reasm_prepare() returns NULL.
Found by code inspection (AI review), not reproduced.
Fixes: 18685451fc4e ("inet: inet_defrag: prevent sk release while still in use")
Reported-by: Paolo Abeni <pabeni@redhat.com>
Closes: https://lore.kernel.org/netdev/24feda7d-ae49-45af-9596-2cc5f149f28e@redhat.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261104122927.1033747-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: adjusted the IPv6 payload_len expression to this branch's older form, using the first fragment's data minus network header instead of skb_network_offset(), in both reassembly paths. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/inet_fragment.c | 61 ++++++++++++++++++++++---
net/ipv4/ip_fragment.c | 13 ++++--
net/ipv6/netfilter/nf_conntrack_reasm.c | 14 ++++--
net/ipv6/reassembly.c | 14 ++++--
4 files changed, 80 insertions(+), 22 deletions(-)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index ba1e851257002..b126b4a96f896 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -17,6 +17,7 @@
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/rhashtable.h>
+#include <linux/sizes.h>
#include <net/sock.h>
#include <net/inet_frag.h>
@@ -454,6 +455,43 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb,
}
EXPORT_SYMBOL(inet_frag_queue_insert);
+/* When a socket owned fragment completes a queue, the truesize of all
+ * other fragments is charged to its sk_wmem_alloc, although they were
+ * orphaned when queued and possibly sent by someone else.
+ * Bound this like ip_append_data() bounds the memory a socket can
+ * allocate (2 * sk_sndbuf), plus slack for fragments inflated by a
+ * refragmentation using a small MTU. Otherwise, several reassembled skbs
+ * alive at the same time can saturate sk_wmem_alloc, and leak the socket.
+ *
+ * Several queues can complete at the same time for the same socket,
+ * and some sockets (tun) use sk_sndbuf = INT_MAX. The charge is reserved
+ * with a cmpxchg() loop, a refcount_t has no helper for this.
+ */
+#define INET_FRAG_WMEM_SLACK SZ_4M
+
+static bool inet_frag_wmem_reserve(struct sock *sk, unsigned int charge)
+{
+ u64 limit = 2ULL * READ_ONCE(sk->sk_sndbuf) + INET_FRAG_WMEM_SLACK;
+ int old = refcount_read(&sk->sk_wmem_alloc);
+
+ limit = min_t(u64, limit, INET_FRAG_MAX_TRUESIZE);
+ do {
+ if (old <= 0 || (u64)old + charge > limit)
+ return false;
+ } while (!atomic_try_cmpxchg(&sk->sk_wmem_alloc.refs, &old,
+ old + charge));
+
+ return true;
+}
+
+static void inet_frag_wmem_adjust(struct sock *sk, int delta)
+{
+ if (delta >= 0)
+ refcount_add(delta, &sk->sk_wmem_alloc);
+ else
+ WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc));
+}
+
void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb,
struct sk_buff *parent)
{
@@ -465,6 +503,11 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb,
int delta;
if (sk && is_skb_wmem(skb)) {
+ /* skb->truesize is already charged to sk, and is part of
+ * q->truesize. inet_frag_reasm_finish() settles the charge.
+ */
+ if (!inet_frag_wmem_reserve(sk, q->truesize - skb->truesize))
+ return NULL;
/* TX: skb->sk might have been passed as argument to
* dst->output and must remain valid until tx completes.
*
@@ -542,17 +585,18 @@ void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb,
out_restore_sk:
if (orig_truesize) {
- int ts_delta = head->truesize - orig_truesize;
-
/* if this reassembled skb is fragmented later,
* fraglist skbs will get skb->sk assigned from head->sk,
* and each frag skb will be released via sock_wfree.
- *
- * Update sk_wmem_alloc.
*/
head->sk = sk;
head->destructor = destructor;
- refcount_add(ts_delta, &sk->sk_wmem_alloc);
+ /* On failure, head stays in the queue and will be freed
+ * with the queue: only charge its truesize.
+ */
+ if (!nextp)
+ inet_frag_wmem_adjust(sk, (int)head->truesize -
+ (int)q->truesize);
}
return nextp;
@@ -563,7 +607,6 @@ void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head,
void *reasm_data, bool try_coalesce)
{
struct sock *sk = is_skb_wmem(head) ? head->sk : NULL;
- const unsigned int head_truesize = head->truesize;
struct sk_buff **nextp = reasm_data;
struct rb_node *rbn;
struct sk_buff *fp;
@@ -628,8 +671,12 @@ void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head,
head->tstamp = q->stamp;
head->mono_delivery_time = q->mono_delivery_time;
+ /* After inet_frag_reasm_prepare(), q->truesize is charged to sk.
+ * sum_truesize also includes what it added (skb_unclone() and
+ * frag_list clone).
+ */
if (sk)
- refcount_add(sum_truesize - head_truesize, &sk->sk_wmem_alloc);
+ inet_frag_wmem_adjust(sk, sum_truesize - (int)q->truesize);
}
EXPORT_SYMBOL(inet_frag_reasm_finish);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index e50740dfe0092..b862c6eeedd9b 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -425,16 +425,19 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
goto out_fail;
}
+ /* Check the size on the first fragment, which will become the head:
+ * inet_frag_reasm_finish() must follow inet_frag_reasm_prepare().
+ */
+ len = ip_hdrlen(skb_rb_first(&qp->q.rb_fragments)) + qp->q.len;
+ err = -E2BIG;
+ if (len > 65535)
+ goto out_oversize;
+
/* Make the one we just received the head. */
reasm_data = inet_frag_reasm_prepare(&qp->q, skb, prev_tail);
if (!reasm_data)
goto out_nomem;
- len = ip_hdrlen(skb) + qp->q.len;
- err = -E2BIG;
- if (len > 65535)
- goto out_oversize;
-
inet_frag_reasm_finish(&qp->q, skb, reasm_data,
ip_frag_coalesce_ok(qp));
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 357e7b3768633..64f9696e7227c 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -327,11 +327,11 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
if (unlikely(ecn == 0xff))
goto err;
- reasm_data = inet_frag_reasm_prepare(&fq->q, skb, prev_tail);
- if (!reasm_data)
- goto err;
-
- payload_len = ((skb->data - skb_network_header(skb)) -
+ /* Check the size on the first fragment, which will become the head:
+ * inet_frag_reasm_finish() must follow inet_frag_reasm_prepare().
+ */
+ payload_len = ((skb_rb_first(&fq->q.rb_fragments)->data -
+ skb_network_header(skb_rb_first(&fq->q.rb_fragments))) -
sizeof(struct ipv6hdr) + fq->q.len -
sizeof(struct frag_hdr));
if (payload_len > IPV6_MAXPLEN) {
@@ -340,6 +340,10 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
goto err;
}
+ reasm_data = inet_frag_reasm_prepare(&fq->q, skb, prev_tail);
+ if (!reasm_data)
+ goto err;
+
/* We have to remove fragment header from datagram and to relocate
* header in order to calculate ICV correctly. */
skb_network_header(skb)[fq->nhoffset] = skb_transport_header(skb)[0];
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index fc9babcd94517..ffcb36690ffdb 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -264,16 +264,20 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
if (unlikely(ecn == 0xff))
goto out_fail;
- reasm_data = inet_frag_reasm_prepare(&fq->q, skb, prev_tail);
- if (!reasm_data)
- goto out_oom;
-
- payload_len = ((skb->data - skb_network_header(skb)) -
+ /* Check the size on the first fragment, which will become the head:
+ * inet_frag_reasm_finish() must follow inet_frag_reasm_prepare().
+ */
+ payload_len = ((skb_rb_first(&fq->q.rb_fragments)->data -
+ skb_network_header(skb_rb_first(&fq->q.rb_fragments))) -
sizeof(struct ipv6hdr) + fq->q.len -
sizeof(struct frag_hdr));
if (payload_len > IPV6_MAXPLEN)
goto out_oversize;
+ reasm_data = inet_frag_reasm_prepare(&fq->q, skb, prev_tail);
+ if (!reasm_data)
+ goto out_oom;
+
/* We have to remove fragment header from datagram and to relocate
* header in order to calculate ICV correctly. */
nhoff = fq->nhoffset;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0248/1059] libbpf: Avoid overflow in BTF.ext bounds check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (246 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0247/1059] inet: frags: bound the wmem charge of the socket completing a reassembly Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0249/1059] gpio: pcf857x: implement get_direction() Greg Kroah-Hartman
` (750 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Darren Carreras, Andrii Nakryiko,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Carreras <carrerasdarren@gmail.com>
[ Upstream commit e40f61a31688898e7cf81e91074a42f805883e4d ]
A malformed BTF.ext subsection length in an ELF input can wrap the
pointer addition used by btf_ext_parse_sec_info() on 32-bit builds. The
wrapped pointer passes the bounds check and parsing then reads beyond the
copied BTF.ext data.
Ensure the header fits in the copied data, then validate the subsection
offset and length with subtraction before forming its pointer.
Fixes: ae4ab4b4117d ("btf: expose API to work with raw btf_ext data")
Closes: https://issues.oss-fuzz.com/issues/477315119
Signed-off-by: Darren Carreras <carrerasdarren@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260813-b4-libbpf-v6-send-20260813-v6-1-56be61c52758@gmail.com
[ sashal: Moved the info pointer and comment below the new bounds check, and kept the older function name, with the comment placed on the declaration originally. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/lib/bpf/btf.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index df3f001dfeec7..8df51b51354eb 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -2657,9 +2657,8 @@ static int btf_ext_setup_info(struct btf_ext *btf_ext,
{
const struct btf_ext_info_sec *sinfo;
struct btf_ext_info *ext_info;
- __u32 info_left, record_size;
+ __u32 data_left, info_left, record_size;
size_t sec_cnt = 0;
- /* The start of the info sec (including the __u32 record_size). */
void *info;
if (ext_sec->len == 0)
@@ -2671,15 +2670,20 @@ static int btf_ext_setup_info(struct btf_ext *btf_ext,
return -EINVAL;
}
- info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off;
- info_left = ext_sec->len;
+ if (btf_ext->hdr->hdr_len > btf_ext->data_size)
+ return -EINVAL;
- if (btf_ext->data + btf_ext->data_size < info + ext_sec->len) {
+ data_left = btf_ext->data_size - btf_ext->hdr->hdr_len;
+ if (ext_sec->off > data_left || ext_sec->len > data_left - ext_sec->off) {
pr_debug("%s section (off:%u len:%u) is beyond the end of the ELF section .BTF.ext\n",
ext_sec->desc, ext_sec->off, ext_sec->len);
return -EINVAL;
}
+ /* The start of the info sec (including the __u32 record_size). */
+ info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off;
+ info_left = ext_sec->len;
+
/* At least a record size */
if (info_left < sizeof(__u32)) {
pr_debug(".BTF.ext %s record size not found\n", ext_sec->desc);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0249/1059] gpio: pcf857x: implement get_direction()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (247 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0248/1059] libbpf: Avoid overflow in BTF.ext bounds check Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0250/1059] perf jitdump: Free event in jit_repipe_code_move() Greg Kroah-Hartman
` (749 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tapio Reijonen, Linus Walleij,
Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <tapio.reijonen@vaisala.com>
[ Upstream commit ed14364ae8c310cc3f3f649ffcbc7f82befe1579 ]
The GPIO core warns (and taints the kernel) when a gpiochip lacks
.get_direction() and a consumer queries a line's direction, for example
via /sys/kernel/debug/gpio. pcf857x provided direction_input/output but
no get_direction.
These quasi-bidirectional expanders cannot report direction in hardware,
and the 'out' software latch alone is ambiguous - a released (input)
line and an output driven high both read back as a set bit. Track the
direction explicitly in a 'dir' latch updated by the direction_input(),
direction_output() and set_multiple() paths, and return it from
get_direction(). Initialise it from the same reset state as 'out':
released lines are inputs, lines flagged in the power-on latch are
driven-low outputs.
Fixes: 15fae37d9f5f ("gpiolib: pcf857x i2c gpio expander support")
Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260825-b4-gpio-pcf857x-get-direction-v1-1-de15996ae354@vaisala.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
[ sashal: Omitted the pcf857x_set_multiple() hunk since this driver has no .set_multiple, and adapted context to older unsigned types and the pcf857x_probe() signature using id->driver_data. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-pcf857x.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index e98ea47d72379..c6ad3b916bb8a 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -72,8 +72,9 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table);
struct pcf857x {
struct gpio_chip chip;
struct i2c_client *client;
- struct mutex lock; /* protect 'out' */
+ struct mutex lock; /* protect 'out' and 'dir' */
unsigned out; /* software latch */
+ unsigned dir; /* direction latch (1 = input) */
unsigned status; /* current status */
unsigned irq_enabled; /* enabled irqs */
@@ -126,12 +127,21 @@ static int pcf857x_input(struct gpio_chip *chip, unsigned offset)
mutex_lock(&gpio->lock);
gpio->out |= (1 << offset);
+ gpio->dir |= (1 << offset);
status = gpio->write(gpio->client, gpio->out);
mutex_unlock(&gpio->lock);
return status;
}
+static int pcf857x_get_direction(struct gpio_chip *chip, unsigned int offset)
+{
+ struct pcf857x *gpio = gpiochip_get_data(chip);
+
+ return (gpio->dir & (1 << offset)) ? GPIO_LINE_DIRECTION_IN
+ : GPIO_LINE_DIRECTION_OUT;
+}
+
static int pcf857x_get(struct gpio_chip *chip, unsigned offset)
{
struct pcf857x *gpio = gpiochip_get_data(chip);
@@ -152,6 +162,7 @@ static int pcf857x_output(struct gpio_chip *chip, unsigned offset, int value)
gpio->out |= bit;
else
gpio->out &= ~bit;
+ gpio->dir &= ~bit;
status = gpio->write(gpio->client, gpio->out);
mutex_unlock(&gpio->lock);
@@ -278,6 +289,7 @@ static int pcf857x_probe(struct i2c_client *client,
gpio->chip.set = pcf857x_set;
gpio->chip.direction_input = pcf857x_input;
gpio->chip.direction_output = pcf857x_output;
+ gpio->chip.get_direction = pcf857x_get_direction;
gpio->chip.ngpio = id->driver_data;
/* NOTE: the OnSemi jlc1562b is also largely compatible with
@@ -349,6 +361,7 @@ static int pcf857x_probe(struct i2c_client *client,
* reset state. Otherwise it flags pins to be driven low.
*/
gpio->out = ~n_latch;
+ gpio->dir = ~n_latch;
gpio->status = gpio->read(gpio->client);
/* Enable irqchip if we have an interrupt */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0250/1059] perf jitdump: Free event in jit_repipe_code_move()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (248 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0249/1059] gpio: pcf857x: implement get_direction() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0251/1059] cxl/test: Map mock device nodes to an online node Greg Kroah-Hartman
` (748 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Ian Rogers,
Stephane Eranian, Arnaldo Carvalho de Melo, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <acme@redhat.com>
[ Upstream commit 7fc5851aac606b9e4143f6857710cc5f346770c5 ]
jit_repipe_code_move() allocates a perf_event with calloc but never
frees it — the 'out' label exits with only perf_sample__exit().
The sibling function jit_repipe_code_load() correctly calls
free(event) at its out label. Add the same free(event) to
jit_repipe_code_move().
Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Stephane Eranian <eranian@google.com>
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Added an out: label with free(event) to the older function layout, and changed the mmap2 failure return into goto out, since perf_sample__exit() and the upstream label are absent. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/jitdump.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 04e648cdab89f..d3ffe5eb55f01 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -665,12 +665,13 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)
ret = perf_event__process_mmap2(tool, event, &sample, jd->machine);
if (ret)
- return ret;
+ goto out;
ret = jit_inject_event(jd, event);
if (!ret)
build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine);
-
+out:
+ free(event);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0251/1059] cxl/test: Map mock device nodes to an online node
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (249 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0250/1059] perf jitdump: Free event in jit_repipe_code_move() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0252/1059] fuse: dont bump attr_version for async direct read completion Greg Kroah-Hartman
` (747 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Davidlohr Bueso, Dave Jiang,
Alison Schofield, Shaikh Kamaluddin, Gregory Price (Meta),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <dave@stgolabs.net>
[ Upstream commit 6f057dea152574dd044382fd0ba5ed19e3ecba25 ]
cxl_type3_mem_init() and cxl_type2_mem_init() assign alternating NUMA
nodes to the mock memdevs to model multi-node topologies. On a
single-node host node 1 has no pgdat, and the first node-aware
allocation in an odd device's probe faults on a NULL zonelist:
Oops: general protection fault, probably for non-canonical address 0xdffffc00000006e3
KASAN: probably user-memory-access in range [0x0000000000003718-0x000000000000371f]
Workqueue: async async_run_entry_fn
RIP: __alloc_frozen_pages_noprof+0x288
new_slab
___slab_alloc
__kmalloc_node_track_caller_noprof
devm_kmalloc
cxl_mock_mem_probe
Map the requested node to an online one, as dax_hmem already does
for its target node.
Fixes: cf1f6877b088 ("cxl/memdev: Add numa_node attribute")
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20260831175119.3247915-1-dave@stgolabs.net
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Applied the numa_map_to_online_node() wrapping to the two set_dev_node() sites that exist in this older file, since the upstream functions and sections it targets are missing. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/cxl/test/cxl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 37bd29e555903..5ef0f6a454726 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -948,7 +948,7 @@ static __init int cxl_single_init(void)
if (!pdev)
goto err_mem;
pdev->dev.parent = &dport->dev;
- set_dev_node(&pdev->dev, i % 2);
+ set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
rc = platform_device_add(pdev);
if (rc) {
@@ -1112,7 +1112,7 @@ static __init int cxl_test_init(void)
if (!pdev)
goto err_mem;
pdev->dev.parent = &dport->dev;
- set_dev_node(&pdev->dev, i % 2);
+ set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
rc = platform_device_add(pdev);
if (rc) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0252/1059] fuse: dont bump attr_version for async direct read completion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (250 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0251/1059] cxl/test: Map mock device nodes to an online node Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0253/1059] RDMA/hns: Fix missing CQE when UD QP use different SL Greg Kroah-Hartman
` (746 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Horst Birthelmer, Jingbo Xu,
Miklos Szeredi, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jingbo Xu <jefflexu@linux.alibaba.com>
[ Upstream commit fc60668db85584da911e5d0a65c8698628f98bba ]
The attr_version counter should only be incremented when cached
attributes are actually modified (as documented in commit 1fb69e781729
("fuse: fix race between getattr and write")). Async direct reads do not
modify any cached inode attributes (size, mtime, ctime), so bumping
attr_version in fuse_aio_complete() for reads is incorrect.
This unconditional bump causes a livelock when auto_inval_data is
enabled together with writeback_cache: fuse_cache_read_iter() issues a
FUSE_GETATTR before every read, but by the time the response arrives,
an async DIO read completion has already incremented fi->attr_version
past the snapshot taken before the request. The GETATTR result is then
discarded (attr_version race), fi->i_time is never refreshed, and every
subsequent read triggers yet another GETATTR -- creating an infinite
loop of useless round-trips.
Fix this by only bumping attr_version for write completions, consistent
with the synchronous DIO write path (fuse_write_update_attr) and the
cached write path.
Fixes: 01e9d11a3e79 ("fuse: add support of async IO")
Reviewed-by: Horst Birthelmer <hbirthelmer@ddn.com>
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[ sashal: Adjusted hunk context because this tree uses a local inode variable in fuse_aio_complete() where upstream uses mapping; the one-line io->write condition is unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fuse/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 8290db2b4f13b..5d632a41ed496 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -719,7 +719,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
if (!left && !io->blocking) {
ssize_t res = fuse_get_res_by_io(io);
- if (res >= 0) {
+ if (res >= 0 && io->write) {
struct inode *inode = file_inode(io->iocb->ki_filp);
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0253/1059] RDMA/hns: Fix missing CQE when UD QP use different SL
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (251 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0252/1059] fuse: dont bump attr_version for async direct read completion Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0254/1059] wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete Greg Kroah-Hartman
` (745 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengchang Tang, Junxian Huang,
Leon Romanovsky, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <tangchengchang@huawei.com>
[ Upstream commit 3547f46c31993d41748f0f7936f9d4dc5b5d4b12 ]
Due to the hardware contraint, CQEs may be dropped when a UD QP
sends with multiple SLs. Pin the SL to the value from the first
post_send on the QP to avoid this issue.
Fixes: 66d86e529dd5 ("RDMA/hns: Add UD support for HIP09")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20260831020324.3540901-2-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Adjusted the struct hns_roce_qp hunk to add ud_sl_set after cong_type and kept the existing SL bounds check in fill_ud_av() ahead of the new SL latch. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/hns/hns_roce_device.h | 1 +
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index fec4084e2dfff..d22012dd4d469 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -653,6 +653,7 @@ struct hns_roce_qp {
struct hns_user_mmap_entry *dwqe_mmap_entry;
u32 config;
enum hns_roce_cong_type cong_type;
+ bool ud_sl_set;
};
struct hns_roce_ib_iboe {
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index f57212698a70f..d61efee7ae8fe 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -425,7 +425,8 @@ static int set_ud_opcode(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,
return 0;
}
-static int fill_ud_av(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,
+static int fill_ud_av(struct hns_roce_qp *qp,
+ struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,
struct hns_roce_ah *ah)
{
struct ib_device *ib_dev = ah->ibah.device;
@@ -439,7 +440,12 @@ static int fill_ud_av(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,
if (WARN_ON(ah->av.sl > MAX_SERVICE_LEVEL))
return -EINVAL;
- hr_reg_write(ud_sq_wqe, UD_SEND_WQE_SL, ah->av.sl);
+ if (!qp->ud_sl_set) {
+ qp->sl = ah->av.sl;
+ qp->ud_sl_set = true;
+ }
+
+ hr_reg_write(ud_sq_wqe, UD_SEND_WQE_SL, qp->sl);
ud_sq_wqe->sgid_index = ah->av.gid_index;
@@ -489,12 +495,10 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp,
qp->qkey : ud_wr(wr)->remote_qkey);
hr_reg_write(ud_sq_wqe, UD_SEND_WQE_DQPN, ud_wr(wr)->remote_qpn);
- ret = fill_ud_av(ud_sq_wqe, ah);
+ ret = fill_ud_av(qp, ud_sq_wqe, ah);
if (ret)
return ret;
- qp->sl = to_hr_ah(ud_wr(wr)->ah)->av.sl;
-
set_extend_sge(qp, wr->sg_list, &curr_idx, valid_num_sge);
/*
@@ -5374,6 +5378,7 @@ static void v2_set_flushed_fields(struct ib_qp *ibqp,
hr_reg_write(context, QPC_SQ_PRODUCER_IDX, hr_qp->sq.head);
hr_reg_clear(qpc_mask, QPC_SQ_PRODUCER_IDX);
hr_qp->state = IB_QPS_ERR;
+ hr_qp->ud_sl_set = false;
spin_unlock_irqrestore(&hr_qp->sq.lock, sq_flag);
if (ibqp->srq || ibqp->qp_type == IB_QPT_XRC_INI) /* no RQ */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0254/1059] wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (252 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0253/1059] RDMA/hns: Fix missing CQE when UD QP use different SL Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0255/1059] wifi: mac80211: fix IEEE80211_TX_CTL_REQ_TX_STATUS mixup Greg Kroah-Hartman
` (744 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Miaoqing Pan, Baochen Qiang,
Rameshkumar Sundaram, Jeff Johnson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
[ Upstream commit 1a7bcf5324c8e2de6512eca5b028b6b283181d3f ]
On WCN6750, if QMI messages never arrive (for example when qrtr_smd
is not ready), WLAN initialization stops before the device is fully
registered. In this case ATH11K_FLAG_QMI_FAIL is not set because no
QMI event handler is executed.
When the driver is removed, ath11k_ahb_remove() still calls
ath11k_core_deinit(), which eventually triggers
ath11k_ce_cleanup_pipes() on uninitialized CE pipes and results in a
NULL pointer dereference in ath11k_hal_srng_access_begin():
ath11k_hal_srng_access_begin+0x14/0x68 [ath11k]
ath11k_ce_cleanup_pipes+0x184/0x190 [ath11k]
ath11k_pcic_stop+0x24/0x38 [ath11k]
ath11k_core_deinit+0xfc/0x1c0 [ath11k]
ath11k_ahb_remove+0x38/0xa0 [ath11k_ahb]
Fix this by invoking ath11k_ahb_remove_prepare() before the state
check and skipping ath11k_core_deinit() if ATH11K_FLAG_REGISTERED
is not set, core initialization did not complete and CE pipes may
remain uninitialized, making ath11k_core_deinit() unsafe.
Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1
Fixes: 00402f49d26f ("ath11k: Add support for WCN6750 device")
Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20260806101331.484063-3-miaoqing.pan@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: adjusted the ath11k_ahb_remove() hunk to keep the local one-argument ath11k_ahb_power_down(ab) call instead of upstream's (ab, false) ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath11k/ahb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
index db20b39c0bf56..795700433eb06 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -1282,14 +1282,15 @@ static int ath11k_ahb_remove(struct platform_device *pdev)
{
struct ath11k_base *ab = platform_get_drvdata(pdev);
- if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) {
+ ath11k_ahb_remove_prepare(ab);
+
+ if (!test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
ath11k_ahb_power_down(ab);
ath11k_debugfs_soc_destroy(ab);
ath11k_qmi_deinit_service(ab);
goto qmi_fail;
}
- ath11k_ahb_remove_prepare(ab);
ath11k_core_deinit(ab);
qmi_fail:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0255/1059] wifi: mac80211: fix IEEE80211_TX_CTL_REQ_TX_STATUS mixup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (253 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0254/1059] wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0256/1059] ACPI: APEI: GHES: Validate memory error section length before payload access Greg Kroah-Hartman
` (743 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit e035900ffe9e8978f7c0d7b61811b6b578751697 ]
In ieee80211_build_hdr(), IEEE80211_TX_CTL_REQ_TX_STATUS is checked
in ctrl_flags, which is wrong - IEEE80211_TX_CTL_REQ_TX_STATUS is in
info->flags, so the check is for IEEE80211_TX_CTRL_PORT_CTRL_PROTO
instead. This works out OK because the only place setting _that_ at
a point before this gets called is in fact ieee80211_tx_control_port()
which was intended here. This is actually needed for correctness, if
jt were checking info->flags instead, TDLS would fill/leak the status
frames created here.
However, we can just fix it by using the cookie instead, that'll be
set for PREAUTH frames via ieee80211_tx_control_port() as well, and
no other frames.
Additionally, the code also erroneously set it, but that just caused
preauth frames to get it set, since storing the ACK SKB will also set
the correct flag. Drop this assignment entirely.
Fixes: a7528198add8 ("mac80211: support control port TX status reporting")
Link: https://patch.msgid.link/20260803141309.292711-10-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Replaced the missing sk_requests_wifi_status() helper with the branch's open-coded skb->sk SKBTX_WIFI_STATUS check, while still swapping the ctrl_flags term for cookie. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/tx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c3256eb8adae5..3fa10e1d56431 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2908,7 +2908,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
if (unlikely(!multicast && ((skb->sk &&
skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) ||
- ctrl_flags & IEEE80211_TX_CTL_REQ_TX_STATUS)))
+ cookie)))
info_id = ieee80211_store_ack_skb(local, skb, &info_flags,
cookie);
@@ -6101,9 +6101,6 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
if (unencrypted)
flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
- if (cookie)
- ctrl_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-
flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX;
skb = dev_alloc_skb(local->hw.extra_tx_headroom +
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0256/1059] ACPI: APEI: GHES: Validate memory error section length before payload access
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (254 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0255/1059] wifi: mac80211: fix IEEE80211_TX_CTL_REQ_TX_STATUS mixup Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0257/1059] remoteproc: imx_rproc: Allow mappings ending at region boundary Greg Kroah-Hartman
` (742 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Hanjun Guo, Shuai Xue,
Dave Jiang, Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <dave.jiang@intel.com>
[ Upstream commit 10338c9085b4939a428a8dc78d2bbf62c161278b ]
ghes_do_proc() hands the CPER_SEC_PLATFORM_MEM payload to the report chain,
arch_apei_report_mem_error() and ghes_handle_memory_failure() without
checking gdata->error_data_length. All three read validation_bits and
physical_addr, at offsets 0 and 16, so a shorter section reads past the
record.
Check the length once in ghes_do_proc(), before any consumer runs. Take the
73-byte struct cper_sec_mem_err_old as the floor: older firmware
legitimately emits that UEFI 2.1/2.2 layout, and it makes validation_bits
safe to read.
The fields from "extended" on are absent from that layout, so also require
whatever length the validation bits claim. Derive it per field rather than
demanding the full 80 bytes: rank needs only 76, and the BANK_GROUP and
BANK_ADDRESS bits describe "bank" at offset 38, which every record carries.
Testing the whole mask against one size, as cper_print_mem() does, gets it
wrong both ways.
Reported-by: sashiko-bot@kernel.org
Closes: https://sashiko.dev/#/patchset/20260714231835.303081-1-dave.jiang@intel.com?part=7
Fixes: ca104edc1784 ("ACPI, APEI, GHES: Cleanup ghes memory error handling")
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260904172337.1409775-12-dave.jiang@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Added the section-length checks in ghes_do_proc() ahead of ghes_edac_report_mem_error() instead of the notifier chain call, with the helper placed before ghes_do_proc() since the surrounding code differs. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/apei/ghes.c | 41 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 517ed5f77008f..b8599ec04b1ad 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -644,6 +644,28 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata,
schedule_work(&entry->work);
}
+/*
+ * The fields from "extended" on are absent from the 73-byte UEFI 2.1/2.2
+ * layout that older firmware still emits. Return the length needed for the
+ * fields the validation bits claim, so over-claiming is rejected without
+ * rejecting an honest short record.
+ */
+static u32 ghes_mem_err_min_len(u64 validation_bits)
+{
+ u32 len = sizeof(struct cper_sec_mem_err_old);
+
+ if (validation_bits & (CPER_MEM_VALID_ROW_EXT | CPER_MEM_VALID_CHIP_ID))
+ len = offsetof(struct cper_sec_mem_err, rank);
+ if (validation_bits & CPER_MEM_VALID_RANK_NUMBER)
+ len = offsetof(struct cper_sec_mem_err, mem_array_handle);
+ if (validation_bits & CPER_MEM_VALID_CARD_HANDLE)
+ len = offsetof(struct cper_sec_mem_err, mem_dev_handle);
+ if (validation_bits & CPER_MEM_VALID_MODULE_HANDLE)
+ len = sizeof(struct cper_sec_mem_err);
+
+ return len;
+}
+
static bool ghes_do_proc(struct ghes *ghes,
const struct acpi_hest_generic_status *estatus)
{
@@ -668,6 +690,25 @@ static bool ghes_do_proc(struct ghes *ghes,
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
+ /*
+ * Check once for all three consumers below. The 73-byte
+ * UEFI 2.1/2.2 layout is the floor, matching
+ * cper_estatus_print_section() and making
+ * validation_bits safe to read.
+ */
+ if (gdata->error_data_length <
+ sizeof(struct cper_sec_mem_err_old))
+ continue;
+
+ /* Then require what the claimed fields actually need. */
+ if (gdata->error_data_length <
+ ghes_mem_err_min_len(mem_err->validation_bits)) {
+ pr_warn_ratelimited(FW_WARN GHES_PFX
+ "memory error section too small (%u) for the fields it claims\n",
+ gdata->error_data_length);
+ continue;
+ }
+
ghes_edac_report_mem_error(sev, mem_err);
arch_apei_report_mem_error(sev, mem_err);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0257/1059] remoteproc: imx_rproc: Allow mappings ending at region boundary
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (255 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0256/1059] ACPI: APEI: GHES: Validate memory error section length before payload access Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0258/1059] RDMA/irdma: Preserve fast-registration IOVA on 32-bit Greg Kroah-Hartman
` (741 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marcel Hofmann, Mathieu Poirier,
Sasha Levin, Peng Fan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Hofmann <marcel.hofmann@ingenics-digital.com>
[ Upstream commit 749eed0c7178c8d53ce4c9acdda4a545721c494b ]
The address range checks in imx_rproc_da_to_sys() and
imx_rproc_da_to_va() use a strict comparison for the exclusive end
address of the requested range.
As a result, a valid request that ends exactly at the end of an address
translation or mapped memory region is rejected. For a region
[start, start + size), a request [addr, addr + len) is contained when:
addr >= start && addr + len <= start + size
This occurs when a loadable ELF segment fills an entire mapped memory
region. This can be produced by a linker script that extends the
resource table section to the end of its designated region:
.resource_table :
{
. = ALIGN(8);
KEEP(*(.resource_table)) /* Resource table */
. = ALIGN(8);
. = ORIGIN(m_rsc_tbl) + LENGTH(m_rsc_tbl);
} > m_rsc_tbl =0x00
This produces a ELF program header like:
LOAD 0x010000 0xa4220000 0xa4220000 0x01000 0x01000 R 0x1000
In this case, the segment size matches the mapped region size exactly,
causing the address translation to fail with:
bad phdr da 0xa4220000 mem 0x1000
Rework the upper-bound checks to allow ranges ending exactly at the region
boundary while guarding against integer overflow.
Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Marcel Hofmann <marcel.hofmann@ingenics-digital.com>
Tested-by: Peng Fan <peng.fan@nxp.com> #i.MX95-19x19-EVK
Link: https://lore.kernel.org/r/20260827123136.438798-1-marcel@hofmania.de
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
[ sashal: Dropped the upstream context block that skips other cores' address-translation entries, since this tree lacks ATT_CORE_MASK and core_index, and applied only the bounds-check change. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/remoteproc/imx_rproc.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 37612ced203ac..3225d952c8930 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -358,10 +358,13 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da,
/* parse address translation table */
for (i = 0; i < dcfg->att_size; i++) {
const struct imx_rproc_att *att = &dcfg->att[i];
+ u64 offset;
- if (da >= att->da && da + len < att->da + att->size) {
- unsigned int offset = da - att->da;
+ if (da < att->da)
+ continue;
+ offset = da - att->da;
+ if (offset <= att->size && len <= att->size - offset) {
*sys = att->sa + offset;
if (is_iomem)
*is_iomem = att->flags & ATT_IOMEM;
@@ -392,9 +395,14 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *i
return NULL;
for (i = 0; i < IMX_RPROC_MEM_MAX; i++) {
- if (sys >= priv->mem[i].sys_addr && sys + len <
- priv->mem[i].sys_addr + priv->mem[i].size) {
- unsigned int offset = sys - priv->mem[i].sys_addr;
+ u64 offset;
+
+ if (sys < priv->mem[i].sys_addr)
+ continue;
+
+ offset = sys - priv->mem[i].sys_addr;
+ if (offset <= priv->mem[i].size &&
+ len <= priv->mem[i].size - offset) {
/* __force to make sparse happy with type conversion */
va = (__force void *)(priv->mem[i].cpu_addr + offset);
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0258/1059] RDMA/irdma: Preserve fast-registration IOVA on 32-bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (256 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0257/1059] remoteproc: imx_rproc: Allow mappings ending at region boundary Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0259/1059] ASoC: sta32x: make power restoration transactional Greg Kroah-Hartman
` (740 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jacob Moroni, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <leonro@nvidia.com>
[ Upstream commit c470050f2a7a7748ce35367e828885a8e658d712 ]
ib_mr::iova is u64, but the fast-registration path passes it through
void * and uintptr_t. These conversions truncate the upper 32 bits on
32-bit kernels before the WQE is built.
Store the IOVA as u64 and write it directly to the WQE. The sole caller
always uses VA-based addressing, so remove the unused FBO selection and
set the VA-based bit unconditionally.
Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Link: https://patch.msgid.link/20260903-64-bit-iova-is-silently-truncated-to-v1-1-96e878ea6873@nvidia.com
Reviewed-by: Jacob Moroni <jmoroni@google.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
[ sashal: Adjusted context in irdma_sc_mr_fast_register() because this tree still has a PUSHWQE line after the VABASEDTO line, which is kept unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/irdma/ctrl.c | 6 ++----
drivers/infiniband/hw/irdma/type.h | 4 +---
drivers/infiniband/hw/irdma/verbs.c | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/ctrl.c b/drivers/infiniband/hw/irdma/ctrl.c
index df0aaa44e315f..b2b3d5d376f9d 100644
--- a/drivers/infiniband/hw/irdma/ctrl.c
+++ b/drivers/infiniband/hw/irdma/ctrl.c
@@ -1321,9 +1321,7 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp,
info->wr_id, wqe_idx,
&qp->qp_uk.sq_wrtrk_array[wqe_idx].wrid);
- temp = (info->addr_type == IRDMA_ADDR_TYPE_VA_BASED) ?
- (uintptr_t)info->va : info->fbo;
- set_64bit_val(wqe, 0, temp);
+ set_64bit_val(wqe, 0, info->va);
temp = FIELD_GET(IRDMAQPSQ_FIRSTPMPBLIDXHI,
info->first_pm_pbl_index >> 16);
@@ -1340,7 +1338,7 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp,
FIELD_PREP(IRDMAQPSQ_LPBLSIZE, info->chunk_size) |
FIELD_PREP(IRDMAQPSQ_HPAGESIZE, page_size) |
FIELD_PREP(IRDMAQPSQ_STAGRIGHTS, info->access_rights) |
- FIELD_PREP(IRDMAQPSQ_VABASEDTO, info->addr_type) |
+ IRDMAQPSQ_VABASEDTO |
FIELD_PREP(IRDMAQPSQ_PUSHWQE, (sq_info.push_wqe ? 1 : 0)) |
FIELD_PREP(IRDMAQPSQ_READFENCE, info->read_fence) |
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
diff --git a/drivers/infiniband/hw/irdma/type.h b/drivers/infiniband/hw/irdma/type.h
index 1c7cbf7c67bed..45a64ffebe908 100644
--- a/drivers/infiniband/hw/irdma/type.h
+++ b/drivers/infiniband/hw/irdma/type.h
@@ -1049,13 +1049,11 @@ struct irdma_reg_ns_stag_info {
struct irdma_fast_reg_stag_info {
u64 wr_id;
u64 reg_addr_pa;
- u64 fbo;
- void *va;
+ u64 va;
u64 total_len;
u32 page_size;
u32 chunk_size;
u32 first_pm_pbl_index;
- enum irdma_addressing_type addr_type;
irdma_stag_index stag_idx;
u16 access_rights;
u32 pd_id;
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index fa7d09fa9ef22..dc4a7e3aeb5f1 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3284,8 +3284,7 @@ static int irdma_post_send(struct ib_qp *ibqp,
stag_info.stag_idx = reg_wr(ib_wr)->key >> 8;
stag_info.page_size = reg_wr(ib_wr)->mr->page_size;
stag_info.wr_id = ib_wr->wr_id;
- stag_info.addr_type = IRDMA_ADDR_TYPE_VA_BASED;
- stag_info.va = (void *)(uintptr_t)iwmr->ibmr.iova;
+ stag_info.va = iwmr->ibmr.iova;
stag_info.total_len = iwmr->ibmr.length;
stag_info.reg_addr_pa = *palloc->level1.addr;
stag_info.first_pm_pbl_index = palloc->level1.idx;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0259/1059] ASoC: sta32x: make power restoration transactional
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (257 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0258/1059] RDMA/irdma: Preserve fast-registration IOVA on 32-bit Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0260/1059] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Greg Kroah-Hartman
` (739 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <pengpeng@iscas.ac.cn>
[ Upstream commit 3e71dc4508bc84862dc3644e3b6a5b966bff22ad ]
sta32x_set_bias_level() enables the codec supplies, restores the
coefficient and register state, and then starts the watchdog. Register
access errors in the mute and coefficient helpers and the cache replay
are discarded, allowing DAPM to publish STANDBY for a partially restored
codec.
Propagate every operation in the local restore transaction, including
the final standby-state write. Start the watchdog only after that write
succeeds. On failure, hold reset, mark the cache dirty, disable the
supplies and report a cleanup failure while preserving the primary
error. The DAPM bias callback consumes the returned error independently
of component resume handling.
Fixes: 54dc6cabe684 ("ASoC: sta32x: preserve coefficient RAM")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260830141521.33246-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Adjusted patch context because the local tree lacks the upstream dapm declaration line in sta32x_set_bias_level(); the logic is otherwise unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/sta32x.c | 101 +++++++++++++++++++++++++++++---------
1 file changed, 77 insertions(+), 24 deletions(-)
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 17003e06b4606..daf9b94af4530 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -346,27 +346,48 @@ static int sta32x_sync_coef_shadow(struct snd_soc_component *component)
{
struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
unsigned int cfud;
- int i;
+ int i, ret;
/* preserve reserved bits in STA32X_CFUD */
- regmap_read(sta32x->regmap, STA32X_CFUD, &cfud);
+ ret = regmap_read(sta32x->regmap, STA32X_CFUD, &cfud);
+ if (ret)
+ return ret;
+
cfud &= 0xf0;
for (i = 0; i < STA32X_COEF_COUNT; i++) {
- regmap_write(sta32x->regmap, STA32X_CFADDR2, i);
- regmap_write(sta32x->regmap, STA32X_B1CF1,
- (sta32x->coef_shadow[i] >> 16) & 0xff);
- regmap_write(sta32x->regmap, STA32X_B1CF2,
- (sta32x->coef_shadow[i] >> 8) & 0xff);
- regmap_write(sta32x->regmap, STA32X_B1CF3,
- (sta32x->coef_shadow[i]) & 0xff);
+ ret = regmap_write(sta32x->regmap, STA32X_CFADDR2, i);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(sta32x->regmap, STA32X_B1CF1,
+ (sta32x->coef_shadow[i] >> 16) & 0xff);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(sta32x->regmap, STA32X_B1CF2,
+ (sta32x->coef_shadow[i] >> 8) & 0xff);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(sta32x->regmap, STA32X_B1CF3,
+ sta32x->coef_shadow[i] & 0xff);
+ if (ret)
+ return ret;
+
/*
* chip documentation does not say if the bits are
* self-clearing, so do it explicitly
*/
- regmap_write(sta32x->regmap, STA32X_CFUD, cfud);
- regmap_write(sta32x->regmap, STA32X_CFUD, cfud | 0x01);
+ ret = regmap_write(sta32x->regmap, STA32X_CFUD, cfud);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(sta32x->regmap, STA32X_CFUD, cfud | 0x01);
+ if (ret)
+ return ret;
}
+
return 0;
}
@@ -374,15 +395,24 @@ static int sta32x_cache_sync(struct snd_soc_component *component)
{
struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
unsigned int mute;
- int rc;
+ int restore_ret, ret;
/* mute during register sync */
- regmap_read(sta32x->regmap, STA32X_MMUTE, &mute);
- regmap_write(sta32x->regmap, STA32X_MMUTE, mute | STA32X_MMUTE_MMUTE);
- sta32x_sync_coef_shadow(component);
- rc = regcache_sync(sta32x->regmap);
- regmap_write(sta32x->regmap, STA32X_MMUTE, mute);
- return rc;
+ ret = regmap_read(sta32x->regmap, STA32X_MMUTE, &mute);
+ if (ret)
+ return ret;
+
+ ret = regmap_write(sta32x->regmap, STA32X_MMUTE,
+ mute | STA32X_MMUTE_MMUTE);
+ if (ret)
+ return ret;
+
+ ret = sta32x_sync_coef_shadow(component);
+ if (!ret)
+ ret = regcache_sync(sta32x->regmap);
+
+ restore_ret = regmap_write(sta32x->regmap, STA32X_MMUTE, mute);
+ return ret ?: restore_ret;
}
/* work around ESD issue where sta32x resets and loses all configuration */
@@ -798,8 +828,8 @@ static int sta32x_startup_sequence(struct sta32x_priv *sta32x)
static int sta32x_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{
- int ret;
struct sta32x_priv *sta32x = snd_soc_component_get_drvdata(component);
+ int cleanup_ret, ret;
dev_dbg(component->dev, "level = %d\n", level);
switch (level) {
@@ -823,15 +853,28 @@ static int sta32x_set_bias_level(struct snd_soc_component *component,
return ret;
}
- sta32x_startup_sequence(sta32x);
- sta32x_cache_sync(component);
+ ret = sta32x_startup_sequence(sta32x);
+ if (!ret)
+ ret = sta32x_cache_sync(component);
+ if (ret)
+ goto restore_failed;
+
+ ret = regmap_update_bits(sta32x->regmap, STA32X_CONFF,
+ STA32X_CONFF_PWDN | STA32X_CONFF_EAPD,
+ 0);
+ if (ret)
+ goto restore_failed;
+
sta32x_watchdog_start(sta32x);
+ break;
}
/* Power down */
- regmap_update_bits(sta32x->regmap, STA32X_CONFF,
- STA32X_CONFF_PWDN | STA32X_CONFF_EAPD,
- 0);
+ ret = regmap_update_bits(sta32x->regmap, STA32X_CONFF,
+ STA32X_CONFF_PWDN | STA32X_CONFF_EAPD,
+ 0);
+ if (ret)
+ return ret;
break;
@@ -849,6 +892,16 @@ static int sta32x_set_bias_level(struct snd_soc_component *component,
break;
}
return 0;
+
+restore_failed:
+ gpiod_set_value(sta32x->gpiod_nreset, 0);
+ regcache_mark_dirty(sta32x->regmap);
+ cleanup_ret = regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies),
+ sta32x->supplies);
+ if (cleanup_ret)
+ dev_warn(component->dev, "Failed to disable supplies: %d\n",
+ cleanup_ret);
+ return ret;
}
static const struct snd_soc_dai_ops sta32x_dai_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0260/1059] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (258 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0259/1059] ASoC: sta32x: make power restoration transactional Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0261/1059] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Greg Kroah-Hartman
` (738 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Golla Nagendra, Frank Li, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Golla Nagendra <nagendra.golla@amd.com>
[ Upstream commit f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e ]
If sw_desc_pool allocation fails after pm_runtime_resume_and_get()
succeeds in zynqmp_dma_alloc_chan_resources(), the error path returns
without dropping the runtime PM reference.
Route that failure path through err_pm so the runtime PM reference is
balanced before returning the error.
Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-2-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[ sashal: Adapted the hunk context because this tree uses kcalloc() for the sw_desc_pool allocation instead of kzalloc_objs(), leaving that call unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/xilinx/zynqmp_dma.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index b10f626ca2c99..217f33f12aa82 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -483,8 +483,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
chan->sw_desc_pool = kcalloc(ZYNQMP_DMA_NUM_DESCS, sizeof(*desc),
GFP_KERNEL);
- if (!chan->sw_desc_pool)
- return -ENOMEM;
+ if (!chan->sw_desc_pool) {
+ ret = -ENOMEM;
+ goto err_pm;
+ }
chan->idle = true;
chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS;
@@ -516,6 +518,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
}
return ZYNQMP_DMA_NUM_DESCS;
+
+err_pm:
+ pm_runtime_put_autosuspend(chan->dev);
+ return ret;
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0261/1059] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v alloc failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (259 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0260/1059] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0262/1059] kernfs: fix up the unlocked attribute reads on the creation paths Greg Kroah-Hartman
` (737 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Golla Nagendra, Frank Li, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Golla Nagendra <nagendra.golla@amd.com>
[ Upstream commit 4ea99b14b3bd955d768666941e2e03ba186b52f5 ]
In zynqmp_dma_alloc_chan_resources(), sw_desc_pool is allocated before
desc_pool_v. If dma_alloc_coherent() for desc_pool_v fails, the function
currently exits through the runtime PM rollback path but leaves the
already allocated sw_desc_pool behind.
Add a dedicated err_free_sw_desc_pool label for the desc_pool_v failure
path, free sw_desc_pool there, then fall through to err_pm for
pm_runtime_put_autosuspend().
This keeps the error unwind symmetric and avoids leaking the software
descriptor pool on coherent descriptor allocation failure.
Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-3-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/xilinx/zynqmp_dma.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 217f33f12aa82..e5f0eb8489ade 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -504,8 +504,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
(2 * ZYNQMP_DMA_DESC_SIZE(chan) *
ZYNQMP_DMA_NUM_DESCS),
&chan->desc_pool_p, GFP_KERNEL);
- if (!chan->desc_pool_v)
- return -ENOMEM;
+ if (!chan->desc_pool_v) {
+ ret = -ENOMEM;
+ goto err_free_sw_desc_pool;
+ }
for (i = 0; i < ZYNQMP_DMA_NUM_DESCS; i++) {
desc = chan->sw_desc_pool + i;
@@ -519,6 +521,9 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
return ZYNQMP_DMA_NUM_DESCS;
+err_free_sw_desc_pool:
+ kfree(chan->sw_desc_pool);
+ chan->sw_desc_pool = NULL;
err_pm:
pm_runtime_put_autosuspend(chan->dev);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0262/1059] kernfs: fix up the unlocked attribute reads on the creation paths
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (260 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0261/1059] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0263/1059] firmware: arm_scmi: Protect xfer->async_done with xfer->lock Greg Kroah-Hartman
` (736 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Shakeel Butt,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <shakeel.butt@linux.dev>
[ Upstream commit 81bdc85b4c086502f4446a58eb5d25f29bb5e9f7 ]
Two creation paths read a live node's attributes without holding
kernfs_iattr_rwsem, which kernfs_iop_setattr() takes for writing. They
need different fixes.
kernfs_create_link() copies the target's ia_uid and then its ia_gid into
the new link. A chown of the target between the two reads leaves the
link with the old uid and the new gid, an owner the target never had.
Read both under the rwsem.
kernfs_new_node() reads the parent's mode and ia_gid for S_ISGID
inheritance. Either value is fine there: the node does not exist yet,
so nothing orders a racing chmod or chown against the creation. Taking
the rwsem would only pick between two answers that are both right. Mark
the reads with READ_ONCE() instead.
The pointer that leads to them is already fine: __kernfs_iattrs()
publishes kernfs_node::iattr with try_cmpxchg(), and both sides read it
with READ_ONCE(), like the rest of fs/kernfs.
The Fixes tag is for the symlink half. kernfs_create_link() has read
the pair unlocked since it started copying the target's owner; only the
name of the lock its writer takes has changed. The READ_ONCE() markings
are not a fix.
Fixes: 488dee96bb62 ("kernfs: allow creating kernfs objects with arbitrary uid/gid")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://patch.msgid.link/20260905191613.3143937-5-shakeel.butt@linux.dev
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Replaced kernfs_iattr_rwsem with kernfs_rwsem in the symlink.c lock and its comment, since the former doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/kernfs/dir.c | 12 +++++++++---
fs/kernfs/symlink.c | 17 ++++++++++++++---
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index a259fe3471a98..c01d900f09de1 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -675,13 +675,19 @@ struct kernfs_node *kernfs_new_node(struct kernfs_node *parent,
{
struct kernfs_node *kn;
- if (parent->mode & S_ISGID) {
+ /*
+ * The mode and the gid below are read unlocked on purpose: they feed
+ * a node that does not exist yet, so nothing orders a racing chmod or
+ * chown against this creation.
+ */
+ if (READ_ONCE(parent->mode) & S_ISGID) {
/* this code block imitates inode_init_owner() for
* kernfs
*/
+ struct kernfs_iattrs *attrs = READ_ONCE(parent->iattr);
- if (parent->iattr)
- gid = parent->iattr->ia_gid;
+ if (attrs)
+ gid = READ_ONCE(attrs->ia_gid);
if (flags & KERNFS_DIR)
mode |= S_ISGID;
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 45371a70caa71..dcf7d8c40548b 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -31,9 +31,20 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
kuid_t uid = GLOBAL_ROOT_UID;
kgid_t gid = GLOBAL_ROOT_GID;
- if (target->iattr) {
- uid = target->iattr->ia_uid;
- gid = target->iattr->ia_gid;
+ /*
+ * A symlink takes its owner from its target, so both fields have to
+ * come from the same moment: read them under kernfs_rwsem, or
+ * a chown of the target racing this could leave the link with the
+ * old uid and the new gid. The section ends before kernfs_add_one()
+ * takes kernfs_rwsem.
+ */
+ scoped_guard(rwsem_read, &kernfs_root(target)->kernfs_rwsem) {
+ struct kernfs_iattrs *attrs = READ_ONCE(target->iattr);
+
+ if (attrs) {
+ uid = attrs->ia_uid;
+ gid = attrs->ia_gid;
+ }
}
kn = kernfs_new_node(parent, name, S_IFLNK|0777, uid, gid, KERNFS_LINK);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0263/1059] firmware: arm_scmi: Protect xfer->async_done with xfer->lock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (261 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0262/1059] kernfs: fix up the unlocked attribute reads on the creation paths Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0264/1059] sit: charge ip_tunnel_prl_entry allocations to memcg Greg Kroah-Hartman
` (735 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Roland Dreier, Cristian Marussi,
Sudeep Holla, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <rolanddreier@rivian.com>
[ Upstream commit 49fc5bc04eec2b7687d49ccceb7adf6ace640a3b ]
Asynchronous SCMI commands are completed by a delayed response. The RX
path signals the response with complete(xfer->async_done). Unlike
xfer->done, xfer->async_done is a pointer to a completion owned by
whoever is waiting for the delayed response, and it stays valid only for
as long as that waiter is still waiting. In do_xfer_with_response() it
is a DECLARE_COMPLETION_ONSTACK() in the caller's stack frame.
Nothing serialises the RX path against a waiter that gives up on a
timeout. scmi_msg_response_validate() does read xfer->async_done
under xfer->lock, and documents that as a requirement, but the lock is
dropped again before scmi_handle_response() dereferences the pointer,
and neither the arming nor the disarming side takes it at all. So a
delayed response arriving just as the wait times out can be signalled
on a completion that is already gone:
waiter RX path (IRQ context)
------ ---------------------
do_xfer_with_response():
xfer->async_done = &async_response
do_xfer(xfer)
wait_for_completion_timeout(xfer->async_done, tmo)
/* returns 0, gives up */
/* response receive interrupt */
scmi_handle_response():
scmi_xfer_command_acquire()
lock xfer->lock
validate: async_done != NULL
unlock xfer->lock
xfer->async_done = NULL
return -ETIMEDOUT
/* async_response goes out of scope */
complete(xfer->async_done)
That last complete() has two possible bad outcomes: it either dereferences
the NULL just stored by the waiter or - if that store is not yet visible
on the RX CPU - it takes a lock and writes to a stack frame that the
waiter may already have returned from.
Fix this by making xfer->lock cover xfer->async_done end-to-end. Add
helpers to arm and disarm it under the lock, use them on both the regular
and the raw paths, and have the RX path read and signal the completion
under that same lock. A waiter that is timing out then either completes
its disarm before the RX path looks, in which case the delayed response is
dropped, or blocks in the disarm until the RX path is done with the
completion, in which case the completion is still alive.
Log the dropped case, so every path where a delayed response that was
matched to a pending xfer and then discarded produces an error. (This is
the same treatment scmi_msg_response_validate() already gives a
delayed response that arrives after the waiter has disarmed the xfer)
Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response")
Signed-off-by: Roland Dreier <rolanddreier@rivian.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://patch.msgid.link/20260909-scmi-async-done-race-v2-1-cc5dec25c6be@rivian.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
[ sashal: Dropped the raw_mode.c hunks and the DELAYED_RESPONSE_OK debug counter call, and placed the new helpers in common.h at a different anchor because the upstream context is missing. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/common.h | 22 +++++++++++++++++
drivers/firmware/arm_scmi/driver.c | 34 +++++++++++++++++++++++----
drivers/firmware/arm_scmi/protocols.h | 9 ++++---
3 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index 10409b43fb29e..bcc8bfa16a7cb 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -269,6 +269,28 @@ extern const struct scmi_desc scmi_virtio_desc;
extern const struct scmi_desc scmi_optee_desc;
#endif
+/**
+ * scmi_xfer_async_response_arm - Arm the delayed response completion
+ *
+ * @xfer: A reference to the xfer to arm
+ * @async_done: The completion to signal upon reception of a delayed response,
+ * or NULL to disarm @xfer.
+ */
+static inline void scmi_xfer_async_response_arm(struct scmi_xfer *xfer,
+ struct completion *async_done)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&xfer->lock, flags);
+ xfer->async_done = async_done;
+ spin_unlock_irqrestore(&xfer->lock, flags);
+}
+
+static inline void scmi_xfer_async_response_disarm(struct scmi_xfer *xfer)
+{
+ scmi_xfer_async_response_arm(xfer, NULL);
+}
+
void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv);
/* shmem related declarations */
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index cbc02edb20a95..5630e522814f6 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -683,6 +683,29 @@ static inline void scmi_xfer_command_release(struct scmi_info *info,
__scmi_xfer_put(&info->tx_minfo, xfer);
}
+/**
+ * scmi_xfer_async_response_complete - Signal a received delayed response
+ *
+ * @xfer: A reference to the xfer whose delayed response was received
+ *
+ * Return: True if a completion was still armed on @xfer and has been
+ * signalled, false if a waiter has already disarmed it due to
+ * timeout or other error.
+ */
+static bool scmi_xfer_async_response_complete(struct scmi_xfer *xfer)
+{
+ unsigned long flags;
+ struct completion *async_done;
+
+ spin_lock_irqsave(&xfer->lock, flags);
+ async_done = xfer->async_done;
+ if (async_done)
+ complete(async_done);
+ spin_unlock_irqrestore(&xfer->lock, flags);
+
+ return !!async_done;
+}
+
static inline void scmi_clear_channel(struct scmi_info *info,
struct scmi_chan_info *cinfo)
{
@@ -784,7 +807,10 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
if (xfer->hdr.type == MSG_TYPE_DELAYED_RESP) {
scmi_clear_channel(info, cinfo);
- complete(xfer->async_done);
+ if (!scmi_xfer_async_response_complete(xfer))
+ dev_err(cinfo->dev,
+ "Delayed Response for %d (protocol 0x%X msg 0x%X) received after waiter was disarmed, dropping\n",
+ xfer->hdr.seq, xfer->hdr.protocol_id, xfer->hdr.id);
} else {
complete(&xfer->done);
}
@@ -1051,7 +1077,7 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
int ret, timeout = msecs_to_jiffies(SCMI_MAX_RESPONSE_TIMEOUT);
DECLARE_COMPLETION_ONSTACK(async_response);
- xfer->async_done = &async_response;
+ scmi_xfer_async_response_arm(xfer, &async_response);
/*
* Delayed responses should not be polled, so an async command should
@@ -1063,7 +1089,7 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
ret = do_xfer(ph, xfer);
if (!ret) {
- if (!wait_for_completion_timeout(xfer->async_done, timeout)) {
+ if (!wait_for_completion_timeout(&async_response, timeout)) {
dev_err(ph->dev,
"timed out in delayed resp(caller: %pS)\n",
(void *)_RET_IP_);
@@ -1073,7 +1099,7 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
}
}
- xfer->async_done = NULL;
+ scmi_xfer_async_response_disarm(xfer);
return ret;
}
diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h
index 1a9753608a2b7..3d117224d577c 100644
--- a/drivers/firmware/arm_scmi/protocols.h
+++ b/drivers/firmware/arm_scmi/protocols.h
@@ -97,7 +97,10 @@ struct scmi_msg_hdr {
* message. If request-ACK protocol is used, we can reuse the same
* buffer for the rx path as we use for the tx path.
* @done: command message transmit completion event
- * @async_done: pointer to delayed response message received event completion
+ * @async_done: pointer to delayed response message received event completion,
+ * or NULL when no delayed response is expected. Protected by
+ * @lock, since the completion is owned by the waiter and can
+ * vanish once the wait times out.
* @pending: True for xfers added to @pending_xfers hashtable
* @node: An hlist_node reference used to store this xfer, alternatively, on
* the free list @free_xfers or in the @pending_xfers hashtable
@@ -117,7 +120,7 @@ struct scmi_msg_hdr {
* - SCMI_XFER_SENT_OK -> SCMI_XFER_RESP_OK [ -> SCMI_XFER_DRESP_OK ]
* - SCMI_XFER_SENT_OK -> SCMI_XFER_DRESP_OK
* (Missing synchronous response is assumed OK and ignored)
- * @lock: A spinlock to protect state and busy fields.
+ * @lock: A spinlock to protect state, busy and async_done fields.
* @priv: A pointer for transport private usage.
*/
struct scmi_xfer {
@@ -137,7 +140,7 @@ struct scmi_xfer {
#define SCMI_XFER_RESP_OK 1
#define SCMI_XFER_DRESP_OK 2
int state;
- /* A lock to protect state and busy fields */
+ /* A lock to protect state, busy and async_done fields */
spinlock_t lock;
void *priv;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0264/1059] sit: charge ip_tunnel_prl_entry allocations to memcg
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (262 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0263/1059] firmware: arm_scmi: Protect xfer->async_done with xfer->lock Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0265/1059] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Greg Kroah-Hartman
` (734 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Lorenzo Bianconi,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 40a2b90f5190fcc7b083809fa93f2799abefeeb1 ]
ipip6_tunnel_add_prl() allocates struct ip_tunnel_prl_entry for each
potential router entry added via SIOCADDPRL.
An unprivileged user with CAP_NET_ADMIN in a user namespace can add
an unbounded number of entries, consuming uncharged kernel memory.
Commit 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on
ip_tunnel_prl structs allocation") added accounting to the temporary
buffer in ipip6_tunnel_get_prl(), but missed the entry allocations
in ipip6_tunnel_add_prl().
Use GFP_KERNEL_ACCOUNT when allocating struct ip_tunnel_prl_entry.
Fixes: 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on ip_tunnel_prl structs allocation")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260907075846.2913645-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Changed kzalloc_obj(struct ip_tunnel_prl_entry, GFP_KERNEL_ACCOUNT) to the older kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT), since kzalloc_obj() helpers don't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/sit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 2c0d62ec8ec4f..f83b6488ded4c 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -391,7 +391,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
goto out;
}
- p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL);
+ p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT);
if (!p) {
err = -ENOBUFS;
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0265/1059] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (263 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0264/1059] sit: charge ip_tunnel_prl_entry allocations to memcg Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0266/1059] crypto: mxs-dcp - handle zero-length skcipher requests Greg Kroah-Hartman
` (733 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Antoine Tenart, Thomas Huth,
Herbert Xu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Huth <thuth@redhat.com>
[ Upstream commit 5c87bcb2f98dbfe08efa016af037b0f9701ba381 ]
key_tmp[] in safexcel_xcbcmac_setkey() and consts[] / _const[] in
safexcel_cmac_setkey() contain crypto key material that should not
get exposed to the outside once the function is done. Scrub the
arrays with memzero_explicit() to avoid that the data could leak
via the stack.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260813134953.979481-1-thuth%40redhat.com
Fixes: 38f21b4bab11f ("crypto: inside-secure - Added support for the AES XCBC ahash")
Fixes: 7a627db9cafdb ("crypto: inside-secure - Added support for the AES-CMAC ahash")
Acked-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Replaced aes_prepareenckey() with aes_expandkey() in the first hunk's context, since the older tree lacks the former. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/inside-secure/safexcel_hash.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index 08227d44a27ba..25bd91eb29b25 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -2107,6 +2107,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,
ret = aes_expandkey(ctx->aes,
(u8 *)key_tmp + 2 * AES_BLOCK_SIZE,
AES_MIN_KEY_SIZE);
+ memzero_explicit(key_tmp, sizeof(key_tmp));
if (ret)
return ret;
@@ -2218,6 +2219,8 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,
}
ctx->cbcmac = false;
+ memzero_explicit(consts, sizeof(consts));
+ memzero_explicit(_const, sizeof(_const));
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0266/1059] crypto: mxs-dcp - handle zero-length skcipher requests
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (264 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0265/1059] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0267/1059] ACPI: glue: Reduce debug noise from acpi_device_notify() Greg Kroah-Hartman
` (732 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Linmao Li, Herbert Xu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <lilinmao@kylinos.cn>
[ Upstream commit ac1d6a65a1e1f069f119df42c6b57dbdff5f6be8 ]
Zero-length skcipher requests are valid no-ops, but MXS-DCP queues them.
When such a request reaches the worker, last_out_len remains zero. The
CBC completion path then subtracts AES_BLOCK_SIZE from this unsigned
value when updating the IV, causing the offset to underflow. On
decryption, the resulting source address precedes aes_in_buf.
Return success before enqueueing zero-length requests. This avoids the
invalid source access and leaves the IV unchanged for a no-op.
Fixes: fadd7a6e616b ("crypto: mxs-dcp - Fix AES issues")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Dropped the unbackported key_referenced condition from the context line, keeping the existing key_len check and adding the same early return for zero-length requests before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/mxs-dcp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 702ab2c6c38e7..cc8b1b23550de 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -453,6 +453,9 @@ static int mxs_dcp_aes_enqueue(struct skcipher_request *req, int enc, int ecb)
struct dcp_aes_req_ctx *rctx = skcipher_request_ctx(req);
int ret;
+ if (!req->cryptlen)
+ return 0;
+
if (unlikely(actx->key_len != AES_KEYSIZE_128))
return mxs_dcp_block_fallback(req, enc);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0267/1059] ACPI: glue: Reduce debug noise from acpi_device_notify()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (265 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0266/1059] crypto: mxs-dcp - handle zero-length skcipher requests Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0268/1059] ACPI: glue: Rework the success message in acpi_device_notify() Greg Kroah-Hartman
` (731 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Andy Shevchenko,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 5bc1e72f80da4c20ce8b57851be4fad67e855ebd ]
When debug is enabled in the ACPI glue code that handles binding
devices to ACPI companions, acpi_device_notify() produces a lot of
message noise related to devices that have no ACPI companions.
Reduce that noise by checking the most obvious case, ACPI device
objects, directly and returning from acpi_device_notify() in that
case without printing any debug messages. Also avoid printing a
debug message when there is no matching ACPI bus type definition for
the given device, which is the case for the vast majority of devices.
Additionally, make the debug messages that get printed more informative.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/6325978.lOV4Wx5bFT@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: c94619c8a5b5 ("ACPI: glue: Carry out companion lookup under bus_type_sem")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/glue.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index cc9ee8cb820fc..54cc709be3166 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -356,22 +356,27 @@ void acpi_device_notify(struct device *dev)
struct acpi_device *adev;
int ret;
+ /* ACPI devices have no ACPI companions. */
+ if (dev->bus == &acpi_bus_type)
+ return;
+
ret = acpi_bind_one(dev, NULL);
if (ret) {
struct acpi_bus_type *type = acpi_get_bus_type(dev);
if (!type)
- goto err;
+ return;
adev = type->find_companion(dev);
if (!adev) {
dev_dbg(dev, "ACPI companion not found\n");
- goto err;
+ return;
}
ret = acpi_bind_one(dev, adev);
- if (ret)
- goto err;
-
+ if (ret) {
+ dev_dbg(dev, "Binding to ACPI companion failed\n");
+ return;
+ }
if (type->setup) {
type->setup(dev);
goto done;
@@ -393,11 +398,6 @@ void acpi_device_notify(struct device *dev)
done:
acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
dev_name(dev));
-
- return;
-
-err:
- dev_dbg(dev, "No ACPI support\n");
}
void acpi_device_notify_remove(struct device *dev)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0268/1059] ACPI: glue: Rework the success message in acpi_device_notify()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (266 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0267/1059] ACPI: glue: Reduce debug noise from acpi_device_notify() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0269/1059] ACPI: glue: Carry out companion lookup under bus_type_sem Greg Kroah-Hartman
` (730 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Andy Shevchenko,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit aef7792cddcac7ab400912c2947a595401d4a7e8 ]
Using an ACPI handle in the acpi_device_notify() success message is
somewhat misleading because the "physical" device is not bound to an
ACPI namespace object in that function, but to an ACPI device object
attached to it. Moreover, the message is outright confusing for the
"physical" devices bound to ACPI devices without ACPI namespace
objects (for example, fixed event buttons).
Address this by turning that message into a dev_dbg() one printed for
the "physical" device and mentioning the name of the ACPI companion.
Fixes: ab06eb920401 ("ACPI: scan: Register platform devices for fixed event buttons")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/2448150.ElGaqSPkdT@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: c94619c8a5b5 ("ACPI: glue: Carry out companion lookup under bus_type_sem")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/glue.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 54cc709be3166..c01ebf20a9318 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -396,8 +396,7 @@ void acpi_device_notify(struct device *dev)
adev->handler->bind(dev);
done:
- acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
- dev_name(dev));
+ dev_dbg(dev, "Bound to ACPI device %s\n", acpi_dev_name(adev));
}
void acpi_device_notify_remove(struct device *dev)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0269/1059] ACPI: glue: Carry out companion lookup under bus_type_sem
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (267 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0268/1059] ACPI: glue: Rework the success message in acpi_device_notify() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0270/1059] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage Greg Kroah-Hartman
` (729 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit c94619c8a5b5d3b980433d247ac87a2d1c827cb6 ]
When acpi_device_notify() looks up an ACPI companion for the given
device, it invokes callbacks from struct acpi_bus_type() without
synchronization which may lead to a use-after-free if the driver
module containing those callbacks is unloaded at the same time.
Address this by holding bus_type_sem throughout the entire ACPI
companion lookup and the execution of the .setup() callback in
struct acpi_bus_type (if present) instead of dropping the semaphore
(prematurely) after finding a matching struct acpi_bus_type.
For this purpose, rename acpi_get_bus_type() to acpi_companion_lookup(),
make it return a struct acpi_device pointer, and move the relevant code
from acpi_device_notify() to it.
Also notice that the only case in which the .bind() callback from an
ACPI scan handler may need to be invoked is when the given device is
a platform one, so adjust acpi_device_notify() accordingly and drop
the "done" label that is not used any more from it.
Fixes: 2ef5236660b6 ("ACPI: glue: Look for ACPI bus type only if ACPI companion is not known")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3089807.e9J7NaK4W3@rafael.j.wysocki
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/glue.c | 61 +++++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 32 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index c01ebf20a9318..e2a40847d24b6 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -59,19 +59,34 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
}
EXPORT_SYMBOL_GPL(unregister_acpi_bus_type);
-static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
+static struct acpi_device *acpi_companion_lookup(struct device *dev)
{
- struct acpi_bus_type *tmp, *ret = NULL;
+ struct acpi_bus_type *type;
- down_read(&bus_type_sem);
- list_for_each_entry(tmp, &bus_type_list, list) {
- if (tmp->match(dev)) {
- ret = tmp;
- break;
+ guard(rwsem_read)(&bus_type_sem);
+
+ list_for_each_entry(type, &bus_type_list, list) {
+ struct acpi_device *adev;
+
+ if (!type->match(dev))
+ continue;
+
+ adev = type->find_companion(dev);
+ if (!adev) {
+ dev_dbg(dev, "ACPI companion not found\n");
+ return NULL;
}
+ if (acpi_bind_one(dev, adev)) {
+ dev_dbg(dev, "Binding to ACPI companion failed\n");
+ return NULL;
+ }
+ if (type->setup)
+ type->setup(dev);
+
+ return adev;
}
- up_read(&bus_type_sem);
- return ret;
+
+ return NULL;
}
#define FIND_CHILD_MIN_SCORE 1
@@ -362,40 +377,22 @@ void acpi_device_notify(struct device *dev)
ret = acpi_bind_one(dev, NULL);
if (ret) {
- struct acpi_bus_type *type = acpi_get_bus_type(dev);
-
- if (!type)
+ adev = acpi_companion_lookup(dev);
+ if (!adev)
return;
-
- adev = type->find_companion(dev);
- if (!adev) {
- dev_dbg(dev, "ACPI companion not found\n");
- return;
- }
- ret = acpi_bind_one(dev, adev);
- if (ret) {
- dev_dbg(dev, "Binding to ACPI companion failed\n");
- return;
- }
- if (type->setup) {
- type->setup(dev);
- goto done;
- }
} else {
adev = ACPI_COMPANION(dev);
if (dev_is_pci(dev)) {
pci_acpi_setup(dev, adev);
- goto done;
} else if (dev_is_platform(dev)) {
acpi_configure_pmsi_domain(dev);
+
+ if (adev->handler && adev->handler->bind)
+ adev->handler->bind(dev);
}
}
- if (adev->handler && adev->handler->bind)
- adev->handler->bind(dev);
-
-done:
dev_dbg(dev, "Bound to ACPI device %s\n", acpi_dev_name(adev));
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0270/1059] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (268 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0269/1059] ACPI: glue: Carry out companion lookup under bus_type_sem Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0271/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers Greg Kroah-Hartman
` (728 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit fcfb2b562115632e0a60a0928dca495f98eb335c ]
Rearange the code in acpi_bind_one() to avoid situations in which the
existing ACPI companion of the given device would be replaced with NULL
due to a memory allocation error or because somebody tries to bind a
physical device with an ACPI companion to a different ACPI device
erroneously.
Fixes: 7b1998116bbb ("ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Merged two conditionals to avoid redundant check ]
Link: https://patch.msgid.link/3465482.44csPzL39Z@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Replaced the kzalloc_obj(*physical_node) call, which this tree lacks, with kzalloc(sizeof(*physical_node), GFP_KERNEL); the rest is unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/glue.c | 58 +++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 34 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index e2a40847d24b6..f915a7c0e7cca 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -243,31 +243,25 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id)
int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
{
struct acpi_device_physical_node *physical_node, *pn;
+ struct acpi_device *comp_dev = ACPI_COMPANION(dev);
char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
struct list_head *physnode_list;
unsigned int node_id;
int retval = -EINVAL;
- if (has_acpi_companion(dev)) {
- if (acpi_dev) {
- dev_warn(dev, "ACPI companion already set\n");
+ if (!acpi_dev) {
+ if (!comp_dev)
return -EINVAL;
- } else {
- acpi_dev = ACPI_COMPANION(dev);
- }
- }
- if (!acpi_dev)
- return -EINVAL;
- acpi_dev_get(acpi_dev);
- get_device(dev);
- physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
- if (!physical_node) {
- retval = -ENOMEM;
- goto err;
+ /* If the companion has been set upfront, pick it up. */
+ acpi_dev = comp_dev;
+ } else if (comp_dev && acpi_dev != comp_dev) {
+ dev_warn(dev, "ACPI companion already set to %s which is not %s\n",
+ acpi_dev_name(comp_dev), acpi_dev_name(acpi_dev));
+ return -EEXIST;
}
- mutex_lock(&acpi_dev->physical_node_lock);
+ guard(mutex)(&acpi_dev->physical_node_lock);
/*
* Keep the list sorted by node_id so that the IDs of removed nodes can
@@ -278,15 +272,12 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
list_for_each_entry(pn, &acpi_dev->physical_node_list, node) {
/* Sanity check. */
if (pn->dev == dev) {
- mutex_unlock(&acpi_dev->physical_node_lock);
-
- dev_warn(dev, "Already associated with ACPI node\n");
- kfree(physical_node);
- if (ACPI_COMPANION(dev) != acpi_dev)
- goto err;
-
- put_device(dev);
- acpi_dev_put(acpi_dev);
+ if (!comp_dev) {
+ /* Really unexpected. */
+ ACPI_COMPANION_SET(dev, acpi_dev);
+ dev_warn(&acpi_dev->dev,
+ "Physical device list corruption fixed up\n");
+ }
return 0;
}
if (pn->node_id == node_id) {
@@ -295,12 +286,19 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
}
}
+ physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
+ if (!physical_node)
+ return -ENOMEM;
+
+ acpi_dev_get(acpi_dev);
+ get_device(dev);
+
physical_node->node_id = node_id;
physical_node->dev = dev;
list_add(&physical_node->node, physnode_list);
acpi_dev->physical_node_count++;
- if (!has_acpi_companion(dev))
+ if (!comp_dev)
ACPI_COMPANION_SET(dev, acpi_dev);
acpi_physnode_link_name(physical_node_name, node_id);
@@ -316,18 +314,10 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
dev_err(dev, "Failed to create link firmware_node (%d)\n",
retval);
- mutex_unlock(&acpi_dev->physical_node_lock);
-
if (acpi_dev->wakeup.flags.valid)
device_set_wakeup_capable(dev, true);
return 0;
-
- err:
- ACPI_COMPANION_SET(dev, NULL);
- put_device(dev);
- acpi_dev_put(acpi_dev);
- return retval;
}
EXPORT_SYMBOL_GPL(acpi_bind_one);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0271/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (269 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0270/1059] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0272/1059] clk: mediatek: reset: Fix device registration kernel-doc Greg Kroah-Hartman
` (727 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Brian Norris, Rafael J. Wysocki,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <briannorris@chromium.org>
[ Upstream commit be5755f023e7e02ec90bbd1d4ca63a0abe594733 ]
When a device RPM-suspends, it queues up an idle check for all of its
suppliers, in case that device was the last consumer, and those
suppliers are now able to suspend. Today, we do this for all suppliers,
and not only for those suppliers that are marked for use by runtime PM.
This isn't directly harmful, but it is a bit wasteful, and also may
induce unexpected suspend attempts (e.g., if a device was purposely last
touched with pm_runtime_put_noidle()).
To avoid excess idle checks, only call pm_request_idle() on linked
suppliers that opted into runtime PM.
Noticed by inspection of trace logs.
This is not expected to have a functional impact on systems that are
using device links properly, and should only be considered an
optimization.
Fixes: 5244f5e2d801 ("PM: runtime: Defer suspending suppliers")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/20260901013341.1417232-1-briannorris@chromium.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Replaced the missing device_link_test(link, DL_FLAG_PM_RUNTIME) helper with the direct link->flags & DL_FLAG_PM_RUNTIME test this tree already uses. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/power/runtime.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index b4d7fcae5e5b7..24348c597b218 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -350,7 +350,8 @@ static void rpm_suspend_suppliers(struct device *dev)
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
device_links_read_lock_held())
- pm_request_idle(link->supplier);
+ if (link->flags & DL_FLAG_PM_RUNTIME)
+ pm_request_idle(link->supplier);
device_links_read_unlock(idx);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0272/1059] clk: mediatek: reset: Fix device registration kernel-doc
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (270 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0271/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0273/1059] clk: s2mps11: initialise clk_hw_onecell_data::num before accessing ::hws[] in probe() Greg Kroah-Hartman
` (726 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Chen-Yu Tsai,
AngeloGioacchino Del Regno, Brian Masney, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit 8d5fa37307ac1f0612cf17ac0ccabcc258cc1526 ]
The comment for mtk_register_reset_controller_with_dev() names the
older helper and documents np rather than dev. The new helper takes
a struct device and obtains its device node internally.
Use the actual function and parameter names and clarify that failures
return negative error codes.
Fixes: 761bc64003e3 ("clk: mediatek: reset: Add new register reset function with device")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
[ sashal: Fixed the kernel-doc block above mtk_register_reset_controller_with_dev() in reset.h, with hunk context adjusted because the preceding mtk_register_reset_controller() doc block has a different title line here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/clk/mediatek/reset.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/mediatek/reset.h b/drivers/clk/mediatek/reset.h
index 6a58a3d591654..aa4edba2db7b5 100644
--- a/drivers/clk/mediatek/reset.h
+++ b/drivers/clk/mediatek/reset.h
@@ -70,11 +70,11 @@ int mtk_register_reset_controller(struct device_node *np,
const struct mtk_clk_rst_desc *desc);
/**
- * mtk_register_reset_controller - Register mediatek clock reset controller with device
- * @np: Pointer to device.
+ * mtk_register_reset_controller_with_dev - Register a MediaTek reset controller
+ * @dev: Device used to manage the reset controller resources.
* @desc: Constant pointer to description of clock reset.
*
- * Return: 0 on success and errorno otherwise.
+ * Return: 0 on success, negative errno otherwise.
*/
int mtk_register_reset_controller_with_dev(struct device *dev,
const struct mtk_clk_rst_desc *desc);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0273/1059] clk: s2mps11: initialise clk_hw_onecell_data::num before accessing ::hws[] in probe()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (271 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0272/1059] clk: mediatek: reset: Fix device registration kernel-doc Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0274/1059] clk: s2mps11: Propagate OF provider registration failures Greg Kroah-Hartman
` (725 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, André Draszik,
Krzysztof Kozlowski, Stephen Boyd, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <andre.draszik@linaro.org>
[ Upstream commit 3e14c7207a975eefcda1929b2134a9f4119dde45 ]
With UBSAN enabled, we're getting the following trace:
UBSAN: array-index-out-of-bounds in .../drivers/clk/clk-s2mps11.c:186:3
index 0 is out of range for type 'struct clk_hw *[] __counted_by(num)' (aka 'struct clk_hw *[]')
This is because commit f316cdff8d67 ("clk: Annotate struct
clk_hw_onecell_data with __counted_by") annotated the hws member of
that struct with __counted_by, which informs the bounds sanitizer about
the number of elements in hws, so that it can warn when hws is accessed
out of bounds.
As noted in that change, the __counted_by member must be initialised
with the number of elements before the first array access happens,
otherwise there will be a warning from each access prior to the
initialisation because the number of elements is zero. This occurs in
s2mps11_clk_probe() due to ::num being assigned after ::hws access.
Move the assignment to satisfy the requirement of assign-before-access.
Cc: stable@vger.kernel.org
Fixes: f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by")
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250326-s2mps11-ubsan-v1-1-fcc6fce5c8a9@linaro.org
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Stable-dep-of: 276741aac3b5 ("clk: s2mps11: Propagate OF provider registration failures")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/clk/clk-s2mps11.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index a3e883a9f4067..d89bd36529b45 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -137,6 +137,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
if (!clk_data)
return -ENOMEM;
+ clk_data->num = S2MPS11_CLKS_NUM;
+
switch (hwid) {
case S2MPS11X:
s2mps11_reg = S2MPS11_REG_RTC_CTRL;
@@ -186,7 +188,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
clk_data->hws[i] = &s2mps11_clks[i].hw;
}
- clk_data->num = S2MPS11_CLKS_NUM;
of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
clk_data);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0274/1059] clk: s2mps11: Propagate OF provider registration failures
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (272 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0273/1059] clk: s2mps11: initialise clk_hw_onecell_data::num before accessing ::hws[] in probe() Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0275/1059] libbpf: fix log level propagation for light skeleton loaders Greg Kroah-Hartman
` (724 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Brian Masney,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 276741aac3b56ba50bef59715ba18ba3f0b953a2 ]
s2mps11_clk_probe() ignores of_clk_add_hw_provider() failures, stores
driver data and returns success even though DT consumers cannot acquire the
registered clocks.
Return the provider error through the existing lookup cleanup path. Skip
empty lookup slots while unwinding because S2MPS14 omits its CP clock.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: b228fad50c00 ("clk: s2mps11: Migrate to clk_hw based OF and registration APIs")
Assisted-by: LLM
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/clk/clk-s2mps11.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index d89bd36529b45..5ba037fbc5480 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -188,8 +188,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
clk_data->hws[i] = &s2mps11_clks[i].hw;
}
- of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
- clk_data);
+ ret = of_clk_add_hw_provider(s2mps11_clks->clk_np,
+ of_clk_hw_onecell_get, clk_data);
+ if (ret)
+ goto err_reg;
platform_set_drvdata(pdev, s2mps11_clks);
@@ -197,8 +199,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
err_reg:
of_node_put(s2mps11_clks[0].clk_np);
- while (--i >= 0)
- clkdev_drop(s2mps11_clks[i].lookup);
+ while (--i >= 0) {
+ if (s2mps11_clks[i].lookup)
+ clkdev_drop(s2mps11_clks[i].lookup);
+ }
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0275/1059] libbpf: fix log level propagation for light skeleton loaders
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (273 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0274/1059] clk: s2mps11: Propagate OF provider registration failures Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0276/1059] fs/ntfs3: update ctime only on successful setxattr Greg Kroah-Hartman
` (723 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Borkmann, Mahe Tardy,
Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahe Tardy <mahe.tardy@gmail.com>
[ Upstream commit e18e82ba9ed53f60acce5f9995ee357a9f7ab91d ]
bpftool's -d option is documented to enable bpf_trace_printk() messages
from the generated syscall loader when used with -L as specified in
commit d510296d331a ("bpftool: Use syscall/loader program in "prog load"
and "gen skeleton" command.")
However commit b59e4ce8bcaa ("bpftool: Switch bpf_object__load_xattr()
to bpf_object__load()") changed bpftool to use bpf_object__load() which
call the internal bpf_object_load with extra_log_level to 0 instead of
bpf_object__load_xattr with the user request log_level.
All the plumbing was still there to generate the bpf_trace_printk()
instructions from the generator but was now unreachable because
bpf_gen__init() was called with extra_log_level to 0, leaving
gen->log_level at 0.
This uses the obj->log_level field introduced in commit e0e3ea888c69
("libbpf: Allow passing user log setting through bpf_object_open_opts")
set from reading verifier_logs in do_skeleton(). This preserves both
object-level and explicit load-time logging settings.
Fixes: b59e4ce8bcaa ("bpftool: Switch bpf_object__load_xattr() to bpf_object__load()")
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Link: https://lore.kernel.org/r/20260907170536.9996-1-mahe.tardy@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
[ sashal: Context lines differ: this tree's bpf_object_load() has a brace-less if (obj->gen_loader) with no else if (!is_native_endianness(obj)) branch, so the same change was applied by hand. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/lib/bpf/libbpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 39315efbba6d2..5b2621ac0326e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -7700,7 +7700,8 @@ static int bpf_object_load(struct bpf_object *obj, int extra_log_level, const ch
}
if (obj->gen_loader)
- bpf_gen__init(obj->gen_loader, extra_log_level, obj->nr_programs, obj->nr_maps);
+ bpf_gen__init(obj->gen_loader, obj->log_level | extra_log_level,
+ obj->nr_programs, obj->nr_maps);
err = bpf_object__probe_loading(obj);
err = err ? : bpf_object__load_vmlinux_btf(obj, false);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0276/1059] fs/ntfs3: update ctime only on successful setxattr
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (274 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0275/1059] libbpf: fix log level propagation for light skeleton loaders Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0277/1059] mtd: spi-nor: spansion: Remove s25fs256s0 Greg Kroah-Hartman
` (722 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Baolin Liu, Konstantin Komarov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baolin Liu <liubaolin@kylinos.cn>
[ Upstream commit bfa6296bb6a0e2333796a9507beb4605b92a9fdf ]
ntfs_setxattr() updates ctime and marks the inode dirty even when the
xattr operation fails.
Do that only on success.
Fixes: 2d44667c306e ("fs/ntfs3: Update i_ctime when xattr is added")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
[ sashal: adjusted the ctime line to the older inode->i_ctime = current_time(inode); form instead of inode_set_ctime_current(inode); in the hunk context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ntfs3/xattr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 92f5b4c84b72e..ed7306dce90dd 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -977,8 +977,10 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
out:
- inode->i_ctime = current_time(inode);
- mark_inode_dirty(inode);
+ if (!err) {
+ inode->i_ctime = current_time(inode);
+ mark_inode_dirty(inode);
+ }
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0277/1059] mtd: spi-nor: spansion: Remove s25fs256s0
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (275 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0276/1059] fs/ntfs3: update ctime only on successful setxattr Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0278/1059] cxl/hdm: Reject switch decoder interleave ways that overflow targets Greg Kroah-Hartman
` (721 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Takahiro Kuwano, Michael Walle,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <takahiro.kuwano@infineon.com>
[ Upstream commit f917d9edf54c3dd578efc231b8fbcd35744f99cd ]
The Spansion ID table lists s25fs256s0 and s25fs256s1 as variants
distinguished by id[4] (0x00 for 256 KB sectors and 0x01 for 64 KB
sectors), following an incorrect statement in the datasheet.
The sector size of s25fs256s is configurable between 256 KB and 64 KB.
The factory default is 64 KB, and id[4] is always 0x01 regardless of the
configured sector size. Remove the invalid s25fs256s0 entry from the ID
table.
Fixes: 075fd6dff24a ("mtd: spi-nor: spansion: Differentiate between s25fl256s and s25fs256s")
Signed-off-by: Takahiro Kuwano <takahiro.kuwano@infineon.com>
Signed-off-by: Michael Walle <mwalle@kernel.org>
[ sashal: Removed the s25fs256s0 entry using the older INFO6 macro form in place of the upstream SNOR_ID struct block, since the hunk context didn't match. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mtd/spi-nor/spansion.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
index cd2d6a95d66e1..ffee510d4b2e4 100644
--- a/drivers/mtd/spi-nor/spansion.c
+++ b/drivers/mtd/spi-nor/spansion.c
@@ -452,10 +452,6 @@ static const struct flash_info spansion_nor_parts[] = {
NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
MFR_FLAGS(USE_CLSR)
.fixups = &s25fs_s_nor_fixups, },
- { "s25fs256s0", INFO6(0x010219, 0x4d0081, 256 * 1024, 128)
- NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
- MFR_FLAGS(USE_CLSR)
- },
{ "s25fs256s1", INFO6(0x010219, 0x4d0181, 64 * 1024, 512)
NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
MFR_FLAGS(USE_CLSR)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0278/1059] cxl/hdm: Reject switch decoder interleave ways that overflow targets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (276 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0277/1059] mtd: spi-nor: spansion: Remove s25fs256s0 Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0279/1059] cxl/hdm: Make switch decoder target parsing endian-safe Greg Kroah-Hartman
` (720 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Davidlohr Bueso, Richard Cheng,
Alison Schofield, Li Ming, Dave Jiang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <alison.schofield@intel.com>
[ Upstream commit 3696326ca14cf018788d64232a068fdf26b1ff31 ]
Switch decoder enumeration validates that the interleave ways encoding
is legal, but not that the resulting number of ways fits the available
targets. This can overrun the target array (target_list.target_id[])
during enumeration of 12 or 16 way interleaves.
Bound the target count where it is established rather than at each use.
Reject an HDM capability whose reported target count is zero or exceeds
the target list register capacity, and reject a zero target switch
decoder allocation in cxl_switch_decoder_init(). Enumeration is then
left with a single check: reject a decoder whose interleave ways exceed
the targets it has.
Add a clarifying comment that target_count is a direct count, not
0-based like decoder_count.
Link: https://sashiko.dev/#/patchset/20260711180755.1779002-1-alison.schofield@intel.com?part=1
Fixes: d17d0540a0db ("cxl/core/hdm: Add CXL standard decoder enumeration to the core")
Tested-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Link: https://patch.msgid.link/af094094813d7f51d86cbf608936270b7d85526e.1786143520.git.alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: adjusted context for missing cxl_settle_decoders() and ioread64_hi_lo() target-list read, plus different anchor lines in the headers, with the new bounds checks themselves unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/hdm.c | 24 ++++++++++++++++++++++++
drivers/cxl/core/port.c | 2 +-
drivers/cxl/cxl.h | 2 ++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index 580cf7834cf11..689df3b86b026 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -74,6 +74,8 @@ static void parse_hdm_decoder_caps(struct cxl_hdm *cxlhdm)
hdm_cap = readl(cxlhdm->regs.hdm_decoder + CXL_HDM_DECODER_CAP_OFFSET);
cxlhdm->decoder_count = cxl_hdm_decoder_count(hdm_cap);
+
+ /* target_count is a direct count (1h..8h), not 0-based like decoder_count */
cxlhdm->target_count =
FIELD_GET(CXL_HDM_DECODER_TARGET_COUNT_MASK, hdm_cap);
if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_11_8, hdm_cap))
@@ -791,6 +793,16 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
return rc;
if (!cxled) {
+ struct cxl_switch_decoder *cxlsd = to_cxl_switch_decoder(&cxld->dev);
+
+ if (cxld->interleave_ways > cxlsd->nr_targets) {
+ dev_err(&port->dev,
+ "decoder%d.%d: interleave ways: %d exceeds targets: %d\n",
+ port->id, cxld->id, cxld->interleave_ways,
+ cxlsd->nr_targets);
+ return -ENXIO;
+ }
+
target_list.value =
ioread64_hi_lo(hdm + CXL_HDM_DECODER0_TL_LOW(which));
for (i = 0; i < cxld->interleave_ways; i++)
@@ -851,6 +863,18 @@ int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm)
if (committed != cxlhdm->decoder_count)
msleep(20);
+ /*
+ * Per CXL 4.0 8.2.4.20.1 Target Count is the number of target ports
+ * per decoder, max 8. Endpoint decoders have no targets.
+ */
+ if (!is_cxl_endpoint(port) &&
+ (cxlhdm->target_count < 1 ||
+ cxlhdm->target_count > CXL_HDM_DECODER0_TL_TARGETS)) {
+ dev_err(&port->dev, "Invalid decoder target count: %u\n",
+ cxlhdm->target_count);
+ return -ENXIO;
+ }
+
for (i = 0; i < cxlhdm->decoder_count; i++) {
int target_map[CXL_DECODER_MAX_INTERLEAVE] = { 0 };
int rc, target_count = cxlhdm->target_count;
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 15b468b6aec38..302a7bc262068 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1474,7 +1474,7 @@ static int cxl_switch_decoder_init(struct cxl_port *port,
struct cxl_switch_decoder *cxlsd,
int nr_targets)
{
- if (nr_targets > CXL_DECODER_MAX_INTERLEAVE)
+ if (nr_targets < 1 || nr_targets > CXL_DECODER_MAX_INTERLEAVE)
return -EINVAL;
cxlsd->nr_targets = nr_targets;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 0f3568071966d..3ba9714b1edda 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -58,6 +58,8 @@
#define CXL_HDM_DECODER0_CTRL_TYPE BIT(12)
#define CXL_HDM_DECODER0_TL_LOW(i) (0x20 * (i) + 0x24)
#define CXL_HDM_DECODER0_TL_HIGH(i) (0x20 * (i) + 0x28)
+/* Target list capacity, i.e. max interleave ways for a non-endpoint decoder */
+#define CXL_HDM_DECODER0_TL_TARGETS 8
#define CXL_HDM_DECODER0_SKIP_LOW(i) CXL_HDM_DECODER0_TL_LOW(i)
#define CXL_HDM_DECODER0_SKIP_HIGH(i) CXL_HDM_DECODER0_TL_HIGH(i)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0279/1059] cxl/hdm: Make switch decoder target parsing endian-safe
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (277 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0278/1059] cxl/hdm: Reject switch decoder interleave ways that overflow targets Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0280/1059] cxl/hdm: Restore commit_end when decoder enumeration fails Greg Kroah-Hartman
` (719 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alison Schofield, Li Ming,
Dave Jiang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <alison.schofield@intel.com>
[ Upstream commit 3f846646b3d3b5699139e686e1107d231a725860 ]
Switch decoder target IDs are stored one per byte, starting with
target 0 in the least significant byte. The current code accesses
those bytes in memory order, which only matches register order on
little-endian hosts.
On big-endian hosts, the target IDs are reversed and the decoder is
associated with the wrong downstream ports.
Place the register values in a byte array in little-endian order and
index the target IDs from there, so the target mapping is independent
of host endianness.
Fixes: d17d0540a0db ("cxl/core/hdm: Add CXL standard decoder enumeration to the core")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Link: https://patch.msgid.link/b0526825b3c3ffdb78837563e178d9aa27b6bbb8.1786143520.git.alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/hdm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index 689df3b86b026..c70a438d200e1 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -2,6 +2,7 @@
/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/seq_file.h>
+#include <asm/unaligned.h>
#include <linux/device.h>
#include <linux/delay.h>
@@ -715,15 +716,12 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
u64 *dpa_base)
{
struct cxl_endpoint_decoder *cxled = NULL;
+ u8 target_id[CXL_HDM_DECODER0_TL_TARGETS];
u64 size, base, skip, dpa_size;
bool committed;
u32 remainder;
int i, rc;
u32 ctrl;
- union {
- u64 value;
- unsigned char target_id[8];
- } target_list;
if (is_endpoint_decoder(&cxld->dev))
cxled = to_cxl_endpoint_decoder(&cxld->dev);
@@ -803,10 +801,12 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
return -ENXIO;
}
- target_list.value =
- ioread64_hi_lo(hdm + CXL_HDM_DECODER0_TL_LOW(which));
+ put_unaligned_le32(readl(hdm + CXL_HDM_DECODER0_TL_LOW(which)),
+ &target_id[0]);
+ put_unaligned_le32(readl(hdm + CXL_HDM_DECODER0_TL_HIGH(which)),
+ &target_id[4]);
for (i = 0; i < cxld->interleave_ways; i++)
- target_map[i] = target_list.target_id[i];
+ target_map[i] = target_id[i];
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0280/1059] cxl/hdm: Restore commit_end when decoder enumeration fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (278 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0279/1059] cxl/hdm: Make switch decoder target parsing endian-safe Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0281/1059] cxl/port: Bound switch decoder target array access by nr_targets Greg Kroah-Hartman
` (718 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonathan Cameron, Dave Jiang,
Li Ming, Richard Cheng, Alison Schofield, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <alison.schofield@intel.com>
[ Upstream commit 7dae18c39e99813461db6ef3fc13f077452109ce ]
commit_end tracks the highest committed decoder on a port. It gets
advanced before decoder enumeration is complete, so a later failure
leaves it pointing at a decoder that was never added. The next probe
then rejects decoder0 as out of order and enumeration fails.
Reset commit_end to the uncommitted baseline once the decoders are
torn down, so a subsequent probe rebuilds it from scratch. Register
the reset before the decoders are added so that on unwind it runs
after every decoder has been unregistered. This prevents commit_end
from dropping below the highest committed decoder still registered and
exposing an inconsistent value to a concurrent reader.
Protect the commit_end advance in the DVSEC emulation path against
concurrent readers, matching the register-programmed path.
Fixes: 176baefb2eb5 ("cxl/hdm: Commit decoder state to hardware")
Fixes: b777e9bec960 ("cxl/hdm: Emulate HDM decoder from DVSEC range registers")
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/4802c5abc906b858a4754bfc4fa3e4c2c455d0c3.1786143520.git.alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Dropped the DVSEC-emulation hunk and the write lock (neither exists here), so commit_end is reset with a plain port->commit_end = -1 in the devm callback. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/hdm.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index c70a438d200e1..6c359d32d0ff9 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -834,6 +834,13 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
return 0;
}
+static void cxl_reset_commit_end(void *data)
+{
+ struct cxl_port *port = data;
+
+ port->commit_end = -1;
+}
+
/**
* devm_cxl_enumerate_decoders - add decoder objects per HDM register set
* @cxlhdm: Structure to populate with HDM capabilities
@@ -842,7 +849,7 @@ int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm)
{
void __iomem *hdm = cxlhdm->regs.hdm_decoder;
struct cxl_port *port = cxlhdm->port;
- int i, committed;
+ int i, committed, rc;
u64 dpa_base = 0;
u32 ctrl;
@@ -875,9 +882,17 @@ int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm)
return -ENXIO;
}
+ /*
+ * Reset commit_end after all decoders have been torn down so a
+ * subsequent probe rebuilds it from scratch.
+ */
+ rc = devm_add_action(&port->dev, cxl_reset_commit_end, port);
+ if (rc)
+ return rc;
+
for (i = 0; i < cxlhdm->decoder_count; i++) {
int target_map[CXL_DECODER_MAX_INTERLEAVE] = { 0 };
- int rc, target_count = cxlhdm->target_count;
+ int target_count = cxlhdm->target_count;
struct cxl_decoder *cxld;
if (is_cxl_endpoint(port)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0281/1059] cxl/port: Bound switch decoder target array access by nr_targets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (279 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0280/1059] cxl/hdm: Restore commit_end when decoder enumeration fails Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0282/1059] ASoC: rt1015: make control calibration failures observable Greg Kroah-Hartman
` (717 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alison Schofield, Li Ming,
Dave Jiang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <alison.schofield@intel.com>
[ Upstream commit 4e42c398af136d62fac8c19c9f410ec83a8dd34a ]
Switch decoder target lookups walk the target array using interleave
ways as the bound. The array is allocated with nr_targets entries, so a
decoder whose interleave ways exceeds nr_targets reads and writes past
the end of it. That happens during dport activation, during decoder
target population, and when userspace reads the target_list attribute.
Bounding by nr_targets alone is not correct either. Commit d6488fee6647
("cxl/port: Fix decoder initialization when nr_targets > interleave_ways")
moved target population to interleave ways precisely so that targets a
decoder does not use are left unpopulated. Neither field alone is a safe
bound, so add a helper that returns the minimum of the two and use it at
every walk of the target array.
Valid configurations keep interleave ways within nr_targets, so this is
not a behavior change for them.
Fixes: 40ba17afdfab ("cxl/acpi: Introduce cxl_decoder objects")
Fixes: d6488fee6647 ("cxl/port: Fix decoder initialization when nr_targets > interleave_ways")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Link: https://patch.msgid.link/d7577652cc6d414e1de0ee4045d4d6b2808172ce.1786143520.git.alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Dropped the update_decoder_targets() hunk since that function is absent, and adapted decoder_populate_targets() to the older signature with target_map and write_seqlock. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/port.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 302a7bc262068..fd29934c6cef9 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -125,20 +125,29 @@ static ssize_t target_type_show(struct device *dev,
}
static DEVICE_ATTR_RO(target_type);
+/*
+ * Interleave ways selects how many targets a decoder uses, but the target
+ * array is only nr_targets long. Bound array access by both.
+ */
+static int cxlsd_nr_used_targets(struct cxl_switch_decoder *cxlsd)
+{
+ return min(cxlsd->cxld.interleave_ways, cxlsd->nr_targets);
+}
+
static ssize_t emit_target_list(struct cxl_switch_decoder *cxlsd, char *buf)
{
- struct cxl_decoder *cxld = &cxlsd->cxld;
+ int nr_used = cxlsd_nr_used_targets(cxlsd);
ssize_t offset = 0;
int i, rc = 0;
- for (i = 0; i < cxld->interleave_ways; i++) {
+ for (i = 0; i < nr_used; i++) {
struct cxl_dport *dport = cxlsd->target[i];
struct cxl_dport *next = NULL;
if (!dport)
break;
- if (i + 1 < cxld->interleave_ways)
+ if (i + 1 < nr_used)
next = cxlsd->target[i + 1];
rc = sysfs_emit_at(buf, offset, "%d%s", dport->port_id,
next ? "," : "");
@@ -1387,7 +1396,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_mem_find_port, CXL);
static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd,
struct cxl_port *port, int *target_map)
{
- int i, rc = 0;
+ int i, nr_used, rc = 0;
if (!target_map)
return 0;
@@ -1398,7 +1407,8 @@ static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd,
return -EINVAL;
write_seqlock(&cxlsd->target_lock);
- for (i = 0; i < cxlsd->cxld.interleave_ways; i++) {
+ nr_used = cxlsd_nr_used_targets(cxlsd);
+ for (i = 0; i < nr_used; i++) {
struct cxl_dport *dport = find_dport(port, target_map[i]);
if (!dport) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0282/1059] ASoC: rt1015: make control calibration failures observable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (280 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0281/1059] cxl/port: Bound switch decoder target array access by nr_targets Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0283/1059] md/raid5: reject a per-device size smaller than one chunk Greg Kroah-Hartman
` (716 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <pengpeng@iscas.ac.cn>
[ Upstream commit 98fe8aab04cec6fcadeb10a757235225d550be36 ]
The bypass-boost control runs a hardware calibration while bypassing the
register cache. It ignores every register access and cache restore
failure, then publishes both the requested mode and calibration
completion.
Return failures from the complete calibration sequence, always restore
normal cache operation and unlock DAPM, and only publish the control
state after the calibration and final mode write both succeed. The mixer
control callback is an effective error consumer, independent of deferred
component resume.
Fixes: da145172b236 ("ASoC: rt1015: Fix DC calibration on bypass boost mode")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260830142118.36668-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Replaced the upstream dapm local from snd_soc_component_to_dapm() with direct &component->dapm in the DAPM mutex lock and unlock calls, plus minor context drift. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/rt1015.c | 81 +++++++++++++++++++++++++++++++--------
1 file changed, 65 insertions(+), 16 deletions(-)
diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c
index 57d0f1c69e46c..4767fbede3e85 100644
--- a/sound/soc/codecs/rt1015.c
+++ b/sound/soc/codecs/rt1015.c
@@ -492,34 +492,71 @@ static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol,
return 0;
}
-static void rt1015_calibrate(struct rt1015_priv *rt1015)
+static int rt1015_calibrate(struct rt1015_priv *rt1015)
{
struct snd_soc_component *component = rt1015->component;
struct regmap *regmap = rt1015->regmap;
+ int ret, sync_ret;
snd_soc_dapm_mutex_lock(&component->dapm);
regcache_cache_bypass(regmap, true);
- regmap_write(regmap, RT1015_CLK_DET, 0x0000);
- regmap_write(regmap, RT1015_PWR4, 0x00B2);
- regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0009);
+ ret = regmap_write(regmap, RT1015_CLK_DET, 0x0000);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_PWR4, 0x00B2);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0009);
+ if (ret)
+ goto restore_cache;
+
msleep(100);
- regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000A);
+ ret = regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000A);
+ if (ret)
+ goto restore_cache;
+
msleep(100);
- regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000C);
+ ret = regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000C);
+ if (ret)
+ goto restore_cache;
+
msleep(100);
- regmap_write(regmap, RT1015_CLSD_INTERNAL8, 0x2028);
- regmap_write(regmap, RT1015_CLSD_INTERNAL9, 0x0140);
- regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000D);
+ ret = regmap_write(regmap, RT1015_CLSD_INTERNAL8, 0x2028);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_CLSD_INTERNAL9, 0x0140);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x000D);
+ if (ret)
+ goto restore_cache;
+
msleep(300);
- regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0008);
- regmap_write(regmap, RT1015_SYS_RST1, 0x05F5);
- regmap_write(regmap, RT1015_CLK_DET, 0x8000);
+ ret = regmap_write(regmap, RT1015_PWR_STATE_CTRL, 0x0008);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_SYS_RST1, 0x05F5);
+ if (ret)
+ goto restore_cache;
+
+ ret = regmap_write(regmap, RT1015_CLK_DET, 0x8000);
+
+restore_cache:
regcache_cache_bypass(regmap, false);
regcache_mark_dirty(regmap);
- regcache_sync(regmap);
+ sync_ret = regcache_sync(regmap);
+ if (!ret)
+ ret = sync_ret;
snd_soc_dapm_mutex_unlock(&component->dapm);
+
+ return ret;
}
static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
@@ -529,6 +566,8 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
snd_soc_kcontrol_component(kcontrol);
struct rt1015_priv *rt1015 =
snd_soc_component_get_drvdata(component);
+ int bypass_boost = rt1015->bypass_boost;
+ int ret;
if (rt1015->dac_is_used) {
dev_err(component->dev, "DAC is being used!\n");
@@ -538,13 +577,23 @@ static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol,
rt1015->bypass_boost = ucontrol->value.integer.value[0];
if (rt1015->bypass_boost == RT1015_Bypass_Boost &&
!rt1015->cali_done) {
- rt1015_calibrate(rt1015);
- rt1015->cali_done = 1;
+ ret = rt1015_calibrate(rt1015);
+ if (ret)
+ goto restore_boost;
+
+ ret = regmap_write(rt1015->regmap, RT1015_MONO_DYNA_CTRL,
+ 0x0010);
+ if (ret)
+ goto restore_boost;
- regmap_write(rt1015->regmap, RT1015_MONO_DYNA_CTRL, 0x0010);
+ rt1015->cali_done = 1;
}
return 0;
+
+restore_boost:
+ rt1015->bypass_boost = bypass_boost;
+ return ret;
}
static const struct snd_kcontrol_new rt1015_snd_controls[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0283/1059] md/raid5: reject a per-device size smaller than one chunk
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (281 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0282/1059] ASoC: rt1015: make control calibration failures observable Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0284/1059] kernfs: dont repeat or skip an entry when readdir resumes Greg Kroah-Hartman
` (715 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+50f9bc7ab8eb224b7629,
Zizhi Wo, Yu Kuai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <wozizhi@huawei.com>
[ Upstream commit 370ca0760b18c64592a258bcb057ff0a2531aabf ]
Both raid5_run() and raid5_resize() align the per-device size down to a
whole multiple of the chunk size:
mddev->dev_sectors &= ~(chunk_sectors - 1);
Neither checks the result, so a size smaller than one chunk silently
becomes zero.
In raid5_run() that is harmless: the array size is derived from the same
zero, so the disk just ends up with no capacity.
In raid5_resize() it leaves the array inconsistent -- mddev->dev_sectors
becomes zero, while mddev->array_sectors and the gendisk capacity keep the
previous. A later raid4/raid5 -> raid0 takeover copies the zero into every
rdev->sectors (raid0_takeover_raid45()), so create_strip_zones() builds a
strip zone table whose zone_end is zero. Any read then passes
bio_check_eod() against the stale capacity and hits the BUG() in
find_zone():
kernel BUG at drivers/md/raid0.c:318!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
Call Trace:
raid0_make_request
md_handle_request
submit_bio_noacct_nocheck
block_read_full_folio
read_part_sector
bdev_disk_changed
bdev_open
Reject a size smaller than one chunk in both functions, so that a running
raid4/raid5 array always has mddev->dev_sectors >= one chunk.
The check is done where the value takes effect, not where it is assigned.
mddev->dev_sectors is written from several places, and none of them can
tell whether the value is usable: the chunk size may still change later.
raid5_run() and raid5_resize() are where every input is final, so one check
in each covers them all.
Fixes: eea136d69f9f ("md: fix buglet in RAID5 -> RAID0 conversion.")
Reported-by: syzbot+50f9bc7ab8eb224b7629@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=50f9bc7ab8eb224b7629
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Link: https://patch.msgid.link/20260916095137.1157801-1-wozizhi@huaweicloud.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
[ sashal: Omitted ret = -EINVAL; before goto abort in raid5_run() because that function has no ret variable here, so the error code is -EIO instead. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/raid5.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ae9a9b904931d..2ef9657967e55 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8054,6 +8054,11 @@ static int raid5_run(struct mddev *mddev)
/* device size must be a multiple of chunk size */
mddev->dev_sectors &= ~((sector_t)mddev->chunk_sectors - 1);
+ if (!mddev->dev_sectors) {
+ pr_warn("md/raid:%s: device size is smaller than one chunk\n",
+ mdname(mddev));
+ goto abort;
+ }
mddev->resync_max_sectors = mddev->dev_sectors;
if (mddev->degraded > dirty_parity_disks &&
@@ -8459,6 +8464,8 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
if (raid5_has_log(conf) || raid5_has_ppl(conf))
return -EINVAL;
sectors &= ~((sector_t)conf->chunk_sectors - 1);
+ if (!sectors)
+ return -EINVAL;
newsize = raid5_size(mddev, sectors, mddev->raid_disks);
if (mddev->external_size &&
mddev->array_sectors > newsize)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0284/1059] kernfs: dont repeat or skip an entry when readdir resumes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (282 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0283/1059] md/raid5: reject a per-device size smaller than one chunk Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0285/1059] crypto: qat - fix active_devs leak on crypto alg registration failure Greg Kroah-Hartman
` (714 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Shakeel Butt,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <shakeel.butt@linux.dev>
[ Upstream commit 5ebcb578adeec7407dd501108ab2f423ca8e3e55 ]
readdir keeps its place as a name hash in ctx->pos and pins the entry in
file->private_data. If that entry is gone when the listing comes back,
kernfs_dir_pos() searches the rbtree for the hash and keeps whatever
node the descent stopped on. That is the entry before or after the
missing one, depending on the shape of the tree.
Landing before it repeats an entry the previous getdents(2) call already
reported. Landing after it, kernfs_dir_next_pos() calls rb_next() and
steps over an unreported entry.
With children A(10), B(20), C(30):
report A, ctx->pos = 10
A removed
kernfs_dir_next_pos(10, A)
A is gone, the search for 10 stops at B
rb_next(B) -> C, so B is never reported
Only the repeat happens today, between two getdents(2) calls. The skip
needs the pinned entry to go away inside one call, which the next patch
allows when it drops kernfs_rwsem around dir_emit().
Before the commit 4e4d6d860b93 the descent kept a node only on the way
left, which is a search for the first entry at or after the hash. That
commit moved the assignment to the top of the loop, where it runs on
right turns too. Restore that search, and step forward only when the
pinned entry is still there rather than when the hash matches, since two
entries in one directory can share a hash.
While here, kernfs_dir_next_pos() called the hash @ino. It is never an
inode number, so name it @hash.
Fixes: 4e4d6d860b93 ("sysfs: Add s_hash to sysfs_dirent and order directory entries by hash")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://patch.msgid.link/20260911182815.1992483-2-shakeel.butt@linux.dev
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Adapted to the older tree's plain void *ns and direct pos->parent and pos->name accesses, since it has no ns_common, RCU parent or RCU name. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/kernfs/dir.c | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index c01d900f09de1..0798f582149f1 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1774,27 +1774,42 @@ static int kernfs_dir_fop_release(struct inode *inode, struct file *filp)
return 0;
}
+/*
+ * Find where a listing left off. @resumed says whether @pos is still that
+ * entry; if not, the first entry at or after @hash is returned instead.
+ */
static struct kernfs_node *kernfs_dir_pos(const void *ns,
- struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos)
+ struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos,
+ bool *resumed)
{
+ if (resumed)
+ *resumed = false;
if (pos) {
int valid = kernfs_active(pos) &&
pos->parent == parent && hash == pos->hash;
kernfs_put(pos);
if (!valid)
pos = NULL;
+ else if (resumed)
+ *resumed = true;
}
if (!pos && (hash > 1) && (hash < INT_MAX)) {
struct rb_node *node = parent->dir.children.rb_node;
+
+ /*
+ * Keep a node only on the way left, so the search ends on the
+ * first entry at or after @hash. The empty name sorts before
+ * every entry sharing the hash, so it lands on the first.
+ */
while (node) {
- pos = rb_to_kn(node);
+ struct kernfs_node *kn = rb_to_kn(node);
- if (hash < pos->hash)
+ if (kernfs_name_compare(hash, "", ns, kn) < 0) {
+ pos = kn;
node = node->rb_left;
- else if (hash > pos->hash)
+ } else {
node = node->rb_right;
- else
- break;
+ }
}
}
/* Skip over entries which are dying/dead or in the wrong namespace */
@@ -1809,10 +1824,13 @@ static struct kernfs_node *kernfs_dir_pos(const void *ns,
}
static struct kernfs_node *kernfs_dir_next_pos(const void *ns,
- struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos)
+ struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos)
{
- pos = kernfs_dir_pos(ns, parent, ino, pos);
- if (pos) {
+ bool resumed;
+
+ pos = kernfs_dir_pos(ns, parent, hash, pos, &resumed);
+ /* Step over @pos only if it survived; two entries can share a hash. */
+ if (pos && resumed) {
do {
struct rb_node *node = rb_next(&pos->rb);
if (!node)
@@ -1841,7 +1859,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
if (kernfs_ns_enabled(parent))
ns = kernfs_info(dentry->d_sb)->ns;
- for (pos = kernfs_dir_pos(ns, parent, ctx->pos, pos);
+ for (pos = kernfs_dir_pos(ns, parent, ctx->pos, pos, NULL);
pos;
pos = kernfs_dir_next_pos(ns, parent, ctx->pos, pos)) {
const char *name = pos->name;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0285/1059] crypto: qat - fix active_devs leak on crypto alg registration failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (283 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0284/1059] kernfs: dont repeat or skip an entry when readdir resumes Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0286/1059] interconnect: qcom: icc-rpm: Handle icc_link_create() failures Greg Kroah-Hartman
` (713 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ahsan Atta, Giovanni Cabiddu,
Thomas Huth, Herbert Xu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahsan Atta <ahsan.atta@intel.com>
[ Upstream commit 178829f1b5b259938188a10f4103fdb901b6435e ]
adf_dev_start() registered both alg sets in a single condition.
If qat_algs_register() succeeds but qat_asym_algs_register() fails,
ADF_STATUS_CRYPTO_ALGS_REGISTERED is left clear, so adf_dev_stop() skips
qat_algs_unregister(): the skciphers and aeads stay registered with
active_devs stuck at 1, pinning the module.
Both helpers leak active_devs internally as well - they increment it and
return without decrementing when a crypto_register_*() call fails, and
the asym path also leaves the already-registered akcipher behind.
Split the registration in adf_dev_start() so that an asym failure
unregisters qat_algs, and unwind active_devs (and the akcipher) on the
error paths of both register helpers. While at it, propagate the error
code returned by the register helpers instead of a blanket -EFAULT.
Fixes: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Added a missing int ret; declaration in adf_dev_start() because this tree's older version of the function doesn't declare it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/qat/qat_common/adf_init.c | 25 +++++++++++++-----
drivers/crypto/qat/qat_common/qat_algs.c | 15 ++++++-----
drivers/crypto/qat/qat_common/qat_asym_algs.c | 26 ++++++++++++++-----
3 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c
index c397c58bd4a96..306bbf8eb46f1 100644
--- a/drivers/crypto/qat/qat_common/adf_init.c
+++ b/drivers/crypto/qat/qat_common/adf_init.c
@@ -169,6 +169,7 @@ int adf_dev_start(struct adf_accel_dev *accel_dev)
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
struct service_hndl *service;
struct list_head *list_itr;
+ int ret;
set_bit(ADF_STATUS_STARTING, &accel_dev->status);
@@ -210,13 +211,23 @@ int adf_dev_start(struct adf_accel_dev *accel_dev)
clear_bit(ADF_STATUS_STARTING, &accel_dev->status);
set_bit(ADF_STATUS_STARTED, &accel_dev->status);
- if (!list_empty(&accel_dev->crypto_list) &&
- (qat_algs_register() || qat_asym_algs_register())) {
- dev_err(&GET_DEV(accel_dev),
- "Failed to register crypto algs\n");
- set_bit(ADF_STATUS_STARTING, &accel_dev->status);
- clear_bit(ADF_STATUS_STARTED, &accel_dev->status);
- return -EFAULT;
+ if (!list_empty(&accel_dev->crypto_list)) {
+ ret = qat_algs_register();
+ if (ret) {
+ dev_err(&GET_DEV(accel_dev), "Failed to register crypto algs\n");
+ set_bit(ADF_STATUS_STARTING, &accel_dev->status);
+ clear_bit(ADF_STATUS_STARTED, &accel_dev->status);
+ return ret;
+ }
+
+ ret = qat_asym_algs_register();
+ if (ret) {
+ dev_err(&GET_DEV(accel_dev), "Failed to register crypto asym algs\n");
+ qat_algs_unregister();
+ set_bit(ADF_STATUS_STARTING, &accel_dev->status);
+ clear_bit(ADF_STATUS_STARTED, &accel_dev->status);
+ return ret;
+ }
}
set_bit(ADF_STATUS_CRYPTO_ALGS_REGISTERED, &accel_dev->status);
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c
index 1e3bc170bf2d0..c578d45508d6d 100644
--- a/drivers/crypto/qat/qat_common/qat_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_algs.c
@@ -1396,19 +1396,22 @@ int qat_algs_register(void)
ret = crypto_register_skciphers(qat_skciphers,
ARRAY_SIZE(qat_skciphers));
if (ret)
- goto unlock;
+ goto err_dec;
ret = crypto_register_aeads(qat_aeads, ARRAY_SIZE(qat_aeads));
if (ret)
- goto unreg_algs;
+ goto err_unreg_skciphers;
-unlock:
mutex_unlock(&algs_lock);
- return ret;
+ return 0;
-unreg_algs:
+err_unreg_skciphers:
crypto_unregister_skciphers(qat_skciphers, ARRAY_SIZE(qat_skciphers));
- goto unlock;
+err_dec:
+ active_devs--;
+unlock:
+ mutex_unlock(&algs_lock);
+ return ret;
}
void qat_algs_unregister(void)
diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c
index fc0613f37b7e1..96f0fece1ceac 100644
--- a/drivers/crypto/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c
@@ -1284,13 +1284,25 @@ int qat_asym_algs_register(void)
int ret = 0;
mutex_lock(&algs_lock);
- if (++active_devs == 1) {
- rsa.base.cra_flags = 0;
- ret = crypto_register_akcipher(&rsa);
- if (ret)
- goto unlock;
- ret = crypto_register_kpp(&dh);
- }
+ if (++active_devs != 1)
+ goto unlock;
+
+ rsa.base.cra_flags = 0;
+ ret = crypto_register_akcipher(&rsa);
+ if (ret)
+ goto err_dec;
+
+ ret = crypto_register_kpp(&dh);
+ if (ret)
+ goto err_unreg_akcipher;
+
+ mutex_unlock(&algs_lock);
+ return 0;
+
+err_unreg_akcipher:
+ crypto_unregister_akcipher(&rsa);
+err_dec:
+ active_devs--;
unlock:
mutex_unlock(&algs_lock);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0286/1059] interconnect: qcom: icc-rpm: Handle icc_link_create() failures
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (284 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0285/1059] crypto: qat - fix active_devs leak on crypto alg registration failure Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0287/1059] interconnect: qcom: use 64-bit SMD RPM bus votes Greg Kroah-Hartman
` (712 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Konrad Dybcio, Dmitry Baryshkov,
Abel Vesa, Georgi Djakov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
[ Upstream commit b2079a6b8e8b92c6c45a22930e5b68a9c5c34645 ]
icc_link_create() can return errors. Don't ignore them.
Assisted-by: LLM
Fixes: 30c8fa3ec61a ("interconnect: qcom: Add MSM8916 interconnect provider driver")
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909-topic-icc_rpm_smd_qol-v1-3-6dc5b5e97626@oss.qualcomm.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
[ sashal: Replaced upstream's open-coded cleanup (including interface-clock disable) with a goto to the existing err_remove_nodes label, since this tree has no intf_clks support. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/interconnect/qcom/icc-rpm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
index 9047481fafd48..3418ac2e28de8 100644
--- a/drivers/interconnect/qcom/icc-rpm.c
+++ b/drivers/interconnect/qcom/icc-rpm.c
@@ -521,8 +521,11 @@ int qnoc_probe(struct platform_device *pdev)
node->data = qnodes[i];
icc_node_add(node, provider);
- for (j = 0; j < qnodes[i]->num_links; j++)
- icc_link_create(node, qnodes[i]->links[j]);
+ for (j = 0; j < qnodes[i]->num_links; j++) {
+ ret = icc_link_create(node, qnodes[i]->links[j]);
+ if (ret)
+ goto err_remove_nodes;
+ }
data->nodes[i] = node;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0287/1059] interconnect: qcom: use 64-bit SMD RPM bus votes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (285 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0286/1059] interconnect: qcom: icc-rpm: Handle icc_link_create() failures Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:56 ` [PATCH 6.1 0288/1059] bpftool: Compute map size of light skeletons at runtime Greg Kroah-Hartman
` (711 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Konrad Dybcio, Abel Vesa,
Gopikrishna Garmidi, Georgi Djakov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
[ Upstream commit 24e7422ce31189502d07279c083646aaca513311 ]
SMD RPM bus bandwidth requests carry a 64-bit bandwidth value.
The interconnect proxy declared the KVP payload as u32, truncating
votes above 4 GiB/s and advertising the wrong payload size to RPM.
Use a little-endian 64-bit payload and accept a u64 value in the proxy
API. This has always been the right behavior, even on msm-3.10 and
32-bit SoCs.
Fixes: be06f8e7425d ("interconnect: qcom: Add interconnect RPM over SMD driver")
Assisted-by: LLM
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260904-topic-icc_rpm_64b_req-v1-1-37e24f1991a3@oss.qualcomm.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
[ sashal: Dropped the icc-rpm.h hunks, which touch a struct and prototype not present in this tree, and applied the u32 to u64 prototype change in smd-rpm.h instead. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/interconnect/qcom/smd-rpm.c | 8 ++++----
drivers/interconnect/qcom/smd-rpm.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/interconnect/qcom/smd-rpm.c b/drivers/interconnect/qcom/smd-rpm.c
index dc8ff8d133a9c..07ea97722d873 100644
--- a/drivers/interconnect/qcom/smd-rpm.c
+++ b/drivers/interconnect/qcom/smd-rpm.c
@@ -22,7 +22,7 @@ static struct qcom_smd_rpm *icc_smd_rpm;
struct icc_rpm_smd_req {
__le32 key;
__le32 nbytes;
- __le32 value;
+ __le64 value;
};
bool qcom_icc_rpm_smd_available(void)
@@ -31,12 +31,12 @@ bool qcom_icc_rpm_smd_available(void)
}
EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_available);
-int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val)
+int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u64 val)
{
struct icc_rpm_smd_req req = {
.key = cpu_to_le32(RPM_KEY_BW),
- .nbytes = cpu_to_le32(sizeof(u32)),
- .value = cpu_to_le32(val),
+ .nbytes = cpu_to_le32(sizeof(u64)),
+ .value = cpu_to_le64(val),
};
return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req,
diff --git a/drivers/interconnect/qcom/smd-rpm.h b/drivers/interconnect/qcom/smd-rpm.h
index ca9d0327b8ac1..3fb4a17ec7704 100644
--- a/drivers/interconnect/qcom/smd-rpm.h
+++ b/drivers/interconnect/qcom/smd-rpm.h
@@ -10,6 +10,6 @@
#include <linux/soc/qcom/smd-rpm.h>
bool qcom_icc_rpm_smd_available(void);
-int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val);
+int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u64 val);
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0288/1059] bpftool: Compute map size of light skeletons at runtime
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (286 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0287/1059] interconnect: qcom: use 64-bit SMD RPM bus votes Greg Kroah-Hartman
@ 2026-12-04 9:56 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0289/1059] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Greg Kroah-Hartman
` (710 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:56 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leon Hwang, Andrii Nakryiko,
Quentin Monnet, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <leon.hwang@linux.dev>
[ Upstream commit a885470df10b1c0dbc011177c19d3fd3bb8af2e9 ]
bpftool rounds memory-mapped data map sizes to the host page size when
generating a light skeleton. The generated code therefore uses a 64K
mapping size when bpftool runs on a 64K-page host, even if the skeleton
runs on a 4K-page target. The target rejects the oversized map mmap(),
causing failure of loading the light skeleton.
When try to run 64K-page selftests on 4K-page VM, the error message does
not provide the reason about page size.
test_atomics:PASS:atomics skeleton open 0 nsec
test_atomics:FAIL:atomics skeleton load unexpected error: -12 (errno 22)
#15 atomics:FAIL
Pass the original map value size and max entries to the generated code and
round mmap size to the runtime page size in the user-space light
skeleton helpers. This keeps generated light skeletons independent of the
build host page size.
Fixes: d510296d331a ("bpftool: Use syscall/loader program in "prog load" and "gen skeleton" command.")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20260915161450.96249-1-leon.hwang@linux.dev
[ sashal: Codegen now passes raw value_size and max_entries to the skeleton helpers, and the in-tree preload skeleton header's call sites are updated to match, since this tree lacks the protect-map and percpu-array code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../bpf/preload/iterators/iterators.lskel.h | 6 +--
tools/bpf/bpftool/gen.c | 26 ++++---------
tools/lib/bpf/skel_internal.h | 37 ++++++++++++++-----
3 files changed, 38 insertions(+), 31 deletions(-)
diff --git a/kernel/bpf/preload/iterators/iterators.lskel.h b/kernel/bpf/preload/iterators/iterators.lskel.h
index 70f236a82fe19..e932ceed3741a 100644
--- a/kernel/bpf/preload/iterators/iterators.lskel.h
+++ b/kernel/bpf/preload/iterators/iterators.lskel.h
@@ -68,7 +68,7 @@ iterators_bpf__destroy(struct iterators_bpf *skel)
iterators_bpf__detach(skel);
skel_closenz(skel->progs.dump_bpf_map.prog_fd);
skel_closenz(skel->progs.dump_bpf_prog.prog_fd);
- skel_free_map_data(skel->rodata, skel->maps.rodata.initial_value, 4096);
+ skel_free_map_data(skel->rodata, skel->maps.rodata.initial_value, 98, 1);
skel_closenz(skel->maps.rodata.map_fd);
skel_free(skel);
}
@@ -86,7 +86,7 @@ iterators_bpf__open(void)
\x20\x20\x20\x6d\x61\x78\x5f\x65\x6e\x74\x72\x69\x65\x73\x0a\0\x25\x34\x75\x20\
\x25\x2d\x31\x36\x73\x25\x36\x64\x0a\0\x20\x20\x69\x64\x20\x6e\x61\x6d\x65\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x61\x74\x74\x61\x63\x68\x65\
-\x64\x0a\0\x25\x34\x75\x20\x25\x2d\x31\x36\x73\x20\x25\x73\x20\x25\x73\x0a\0", 4096, 98);
+\x64\x0a\0\x25\x34\x75\x20\x25\x2d\x31\x36\x73\x20\x25\x73\x20\x25\x73\x0a\0", 98, 1, 98);
if (!skel->rodata)
goto cleanup;
skel->maps.rodata.initial_value = (__u64) (long) skel->rodata;
@@ -401,7 +401,7 @@ iterators_bpf__load(struct iterators_bpf *skel)
if (err < 0)
return err;
skel->rodata = skel_finalize_map_data(&skel->maps.rodata.initial_value,
- 4096, PROT_READ, skel->maps.rodata.map_fd);
+ 98, 1, PROT_READ, skel->maps.rodata.map_fd);
if (!skel->rodata)
return -ENOMEM;
return 0;
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index ac9886c80e046..35da2a8ce6612 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -453,16 +453,6 @@ static void print_hex(const char *data, int data_sz)
}
}
-static size_t bpf_map_mmap_sz(const struct bpf_map *map)
-{
- long page_sz = sysconf(_SC_PAGE_SIZE);
- size_t map_sz;
-
- map_sz = (size_t)roundup(bpf_map__value_size(map), 8) * bpf_map__max_entries(map);
- map_sz = roundup(map_sz, page_sz);
- return map_sz;
-}
-
/* Emit type size asserts for all top-level fields in memory-mapped internal maps. */
static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
{
@@ -640,8 +630,8 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name)
continue;
if (bpf_map__is_internal(map) &&
(bpf_map__map_flags(map) & BPF_F_MMAPABLE))
- printf("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$zd);\n",
- ident, bpf_map_mmap_sz(map));
+ printf("\tskel_free_map_data(skel->%1$s, skel->maps.%1$s.initial_value, %2$u, %3$u);\n",
+ ident, bpf_map__value_size(map), bpf_map__max_entries(map));
codegen("\
\n\
skel_closenz(skel->maps.%1$s.map_fd); \n\
@@ -714,11 +704,11 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
print_hex(mmap_data, mmap_size);
codegen("\
\n\
- \", %1$zd, %2$zd); \n\
- if (!skel->%3$s) \n\
+ \", %1$u, %2$u, %3$zd); \n\
+ if (!skel->%4$s) \n\
goto cleanup; \n\
- skel->maps.%3$s.initial_value = (__u64) (long) skel->%3$s;\n\
- ", bpf_map_mmap_sz(map), mmap_size, ident);
+ skel->maps.%4$s.initial_value = (__u64) (long) skel->%4$s;\n\
+ ", bpf_map__value_size(map), bpf_map__max_entries(map), mmap_size, ident);
}
codegen("\
\n\
@@ -773,11 +763,11 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
codegen("\
\n\
skel->%1$s = skel_finalize_map_data(&skel->maps.%1$s.initial_value, \n\
- %2$zd, %3$s, skel->maps.%1$s.map_fd);\n\
+ %2$u, %3$u, %4$s, skel->maps.%1$s.map_fd);\n\
if (!skel->%1$s) \n\
return -ENOMEM; \n\
",
- ident, bpf_map_mmap_sz(map), mmap_flags);
+ ident, bpf_map__value_size(map), bpf_map__max_entries(map), mmap_flags);
}
codegen("\
\n\
diff --git a/tools/lib/bpf/skel_internal.h b/tools/lib/bpf/skel_internal.h
index 1e82ab06c3ebf..5aa1549257197 100644
--- a/tools/lib/bpf/skel_internal.h
+++ b/tools/lib/bpf/skel_internal.h
@@ -11,6 +11,7 @@
#include <linux/bpf.h>
#else
#include <unistd.h>
+#include <sys/param.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <stdlib.h>
@@ -121,7 +122,7 @@ static inline void skel_free(const void *p)
* either bpf_probe_read_kernel() or bpf_copy_from_user() from initial_value
* depending on bpf_loader_ctx->flags.
*/
-static inline void skel_free_map_data(void *p, __u64 addr, size_t sz)
+static inline void skel_free_map_data(void *p, __u64 addr, size_t val_sz, __u32 max_entries)
{
if (addr != ~0ULL)
kvfree(p);
@@ -130,18 +131,20 @@ static inline void skel_free_map_data(void *p, __u64 addr, size_t sz)
*/
}
-static inline void *skel_prep_map_data(const void *val, size_t mmap_sz, size_t val_sz)
+static inline void *skel_prep_map_data(const void *val, size_t val_sz, __u32 max_entries,
+ size_t data_sz)
{
void *addr;
- addr = kvmalloc(val_sz, GFP_KERNEL);
+ addr = kvmalloc(data_sz, GFP_KERNEL);
if (!addr)
return NULL;
- memcpy(addr, val, val_sz);
+ memcpy(addr, val, data_sz);
return addr;
}
-static inline void *skel_finalize_map_data(__u64 *init_val, size_t mmap_sz, int flags, int fd)
+static inline void *skel_finalize_map_data(__u64 *init_val, size_t val_sz, __u32 max_entries,
+ int flags, int fd)
{
struct bpf_map *map;
void *addr = NULL;
@@ -176,25 +179,39 @@ static inline void skel_free(void *p)
free(p);
}
-static inline void skel_free_map_data(void *p, __u64 addr, size_t sz)
+static inline size_t skel_map_mmap_sz(size_t val_sz, __u32 max_entries)
{
- munmap(p, sz);
+ const long page_sz = sysconf(_SC_PAGE_SIZE);
+ size_t mmap_sz;
+
+ mmap_sz = roundup(val_sz, 8) * max_entries;
+ mmap_sz = roundup(mmap_sz, page_sz);
+ return mmap_sz;
+}
+
+static inline void skel_free_map_data(void *p, __u64 addr, size_t val_sz, __u32 max_entries)
+{
+ munmap(p, skel_map_mmap_sz(val_sz, max_entries));
}
-static inline void *skel_prep_map_data(const void *val, size_t mmap_sz, size_t val_sz)
+static inline void *skel_prep_map_data(const void *val, size_t val_sz, __u32 max_entries,
+ size_t data_sz)
{
+ size_t mmap_sz = skel_map_mmap_sz(val_sz, max_entries);
void *addr;
addr = mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (addr == (void *) -1)
return NULL;
- memcpy(addr, val, val_sz);
+ memcpy(addr, val, data_sz);
return addr;
}
-static inline void *skel_finalize_map_data(__u64 *init_val, size_t mmap_sz, int flags, int fd)
+static inline void *skel_finalize_map_data(__u64 *init_val, size_t val_sz, __u32 max_entries,
+ int flags, int fd)
{
+ size_t mmap_sz = skel_map_mmap_sz(val_sz, max_entries);
void *addr;
addr = mmap((void *) (long) *init_val, mmap_sz, flags, MAP_SHARED | MAP_FIXED, fd, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0289/1059] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (287 preceding siblings ...)
2026-12-04 9:56 ` [PATCH 6.1 0288/1059] bpftool: Compute map size of light skeletons at runtime Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0290/1059] mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked() Greg Kroah-Hartman
` (709 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Hunter, Frank Li,
Alexandre Belloni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <adrian.hunter@intel.com>
[ Upstream commit 5fbd0790af9484c251341e3ba2ebbb2887c570c8 ]
INTR_IBI_READY indicates that one or more IBI Status Descriptors are
present in the IBI ring. After clearing interrupt status, the interrupt
handler processes only a single IBI even though additional IBIs may
already be queued.
The controller does not reassert INTR_IBI_READY solely because entries
remain in the ring after interrupt status has been cleared. Consequently,
the remaining IBIs are not processed until some later interrupt occurs,
and can accumulate if IBIs arrive more often than the interrupt handler
runs.
Process all IBIs that are pending when the handler runs: capture the IBI
enqueue pointer up front and continue until the dequeue pointer reaches
that position.
Fixes: 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260920151248.46936-10-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[ sashal: kept the branch's DBG() macro and its spinlock-protected dequeue pointer update, writing the fresh locked read back through *op1_val instead of a local. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i3c/master/mipi-i3c-hci/dma.c | 40 +++++++++++++++++----------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index d1d92be403253..80dfd30f90116 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -594,24 +594,23 @@ static void hci_dma_recycle_ibi_slot(struct i3c_hci *hci,
i3c_generic_ibi_recycle_slot(dev_ibi->pool, slot);
}
-static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
+static bool hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh,
+ u32 *op1_val, unsigned int enq_ptr)
{
struct i3c_dev_desc *dev;
struct i3c_hci_dev_data *dev_data;
struct hci_dma_dev_ibi_data *dev_ibi;
struct i3c_ibi_slot *slot;
- u32 op1_val, op2_val, ibi_status_error;
- unsigned int ptr, enq_ptr, deq_ptr;
+ u32 ibi_status_error;
+ unsigned int ptr, deq_ptr;
unsigned int ibi_size, ibi_chunks, ibi_data_offset, first_part;
int ibi_addr, last_ptr;
void *ring_ibi_data;
dma_addr_t ring_ibi_data_dma;
- op1_val = rh_reg_read(RING_OPERATION1);
- deq_ptr = FIELD_GET(RING_OP1_IBI_DEQ_PTR, op1_val);
-
- op2_val = rh_reg_read(RING_OPERATION2);
- enq_ptr = FIELD_GET(RING_OP2_IBI_ENQ_PTR, op2_val);
+ deq_ptr = FIELD_GET(RING_OP1_IBI_DEQ_PTR, *op1_val);
+ if (deq_ptr == enq_ptr)
+ return false;
ibi_status_error = 0;
ibi_addr = -1;
@@ -659,7 +658,7 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
if (last_ptr == -1) {
/* this IBI sequence is not yet complete */
DBG("no LAST_STATUS available (e=%d d=%d)", enq_ptr, deq_ptr);
- return;
+ return false;
}
deq_ptr = last_ptr + 1;
deq_ptr %= rh->ibi_status_entries;
@@ -732,10 +731,10 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
done:
/* take care to update the ibi dequeue pointer atomically */
spin_lock(&rh->lock);
- op1_val = rh_reg_read(RING_OPERATION1);
- op1_val &= ~RING_OP1_IBI_DEQ_PTR;
- op1_val |= FIELD_PREP(RING_OP1_IBI_DEQ_PTR, deq_ptr);
- rh_reg_write(RING_OPERATION1, op1_val);
+ *op1_val = rh_reg_read(RING_OPERATION1);
+ *op1_val &= ~RING_OP1_IBI_DEQ_PTR;
+ *op1_val |= FIELD_PREP(RING_OP1_IBI_DEQ_PTR, deq_ptr);
+ rh_reg_write(RING_OPERATION1, *op1_val);
spin_unlock(&rh->lock);
/* update the chunk pointer */
@@ -744,6 +743,19 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
/* and tell the hardware about freed chunks */
rh_reg_write(CHUNK_CONTROL, rh_reg_read(CHUNK_CONTROL) + ibi_chunks);
+
+ return true;
+}
+
+static void hci_dma_drain_ibi_ring(struct i3c_hci *hci, struct hci_rh_data *rh)
+{
+ u32 op1_val = rh_reg_read(RING_OPERATION1);
+ u32 op2_val = rh_reg_read(RING_OPERATION2);
+ unsigned int enq_ptr = FIELD_GET(RING_OP2_IBI_ENQ_PTR, op2_val);
+
+ /* Loop is bounded by enq_ptr. Further IBIs will re-assert INTR_IBI_READY */
+ while (hci_dma_process_ibi(hci, rh, &op1_val, enq_ptr))
+ ;
}
static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask)
@@ -768,7 +780,7 @@ static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask)
rh_reg_write(INTR_STATUS, status);
if (status & INTR_IBI_READY)
- hci_dma_process_ibi(hci, rh);
+ hci_dma_drain_ibi_ring(hci, rh);
if (status & (INTR_TRANSFER_COMPLETION | INTR_TRANSFER_ERR))
hci_dma_xfer_done(hci, rh);
if (status & INTR_RING_OP)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0290/1059] mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (288 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0289/1059] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0291/1059] wifi: rtl8xxxu: unwind incomplete receive startup Greg Kroah-Hartman
` (708 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrew Morton, David Hildenbrand,
Jason Gunthorpe, John Hubbard, Peter Xu, Lance Yang, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit da01399b90a73cd00b502f7903fa5acbfac4a103 ]
The !CONFIG_MMU implementation of __get_user_pages_locked() takes a bare
get_page() reference for each page regardless of foll_flags:
if (pages[i])
get_page(pages[i]);
This is reached from pin_user_pages*() with FOLL_PIN set.
unpin_user_page() is shared between MMU and NOMMU configurations and
unconditionally calls gup_put_folio(..., FOLL_PIN), which subtracts
GUP_PIN_COUNTING_BIAS (1024) from the folio refcount.
This means that pin adds 1, and then unpin will subtract 1024.
If a user maps a page (refcount 1), registers it 1023 times as an
io_uring fixed buffer (1023 pin_user_pages calls -> refcount 1024), then
unregisters: the first unpin_user_page subtracts 1024, refcount hits 0,
the page is freed and returned to the buddy allocator. The remaining
1022 unpins write into whatever was reallocated, and the user's VMA
still maps the freed page (NOMMU has no MMU to invalidate it).
Reallocating the page for an io_uring pbuf_ring then lets userspace
corrupt the new owner's data through the stale mapping.
Use try_grab_folio() which adds GUP_PIN_COUNTING_BIAS for FOLL_PIN and 1
for FOLL_GET, mirroring the CONFIG_MMU path so pin and unpin are
symmetric. Keep supporting the traditional behavior where users specify
a pages array but don't set FOLL_GET.
While at it, don't return NULL pointers in the page array,
as this is really not expected for GUP users; instead, just fail and return
-EFAULT.
[ david: support traditional behavior with no FOLL_GET, extend
description ]
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Lance Yang <lance.yang@linux.dev>
Reported-by: Anthropic
Fixes: 3faa52c03f44 ("mm/gup: track FOLL_PIN pages")
Assisted-by: gkh_clanker_t1000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Lance Yang <lance.yang@linux.dev>
Link: https://patch.msgid.link/20260921-nommu_gup_pin-v4-1-c410041cc479@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
[ sashal: Replaced upstream's try_grab_folio() with try_grab_page(), keeping the FOLL_GET default, and dropped the ret/err locals, using the existing finish_or_fault label for failures. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/gup.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 8629b2e145460..f209cfcb62add 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1743,6 +1743,10 @@ static long __get_user_pages_locked(struct mm_struct *mm, unsigned long start,
unsigned long vm_flags;
long i;
+ /* See the MMU variant: support the traditional behavior. */
+ if (pages && !(foll_flags & FOLL_PIN))
+ foll_flags |= FOLL_GET;
+
/* calculate required read or write permissions.
* If FOLL_FORCE is set, we only require the "MAY" flags.
*/
@@ -1763,8 +1767,12 @@ static long __get_user_pages_locked(struct mm_struct *mm, unsigned long start,
if (pages) {
pages[i] = virt_to_page((void *)start);
- if (pages[i])
- get_page(pages[i]);
+ if (!pages[i])
+ goto finish_or_fault;
+ if (unlikely(!try_grab_page(pages[i], foll_flags))) {
+ pages[i] = NULL;
+ goto finish_or_fault;
+ }
}
if (vmas)
vmas[i] = vma;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0291/1059] wifi: rtl8xxxu: unwind incomplete receive startup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (289 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0290/1059] mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked() Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0292/1059] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors Greg Kroah-Hartman
` (707 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ping-Ke Shih, Kim Wooseok,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Wooseok <5mghybrid@khu.ac.kr>
[ Upstream commit 4c58fb8944a2cfbe5506534de0cf58646408d31a ]
rtl8xxxu_start() allocates and submits RX URBs one at a time. If a later
allocation fails, the error path frees the TX pool but leaves earlier RX
requests active. A partial TX or RX allocation failure can also leave
ret at zero, so start reports success despite the incomplete setup.
Allocate the RX pool before submitting any of it, and return ENOMEM
whenever a pool allocation fails. Pass start errors through
rtl8xxxu_stop(), including interrupt URB submission failures, so the
existing stop path cancels work and releases both active requests and
partially allocated pools.
Share the submission loop with the RX worker. Both callers keep requests
that fail with ENOMEM/EAGAIN. For a fatal error during startup, free the
rest of the unsubmitted batch and return the error so start can unwind.
In the worker, free only the failed request and continue with the rest
of the batch.
Keep the allocation loop in a small helper so the setup and error paths
in start remain easy to follow.
On an RTL8192EU, I exercised every error exit in rtl8xxxu_start()
except interrupt-URB allocation and submission failures, which this
adapter does not use.
Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Assisted-by: GPT-6 Astra
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kim Wooseok <5mghybrid@khu.ac.kr>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260921-codex-rtl-rx-v3-submit-v4-2-eeb09fe8f791@khu.ac.kr
[ sashal: Adapted to the older driver: rtl8xxxu_stop() takes no suspend argument and kmalloc_obj() became kmalloc(sizeof(), GFP_KERNEL), with a different file name and context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 96 +++++++++++--------
1 file changed, 54 insertions(+), 42 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 4a7f48f10b304..9033084135b68 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -71,6 +71,7 @@ MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to di
#define RTL8XXXU_TX_URB_LOW_WATER 25
#define RTL8XXXU_TX_URB_HIGH_WATER 32
+static void rtl8xxxu_stop(struct ieee80211_hw *hw);
static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv,
struct rtl8xxxu_rx_urb *rx_urb);
@@ -5259,6 +5260,28 @@ static void rtl8xxxu_free_rx_resources(struct rtl8xxxu_priv *priv)
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
}
+static int rtl8xxxu_alloc_rx_urbs(struct rtl8xxxu_priv *priv)
+{
+ struct rtl8xxxu_rx_urb *rx_urb;
+ int i;
+
+ /* No RX work is active until the complete pool has been allocated. */
+ for (i = 0; i < RTL8XXXU_RX_URBS; i++) {
+ rx_urb = kmalloc(sizeof(struct rtl8xxxu_rx_urb), GFP_KERNEL);
+ if (!rx_urb)
+ return -ENOMEM;
+
+ usb_init_urb(&rx_urb->urb);
+ INIT_LIST_HEAD(&rx_urb->list);
+ rx_urb->hw = priv->hw;
+
+ list_add_tail(&rx_urb->list, &priv->rx_urb_pending_list);
+ priv->rx_urb_pending_count++;
+ }
+
+ return 0;
+}
+
static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
struct rtl8xxxu_rx_urb *rx_urb)
{
@@ -5286,32 +5309,21 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
}
-static void rtl8xxxu_rx_urb_work(struct work_struct *work)
+static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
{
- struct rtl8xxxu_priv *priv;
struct rtl8xxxu_rx_urb *rx_urb, *tmp;
- struct list_head local;
unsigned long flags;
+ LIST_HEAD(local);
int ret;
- priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
- INIT_LIST_HEAD(&local);
-
spin_lock_irqsave(&priv->rx_urb_lock, flags);
-
list_splice_init(&priv->rx_urb_pending_list, &local);
priv->rx_urb_pending_count = 0;
-
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
list_for_each_entry_safe(rx_urb, tmp, &local, list) {
list_del_init(&rx_urb->list);
ret = rtl8xxxu_submit_rx_urb(priv, rx_urb);
- /*
- * If out of memory or temporary error, put it back on the
- * queue and try again. Otherwise the device is dead/gone
- * and we should drop it.
- */
switch (ret) {
case 0:
break;
@@ -5320,11 +5332,29 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
rtl8xxxu_queue_rx_urb(priv, rx_urb);
break;
default:
+ usb_free_urb(&rx_urb->urb);
+ if (startup)
+ goto free_remaining;
dev_warn(&priv->udev->dev,
"failed to requeue urb with error %i\n", ret);
- usb_free_urb(&rx_urb->urb);
}
}
+
+ return 0;
+
+free_remaining:
+ list_for_each_entry_safe(rx_urb, tmp, &local, list) {
+ list_del(&rx_urb->list);
+ usb_free_urb(&rx_urb->urb);
+ }
+ return ret;
+}
+
+static void rtl8xxxu_rx_urb_work(struct work_struct *work)
+{
+ struct rtl8xxxu_priv *priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+
+ rtl8xxxu_submit_rx_urbs(priv, false);
}
/*
@@ -6434,7 +6464,6 @@ static void rtl8xxxu_watchdog_callback(struct work_struct *work)
static int rtl8xxxu_start(struct ieee80211_hw *hw)
{
struct rtl8xxxu_priv *priv = hw->priv;
- struct rtl8xxxu_rx_urb *rx_urb;
struct rtl8xxxu_tx_urb *tx_urb;
unsigned long flags;
int ret, i;
@@ -6449,14 +6478,13 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
if (priv->usb_interrupts) {
ret = rtl8xxxu_submit_int_urb(hw);
if (ret)
- goto exit;
+ goto error_out;
}
for (i = 0; i < RTL8XXXU_TX_URBS; i++) {
tx_urb = kmalloc(sizeof(struct rtl8xxxu_tx_urb), GFP_KERNEL);
if (!tx_urb) {
- if (!i)
- ret = -ENOMEM;
+ ret = -ENOMEM;
goto error_out;
}
@@ -6467,31 +6495,21 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
priv->tx_urb_free_count++;
}
+ ret = rtl8xxxu_alloc_rx_urbs(priv);
+ if (ret)
+ goto error_out;
+
priv->tx_stopped = false;
spin_lock_irqsave(&priv->rx_urb_lock, flags);
priv->shutdown = false;
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
- for (i = 0; i < RTL8XXXU_RX_URBS; i++) {
- rx_urb = kmalloc(sizeof(struct rtl8xxxu_rx_urb), GFP_KERNEL);
- if (!rx_urb) {
- if (!i)
- ret = -ENOMEM;
-
- goto error_out;
- }
- usb_init_urb(&rx_urb->urb);
- INIT_LIST_HEAD(&rx_urb->list);
- rx_urb->hw = hw;
-
- ret = rtl8xxxu_submit_rx_urb(priv, rx_urb);
- if (ret)
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
- }
+ ret = rtl8xxxu_submit_rx_urbs(priv, true);
+ if (ret)
+ goto error_out;
schedule_delayed_work(&priv->ra_watchdog, 2 * HZ);
-exit:
/*
* Accept all data and mgmt frames
*/
@@ -6503,13 +6521,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
return ret;
error_out:
- rtl8xxxu_free_tx_resources(priv);
- /*
- * Disable all data and mgmt frames
- */
- rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x0000);
- rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0x0000);
-
+ rtl8xxxu_stop(hw);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0292/1059] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (290 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0291/1059] wifi: rtl8xxxu: unwind incomplete receive startup Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0293/1059] crypto: qat - hold cfg->lock when accessing config sections Greg Kroah-Hartman
` (706 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kim Wooseok, Ping-Ke Shih,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Wooseok <5mghybrid@khu.ac.kr>
[ Upstream commit 2f77c66694108785a1f6ae6c5de06453e7f7a91f ]
rtl8xxxu resubmits completed RX requests when more than eight URBs are
waiting on the pending list. It starts with 32 URBs, but frees them on
completion errors. After enough errors, the remaining pool can no longer
reach the submission threshold. Reception then stays stopped even after
the errors end. Temporary submission failures can leave a small batch
waiting with no further work scheduled, too.
Keep the URB when a completion reports EPROTO, EILSEQ, ETIME, EOVERFLOW,
ECOMM or ENOSR. Free its receive buffer and return the request to the
same pending list used by normal completions. ENOMEM/EAGAIN from startup
or worker submission uses this path as well, so a submission failure
cannot strand a request during recovery.
Use one delayed work item to submit the pending requests. An error
queues a retry after 100 ms without moving an existing reservation back.
If a normal completion takes the pending count above eight,
mod_delayed_work(..., 0) brings the work forward. This limits repeated
retries when reception is not progressing, while allowing normal traffic
to replenish the pool promptly. The 100 ms delay is therefore not a
minimum wait for each failed URB.
Keep the shutdown check, queue insertion and scheduling under the RX
lock. Stop sets shutdown under that lock, cancels the delayed work
synchronously, then drains active and pending requests. Cancellation and
device removal continue to free their URBs.
Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Assisted-by: GPT-6 Astra
Signed-off-by: Kim Wooseok <5mghybrid@khu.ac.kr>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260921-codex-rtl-rx-v3-submit-v4-3-eeb09fe8f791@khu.ac.kr
[ sashal: Replaced the newer system_percpu_wq workqueue name with system_wq in the mod_delayed_work() call, since the older tree lacks the former. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +-
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 46 ++++++++++++-------
2 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index cda3b802e89dd..e0d1ea779d545 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1287,7 +1287,7 @@ struct rtl8xxxu_priv {
struct list_head rx_urb_pending_list;
int rx_urb_pending_count;
bool shutdown;
- struct work_struct rx_urb_wq;
+ struct delayed_work rx_urb_wq;
u8 mac_addr[ETH_ALEN];
char chip_name[8];
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 9033084135b68..3640bb9c19139 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -67,6 +67,7 @@ MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to di
#define USB_VENDOR_ID_REALTEK 0x0bda
#define RTL8XXXU_RX_URBS 32
#define RTL8XXXU_RX_URB_PENDING_WATER 8
+#define RTL8XXXU_RX_URB_RETRY_DELAY_MS 100
#define RTL8XXXU_TX_URBS 64
#define RTL8XXXU_TX_URB_LOW_WATER 25
#define RTL8XXXU_TX_URB_HIGH_WATER 32
@@ -5283,9 +5284,8 @@ static int rtl8xxxu_alloc_rx_urbs(struct rtl8xxxu_priv *priv)
}
static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
- struct rtl8xxxu_rx_urb *rx_urb)
+ struct rtl8xxxu_rx_urb *rx_urb, bool defer_schedule)
{
- struct sk_buff *skb;
unsigned long flags;
spin_lock_irqsave(&priv->rx_urb_lock, flags);
@@ -5293,16 +5293,13 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
if (!priv->shutdown) {
list_add_tail(&rx_urb->list, &priv->rx_urb_pending_list);
priv->rx_urb_pending_count++;
- /*
- * Arm the worker under rx_urb_lock so this is atomic with the
- * shutdown check: moving it out of the lock would let a
- * completion arm the work after rtl8xxxu_stop() canceled it.
- */
- if (priv->rx_urb_pending_count > RTL8XXXU_RX_URB_PENDING_WATER)
- schedule_work(&priv->rx_urb_wq);
+ /* Serialize scheduling with the shutdown check and cancellation. */
+ if (defer_schedule)
+ schedule_delayed_work(&priv->rx_urb_wq,
+ msecs_to_jiffies(RTL8XXXU_RX_URB_RETRY_DELAY_MS));
+ else if (priv->rx_urb_pending_count > RTL8XXXU_RX_URB_PENDING_WATER)
+ mod_delayed_work(system_wq, &priv->rx_urb_wq, 0);
} else {
- skb = (struct sk_buff *)rx_urb->urb.context;
- dev_kfree_skb_irq(skb);
usb_free_urb(&rx_urb->urb);
}
@@ -5329,7 +5326,7 @@ static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
break;
case -ENOMEM:
case -EAGAIN:
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, true);
break;
default:
usb_free_urb(&rx_urb->urb);
@@ -5352,7 +5349,8 @@ static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
static void rtl8xxxu_rx_urb_work(struct work_struct *work)
{
- struct rtl8xxxu_priv *priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+ struct rtl8xxxu_priv *priv = container_of(to_delayed_work(work),
+ struct rtl8xxxu_priv, rx_urb_wq);
rtl8xxxu_submit_rx_urbs(priv, false);
}
@@ -5862,10 +5860,24 @@ static void rtl8xxxu_rx_complete(struct urb *urb)
skb = NULL;
rx_urb->urb.context = NULL;
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, false);
} else {
dev_dbg(dev, "%s: status %i\n", __func__, urb->status);
- goto cleanup;
+
+ switch (urb->status) {
+ case -EPROTO:
+ case -EILSEQ:
+ case -ETIME:
+ case -EOVERFLOW:
+ case -ECOMM:
+ case -ENOSR:
+ dev_kfree_skb(skb);
+ urb->context = NULL;
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, true);
+ return;
+ default:
+ goto cleanup;
+ }
}
return;
@@ -6544,7 +6556,7 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw)
* it drained via rtl8xxxu_submit_rx_urb(), so a worker still running
* after the kill could submit a URB that escapes it.
*/
- cancel_work_sync(&priv->rx_urb_wq);
+ cancel_delayed_work_sync(&priv->rx_urb_wq);
usb_kill_anchored_urbs(&priv->rx_anchor);
usb_kill_anchored_urbs(&priv->tx_anchor);
@@ -6736,7 +6748,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
spin_lock_init(&priv->tx_urb_lock);
INIT_LIST_HEAD(&priv->rx_urb_pending_list);
spin_lock_init(&priv->rx_urb_lock);
- INIT_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work);
+ INIT_DELAYED_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work);
INIT_DELAYED_WORK(&priv->ra_watchdog, rtl8xxxu_watchdog_callback);
INIT_WORK(&priv->c2hcmd_work, rtl8xxxu_c2hcmd_callback);
skb_queue_head_init(&priv->c2hcmd_queue);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0293/1059] crypto: qat - hold cfg->lock when accessing config sections
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (291 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0292/1059] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0294/1059] serial: txx9: Drop noop probe function and dangerous remove callback Greg Kroah-Hartman
` (705 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ahsan Atta, Giovanni Cabiddu,
Herbert Xu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahsan Atta <ahsan.atta@intel.com>
[ Upstream commit cb3a1364fed9ea7b063e3ae026177a145abb5940 ]
adf_cfg_sec_find() walks the per-device section list without holding
cfg->lock, and the returned section pointer is used later under the
lock. A concurrent section deletion under cfg->lock
(adf_cfg_del_all_except() on device down, or adf_cfg_dev_remove() on
removal) can free the section first, leading to a use-after-free.
The debugfs dev_cfg reader has the same problem: qat_dev_cfg_show()
walks both the section list and each section's param_head under the
global qat_cfg_read_lock mutex, not the per-device cfg->lock used by the
add and delete paths, so the two do not serialise. Updating an existing
key frees the old key_val under cfg->lock, so even a config write
concurrent with an open dev_cfg read can free an entry mid-walk, a wider
window than section deletion alone.
Take cfg->lock around the section lookup in adf_cfg_add_key_value_param()
and around the lookup and insert in adf_cfg_section_add(), and use
down_read()/up_read(&cfg->lock) in the debugfs start/stop callbacks.
Remove the now-unused qat_cfg_read_lock.
While here, return -ENOENT rather than -EFAULT when the section is not
found; EFAULT (bad userspace address) is not meaningful for this case.
Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Replaced the kzalloc_obj(*sec) allocator with kzalloc(sizeof(*sec), GFP_KERNEL) in adf_cfg_section_add(), keeping the new ret = -ENOMEM; goto unlock; error path. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/qat/qat_common/adf_cfg.c | 49 +++++++++++++++----------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/drivers/crypto/qat/qat_common/adf_cfg.c b/drivers/crypto/qat/qat_common/adf_cfg.c
index 368d14d81503c..f885d02cb2cb3 100644
--- a/drivers/crypto/qat/qat_common/adf_cfg.c
+++ b/drivers/crypto/qat/qat_common/adf_cfg.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
/* Copyright(c) 2014 - 2020 Intel Corporation */
-#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/seq_file.h>
@@ -8,13 +7,11 @@
#include "adf_cfg.h"
#include "adf_common_drv.h"
-static DEFINE_MUTEX(qat_cfg_read_lock);
-
static void *qat_dev_cfg_start(struct seq_file *sfile, loff_t *pos)
{
struct adf_cfg_device_data *dev_cfg = sfile->private;
- mutex_lock(&qat_cfg_read_lock);
+ down_read(&dev_cfg->lock);
return seq_list_start(&dev_cfg->sec_list, *pos);
}
@@ -42,7 +39,9 @@ static void *qat_dev_cfg_next(struct seq_file *sfile, void *v, loff_t *pos)
static void qat_dev_cfg_stop(struct seq_file *sfile, void *v)
{
- mutex_unlock(&qat_cfg_read_lock);
+ struct adf_cfg_device_data *dev_cfg = sfile->private;
+
+ up_read(&dev_cfg->lock);
}
static const struct seq_operations qat_dev_cfg_sops = {
@@ -238,13 +237,10 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
enum adf_cfg_val_type type)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
+ struct adf_cfg_section *section;
struct adf_cfg_key_val *key_val;
- struct adf_cfg_section *section = adf_cfg_sec_find(accel_dev,
- section_name);
char temp_val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
-
- if (!section)
- return -EFAULT;
+ int ret = 0;
key_val = kzalloc(sizeof(*key_val), GFP_KERNEL);
if (!key_val)
@@ -277,20 +273,28 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
* anything (the newly created key_val is freed).
*/
down_write(&cfg->lock);
+
+ section = adf_cfg_sec_find(accel_dev, section_name);
+ if (!section) {
+ kfree(key_val);
+ ret = -ENOENT;
+ goto unlock;
+ }
+
if (!adf_cfg_key_val_get(accel_dev, section_name, key, temp_val)) {
if (strncmp(temp_val, key_val->val, sizeof(temp_val))) {
adf_cfg_keyval_remove(key, section);
} else {
kfree(key_val);
- goto out;
+ goto unlock;
}
}
adf_cfg_keyval_add(key_val, section);
-out:
+unlock:
up_write(&cfg->lock);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(adf_cfg_add_key_value_param);
@@ -308,21 +312,26 @@ EXPORT_SYMBOL_GPL(adf_cfg_add_key_value_param);
int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
- struct adf_cfg_section *sec = adf_cfg_sec_find(accel_dev, name);
+ struct adf_cfg_section *sec;
+ int ret = 0;
- if (sec)
- return 0;
+ down_write(&cfg->lock);
+
+ if (adf_cfg_sec_find(accel_dev, name))
+ goto unlock;
sec = kzalloc(sizeof(*sec), GFP_KERNEL);
- if (!sec)
- return -ENOMEM;
+ if (!sec) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
strscpy(sec->name, name, sizeof(sec->name));
INIT_LIST_HEAD(&sec->param_head);
- down_write(&cfg->lock);
list_add_tail(&sec->list, &cfg->sec_list);
+unlock:
up_write(&cfg->lock);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(adf_cfg_section_add);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0294/1059] serial: txx9: Drop noop probe function and dangerous remove callback
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (292 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0293/1059] crypto: qat - hold cfg->lock when accessing config sections Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0295/1059] serial: sh-sci: Unregister UART on sysfs setup failure Greg Kroah-Hartman
` (704 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Atsushi Nemoto, Geert Uytterhoeven,
Andy Shevchenko, Uwe Kleine-König , Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
[ Upstream commit 22c6a6ac74c2434735638e7ef1101597ae263aec ]
The only platform device that can be bound to the driver is allocated by
the driver itself. That device doesn't have platdata, so the probe
function only consists of a loop that is never run and thus can be
dropped without loss of functionality.
The remove function then should better not undo things that were not
done in the first place. That happens because serial_txx9_init() calls
serial_txx9_register_ports() with the created platform device and so
up->dev == &dev->dev evaluates to true and uart_remove_one_port() is
called twice for each port.
So let serial_txx9_exit() undo exactly what serial_txx9_init() does and
remove the useless respectively wrong functions.
Fixes: 0970769aceb9 ("[SERIAL] serial_txx9 driver update")
Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/cd4fce2cef14907ebe4713c147f8896924380e44.1786697789.git.u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Changed the removed platform driver's remove function from void to int return type (with return 0;) to match the older base; the rest is identical apart from context offsets. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/serial_txx9.c | 56 ++------------------------------
1 file changed, 3 insertions(+), 53 deletions(-)
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index e12f1dc18c38b..5f71333bb2dd5 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -1031,7 +1031,8 @@ static void serial_txx9_unregister_port(int line)
struct uart_port *uart = &serial_txx9_ports[line];
mutex_lock(&serial_txx9_mutex);
- uart_remove_one_port(&serial_txx9_reg, uart);
+ if (uart->iobase || uart->mapbase)
+ uart_remove_one_port(&serial_txx9_reg, uart);
uart->flags = 0;
uart->type = PORT_UNKNOWN;
uart->iobase = 0;
@@ -1041,53 +1042,6 @@ static void serial_txx9_unregister_port(int line)
mutex_unlock(&serial_txx9_mutex);
}
-/*
- * Register a set of serial devices attached to a platform device.
- */
-static int serial_txx9_probe(struct platform_device *dev)
-{
- struct uart_port *p = dev_get_platdata(&dev->dev);
- struct uart_port port;
- int ret, i;
-
- memset(&port, 0, sizeof(struct uart_port));
- for (i = 0; p && p->uartclk != 0; p++, i++) {
- port.iobase = p->iobase;
- port.membase = p->membase;
- port.irq = p->irq;
- port.uartclk = p->uartclk;
- port.iotype = p->iotype;
- port.flags = p->flags;
- port.mapbase = p->mapbase;
- port.dev = &dev->dev;
- port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_TXX9_CONSOLE);
- ret = serial_txx9_register_port(&port);
- if (ret < 0) {
- dev_err(&dev->dev, "unable to register port at index %d "
- "(IO%lx MEM%llx IRQ%d): %d\n", i,
- p->iobase, (unsigned long long)p->mapbase,
- p->irq, ret);
- }
- }
- return 0;
-}
-
-/*
- * Remove serial ports registered against a platform device.
- */
-static int serial_txx9_remove(struct platform_device *dev)
-{
- int i;
-
- for (i = 0; i < UART_NR; i++) {
- struct uart_port *up = &serial_txx9_ports[i];
-
- if (up->dev == &dev->dev)
- serial_txx9_unregister_port(i);
- }
- return 0;
-}
-
#ifdef CONFIG_PM
static int serial_txx9_suspend(struct platform_device *dev, pm_message_t state)
{
@@ -1119,8 +1073,6 @@ static int serial_txx9_resume(struct platform_device *dev)
#endif
static struct platform_driver serial_txx9_plat_driver = {
- .probe = serial_txx9_probe,
- .remove = serial_txx9_remove,
#ifdef CONFIG_PM
.suspend = serial_txx9_suspend,
.resume = serial_txx9_resume,
@@ -1274,9 +1226,7 @@ static void __exit serial_txx9_exit(void)
platform_driver_unregister(&serial_txx9_plat_driver);
platform_device_unregister(serial_txx9_plat_devs);
for (i = 0; i < UART_NR; i++) {
- struct uart_port *up = &serial_txx9_ports[i];
- if (up->iobase || up->mapbase)
- uart_remove_one_port(&serial_txx9_reg, up);
+ serial_txx9_unregister_port(i);
}
uart_unregister_driver(&serial_txx9_reg);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0295/1059] serial: sh-sci: Unregister UART on sysfs setup failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (293 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0294/1059] serial: txx9: Drop noop probe function and dangerous remove callback Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0296/1059] bpf: Keep target extended until its last freplace link detaches Greg Kroah-Hartman
` (703 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit c5b33c86d86da3ccff8c05e2a28719e3ec933f70 ]
sci_probe_single() registers the UART port before sci_probe() creates
the RX FIFO tuning attributes. If either device_create_file() call
fails, probe returns an error without removing the port from the serial
core. Device-managed resources are then released while the port remains
registered.
Unregister the UART port before returning either sysfs creation error.
If the second attribute fails, remove the first attribute before
unregistering the port. Keep the existing probe failure policy and leave
the successful initialization path unchanged.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 5d23188a473d ("serial: sh-sci: make RX FIFO parameters tunable via sysfs")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Link: https://patch.msgid.link/20260911031500.5745-1-mhun512@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Adjusted the hunk layout: the rx_fifo_timeout creation is a separate type-checked block rather than nested in a fifosize check, and its error path keeps the conditional trigger-file removal before jumping to the new err_remove_port label. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/sh-sci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index eb69b56bb8215..3c84c0580a9ce 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3439,7 +3439,7 @@ static int sci_probe(struct platform_device *dev)
if (sp->port.fifosize > 1) {
ret = device_create_file(&dev->dev, &dev_attr_rx_fifo_trigger);
if (ret)
- return ret;
+ goto err_remove_port;
}
if (sp->port.type == PORT_SCIFA || sp->port.type == PORT_SCIFB ||
sp->port.type == PORT_HSCIF) {
@@ -3449,7 +3449,7 @@ static int sci_probe(struct platform_device *dev)
device_remove_file(&dev->dev,
&dev_attr_rx_fifo_trigger);
}
- return ret;
+ goto err_remove_port;
}
}
@@ -3459,6 +3459,10 @@ static int sci_probe(struct platform_device *dev)
sci_ports_in_use |= BIT(dev_id);
return 0;
+
+err_remove_port:
+ uart_remove_one_port(&sci_uart_driver, &sp->port);
+ return ret;
}
static void sci_console_save(struct sci_port *s)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0296/1059] bpf: Keep target extended until its last freplace link detaches
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (294 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0295/1059] serial: sh-sci: Unregister UART on sysfs setup failure Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0297/1059] bpftool: Fix CPU IDs in per-CPU map output Greg Kroah-Hartman
` (702 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Chen, Jiri Olsa,
Kumar Kartikeya Dwivedi, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <chenyuan@kylinos.cn>
[ Upstream commit c43c348a84460b003fa757dd43d8c89848ae220d ]
The is_extended / prog_array_member_cnt protocol introduced by commit
d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
keeps a prog extended by a freplace program out of prog_array maps, and
vice versa: once a tail call re-enters an extended subprogram, its
tail_call_cnt resets on every execution and the loop never terminates.
But is_extended is a plain boolean, while one target prog can carry
several freplace links at the same time, one on its entry and one on a
global subprogram. __bpf_trampoline_unlink_prog() cleared is_extended
whenever *any* freplace link detached, so detaching one of two links
re-armed the unbounded loop through the remaining one.
Replace the is_extended boolean with a count of the freplace links
attached to each target prog, so the target stays extended until its
last link detaches. Also rename bpf_freplace_check_tgt_prog() to
bpf_freplace_link_tgt_prog(), as the helper has never been a pure
check: it reserves the target prog on success.
Fixes: d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20260924023737.1140521-2-chenyuan_fl@163.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ sashal: Replaced the bpf_prog_aux::is_extended bool with a freplace_link_cnt counter, adapting the struct bpf_prog_aux context in bpf.h and using the bpf_tramp_link API names. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 4 ++--
kernel/bpf/arraymap.c | 2 +-
kernel/bpf/trampoline.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 0ce4f1eb92d10..53d397b3d54cd 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1210,9 +1210,8 @@ struct bpf_prog_aux {
bool sleepable;
bool tail_call_reachable;
bool xdp_has_frags;
- bool is_extended; /* true if extended by freplace program */
u64 prog_array_member_cnt; /* counts how many times as member of prog_array */
- struct mutex ext_mutex; /* mutex for is_extended and prog_array_member_cnt */
+ struct mutex ext_mutex; /* mutex for freplace_link_cnt and prog_array_member_cnt */
/* BTF_KIND_FUNC_PROTO for valid attach_btf_id */
const struct btf_type *attach_func_proto;
/* function name for valid attach_btf_id */
@@ -1235,6 +1234,7 @@ struct bpf_prog_aux {
int cgroup_atype; /* enum cgroup_bpf_attach_type */
struct bpf_map *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE];
char name[BPF_OBJ_NAME_LEN];
+ u16 freplace_link_cnt; /* counts freplace links extending this prog */
#ifdef CONFIG_SECURITY
void *security;
#endif
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 6fc07a983dd0c..8fa8c0d846003 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -901,7 +901,7 @@ static void *prog_fd_array_get_ptr(struct bpf_map *map,
}
mutex_lock(&prog->aux->ext_mutex);
- is_extended = prog->aux->is_extended;
+ is_extended = prog->aux->freplace_link_cnt > 0;
if (!is_extended)
prog->aux->prog_array_member_cnt++;
mutex_unlock(&prog->aux->ext_mutex);
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 3473e86a112a0..75f4173a0c24a 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -546,7 +546,7 @@ static enum bpf_tramp_prog_type bpf_attach_type_to_tramp(struct bpf_prog *prog)
}
}
-static int bpf_freplace_check_tgt_prog(struct bpf_prog *tgt_prog)
+static int bpf_freplace_link_tgt_prog(struct bpf_prog *tgt_prog)
{
struct bpf_prog_aux *aux = tgt_prog->aux;
@@ -560,7 +560,7 @@ static int bpf_freplace_check_tgt_prog(struct bpf_prog *tgt_prog)
*/
return -EBUSY;
- aux->is_extended = true;
+ aux->freplace_link_cnt++;
return 0;
}
@@ -587,7 +587,7 @@ static int __bpf_trampoline_link_prog(struct bpf_tramp_link *link,
/* Cannot attach extension if fentry/fexit are in use. */
if (cnt)
return -EBUSY;
- err = bpf_freplace_check_tgt_prog(tgt_prog);
+ err = bpf_freplace_link_tgt_prog(tgt_prog);
if (err)
return err;
tr->extension_prog = link->link.prog;
@@ -642,7 +642,7 @@ static int __bpf_trampoline_unlink_prog(struct bpf_tramp_link *link,
tr->extension_prog->bpf_func, NULL);
tr->extension_prog = NULL;
guard(mutex)(&tgt_prog->aux->ext_mutex);
- tgt_prog->aux->is_extended = false;
+ tgt_prog->aux->freplace_link_cnt--;
return err;
}
hlist_del_init(&link->tramp_hlist);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0297/1059] bpftool: Fix CPU IDs in per-CPU map output
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (295 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0296/1059] bpf: Keep target extended until its last freplace link detaches Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0298/1059] bpf: Look at frame 0 when telling async callback entries apart Greg Kroah-Hartman
` (701 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hui Su, Kumar Kartikeya Dwivedi,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <sh_def@163.com>
[ Upstream commit dbf8cef936c7783ca909c38097a69f73173a19a7 ]
bpftool uses dense per-CPU value-buffer slots when printing per-CPU map
values. It also uses the slot index as the CPU ID, which produces
incorrect labels when the possible CPU mask is sparse, such as 0,2-3.
Parse the possible CPU mask and use the corresponding logical CPU ID in
plain, JSON, and BTF-formatted output. Keep the dense slot index for
accessing the per-CPU value buffer.
Pass the parsed CPU count together with the CPU ID array so that the
printed CPU IDs and loop bounds come from the same possible-CPU mask.
Propagate CPU-ID lookup and map output errors through the shared output
path to its callers.
Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Signed-off-by: Hui Su <sh_def@163.com>
Link: https://lore.kernel.org/bpf/20260813155131.1022745-3-sh_def@163.com/
Link: https://lore.kernel.org/bpf/20260923004243.969919-2-sh_def@163.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/bpf/bpftool/common.c | 40 ++++++++++++++++
tools/bpf/bpftool/main.h | 1 +
tools/bpf/bpftool/map.c | 93 +++++++++++++++++++++++++-------------
3 files changed, 102 insertions(+), 32 deletions(-)
diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index a1cd6d2ac8ef1..2da7f4144bf12 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -29,6 +29,7 @@
#include <bpf/bpf.h>
#include <bpf/hashmap.h>
#include <bpf/libbpf.h> /* libbpf_num_possible_cpus */
+#include <bpf/libbpf_internal.h>
#include <bpf/btf.h>
#include "main.h"
@@ -575,6 +576,45 @@ unsigned int get_possible_cpus(void)
return cpus;
}
+int get_possible_cpu_ids(int **cpu_ids)
+{
+ const char *possible_cpus_file = "/sys/devices/system/cpu/possible";
+ bool *mask = NULL;
+ int mask_sz, nr_cpus = 0;
+ int *ids = NULL;
+ int i, res;
+
+ *cpu_ids = NULL;
+
+ res = parse_cpu_mask_file(possible_cpus_file, &mask, &mask_sz);
+ if (res) {
+ p_err("failed to parse possible CPU mask: %s", strerror(-res));
+ return res;
+ }
+
+ for (i = 0; i < mask_sz; i++)
+ nr_cpus += mask[i];
+
+ ids = calloc(nr_cpus, sizeof(*ids));
+ if (!ids) {
+ p_err("mem alloc failed");
+ res = -ENOMEM;
+ goto out;
+ }
+
+ for (i = 0, nr_cpus = 0; i < mask_sz; i++) {
+ if (mask[i])
+ ids[nr_cpus++] = i;
+ }
+ *cpu_ids = ids;
+ ids = NULL;
+ res = nr_cpus;
+out:
+ free(ids);
+ free(mask);
+ return res;
+}
+
static char *
ifindex_to_name_ns(__u32 ifindex, __u32 ns_dev, __u32 ns_ino, char *buf)
{
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index c9e171082cf61..13cdbd03e4357 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -202,6 +202,7 @@ void print_hex_data_json(uint8_t *data, size_t len);
unsigned int get_page_size(void);
unsigned int get_possible_cpus(void);
+int get_possible_cpu_ids(int **cpu_ids);
const char *
ifindex_to_bfd_params(__u32 ifindex, __u64 ns_dev, __u64 ns_ino,
const char **opt);
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 748b3def6b2c2..cf8f80c2c328b 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -70,7 +70,7 @@ static void *alloc_value(struct bpf_map_info *info)
static int do_dump_btf(const struct btf_dumper *d,
struct bpf_map_info *map_info, void *key,
- void *value)
+ void *value, const int *cpu_ids, int cpu_cnt)
{
__u32 value_id;
int ret = 0;
@@ -93,15 +93,15 @@ static int do_dump_btf(const struct btf_dumper *d,
jsonw_name(d->jw, "value");
ret = btf_dumper_type(d, value_id, value);
} else {
- unsigned int i, n, step;
+ unsigned int step;
+ int i;
jsonw_name(d->jw, "values");
jsonw_start_array(d->jw);
- n = get_possible_cpus();
step = round_up(map_info->value_size, 8);
- for (i = 0; i < n; i++) {
+ for (i = 0; i < cpu_cnt; i++) {
jsonw_start_object(d->jw);
- jsonw_int_field(d->jw, "cpu", i);
+ jsonw_int_field(d->jw, "cpu", cpu_ids[i]);
jsonw_name(d->jw, "value");
ret = btf_dumper_type(d, value_id, value + i * step);
jsonw_end_object(d->jw);
@@ -130,7 +130,8 @@ static json_writer_t *get_btf_writer(void)
}
static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
- unsigned char *value, struct btf *btf)
+ unsigned char *value, struct btf *btf,
+ const int *cpu_ids, int cpu_cnt)
{
jsonw_start_object(json_wtr);
@@ -147,12 +148,12 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
};
jsonw_name(json_wtr, "formatted");
- do_dump_btf(&d, info, key, value);
+ do_dump_btf(&d, info, key, value, cpu_ids, cpu_cnt);
}
} else {
- unsigned int i, n, step;
+ unsigned int step;
+ int i;
- n = get_possible_cpus();
step = round_up(info->value_size, 8);
jsonw_name(json_wtr, "key");
@@ -160,10 +161,10 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
jsonw_name(json_wtr, "values");
jsonw_start_array(json_wtr);
- for (i = 0; i < n; i++) {
+ for (i = 0; i < cpu_cnt; i++) {
jsonw_start_object(json_wtr);
- jsonw_int_field(json_wtr, "cpu", i);
+ jsonw_int_field(json_wtr, "cpu", cpu_ids[i]);
jsonw_name(json_wtr, "value");
print_hex_data_json(value + i * step,
@@ -180,7 +181,7 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
};
jsonw_name(json_wtr, "formatted");
- do_dump_btf(&d, info, key, value);
+ do_dump_btf(&d, info, key, value, cpu_ids, cpu_cnt);
}
}
@@ -242,7 +243,7 @@ print_entry_error(struct bpf_map_info *map_info, void *key, int lookup_errno)
}
static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
- unsigned char *value)
+ unsigned char *value, const int *cpu_ids, int cpu_cnt)
{
if (!map_is_per_cpu(info->type)) {
bool single_line, break_names;
@@ -265,9 +266,9 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
printf("\n");
} else {
- unsigned int i, n, step;
+ unsigned int step;
+ int i;
- n = get_possible_cpus();
step = round_up(info->value_size, 8);
if (info->key_size) {
@@ -276,9 +277,9 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
printf("\n");
}
if (info->value_size) {
- for (i = 0; i < n; i++) {
+ for (i = 0; i < cpu_cnt; i++) {
printf("value (CPU %02d):%c",
- i, info->value_size > 16 ? '\n' : ' ');
+ cpu_ids[i], info->value_size > 16 ? '\n' : ' ');
fprint_hex(stdout, value + i * step,
info->value_size, " ");
printf("\n");
@@ -733,7 +734,7 @@ static int do_show(int argc, char **argv)
static int dump_map_elem(int fd, void *key, void *value,
struct bpf_map_info *map_info, struct btf *btf,
- json_writer_t *btf_wtr)
+ json_writer_t *btf_wtr, const int *cpu_ids, int cpu_cnt)
{
if (bpf_map_lookup_elem(fd, key, value)) {
print_entry_error(map_info, key, errno);
@@ -741,7 +742,7 @@ static int dump_map_elem(int fd, void *key, void *value,
}
if (json_output) {
- print_entry_json(map_info, key, value, btf);
+ print_entry_json(map_info, key, value, btf, cpu_ids, cpu_cnt);
} else if (btf) {
struct btf_dumper d = {
.btf = btf,
@@ -749,9 +750,9 @@ static int dump_map_elem(int fd, void *key, void *value,
.is_plain_text = true,
};
- do_dump_btf(&d, map_info, key, value);
+ do_dump_btf(&d, map_info, key, value, cpu_ids, cpu_cnt);
} else {
- print_entry_plain(map_info, key, value);
+ print_entry_plain(map_info, key, value, cpu_ids, cpu_cnt);
}
return 0;
@@ -824,6 +825,8 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
void *key, *value, *prev_key;
unsigned int num_elems = 0;
struct btf *btf = NULL;
+ int *cpu_ids = NULL;
+ int cpu_cnt = 0;
int err;
key = malloc(info->key_size);
@@ -836,6 +839,14 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
prev_key = NULL;
+ if (map_is_per_cpu(info->type)) {
+ cpu_cnt = get_possible_cpu_ids(&cpu_ids);
+ if (cpu_cnt < 0) {
+ err = cpu_cnt;
+ goto exit_free;
+ }
+ }
+
if (wtr) {
err = get_map_kv_btf(info, &btf);
if (err) {
@@ -867,7 +878,8 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
err = 0;
break;
}
- if (!dump_map_elem(fd, key, value, info, btf, wtr))
+ if (!dump_map_elem(fd, key, value, info, btf, wtr,
+ cpu_ids, cpu_cnt))
num_elems++;
prev_key = key;
}
@@ -884,6 +896,7 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
exit_free:
free(key);
free(value);
+ free(cpu_ids);
free_map_kv_btf(btf);
return err;
@@ -1026,17 +1039,30 @@ static int do_update(int argc, char **argv)
return err;
}
-static void print_key_value(struct bpf_map_info *info, void *key,
- void *value)
+static int print_key_value(struct bpf_map_info *info, void *key,
+ void *value)
{
json_writer_t *btf_wtr;
struct btf *btf;
+ int *cpu_ids = NULL;
+ int cpu_cnt = 0;
+ int err = 0;
- if (get_map_kv_btf(info, &btf))
- return;
+ if (map_is_per_cpu(info->type)) {
+ cpu_cnt = get_possible_cpu_ids(&cpu_ids);
+
+ if (cpu_cnt < 0) {
+ err = cpu_cnt;
+ goto out;
+ }
+ }
+
+ err = get_map_kv_btf(info, &btf);
+ if (err)
+ goto out;
if (json_output) {
- print_entry_json(info, key, value, btf);
+ print_entry_json(info, key, value, btf, cpu_ids, cpu_cnt);
} else if (btf) {
/* if here json_wtr wouldn't have been initialised,
* so let's create separate writer for btf
@@ -1046,7 +1072,7 @@ static void print_key_value(struct bpf_map_info *info, void *key,
p_info("failed to create json writer for btf. falling back to plain output");
free_map_kv_btf(btf);
btf = NULL;
- print_entry_plain(info, key, value);
+ print_entry_plain(info, key, value, cpu_ids, cpu_cnt);
} else {
struct btf_dumper d = {
.btf = btf,
@@ -1054,13 +1080,16 @@ static void print_key_value(struct bpf_map_info *info, void *key,
.is_plain_text = true,
};
- do_dump_btf(&d, info, key, value);
+ do_dump_btf(&d, info, key, value, cpu_ids, cpu_cnt);
jsonw_destroy(&btf_wtr);
}
} else {
- print_entry_plain(info, key, value);
+ print_entry_plain(info, key, value, cpu_ids, cpu_cnt);
}
free_map_kv_btf(btf);
+out:
+ free(cpu_ids);
+ return err;
}
static int do_lookup(int argc, char **argv)
@@ -1104,7 +1133,7 @@ static int do_lookup(int argc, char **argv)
}
/* here means bpf_map_lookup_elem() succeeded */
- print_key_value(&info, key, value);
+ err = print_key_value(&info, key, value);
exit_free:
free(key);
@@ -1379,7 +1408,7 @@ static int do_pop_dequeue(int argc, char **argv)
goto exit_free;
}
- print_key_value(&info, key, value);
+ err = print_key_value(&info, key, value);
exit_free:
free(key);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0298/1059] bpf: Look at frame 0 when telling async callback entries apart
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (296 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0297/1059] bpftool: Fix CPU IDs in per-CPU map output Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0299/1059] bpf: Fix uninit read for non-fetch atomics on partially spilled slots Greg Kroah-Hartman
` (700 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Puranjay Mohan, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <puranjay@kernel.org>
[ Upstream commit e55220162aae99622d9e80d4700e51c13a6f2a16 ]
push_async_cb() sets in_async_callback_fn and async_entry_cnt on the
callback's own frame, which is frame 0 of the fresh state it starts, and
setup_func_entry() copies neither, so a subprog called by the callback
carries neither. Two places read them from the innermost frame instead.
is_state_visited() skips the infinite loop check when two states differ
in async_entry_cnt, because seeing the same state on a second entry into
an async callback is not a loop. A callback which re-arms itself and
calls a subprog therefore compares the two entries at a loop inside that
subprog, where the innermost frame is the subprog's and has no flag set,
and the state is rejected:
infinite loop detected at insn 60
push_callback_call() numbers a new entry as the caller's count plus one.
When the callback re-arms itself from a subprog, the caller is that
subprog's frame with a count of 0, so every entry is numbered 1, the
check above never sees a difference, and a loop anywhere in such a
callback is rejected the same way.
Read the flag and the count from frame 0 in both places. A loop within a
single entry still has a matching count and is still caught, and frame 0
of a non-async state does not have the flag set, so nothing else changes.
The two other readers are already correct: check_return_code() reads
frame[0], and the one in do_check() is reached only after an early return
for curframe != 0.
Fixes: bfc6bb74e4f1 ("bpf: Implement verifier support for validation of async callbacks.")
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924162609.1746610-2-puranjay@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index b79581a941cd9..dfc6475a9203e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -6934,7 +6934,7 @@ static int __check_func_call(struct bpf_verifier_env *env, struct bpf_insn *insn
if (!async_cb)
return -EFAULT;
callee = async_cb->frame[0];
- callee->async_entry_cnt = caller->async_entry_cnt + 1;
+ callee->async_entry_cnt = state->frame[0]->async_entry_cnt + 1;
/* Convert bpf_timer_set_callback() args into timer callback args */
err = set_callee_state_cb(env, caller, callee, *insn_idx);
@@ -12245,10 +12245,10 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
goto next;
if (sl->state.branches) {
- struct bpf_func_state *frame = sl->state.frame[sl->state.curframe];
+ struct bpf_func_state *frame = sl->state.frame[0];
if (frame->in_async_callback_fn &&
- frame->async_entry_cnt != cur->frame[cur->curframe]->async_entry_cnt) {
+ frame->async_entry_cnt != cur->frame[0]->async_entry_cnt) {
/* Different async_entry_cnt means that the verifier is
* processing another entry into async callback.
* Seeing the same state is not an indication of infinite
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0299/1059] bpf: Fix uninit read for non-fetch atomics on partially spilled slots
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (297 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0298/1059] bpf: Look at frame 0 when telling async callback entries apart Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0300/1059] powerpc/ftrace: Dont restore r13 during ftrace_regs_caller Greg Kroah-Hartman
` (699 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hao Sun, Kumar Kartikeya Dwivedi,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Sun <sunhao.th@gmail.com>
[ Upstream commit 5a84b4424db8ae07f0ac682ab031c37a91dce50b ]
check_stack_read_fixed_off() skips partial spill checks for non-fetch
atomics; the following prog can be loaded:
0: (b7) r1 = 1 ; R1=1
1: (63) *(u32 *)(r10 -8) = r1 ; R1=1 R10=fp0 fp-8=????1
2: (db) lock *(u64 *)(r10 -8) += r1 ; R1=1 R10=fp0 fp-8=mmmmmmmm
3: (79) r0 = *(u64 *)(r10 -8) ; R0=scalar() R10=fp0 fp-8=mmmmmmmm
4: (77) r0 >>= 32 ; R0=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
5: (95) exit
When test run:
retval=4294967295
Note fp-8 is ????1 at #1, yet it becomes fp-8=mmmmmmmm after the
non-fetching atomic add at #2; hence the high 32 bits are leaked.
Fix by applying the partial load check; after the patch, the
prog is rejected:
Verification failed: Memory Safety: Uninitialized stack read
Reason:
This rejected read uses 8 bytes at stack offset -8, but byte 4 in that range is uninitialized on
this path. Programs loaded with CAP_PERFMON can be allowed to read uninitialized stack bytes, but
this program is being rejected without that allowance.
At:
...
0 | (b7) r1 = 1
1 | (63) *(u32 *)(r10 -8) = r1
>>> 2 | (db) lock *(u64 *)(r10 -8) += r1
3 | (79) r0 = *(u64 *)(r10 -8)
4 | (77) r0 >>= 32
This affects CAP_BPF only.
Fixes: 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill")
Signed-off-by: Hao Sun <sunhao.th@gmail.com>
Link: https://lore.kernel.org/bpf/20260924131342.934290-1-sunhao.th@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ sashal: Moved the early dst_regno < 0 return to the start of the aligned full-size fill branch and after the per-byte validity loop in the partial-fill branch, since this tree lacks upstream's narrow-fill structure. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index dfc6475a9203e..ba4ae75512294 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -3541,10 +3541,11 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
}
mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64);
- if (dst_regno < 0)
- return 0;
if (!(off % BPF_REG_SIZE) && size == spill_size) {
+ if (dst_regno < 0)
+ return 0;
+
/* The earlier check_reg_arg() has decided the
* subreg_def for this insn. Save it first.
*/
@@ -3565,6 +3566,9 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
off, i, size);
return -EACCES;
}
+ if (dst_regno < 0)
+ return 0;
+
mark_reg_unknown(env, state->regs, dst_regno);
}
state->regs[dst_regno].live |= REG_LIVE_WRITTEN;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0300/1059] powerpc/ftrace: Dont restore r13 during ftrace_regs_caller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (298 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0299/1059] bpf: Fix uninit read for non-fetch atomics on partially spilled slots Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0301/1059] bpf: Fix uninit read for helper mem args on partially spilled slots Greg Kroah-Hartman
` (698 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michal Suchánek,
Christophe Leroy (CS GROUP), Hari Bathini, Shrikanth Hegde,
Samir Mulani, Madhavan Srinivasan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <sshegde@linux.ibm.com>
[ Upstream commit af5f0870883ae4aea7f668d06cbb7ad0e12824c8 ]
Michal reported a stack-protector failure and subsequent panic when
running kernel builds. This was observed with full/lazy preemption.
Initially it was suspected as KVM, but later turned out to be due
to a bcc tool running in parallel.
Issue was recreated using a bcc tool.
For example, running below in parallel leads to crash.
./funccount sched* -d 100 and make -j 64
The same crash was observed when running kprobe for schedule() function,
while simpler function tracer for schedule() didn't cause the crash.
This helped to narrow it down to ftrace backed kprobes area.
The crash occurs as follows:
ftrace_regs_caller entry on CPU A
|
+-> save r13 = CPU A PACA into pt_regs
|
+-> call kprobe_ftrace_handler()
|
+-> ftrace_test_recursion_unlock()
|
+-> preempt_enable
+-> task can schedule and migrate to CPU B
+-> task resumes with live r13 = CPU B PACA
|
+-> REST_GPRS(2, 31)
|
+-> restore saved r13 = CPU A PACA
|
|-> The task then continues running on CPU B with r13 pointing
| to CPU A's PACA.
The stack-protector canary is accessed through the PACA. After the task
migrates, CPU A may run a different task and update its PACA with that
task's canary. Restoring the saved r13 then causes the migrated task's
saved stack canary to be compared against the canary in CPU A's PACA,
resulting in a stack-protector failure.
Similarly, current is resolved through the PACA. With a stale r13,
preempt_count() can access the state of the task referenced by CPU A's
PACA instead of the task running on CPU B. This results in corrupted
preempt-count warnings and scheduling-while-atomic failures.
This path for example is called when using kprobes and parallel kernel
builds can cause preemptions during ftrace_test_recursion_unlock.
Do not restore r13 from the saved register frame. If the task did not
migrate, the live r13 already has the saved value. If it migrated, the
live r13 contains the correct PACA pointer for the CPU on which the task
resumed.
On PPC32, r13 is regular register. So do this fix only for PPC64
Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
Reported-by: Michal Suchánek <msuchanek@suse.de>
Closes: https://lore.kernel.org/all/aqKfsVArHHaIK6M9@kunlun.suse.cz/
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Tested-by: Samir Mulani <samir@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260921072151.35531-1-sshegde@linux.ibm.com
[ sashal: Applied the upstream hunk to ftrace_mprofile.S instead of ftrace_entry.S, which doesn't exist on this branch; the surrounding context is otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/trace/ftrace_mprofile.S | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/kernel/trace/ftrace_mprofile.S b/arch/powerpc/kernel/trace/ftrace_mprofile.S
index f4a72b38488f7..74f7edff9eece 100644
--- a/arch/powerpc/kernel/trace/ftrace_mprofile.S
+++ b/arch/powerpc/kernel/trace/ftrace_mprofile.S
@@ -129,7 +129,13 @@
/* Restore gprs */
.if \allregs == 1
+#ifdef CONFIG_PPC64
+ REST_GPRS(2, 12, r1)
+ /* Do not restore a stale PACA pointer if the task migrated */
+ REST_GPRS(14, 31, r1)
+#else
REST_GPRS(2, 31, r1)
+#endif
.else
REST_GPRS(3, 10, r1)
#ifdef CONFIG_LIVEPATCH_64
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0301/1059] bpf: Fix uninit read for helper mem args on partially spilled slots
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (299 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0300/1059] powerpc/ftrace: Dont restore r13 during ftrace_regs_caller Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0302/1059] sysctl: unregister tables before freeing bitmap Greg Kroah-Hartman
` (697 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kumar Kartikeya Dwivedi, Hao Sun,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Sun <sunhao.th@gmail.com>
[ Upstream commit b3861495d2b2f7459cddf49e63fa0758ba430583 ]
check_stack_range_initialized() takes the spilled register path when
bpf_is_spilled_reg(ss) holds, which, however, only looks at the last
byte of the slot. Hence, a partially spilled scalar (on the lower part)
bypasses the check and the following loads:
0: (b7) r1 = 1 ; R1=1
1: (63) *(u32 *)(r10 -8) = r1 ; R1=1 R10=fp0 fp-8=????1
2: (18) r1 = 0x0 ; R1=map_ptr(map=rb,ks=0,vs=0)
4: (bf) r2 = r10 ; R2=fp0 R10=fp0
5: (07) r2 += -8 ; R2=fp-8
6: (b7) r3 = 8 ; R3=8
7: (b7) r4 = 0 ; R4=0
8: (85) call bpf_ringbuf_output#130
...
When executed, it dumps the uninit four bytes:
RINGBUF: 01 00 00 00 ff ff ff ff
This is the same root cause as the non-fetch atomic case fixed in
commit 5a84b4424db8 ("bpf: Fix uninit read for non-fetch atomics on
partially spilled slots").
Fix by only taking the spilled register path for the bytes marked
STACK_SPILL, so the rest of the slot goes through the usual checks.
Fixes: 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill")
Suggested-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Hao Sun <sunhao.th@gmail.com>
Link: https://lore.kernel.org/bpf/20260925082814.1554771-1-sunhao.th@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index ba4ae75512294..dee55d5db7da7 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5391,7 +5391,12 @@ static int check_stack_range_initialized(
goto mark;
}
- if (is_spilled_reg(&state->stack[spi]) &&
+ /*
+ * Only the bytes marked STACK_SPILL hold the spilled register.
+ * The rest of a narrowly spilled slot keeps its previous type
+ * and must be initialized on its own.
+ */
+ if (*stype == STACK_SPILL &&
(state->stack[spi].spilled_ptr.type == SCALAR_VALUE ||
env->allow_ptr_leaks)) {
if (clobber) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0302/1059] sysctl: unregister tables before freeing bitmap
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (300 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0301/1059] bpf: Fix uninit read for helper mem args on partially spilled slots Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0303/1059] ACPI: PCC: Free channel on OpRegion deactivation Greg Kroah-Hartman
` (696 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yibo Tan, Joel Granados, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yibo Tan <lhfff@tju.edu.cn>
[ Upstream commit 238dfe02fb0a9f72d7fd275d74ce80f13923ef31 ]
The table registered for bitmap_0001 retains a pointer to
test_data.bitmap_0001. unregister_sysctl_table() prevents new handlers
from starting and waits for active handlers to finish.
test_sysctl_exit() currently frees the bitmap before unregistering the
table. A concurrent read during module removal can therefore enter
proc_do_large_bitmap() while the bitmap is freed. KASAN reports a
slab-use-after-free in _find_next_bit().
Unregister all tables before freeing the bitmap so the unregister rundown
provides the required lifetime boundary.
The unmodified module reproduced the use-after-free in three KASAN runs.
With this change, three runs each completed 100 load, read and unload race
rounds without a kernel diagnostic.
Fixes: 2ea622b887e7 ("tools/testing/selftests/sysctl/sysctl.sh: add proc_do_large_bitmap() test case")
Assisted-by: LLM
Signed-off-by: Yibo Tan <lhfff@tju.edu.cn>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/test_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c
index 9a564971f539a..fea5748d116a7 100644
--- a/lib/test_sysctl.c
+++ b/lib/test_sysctl.c
@@ -178,9 +178,9 @@ module_init(test_sysctl_init);
static void __exit test_sysctl_exit(void)
{
- kfree(test_data.bitmap_0001);
if (test_sysctl_header)
unregister_sysctl_table(test_sysctl_header);
+ kfree(test_data.bitmap_0001);
}
module_exit(test_sysctl_exit);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0303/1059] ACPI: PCC: Free channel on OpRegion deactivation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (301 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0302/1059] sysctl: unregister tables before freeing bitmap Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0304/1059] arm64: dts: qcom: sdm845-lg: fix sdcard pinctrl nodes Greg Kroah-Hartman
` (695 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Huisong Li, Sudeep Holla,
Rafael J. Wysocki, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit fa9c7ee692988edddc1da74bc5257d53dd3c7130 ]
ACPICA calls the address space setup callback with
ACPI_REGION_DEACTIVATE when a PCC OperationRegion is torn down.
The PCC setup callback currently allocates a fresh pcc_data and requests
the mailbox channel before looking at the function argument. If ACPICA
deactivates a region, this can leave the existing region context and
mailbox channel unreleased, and may also request a channel during
teardown.
Handle ACPI_REGION_DEACTIVATE before allocation. Free the PCC mailbox
channel, release the region context and clear the context pointer.
Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype")
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Link: https://patch.msgid.link/20260922144302.3847593-4-sudeep.holla@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Replaced kzalloc_obj(*data) with this branch's kzalloc(sizeof(*data), GFP_KERNEL) in the context line, since the kzalloc_obj() helper is missing here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/acpi_pcc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index 683924a708ba0..04bb232603965 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -55,6 +55,19 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_mbox_chan *pcc_chan;
acpi_status ret;
+ if (function == ACPI_REGION_DEACTIVATE) {
+ data = *region_context;
+ if (data) {
+ pcc_mbox_free_channel(data->pcc_chan);
+ kfree(data);
+ *region_context = NULL;
+ }
+ return AE_OK;
+ }
+
+ if (function != ACPI_REGION_ACTIVATE)
+ return AE_BAD_PARAMETER;
+
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return AE_NO_MEMORY;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0304/1059] arm64: dts: qcom: sdm845-lg: fix sdcard pinctrl nodes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (302 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0303/1059] ACPI: PCC: Free channel on OpRegion deactivation Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0305/1059] x86/fpu: Fix potential underflow in xstate_calculate_size() Greg Kroah-Hartman
` (694 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paul Sajna, David Heidelberg,
Konrad Dybcio, Bjorn Andersson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Sajna <sajattack@postmarketos.org>
[ Upstream commit e57d572ed779eb53e7eb5b8f9546731eff21bc93 ]
sdcard was previously rather unreliable during boot on sdm845-lg-judyln
Identified and applied correct settings from downstream lineageos kernel.
Verified card was properly detected over 5 reboots with rootfs on sdcard.
Refer to downstream: https://github.com/LineageOS/android_kernel_lge_sdm845/blob/efa8458f79dffeb380d43b38b9403407f87d9f05/arch/arm64/boot/dts/qcom/sdm845-pinctrl.dtsi#L148-L303
Fixes: 28ae8aa3923c ("arm64: dts: qcom: add device tree for LG G7 and LG V35")
Signed-off-by: Paul Sajna <sajattack@postmarketos.org>
Reviewed-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260802-judyln-sdcard-fix-v1-1-b3477cfc42cc@postmarketos.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
[ sashal: Adapted the changes to the older nested pinconf/pinmux pinctrl node style in this tree instead of the flat -state style used upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
index 84a6438cedfd4..c0b38cac1b615 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
@@ -557,14 +557,6 @@ sdc2_clk: sdc2-clk {
pinconf {
pins = "sdc2_clk";
bias-disable;
-
- /*
- * It seems that mmc_test reports errors if drive
- * strength is not 16 on clk, cmd, and data pins.
- *
- * TODO: copy-pasted from mtp, try other values
- * on these devices.
- */
drive-strength = <16>;
};
};
@@ -573,7 +565,7 @@ sdc2_cmd: sdc2-cmd {
pinconf {
pins = "sdc2_cmd";
bias-pull-up;
- drive-strength = <16>;
+ drive-strength = <10>;
};
};
@@ -581,7 +573,7 @@ sdc2_data: sdc2-data {
pinconf {
pins = "sdc2_data";
bias-pull-up;
- drive-strength = <16>;
+ drive-strength = <10>;
};
};
@@ -594,6 +586,7 @@ pinmux {
pinconf {
pins = "gpio126";
bias-pull-up;
+ drive-strength = <2>;
};
};
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0305/1059] x86/fpu: Fix potential underflow in xstate_calculate_size()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (303 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0304/1059] arm64: dts: qcom: sdm845-lg: fix sdcard pinctrl nodes Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0306/1059] ARM: dts: qcom: msm8974: add MDSS reset Greg Kroah-Hartman
` (693 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrei Vagin, Borislav Petkov (AMD),
Alexander Mikhalitsyn, Chang S. Bae, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Vagin <avagin@google.com>
[ Upstream commit f1751b220bc8a9bd2dc38ecf61f5c29f3826ace0 ]
xstate_calculate_size() calculates the size required for a given set of
xfeatures. It determines the topmost feature by finding the most
significant bit in xfeatures using fls64(xfeatures) - 1.
If xfeatures is 0, fls64(0) returns 0, and topmost becomes -1.
Previously, topmost was unsigned int, so -1 underflowed to UINT_MAX.
This caused the subsequent check `topmost <= XFEATURE_SSE` to fail, and
the code proceeded to access xstate arrays using topmost (UINT_MAX) as
an index, leading to an out-of-bounds access.
[ bp: Remove text explaining what the patch does. ]
Fixes: d6d6d50f1e80 ("x86/fpu/xstate: Consolidate size calculations")
Signed-off-by: Andrei Vagin <avagin@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Reviewed-by: Chang S. Bae <chang.seok.bae@intel.com>
Link: https://patch.msgid.link/20260925162454.1403405-6-avagin@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kernel/fpu/xstate.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index d185943437453..96040a3af5e54 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -563,12 +563,14 @@ static bool __init check_xstate_against_struct(int nr)
static unsigned int xstate_calculate_size(u64 xfeatures, bool compacted)
{
- unsigned int topmost = fls64(xfeatures) - 1;
- unsigned int offset = xstate_offsets[topmost];
+ unsigned int topmost, offset;
- if (topmost <= XFEATURE_SSE)
+ if (!(xfeatures & ~XFEATURE_MASK_FPSSE))
return sizeof(struct xregs_state);
+ topmost = fls64(xfeatures) - 1;
+ offset = xstate_offsets[topmost];
+
if (compacted)
offset = xfeature_get_offset(xfeatures, topmost);
return offset + xstate_sizes[topmost];
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0306/1059] ARM: dts: qcom: msm8974: add MDSS reset
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (304 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0305/1059] x86/fpu: Fix potential underflow in xstate_calculate_size() Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0307/1059] tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit Greg Kroah-Hartman
` (692 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stephan Gerhold, Dmitry Baryshkov,
Konrad Dybcio, Bjorn Andersson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[ Upstream commit 542991a1d77e5fea5263c2406773a0cd09a8ec48 ]
Commit 13a4b7fb6260 ("pmdomain: core: Leave powered-on genpds on until
late_initcall_sync") kept power-domains on longer during boot which is
causing DSI clock to get stuck and fail to acquire its configuration on
DSI bringup. Follow the example of other platforms and add MDSS reset to
the display subsystem node, fixing DSI issues.
Fixes: 5a9fc531f6ec ("ARM: dts: msm8974: add display support")
Suggested-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260810-msm8974-mmcc-fix-v2-1-5c787d79c0fa@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
[ sashal: Kept this tree's existing include list and appended the new mmcc reset include after it, with the file at its older non-qcom/ path and the mdss@ node name. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/boot/dts/qcom-msm8974.dtsi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 5ea45e486ed54..0f116dcbe3205 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -8,6 +8,7 @@
#include <dt-bindings/clock/qcom,rpmcc.h>
#include <dt-bindings/reset/qcom,gcc-msm8974.h>
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/reset/qcom,mmcc-msm8974.h>
/ {
#address-cells = <1>;
@@ -1508,6 +1509,8 @@ mdss: mdss@fd900000 {
interrupt-controller;
#interrupt-cells = <1>;
+ resets = <&mmcc MDSS_RESET>;
+
status = "disabled";
#address-cells = <1>;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0307/1059] tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (305 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0306/1059] ARM: dts: qcom: msm8974: add MDSS reset Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0308/1059] bitmap: bitmap_parse(): reject non-hex character before 8 digits Greg Kroah-Hartman
` (691 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Danish Khateeb,
Thomas Weißschuh, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <danishkhateeb03@gmail.com>
[ Upstream commit 929ea5b3481fdbbb419f3986703280fb2b819504 ]
Since commit feaf75658783 ("nolibc: fix fd_set type"), an fd_set is an
array of unsigned long, but the FD_* macros still build their masks as
an int or an unsigned int: 1 << n in FD_SET(), 1U << n in FD_CLR() and
FD_ISSET(), where n is the fd modulo 64 on 64-bit architectures. So:
- FD_SET() of an fd with n == 31 sets the bits for n = 31-63, as
1 << 31 is negative and gets sign-extended.
- For n >= 32 the shifts are undefined. x86-64, for instance, masks
the shift count, so FD_SET(40) and FD_ISSET(40) use the bit of fd 8.
- FD_CLR() zero-extends ~(1U << n), so it also clears the bits for
n = 32-63, whichever fd it is given.
select() on fd 40, for instance, fails with EBADF, or watches fd 8
instead if that one is open.
Build the masks from 1UL.
Fixes: feaf75658783 ("nolibc: fix fd_set type")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Link: https://patch.msgid.link/20260925211600.119116-3-danishkhateeb03@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
[ sashal: Applied the three FD_* mask fixes to tools/include/nolibc/types.h, since the sys/select.h header doesn't exist on this branch. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/include/nolibc/types.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index a6f3af0509eb7..a7d29ae5df725 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -102,7 +102,7 @@ typedef struct {
int __fd = (fd); \
if (__fd >= 0) \
__set->fds[__fd / FD_SETIDXMASK] &= \
- ~(1U << (__fd & FD_SETBITMASK)); \
+ ~(1UL << (__fd & FD_SETBITMASK)); \
} while (0)
#define FD_SET(fd, set) do { \
@@ -110,7 +110,7 @@ typedef struct {
int __fd = (fd); \
if (__fd >= 0) \
__set->fds[__fd / FD_SETIDXMASK] |= \
- 1 << (__fd & FD_SETBITMASK); \
+ 1UL << (__fd & FD_SETBITMASK); \
} while (0)
#define FD_ISSET(fd, set) ({ \
@@ -119,7 +119,7 @@ typedef struct {
int __r = 0; \
if (__fd >= 0) \
__r = !!(__set->fds[__fd / FD_SETIDXMASK] & \
-1U << (__fd & FD_SETBITMASK)); \
+1UL << (__fd & FD_SETBITMASK)); \
__r; \
})
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0308/1059] bitmap: bitmap_parse(): reject non-hex character before 8 digits
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (306 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0307/1059] tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0309/1059] bitmap: bitmap_parselist(): reject trailing characters after group size Greg Kroah-Hartman
` (690 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain, Yury Norov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
[ Upstream commit 7cee2fb210a198667d3d4200705215e6f315cab0 ]
bitmap_parse() is documented to return -EINVAL for illegal characters,
and it does so everywhere except when the illegal character directly
precedes a chunk of exactly eight hex digits.
bitmap_get_x32_reverse() parses a chunk from right to left. After it
has consumed eight digits it looks at one more character: a hex digit
means the chunk is wider than 32 bits and -EOVERFLOW is returned. Any
other character is silently consumed as if it were a separator, and the
remaining input is parsed as the next chunk. As a result:
"x12345678" -> 0x12345678, returns 0 (expected -EINVAL)
"1g12345678" -> 0x1_12345678, returns 0 (expected -EINVAL)
"0x0000000f" -> 0xf, returns 0, while "0xf" returns -EINVAL
bitmap_parse() backs cpumask_parse() and cpumask_parse_user(), so the
same inconsistency is visible when writing masks such as
/proc/irq/*/smp_affinity or the network queue rps_cpus/xps_cpus files.
__bitmap_parse(), which this function replaced in commit 2d6261583be0
("lib: rework bitmap_parse()"), rejected all three strings with -EINVAL,
and a "0x" prefix is accepted today only when exactly eight digits
follow it, so no reliably working input is lost.
When the loop falls through, *end is known to be a non-separator
character inside the buffer, so return -EOVERFLOW if it is a hex digit
and -EINVAL otherwise.
Fixes: 2d6261583be0 ("lib: rework bitmap_parse()")
Assisted-by: LLM
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
[ sashal: Applied the hunk unchanged to lib/bitmap.c because the bitmap string-parsing function has not yet been split out into lib/bitmap-str.c here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/bitmap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index ddb31015e38ae..d3184db294e68 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -880,8 +880,12 @@ static const char *bitmap_get_x32_reverse(const char *start,
goto out;
}
- if (hex_to_bin(*end--) >= 0)
- return ERR_PTR(-EOVERFLOW);
+ /*
+ * Eight digits have been consumed and the next character is not a
+ * separator: another hex digit means the chunk does not fit in 32
+ * bits, anything else is an illegal character.
+ */
+ return ERR_PTR(hex_to_bin(*end) >= 0 ? -EOVERFLOW : -EINVAL);
out:
*num = ret;
return end;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0309/1059] bitmap: bitmap_parselist(): reject trailing characters after group size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (307 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0308/1059] bitmap: bitmap_parse(): reject non-hex character before 8 digits Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0310/1059] bitmap: bitmap_parselist(): dont wrap around on a huge " Greg Kroah-Hartman
` (689 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain, Yury Norov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
[ Upstream commit c55d102257fa31271c6f11fea595b78c48fd7aa2 ]
bitmap_parse_region() checks that every region ends at a separator
(',', whitespace, '\n' or '\0'), except in the "range:used/group" form:
after parsing the group size it returns the pointer to the following
character without looking at it. The caller then starts a new region
at that character.
Before 'N' and 'all' were accepted as region starts this happened to be
harmless, because any other character would fail to parse as a new
region. Now text directly following the group size is silently parsed
as another region:
"0-7:1/2N" -> bits 0,2,4,6,7 (nbits = 8), returns 0
"0-7:1/2all" -> all bits set, returns 0
while "0-7N", "5N" or "0-7:1/2x" are correctly rejected with -EINVAL.
bitmap_parselist() is documented to return -EINVAL for an invalid
character. It parses cpu lists from sysfs, cgroup cpuset files and
boot parameters such as isolcpus= and nohz_full=, so a typo there is
accepted and yields a different mask than intended.
Check for the end of the region after the group size as well, like the
other forms do.
Fixes: 2c4885d24e64 ("lib: bitmap: support "N" as an alias for size of bitmap")
Assisted-by: LLM
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
[ sashal: Applied the same hunk to bitmap_parse_region() in lib/bitmap.c, since the string-parsing code had not yet been split out into lib/bitmap-str.c. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/bitmap.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index d3184db294e68..9b41b17c96d32 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -765,7 +765,14 @@ static const char *bitmap_parse_region(const char *str, struct region *r)
if (*str != '/')
return ERR_PTR(-EINVAL);
- return bitmap_getnum(str + 1, &r->group_len, lastbit);
+ str = bitmap_getnum(str + 1, &r->group_len, lastbit);
+ if (IS_ERR(str))
+ return str;
+
+ if (!end_of_region(*str))
+ return ERR_PTR(-EINVAL);
+
+ return end_of_str(*str) ? NULL : str;
no_end:
r->end = r->start;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0310/1059] bitmap: bitmap_parselist(): dont wrap around on a huge group size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (308 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0309/1059] bitmap: bitmap_parselist(): reject trailing characters after group size Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0311/1059] netfilter: nfnetlink: Fix for interrupted hook dumps Greg Kroah-Hartman
` (688 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain, Yury Norov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
[ Upstream commit d075c4dc0b3c8ed91a4f67ebdf3384aa59fd4fbb ]
In the "range:used/group" form bitmap_set_region() walks the range with
for (start = r->start; start <= r->end; start += r->group_len)
where all values are unsigned int. bitmap_getnum() accepts any group
size up to UINT_MAX, and bitmap_check_region() only requires it to be
non-zero and at least the used size. If start + group_len exceeds
UINT_MAX, start wraps around to a small value that is still <= end, and
bits below the start of the range get set:
"1-1:1/4294967295" -> bits 0,1 (expected bit 1)
"15-15:1/4294967281" -> bits 0,15 (expected bit 15)
The loop still terminates, because start keeps decreasing until it
wraps past zero again, but the resulting mask contains bits outside
the requested range.
This needs a group size within 'start' of UINT_MAX, so it is unlikely
to be hit by accident; all bits set stay below the end of the range,
so there is no out-of-bounds write.
A group larger than the range simply means that the range contains a
single group, so stop the walk when the next group would start beyond
UINT_MAX.
Fixes: 0a5ce0831d04 ("lib/bitmap.c: make bitmap_parselist() thread-safe and much faster")
Assisted-by: LLM
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
[ sashal: Applied the change to lib/bitmap.c instead of lib/bitmap-str.c, which doesn't exist in this tree, and added #include <linux/overflow.h> there. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/bitmap.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 9b41b17c96d32..96641893c9e1d 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -13,6 +13,7 @@
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/overflow.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/thread_info.h>
@@ -652,10 +653,12 @@ struct region {
static void bitmap_set_region(const struct region *r, unsigned long *bitmap)
{
- unsigned int start;
+ unsigned int start = r->start;
- for (start = r->start; start <= r->end; start += r->group_len)
+ do {
bitmap_set(bitmap, start, min(r->end - start + 1, r->off));
+ } while (!check_add_overflow(start, r->group_len, &start) &&
+ start <= r->end);
}
static int bitmap_check_region(const struct region *r)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0311/1059] netfilter: nfnetlink: Fix for interrupted hook dumps
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (309 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0310/1059] bitmap: bitmap_parselist(): dont wrap around on a huge " Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0312/1059] RDMA/mlx5: Set QP event handler before firmware QPC insertion Greg Kroah-Hartman
` (687 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Phil Sutter, Pablo Neira Ayuso,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <phil@nwl.cc>
[ Upstream commit d3950004ba90350bcdf414c5f804da277178564a ]
Handling of concurrent hook changes with a dump in progress was
problematic in nfnl_hook_dump and entirely broken in nfnl_hook_dump_nat.
Address all issues in a single patch to please the review LLM.
Introduce sequence numbers in struct netns_nf to replace pointer
value-based modification detection which may fail due to memory buffer
reuse. This also eliminates the need for most manual cb->seq updates and
excessive array index value checks.
Since nat hook updates are protected by a different mutex than others,
they have to bump their own sequence number. nfnl_hook_dump_nat
therefore open-codes what nl_dump_check_consistent does but bumps
cb->seq instead of setting NLM_F_DUMP_INTR flag.
Dumps of many nat hooks was entirely broken since the array index was
not (re)stored. Use cb->args[1] for that and make sure it is reset upon
completion as the same dump may loop over multiple arrays of nat hooks.
In nfnl_hook_dump, don't signal NLM_F_DUMP_INTR if
nfnl_hook_entries_head returns error: This is a permanent condition
which does not change during a dump. It is already caught by
nfnl_hook_dump_start though, so should not happen anyway.
In general, access ops array pointer values using READ_ONCE since they
are assigned to using WRITE_ONCE.
Avoid setting NLM_F_DUMP_INTR flag in garbage memory by calling
nl_dump_check_consistent only for non-empty skbs. If not a single
netlink message was created, nfnetlink code will take care of setting
the flag.
Fixes: e2cf17d3774c ("netfilter: add new hook nfnl subsystem")
Fixes: b010e2a4a9ac ("netfilter: nfnetlink_hook: Dump nat type chains")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/netns/netfilter.h | 1 +
net/netfilter/core.c | 17 ++++++++++++++++-
net/netfilter/nfnetlink_hook.c | 19 +++++--------------
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h
index 02bbdc577f8e2..a3dc9871de7b4 100644
--- a/include/net/netns/netfilter.h
+++ b/include/net/netns/netfilter.h
@@ -30,5 +30,6 @@ struct netns_nf {
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
unsigned int defrag_ipv6_users;
#endif
+ unsigned int hook_base_seq;
};
#endif
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 50490bae3623e..028e62d17482d 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -381,6 +381,15 @@ static void nf_static_key_dec(const struct nf_hook_ops *reg, int pf)
#endif
}
+static void bump_hook_base_seq(struct net *net)
+{
+ unsigned int base_seq = READ_ONCE(net->nf.hook_base_seq);
+
+ while (++base_seq == 0)
+ ;
+ smp_store_release(&net->nf.hook_base_seq, base_seq);
+}
+
static int __nf_register_net_hook(struct net *net, int pf,
const struct nf_hook_ops *reg)
{
@@ -425,6 +434,7 @@ static int __nf_register_net_hook(struct net *net, int pf,
if (!IS_ERR(new_hooks)) {
hooks_validate(new_hooks);
rcu_assign_pointer(*pp, new_hooks);
+ bump_hook_base_seq(net);
}
mutex_unlock(&nf_hook_mutex);
@@ -478,6 +488,7 @@ static void __nf_unregister_net_hook(struct net *net, int pf,
{
struct nf_hook_entries __rcu **pp;
struct nf_hook_entries *p;
+ bool found;
pp = nf_hook_entry_head(net, pf, reg->hooknum, reg->dev);
if (!pp)
@@ -491,7 +502,8 @@ static void __nf_unregister_net_hook(struct net *net, int pf,
return;
}
- if (nf_remove_net_hook(p, reg)) {
+ found = nf_remove_net_hook(p, reg);
+ if (found) {
#ifdef CONFIG_NETFILTER_INGRESS
if (nf_ingress_hook(reg, pf))
net_dec_ingress_queue();
@@ -506,6 +518,8 @@ static void __nf_unregister_net_hook(struct net *net, int pf,
}
p = __nf_hook_entries_try_shrink(p, pp);
+ if (found)
+ bump_hook_base_seq(net);
mutex_unlock(&nf_hook_mutex);
if (!p)
return;
@@ -775,6 +789,7 @@ static int __net_init netfilter_net_init(struct net *net)
return -ENOMEM;
}
#endif
+ net->nf.hook_base_seq = 1;
return 0;
}
diff --git a/net/netfilter/nfnetlink_hook.c b/net/netfilter/nfnetlink_hook.c
index 8120aadf6a0fe..ad17b39639402 100644
--- a/net/netfilter/nfnetlink_hook.c
+++ b/net/netfilter/nfnetlink_hook.c
@@ -53,7 +53,6 @@ static int nf_netlink_dump_start_rcu(struct sock *nlsk, struct sk_buff *skb,
struct nfnl_dump_hook_data {
char devname[IFNAMSIZ];
- unsigned long headv;
u8 hook;
};
@@ -256,30 +255,24 @@ static int nfnl_hook_dump(struct sk_buff *nlskb,
unsigned int i = cb->args[0];
rcu_read_lock();
+ cb->seq = smp_load_acquire(&net->nf.hook_base_seq);
e = nfnl_hook_entries_head(family, ctx->hook, net, ctx->devname);
- if (!e)
+ if (!e || IS_ERR(e))
goto done;
- if (IS_ERR(e)) {
- cb->seq++;
- goto done;
- }
-
- if ((unsigned long)e != ctx->headv || i >= e->num_hook_entries)
- cb->seq++;
-
ops = nf_hook_entries_get_hook_ops(e);
for (; i < e->num_hook_entries; i++) {
- err = nfnl_hook_dump_one(nlskb, ctx, ops[i], family,
+ err = nfnl_hook_dump_one(nlskb, ctx, READ_ONCE(ops[i]), family,
cb->nlh->nlmsg_seq);
if (err)
break;
}
done:
- nl_dump_check_consistent(cb, nlmsg_hdr(nlskb));
+ if (nlskb->len > 0)
+ nl_dump_check_consistent(cb, nlmsg_hdr(nlskb));
rcu_read_unlock();
cb->args[0] = i;
return nlskb->len;
@@ -320,10 +313,8 @@ static int nfnl_hook_dump_start(struct netlink_callback *cb)
return -ENOMEM;
strscpy(ctx->devname, name, sizeof(ctx->devname));
- ctx->headv = (unsigned long)head;
ctx->hook = hooknum;
- cb->seq = 1;
cb->data = ctx;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0312/1059] RDMA/mlx5: Set QP event handler before firmware QPC insertion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (310 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0311/1059] netfilter: nfnetlink: Fix for interrupted hook dumps Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0313/1059] ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers Greg Kroah-Hartman
` (686 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yishai Hadas, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <yishaih@nvidia.com>
[ Upstream commit 05a078c97eb0bb7158526dae414b853737692485 ]
Four QP creation paths assigned base->container_mibqp and
base->mqp.event after the firmware create call that inserts the QP into
dev->qp_table.tree. A firmware error EQE in that window reaches
qp->event() with a NULL pointer.
Move both assignments before the firmware call.
Also set ibqp.qp_num inside mlx5_qpc_create_qp() before
create_resource_common() so an EQE arriving early does not observe
qp_num==0.
In addition, add a WARN_ON_ONCE(!qp->event) guard in
rsc_event_notifier() as a safeguard for future regressions.
Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/20260915140933.40580-14-yishaih@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Dropped the upstream attrs argument and the go_back_n retry-mode context lines, which this tree lacks, while keeping the same early handler and qp_num assignments. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx5/qp.c | 22 ++++++++++------------
drivers/infiniband/hw/mlx5/qpc.c | 10 ++++++++++
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 37cedcdc63360..86674bf1175eb 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1555,6 +1555,8 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
if (err)
return err;
+ sq->base.container_mibqp = qp;
+ sq->base.mqp.event = mlx5_ib_qp_event;
err = create_raw_packet_qp_sq(dev, udata, sq, in, pd,
to_mcq(init_attr->send_cq));
if (err)
@@ -1566,9 +1568,6 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
resp->sqn = sq->base.mqp.qpn;
resp->comp_mask |= MLX5_IB_CREATE_QP_RESP_MASK_SQN;
}
-
- sq->base.container_mibqp = qp;
- sq->base.mqp.event = mlx5_ib_qp_event;
}
if (qp->rq.wqe_cnt) {
@@ -2014,13 +2013,13 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
}
base = &qp->trans_qp.base;
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
return err;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2158,14 +2157,14 @@ static int create_dci(struct mlx5_ib_dev *dev, struct ib_pd *pd,
qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING;
}
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2354,6 +2353,8 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING;
}
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
if (init_attr->qp_type == IB_QPT_RAW_PACKET ||
qp->flags & IB_QP_CREATE_SOURCE_QPN) {
qp->raw_packet_qp.sq.ubuffer.buf_addr = ucmd->sq_buf_addr;
@@ -2367,8 +2368,6 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2493,14 +2492,13 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
if (qp->flags & IB_QP_CREATE_IPOIB_UD_LSO)
MLX5_SET(qpc, qpc, ulp_stateless_offload_mode, 1);
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
-
get_cqs(qp->type, attr->send_cq, attr->recv_cq,
&send_cq, &recv_cq);
spin_lock_irqsave(&dev->reset_flow_resource_lock, flags);
diff --git a/drivers/infiniband/hw/mlx5/qpc.c b/drivers/infiniband/hw/mlx5/qpc.c
index 4617eeb8ecffb..48923bfa78d20 100644
--- a/drivers/infiniband/hw/mlx5/qpc.c
+++ b/drivers/infiniband/hw/mlx5/qpc.c
@@ -136,6 +136,8 @@ static int rsc_event_notifier(struct notifier_block *nb,
case MLX5_RES_RQ:
case MLX5_RES_SQ:
qp = (struct mlx5_core_qp *)common;
+ if (WARN_ON_ONCE(!qp->event))
+ goto out;
qp->event(qp, event_type);
/* Need to put resource in event handler */
return NOTIFY_OK;
@@ -266,6 +268,14 @@ int mlx5_qpc_create_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
qp->uid = MLX5_GET(create_qp_in, in, uid);
qp->qpn = MLX5_GET(create_qp_out, out, qpn);
+ /* Set ibqp.qp_num before create_resource_common() inserts the QP into
+ * the radix tree and makes it visible to EQE processing. The
+ * assignment in create_qp() happens only after this function returns,
+ * leaving a window where an arriving EQE would observe qp_num == 0.
+ * create_qp() still overrides this with 0/1 for QP0/QP1, and sets it
+ * independently for DCT (which does not go through this function).
+ */
+ to_mibqp(qp)->ibqp.qp_num = qp->qpn;
err = create_resource_common(dev, qp, MLX5_RES_QP);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0313/1059] ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (311 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0312/1059] RDMA/mlx5: Set QP event handler before firmware QPC insertion Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0314/1059] perf test code-reading: Fix duplicate kernel maps and machine leak Greg Kroah-Hartman
` (685 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, bui duc phuc, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <phucduc.bui@gmail.com>
[ Upstream commit 49aeb628d10ef3d5694c39b7a3427d34bde06bb2 ]
Currently, DAPM event handlers in mt8192-dai-i2s.c ignore return values
from mt8192_afe_gpio_request(), mt8192_apll1_enable(),
mt8192_apll2_enable(), and mt8192_mck_enable(). If GPIO configuration or
clock setup fails during DAPM events, the error is silently ignored.
Fix this by checking and propagating error codes properly in all I2S DAI
DAPM event handlers.
Fixes: 2c37b4ed730b ("ASoC: mediatek: mt8192: support i2s in platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260918133912.133799-15-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Kept the tree's strcmp(w->name, APLL1_W_NAME) condition in mtk_apll_event() instead of upstream's snd_soc_dapm_widget_name_cmp() helper, which isn't available here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/mediatek/mt8192/mt8192-dai-i2s.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
index ea516d63d94dd..6cb9c193a1522 100644
--- a/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
+++ b/sound/soc/mediatek/mt8192/mt8192-dai-i2s.c
@@ -586,6 +586,7 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mtk_afe_i2s_priv *i2s_priv;
+ int ret;
i2s_priv = get_i2s_priv_by_name(afe, w->name);
@@ -599,16 +600,17 @@ static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- mt8192_afe_gpio_request(afe->dev, true, i2s_priv->id, 0);
+ ret = mt8192_afe_gpio_request(afe->dev, true, i2s_priv->id, 0);
break;
case SND_SOC_DAPM_POST_PMD:
- mt8192_afe_gpio_request(afe->dev, false, i2s_priv->id, 0);
+ ret = mt8192_afe_gpio_request(afe->dev, false, i2s_priv->id, 0);
break;
default:
+ ret = 0;
break;
}
- return 0;
+ return ret;
}
static int mtk_apll_event(struct snd_soc_dapm_widget *w,
@@ -617,6 +619,7 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
{
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
+ int ret;
dev_dbg(cmpnt->dev, "%s(), name %s, event 0x%x\n",
__func__, w->name, event);
@@ -624,9 +627,11 @@ static int mtk_apll_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
if (strcmp(w->name, APLL1_W_NAME) == 0)
- mt8192_apll1_enable(afe);
+ ret = mt8192_apll1_enable(afe);
else
- mt8192_apll2_enable(afe);
+ ret = mt8192_apll2_enable(afe);
+ if (ret)
+ return ret;
break;
case SND_SOC_DAPM_POST_PMD:
if (strcmp(w->name, APLL1_W_NAME) == 0)
@@ -704,6 +709,7 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt);
struct mtk_afe_i2s_priv *i2s_priv;
+ int ret;
dev_dbg(cmpnt->dev, "%s(), name %s, event 0x%x\n",
__func__, w->name, event);
@@ -716,7 +722,9 @@ static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- mt8192_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate);
+ ret = mt8192_mck_enable(afe, i2s_priv->mclk_id, i2s_priv->mclk_rate);
+ if (ret)
+ return ret;
break;
case SND_SOC_DAPM_POST_PMD:
i2s_priv->mclk_rate = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0314/1059] perf test code-reading: Fix duplicate kernel maps and machine leak
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (312 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0313/1059] ASoC: mediatek: mt8192: Propagate errors in I2S DAI DAPM event handlers Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0315/1059] perf build: Clean libperf-gtk.so in make clean Greg Kroah-Hartman
` (684 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Arnaldo Carvalho de Melo,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 58bf7b7af359d4c6f1af29fd8d2067bbcff1d8c7 ]
In do_test_code_reading(), machine__new_host(&host_env) already calls
machine__create_kernel_maps(machine). Calling
machine__create_kernel_maps(machine) a second time immediately
afterwards duplicates all kernel module maps in machine->kmaps, causing
dso__load_kcore()'s module validation (do_validate_kcore_modules()) to
fail and fall back to /proc/kallsyms.
Furthermore, when try_kcore is true and !have_kcore, returning
TEST_CODE_READING_NO_KCORE directly bypasses out_err, leaking the entire
struct machine, its kernel/module maps and DSOs, all kallsyms symbols,
and host_env.
Remove the redundant machine__create_kernel_maps() call, check for
!machine after machine__new_host(), and jump to out_err when returning
TEST_CODE_READING_NO_KCORE.
Fixes: 0fd4008ed755c52d ("perf test: Use machine__new_host in mmap thread code reading test")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Dropped the host_env/perf_env__init parts that don't exist here, and on machine__new_host() failure used "return err" instead of "goto out_err" to avoid a NULL dereference in cleanup. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/tests/code-reading.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 95feb6ef34a0a..b357abe6d7237 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -569,13 +569,11 @@ static int do_test_code_reading(bool try_kcore)
pid = getpid();
machine = machine__new_host();
- machine->env = &perf_env;
-
- ret = machine__create_kernel_maps(machine);
- if (ret < 0) {
- pr_debug("machine__create_kernel_maps failed\n");
- goto out_err;
+ if (!machine) {
+ pr_debug("machine__new_host failed\n");
+ return err;
}
+ machine->env = &perf_env;
/* Force the use of kallsyms instead of vmlinux to try kcore */
if (try_kcore)
@@ -592,8 +590,10 @@ static int do_test_code_reading(bool try_kcore)
have_kcore = dso__is_kcore(map->dso);
/* 2nd time through we just try kcore */
- if (try_kcore && !have_kcore)
- return TEST_CODE_READING_NO_KCORE;
+ if (try_kcore && !have_kcore) {
+ err = TEST_CODE_READING_NO_KCORE;
+ goto out_err;
+ }
/* No point getting kernel events if there is no kernel object */
if (!have_vmlinux && !have_kcore)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0315/1059] perf build: Clean libperf-gtk.so in make clean
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (313 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0314/1059] perf test code-reading: Fix duplicate kernel maps and machine leak Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0316/1059] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Greg Kroah-Hartman
` (683 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Arnaldo Carvalho de Melo,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit fb0da4af899ab1d6a66d29b21189bda3c68c2ce0 ]
When GTK support was made opt-in (first via GTK2=1 and recently ported
to GTK4=1), $(OUTPUT)libperf-gtk.so is only added to ALL_PROGRAMS when
GTK4 is defined. As a result, running 'make clean' without GTK4=1 does
not remove $(OUTPUT)libperf-gtk.so.
Add $(OUTPUT)libperf-gtk.so explicitly to the core-progs clean list so
it is always removed by 'make clean'.
Fixes: 4751bddd3f983af2 ("perf tools: Make GTK2 support opt-in")
Closes: https://lore.kernel.org/linux-perf-users/CAP-5=fV6+mzN3Lf_mCAJ4aP42JFZsF55ekvt8XrX505xOWwrmA@mail.gmail.com/
Reported-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: kept the single-line core-progs clean rule and appended $(OUTPUT)libperf-gtk.so, since the context line is not split with a backslash continuation here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a432e59afc42a..b1264be032d45 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1093,7 +1093,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
$(Q)$(RM) $(OUTPUT).config-detected
- $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so
+ $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so $(OUTPUT)libperf-gtk.so
$(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0316/1059] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (314 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0315/1059] perf build: Clean libperf-gtk.so in make clean Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0317/1059] RDMA/mlx4: Do not allow the user to write to the clock page Greg Kroah-Hartman
` (682 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Venkat Rao Bagalkote,
Mukesh Kumar Chaurasiya, Shrikanth Hegde, Madhavan Srinivasan,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
[ Upstream commit 644ffb02746690c0ebfe143e066f81c9bde2975e ]
radix_enabled() uses a jump label which is only valid after
setup_feature_keys() is called. Before that point, on a pSeries
hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in
cur_cpu_spec->mmu_features, but the jump label has not yet been patched,
so radix_enabled() incorrectly returns true.
The dangerous usage window where it goes wrong in early_setup():
early_setup:
configure_exceptions();
<exceptions can happen now, and handler enter/exit can be invoked>
<those could use radix_enabled(), which returns stale true>
setup_feature_keys();
<jump labels set up; post this it is safe to use radix_enabled()>
If an NMI occurs in this window, !radix_enabled() evaluates to false in
DEFINE_INTERRUPT_HANDLER_NMI. The handler fails to skip NMI entry in real
mode and attempts to access memory outside the Real Mode Area (RMA),
hanging the boot.
Since common interrupt wrappers do not have the context of early or late,
using early_radix_enabled() is the safer option. It does a plain bitmask
check against cur_cpu_spec->mmu_features and is correct at all times.
Console logs from a pSeries HASH guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=0 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!)
[ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=0 radix_enabled=1
[ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=0 radix_enabled=0 (should now match!)
[ 0.057124] DEBUG: post secondary CPU bringup: early_radix_enabled=0 radix_enabled=0 (should match!)
Console logs from a RADIX guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=1 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!)
[ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=1 radix_enabled=1
[ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=1 radix_enabled=1 (should now match!)
[ 0.057016] DEBUG: post secondary CPU bringup: early_radix_enabled=1 radix_enabled=1 (should match!)
Add the missing #include <asm/mmu.h> in alphabetical order since
early_radix_enabled() is declared there.
Fixes: 8d0e21012743 ("powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash")
Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Reviewed-by: Mukesh Kumar Chaurasiya <mkchauras@gmail.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260909123240.58786-1-venkat88@linux.ibm.com
[ sashal: Applied the same !radix_enabled() to !early_radix_enabled() change in the inline functions interrupt_nmi_enter_prepare() and interrupt_nmi_exit_prepare(), since the DEFINE_INTERRUPT_HANDLER_NMI macro lacks the guard here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/include/asm/interrupt.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
index 4999de47b4a38..b2517538bcaea 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -72,6 +72,7 @@
#include <asm/firmware.h>
#include <asm/ftrace.h>
#include <asm/kprobes.h>
+#include <asm/mmu.h>
#include <asm/runlatch.h>
#ifdef CONFIG_PPC64
@@ -345,7 +346,7 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte
*/
if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
firmware_has_feature(FW_FEATURE_LPAR) &&
- !radix_enabled())
+ !early_radix_enabled())
return;
/*
@@ -374,7 +375,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter
nmi_exit();
} else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
firmware_has_feature(FW_FEATURE_LPAR) &&
- !radix_enabled()) {
+ !early_radix_enabled()) {
// no nmi_exit for a pseries hash guest taking a real mode exception
} else if (IS_ENABLED(CONFIG_KASAN)) {
// no nmi_exit for KASAN in real mode
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0317/1059] RDMA/mlx4: Do not allow the user to write to the clock page
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (315 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0316/1059] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0318/1059] vfio/platform: prevent read-only region mappings from becoming writable Greg Kroah-Hartman
` (681 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
[ Upstream commit 33db1d9683b8fb00bc233d0bea093e694ed9afc5 ]
mlx4_ib_mmap() maps the internal clock page to userspace through
rdma_user_mmap_io(), which does not restrict write access. Userspace can
request PROT_WRITE directly, or upgrade a read-only mapping later with
mprotect() because VM_MAYWRITE remains set.
Reject VM_WRITE, VM_EXEC and clear VM_MAYWRITE, applying the same read-only
policy as commit c660133c339f ("RDMA/mlx5: Do not allow the user to write to the
clock page"). The rdma-core mlx4 provider requests this mapping with
PROT_READ, so its existing behavior is unchanged.
Fixes: 52033cfb5aab ("IB/mlx4: Add mmap call to map the hardware clock")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Link: https://patch.msgid.link/20260926111150.3197004-1-yaojiale02@163.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Replaced the missing vm_flags_clear(vma, VM_MAYWRITE) helper with the open-coded vma->vm_flags &= ~VM_MAYWRITE. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx4/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 0f0b130cc8aac..cc0a8b71add4a 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1171,6 +1171,10 @@ static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
struct mlx4_clock_params params;
int ret;
+ if (vma->vm_flags & (VM_WRITE | VM_EXEC))
+ return -EPERM;
+ vma->vm_flags &= ~VM_MAYWRITE;
+
ret = mlx4_get_internal_clock_params(dev->dev, ¶ms);
if (ret)
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0318/1059] vfio/platform: prevent read-only region mappings from becoming writable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (316 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0317/1059] RDMA/mlx4: Do not allow the user to write to the clock page Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0319/1059] vfio/fsl-mc: " Greg Kroah-Hartman
` (680 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mostafa Saleh, Eric Auger,
Pranjal Shrivastava, Abdifatah Suruur, Alex Williamson,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <suruurism@gmail.com>
[ Upstream commit 420bed9131dbbe37abe9d6b32af51219875811e0 ]
vfio_platform_mmap() rejects writable mappings of regions without the
WRITE flag, but leaves VM_MAYWRITE set. Userspace can map such a region
read-only and then upgrade the mapping to writable with mprotect().
Clear VM_MAYWRITE for regions without the WRITE flag, as i915 does for
its read-only objects and as fixed in drm/vc4 (CVE-2026-68445),
drm/panthor (CVE-2024-53071) and commit a5edadbae57e ("ptp: vmclock:
prevent read-only mappings from becoming writable").
Note this is defensive hardening: no in-tree platform driver currently
publishes a region without the WRITE flag. The guard costs nothing and
keeps the mmap() interface honest if a read-only region ever appears.
Fixes: fad4d5b1f042 ("vfio/platform: support MMAP of MMIO regions")
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
Link: https://lore.kernel.org/r/20260929094848.7439-2-suruurism@gmail.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
[ sashal: Replaced the vm_flags_clear(vma, VM_MAYWRITE) call with the open-coded vma->vm_flags &= ~VM_MAYWRITE; because the helper doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vfio/platform/vfio_platform_common.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index 1820ed0f9e010..0f0f8fdef896e 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -608,9 +608,13 @@ int vfio_platform_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma
&& (vma->vm_flags & VM_READ))
return -EINVAL;
- if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)
- && (vma->vm_flags & VM_WRITE))
- return -EINVAL;
+ /* Prevent read-only region mappings from being upgraded with mprotect() */
+ if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) {
+ if (vma->vm_flags & VM_WRITE)
+ return -EINVAL;
+
+ vma->vm_flags &= ~VM_MAYWRITE;
+ }
vma->vm_private_data = vdev;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0319/1059] vfio/fsl-mc: prevent read-only region mappings from becoming writable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (317 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0318/1059] vfio/platform: prevent read-only region mappings from becoming writable Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0320/1059] ALSA: usb-audio: Fix UAC2 mixer unit request handling Greg Kroah-Hartman
` (679 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ioana Ciornei, Abdifatah Suruur,
Alex Williamson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdifatah Suruur <suruurism@gmail.com>
[ Upstream commit 25fd8b27ee8d4f59cc2ad99cf67aef4570b82096 ]
vfio_fsl_mc_mmap() rejects writable mappings of regions without the
WRITE flag, but leaves VM_MAYWRITE set. Userspace can map such a region
read-only and then upgrade the mapping to writable with mprotect().
Clear VM_MAYWRITE for regions without the WRITE flag, as i915 does for
its read-only objects and as fixed in drm/vc4 (CVE-2026-68445),
drm/panthor (CVE-2024-53071) and commit a5edadbae57e ("ptp: vmclock:
prevent read-only mappings from becoming writable").
Note this is defensive hardening: the fsl-mc bus publishes all device
regions with the WRITE flag set, so no device can currently reach the
read-only path. The guard costs nothing and keeps the mmap() interface
honest if a read-only region ever appears.
Fixes: 67247289688d4 ("vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions")
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
Link: https://lore.kernel.org/r/20260929094848.7439-3-suruurism@gmail.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
[ sashal: Replaced the vm_flags_clear(vma, VM_MAYWRITE) call with the open-coded vma->vm_flags &= ~VM_MAYWRITE; because the helper doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vfio/fsl-mc/vfio_fsl_mc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
index b16874e913e4f..cc3de911adafc 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
@@ -409,9 +409,13 @@ static int vfio_fsl_mc_mmap(struct vfio_device *core_vdev,
&& (vma->vm_flags & VM_READ))
return -EINVAL;
- if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)
- && (vma->vm_flags & VM_WRITE))
- return -EINVAL;
+ /* Prevent read-only region mappings from being upgraded with mprotect() */
+ if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) {
+ if (vma->vm_flags & VM_WRITE)
+ return -EINVAL;
+
+ vma->vm_flags &= ~VM_MAYWRITE;
+ }
vma->vm_private_data = mc_dev;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0320/1059] ALSA: usb-audio: Fix UAC2 mixer unit request handling
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (318 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0319/1059] vfio/fsl-mc: " Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0321/1059] rtc: ftrtc010: use devm clock APIs to fix use-after-disable in remove Greg Kroah-Hartman
` (678 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zipdox, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit 0458d97859840506c3688a963dcd4f72b4a23083 ]
For a request for a Mixer Unit on UAC2 (also UAC3), the wValue is
different from UAC1 and an incompatible value must be passed.
Namely, UAC1 takes a word consisting of 1-based input channel in the
high byte and 1-based output channel in the low byte.
Meanwhile, UAC2/3 takes UAC2_MU_MIXER in the high byte and a MCN
(0-based bit position of input/output channels) in the low byte.
The current driver implementation blindly assumes the UAC1 way, hence
it would cause a firmware error.
This patch attempts to implement the conversion to UAC2 MCN at
get_ctl_value_v2() and snd_usb_mixer_set_ctl_value() for mixer units.
At the points above, the old wValue containing ICN and OCN is
converted to the corresponding MCN, and it's used as the proper
wValue.
Reported-by: Zipdox <zipdox@zipdox.net>
Closes: https://lore.kernel.org/d46fcac6-bd7e-4fc4-95e1-4e8d39f92ad3@zipdox.net
Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260930155356.348608-3-tiwai@suse.de
[ sashal: Context line adjusted in the struct header because get_cur_broken is missing here, and the return statement context in get_ctl_value_v1() differs; the added code is otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/mixer.c | 23 +++++++++++++++++++++++
sound/usb/mixer.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 9b61c8b45a842..85d4a31e2ed84 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -340,6 +340,17 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
return err;
}
+/* convert the given UAC1 wValue (ICN|OCN) to UAC2 MCN */
+static unsigned char to_mcn(const struct usb_mixer_elem_info *cval,
+ unsigned int validx)
+{
+ unsigned char m = (validx >> 8) & 0xff; /* 1-based input channel */
+ unsigned char v = validx & 0xff; /* 1-based output channel */
+
+ /* num_inputs * num_outputs is guaranteed to be < 256 */
+ return (m - 1) * cval->num_outputs + (v - 1);
+}
+
static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
int validx, int *value_ret)
{
@@ -352,6 +363,10 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
val_size = uac2_ctl_value_size(cval->val_type);
+ /* correct wValue for UAC2 mixer control with MCN */
+ if (cval->v2_mixer)
+ validx = (UAC2_MU_MIXER << 8) | to_mcn(cval, validx);
+
if (request == UAC_GET_CUR) {
bRequest = UAC2_CS_CUR;
size = val_size;
@@ -476,6 +491,10 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
}
request = UAC2_CS_CUR;
+
+ /* correct wValue for UAC2 mixer control with MCN */
+ if (cval->v2_mixer)
+ validx = (UAC2_MU_MIXER << 8) | to_mcn(cval, validx);
}
value_set = convert_bytes_value(cval, value_set);
@@ -2205,6 +2224,10 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
cval->control = in_ch + 1; /* based on 1 */
+ if (state->mixer->protocol == UAC_VERSION_2 ||
+ state->mixer->protocol == UAC_VERSION_3)
+ cval->v2_mixer = true;
+ cval->num_outputs = num_outs;
cval->val_type = USB_MIXER_S16;
for (i = 0; i < num_outs; i++) {
__u8 *c = uac_mixer_unit_bmControls(desc, state->mixer->protocol);
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 36cb4f7daee58..d9e8a0453d676 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -94,6 +94,8 @@ struct usb_mixer_elem_info {
int cache_val[MAX_CHANNELS];
u8 initialized;
u8 min_mute;
+ u8 num_outputs;
+ bool v2_mixer;
void *private_data;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0321/1059] rtc: ftrtc010: use devm clock APIs to fix use-after-disable in remove
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (319 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0320/1059] ALSA: usb-audio: Fix UAC2 mixer unit request handling Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0322/1059] seg6: factor out End lookup nexthop processing to a dedicated function Greg Kroah-Hartman
` (677 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Liu Dalin, Linus Walleij,
Alexandre Belloni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Dalin <liudalin@kylinsec.com.cn>
[ Upstream commit d41ee317c9907d714014d0d5e4726fbd6acf338e ]
The driver mixes devm_rtc_register_device() with manual clock
disabling in ftrtc010_rtc_remove(). Because the RTC device was
registered via devm, it remains registered until devres cleanup
runs after .remove() returns. An unprivileged process holding an
open /dev/rtc0 file descriptor could issue ioctl(RTC_RD_TIME)
during this window, triggering MMIO reads on clock-gated hardware
and causing a synchronous external abort.
Replace devm_clk_get() + clk_prepare_enable() with
devm_clk_get_enabled() to tie clock lifecycle to devres. Remove
the manual .remove() callback and the corresponding error handling
labels in ftrtc010_rtc_probe().
Fixes: 1d61d2592c1f ("rtc: ftrtc010: Rename to Faraday FTRTC010")
Assisted-by: Sashiko AI [static analysis]
Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Tested-by: Liu Dalin <liudalin@kylinsec.com.cn>
Link: https://patch.msgid.link/0238203A74C9B9F6+20260827080320.3351155-3-liudalin@kylinsec.com.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[ sashal: Changed static void remove signature to static int in the deleted ftrtc010_rtc_remove() context, plus shifted context offsets from earlier changes to this file. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/rtc/rtc-ftrtc010.c | 69 +++++++++-----------------------------
1 file changed, 16 insertions(+), 53 deletions(-)
diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c
index 92458e7864d1a..c989574b1fbc6 100644
--- a/drivers/rtc/rtc-ftrtc010.c
+++ b/drivers/rtc/rtc-ftrtc010.c
@@ -121,51 +121,33 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, rtc);
- rtc->pclk = devm_clk_get(dev, "PCLK");
- if (IS_ERR(rtc->pclk)) {
+ rtc->pclk = devm_clk_get_enabled(dev, "PCLK");
+ if (IS_ERR_OR_NULL(rtc->pclk)) {
dev_err(dev, "could not get PCLK\n");
- } else {
- ret = clk_prepare_enable(rtc->pclk);
- if (ret) {
- dev_err(dev, "failed to enable PCLK\n");
- return ret;
- }
+ return PTR_ERR_OR_ZERO(rtc->pclk);
}
- rtc->extclk = devm_clk_get(dev, "EXTCLK");
- if (IS_ERR(rtc->extclk)) {
+ rtc->extclk = devm_clk_get_enabled(dev, "EXTCLK");
+ if (IS_ERR_OR_NULL(rtc->extclk)) {
dev_err(dev, "could not get EXTCLK\n");
- } else {
- ret = clk_prepare_enable(rtc->extclk);
- if (ret) {
- dev_err(dev, "failed to enable EXTCLK\n");
- goto err_disable_pclk;
- }
+ return PTR_ERR_OR_ZERO(rtc->extclk);
}
rtc->rtc_irq = platform_get_irq(pdev, 0);
- if (rtc->rtc_irq < 0) {
- ret = rtc->rtc_irq;
- goto err_disable_extclk;
- }
+ if (rtc->rtc_irq < 0)
+ return rtc->rtc_irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -ENODEV;
- goto err_disable_extclk;
- }
+ if (!res)
+ return -ENODEV;
rtc->rtc_base = devm_ioremap(dev, res->start,
resource_size(res));
- if (!rtc->rtc_base) {
- ret = -ENOMEM;
- goto err_disable_extclk;
- }
+ if (!rtc->rtc_base)
+ return -ENOMEM;
rtc_dev = devm_rtc_allocate_device(dev);
- if (IS_ERR(rtc_dev)) {
- ret = PTR_ERR(rtc_dev);
- goto err_disable_extclk;
- }
+ if (IS_ERR(rtc_dev))
+ return PTR_ERR(rtc_dev);
rtc_dev->ops = &ftrtc010_rtc_ops;
@@ -180,29 +162,11 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt,
IRQF_SHARED, pdev->name, dev);
if (unlikely(ret))
- goto err_disable_extclk;
+ return ret;
ret = devm_rtc_register_device(rtc_dev);
if (ret)
- goto err_disable_extclk;
-
- return 0;
-
-err_disable_extclk:
- clk_disable_unprepare(rtc->extclk);
-err_disable_pclk:
- clk_disable_unprepare(rtc->pclk);
- return ret;
-}
-
-static int ftrtc010_rtc_remove(struct platform_device *pdev)
-{
- struct ftrtc010_rtc *rtc = platform_get_drvdata(pdev);
-
- if (!IS_ERR(rtc->extclk))
- clk_disable_unprepare(rtc->extclk);
- if (!IS_ERR(rtc->pclk))
- clk_disable_unprepare(rtc->pclk);
+ return ret;
return 0;
}
@@ -220,7 +184,6 @@ static struct platform_driver ftrtc010_rtc_driver = {
.of_match_table = ftrtc010_rtc_dt_match,
},
.probe = ftrtc010_rtc_probe,
- .remove = ftrtc010_rtc_remove,
};
module_platform_driver_probe(ftrtc010_rtc_driver, ftrtc010_rtc_probe);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0322/1059] seg6: factor out End lookup nexthop processing to a dedicated function
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (320 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0321/1059] rtc: ftrtc010: use devm clock APIs to fix use-after-disable in remove Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0323/1059] ipv6: sr: restruct ifdefines Greg Kroah-Hartman
` (676 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Mayer, David Ahern,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <andrea.mayer@uniroma2.it>
[ Upstream commit 525c65ff5696f7ccd8335edde1d9964420707910 ]
The End nexthop lookup/input operations are moved into a new helper
function named input_action_end_finish(). This avoids duplicating the
code needed to compute the nexthop in the different flavors of the End
behavior.
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: f9cb4d296d81 ("seg6: fix HMAC validation when an extension header precedes the SRH")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/seg6_local.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index d138ae182d0c2..5b1418f7c062c 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -381,6 +381,14 @@ static void seg6_next_csid_advance_arg(struct in6_addr *addr,
memset(&addr->s6_addr[16 - fnc_octects], 0x00, fnc_octects);
}
+static int input_action_end_finish(struct sk_buff *skb,
+ struct seg6_local_lwt *slwt)
+{
+ seg6_lookup_nexthop(skb, NULL, 0);
+
+ return dst_input(skb);
+}
+
static int input_action_end_core(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
{
@@ -392,9 +400,7 @@ static int input_action_end_core(struct sk_buff *skb,
advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
- seg6_lookup_nexthop(skb, NULL, 0);
-
- return dst_input(skb);
+ return input_action_end_finish(skb, slwt);
drop:
kfree_skb(skb);
@@ -412,9 +418,7 @@ static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
/* update DA */
seg6_next_csid_advance_arg(daddr, finfo);
- seg6_lookup_nexthop(skb, NULL, 0);
-
- return dst_input(skb);
+ return input_action_end_finish(skb, slwt);
}
static bool seg6_next_csid_enabled(__u32 fops)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0323/1059] ipv6: sr: restruct ifdefines
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (321 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0322/1059] seg6: factor out End lookup nexthop processing to a dedicated function Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0324/1059] seg6: fix HMAC validation when an extension header precedes the SRH Greg Kroah-Hartman
` (675 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Simon Horman, David Ahern,
Hangbin Liu, Sabrina Dubroca, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <liuhangbin@gmail.com>
[ Upstream commit a79d8fe2ff8e78e549dc86cc853a61b029404871 ]
There are too many ifdef in IPv6 segment routing code that may cause logic
problems. like commit 160e9d275218 ("ipv6: sr: fix invalid unregister error
path"). To avoid this, the init functions are redefined for both cases. The
code could be more clear after all fidefs are removed.
Suggested-by: Simon Horman <horms@kernel.org>
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20240529040908.3472952-1-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: f9cb4d296d81 ("seg6: fix HMAC validation when an extension header precedes the SRH")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/seg6.h | 7 +++++++
include/net/seg6_hmac.h | 7 +++++++
net/ipv6/seg6.c | 33 +++++----------------------------
3 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/include/net/seg6.h b/include/net/seg6.h
index af668f17b3988..82b3fbbcbb935 100644
--- a/include/net/seg6.h
+++ b/include/net/seg6.h
@@ -52,10 +52,17 @@ static inline struct seg6_pernet_data *seg6_pernet(struct net *net)
extern int seg6_init(void);
extern void seg6_exit(void);
+#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
extern int seg6_iptunnel_init(void);
extern void seg6_iptunnel_exit(void);
extern int seg6_local_init(void);
extern void seg6_local_exit(void);
+#else
+static inline int seg6_iptunnel_init(void) { return 0; }
+static inline void seg6_iptunnel_exit(void) {}
+static inline int seg6_local_init(void) { return 0; }
+static inline void seg6_local_exit(void) {}
+#endif
extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced);
extern struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags);
diff --git a/include/net/seg6_hmac.h b/include/net/seg6_hmac.h
index 2b5d2ee5613e8..24f733b3e3fe9 100644
--- a/include/net/seg6_hmac.h
+++ b/include/net/seg6_hmac.h
@@ -49,9 +49,16 @@ extern int seg6_hmac_info_del(struct net *net, u32 key);
extern int seg6_push_hmac(struct net *net, struct in6_addr *saddr,
struct ipv6_sr_hdr *srh);
extern bool seg6_hmac_validate_skb(struct sk_buff *skb);
+#ifdef CONFIG_IPV6_SEG6_HMAC
extern int seg6_hmac_init(void);
extern void seg6_hmac_exit(void);
extern int seg6_hmac_net_init(struct net *net);
extern void seg6_hmac_net_exit(struct net *net);
+#else
+static inline int seg6_hmac_init(void) { return 0; }
+static inline void seg6_hmac_exit(void) {}
+static inline int seg6_hmac_net_init(struct net *net) { return 0; }
+static inline void seg6_hmac_net_exit(struct net *net) {}
+#endif
#endif
diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index 203bff1a6556c..c175d6cb57897 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -21,9 +21,7 @@
#include <net/genetlink.h>
#include <linux/seg6.h>
#include <linux/seg6_genl.h>
-#ifdef CONFIG_IPV6_SEG6_HMAC
#include <net/seg6_hmac.h>
-#endif
bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced)
{
@@ -440,13 +438,11 @@ static int __net_init seg6_net_init(struct net *net)
net->ipv6.seg6_data = sdata;
-#ifdef CONFIG_IPV6_SEG6_HMAC
if (seg6_hmac_net_init(net)) {
kfree(rcu_dereference_raw(sdata->tun_src));
kfree(sdata);
return -ENOMEM;
}
-#endif
return 0;
}
@@ -455,9 +451,7 @@ static void __net_exit seg6_net_exit(struct net *net)
{
struct seg6_pernet_data *sdata = seg6_pernet(net);
-#ifdef CONFIG_IPV6_SEG6_HMAC
seg6_hmac_net_exit(net);
-#endif
kfree(rcu_dereference_raw(sdata->tun_src));
kfree(sdata);
@@ -523,41 +517,28 @@ int __init seg6_init(void)
if (err)
goto out_unregister_pernet;
-#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
err = seg6_iptunnel_init();
if (err)
goto out_unregister_genl;
err = seg6_local_init();
- if (err) {
- seg6_iptunnel_exit();
- goto out_unregister_genl;
- }
-#endif
+ if (err)
+ goto out_unregister_iptun;
-#ifdef CONFIG_IPV6_SEG6_HMAC
err = seg6_hmac_init();
if (err)
- goto out_unregister_iptun;
-#endif
+ goto out_unregister_seg6;
pr_info("Segment Routing with IPv6\n");
out:
return err;
-#ifdef CONFIG_IPV6_SEG6_HMAC
-out_unregister_iptun:
-#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
+out_unregister_seg6:
seg6_local_exit();
+out_unregister_iptun:
seg6_iptunnel_exit();
-#endif
-#endif
-#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
out_unregister_genl:
-#endif
-#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC)
genl_unregister_family(&seg6_genl_family);
-#endif
out_unregister_pernet:
unregister_pernet_subsys(&ip6_segments_ops);
goto out;
@@ -565,13 +546,9 @@ int __init seg6_init(void)
void seg6_exit(void)
{
-#ifdef CONFIG_IPV6_SEG6_HMAC
seg6_hmac_exit();
-#endif
-#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
seg6_local_exit();
seg6_iptunnel_exit();
-#endif
genl_unregister_family(&seg6_genl_family);
unregister_pernet_subsys(&ip6_segments_ops);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0324/1059] seg6: fix HMAC validation when an extension header precedes the SRH
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (322 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0323/1059] ipv6: sr: restruct ifdefines Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0325/1059] iommu/arm-smmu-v3: Ensure L2 tables are visible before L1 ptrs Greg Kroah-Hartman
` (674 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuya Kusakabe, Andrea Mayer,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
[ Upstream commit f9cb4d296d81adb0923546ca5d54fae57a81af52 ]
seg6_hmac_validate_skb() derived the SRH from skb_transport_header().
That only holds while the two coincide, which is not true on the
seg6_local input path.
ip6_rcv_core() leaves the transport header just past the IPv6 header.
A Hop-by-Hop options header is consumed before the route lookup and
advances it, but a Destination Options header is not: the seg6_local
lwtunnel is entered through an input redirect from the route lookup,
which bypasses the extension header handlers. The transport header
then still points at the Destination Options header while
seg6_get_srh() has located the real SRH further down the chain.
The HMAC is therefore computed over the Destination Options header,
and a packet carrying a valid HMAC TLV is dropped when
seg6_require_hmac is set. Such a packet is legitimate: RFC 8200 allows
Destination Options before a routing header, and get_srh() has walked
the header chain since commit 5829d70b0b6c ("ipv6: sr: fix get_srh() to
comply with IPv6 standard "RFC 8200"").
With a Fragment or an Authentication header in front of the SRH, the
same mistake also reads past the data pulled by seg6_get_srh(). This
happens before seg6_require_hmac is read, so the default configuration
is affected.
Reproduce by giving a node a seg6local End SID with
net.ipv6.conf.<dev>.seg6_require_hmac=1 and a key installed with
"ip sr hmac set <keyid> sha1", then sending
IPv6 -> Destination Options -> SRH (carrying a valid HMAC TLV) -> payload
to that SID: it is dropped, while the same packet without the
Destination Options header passes.
Fixes: 5829d70b0b6c ("ipv6: sr: fix get_srh() to comply with IPv6 standard "RFC 8200"")
Assisted-by: LLM
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/20260926-b4-seg6-hmac-transport-header-v2-1-8087b76f6375@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Dropped the end_flv8986_core() call-site hunk since that function doesn't exist here, and took this tree's seg6_local.c, changing only the two existing seg6_hmac_validate_skb() calls. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/seg6_hmac.h | 3 ++-
net/ipv6/exthdrs.c | 2 +-
net/ipv6/seg6_hmac.c | 5 +----
net/ipv6/seg6_local.c | 4 ++--
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/net/seg6_hmac.h b/include/net/seg6_hmac.h
index 24f733b3e3fe9..0544e0595ff5d 100644
--- a/include/net/seg6_hmac.h
+++ b/include/net/seg6_hmac.h
@@ -48,7 +48,8 @@ extern int seg6_hmac_info_add(struct net *net, u32 key,
extern int seg6_hmac_info_del(struct net *net, u32 key);
extern int seg6_push_hmac(struct net *net, struct in6_addr *saddr,
struct ipv6_sr_hdr *srh);
-extern bool seg6_hmac_validate_skb(struct sk_buff *skb);
+extern bool seg6_hmac_validate_skb(struct sk_buff *skb,
+ struct ipv6_sr_hdr *srh);
#ifdef CONFIG_IPV6_SEG6_HMAC
extern int seg6_hmac_init(void);
extern void seg6_hmac_exit(void);
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index d7e307aa6b020..523190563d94c 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -393,7 +393,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb, struct inet6_dev *idev)
}
#ifdef CONFIG_IPV6_SEG6_HMAC
- if (!seg6_hmac_validate_skb(skb)) {
+ if (!seg6_hmac_validate_skb(skb, hdr)) {
kfree_skb(skb);
return -1;
}
diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
index e784f539194ad..6e6a7fec872f2 100644
--- a/net/ipv6/seg6_hmac.c
+++ b/net/ipv6/seg6_hmac.c
@@ -234,21 +234,18 @@ EXPORT_SYMBOL(seg6_hmac_compute);
*
* called with rcu_read_lock()
*/
-bool seg6_hmac_validate_skb(struct sk_buff *skb)
+bool seg6_hmac_validate_skb(struct sk_buff *skb, struct ipv6_sr_hdr *srh)
{
u8 hmac_output[SEG6_HMAC_FIELD_LEN];
struct net *net = dev_net(skb->dev);
struct seg6_hmac_info *hinfo;
struct sr6_tlv_hmac *tlv;
- struct ipv6_sr_hdr *srh;
struct inet6_dev *idev;
idev = __in6_dev_get(skb->dev);
if (!idev)
return false;
- srh = (struct ipv6_sr_hdr *)skb_transport_header(skb);
-
tlv = seg6_get_tlv_hmac(srh);
/* mandatory check but no tlv */
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 5b1418f7c062c..7f56f9ad1317d 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -209,7 +209,7 @@ static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)
return NULL;
#ifdef CONFIG_IPV6_SEG6_HMAC
- if (!seg6_hmac_validate_skb(skb))
+ if (!seg6_hmac_validate_skb(skb, srh))
return NULL;
#endif
@@ -226,7 +226,7 @@ static bool decap_and_validate(struct sk_buff *skb, int proto)
return false;
#ifdef CONFIG_IPV6_SEG6_HMAC
- if (srh && !seg6_hmac_validate_skb(skb))
+ if (srh && !seg6_hmac_validate_skb(skb, srh))
return false;
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0325/1059] iommu/arm-smmu-v3: Ensure L2 tables are visible before L1 ptrs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (323 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0324/1059] seg6: fix HMAC validation when an extension header precedes the SRH Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0326/1059] bpf: Roll back freplace link state when bpf_arch_text_poke() fails Greg Kroah-Hartman
` (673 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolin Chen, Jason Gunthorpe,
Mostafa Saleh, Pranjal Shrivastava, Will Deacon, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <smostafa@google.com>
[ Upstream commit 84366fb547ed987c4857311da0e5127d95bf97e6 ]
Commit 6fabce53f6b9 ("iommu/arm-smmu-v3: Add a missing dma_wmb() for hitless STE update")
adds a dma_wmb() to arm_smmu_write_entry() to make sure stream tables
and context descriptors are observed first.
However, STE L1 table descriptors are configured directly
via WRITE_ONCE(), where before that they were zeroed with memset()
inside dma_direct_alloc() then written to abort in via memset() also
in arm_smmu_init_initial_stes() without a barrier in both cases which
means that the SMMUv3 can observe the allocated table before the
written descriptors causing it to fetch random data.
Similarly in arm_smmu_write_cd_l1_desc() where the L1 CD is written
after dma_alloc_coherent() with no barriers.
Add dma_wmb() in both cases.
Fixes: 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
Reported-by: Sashiko <>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>
[ sashal: adapted the two L1 descriptor write functions to this tree's older signatures and struct layout, adding the dma_wmb() calls before the WRITE_ONCE() stores. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 79d907c57b6b6..182179d62a51c 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1033,6 +1033,9 @@ static void arm_smmu_write_cd_l1_desc(__le64 *dst,
u64 val = (l1_desc->l2ptr_dma & CTXDESC_L1_DESC_L2PTR_MASK) |
CTXDESC_L1_DESC_V;
+ /* Ensure the zero-cleared L2 table is fully visible. */
+ dma_wmb();
+
/* See comment in arm_smmu_write_ctx_desc() */
WRITE_ONCE(*dst, cpu_to_le64(val));
}
@@ -1248,6 +1251,9 @@ arm_smmu_write_strtab_l1_desc(__le64 *dst, struct arm_smmu_strtab_l1_desc *desc)
val |= FIELD_PREP(STRTAB_L1_DESC_SPAN, desc->span);
val |= desc->l2ptr_dma & STRTAB_L1_DESC_L2PTR_MASK;
+ /* Ensure the new L2 table is fully visible. */
+ dma_wmb();
+
/* See comment in arm_smmu_write_ctx_desc() */
WRITE_ONCE(*dst, cpu_to_le64(val));
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0326/1059] bpf: Roll back freplace link state when bpf_arch_text_poke() fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (324 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0325/1059] iommu/arm-smmu-v3: Ensure L2 tables are visible before L1 ptrs Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0327/1059] scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets Greg Kroah-Hartman
` (672 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leon Hwang, Yuan Chen,
Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <chenyuan@kylinos.cn>
[ Upstream commit 5ec398d9ec8fe13f8058af9a2e5f5e8f46e0a35a ]
A freplace attach claims the target prog by bumping
tgt_prog->aux->freplace_link_cnt and setting tr->extension_prog.
bpf_arch_text_poke() then makes the extension take effect. If the
poke fails, the claims are never released: the attach unwinds
through bpf_link_cleanup(), which clears link->prog, so
bpf_trampoline_unlink_prog() never runs.
Drop the link count under ext_mutex on the error path, and set
tr->extension_prog only after the poke succeeded. The count is
still bumped before the poke: it blocks prog_array updates while
the entry is patched.
Fixes: d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
Fixes: be8704ff07d2 ("bpf: Introduce dynamic program extensions")
Suggested-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://patch.msgid.link/20260928091121.219333-1-chenyuan_fl@163.com
[ sashal: Adapted the freplace fix to use struct bpf_tramp_link (link->link.prog) and the older bpf_arch_text_poke() signature without the old-text-type argument. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/trampoline.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 75f4173a0c24a..b509357019e70 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -590,9 +590,16 @@ static int __bpf_trampoline_link_prog(struct bpf_tramp_link *link,
err = bpf_freplace_link_tgt_prog(tgt_prog);
if (err)
return err;
+ err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP, NULL,
+ link->link.prog->bpf_func);
+ if (err) {
+ /* Undo the claim from bpf_freplace_link_tgt_prog(). */
+ guard(mutex)(&tgt_prog->aux->ext_mutex);
+ tgt_prog->aux->freplace_link_cnt--;
+ return err;
+ }
tr->extension_prog = link->link.prog;
- return bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP, NULL,
- link->link.prog->bpf_func);
+ return 0;
}
if (cnt >= BPF_MAX_TRAMP_LINKS)
return -E2BIG;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0327/1059] scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (325 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0326/1059] bpf: Roll back freplace link state when bpf_arch_text_poke() fails Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0328/1059] scsi: scsi_debug: Enforce physical block alignment of zoned writes Greg Kroah-Hartman
` (671 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Niklas Cassel, Damien Le Moal,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 92feb036a2d33c7b78b8daa2384f5c70d6679a91 ]
resp_write_scat() computes the length of an LBA range in bytes as a 32-bit
product, num_by = num * lb_size, and adds it to sg_off, the 32-bit offset
of the next range in the data-out buffer. The product wraps for a range of
4 GiB or more, which check_device_access_params() allows once the store is
that large, and sg_off wraps once the ranges add up to 4 GiB, which neither
their number nor their overlap prevents. The ranges that follow are then
written from the wrong offset in the buffer.
Make num_by and sg_off 64-bit, and pass do_device_access() sg_off capped at
the length of the buffer. An offset at the end of the buffer copies
nothing, and sg_copy_buffer(), which takes it as an off_t, is never given
one larger than the buffer that it copies.
Assisted-by: LLM
Fixes: 481b5e5c7949 ("scsi: scsi_debug: add resp_write_scat function")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-21-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: Kept this branch's older sdev_printk format and do_device_access() argument list (no group or atomic flag), applying only the u64 and %llu changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 620911ccd134f..edf9a027d70c8 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3733,7 +3733,8 @@ static int resp_write_scat(struct scsi_cmnd *scp,
struct sdeb_store_info *sip = devip2sip(devip, true);
u8 wrprotect;
u16 lbdof, num_lrd, k;
- u32 num, num_by, bt_len, lbdof_blen, sg_off, cum_lb;
+ u32 num, bt_len, lbdof_blen, cum_lb;
+ u64 num_by, sg_off;
u32 lb_size = sdebug_sector_size;
u32 ei_lba;
u64 lba;
@@ -3807,14 +3808,14 @@ static int resp_write_scat(struct scsi_cmnd *scp,
num = get_unaligned_be32(up + 8);
if (sdebug_verbose)
sdev_printk(KERN_INFO, scp->device,
- "%s: %s: k=%d LBA=0x%llx num=%u sg_off=%u\n",
+ "%s: %s: k=%d LBA=0x%llx num=%u sg_off=%llu\n",
my_name, __func__, k, lba, num, sg_off);
if (num == 0)
continue;
ret = check_device_access_params(scp, lba, num, true);
if (ret)
goto err_out_unlock;
- num_by = num * lb_size;
+ num_by = (u64)num * lb_size;
ei_lba = is_16 ? 0 : get_unaligned_be32(up + 12);
if ((cum_lb + num) > bt_len) {
@@ -3841,7 +3842,9 @@ static int resp_write_scat(struct scsi_cmnd *scp,
}
}
- ret = do_device_access(sip, scp, sg_off, lba, num, true);
+ ret = do_device_access(sip, scp,
+ min_t(u64, sg_off, scsi_bufflen(scp)),
+ lba, num, true);
/* If ZBC zone then bump its write pointer */
if (sdebug_dev_is_zoned(devip))
zbc_inc_wp(devip, lba, num);
@@ -3852,7 +3855,7 @@ static int resp_write_scat(struct scsi_cmnd *scp,
goto err_out_unlock;
} else if (unlikely(sdebug_verbose && (ret < num_by)))
sdev_printk(KERN_INFO, scp->device,
- "%s: write: cdb indicated=%u, IO sent=%d bytes\n",
+ "%s: write: cdb indicated=%llu, IO sent=%d bytes\n",
my_name, num_by, ret);
if (unlikely((sdebug_opts & SDEBUG_OPT_RECOV_DIF_DIX) &&
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0328/1059] scsi: scsi_debug: Enforce physical block alignment of zoned writes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (326 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0327/1059] scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0329/1059] scsi: scsi_debug: Report the residual of a write Greg Kroah-Hartman
` (670 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 63cb3900be261fccc05cadcf3402058418a5fada ]
ZBC-3 r06 (T10/BSR INCITS 579), 4.5.3.3.2, requires a write to a sequential
write required zone to be terminated with ILLEGAL REQUEST / UNALIGNED WRITE
COMMAND both when it does not start at the write pointer and when it does
not end on a physical block boundary. That is why sd_zbc_read_zones() sets
the zone_write_granularity queue limit to the physical block size of a
host-managed device.
check_zbc_access_params() implements the first condition but not the
second. So with zbc=managed sector_size=512 physblk_exp=3, a write of a
single logical block at the write pointer is accepted and advances the
write pointer by one logical block, leaving it off the granularity that was
advertised: nothing can write at it any more, and the zone can only be used
again after being reset.
Check the ending LBA as well, with the same sense data, as the standard
gives both conditions the same. An entire medium write same command, which
the standard excludes, needs no special case: the preceding check already
terminates it with WRITE BOUNDARY VIOLATION. Sequential write preferred
zones are left alone, as writes to them need not be sequential, and with
the default physblk_exp=0 the check is a no-op.
Assisted-by: LLM
Fixes: f0d1cf9378bd ("scsi: scsi_debug: Add ZBC zone commands")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-23-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: Replaced the two-argument mk_sense_buffer(scp, ILLEGAL_REQUEST, UNALIGNED_WRITE_COMMAND) with the older three-argument form using LBA_OUT_OF_RANGE and UNALIGNED_WRITE_ASCQ, since the combined macro doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index edf9a027d70c8..6a9a591c5dd3a 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2953,6 +2953,17 @@ static int check_zbc_access_params(struct scsi_cmnd *scp,
UNALIGNED_WRITE_ASCQ);
return check_condition_result;
}
+ /*
+ * Writes must end on a physical block boundary, that is, the
+ * transfer length must be a multiple of the physical block
+ * size.
+ */
+ if (!IS_ALIGNED(lba + num, 1U << sdebug_physblk_exp)) {
+ mk_sense_buffer(scp, ILLEGAL_REQUEST,
+ LBA_OUT_OF_RANGE,
+ UNALIGNED_WRITE_ASCQ);
+ return check_condition_result;
+ }
}
/* Handle implicit open of closed and empty zones */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0329/1059] scsi: scsi_debug: Report the residual of a write
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (327 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0328/1059] scsi: scsi_debug: Enforce physical block alignment of zoned writes Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0330/1059] scsi: scsi_debug: Do not write a partial physical block to a zoned device Greg Kroah-Hartman
` (669 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 7c000c4ad2c0a7b2da06ffe28f5a7489fc52ca2d ]
Documentation/scsi/scsi_mid_low_api.rst defines the residual as the length
of the data buffer less the number of bytes actually transferred, so a
write whose data buffer is larger than its transfer length leaves
one. resp_read_dt0() and resp_write_tape() report it, but the write paths
for a disk do not, so such a write completes with GOOD status and a
residual of zero while a READ of the same length into the same buffer
reports it correctly.
Report it in resp_write_dt0(), resp_write_scat() and resp_atomic_write().
resp_write_scat() differs twice over. Its data-out buffer also holds the
parameter list header and the LBA range descriptors, so what the command
consumed is sg_off rather than the bytes that the last range transferred;
and sg_off counts what was asked for rather than what was transferred, so
it can exceed the buffer and needs a guard. A command with no LBA range
descriptors or a buffer transfer length of zero transfers nothing, so the
whole buffer is residual. An error, real or injected, can end the command
after some ranges have been written, so the residual is reported on every
exit once the parameter list has been fetched.
Assisted-by: LLM
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-22-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: Adapted to the older base: sdeb_write_unlock() replaces sdeb_meta_write_unlock(), and the missing atomic-write function's hunk was dropped, so only two of three upstream hunks apply. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6a9a591c5dd3a..5bd748ca1ffd3 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3711,6 +3711,9 @@ static int resp_write_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
"%s: write: cdb indicated=%u, IO sent=%d bytes\n",
my_name, num * sdebug_sector_size, ret);
+ if (ret < scsi_bufflen(scp))
+ scsi_set_resid(scp, scsi_bufflen(scp) - ret);
+
if (unlikely((sdebug_opts & SDEBUG_OPT_RECOV_DIF_DIX) &&
atomic_read(&sdeb_inject_pending))) {
if (sdebug_opts & SDEBUG_OPT_RECOVERED_ERR) {
@@ -3778,8 +3781,10 @@ static int resp_write_scat(struct scsi_cmnd *scp,
"Unprotected WR to DIF device\n");
}
}
- if ((num_lrd == 0) || (bt_len == 0))
+ if (num_lrd == 0 || bt_len == 0) {
+ scsi_set_resid(scp, scsi_bufflen(scp));
return 0; /* T10 says these do-nothings are not errors */
+ }
if (lbdof == 0) {
if (sdebug_verbose)
sdev_printk(KERN_INFO, scp->device,
@@ -3871,6 +3876,8 @@ static int resp_write_scat(struct scsi_cmnd *scp,
if (unlikely((sdebug_opts & SDEBUG_OPT_RECOV_DIF_DIX) &&
atomic_read(&sdeb_inject_pending))) {
+ /* This range has been written */
+ sg_off += num_by;
if (sdebug_opts & SDEBUG_OPT_RECOVERED_ERR) {
mk_sense_buffer(scp, RECOVERED_ERROR, THRESHOLD_EXCEEDED, 0);
atomic_set(&sdeb_inject_pending, 0);
@@ -3894,6 +3901,13 @@ static int resp_write_scat(struct scsi_cmnd *scp,
}
ret = 0;
err_out_unlock:
+ /*
+ * sg_off counts what the command asked for, which can exceed the
+ * buffer: lbdof is not validated against it, and a range is counted
+ * in full even if do_device_access() copied less.
+ */
+ if (scsi_bufflen(scp) > sg_off)
+ scsi_set_resid(scp, scsi_bufflen(scp) - sg_off);
sdeb_write_unlock(sip);
err_out:
kfree(lrdp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0330/1059] scsi: scsi_debug: Do not write a partial physical block to a zoned device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (328 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0329/1059] scsi: scsi_debug: Report the residual of a write Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0331/1059] scsi: scsi_debug: Advance the write pointer over the data written Greg Kroah-Hartman
` (668 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit b8fad9f02485f179e35bc4677386b6608d8cefb0 ]
do_device_access() copies one logical block at a time and stops at the
first short copy, so a data-out buffer smaller than the transfer length of
the command can leave part of a physical block written. An initiator can
arrange that with SG_IO.
That is acceptable everywhere but a sequential write required zone, where
ZBC-3 r06 (T10/BSR INCITS 579), 4.5.3.3.2, requires a write to end on a
physical block boundary.
For such a zone, stop at the last whole physical block that the buffer
holds. The bytes left over are not written, and are reported to the
initiator as part of the residual.
Assisted-by: LLM
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-24-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index da43ed8f9b9ad..8ec8c151f4936 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3032,6 +3032,8 @@ static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp,
u64 block, rest = 0;
enum dma_data_direction dir;
struct scsi_data_buffer *sdb = &scp->sdb;
+ struct scsi_device *sdp = scp->device;
+ struct sdebug_dev_info *devip = (struct sdebug_dev_info *)sdp->hostdata;
u8 *fsp;
if (do_write) {
@@ -3047,6 +3049,25 @@ static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp,
return -1;
fsp = sip->storep;
+ /*
+ * A write to a sequential write required zone has to end on a physical
+ * block boundary, so if the data-out buffer does not hold all of the
+ * data that the command asks for, write up to the last whole physical
+ * block that it does hold. What is left over is reported as part of
+ * the residual.
+ */
+ if (do_write && sdebug_dev_is_zoned(devip)) {
+ struct sdeb_zone_state *zsp = zbc_zone(devip, lba);
+
+ if (zsp->z_type == ZBC_ZTYPE_SWR) {
+ u32 avail = (sdb->length - sg_skip)
+ >> ilog2(sdebug_sector_size);
+
+ if (avail < num)
+ num = round_down(avail, 1U << sdebug_physblk_exp);
+ }
+ }
+
block = do_div(lba, sdebug_store_sectors);
if (block + num > sdebug_store_sectors)
rest = block + num - sdebug_store_sectors;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0331/1059] scsi: scsi_debug: Advance the write pointer over the data written
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (329 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0330/1059] scsi: scsi_debug: Do not write a partial physical block to a zoned device Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0332/1059] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node Greg Kroah-Hartman
` (667 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit cb2d2a7c80c62d1e5e476609706f29dd9584d0e0 ]
resp_write_dt0() and resp_write_scat() advance the write pointer of a
sequential write required zone by the transfer length of the command
without looking at what do_device_access() returned, which is -1 when the
data direction of the command does not match the operation, and a short
byte count when the data-out buffer is smaller than the transfer length. An
initiator can produce both with SG_IO.
The zone then describes more data than is on the medium, and a write at the
position where the data really ends is terminated with UNALIGNED WRITE
COMMAND, so the zone has to be reset before it can be written to again.
Advance the write pointer over the data that was written instead. As
do_device_access() does not write a partial physical block to such a zone,
that leaves the write pointer where a write can end.
Assisted-by: LLM
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Fixes: f0d1cf9378bd ("scsi: scsi_debug: Add ZBC zone commands")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-25-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: adjusted context for the older do_device_access() signature and locking helpers, and the prerequisite partial-physical-block clamp for zoned devices is not included. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3720,9 +3720,9 @@ static int resp_write_dt0(struct scsi_cm
ret = do_device_access(sip, scp, 0, lba, num, true);
if (unlikely(scsi_debug_lbp()))
map_region(sip, lba, num);
- /* If ZBC zone then bump its write pointer */
- if (sdebug_dev_is_zoned(devip))
- zbc_inc_wp(devip, lba, num);
+ /* If ZBC zone then bump its write pointer over the data written */
+ if (sdebug_dev_is_zoned(devip) && ret > 0)
+ zbc_inc_wp(devip, lba, ret >> ilog2(sdebug_sector_size));
sdeb_write_unlock(sip);
if (unlikely(-1 == ret))
return DID_ERROR << 16;
@@ -3882,9 +3882,10 @@ static int resp_write_scat(struct scsi_c
ret = do_device_access(sip, scp,
min_t(u64, sg_off, scsi_bufflen(scp)),
lba, num, true);
- /* If ZBC zone then bump its write pointer */
- if (sdebug_dev_is_zoned(devip))
- zbc_inc_wp(devip, lba, num);
+ /* If ZBC zone then bump its write pointer over the data written */
+ if (sdebug_dev_is_zoned(devip) && ret > 0)
+ zbc_inc_wp(devip, lba,
+ ret >> ilog2(sdebug_sector_size));
if (unlikely(scsi_debug_lbp()))
map_region(sip, lba, num);
if (unlikely(-1 == ret)) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0332/1059] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (330 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0331/1059] scsi: scsi_debug: Advance the write pointer over the data written Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0333/1059] spi: fsl: unmap immr_spi_cs on remove Greg Kroah-Hartman
` (666 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolin Chen, Mostafa Saleh,
Will Deacon, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <nicolinc@nvidia.com>
[ Upstream commit 2888520bdcbe0599cfc77b2fad8dc6c95505a3cb ]
arm_smmu_insert_master() skips inserting a stream whose StreamID duplicates
one the same master already owns (bridged PCI devices can present duplicate
IDs), leaving that master->streams[i].node zeroed and unlinked from the
smmu->streams rb-tree.
Both the insert error-rollback loop and arm_smmu_remove_master() then call
rb_erase() on every master->streams[i].node unconditionally. rb_erase() on
a zeroed node sees a NULL parent, treats the node as the tree root and sets
root->rb_node = NULL, silently emptying the whole SID tree and breaking SID
lookups (and DMA) for every other master on the SMMU.
Mark each node with RB_CLEAR_NODE() after sort_nonatomic() reorders the
array, since sorting relocates the entries and would leave the earlier
self-referential RB_CLEAR_NODE() pointer stale. An un-inserted node then
stays RB_EMPTY_NODE() and is skipped in both erase loops; inserted nodes
are linked by rb_find_add() and erased as before.
Fixes: b00d24997a11 ("iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids")
Assisted-by: LLM
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
[ sashal: placed the RB_CLEAR_NODE() loop before the streams_mutex lock, since this tree has no sort_nonatomic() call to anchor it after, and dropped the upstream comment about sorting. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 182179d62a51c..5529bebe7bb5c 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2626,6 +2626,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
return -ENOMEM;
master->num_streams = fwspec->num_ids;
+ for (i = 0; i < fwspec->num_ids; i++)
+ RB_CLEAR_NODE(&master->streams[i].node);
+
mutex_lock(&smmu->streams_mutex);
for (i = 0; i < fwspec->num_ids; i++) {
struct arm_smmu_stream *new_stream = &master->streams[i];
@@ -2661,7 +2664,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
if (ret) {
for (i--; i >= 0; i--)
- rb_erase(&master->streams[i].node, &smmu->streams);
+ if (!RB_EMPTY_NODE(&master->streams[i].node))
+ rb_erase(&master->streams[i].node,
+ &smmu->streams);
kfree(master->streams);
}
mutex_unlock(&smmu->streams_mutex);
@@ -2680,7 +2685,8 @@ static void arm_smmu_remove_master(struct arm_smmu_master *master)
mutex_lock(&smmu->streams_mutex);
for (i = 0; i < fwspec->num_ids; i++)
- rb_erase(&master->streams[i].node, &smmu->streams);
+ if (!RB_EMPTY_NODE(&master->streams[i].node))
+ rb_erase(&master->streams[i].node, &smmu->streams);
mutex_unlock(&smmu->streams_mutex);
kfree(master->streams);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0333/1059] spi: fsl: unmap immr_spi_cs on remove
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (331 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0332/1059] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0334/1059] spi: bcm63xx-hsspi: Disable runtime PM " Greg Kroah-Hartman
` (665 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
[ Upstream commit af1d882d421de504a1e5fac92eb06947b6cbdd8f ]
of_fsl_spi_remove() does not unmap pinfo->immr_spi_cs after a
successful probe when CONFIG_FSL_SOC is enabled and fsl,spisel_boot
causes of_fsl_spi_probe() to map it with ioremap(). The probe error
path already performs the matching iounmap().
Retrieve pinfo from the platform data and call iounmap() when
pinfo->immr_spi_cs is present, pairing normal removal with the mapping
established by of_fsl_spi_probe().
Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260924112329.1566051-2-lgs201920130244@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Context adjusted because the earlier spi_controller_get/put fix is already present, so the iounmap() is placed between fsl_spi_cpm_free() and spi_controller_put(host). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-fsl-spi.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index a92671faca2ab..884cecc8e1eb1 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -721,12 +721,20 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
{
struct spi_controller *host = platform_get_drvdata(ofdev);
struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
+#if IS_ENABLED(CONFIG_FSL_SOC)
+ struct fsl_spi_platform_data *pdata = dev_get_platdata(&ofdev->dev);
+ struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
+#endif
spi_controller_get(host);
spi_unregister_controller(host);
fsl_spi_cpm_free(mpc8xxx_spi);
+#if IS_ENABLED(CONFIG_FSL_SOC)
+ if (pinfo->immr_spi_cs)
+ iounmap(pinfo->immr_spi_cs);
+#endif
spi_controller_put(host);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0334/1059] spi: bcm63xx-hsspi: Disable runtime PM on remove
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (332 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0333/1059] spi: fsl: unmap immr_spi_cs on remove Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0335/1059] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Greg Kroah-Hartman
` (664 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
[ Upstream commit 38232bd3cea74845c2064eb9f7eac77fa5a21d85 ]
bcm63xx_hsspi_probe() enables runtime PM before creating the sysfs
group, but bcm63xx_hsspi_remove() does not perform the matching
pm_runtime_disable() after a successful probe.
The probe error paths already disable runtime PM when sysfs group
creation or controller registration fails.
Add pm_runtime_disable() to the remove path after removing the sysfs
group to balance pm_runtime_enable() from bcm63xx_hsspi_probe().
Fixes: fb8695e3749e ("spi: bcm63xx-hsspi: fix pm_runtime")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260924112329.1566051-4-lgs201920130244@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Added the missing pm_runtime_disable() call at the end of the int-returning remove(), since the driver has no sysfs group for the upstream context to anchor on. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-bcm63xx-hsspi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index 8822dd21486af..46d8c22e3b819 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -476,6 +476,7 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev)
__raw_writel(0, bs->regs + HSSPI_INT_MASK_REG);
clk_disable_unprepare(bs->pll_clk);
clk_disable_unprepare(bs->clk);
+ pm_runtime_disable(&pdev->dev);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0335/1059] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (333 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0334/1059] spi: bcm63xx-hsspi: Disable runtime PM " Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0336/1059] dlm: validate node weights before building member array Greg Kroah-Hartman
` (663 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Konrad Dybcio,
Rob Clark, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[ Upstream commit 77e3ffcf69065c4ce92c725540e0b4db14f43ad7 ]
Only a530/a540 have a GPMU. On the other a5xx parts, reading the
0xa800-0xac60 GPMU aperture during a crashdump resets the board -- on
sda660 (a512) a GPU hang thus reboots the SoC instead of recovering.
Split the GPMU block into its own array and collect it only when a GPMU
is present.
Fixes: e20c9284c8f2 ("drm/msm/adreno: Add support for Adreno 510 GPU")
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/754867/
Message-ID: <20260920-a5xx-no-gpmu-v1-1-714200254f76@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
[ sashal: Kept the tree's kzalloc(sizeof(*a5xx_state), GFP_KERNEL) instead of kzalloc_obj() and added the new adreno_gpu declaration above it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 49 +++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 5a10628934bc6..e01bc8200f78f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1332,9 +1332,14 @@ static const u32 a5xx_registers[] = {
0xE800, 0xE806, 0xE810, 0xE89A, 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB,
0xE900, 0xE905, 0xEB80, 0xEB8F, 0xEBB0, 0xEBB0, 0xEC00, 0xEC05,
0xEC08, 0xECE9, 0xECF0, 0xECF0, 0xEA80, 0xEA80, 0xEA82, 0xEAA3,
- 0xEAA5, 0xEAC2, 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D,
- 0XA880, 0xA88D, 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5,
- 0xAC60, 0xAC60, ~0,
+ 0xEAA5, 0xEAC2, ~0,
+};
+
+/* GPMU registers, only valid on parts with a GPMU (a530/a540) */
+static const u32 a5xx_gpmu_registers[] = {
+ 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D, 0xA880, 0xA88D,
+ 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5, 0xAC60, 0xAC60,
+ ~0,
};
static void a5xx_dump(struct msm_gpu *gpu)
@@ -1445,6 +1450,7 @@ struct a5xx_crashdumper {
struct a5xx_gpu_state {
struct msm_gpu_state base;
u32 *hlsqregs;
+ u32 *gpmuregs;
};
static int a5xx_crashdumper_init(struct msm_gpu *gpu,
@@ -1562,8 +1568,30 @@ static void a5xx_gpu_state_get_hlsq_regs(struct msm_gpu *gpu,
msm_gem_kernel_put(dumper.bo, gpu->aspace);
}
+static void a5xx_gpu_state_get_gpmu_regs(struct msm_gpu *gpu,
+ struct a5xx_gpu_state *a5xx_state)
+{
+ u32 count = 0, pos = 0;
+ int i;
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2)
+ count += a5xx_gpmu_registers[i + 1] - a5xx_gpmu_registers[i] + 1;
+
+ a5xx_state->gpmuregs = kcalloc(count, sizeof(u32), GFP_KERNEL);
+ if (!a5xx_state->gpmuregs)
+ return;
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) {
+ u32 addr;
+
+ for (addr = a5xx_gpmu_registers[i]; addr <= a5xx_gpmu_registers[i + 1]; addr++)
+ a5xx_state->gpmuregs[pos++] = gpu_read(gpu, addr);
+ }
+}
+
static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu)
{
+ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a5xx_gpu_state *a5xx_state = kzalloc(sizeof(*a5xx_state),
GFP_KERNEL);
bool stalled = !!(gpu_read(gpu, REG_A5XX_RBBM_STATUS3) & BIT(24));
@@ -1579,6 +1607,9 @@ static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu)
a5xx_state->base.rbbm_status = gpu_read(gpu, REG_A5XX_RBBM_STATUS);
+ if (adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu))
+ a5xx_gpu_state_get_gpmu_regs(gpu, a5xx_state);
+
/*
* Get the HLSQ regs with the help of the crashdumper, but only if
* we are not stalled in an iommu fault (in which case the crashdumper
@@ -1600,6 +1631,7 @@ static void a5xx_gpu_state_destroy(struct kref *kref)
struct a5xx_gpu_state, base);
kfree(a5xx_state->hlsqregs);
+ kfree(a5xx_state->gpmuregs);
adreno_gpu_state_destroy(state);
kfree(a5xx_state);
@@ -1628,6 +1660,17 @@ static void a5xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
adreno_show(gpu, state, p);
+ if (a5xx_state->gpmuregs) {
+ u32 o, pos = 0;
+
+ drm_printf(p, "registers-gpmu:\n");
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2)
+ for (o = a5xx_gpmu_registers[i]; o <= a5xx_gpmu_registers[i + 1]; o++)
+ drm_printf(p, " - { offset: 0x%04x, value: 0x%08x }\n",
+ o << 2, a5xx_state->gpmuregs[pos++]);
+ }
+
/* Dump the additional a5xx HLSQ registers */
if (!a5xx_state->hlsqregs)
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0336/1059] dlm: validate node weights before building member array
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (334 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0335/1059] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0337/1059] dmaengine: ste_dma40: Fix physical cyclic capability Greg Kroah-Hartman
` (662 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qing Ming, Alexander Aring,
David Teigland, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Ming <a0yami@mailbox.org>
[ Upstream commit 7f662eb1807ed732ac7d5e119753c8185f241bb8 ]
DLM node weights are parsed as signed integers and copied into the member
list. make_member_array() uses their sum as the allocation count, but only
positive weights contribute entries to the array. A negative weight can
therefore reduce the allocation without reducing the number of writes.
The issue was found through static analysis of the configfs input and
member array construction. With two recovery members weighted -31 and 32,
the sum is 1, so recovery allocates one int and then writes the positive
member's node ID 32 times. A reproducer using dlm_controld and dlm_tool
triggered the same report on a KASAN kernel:
BUG: KASAN: slab-out-of-bounds in dlm_recover_members [dlm]
Write of size 4 by task dlm_recoverd
Call Trace:
dlm_recover_members
dlm_recoverd
kthread
ret_from_fork
Reject negative weights at the configfs input boundary. Also detect
overflow when adding non-negative weights to the signed allocation count,
and propagate array construction errors to the recovery path.
Fixes: e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Signed-off-by: Qing Ming <a0yami@mailbox.org>
Assisted-by: Codex:gpt-5
Acked-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
[ sashal: Kept the tree's kmalloc_array() instead of kmalloc_objs() and dropped the early ls_total_weight assignment; ping_members(ls) context also differs. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/dlm/config.c | 9 ++++++++-
fs/dlm/member.c | 17 +++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 20b60709eccf0..3d48d7548c1cd 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -804,10 +804,17 @@ static ssize_t node_weight_show(struct config_item *item, char *buf)
static ssize_t node_weight_store(struct config_item *item, const char *buf,
size_t len)
{
- int rc = kstrtoint(buf, 0, &config_item_to_node(item)->weight);
+ struct dlm_node *node = config_item_to_node(item);
+ int weight;
+ int rc;
+ rc = kstrtoint(buf, 0, &weight);
if (rc)
return rc;
+ if (weight < 0)
+ return -EINVAL;
+
+ node->weight = weight;
return len;
}
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 2af2ccfe43a9d..aece94eaf66f8 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -386,7 +386,7 @@ void dlm_clear_members_gone(struct dlm_ls *ls)
clear_memb_list(&ls->ls_nodes_gone, NULL);
}
-static void make_member_array(struct dlm_ls *ls)
+static int make_member_array(struct dlm_ls *ls)
{
struct dlm_member *memb;
int i, w, x = 0, total = 0, all_zero = 0, *array;
@@ -395,8 +395,8 @@ static void make_member_array(struct dlm_ls *ls)
ls->ls_node_array = NULL;
list_for_each_entry(memb, &ls->ls_nodes, list) {
- if (memb->weight)
- total += memb->weight;
+ if (check_add_overflow(total, memb->weight, &total))
+ return -EOVERFLOW;
}
/* all nodes revert to weight of 1 if all have weight 0 */
@@ -406,10 +406,9 @@ static void make_member_array(struct dlm_ls *ls)
all_zero = 1;
}
- ls->ls_total_weight = total;
array = kmalloc_array(total, sizeof(*array), GFP_NOFS);
if (!array)
- return;
+ return -ENOMEM;
list_for_each_entry(memb, &ls->ls_nodes, list) {
if (!all_zero && !memb->weight)
@@ -426,7 +425,10 @@ static void make_member_array(struct dlm_ls *ls)
array[x++] = memb->nodeid;
}
+ ls->ls_total_weight = total;
ls->ls_node_array = array;
+
+ return 0;
}
/* send a status request to all members just to establish comms connections */
@@ -583,7 +585,10 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
}
ls->ls_low_nodeid = low;
- make_member_array(ls);
+ error = make_member_array(ls);
+ if (error)
+ return error;
+
*neg_out = neg;
error = ping_members(ls);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0337/1059] dmaengine: ste_dma40: Fix physical cyclic capability
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (335 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0336/1059] dlm: validate node weights before building member array Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0338/1059] dmaengine: ste_dma40: Fix cyclic transfer residue Greg Kroah-Hartman
` (661 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frank Li, Linus Walleij, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 11101a8e3e42273a5910a149f6324040b88f4747 ]
d40_dmaengine_init() configures dma_both for physical channels that can
handle both slave and memcpy transfers. Physical DMA40 channel setup has
supported cyclic LLIs since cyclic transfer support was added, but the
DMA_CYCLIC capability is set on dma_slave a second time instead of
dma_both.
Set DMA_CYCLIC on dma_both so d40_ops_init() installs
device_prep_dma_cyclic and physical channels advertise cyclic support.
Fixes: 0c842b551063 ("dma40: cyclic xfer support")
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-1-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 594b016e76efc..e06f8f0e9c825 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2885,7 +2885,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
dma_cap_zero(base->dma_both.cap_mask);
dma_cap_set(DMA_SLAVE, base->dma_both.cap_mask);
dma_cap_set(DMA_MEMCPY, base->dma_both.cap_mask);
- dma_cap_set(DMA_CYCLIC, base->dma_slave.cap_mask);
+ dma_cap_set(DMA_CYCLIC, base->dma_both.cap_mask);
d40_ops_init(base, &base->dma_both);
err = dmaenginem_async_device_register(&base->dma_both);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0338/1059] dmaengine: ste_dma40: Fix cyclic transfer residue
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (336 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0337/1059] dmaengine: ste_dma40: Fix physical cyclic capability Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0339/1059] dmaengine: ste_dma40: Recover coalesced cyclic callbacks Greg Kroah-Hartman
` (660 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frank Li, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit c80edceff29ee212987c2d2c851b2cb2eb4b477a ]
DMA40 reads residue from the element count of the currently active LLI.
For a cyclic transfer this reports at most one period, not the bytes
remaining until the cyclic buffer wraps.
Once DMA40 advertises burst granularity, DMAengine PCM uses this residue
directly. For a four-period PCM buffer it consequently reports the
hardware pointer near three periods after every period interrupt. ALSA
eventually stops playback with -EIO although DMA period callbacks
continue.
Calculate cyclic residue from the current memory-side hardware pointer
instead. Read the destination pointer for capture and the source pointer
for playback. Sample the split logical channel pointer coherently and
retain the last valid residue during relink transitions.
Make at most three residue sampling attempts: one initial read plus two
retries. The retries let transient split-register updates or LLI relink
windows settle, while the limit prevents unbounded polling if hardware does
not yield a valid pointer.
This avoids counting terminal-count interrupts, which races with hardware
advancing to the next LLI and cannot account for coalesced interrupt
status. Also reject cyclic periods that expand into multiple LLIs because
logical cyclic LLIs each request a terminal-count interrupt and would
generate more than one callback per period.
Reject invalid cyclic geometries before dividing or constructing the
scatterlist as well.
Reported-by: Frank Li <Frank.li@oss.nxp.com>
Closes: https://lore.kernel.org/dmaengine/aq2wIPJW6viUxyy9@SMW015318/
Fixes: 15c606686541 ("dmaengine: ste_dma40: indicate granularity on channels")
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-2-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[ sashal: Replaced kzalloc_objs(...) with the older kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT) and adjusted hunk context offsets; the rest matches upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 106 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 101 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index e06f8f0e9c825..3ae29c81ac76d 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -38,6 +38,9 @@
/* Maximum iterations taken before giving up suspending a channel */
#define D40_SUSPEND_MAX_IT 500
+/* Maximum attempts to sample a stable cyclic residue position */
+#define D40_RESIDUE_MAX_ATTEMPTS 3
+
/* Milliseconds */
#define DMA40_AUTOSUSPEND_DELAY 100
@@ -351,6 +354,9 @@ struct d40_lli_pool {
* @lli_len: Number of llis of current descriptor.
* @lli_current: Number of transferred llis.
* @lcla_alloc: Number of LCLA entries allocated.
+ * @cyclic_dma_addr: Start address of the cyclic buffer.
+ * @cyclic_buf_len: Length of the cyclic buffer.
+ * @cyclic_residue: Last valid cyclic residue sample.
* @txd: DMA engine struct. Used for among other things for communication
* during a transfer.
* @node: List entry.
@@ -369,6 +375,9 @@ struct d40_desc {
int lli_len;
int lli_current;
int lcla_alloc;
+ dma_addr_t cyclic_dma_addr;
+ size_t cyclic_buf_len;
+ size_t cyclic_residue;
struct dma_async_tx_descriptor txd;
struct list_head node;
@@ -1397,6 +1406,64 @@ static u32 d40_residue(struct d40_chan *d40c)
return num_elt * d40c->dma_cfg.dst_info.data_width;
}
+static bool d40_current_addr(struct d40_chan *d40c, dma_addr_t *addr)
+{
+ bool dst = d40c->dma_cfg.dir == DMA_DEV_TO_MEM;
+ void __iomem *high_reg;
+ void __iomem *low_reg;
+ u32 low;
+ u32 high;
+ u32 check;
+ int i;
+
+ if (chan_is_physical(d40c)) {
+ *addr = readl(chan_base(d40c) +
+ (dst ? D40_CHAN_REG_SDPTR : D40_CHAN_REG_SSPTR));
+ return true;
+ }
+
+ if (dst) {
+ low_reg = &d40c->lcpa->lcsp2;
+ high_reg = &d40c->lcpa->lcsp3;
+ } else {
+ low_reg = &d40c->lcpa->lcsp0;
+ high_reg = &d40c->lcpa->lcsp1;
+ }
+
+ for (i = 0; i < D40_RESIDUE_MAX_ATTEMPTS; i++) {
+ high = readl(high_reg) & D40_MEM_LCSP1_SPTR_MASK;
+ low = readl(low_reg) & D40_MEM_LCSP0_SPTR_MASK;
+ check = readl(high_reg) & D40_MEM_LCSP1_SPTR_MASK;
+ if (high == check) {
+ *addr = low | high;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool d40_cyclic_offset(struct d40_chan *d40c, struct d40_desc *d40d,
+ size_t *offset)
+{
+ dma_addr_t current_addr;
+ dma_addr_t current_offset;
+ int i;
+
+ for (i = 0; i < D40_RESIDUE_MAX_ATTEMPTS; i++) {
+ if (!d40_current_addr(d40c, ¤t_addr))
+ continue;
+
+ current_offset = current_addr - d40d->cyclic_dma_addr;
+ if (current_offset <= d40d->cyclic_buf_len) {
+ *offset = current_offset;
+ return true;
+ }
+ }
+
+ return false;
+}
+
static bool d40_tx_is_linked(struct d40_chan *d40c)
{
bool is_link;
@@ -2091,15 +2158,26 @@ static bool d40_is_paused(struct d40_chan *d40c)
}
-static u32 stedma40_residue(struct dma_chan *chan)
+static u32 stedma40_residue(struct dma_chan *chan, dma_cookie_t cookie)
{
struct d40_chan *d40c =
container_of(chan, struct d40_chan, chan);
+ struct d40_desc *d40d;
+ size_t offset;
u32 bytes_left;
unsigned long flags;
spin_lock_irqsave(&d40c->lock, flags);
- bytes_left = d40_residue(d40c);
+ d40d = d40_first_active_get(d40c);
+ if (d40d && d40d->txd.cookie == cookie && d40d->cyclic &&
+ d40d->cyclic_buf_len) {
+ if (d40_cyclic_offset(d40c, d40d, &offset))
+ d40d->cyclic_residue = d40d->cyclic_buf_len - offset;
+ bytes_left = d40d->cyclic_residue;
+ } else {
+ bytes_left = d40_residue(d40c);
+ }
+
spin_unlock_irqrestore(&d40c->lock, flags);
return bytes_left;
@@ -2229,8 +2307,13 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
if (desc == NULL)
goto unlock;
- if (sg_next(&sg_src[sg_len - 1]) == sg_src)
+ if (sg_next(&sg_src[sg_len - 1]) == sg_src) {
desc->cyclic = true;
+ if (desc->lli_len != sg_len) {
+ chan_err(chan, "Cyclic periods must fit in one LLI\n");
+ goto free_desc;
+ }
+ }
src_dev_addr = 0;
dst_dev_addr = 0;
@@ -2509,11 +2592,18 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
size_t buf_len, size_t period_len,
enum dma_transfer_direction direction, unsigned long flags)
{
- unsigned int periods = buf_len / period_len;
+ unsigned int periods;
struct dma_async_tx_descriptor *txd;
+ struct d40_desc *desc;
struct scatterlist *sg;
+ dma_addr_t buf_addr = dma_addr;
int i;
+ if (!buf_len || !period_len || buf_len % period_len)
+ return NULL;
+
+ periods = buf_len / period_len;
+
sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT);
if (!sg)
return NULL;
@@ -2528,6 +2618,12 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
txd = d40_prep_sg(chan, sg, sg, periods, direction,
DMA_PREP_INTERRUPT);
+ if (txd) {
+ desc = container_of(txd, struct d40_desc, txd);
+ desc->cyclic_dma_addr = buf_addr;
+ desc->cyclic_buf_len = buf_len;
+ desc->cyclic_residue = buf_len;
+ }
kfree(sg);
@@ -2548,7 +2644,7 @@ static enum dma_status d40_tx_status(struct dma_chan *chan,
ret = dma_cookie_status(chan, cookie, txstate);
if (ret != DMA_COMPLETE && txstate)
- dma_set_residue(txstate, stedma40_residue(chan));
+ dma_set_residue(txstate, stedma40_residue(chan, cookie));
if (d40_is_paused(d40c))
ret = DMA_PAUSED;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0339/1059] dmaengine: ste_dma40: Recover coalesced cyclic callbacks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (337 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0338/1059] dmaengine: ste_dma40: Fix cyclic transfer residue Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0340/1059] dmaengine: ste_dma40: Fix failed start cleanup Greg Kroah-Hartman
` (659 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Frank Li, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit db28400d92cd97005065dad230b8a5d72ab121cb ]
DMA40 has one terminal-count status bit per channel, so cyclic period
interrupts can coalesce.
Use the memory-side pointer displacement to queue the minimum observable
number of callbacks. If sampling fails, queue one callback and invalidate
the saved position; the next successful sample resynchronizes without
recounting it.
The pointer is modulo the cyclic buffer: a displacement of d periods can
mean d plus n complete iterations of the buffer. Report d, so the driver
could have missed n iterations of the buffer; DMA40 has no counter to
recover them. For an unchanged pointer, report one callback rather than
risk a spurious full-buffer burst.
This condition has not been seen in practice and is only a product of
review comments that the buffer can miss interrupts.
The preceding cyclic-residue fix ensures that every cyclic period fits in
one LLI, so each boundary corresponds to one client callback.
Fixes: 0c842b551063 ("dma40: cyclic xfer support")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-3-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 69 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 3ae29c81ac76d..d6104fe6c29fa 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -357,11 +357,14 @@ struct d40_lli_pool {
* @cyclic_dma_addr: Start address of the cyclic buffer.
* @cyclic_buf_len: Length of the cyclic buffer.
* @cyclic_residue: Last valid cyclic residue sample.
+ * @cyclic_period_len: Length of one cyclic period.
+ * @cyclic_callback_pos: Position after the callbacks already queued.
* @txd: DMA engine struct. Used for among other things for communication
* during a transfer.
* @node: List entry.
* @is_in_client_list: true if the client owns this descriptor.
* @cyclic: true if this is a cyclic job
+ * @cyclic_callback_pos_valid: Whether cyclic_callback_pos is reliable.
*
* This descriptor is used for both logical and physical transfers.
*/
@@ -378,12 +381,15 @@ struct d40_desc {
dma_addr_t cyclic_dma_addr;
size_t cyclic_buf_len;
size_t cyclic_residue;
+ size_t cyclic_period_len;
+ size_t cyclic_callback_pos;
struct dma_async_tx_descriptor txd;
struct list_head node;
bool is_in_client_list;
bool cyclic;
+ bool cyclic_callback_pos_valid;
};
/**
@@ -1464,6 +1470,61 @@ static bool d40_cyclic_offset(struct d40_chan *d40c, struct d40_desc *d40d,
return false;
}
+static unsigned int d40_cyclic_periods_elapsed(struct d40_chan *d40c,
+ struct d40_desc *d40d)
+{
+ size_t current_pos;
+ size_t delta;
+ size_t offset;
+ unsigned int periods;
+
+ if (!d40d->cyclic_period_len)
+ return 1;
+
+ if (!d40_cyclic_offset(d40c, d40d, &offset)) {
+ d40d->cyclic_callback_pos_valid = false;
+ return 1;
+ }
+
+ current_pos = rounddown(offset, d40d->cyclic_period_len);
+ if (!d40_residue(d40c) && current_pos != offset)
+ current_pos += d40d->cyclic_period_len;
+ if (current_pos == d40d->cyclic_buf_len)
+ current_pos = 0;
+
+ if (!d40d->cyclic_callback_pos_valid) {
+ /*
+ * The previous interrupt was reported without a pointer
+ * sample. Resynchronize without using the stale position,
+ * which would count that callback again.
+ */
+ d40d->cyclic_callback_pos = current_pos;
+ d40d->cyclic_callback_pos_valid = true;
+ return 1;
+ }
+
+ /*
+ * The pointer wraps with the cyclic buffer, so its displacement is
+ * only the minimum number of elapsed periods. Complete buffer laps
+ * are not observable.
+ */
+ delta = (current_pos + d40d->cyclic_buf_len -
+ d40d->cyclic_callback_pos) % d40d->cyclic_buf_len;
+ periods = delta / d40d->cyclic_period_len;
+ if (!periods) {
+ /*
+ * The TC status is a single latched bit. An unchanged pointer
+ * cannot distinguish a complete lap from a repeated interrupt,
+ * so do not amplify it into a buffer's worth of callbacks.
+ */
+ periods = 1;
+ }
+
+ d40d->cyclic_callback_pos = current_pos;
+
+ return periods;
+}
+
static bool d40_tx_is_linked(struct d40_chan *d40c)
{
bool is_link;
@@ -1588,6 +1649,7 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c)
static void dma_tc_handle(struct d40_chan *d40c)
{
struct d40_desc *d40d;
+ unsigned int callbacks = 1;
/* Get first active entry from list */
d40d = d40_first_active_get(d40c);
@@ -1612,6 +1674,8 @@ static void dma_tc_handle(struct d40_chan *d40c)
if (d40d->lli_current == d40d->lli_len)
d40d->lli_current = 0;
}
+
+ callbacks = d40_cyclic_periods_elapsed(d40c, d40d);
} else {
d40_lcla_free_all(d40c, d40d);
@@ -1633,7 +1697,7 @@ static void dma_tc_handle(struct d40_chan *d40c)
d40_desc_done(d40c, d40d);
}
- d40c->pending_tx++;
+ d40c->pending_tx += callbacks;
tasklet_schedule(&d40c->tasklet);
}
@@ -2623,6 +2687,9 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
desc->cyclic_dma_addr = buf_addr;
desc->cyclic_buf_len = buf_len;
desc->cyclic_residue = buf_len;
+ desc->cyclic_period_len = period_len;
+ desc->cyclic_callback_pos = 0;
+ desc->cyclic_callback_pos_valid = true;
}
kfree(sg);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0340/1059] dmaengine: ste_dma40: Fix failed start cleanup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (338 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0339/1059] dmaengine: ste_dma40: Recover coalesced cyclic callbacks Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0341/1059] dmaengine: ste_dma40: Fix LCLA allocation order Greg Kroah-Hartman
` (658 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 8175ead5727173d4b96d1e830e696765d75ade71 ]
If d40_start() fails after a queued descriptor has been moved to the
active list, d40_queue_start() currently returns NULL without unwinding
the transfer state or clearing the channel busy flag.
Fix this pre-existing error path by completing the descriptor through the
normal tasklet path, clearing the busy flag, balancing the runtime PM
reference and returning an error pointer to distinguish the failure from
the no-work case. Do not free the descriptor directly, since it has
already been submitted and has a DMA cookie.
When starting the next queued transfer from the completion handler, put
the completed descriptor on the done list first. This preserves FIFO
completion order if the new transfer fails to start and prevents the
completed cookie from moving backwards.
Use done-list membership rather than the cyclic flag to identify terminal
descriptors in the tasklet. A cyclic descriptor that failed to start is
then completed and removed instead of remaining permanently at the head
of the done list.
Fixes: 7d83a854a1a4 ("dma40: remove "hardware link with previous jobs" code")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260618051539.15E201F000E9@smtp.kernel.org/
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Assisted-by: LLM
Link: https://lore.kernel.org/dmaengine/20260618051539.15E201F000E9@smtp.kernel.org/
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-4-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index d6104fe6c29fa..d2d44cbd22ae1 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1638,8 +1638,15 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c)
/* Start dma job */
err = d40_start(d40c);
- if (err)
- return NULL;
+ if (err) {
+ d40_desc_remove(d40d);
+ d40_desc_done(d40c, d40d);
+ d40c->pending_tx++;
+ d40c->busy = false;
+ pm_runtime_put_autosuspend(d40c->base->dev);
+ tasklet_schedule(&d40c->tasklet);
+ return ERR_PTR(err);
+ }
}
return d40d;
@@ -1686,15 +1693,15 @@ static void dma_tc_handle(struct d40_chan *d40c)
return;
}
+ d40_desc_remove(d40d);
+ d40_desc_done(d40c, d40d);
+
if (d40_queue_start(d40c) == NULL) {
d40c->busy = false;
pm_runtime_mark_last_busy(d40c->base->dev);
pm_runtime_put_autosuspend(d40c->base->dev);
}
-
- d40_desc_remove(d40d);
- d40_desc_done(d40c, d40d);
}
d40c->pending_tx += callbacks;
@@ -1708,20 +1715,22 @@ static void dma_tasklet(struct tasklet_struct *t)
struct d40_desc *d40d;
unsigned long flags;
bool callback_active;
+ bool from_done;
struct dmaengine_desc_callback cb;
spin_lock_irqsave(&d40c->lock, flags);
/* Get first entry from the done list */
d40d = d40_first_done(d40c);
- if (d40d == NULL) {
+ from_done = !!d40d;
+ if (!from_done) {
/* Check if we have reached here for cyclic job */
d40d = d40_first_active_get(d40c);
if (d40d == NULL || !d40d->cyclic)
goto check_pending_tx;
}
- if (!d40d->cyclic)
+ if (from_done)
dma_cookie_complete(&d40d->txd);
/*
@@ -1737,7 +1746,7 @@ static void dma_tasklet(struct tasklet_struct *t)
callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT);
dmaengine_desc_get_callback(&d40d->txd, &cb);
- if (!d40d->cyclic) {
+ if (from_done) {
if (async_tx_test_ack(&d40d->txd)) {
d40_desc_remove(d40d);
d40_desc_free(d40c, d40d);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0341/1059] dmaengine: ste_dma40: Fix LCLA allocation order
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (339 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0340/1059] dmaengine: ste_dma40: Fix failed start cleanup Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0342/1059] dmaengine: ste_dma40: Validate DMA specifier length Greg Kroah-Hartman
` (657 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 7d4dc355c574d414d2402ac481a2fc4ee51e2771 ]
d40_lcla_allocate() calculates the number of pages needed for LCLA, but
passes that raw page count as the allocation order to __get_free_pages().
The same value is later passed to free_pages().
Store the allocation order with get_order() instead, and use a separate
byte size for allocation diagnostics, fallback kmalloc() sizing and DMA
mapping.
Fixes: 508849ade23c ("DMAENGINE: ste_dma40: allocate LCLA dynamically")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260819225114.AE1511F000E9@smtp.kernel.org/
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-12-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index d2d44cbd22ae1..c890f720bfe37 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -399,8 +399,8 @@ struct d40_desc {
* @dma_addr: DMA address, if mapped
* @base_unaligned: The orignal kmalloc pointer, if kmalloc is used.
* This pointer is only there for clean-up on error.
- * @pages: The number of pages needed for all physical channels.
- * Only used later for clean-up on error
+ * @alloc_order: Order used for the LCLA page allocation.
+ * Only used later for clean-up on error.
* @lock: Lock to protect the content in this struct.
* @alloc_map: big map over which LCLA entry is own by which job.
*/
@@ -408,7 +408,7 @@ struct d40_lcla_pool {
void *base;
dma_addr_t dma_addr;
void *base_unaligned;
- int pages;
+ unsigned int alloc_order;
spinlock_t lock;
struct d40_desc **alloc_map;
};
@@ -3543,6 +3543,7 @@ static void __init d40_hw_init(struct d40_base *base)
static int __init d40_lcla_allocate(struct d40_base *base)
{
struct d40_lcla_pool *pool = &base->lcla_pool;
+ size_t lcla_size = SZ_1K * base->num_phy_chans;
unsigned long *page_list;
int i, j;
int ret;
@@ -3558,20 +3559,20 @@ static int __init d40_lcla_allocate(struct d40_base *base)
if (!page_list)
return -ENOMEM;
- /* Calculating how many pages that are required */
- base->lcla_pool.pages = SZ_1K * base->num_phy_chans / PAGE_SIZE;
+ base->lcla_pool.alloc_order = get_order(lcla_size);
for (i = 0; i < MAX_LCLA_ALLOC_ATTEMPTS; i++) {
page_list[i] = __get_free_pages(GFP_KERNEL,
- base->lcla_pool.pages);
+ base->lcla_pool.alloc_order);
if (!page_list[i]) {
- d40_err(base->dev, "Failed to allocate %d pages.\n",
- base->lcla_pool.pages);
+ d40_err(base->dev, "Failed to allocate %zu bytes.\n",
+ lcla_size);
ret = -ENOMEM;
for (j = 0; j < i; j++)
- free_pages(page_list[j], base->lcla_pool.pages);
+ free_pages(page_list[j],
+ base->lcla_pool.alloc_order);
goto free_page_list;
}
@@ -3581,7 +3582,7 @@ static int __init d40_lcla_allocate(struct d40_base *base)
}
for (j = 0; j < i; j++)
- free_pages(page_list[j], base->lcla_pool.pages);
+ free_pages(page_list[j], base->lcla_pool.alloc_order);
if (i < MAX_LCLA_ALLOC_ATTEMPTS) {
base->lcla_pool.base = (void *)page_list[i];
@@ -3591,10 +3592,9 @@ static int __init d40_lcla_allocate(struct d40_base *base)
* alignment, try with allocating a big buffer.
*/
dev_warn(base->dev,
- "[%s] Failed to get %d pages @ 18 bit align.\n",
- __func__, base->lcla_pool.pages);
- base->lcla_pool.base_unaligned = kmalloc(SZ_1K *
- base->num_phy_chans +
+ "[%s] Failed to get %zu bytes @ 18 bit align.\n",
+ __func__, lcla_size);
+ base->lcla_pool.base_unaligned = kmalloc(lcla_size +
LCLA_ALIGNMENT,
GFP_KERNEL);
if (!base->lcla_pool.base_unaligned) {
@@ -3606,8 +3606,7 @@ static int __init d40_lcla_allocate(struct d40_base *base)
LCLA_ALIGNMENT);
}
- pool->dma_addr = dma_map_single(base->dev, pool->base,
- SZ_1K * base->num_phy_chans,
+ pool->dma_addr = dma_map_single(base->dev, pool->base, lcla_size,
DMA_TO_DEVICE);
if (dma_mapping_error(base->dev, pool->dma_addr)) {
pool->dma_addr = 0;
@@ -3847,7 +3846,7 @@ static int __init d40_probe(struct platform_device *pdev)
if (!base->lcla_pool.base_unaligned && base->lcla_pool.base)
free_pages((unsigned long)base->lcla_pool.base,
- base->lcla_pool.pages);
+ base->lcla_pool.alloc_order);
kfree(base->lcla_pool.base_unaligned);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0342/1059] dmaengine: ste_dma40: Validate DMA specifier length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (340 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0341/1059] dmaengine: ste_dma40: Fix LCLA allocation order Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0343/1059] dmaengine: ste_dma40: Reject direction changes after allocation Greg Kroah-Hartman
` (656 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frank Li, Linus Walleij, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 9f1064ebe17cf3ab65ac6eb166398e02678aea33 ]
The DMA40 binding requires three cells, but d40_xlate() reads args[0],
args[1], and args[2] without checking args_count. A malformed provider node
can specify fewer cells, leaving some of these values uninitialized when
the OF DMA core invokes the translation callback.
Reject specifiers that do not contain exactly three cells before reading
the argument array.
Fixes: fa332de5c6b3 ("dmaengine: ste_dma40: Supply full Device Tree parsing support")
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-17-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index c890f720bfe37..3ec960b6a16d2 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2505,6 +2505,9 @@ static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec,
dma_cap_mask_t cap;
u32 flags;
+ if (dma_spec->args_count != 3)
+ return NULL;
+
memset(&cfg, 0, sizeof(struct stedma40_chan_cfg));
dma_cap_zero(cap);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0343/1059] dmaengine: ste_dma40: Reject direction changes after allocation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (341 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0342/1059] dmaengine: ste_dma40: Validate DMA specifier length Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0344/1059] dmaengine: ste_dma40: Fix logical channel bounds check Greg Kroah-Hartman
` (655 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 77ebc64f40717b8501793b5f5ee717a141e62e8e ]
Logical channel allocation uses the configured direction to select the
source or destination allocation mask, derive the logical channel number,
and choose the LCPA location.
d40_set_runtime_config_write() nevertheless overwrites the configured
direction when a transfer is prepared for the opposite direction.
d40_free_dma() then clears the wrong allocation mask, leaking the original
resource and potentially releasing one used by another client.
Reject directions that differ from the direction used during allocation
and propagate runtime configuration errors to callers. Skip slave runtime
configuration for memcpy transfers, which also use d40_prep_sg() but do
not require it.
Fixes: 95e1400fa131 ("DMAENGINE: add runtime slave config to DMA40 v3")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260618051539.15E201F000E9@smtp.kernel.org/
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-18-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 3ec960b6a16d2..15f55802e8036 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2372,7 +2372,13 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
return NULL;
}
- d40_set_runtime_config_write(dchan, &chan->slave_config, direction);
+ if (direction != DMA_MEM_TO_MEM) {
+ ret = d40_set_runtime_config_write(dchan,
+ &chan->slave_config,
+ direction);
+ if (ret)
+ return NULL;
+ }
spin_lock_irqsave(&chan->lock, flags);
@@ -2843,6 +2849,13 @@ static int d40_set_runtime_config_write(struct dma_chan *chan,
return -EINVAL;
}
+ if (direction != cfg->dir) {
+ chan_err(d40c,
+ "transfer direction %d differs from allocated direction %d\n",
+ direction, cfg->dir);
+ return -EINVAL;
+ }
+
src_addr_width = config->src_addr_width;
src_maxburst = config->src_maxburst;
dst_addr_width = config->dst_addr_width;
@@ -2851,13 +2864,6 @@ static int d40_set_runtime_config_write(struct dma_chan *chan,
if (direction == DMA_DEV_TO_MEM) {
config_addr = config->src_addr;
- if (cfg->dir != DMA_DEV_TO_MEM)
- dev_dbg(d40c->base->dev,
- "channel was not configured for peripheral "
- "to memory transfer (%d) overriding\n",
- cfg->dir);
- cfg->dir = DMA_DEV_TO_MEM;
-
/* Configure the memory side */
if (dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
dst_addr_width = src_addr_width;
@@ -2867,13 +2873,6 @@ static int d40_set_runtime_config_write(struct dma_chan *chan,
} else if (direction == DMA_MEM_TO_DEV) {
config_addr = config->dst_addr;
- if (cfg->dir != DMA_MEM_TO_DEV)
- dev_dbg(d40c->base->dev,
- "channel was not configured for memory "
- "to peripheral transfer (%d) overriding\n",
- cfg->dir);
- cfg->dir = DMA_MEM_TO_DEV;
-
/* Configure the memory side */
if (src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
src_addr_width = dst_addr_width;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0344/1059] dmaengine: ste_dma40: Fix logical channel bounds check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (342 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0343/1059] dmaengine: ste_dma40: Reject direction changes after allocation Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0345/1059] dmaengine: ste_dma40: Fix event group bounds Greg Kroah-Hartman
` (654 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Linus Walleij, Frank Li,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 57938e0c2a24f9f792fe9f611391ef6b58d1aa21 ]
d40_validate_conf() checks the raw dev_type against num_log_chans,
but d40_allocate_channel() derives the lookup_log_chans index as either
2 * dev_type or 2 * dev_type + 1.
Validate the dev_type against the derived logical channel index limit so
channel allocation cannot write past lookup_log_chans.
Fixes: 26955c07dcf3 ("dmaengine: ste_dma40: Amalgamate DMA source and destination channel numbers")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260618051539.15E201F000E9@smtp.kernel.org/
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-19-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 15f55802e8036..e5260139f5da4 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1843,15 +1843,26 @@ static int d40_validate_conf(struct d40_chan *d40c,
{
int res = 0;
bool is_log = conf->mode == STEDMA40_MODE_LOGICAL;
+ bool invalid_dev_type = conf->dev_type < 0;
if (!conf->dir) {
chan_err(d40c, "Invalid direction.\n");
res = -EINVAL;
}
- if ((is_log && conf->dev_type > d40c->base->num_log_chans) ||
- (!is_log && conf->dev_type > d40c->base->num_phy_chans) ||
- (conf->dev_type < 0)) {
+ if (!invalid_dev_type && is_log) {
+ int max_dev_type;
+
+ if (conf->dir == DMA_DEV_TO_MEM)
+ max_dev_type = DIV_ROUND_UP(d40c->base->num_log_chans, 2);
+ else
+ max_dev_type = d40c->base->num_log_chans / 2;
+
+ invalid_dev_type = conf->dev_type >= max_dev_type;
+ }
+
+ if (invalid_dev_type ||
+ (!is_log && conf->dev_type > d40c->base->num_phy_chans)) {
chan_err(d40c, "Invalid device type (%d)\n", conf->dev_type);
res = -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0345/1059] dmaengine: ste_dma40: Fix event group bounds
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (343 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0344/1059] dmaengine: ste_dma40: Fix logical channel bounds check Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0346/1059] dmaengine: ste_dma40: Fix V4B event group mapping Greg Kroah-Hartman
` (653 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Linus Walleij, Frank Li,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit e66a9dbe04c71249cfb2a544c9c25d1b3b761fba ]
The dev_type validation can allow values whose derived event group has no
matching physical channel pair. d40_allocate_channel() then indexes
phy_res with j + event_group * 2, and __d40_set_prio_rt() uses the same
group to select priority and realtime registers.
The physical-mode validation also compares dev_type with the number of
physical channels. However, dev_type identifies an event line: DB8500 has
eight physical channels but 64 source and 64 destination event lines. The
event group determines which physical channel pair can serve an event, so
the physical channel count is not a valid dev_type limit.
Reject dev_type values outside the hardware event-group range, remove the
incorrect physical channel count limit, and stop the physical-channel
search before a partial final channel group can index past phy_res.
Fixes: 26955c07dcf3 ("dmaengine: ste_dma40: Amalgamate DMA source and destination channel numbers")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/
Assisted-by: LLM
Link: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-20-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index e5260139f5da4..7e4db98b1b05b 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -51,6 +51,10 @@
#define D40_LCLA_LINK_PER_EVENT_GRP 128
#define D40_LCLA_END D40_LCLA_LINK_PER_EVENT_GRP
+/* Number of event groups per hardware register layout */
+#define D40_EVENT_GROUPS_V4A 4
+#define D40_EVENT_GROUPS_V4B 5
+
/* Max number of logical channels per physical channel */
#define D40_MAX_LOG_CHAN_PER_PHY 32
@@ -510,6 +514,7 @@ struct d40_chan {
* @high_prio_clear: the high priority clear register
* @interrupt_en: the interrupt enable register
* @interrupt_clear: the interrupt clear register
+ * @num_event_groups: number of supported event groups
* @il: the pointer to struct d40_interrupt_lookup
* @il_size: the size of d40_interrupt_lookup array
* @init_reg: the pointer to the struct d40_reg_val
@@ -524,6 +529,7 @@ struct d40_gen_dmac {
u32 high_prio_clear;
u32 interrupt_en;
u32 interrupt_clear;
+ u32 num_event_groups;
struct d40_interrupt_lookup *il;
u32 il_size;
struct d40_reg_val *init_reg;
@@ -1845,6 +1851,11 @@ static int d40_validate_conf(struct d40_chan *d40c,
bool is_log = conf->mode == STEDMA40_MODE_LOGICAL;
bool invalid_dev_type = conf->dev_type < 0;
+ if (!invalid_dev_type &&
+ D40_TYPE_TO_GROUP(conf->dev_type) >=
+ d40c->base->gen_dmac.num_event_groups)
+ invalid_dev_type = true;
+
if (!conf->dir) {
chan_err(d40c, "Invalid direction.\n");
res = -EINVAL;
@@ -1861,8 +1872,7 @@ static int d40_validate_conf(struct d40_chan *d40c,
invalid_dev_type = conf->dev_type >= max_dev_type;
}
- if (invalid_dev_type ||
- (!is_log && conf->dev_type > d40c->base->num_phy_chans)) {
+ if (invalid_dev_type) {
chan_err(d40c, "Invalid device type (%d)\n", conf->dev_type);
res = -EINVAL;
}
@@ -2027,8 +2037,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
}
}
} else
- for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
+ for (j = 0; j < d40c->base->num_phy_chans;
+ j += D40_GROUP_SIZE) {
int phy_num = j + event_group * 2;
+ if (phy_num + 1 >= num_phy_chans)
+ break;
+
for (i = phy_num; i < phy_num + 2; i++) {
if (d40_alloc_mask_set(&phys[i],
is_src,
@@ -2048,8 +2062,10 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
return -EINVAL;
/* Find logical channel */
- for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
+ for (j = 0; j < d40c->base->num_phy_chans; j += D40_GROUP_SIZE) {
int phy_num = j + event_group * 2;
+ if (phy_num + 1 >= num_phy_chans)
+ break;
if (d40c->dma_cfg.use_fixed_channel) {
i = d40c->dma_cfg.phy_channel;
@@ -3398,6 +3414,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
base->log_chans = &base->phy_chans[num_phy_chans];
if (base->plat_data->num_of_phy_chans == 14) {
+ base->gen_dmac.num_event_groups = D40_EVENT_GROUPS_V4B;
base->gen_dmac.backup = d40_backup_regs_v4b;
base->gen_dmac.backup_size = BACKUP_REGS_SZ_V4B;
base->gen_dmac.interrupt_en = D40_DREG_CPCMIS;
@@ -3411,6 +3428,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
base->gen_dmac.init_reg = dma_init_reg_v4b;
base->gen_dmac.init_reg_size = ARRAY_SIZE(dma_init_reg_v4b);
} else {
+ base->gen_dmac.num_event_groups = D40_EVENT_GROUPS_V4A;
if (base->rev >= 3) {
base->gen_dmac.backup = d40_backup_regs_v4a;
base->gen_dmac.backup_size = BACKUP_REGS_SZ_V4A;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0346/1059] dmaengine: ste_dma40: Fix V4B event group mapping
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (344 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0345/1059] dmaengine: ste_dma40: Fix event group bounds Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0347/1059] dmaengine: ste_dma40: Validate fixed physical channel indexes Greg Kroah-Hartman
` (652 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Frank Li, Vinod Koul,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit b36f8fce7314fed53563c60e683ff86deb8a51ae ]
DMA40 physical resources are connected in pairs to event groups. The
mapping repeats after each complete set of groups.
D40_GROUP_SIZE and D40_PHYS_TO_GROUP() encode the four-group V4A layout.
On V4B, which has five groups, resources 8 and 9 are consequently offered
both to event groups 0 and 4. The GCC clock bookkeeping also treats these
resources as group 0 instead of group 4.
Derive the physical-resource stride and reverse mapping from the
variant-specific number of event groups. This preserves the V4A mapping
and gives V4B a ten-resource stride: resources 8 and 9 belong only to
group 4, while resources 10 and 11 repeat group 0.
Fixes: 3cb645dc85a0 ("dmaengine: ste_dma40: support more than 128 event lines")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-21-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 47 ++++++++++++++++++++++++++------------
drivers/dma/ste_dma40_ll.h | 2 --
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 7e4db98b1b05b..321e277cdf621 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -54,6 +54,7 @@
/* Number of event groups per hardware register layout */
#define D40_EVENT_GROUPS_V4A 4
#define D40_EVENT_GROUPS_V4B 5
+#define D40_PHYS_PER_EVENT_GROUP 2
/* Max number of logical channels per physical channel */
#define D40_MAX_LOG_CHAN_PER_PHY 32
@@ -1989,6 +1990,12 @@ static bool d40_alloc_mask_free(struct d40_phy_res *phy, bool is_src,
return is_free;
}
+static int d40_phy_to_group(struct d40_base *base, int phy)
+{
+ return (phy / D40_PHYS_PER_EVENT_GROUP) %
+ base->gen_dmac.num_event_groups;
+}
+
static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
{
int dev_type = d40c->dma_cfg.dev_type;
@@ -1999,11 +2006,14 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
int j;
int log_num;
int num_phy_chans;
+ int phy_group_stride;
bool is_src;
bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;
phys = d40c->base->phy_res;
num_phy_chans = d40c->base->num_phy_chans;
+ phy_group_stride = D40_PHYS_PER_EVENT_GROUP *
+ d40c->base->gen_dmac.num_event_groups;
if (d40c->dma_cfg.dir == DMA_DEV_TO_MEM) {
log_num = 2 * dev_type;
@@ -2037,13 +2047,18 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
}
}
} else
- for (j = 0; j < d40c->base->num_phy_chans;
- j += D40_GROUP_SIZE) {
- int phy_num = j + event_group * 2;
- if (phy_num + 1 >= num_phy_chans)
+ for (j = 0; j < num_phy_chans;
+ j += phy_group_stride) {
+ int phy_num = j + event_group *
+ D40_PHYS_PER_EVENT_GROUP;
+
+ if (phy_num + D40_PHYS_PER_EVENT_GROUP >
+ num_phy_chans)
break;
- for (i = phy_num; i < phy_num + 2; i++) {
+ for (i = phy_num;
+ i < phy_num + D40_PHYS_PER_EVENT_GROUP;
+ i++) {
if (d40_alloc_mask_set(&phys[i],
is_src,
0,
@@ -2062,9 +2077,10 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
return -EINVAL;
/* Find logical channel */
- for (j = 0; j < d40c->base->num_phy_chans; j += D40_GROUP_SIZE) {
- int phy_num = j + event_group * 2;
- if (phy_num + 1 >= num_phy_chans)
+ for (j = 0; j < num_phy_chans; j += phy_group_stride) {
+ int phy_num = j + event_group * D40_PHYS_PER_EVENT_GROUP;
+
+ if (phy_num + D40_PHYS_PER_EVENT_GROUP > num_phy_chans)
break;
if (d40c->dma_cfg.use_fixed_channel) {
@@ -2091,14 +2107,17 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
* channels.
*/
if (is_src) {
- for (i = phy_num; i < phy_num + 2; i++) {
+ for (i = phy_num;
+ i < phy_num + D40_PHYS_PER_EVENT_GROUP;
+ i++) {
if (d40_alloc_mask_set(&phys[i], is_src,
event_line, is_log,
first_phy_user))
goto found_log;
}
} else {
- for (i = phy_num + 1; i >= phy_num; i--) {
+ for (i = phy_num + D40_PHYS_PER_EVENT_GROUP - 1;
+ i >= phy_num; i--) {
if (d40_alloc_mask_set(&phys[i], is_src,
event_line, is_log,
first_phy_user))
@@ -3236,9 +3255,9 @@ static int __init d40_phy_res_init(struct d40_base *base)
base->phy_res[i].allocated_src = D40_ALLOC_PHY;
base->phy_res[i].allocated_dst = D40_ALLOC_PHY;
base->phy_res[i].reserved = true;
- gcc |= D40_DREG_GCC_EVTGRP_ENA(D40_PHYS_TO_GROUP(i),
+ gcc |= D40_DREG_GCC_EVTGRP_ENA(d40_phy_to_group(base, i),
D40_DREG_GCC_SRC);
- gcc |= D40_DREG_GCC_EVTGRP_ENA(D40_PHYS_TO_GROUP(i),
+ gcc |= D40_DREG_GCC_EVTGRP_ENA(d40_phy_to_group(base, i),
D40_DREG_GCC_DST);
@@ -3258,9 +3277,9 @@ static int __init d40_phy_res_init(struct d40_base *base)
base->phy_res[chan].allocated_src = D40_ALLOC_PHY;
base->phy_res[chan].allocated_dst = D40_ALLOC_PHY;
base->phy_res[chan].reserved = true;
- gcc |= D40_DREG_GCC_EVTGRP_ENA(D40_PHYS_TO_GROUP(chan),
+ gcc |= D40_DREG_GCC_EVTGRP_ENA(d40_phy_to_group(base, chan),
D40_DREG_GCC_SRC);
- gcc |= D40_DREG_GCC_EVTGRP_ENA(D40_PHYS_TO_GROUP(chan),
+ gcc |= D40_DREG_GCC_EVTGRP_ENA(d40_phy_to_group(base, chan),
D40_DREG_GCC_DST);
num_phy_chans_avail--;
}
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h
index c504e855eb02b..b04c4e92b4ed0 100644
--- a/drivers/dma/ste_dma40_ll.h
+++ b/drivers/dma/ste_dma40_ll.h
@@ -16,8 +16,6 @@
#define D40_TYPE_TO_GROUP(type) (type / 16)
#define D40_TYPE_TO_EVENT(type) (type % 16)
-#define D40_GROUP_SIZE 8
-#define D40_PHYS_TO_GROUP(phys) ((phys & (D40_GROUP_SIZE - 1)) / 2)
/* Most bits of the CFG register are the same in log as in phy mode */
#define D40_SREG_CFG_MST_POS 15
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0347/1059] dmaengine: ste_dma40: Validate fixed physical channel indexes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (345 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0346/1059] dmaengine: ste_dma40: Fix V4B event group mapping Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:57 ` [PATCH 6.1 0348/1059] dmaengine: ste_dma40: Validate memcpy configuration Greg Kroah-Hartman
` (651 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 884e01160bc727509b4fdf04e763a86b936df464 ]
Fixed physical memcpy allocation uses dma_cfg.phy_channel directly as an
index into phy_res when use_fixed_channel is set. d40_validate_conf()
validates dev_type but not the fixed physical channel, allowing an invalid
configuration to access memory outside the array.
Validate the fixed physical channel centrally before accepting the channel
configuration.
Fixes: f000df8c5a0e ("dmaengine: ste_dma40: support fixed physical channel allocation")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-23-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 321e277cdf621..14d36b9dca5c5 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1878,6 +1878,14 @@ static int d40_validate_conf(struct d40_chan *d40c,
res = -EINVAL;
}
+ if (conf->use_fixed_channel &&
+ (conf->phy_channel < 0 ||
+ conf->phy_channel >= d40c->base->num_phy_chans)) {
+ chan_err(d40c, "Invalid physical channel (%d)\n",
+ conf->phy_channel);
+ res = -EINVAL;
+ }
+
if (conf->dir == DMA_DEV_TO_DEV) {
/*
* DMAC HW supports it. Will be added to this driver,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0348/1059] dmaengine: ste_dma40: Validate memcpy configuration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (346 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0347/1059] dmaengine: ste_dma40: Validate fixed physical channel indexes Greg Kroah-Hartman
@ 2026-12-04 9:57 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0349/1059] pNFS/flexfiles: honor FF_FLAGS_NO_IO_THRU_MDS over the mdsthreshold hint Greg Kroah-Hartman
` (650 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:57 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 0ac4a90c4805b41013044fdefff051ae59a54302 ]
d40_config_memcpy() builds a default memcpy configuration without passing
it through d40_validate_conf(). A dev_type supplied through the
memcpy-channels device tree property can therefore bypass the bounds
checks added for client configurations.
The generic DMA direction enum assigns zero to DMA_MEM_TO_MEM, unlike
DMA40's old private enum. Allow memory-to-memory directions in the
validator so checking the generated configuration does not reject all
memcpy channels.
Validate the generated memcpy configuration before deriving logical
channel registers or allocating the channel.
Fixes: 2c2b62d5d911 ("dmaengine: ste_dma40: Replace ST-E's home-brew DMA direction defs with generic ones")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-24-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 14d36b9dca5c5..9276ac7f63eb4 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1857,7 +1857,8 @@ static int d40_validate_conf(struct d40_chan *d40c,
d40c->base->gen_dmac.num_event_groups)
invalid_dev_type = true;
- if (!conf->dir) {
+ if (conf->dir != DMA_MEM_TO_MEM &&
+ !is_slave_direction(conf->dir)) {
chan_err(d40c, "Invalid direction.\n");
res = -EINVAL;
}
@@ -2152,11 +2153,16 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
static int d40_config_memcpy(struct d40_chan *d40c)
{
dma_cap_mask_t cap = d40c->chan.device->cap_mask;
+ int ret;
if (dma_has_cap(DMA_MEMCPY, cap) && !dma_has_cap(DMA_SLAVE, cap)) {
d40c->dma_cfg = dma40_memcpy_conf_log;
d40c->dma_cfg.dev_type = dma40_memcpy_channels[d40c->chan.chan_id];
+ ret = d40_validate_conf(d40c, &d40c->dma_cfg);
+ if (ret)
+ return ret;
+
d40_log_cfg(&d40c->dma_cfg,
&d40c->log_def.lcsp1, &d40c->log_def.lcsp3);
@@ -2164,6 +2170,10 @@ static int d40_config_memcpy(struct d40_chan *d40c)
dma_has_cap(DMA_SLAVE, cap)) {
d40c->dma_cfg = dma40_memcpy_conf_phy;
+ ret = d40_validate_conf(d40c, &d40c->dma_cfg);
+ if (ret)
+ return ret;
+
/* Generate interrupt at end of transfer or relink. */
d40c->dst_def_cfg |= BIT(D40_SREG_CFG_TIM_POS);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0349/1059] pNFS/flexfiles: honor FF_FLAGS_NO_IO_THRU_MDS over the mdsthreshold hint
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (347 preceding siblings ...)
2026-12-04 9:57 ` [PATCH 6.1 0348/1059] dmaengine: ste_dma40: Validate memcpy configuration Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0350/1059] pNFS/flexfiles: dont read through MDS when previous layout forbid it Greg Kroah-Hartman
` (649 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Snitzer, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <snitzer@kernel.org>
[ Upstream commit 78422f623c1e150e3cdfe62598c6e352a2dcfc5f ]
A flexfiles layout may carry FF_FLAGS_NO_IO_THRU_MDS, which tells the
client that this file's data must not be read or written through the
metadata server.
The RFC 5661 mdsthreshold hint pulls the other way. When a server returns
one, pnfs_within_mdsthreshold() answers "use MDS I/O" for every I/O below
the threshold, pnfs_update_layout() then hands back no segment, and
ff_layout_pg_init_read() reads through the MDS - the very thing the
layout forbids. A server that sets both is asking for two incompatible
things; the layout flag is the stronger statement, and the one whose
violation the client cannot recover from.
Record the policy on the inode, where it outlives the layout hdr that
carried it, and consult it before the hint:
- ff_layout_alloc_lseg() sets NFS_INO_NO_IO_THRU_MDS beside the existing
sticky hdr-level NFS4_FF_HDR_NO_IO_THRU_MDS bit.
- pnfs_within_mdsthreshold() returns false at once for such an inode, so
no I/O is diverted to the MDS on the strength of the hint.
The bit is never cleared for the life of the in-core inode. Servers are
assumed to be consistent in their no-fallback policy per file, which is
the assumption ff_layout_hdr_no_fallback_to_mds() already makes; a server
that was not would lose the effect of its mdsthreshold hint - a SHOULD -
on an inode that is already in core, and nothing else.
Fixes: 260074cd8413 ("pNFS/flexfiles: Add support for FF_FLAGS_NO_IO_THRU_MDS")
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
[ sashal: Omitted the nfs_file_block_o_direct() context in internal.h, since that helper is missing here, so the new bit and helpers are inserted before the NFS_PATH_CANONICAL define instead. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 5 ++++-
fs/nfs/internal.h | 29 ++++++++++++++++++++++++++
fs/nfs/pnfs.c | 12 ++++++++++-
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 8e9d523bcb6a9..79b1210986ab3 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -539,9 +539,12 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
if (!p)
goto out_sort_mirrors;
fls->flags = be32_to_cpup(p);
- if (fls->flags & FF_FLAGS_NO_IO_THRU_MDS)
+ if (fls->flags & FF_FLAGS_NO_IO_THRU_MDS) {
set_bit(NFS4_FF_HDR_NO_IO_THRU_MDS,
&FF_LAYOUT_FROM_HDR(lh)->flags);
+ /* Outlives this layout hdr; see NFS_INO_NO_IO_THRU_MDS */
+ nfs_set_no_io_thru_mds(lh->plh_inode);
+ }
p = xdr_inline_decode(&stream, 4);
if (!p)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 87f16510777ec..d71098bb69e17 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -464,6 +464,35 @@ static inline bool nfs_file_io_is_buffered(struct nfs_inode *nfsi)
return test_bit(NFS_INO_ODIRECT, &nfsi->flags) == 0;
}
+/*
+ * Module-private nfs_inode->flags bit (not in <linux/nfs_fs.h>, so no
+ * exported layout changes): set, and never cleared for the life of the
+ * in-core inode, once a layout driver has seen the server forbid I/O
+ * through the MDS for this file (flexfiles sets it from
+ * FF_FLAGS_NO_IO_THRU_MDS in ff_layout_alloc_lseg()). The RFC 5661
+ * mdsthreshold hint must not be acted on for such a file, since the only
+ * thing pnfs_within_mdsthreshold() can ask for is the one thing the
+ * layout forbids. Servers are assumed to be consistent in their
+ * no-fallback policy per file, the same assumption
+ * ff_layout_hdr_no_fallback_to_mds() already makes; if one were not, the
+ * only effect is that its mdsthreshold hint - a SHOULD - stops being
+ * honored for an inode that is already in core.
+ */
+#define NFS_INO_NO_IO_THRU_MDS (30)
+
+static inline void nfs_set_no_io_thru_mds(struct inode *inode)
+{
+ struct nfs_inode *nfsi = NFS_I(inode);
+
+ if (!test_bit(NFS_INO_NO_IO_THRU_MDS, &nfsi->flags))
+ set_bit(NFS_INO_NO_IO_THRU_MDS, &nfsi->flags);
+}
+
+static inline bool nfs_no_io_thru_mds(struct inode *inode)
+{
+ return test_bit(NFS_INO_NO_IO_THRU_MDS, &NFS_I(inode)->flags);
+}
+
/* namespace.c */
#define NFS_PATH_CANONICAL 1
extern char *nfs_path(char **p, struct dentry *dentry,
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 9e1c50e0d6a53..0e792b9e72bcc 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1870,7 +1870,9 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
* is set to IOMODE_READ for a READ request, and set to IOMODE_RW for a
* WRITE request.
*
- * A return of true means use MDS I/O.
+ * A return of true means use MDS I/O, so for a file whose layout forbids
+ * that (see NFS_INO_NO_IO_THRU_MDS) the hint is not evaluated at all:
+ * there is no answer it could give that this client may act on.
*
* From rfc 5661:
* If a file's size is smaller than the file size threshold, data accesses
@@ -1891,6 +1893,14 @@ static bool pnfs_within_mdsthreshold(struct nfs_open_context *ctx,
if (t == NULL)
return ret;
+ /*
+ * The server has told a layout driver that this file's I/O may not
+ * go through the MDS (flexfiles FF_FLAGS_NO_IO_THRU_MDS). Honor
+ * that over its own mdsthreshold hint.
+ */
+ if (nfs_no_io_thru_mds(ino))
+ return ret;
+
dprintk("%s bm=0x%x rd_sz=%llu wr_sz=%llu rd_io=%llu wr_io=%llu\n",
__func__, t->bm, t->rd_sz, t->wr_sz, t->rd_io_sz, t->wr_io_sz);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0350/1059] pNFS/flexfiles: dont read through MDS when previous layout forbid it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (348 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0349/1059] pNFS/flexfiles: honor FF_FLAGS_NO_IO_THRU_MDS over the mdsthreshold hint Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0351/1059] pNFS/flexfiles: dont reset to MDS for v4 error " Greg Kroah-Hartman
` (648 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Snitzer, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <snitzer@kernel.org>
[ Upstream commit 2f007ba074ad77e70d941e16956d1937dc3080c6 ]
ff_layout_pg_init_read() falls back to the MDS whenever
pnfs_update_layout() returns no segment and no error: a bulk
CB_LAYOUTRECALL (FSID, DEVICEID or ALL), LAYOUTGETs blocked behind a
layout being returned, or a LAYOUTGET refused with
NFS4ERR_LAYOUTUNAVAILABLE or NFS4ERR_TOOSMALL, which set the per-iomode
fail bit for PNFS_LAYOUTGET_RETRY_TIMEOUT. That is the read-side twin
of the write path fixed by commit 1d62e659c0bf ("NFSv4/flexfiles:
honor FF_FLAGS_NO_IO_THRU_MDS in pg_get_mirror_count_write"), and it
is reached in exactly the situation that matters most: the file had a
valid layout, the layout had to go back, and the next one has not
arrived yet.
The write side could answer -EAGAIN because writeback owns the retry and
redirties the page. A read has no such owner, so -EAGAIN here would
surface as an I/O error to the application. Wait for a layout instead,
on the same terms the function already uses when the layout lookup
itself returns -EAGAIN: sleep a second and retry, bounded by
pg_maxretrans, which ff_layout_pg_init_read() sets only for soft and
softerr mounts. A hard mount therefore waits, which is what a hard
mount is for, and matches what the FF_FLAGS_NO_IO_THRU_MDS check on the
data server selection a few lines above already does. That includes
waiting out NFS4ERR_LAYOUTUNAVAILABLE: a file that was given a layout
with this flag must not be read off the MDS, whatever the server says
afterwards.
The test asks the inode (NFS_INO_NO_IO_THRU_MDS) rather than the layout
hdr, because in this path there is no segment, and the hdr that carried
the flag may already have been destroyed. Where a segment is in hand -
the data server selection above, ff_layout_read_pagelist() - the
existing per-segment ff_layout_no_fallback_to_mds() test stays, since it
is the more precise question.
Fixes: 260074cd8413 ("pNFS/flexfiles: Add support for FF_FLAGS_NO_IO_THRU_MDS")
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 38 ++++++++++++++++++--------
1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 79b1210986ab3..a15014d228321 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -891,19 +891,33 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
if (pgio->pg_error < 0) {
if (pgio->pg_error != -EAGAIN)
return;
- /* Retry getting layout segment if lower layer returned -EAGAIN */
- if (pgio->pg_maxretrans && req->wb_nio++ > pgio->pg_maxretrans) {
- if (NFS_SERVER(pgio->pg_inode)->flags & NFS_MOUNT_SOFTERR)
- pgio->pg_error = -ETIMEDOUT;
- else
- pgio->pg_error = -EIO;
- return;
- }
- pgio->pg_error = 0;
- /* Sleep for 1 second before retrying */
- ssleep(1);
- goto retry;
+ goto retry_nolseg;
+ }
+ /*
+ * No segment, and no error to report either: pnfs_update_layout()
+ * simply has nothing to give (NFS_LAYOUT_BULK_RECALL, a failed
+ * pnfs_layout_io_test, blocked LAYOUTGETs, a layout being
+ * returned). If the server forbids reading this file through the
+ * MDS there is no fallback to take, so wait for a layout on the
+ * same terms as the -EAGAIN above. The layout hdr that carried
+ * FF_FLAGS_NO_IO_THRU_MDS may itself be gone by now, which is why
+ * this asks the inode and not the hdr.
+ */
+ if (!nfs_no_io_thru_mds(pgio->pg_inode))
+ goto out_mds;
+retry_nolseg:
+ /* Retry getting layout segment if lower layer returned -EAGAIN */
+ if (pgio->pg_maxretrans && req->wb_nio++ > pgio->pg_maxretrans) {
+ if (NFS_SERVER(pgio->pg_inode)->flags & NFS_MOUNT_SOFTERR)
+ pgio->pg_error = -ETIMEDOUT;
+ else
+ pgio->pg_error = -EIO;
+ return;
}
+ pgio->pg_error = 0;
+ /* Sleep for 1 second before retrying */
+ ssleep(1);
+ goto retry;
out_mds:
trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode,
0, NFS4_MAX_UINT64, IOMODE_READ,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0351/1059] pNFS/flexfiles: dont reset to MDS for v4 error when previous layout forbid it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (349 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0350/1059] pNFS/flexfiles: dont read through MDS when previous layout forbid it Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0352/1059] ipv4: reserve one IP ID per segment for UDP GSO packets Greg Kroah-Hartman
` (647 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Snitzer, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <snitzer@kernel.org>
[ Upstream commit ec906cf7bee60f3bbc8500bac14e65813e38ac93 ]
ff_layout_async_handle_error_v4() ends in -NFS4ERR_RESET_TO_MDS, which
makes ff_layout_read_release() / ff_layout_write_release() call
ff_layout_reset_read() or ff_layout_reset_write(hdr, false), and those
call pnfs_read_done_resend_to_mds() / pnfs_write_done_resend_to_mds().
Those build a page I/O descriptor with force_mds set, so the flexfiles
->pg_init() never runs and no layout is consulted anywhere on the way:
the READ or WRITE goes to the metadata server unconditionally. For a
layout carrying FF_FLAGS_NO_IO_THRU_MDS that is exactly what the server
forbade.
The fall-through into reset: is already safe, because
ff_layout_avoid_mds_available_ds() returns true for a segment with the
flag and so answers -NFS4ERR_RESET_TO_PNFS first. What is not safe is
the goto: the invalid-layout errors (NFS4ERR_PNFS_NO_LAYOUT, STALE,
BADHANDLE, ISDIR, FHEXPIRED, WRONG_TYPE) call pnfs_destroy_layout() and
jump straight to reset:, over that check. That is the case where the
file had a perfectly good layout, something forced it to be given back,
and the client answers by writing to the MDS behind the server's back.
Test at reset: itself, so it covers the goto and any future one, and ask
the inode (NFS_INO_NO_IO_THRU_MDS): the callers that jump here have just
destroyed the layout hdr, so the hdr-level flag is no longer reachable,
while the inode-level one is set for the life of the in-core inode.
-NFS4ERR_RESET_TO_PNFS is the right answer rather than an error. It is
what the fall-through already returns for the same flag, and the
resends it drives - ff_layout_resend_pnfs_read() and
ff_layout_reset_write(hdr, true) - re-enter the pgio path with force_mds
clear, so a fresh LAYOUTGET is taken, which is precisely what a
destroyed layout needs. A LAYOUTGET that fails fatally makes
pnfs_update_layout() return an error, which ->pg_init() reports; a
non-fatal refusal (NFS4ERR_LAYOUTUNAVAILABLE, NFS4ERR_TOOSMALL) returns
no segment instead, and the client keeps retrying through pNFS rather
than falling back.
ff_layout_async_handle_error_v3() needs no such change: it returns only
-NFS4ERR_RESET_TO_PNFS or -EAGAIN.
Fixes: 260074cd8413 ("pNFS/flexfiles: Add support for FF_FLAGS_NO_IO_THRU_MDS")
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index a15014d228321..60f3fc26f0385 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1223,6 +1223,23 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
if (ff_layout_avoid_mds_available_ds(lseg))
return -NFS4ERR_RESET_TO_PNFS;
reset:
+ /*
+ * FF_FLAGS_NO_IO_THRU_MDS: never resend through the MDS. The
+ * caller would do so with force_mds set (ff_layout_reset_read(),
+ * ff_layout_reset_write(hdr, false) -> pnfs_*_done_resend_to_mds()),
+ * which builds a descriptor out of the plain MDS page ops and so
+ * consults no layout at all -- this is the last point at which the
+ * policy can still be applied. Retry through pNFS instead, which
+ * takes a fresh LAYOUTGET; that is also the right answer for the
+ * invalid-layout cases that jump here, since they have just called
+ * pnfs_destroy_layout(). Having done so they can no longer ask the
+ * layout hdr about the flag, hence the inode.
+ */
+ if (nfs_no_io_thru_mds(inode)) {
+ dprintk("%s Retry through pNFS, no MDS fallback. Error %d\n",
+ __func__, task->tk_status);
+ return -NFS4ERR_RESET_TO_PNFS;
+ }
dprintk("%s Retry through MDS. Error %d\n", __func__,
task->tk_status);
return -NFS4ERR_RESET_TO_MDS;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0352/1059] ipv4: reserve one IP ID per segment for UDP GSO packets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (350 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0351/1059] pNFS/flexfiles: dont reset to MDS for v4 error " Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0353/1059] proc: report SIGEV_NONE in /proc/pid/timers if target task has died Greg Kroah-Hartman
` (646 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jiayuan Chen,
Willem de Bruijn, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 852c08d6a99149dc71c51cea125b5083f555237e ]
__ip_make_skb() reserves a single IP ID for UDP GSO packets, but GSO
assigns one IP ID per segment. Following packets then reuse these IDs,
either from inet->inet_id or from the shared generator.
Unless IP_PMTUDISC_DO/PROBE is used, DF is not set on UDP GSO packets,
so segments can be fragmented on the path and IP ID reuse can lead to
incorrect reassembly.
Reserve one IP ID per segment, using the same test as udp_send_skb().
Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: Willem de Bruijn <willemb@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260930144018.1174068-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adjusted context in one hunk because the older tree lacks the pmtudisc local, so __u8 ttl; replaces u8 pmtudisc, ttl; in the declarations. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/ip_output.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index da0707f5fb8bd..588f0a96ad306 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1519,6 +1519,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
struct iphdr *iph;
__be16 df = 0;
__u8 ttl;
+ int segs;
skb = __skb_dequeue(queue);
if (!skb)
@@ -1572,7 +1573,19 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
iph->ttl = ttl;
iph->protocol = sk->sk_protocol;
ip_copy_addrs(iph, fl4);
- ip_select_ident(net, skb, sk);
+
+ /* UDP GSO packets are segmented later (see udp_send_skb()):
+ * reserve one IP ID per segment.
+ */
+ segs = 1;
+ if (cork->gso_size && sk_is_udp(sk)) {
+ int datalen = skb->len - skb_transport_offset(skb) -
+ sizeof(struct udphdr);
+
+ if (datalen > cork->gso_size)
+ segs = DIV_ROUND_UP(datalen, cork->gso_size);
+ }
+ ip_select_ident_segs(net, skb, sk, segs);
if (opt) {
iph->ihl += opt->optlen >> 2;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0353/1059] proc: report SIGEV_NONE in /proc/pid/timers if target task has died
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (351 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0352/1059] ipv4: reserve one IP ID per segment for UDP GSO packets Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0354/1059] wifi: mt76: mt7915: unregister thermal cooling device on hwmon failure Greg Kroah-Hartman
` (645 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrei Vagin, Andrew Morton,
Pavel Tikhomirov, Thomas Gleixner, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Vagin <avagin@google.com>
[ Upstream commit 0a27f795030ce6a2c71525b0544e3b13bba8828e ]
When a posix timer is created targeting a specific thread (using
SIGEV_SIGNAL | SIGEV_THREAD_ID), it takes a reference to the target struct
pid in timer->it_pid. If the target thread subsequently terminates, its
numeric tid is freed and can be recycled for an unrelated task. However,
the timer holds its reference to the original struct pid.
show_timer() in /proc/[pid]/timers previously called pid_nr_ns() directly
on timer->it_pid without checking whether any task remained attached to
that struct pid. As a result:
1. It reported the stale tid, which could mistakenly refer to a recycled
pid.
2. In the kernel, expired signals for dead target threads are dropped by
posixtimer_send_sigqueue() because posixtimer_get_target() returns
NULL, so the timer functionally acts as SIGEV_NONE.
3. Checkpoint/restore tools (CRIU) parsing /proc/[pid]/timers would try
to restore a timer with SIGEV_SIGNAL | SIGEV_THREAD_ID targeting a
non-existent or unrelated thread.
Check pid_has_task(timer->it_pid, timer->it_pid_type) in show_timer(). If
the target task has died, override notify to SIGEV_NONE and report PID 0
(e.g., 'notify: none/pid.0').
Link: https://lore.kernel.org/20260816161216.984580-1-avagin@google.com
Fixes: 57b8015e07a7 ("posix-timers: Show sigevent info in proc file")
Signed-off-by: Andrei Vagin <avagin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[ sashal: Replaced timer->it_pid_type with a type computed from the notify flags (PIDTYPE_PID if SIGEV_THREAD_ID, else PIDTYPE_TGID), and dropped the it_lock guard and posixtimer_valid() check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/proc/base.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 6f24023b64f31..a3f54e13e618f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2529,6 +2529,7 @@ static int show_timer(struct seq_file *m, void *v)
struct k_itimer *timer;
struct timers_private *tp = m->private;
int notify;
+ pid_t nr = 0;
static const char * const nstr[] = {
[SIGEV_SIGNAL] = "signal",
[SIGEV_NONE] = "none",
@@ -2538,6 +2539,13 @@ static int show_timer(struct seq_file *m, void *v)
timer = list_entry((struct list_head *)v, struct k_itimer, list);
notify = timer->it_sigev_notify;
+ if (timer->it_pid &&
+ pid_has_task(timer->it_pid,
+ (notify & SIGEV_THREAD_ID) ? PIDTYPE_PID : PIDTYPE_TGID))
+ nr = pid_nr_ns(timer->it_pid, tp->ns);
+ else
+ notify = SIGEV_NONE;
+
seq_printf(m, "ID: %d\n", timer->it_id);
seq_printf(m, "signal: %d/%px\n",
timer->sigq->info.si_signo,
@@ -2545,7 +2553,7 @@ static int show_timer(struct seq_file *m, void *v)
seq_printf(m, "notify: %s/%s.%d\n",
nstr[notify & ~SIGEV_THREAD_ID],
(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
- pid_nr_ns(timer->it_pid, tp->ns));
+ nr);
seq_printf(m, "ClockID: %d\n", timer->it_clock);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0354/1059] wifi: mt76: mt7915: unregister thermal cooling device on hwmon failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (352 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0353/1059] proc: report SIGEV_NONE in /proc/pid/timers if target task has died Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0355/1059] wifi: mt76: mt7915: guard firmware memory dump write on disabled memdump Greg Kroah-Hartman
` (644 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Felix Fietkau, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <nbd@nbd.name>
[ Upstream commit b8286bc7fe520e7117e7b6e1a1fd4c0df439aa3a ]
mt7915_thermal_init() registered the thermal cooling device and its sysfs
link, then returned the hwmon registration error without undoing them.
The cooling device (not devm-managed) and the link then leaked, and its
callbacks referenced the freed phy. Unregister the cooling device before
returning the error.
Fixes: 0ae3ff568451 ("mt76: mt7915: fix hwmon temp sensor mem use-after-free")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Added mt7915_unregister_thermal(phy) to the existing IS_ERR(hwmon) check, since the surrounding throttle_temp initialisation meant the upstream return lines had no context to match. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index cd9bf39861158..cbe3780474249 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -194,8 +194,10 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy,
mt7915_hwmon_groups);
- if (IS_ERR(hwmon))
+ if (IS_ERR(hwmon)) {
+ mt7915_unregister_thermal(phy);
return PTR_ERR(hwmon);
+ }
/* initialize critical/maximum high temperature */
phy->throttle_temp[0] = 110;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0355/1059] wifi: mt76: mt7915: guard firmware memory dump write on disabled memdump
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (353 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0354/1059] wifi: mt76: mt7915: unregister thermal cooling device on hwmon failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0356/1059] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path Greg Kroah-Hartman
` (643 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Felix Fietkau, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <nbd@nbd.name>
[ Upstream commit decf5142c2d4c295684da8644d4cb93dcf956c5d ]
mt7915_coredump_build()/mt7996_coredump_build() wrote dump_mem->len
unconditionally, but the allocation only reserves room for the memory
dump header when coredump_memdump is enabled and memdump_buf_len is
non-zero. In the default configuration the allocation ends right after
the fixed header, so the write landed one struct past the buffer. Only
populate the memory-dump section when it was actually allocated.
Fixes: 4dbcb9125cc3 ("wifi: mt76: mt7915: enable coredump support")
Fixes: 878161d5d4a4 ("wifi: mt76: mt7996: enable coredump support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Dropped the mt7996 hunk because that driver doesn't exist in this tree, and the mt7915 hunk applies unchanged apart from a one-line context offset. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7915/coredump.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c b/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c
index d097a56dd33d1..ee2b454ed1860 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c
@@ -344,11 +344,12 @@ static struct mt7915_coredump *mt7915_coredump_build(struct mt7915_dev *dev)
mt7915_coredump_fw_stack(dev, dump, exception);
/* gather memory content */
- dump_mem = (struct mt7915_coredump_mem *)(buf + sofar);
- dump_mem->len = crash_data->memdump_buf_len;
- if (coredump_memdump && crash_data->memdump_buf_len)
+ if (coredump_memdump && crash_data->memdump_buf_len) {
+ dump_mem = (struct mt7915_coredump_mem *)(buf + sofar);
+ dump_mem->len = crash_data->memdump_buf_len;
memcpy(dump_mem->data, crash_data->memdump_buf,
crash_data->memdump_buf_len);
+ }
mutex_unlock(&dev->dump_mutex);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0356/1059] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (354 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0355/1059] wifi: mt76: mt7915: guard firmware memory dump write on disabled memdump Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0357/1059] wifi: mt76: fix wcid->pktid corruption in mt76_wcid_cleanup() Greg Kroah-Hartman
` (642 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, moosager, Devin Wittmayer,
Felix Fietkau, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devin Wittmayer <lucid_duck@justthetip.ca>
[ Upstream commit 75673ab3c0e4186628e0a76b94443cddfbeca255 ]
mt7921e_mac_reset() ignores the return value of
mt792xe_mcu_drv_pmctrl(). When the driver-own handshake fails,
__mt792xe_mcu_drv_pmctrl() returns -EIO without reinitialising WPDMA or
clearing MT76_STATE_PM, and the reset carries on: it writes the
interrupt enable registers, cycles NAPI, resets WPDMA and downloads
firmware to a chip the driver does not own.
Return the error instead. The call is the first statement in the
function, before any teardown, so nothing needs unwinding.
Reported-by: moosager <moosager90@gmail.com>
Link: https://lore.kernel.org/linux-wireless/anG46qbvCqCHGF-f@fedora.fritz.box/
Fixes: dfc7743de1eb ("mt76: mt7921: refactor mcu.c to be bus independent")
Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
Tested-by: moosager <moosager90@gmail.com>
Link: https://patch.msgid.link/20260809012309.43657-1-lucid_duck@justthetip.ca
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Adapted the call to the older name mt7921e_mcu_drv_pmctrl() because this tree predates the rename to mt792xe_mcu_drv_pmctrl(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
index cb20ddcad137c..120cc08ae7b44 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
@@ -71,7 +71,9 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
{
int i, err;
- mt7921e_mcu_drv_pmctrl(dev);
+ err = mt7921e_mcu_drv_pmctrl(dev);
+ if (err)
+ return err;
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0357/1059] wifi: mt76: fix wcid->pktid corruption in mt76_wcid_cleanup()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (355 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0356/1059] wifi: mt76: mt7921: check drv_pmctrl return in the PCIe reset path Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0358/1059] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class Greg Kroah-Hartman
` (641 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ryan Leung, Felix Fietkau,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Leung <untilscour@protonmail.com>
[ Upstream commit 158c1145fe7ddd82914011a00de7cc3262616b16 ]
mt76_wcid_cleanup() releases dev->status_lock before calling
idr_destroy(&wcid->pktid) to tear down the pktid idr. Meanwhile,
mt76_tx_status_skb_add() from tx.c can concurrently insert into
that same idr during tx completion handling:
spin_lock_bh(&dev->status_lock);
pid = idr_alloc(&wcid->pktid, skb, MT_PACKET_ID_FIRST,
MT_PACKET_ID_MASK, GFP_ATOMIC);
Since idr_destroy() runs outside the lock, it can execute concurrently
with idr_alloc() on the same idr, corrupting its internal data
structures. Because idr nodes are freed through the generic slab
allocator, this corruption can resurface later as an unrelated-looking
crash anywhere in the kernel that happens to reuse the same freed
memory.
Fix this by calling idr_destroy() before releasing dev->status_lock,
so that the table teardown and any concurrent insertion are mutually
exclusive.
Closes: https://github.com/openwrt/openwrt/issues/24594
Fixes: bd1e3e7b693c ("mt76: introduce packet_id idr")
Signed-off-by: Ryan Leung <untilscour@protonmail.com>
Link: https://patch.msgid.link/20260820-mt76-pktid-idr-race-v1-1-451f176a6495@protonmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Moved idr_destroy(&wcid->pktid) inside the status lock in mt76_packet_id_flush() in mt76.h, since the upstream function mt76_wcid_cleanup() doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt76.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 6bae36e4f25a7..e6a4bea9f2e3c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -1452,9 +1452,8 @@ mt76_packet_id_flush(struct mt76_dev *dev, struct mt76_wcid *wcid)
mt76_tx_status_lock(dev, &list);
mt76_tx_status_skb_get(dev, wcid, -1, &list);
- mt76_tx_status_unlock(dev, &list);
-
idr_destroy(&wcid->pktid);
+ mt76_tx_status_unlock(dev, &list);
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0358/1059] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (356 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0357/1059] wifi: mt76: fix wcid->pktid corruption in mt76_wcid_cleanup() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0359/1059] drm/amd/display: copy function name into dcn_fpu trace event Greg Kroah-Hartman
` (640 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melissa Wen, Tvrtko Ursulin,
Dan Wheeler, Roman Li, Alex Deucher, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <mwen@igalia.com>
[ Upstream commit 6c4f8c5cc00326f6c709bff0d640d504c90862ca ]
Don't create an amdgpu_dm_atomic_state_template event since this is just
a template. Declare the template as an event class that will be used by
actual event tracers.
Fixes: e8a982355f96 ("drm/amd/display: Add tracepoint for amdgpu_dm")
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ sashal: Changed struct drm_atomic_commit to struct drm_atomic_state in TP_PROTO and __field, since this tree predates the upstream rename. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../amd/display/amdgpu_dm/amdgpu_dm_trace.h | 56 +++++++++----------
1 file changed, 26 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
index 7bc89954882ff..8d3c7e4d593cf 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
@@ -309,36 +309,32 @@ DEFINE_EVENT(amdgpu_dm_plane_state_template, amdgpu_dm_atomic_update_cursor,
TP_PROTO(const struct drm_plane_state *state),
TP_ARGS(state));
-TRACE_EVENT(amdgpu_dm_atomic_state_template,
- TP_PROTO(const struct drm_atomic_state *state),
- TP_ARGS(state),
-
- TP_STRUCT__entry(
- __field(const struct drm_atomic_state *, state)
- __field(bool, allow_modeset)
- __field(bool, legacy_cursor_update)
- __field(bool, async_update)
- __field(bool, duplicated)
- __field(int, num_connector)
- __field(int, num_private_objs)
- ),
-
- TP_fast_assign(
- __entry->state = state;
- __entry->allow_modeset = state->allow_modeset;
- __entry->legacy_cursor_update = state->legacy_cursor_update;
- __entry->async_update = state->async_update;
- __entry->duplicated = state->duplicated;
- __entry->num_connector = state->num_connector;
- __entry->num_private_objs = state->num_private_objs;
- ),
-
- TP_printk("state=%p allow_modeset=%d legacy_cursor_update=%d "
- "async_update=%d duplicated=%d num_connector=%d "
- "num_private_objs=%d",
- __entry->state, __entry->allow_modeset, __entry->legacy_cursor_update,
- __entry->async_update, __entry->duplicated, __entry->num_connector,
- __entry->num_private_objs)
+DECLARE_EVENT_CLASS(amdgpu_dm_atomic_state_template,
+ TP_PROTO(const struct drm_atomic_state *state),
+ TP_ARGS(state),
+ TP_STRUCT__entry(__field(const struct drm_atomic_state *, state)
+ __field(bool, allow_modeset)
+ __field(bool, legacy_cursor_update)
+ __field(bool, async_update)
+ __field(bool, duplicated)
+ __field(int, num_connector)
+ __field(int, num_private_objs)
+ ),
+ TP_fast_assign(__entry->state = state;
+ __entry->allow_modeset = state->allow_modeset;
+ __entry->legacy_cursor_update = state->legacy_cursor_update;
+ __entry->async_update = state->async_update;
+ __entry->duplicated = state->duplicated;
+ __entry->num_connector = state->num_connector;
+ __entry->num_private_objs = state->num_private_objs;
+ ),
+ TP_printk("state=%p allow_modeset=%d legacy_cursor_update=%d "
+ "async_update=%d duplicated=%d num_connector=%d "
+ "num_private_objs=%d",
+ __entry->state, __entry->allow_modeset,
+ __entry->legacy_cursor_update, __entry->async_update,
+ __entry->duplicated, __entry->num_connector,
+ __entry->num_private_objs)
);
DEFINE_EVENT(amdgpu_dm_atomic_state_template, amdgpu_dm_atomic_commit_tail_begin,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0359/1059] drm/amd/display: copy function name into dcn_fpu trace event
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (357 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0358/1059] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0360/1059] fs/ntfs3: check return values in indx_delete_entry() Greg Kroah-Hartman
` (639 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melissa Wen, Tvrtko Ursulin,
Dan Wheeler, Roman Li, Alex Deucher, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <mwen@igalia.com>
[ Upstream commit b4d41522012d91cd875cebdfd1a3bbb04eb863dd ]
Userspace trace tools that use libtraceevent to read binary buffer only
see a kernel address when printing const char *. Use string macros in
dcn_fpu to copy the function name into the trace event.
Fixes: 96ee63730fa3 ("drm/amd/display: Add control mechanism for FPU")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ sashal: Changed __assign_str(function) to the two-argument __assign_str(function, function), because this tree's trace macro takes both a destination and a source. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
index 8d3c7e4d593cf..5f50861c0fb88 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
@@ -636,20 +636,20 @@ TRACE_EVENT(dcn_fpu,
TP_STRUCT__entry(
__field(bool, begin)
- __field(const char *, function)
+ __string(function, function)
__field(int, line)
__field(int, recursion_depth)
),
TP_fast_assign(
__entry->begin = begin;
- __entry->function = function;
+ __assign_str(function, function);
__entry->line = line;
__entry->recursion_depth = recursion_depth;
),
TP_printk("%s: recursion_depth: %d: %s()+%d:",
__entry->begin ? "begin" : "end",
__entry->recursion_depth,
- __entry->function,
+ __get_str(function),
__entry->line
)
);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0360/1059] fs/ntfs3: check return values in indx_delete_entry()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (358 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0359/1059] drm/amd/display: copy function name into dcn_fpu trace event Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0361/1059] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path Greg Kroah-Hartman
` (638 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Morgun, Konstantin Komarov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Morgun <d.morgun@ispras.ru>
[ Upstream commit 131f7d7abf0f10edc6ea6b032f8a3908bdb13ce8 ]
When the index tree collapses down to an empty root,
indx_delete_entry() calls attr_set_size() and ni_remove_attr() for
both ATTR_ALLOC and ATTR_BITMAP, but their return values are
overwritten by the following call without being checked.
In most other call sites of these functions the return value is
checked, so add the same checks here in case an error at this point
is meaningful.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dmitry Morgun <d.morgun@ispras.ru>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
[ sashal: Added four error checks after the attr_set_size/ni_remove_attr calls in the index collapse path, passing an extra NULL argument to attr_set_size() for the older signature and omitting the missing i_size_write context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ntfs3/index.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 05e4c2fee712d..18620b37e69e4 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -2684,15 +2684,25 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len,
&indx->alloc_run, 0, NULL, false, NULL);
+ if (err)
+ goto out;
+
err = ni_remove_attr(ni, ATTR_ALLOC, in->name, in->name_len,
false, NULL);
run_close(&indx->alloc_run);
+ if (err)
+ goto out;
err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len,
&indx->bitmap_run, 0, NULL, false, NULL);
+ if (err)
+ goto out;
+
err = ni_remove_attr(ni, ATTR_BITMAP, in->name, in->name_len,
false, NULL);
run_close(&indx->bitmap_run);
+ if (err)
+ goto out;
root = indx_get_root(indx, ni, &attr, &mi);
if (!root) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0361/1059] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (359 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0360/1059] fs/ntfs3: check return values in indx_delete_entry() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0362/1059] ALSA: hda: Use linked list for jack table Greg Kroah-Hartman
` (637 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 237782c3d416b392a12642f32959e9d3c94e0c26 ]
tx_coal_frames[] is written by ethtool (stmmac_set_coalesce) and read
locklessly from the TX fast path (stmmac_xmit, stmmac_tso_xmit,
stmmac_xdp_xmit_zc and stmmac_xdp_xmit_xdpf), so pair every access
with READ_ONCE()/WRITE_ONCE() to mark the intentional data race and
read a consistent value into a local variable.
Moreover, ethtool allows disabling TX coalescing by setting
tx_max_coalesced_frames to 0: guard the modulo operation in
stmmac_xdp_xmit_xdpf() against a zero tx_coal_frames[queue] to avoid
a division by zero.
Both issues were found by code inspection while extending the XDP TX
path with multi-buff support, and neither has ever been triggered, so
they are only theoretical. Tested on the Qualcomm RB3-gen2 board.
Fixes: db2f2842e6f5 ("net: stmmac: add per-queue TX & RX coalesce ethtool support")
Fixes: be8b38a722e6 ("net: stmmac: Add support for XDP_TX action")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261001-b4-stmmac-xmit-mb-v4-1-664e0c3eb289@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adapted declaration-block context by adding only a local tx_coal variable, since this tree's variable layout and older APIs (no sdu_len, hrtimer_init) differ from upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 11 ++---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 41 ++++++++-----------
2 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 4d40e0c8c1b36..d4e0f47d914ff 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -984,7 +984,8 @@ static int __stmmac_get_coalesce(struct net_device *dev,
if (queue < tx_cnt) {
ec->tx_coalesce_usecs = priv->tx_coal_timer[queue];
- ec->tx_max_coalesced_frames = priv->tx_coal_frames[queue];
+ ec->tx_max_coalesced_frames =
+ READ_ONCE(priv->tx_coal_frames[queue]);
} else {
ec->tx_coalesce_usecs = 0;
ec->tx_max_coalesced_frames = 0;
@@ -1073,14 +1074,14 @@ static int __stmmac_set_coalesce(struct net_device *dev,
int i;
for (i = 0; i < tx_cnt; i++) {
- priv->tx_coal_frames[i] =
- ec->tx_max_coalesced_frames;
+ WRITE_ONCE(priv->tx_coal_frames[i],
+ ec->tx_max_coalesced_frames);
priv->tx_coal_timer[i] =
ec->tx_coalesce_usecs;
}
} else if (queue < tx_cnt) {
- priv->tx_coal_frames[queue] =
- ec->tx_max_coalesced_frames;
+ WRITE_ONCE(priv->tx_coal_frames[queue],
+ ec->tx_max_coalesced_frames);
priv->tx_coal_timer[queue] =
ec->tx_coalesce_usecs;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8145518cb83a0..c469a800fabb6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2443,7 +2443,8 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
while (budget-- > 0) {
dma_addr_t dma_addr;
- bool set_ic;
+ bool set_ic = false;
+ u32 tx_coal;
/* We are sharing with slow path and stop XSK TX desc submission when
* available TX ring is less than threshold.
@@ -2485,12 +2486,9 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
tx_q->tx_count_frames++;
- if (!priv->tx_coal_frames[queue])
- set_ic = false;
- else if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0)
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
+ if (tx_coal && !(tx_q->tx_count_frames % tx_coal))
set_ic = true;
- else
- set_ic = false;
if (set_ic) {
tx_q->tx_count_frames = 0;
@@ -3053,7 +3051,7 @@ static void stmmac_init_coalesce(struct stmmac_priv *priv)
for (chan = 0; chan < tx_channel_count; chan++) {
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
- priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES;
+ WRITE_ONCE(priv->tx_coal_frames[chan], STMMAC_TX_FRAMES);
priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER;
hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
@@ -4100,7 +4098,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
bool has_vlan, set_ic;
dma_addr_t tso_des, des;
u8 proto_hdr_len, hdr;
- u32 pay_len, mss;
+ u32 tx_coal, pay_len, mss;
int i;
tx_q = &priv->dma_conf.tx_queue[queue];
@@ -4241,16 +4239,16 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
tx_packets = (tx_q->cur_tx + 1) - first_tx;
tx_q->tx_count_frames += tx_packets;
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
set_ic = true;
- else if (!priv->tx_coal_frames[queue])
+ else if (!tx_coal)
set_ic = false;
else if (!netdev_xmit_more())
set_ic = true;
- else if (tx_packets > priv->tx_coal_frames[queue])
+ else if (tx_packets > tx_coal)
set_ic = true;
- else if ((tx_q->tx_count_frames %
- priv->tx_coal_frames[queue]) < tx_packets)
+ else if ((tx_q->tx_count_frames % tx_coal) < tx_packets)
set_ic = true;
else
set_ic = false;
@@ -4382,6 +4380,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
struct dma_desc *desc, *first;
struct stmmac_tx_queue *tx_q;
bool has_vlan, set_ic;
+ u32 tx_coal;
int entry, first_tx;
dma_addr_t des;
@@ -4501,16 +4500,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
tx_packets = (entry + 1) - first_tx;
tx_q->tx_count_frames += tx_packets;
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
set_ic = true;
- else if (!priv->tx_coal_frames[queue])
+ else if (!tx_coal)
set_ic = false;
else if (!netdev_xmit_more())
set_ic = true;
- else if (tx_packets > priv->tx_coal_frames[queue])
+ else if (tx_packets > tx_coal)
set_ic = true;
- else if ((tx_q->tx_count_frames %
- priv->tx_coal_frames[queue]) < tx_packets)
+ else if ((tx_q->tx_count_frames % tx_coal) < tx_packets)
set_ic = true;
else
set_ic = false;
@@ -4781,7 +4780,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
unsigned int entry = tx_q->cur_tx;
struct dma_desc *tx_desc;
dma_addr_t dma_addr;
- bool set_ic;
+ u32 tx_coal;
if (stmmac_tx_avail(priv, queue) < STMMAC_TX_THRESH(priv))
return STMMAC_XDP_CONSUMED;
@@ -4827,12 +4826,8 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
tx_q->tx_count_frames++;
- if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0)
- set_ic = true;
- else
- set_ic = false;
-
- if (set_ic) {
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
+ if (tx_coal && !(tx_q->tx_count_frames % tx_coal)) {
tx_q->tx_count_frames = 0;
stmmac_set_tx_ic(priv, tx_desc);
u64_stats_update_begin(&txq_stats->q_syncp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0362/1059] ALSA: hda: Use linked list for jack table
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (360 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0361/1059] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0363/1059] ALSA: hda: Dont free card at probe error in vga_switcheroo handler Greg Kroah-Hartman
` (636 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit 5676e013f16ac4b616d433af24647d0ce4b067aa ]
So far we've used snd_array infrastructure for managing the
hda_jack_tbl elements, but it turned out that this may lead to a UAF
when a different order of destruction procedure is applied; namely,
each hda_jack_tbl object creates a snd_jack object and sets the
private_data pointing to the hda_jack_tbl, and private_free to release
it. It looks harmless, but since snd_array may reallocate the whole
table at growing, the formerly referred jack pointer may become stale.
Fortunately, currently there is no call pattern that triggers this
issue, so it's only hypothetical, but we should address it in anyway.
There are several ways to address this, and at this time, we rather
redesign the hda_jack_tbl allocations: instead of snd_array(), do a
normal kmalloc() + linked list. There will be more kmalloc calls than
the original code, but as the number of jacks are usually at most
handful, it must not be a problem. This change allows us the
persistent jack pointer, so no stale pointer access can happen any
longer.
This also fixes another reported issue about the stale jack pointer
reference in snd_hda_jack_tbl_new(), too.
Fixes: 31ef22579302 ("ALSA: hda - Integrate input-jack stuff into kctl-jack")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007171057.7462-1-tiwai@suse.de
[ sashal: Replaced the missing kzalloc_obj() helper with kzalloc(sizeof(*jack), GFP_KERNEL), and adjusted context in hda_codec.h and the SOF hda-codec.c wake-enable code to match this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/sound/hda_codec.h | 6 ++-
sound/pci/hda/hda_codec.c | 1 -
sound/pci/hda/hda_jack.c | 79 ++++++++++++++++++---------------
sound/pci/hda/hda_jack.h | 1 +
sound/soc/sof/intel/hda-codec.c | 4 +-
5 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
index 5788cec54a378..f8192b835a46c 100644
--- a/include/sound/hda_codec.h
+++ b/include/sound/hda_codec.h
@@ -30,6 +30,7 @@ struct hda_beep;
struct hda_codec;
struct hda_pcm;
struct hda_pcm_stream;
+struct hda_jack_tbl;
/*
* codec bus
@@ -277,7 +278,8 @@ struct hda_codec {
struct hda_codec *codec, hda_nid_t nid);
/* jack detection */
- struct snd_array jacktbl;
+ struct hda_jack_tbl *jacktbl, *jacktbl_last; /* linked list head/tail */
+ int jacktbl_used; /* number of jacktbl elements */
unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
struct delayed_work jackpoll_work;
@@ -509,7 +511,7 @@ static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {}
static inline bool hda_codec_need_resume(struct hda_codec *codec)
{
- return !codec->relaxed_resume && codec->jacktbl.used;
+ return !codec->relaxed_resume && codec->jacktbl_used;
}
/*
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index a267724f631bb..0895d428e4591 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -942,7 +942,6 @@ snd_hda_codec_device_init(struct hda_bus *bus, unsigned int codec_addr,
snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);
snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16);
- snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16);
snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8);
INIT_LIST_HEAD(&codec->conn_list);
INIT_LIST_HEAD(&codec->pcm_list_head);
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index 8c25c7d81128b..1ff67f839ce43 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -70,12 +70,11 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid, int dev_id)
struct hda_jack_tbl *
snd_hda_jack_tbl_get_mst(struct hda_codec *codec, hda_nid_t nid, int dev_id)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack;
- if (!nid || !jack)
+ if (!nid)
return NULL;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->nid == nid && jack->dev_id == dev_id)
return jack;
return NULL;
@@ -92,12 +91,11 @@ struct hda_jack_tbl *
snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec,
unsigned char tag, int dev_id)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack;
- if (!tag || !jack)
+ if (!tag)
return NULL;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->tag == tag && jack->dev_id == dev_id)
return jack;
return NULL;
@@ -107,12 +105,11 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag);
static struct hda_jack_tbl *
any_jack_tbl_get_from_nid(struct hda_codec *codec, hda_nid_t nid)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack;
- if (!nid || !jack)
+ if (!nid)
return NULL;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->nid == nid)
return jack;
return NULL;
@@ -136,12 +133,19 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id)
if (jack)
return jack;
- jack = snd_array_new(&codec->jacktbl);
+ jack = kzalloc(sizeof(*jack), GFP_KERNEL);
if (!jack)
return NULL;
jack->nid = nid;
jack->dev_id = dev_id;
jack->jack_dirty = 1;
+ if (!codec->jacktbl)
+ codec->jacktbl = jack;
+ else
+ codec->jacktbl_last->next = jack;
+ codec->jacktbl_last = jack;
+ codec->jacktbl_used++;
+
if (existing_nid_jack) {
jack->tag = existing_nid_jack->tag;
@@ -152,7 +156,7 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id)
*/
jack->jack_detect = existing_nid_jack->jack_detect;
} else {
- jack->tag = codec->jacktbl.used;
+ jack->tag = codec->jacktbl_used;
}
return jack;
@@ -160,10 +164,9 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id)
void snd_hda_jack_tbl_disconnect(struct hda_codec *codec)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack;
- for (i = 0; i < codec->jacktbl.used; i++, jack++) {
+ for (jack = codec->jacktbl; jack; jack = jack->next) {
if (!codec->bus->shutdown && jack->jack)
snd_device_disconnect(codec->card, jack->jack);
}
@@ -171,22 +174,31 @@ void snd_hda_jack_tbl_disconnect(struct hda_codec *codec)
void snd_hda_jack_tbl_clear(struct hda_codec *codec)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack, *jack_next;
- for (i = 0; i < codec->jacktbl.used; i++, jack++) {
+ for (jack = codec->jacktbl; jack; jack = jack_next) {
struct hda_jack_callback *cb, *next;
- /* free jack instances manually when clearing/reconfiguring */
- if (!codec->bus->shutdown && jack->jack)
- snd_device_free(codec->card, jack->jack);
+ jack_next = jack->next;
+
+ if (jack->jack) {
+ /* fingers away from stale data */
+ jack->jack->private_data = NULL;
+ jack->jack->private_free = NULL;
+ /* free jack instances manually when clearing/reconfiguring */
+ if (!codec->bus->shutdown)
+ snd_device_free(codec->card, jack->jack);
+ }
for (cb = jack->callback; cb; cb = next) {
next = cb->next;
kfree(cb);
}
+ kfree(jack);
}
- snd_array_free(&codec->jacktbl);
+
+ codec->jacktbl = codec->jacktbl_last = NULL;
+ codec->jacktbl_used = 0;
}
#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
@@ -232,10 +244,9 @@ static void jack_detect_update(struct hda_codec *codec,
*/
void snd_hda_jack_set_dirty_all(struct hda_codec *codec)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i;
+ struct hda_jack_tbl *jack;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->nid)
jack->jack_dirty = 1;
}
@@ -472,19 +483,17 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_set_button_state);
void snd_hda_jack_report_sync(struct hda_codec *codec)
{
struct hda_jack_tbl *jack;
- int i, state;
+ int state;
/* update all jacks at first */
- jack = codec->jacktbl.list;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->nid)
jack_detect_update(codec, jack);
/* report the updated jacks; it's done after updating all jacks
* to make sure that all gating jacks properly have been set
*/
- jack = codec->jacktbl.list;
- for (i = 0; i < codec->jacktbl.used; i++, jack++)
+ for (jack = codec->jacktbl; jack; jack = jack->next)
if (jack->nid) {
if (!jack->jack || jack->block_report)
continue;
@@ -752,10 +761,10 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event);
*/
void snd_hda_jack_poll_all(struct hda_codec *codec)
{
- struct hda_jack_tbl *jack = codec->jacktbl.list;
- int i, changes = 0;
+ struct hda_jack_tbl *jack;
+ int changes = 0;
- for (i = 0; i < codec->jacktbl.used; i++, jack++) {
+ for (jack = codec->jacktbl; jack; jack = jack->next) {
unsigned int old_sense;
if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
continue;
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index ff7d289c034bf..26bfaae393568 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -44,6 +44,7 @@ struct hda_jack_tbl {
int type;
int button_state;
struct snd_jack *jack;
+ struct hda_jack_tbl *next;
};
struct hda_jack_keymap {
diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
index d156d0264a2c7..cf96a1968517f 100644
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -79,7 +79,7 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable)
if (enable) {
list_for_each_codec(codec, hbus)
- if (codec->jacktbl.used)
+ if (codec->jacktbl_used)
mask |= BIT(codec->core.addr);
}
@@ -98,7 +98,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev)
* Wake up all jack-detecting codecs regardless whether an event
* has been recorded in STATESTS
*/
- if (codec->jacktbl.used)
+ if (codec->jacktbl_used)
pm_request_resume(&codec->core.dev);
}
EXPORT_SYMBOL_NS(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0363/1059] ALSA: hda: Dont free card at probe error in vga_switcheroo handler
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (361 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0362/1059] ALSA: hda: Use linked list for jack table Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0364/1059] cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing Greg Kroah-Hartman
` (635 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit 7e1ad3c55baa80399f1727dfd2303fa4d1558d9a ]
The vga_switcheroo handler azx_vs_set_state() calls
azx_probe_contine() for enabling the audio, and if an error happens
during the probe, azx_probe_continue() releases its associated sound
card object at the error path. The card release procedure includes
the call of vga_switcheroo_unregister_client(), and this triggers the
vgasr_mutex lock again that had been already held by the caller
(vga_switcheroo_process_delayed_switch()) -- leading to a deadlock.
(Moreover, the card release will cause a potential UAF at the error
message in azx_vs_set_state() since the card object is already gone;
this was the original report by Sashiko.)
For avoiding the unneeded crash, it's better to avoid the card release
in this error path, so we make azx_probe_continue() behaving
conditionally. In return, set hda->init_failed flag, so that any
further (re-)attempts will be filtered after that point.
The check of hda->init_failed is dropped from azx_vs_can_switch().
It's because otherwise vga_switcheroo can't be switched to turn off
GPU once when a probe error happens at the audio side.
Fixes: 39173303c838 ("ALSA: hda: Free card instance properly at probe errors")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261007213728.155092-1-tiwai%40suse.de
Link: https://patch.msgid.link/20261007223448.172443-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: adjusted context for the file's old path, and changed the azx_firmware_cb() caller to pass true to azx_probe_continue() since this tree still has that callback. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/hda/hda_intel.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 64c45140e942e..f105b320567ea 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1181,7 +1181,7 @@ static const struct dev_pm_ops azx_pm = {
#endif /* CONFIG_PM */
-static int azx_probe_continue(struct azx *chip);
+static int azx_probe_continue(struct azx *chip, bool free_on_error);
#ifdef SUPPORT_VGA_SWITCHEROO
static struct pci_dev *get_bound_vga(struct pci_dev *pci);
@@ -1208,8 +1208,10 @@ static void azx_vs_set_state(struct pci_dev *pci,
if (!disabled) {
dev_info(chip->card->dev,
"Start delayed initialization\n");
- if (azx_probe_continue(chip) < 0)
+ if (azx_probe_continue(chip, false) < 0) {
+ hda->init_failed = 1;
dev_err(chip->card->dev, "initialization error\n");
+ }
}
} else {
dev_info(chip->card->dev, "%s via vga_switcheroo\n",
@@ -1248,8 +1250,6 @@ static bool azx_vs_can_switch(struct pci_dev *pci)
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
wait_for_completion(&hda->probe_wait);
- if (hda->init_failed)
- return false;
if (chip->disabled || !hda->probe_continued)
return true;
if (snd_hda_lock_devices(&chip->bus))
@@ -1743,7 +1743,7 @@ static void azx_check_snoop_available(struct azx *chip)
static void azx_probe_work(struct work_struct *work)
{
struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
- azx_probe_continue(&hda->chip);
+ azx_probe_continue(&hda->chip, true);
}
static int default_bdl_pos_adj(struct azx *chip)
@@ -2054,7 +2054,7 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
dev_err(card->dev, "Cannot load firmware, continue without patching\n");
if (!chip->disabled) {
/* continue probing */
- azx_probe_continue(chip);
+ azx_probe_continue(chip, true);
}
}
#endif
@@ -2300,7 +2300,7 @@ static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
[AZX_DRIVER_TERA] = 1,
};
-static int azx_probe_continue(struct azx *chip)
+static int azx_probe_continue(struct azx *chip, bool free_on_error)
{
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
struct hdac_bus *bus = azx_bus(chip);
@@ -2411,10 +2411,12 @@ static int azx_probe_continue(struct azx *chip)
out_free:
if (err < 0) {
- pci_set_drvdata(pci, NULL);
if (hda->vga_switcheroo_registered)
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
- snd_card_free(chip->card);
+ if (free_on_error) {
+ pci_set_drvdata(pci, NULL);
+ snd_card_free(chip->card);
+ }
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0364/1059] cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (362 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0363/1059] ALSA: hda: Dont free card at probe error in vga_switcheroo handler Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0365/1059] wifi: nl80211: reject zero RNR/MBSSID elements Greg Kroah-Hartman
` (634 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haotian Zhang, Viresh Kumar,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <vulab@iscas.ac.cn>
[ Upstream commit 6fa50b1988b8dfd2e92a9cecba073fe4347a5e23 ]
of_parse_phandle_with_args() transfers a reference to the provider node
in out_args->np, which the caller is responsible for releasing with
of_node_put(). Neither qcom_get_related_cpus() nor
qcom_cpufreq_hw_cpu_init() ever puts args.np: they only put cpu_np, which
is a different node obtained from of_cpu_device_node_get(). The
reference is therefore leaked on every successful call, and
qcom_get_related_cpus() leaks one per present CPU.
Release args.np after the parsed index has been read in both call sites.
Fixes: 2849dd8bc72b ("cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 749b60c78da5d..ba9a800e77c71 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -311,6 +311,8 @@ static void qcom_get_related_cpus(int index, struct cpumask *m)
if (index == args.args[0])
cpumask_set_cpu(cpu, m);
+
+ of_node_put(args.np);
}
}
@@ -531,6 +533,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
return ret;
index = args.args[0];
+ of_node_put(args.np);
res = platform_get_resource(pdev, IORESOURCE_MEM, index);
if (!res) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0365/1059] wifi: nl80211: reject zero RNR/MBSSID elements
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (363 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0364/1059] cpufreq: qcom-cpufreq-hw: fix device node refcount leak in phandle parsing Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0366/1059] wifi: mac80211: limit injected HT/VHT MCSes Greg Kroah-Hartman
` (633 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit c767e1173aeab7825a8dfb197041d3996db84e39 ]
That's a nonsensical configuration, and we get errors
reported further down in mac80211 for it; hostapd has
code that only adds the nested element if it'll not be
an empty list.
Remove an unnecessary NULL check while at it.
Fixes: dbbb27e183b1 ("cfg80211: support RNR for EMA AP")
Assisted-by: LLM
Link: https://patch.msgid.link/20261005224950.97db49d9d104.I5765a3310528b3d1cb1673dc90ad5ab5fc3ea571@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Kept the tree's existing kzalloc(struct_size(...), GFP_KERNEL) allocation instead of kzalloc_flex() and added the new zero-count check above it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/wireless/nl80211.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 42eeb3782c1f9..458483ab21bea 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5462,6 +5462,9 @@ nl80211_parse_mbssid_elems(struct wiphy *wiphy, struct nlattr *attrs,
num_elems++;
}
+ if (!num_elems)
+ return ERR_PTR(-EINVAL);
+
elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
if (!elems)
return ERR_PTR(-ENOMEM);
@@ -5497,6 +5500,9 @@ nl80211_parse_rnr_elems(struct wiphy *wiphy, struct nlattr *attrs,
num_elems++;
}
+ if (!num_elems)
+ return ERR_PTR(-EINVAL);
+
elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
if (!elems)
return ERR_PTR(-ENOMEM);
@@ -5645,7 +5651,8 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev,
if (IS_ERR(rnr))
return PTR_ERR(rnr);
- if (rnr && rnr->cnt < bcn->mbssid_ies->cnt) {
+ /* RNR elements are only used with MBSSID elements */
+ if (rnr->cnt < bcn->mbssid_ies->cnt) {
kfree(rnr);
return -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0366/1059] wifi: mac80211: limit injected HT/VHT MCSes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (364 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0365/1059] wifi: nl80211: reject zero RNR/MBSSID elements Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0367/1059] wifi: mac80211: fix mbssid/rnr allocation in beacon data Greg Kroah-Hartman
` (632 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit 22d8e38161c722fe6e7ffb2a4c7fadab0f111271 ]
With radiotap injection the HT/VHT MCSes can be just
about anything, but that can later get problematic.
Limit them to the rates the device reports, which is
presumably going to be a subset of what mac80211 can
do, except for HT MCS 32 which some devices report as
supported, but then TX status can't deal with it.
If it's not supported just ignore the config.
Assisted-by: LLM
Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
Fixes: 646e76bb5daf ("mac80211: parse VHT info in injected frames")
Link: https://patch.msgid.link/20261005224950.68e210b8487a.I2ee0e4664c54cf31002eb9e4f5190fd05ff4130f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Dropped the chandef argument and the antenna-reset context lines, and placed the new VHT helper after ieee80211_validate_radiotap_len() because the older tree lacks ieee80211_rate_bw_usable(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/tx.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3fa10e1d56431..6dba93bca9b8e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2131,6 +2131,27 @@ static bool ieee80211_validate_radiotap_len(struct sk_buff *skb)
return true;
}
+static bool
+ieee80211_vht_tx_rate_supported(const struct ieee80211_sta_vht_cap *vht_cap,
+ u8 mcs, u8 nss)
+{
+ u16 map = le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map);
+
+ if (!vht_cap->vht_supported)
+ return false;
+
+ switch ((map >> (2 * (nss - 1))) & 3) {
+ case IEEE80211_VHT_MCS_SUPPORT_0_7:
+ return mcs <= 7;
+ case IEEE80211_VHT_MCS_SUPPORT_0_8:
+ return mcs <= 8;
+ case IEEE80211_VHT_MCS_SUPPORT_0_9:
+ return mcs <= 9;
+ default:
+ return false;
+ }
+}
+
bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
struct net_device *dev)
{
@@ -2309,10 +2330,16 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
}
if (rate_flags & IEEE80211_TX_RC_MCS) {
- info->control.rates[0].idx = rate;
+ /* MCS 32 and up aren't handled, e.g. by TX status */
+ if (sband && sband->ht_cap.ht_supported && rate < 32 &&
+ sband->ht_cap.mcs.rx_mask[rate / 8] & BIT(rate % 8))
+ info->control.rates[0].idx = rate;
} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
- ieee80211_rate_set_vht(info->control.rates, vht_mcs,
- vht_nss);
+ if (sband &&
+ ieee80211_vht_tx_rate_supported(&sband->vht_cap,
+ vht_mcs, vht_nss))
+ ieee80211_rate_set_vht(info->control.rates,
+ vht_mcs, vht_nss);
} else if (sband) {
for (i = 0; i < sband->n_bitrates; i++) {
if (rate * 5 != sband->bitrates[i].bitrate)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0367/1059] wifi: mac80211: fix mbssid/rnr allocation in beacon data
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (365 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0366/1059] wifi: mac80211: limit injected HT/VHT MCSes Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0368/1059] fs/resctrl: Ensure default group reports tasks on monitor-only systems Greg Kroah-Hartman
` (631 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit baf0d4feed2f0fed8e045f948534a4bd43ae464e ]
These structs are placed after the tail, but that can make
them unaligned. Change the order so the structs are after
one another, and then followed by the head/tail/elements.
Assisted-by: LLM
Fixes: 2b3171c6fe0a ("mac80211: MBSSID beacon handling in AP mode")
Link: https://patch.msgid.link/20261005224950.2f554b2c7c10.Ie961eb6b1435f956446e052936258758b966c67f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Adjusted declarations to keep u32 changed and add u8 *pos, and dropped the old && guard in the old-RNR lookup since the patch moves it into the old->mbssid_ies branch. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/cfg.c | 53 +++++++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 16bd28290ae68..216e49359b9a1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1120,6 +1120,7 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
struct beacon_data *new, *old;
int new_head_len, new_tail_len;
int size, err;
+ u8 *pos;
u32 changed = BSS_CHANGED_BEACON;
struct ieee80211_bss_conf *link_conf = link->conf;
@@ -1147,20 +1148,16 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
/* new or old multiple BSSID elements? */
if (params->mbssid_ies) {
mbssid = params->mbssid_ies;
- size += struct_size(new->mbssid_ies, elem, mbssid->cnt);
- if (params->rnr_ies) {
- rnr = params->rnr_ies;
- size += struct_size(new->rnr_ies, elem, rnr->cnt);
- }
- size += ieee80211_get_mbssid_beacon_len(mbssid, rnr,
- mbssid->cnt);
+ rnr = params->rnr_ies;
} else if (old && old->mbssid_ies) {
mbssid = old->mbssid_ies;
+ rnr = old->rnr_ies;
+ }
+
+ if (mbssid) {
size += struct_size(new->mbssid_ies, elem, mbssid->cnt);
- if (old && old->rnr_ies) {
- rnr = old->rnr_ies;
+ if (rnr)
size += struct_size(new->rnr_ies, elem, rnr->cnt);
- }
size += ieee80211_get_mbssid_beacon_len(mbssid, rnr,
mbssid->cnt);
}
@@ -1172,26 +1169,38 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
/* start filling the new info now */
/*
- * pointers go into the block we allocated,
- * memory is | beacon_data | head | tail | mbssid_ies | rnr_ies
+ * pointers go into the block we allocated, the order in memory is
+ * - struct beacon_data
+ * - struct mbssid_ies (including variable array)
+ * - struct rnr_ies (including variable array)
+ * - beacon head
+ * - beacon tail
+ * - mbssid/rnr elements
+ * so that the structs (which contain pointers) are all aligned
*/
- new->head = ((u8 *) new) + sizeof(*new);
- new->tail = new->head + new_head_len;
- new->head_len = new_head_len;
- new->tail_len = new_tail_len;
- /* copy in optional mbssid_ies */
+ pos = (u8 *)(new + 1);
if (mbssid) {
- u8 *pos = new->tail + new->tail_len;
-
new->mbssid_ies = (void *)pos;
pos += struct_size(new->mbssid_ies, elem, mbssid->cnt);
- pos += ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies,
- mbssid);
if (rnr) {
new->rnr_ies = (void *)pos;
pos += struct_size(new->rnr_ies, elem, rnr->cnt);
- ieee80211_copy_rnr_beacon(pos, new->rnr_ies, rnr);
}
+ }
+
+ new->head = pos;
+ new->head_len = new_head_len;
+ pos += new_head_len;
+ new->tail = pos;
+ new->tail_len = new_tail_len;
+ pos += new_tail_len;
+
+ /* copy in optional mbssid_ies */
+ if (mbssid) {
+ pos += ieee80211_copy_mbssid_beacon(pos, new->mbssid_ies,
+ mbssid);
+ if (rnr)
+ ieee80211_copy_rnr_beacon(pos, new->rnr_ies, rnr);
/* update bssid_indicator */
link_conf->bssid_indicator =
ilog2(__roundup_pow_of_two(mbssid->cnt + 1));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0368/1059] fs/resctrl: Ensure default group reports tasks on monitor-only systems
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (366 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0367/1059] wifi: mac80211: fix mbssid/rnr allocation in beacon data Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0369/1059] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq Greg Kroah-Hartman
` (630 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tony Luck,
Borislav Petkov (AMD), Reinette Chatre, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Luck <tony.luck@intel.com>
[ Upstream commit 2c10b3fa5bdf61e344bc522e6c2e00d870ce7ab8 ]
resctrl can be mounted on a system that supports monitoring but not allocation.
On such a system reading the "tasks" file in the default group reports no
tasks, even when there are tasks assigned to the default group. This problem
occurs because the check for whether a task belongs to a CTRL_MON group is
gated by a check for whether the system supports allocation.
The resctrl_arch_alloc_capable() check in is_closid_match() breaks task
reporting for the default group on monitor-only systems so remove this check.
On systems that support allocation the check is redundant.
Fixes: e6b2fac36fcc ("x86/resctrl: Use is_closid_match() in more places")
Closes: https://sashiko.dev/#/patchset/20260831174421.13921-1-tony.luck%40intel.com?part=9
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://patch.msgid.link/20261009193923.15498-1-tony.luck@intel.com
[ sashal: Removed the rdt_alloc_capable term from is_closid_match() in the old arch/x86/kernel/cpu/resctrl/rdtgroup.c location, since this tree has no resctrl_arch_alloc_capable() and compares t->closid directly. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 6de03440d66ae..7100cda2ea4ab 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -611,8 +611,7 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
static bool is_closid_match(struct task_struct *t, struct rdtgroup *r)
{
- return (rdt_alloc_capable &&
- (r->type == RDTCTRL_GROUP) && (t->closid == r->closid));
+ return (r->type == RDTCTRL_GROUP && t->closid == r->closid);
}
static bool is_rmid_match(struct task_struct *t, struct rdtgroup *r)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0369/1059] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (367 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0368/1059] fs/resctrl: Ensure default group reports tasks on monitor-only systems Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0370/1059] RDMA/core: Clear driver_udata before destroying objects in rdma_core Greg Kroah-Hartman
` (629 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Quanye Yang, Farhad Alemi, Jack Wang,
Leon Romanovsky, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanye Yang <quanyeyang@proton.me>
[ Upstream commit 3255d6b83491574b115806ec958d8f6ca090fa9c ]
On disconnect the client error recovery path calls ib_drain_qp(), which
requires one free RQ slot and that no recv WQEs are posted while the
queue is being drained.
When the server is loaded with always_invalidate=N, the path does not
advertise RTRS_MSG_NEW_RKEY_F. A client-requested invalidation is then
a standalone SEND_WITH_INV. The recv completion path did not repost
that WQE; it posted two empty recv WQEs later, when the RDMA-with-IMM
response carried RTRS_IO_RSP_W_INV_IMM. If the invalidate receive
never arrived, each such response increased RQ occupancy by one until
ib_post_recv() started returning -ENOMEM and __ib_drain_rq() failed
with:
failed to drain recv queue: -12
Repost one empty recv WQE for every receive completion, including
SEND_WITH_INV completions on the always_invalidate=N path, and only
while the path is still connected so CQ polling cannot race with
ib_drain_qp(). Size IO connection RQs to 2 * queue_depth + 1 to match
the posted recv count and leave the drain slot.
Tested with a synthetic RTRS client flooding unpaired
RTRS_IO_RSP_W_INV_IMM messages; error recovery no longer triggers
__ib_drain_rq() warnings.
Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
Signed-off-by: Quanye Yang <quanyeyang@proton.me>
Link: https://lore.kernel.org/linux-rdma/CA+0ovCihE2_pxLimjmmR8NMz4g-ie8dvvq1jmAj-Om33y3Vzfg@mail.gmail.com
Link: https://patch.msgid.link/20261005-rtrs-fix-ib-drain-rq-v2-1-35535a3ed115@proton.me
Tested-by: Quanye Yang <quanyeyang@proton.me>
Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: kept the branch's existing min_t(int, ...) layout and %d error print, changing only the recv WR factor from 3 to 2 instead of upstream's plain min() form. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 45 +++++++++-----------------
1 file changed, 15 insertions(+), 30 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 7e592e3c04c6c..846a3b17afcd6 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -582,25 +582,21 @@ static struct ib_cqe io_comp_cqe = {
.done = rtrs_clt_rdma_done
};
-/*
- * Post x2 empty WRs: first is for this RDMA with IMM,
- * second is for RECV with INV, which happened earlier.
- */
-static int rtrs_post_recv_empty_x2(struct rtrs_con *con, struct ib_cqe *cqe)
+static int rtrs_clt_repost_recv(struct rtrs_clt_con *con)
{
- struct ib_recv_wr wr_arr[2], *wr;
- int i;
+ struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
+ int err;
- memset(wr_arr, 0, sizeof(wr_arr));
- for (i = 0; i < ARRAY_SIZE(wr_arr); i++) {
- wr = &wr_arr[i];
- wr->wr_cqe = cqe;
- if (i)
- /* Chain backwards */
- wr->next = &wr_arr[i - 1];
- }
+ if (READ_ONCE(clt_path->state) != RTRS_CLT_CONNECTED)
+ return 0;
- return ib_post_recv(con->qp, wr, NULL);
+ err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
+ if (err) {
+ rtrs_err(con->c.path, "rtrs_post_recv_empty(): %pe\n",
+ ERR_PTR(err));
+ rtrs_rdma_error_recovery(con);
+ }
+ return err;
}
static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
@@ -661,19 +657,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
rtrs_wrn(con->c.path, "Unknown IMM type %u\n",
imm_type);
}
- if (w_inval)
- /*
- * Post x2 empty WRs: first is for this RDMA with IMM,
- * second is for RECV with INV, which happened earlier.
- */
- err = rtrs_post_recv_empty_x2(&con->c, &io_comp_cqe);
- else
- err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
- if (err) {
- rtrs_err(con->c.path, "rtrs_post_recv_empty(): %d\n",
- err);
- rtrs_rdma_error_recovery(con);
- }
+ rtrs_clt_repost_recv(con);
break;
case IB_WC_RECV:
/*
@@ -689,6 +673,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
return rtrs_clt_rkey_rsp_done(con, wc);
}
+ rtrs_clt_repost_recv(con);
break;
case IB_WC_RDMA_WRITE:
/*
@@ -1709,7 +1694,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)
/* QD * (REQ + RSP + FR REGS or INVS) + drain */
clt_path->queue_depth * 4 + 1);
max_recv_wr = min_t(int, wr_limit,
- clt_path->queue_depth * 3 + 1);
+ clt_path->queue_depth * 2 + 1);
max_send_sge = 2;
}
atomic_set(&con->c.sq_wr_avail, max_send_wr);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0370/1059] RDMA/core: Clear driver_udata before destroying objects in rdma_core
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (368 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0369/1059] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0371/1059] dmaengine: ste_dma40: Preserve the LCPA I/O address space Greg Kroah-Hartman
` (628 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jacob Moroni, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <jmoroni@google.com>
[ Upstream commit d37e98844afea39a9614cac0de837701263c90f7 ]
When uobject creation fails while copying user output data (i.e.,
after the HW object has been created), it calls
rdma_alloc_abort_uobject() with hw_obj_valid=true which then
invokes the object's destroy callback, but passes the
uverbs_attr_bundle from the original creation command.
The issue is that drivers are expected to validate the udata
and return an error if there's unexpected content, and data from
the wrong command counts as "unexpected content", so this ends
up causing the driver's destroy call to fail.
A similar issue exists in the rereg_mr path when a new MR
is created and the old one is destroyed.
Fix this by clearing driver_udata before invoking the driver's
destroy method.
Fixes: 6e0954b11c05 ("RDMA/uverbs: Allow drivers to create a new HW object during rereg_mr")
Fixes: 0ac8903cbbe6 ("RDMA/core: Allow the ioctl layer to abort a fully created uobject")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
Link: https://patch.msgid.link/20261006152908.888059-1-jmoroni@google.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Backport calls the existing out-of-line uverbs_get_cleared_udata() in rdma_core.c only, skipping the header inline move and the create_qp() cleanup because this tree's layout lacks them. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/core/rdma_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
index 29b1ab1d5f933..54d008e9ae85a 100644
--- a/drivers/infiniband/core/rdma_core.c
+++ b/drivers/infiniband/core/rdma_core.c
@@ -687,6 +687,7 @@ void rdma_assign_uobject(struct ib_uobject *to_uobj, struct ib_uobject *new_uobj
* If this fails then the uobject is still completely valid (though with
* a new ID) and we leak it until context close.
*/
+ uverbs_get_cleared_udata(attrs);
uverbs_destroy_uobject(to_uobj, RDMA_REMOVE_DESTROY, attrs);
}
@@ -702,6 +703,7 @@ void rdma_alloc_abort_uobject(struct ib_uobject *uobj,
int ret;
if (hw_obj_valid) {
+ uverbs_get_cleared_udata(attrs);
ret = uobj->uapi_object->type_class->destroy_hw(
uobj, RDMA_REMOVE_ABORT, attrs);
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0371/1059] dmaengine: ste_dma40: Preserve the LCPA I/O address space
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (369 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0370/1059] RDMA/core: Clear driver_udata before destroying objects in rdma_core Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0372/1059] mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure Greg Kroah-Hartman
` (627 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Linus Walleij,
Frank Li, Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 42c31fec1ca76b8b5f7759def122d418dff2cd4b ]
The LCPA area is mapped with devm_ioremap(), but lcpa_base and the
per-channel lcpa pointer lack __iomem annotations. This loses the I/O
address space and makes sparse warn when d40_current_addr() assigns
LCPA register addresses to its __iomem pointers.
Annotate both pointers and the LCPA argument of d40_log_lli_lcpa_write()
to preserve the I/O address space from the mapping to the register
accessors. This also fixes the existing LCPA read and write warnings
without changing the generated code.
Fixes: c80edceff29e ("dmaengine: ste_dma40: Fix cyclic transfer residue")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610090216.pjMRxhRL-lkp@intel.com/
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261010-dma40-smatch-fix-v1-1-26ca10043957@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 4 ++--
drivers/dma/ste_dma40_ll.c | 8 ++++----
drivers/dma/ste_dma40_ll.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 9276ac7f63eb4..430270287dcba 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -497,7 +497,7 @@ struct d40_chan {
u32 src_def_cfg;
u32 dst_def_cfg;
struct d40_def_lcsp log_def;
- struct d40_log_lli_full *lcpa;
+ struct d40_log_lli_full __iomem *lcpa;
/* Runtime reconfiguration */
dma_addr_t runtime_addr;
enum dma_transfer_direction runtime_direction;
@@ -610,7 +610,7 @@ struct d40_base {
/* Physical half channels */
struct d40_phy_res *phy_res;
struct d40_lcla_pool lcla_pool;
- void *lcpa_base;
+ void __iomem *lcpa_base;
dma_addr_t phy_lcpa;
resource_size_t lcpa_size;
struct kmem_cache *desc_slab;
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c
index b5287c661eb7a..862ff5996b8ff 100644
--- a/drivers/dma/ste_dma40_ll.c
+++ b/drivers/dma/ste_dma40_ll.c
@@ -332,10 +332,10 @@ static void d40_log_lli_link(struct d40_log_lli *lli_dst,
(dlos << D40_MEM_LCSP1_SLOS_POS);
}
-void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa,
- struct d40_log_lli *lli_dst,
- struct d40_log_lli *lli_src,
- int next, unsigned int flags)
+void d40_log_lli_lcpa_write(struct d40_log_lli_full __iomem *lcpa,
+ struct d40_log_lli *lli_dst,
+ struct d40_log_lli *lli_src,
+ int next, unsigned int flags)
{
d40_log_lli_link(lli_dst, lli_src, next, flags);
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h
index b04c4e92b4ed0..171249527fde2 100644
--- a/drivers/dma/ste_dma40_ll.h
+++ b/drivers/dma/ste_dma40_ll.h
@@ -455,7 +455,7 @@ int d40_log_sg_to_lli(struct scatterlist *sg,
u32 lcsp13, /* src or dst*/
u32 data_width1, u32 data_width2);
-void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa,
+void d40_log_lli_lcpa_write(struct d40_log_lli_full __iomem *lcpa,
struct d40_log_lli *lli_dst,
struct d40_log_lli *lli_src,
int next, unsigned int flags);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0372/1059] mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (370 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0371/1059] dmaengine: ste_dma40: Preserve the LCPA I/O address space Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0373/1059] mailbox: arm_mhu_db: " Greg Kroah-Hartman
` (626 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anup Vishwakarma, Mukesh Ojha,
Jassi Brar, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
[ Upstream commit da988ac6afe152f802140ccaa0ad5e8f675b8814 ]
qcom_ipcc_probe() registers the mailbox controller via
devm_mbox_controller_register(), which automatically calls
mbox_controller_unregister() through devres when the device is removed
or probe fails. If devm_request_irq() subsequently fails, the
err_req_irq: label also manually calls mbox_controller_unregister(),
resulting in a double call that corrupts the global mailbox controller
list and causes a kernel panic.
Remove the redundant manual call and rely on devres for cleanup.
Fixes: e9d50e4b4d04 ("mailbox: qcom-ipcc: Dynamic alloc for channel arrangement")
Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
[ sashal: Kept the existing braced dev_err() block in the IRQ failure path and only retargeted its goto to err_mbox, since the context differed from upstream's bare goto. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mailbox/qcom-ipcc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index 7426fc5e02e4b..a9bc524719201 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -321,16 +321,13 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
IRQF_NO_THREAD, name, ipcc);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to register the irq: %d\n", ret);
- goto err_req_irq;
+ goto err_mbox;
}
platform_set_drvdata(pdev, ipcc);
return 0;
-err_req_irq:
- if (ipcc->num_chans)
- mbox_controller_unregister(&ipcc->mbox);
err_mbox:
irq_domain_remove(ipcc->irq_domain);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0373/1059] mailbox: arm_mhu_db: Remove redundant mbox_controller_unregister() on probe failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (371 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0372/1059] mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0374/1059] seq_buf: Do not print an empty line from an overflowed seq_buf_do_printk() Greg Kroah-Hartman
` (625 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anup Vishwakarma, Mukesh Ojha,
Jassi Brar, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
[ Upstream commit 8228ed61b6cbd6e79531c9ebfcad233c35eae562 ]
mhu_db_probe() registers the mailbox controller via
devm_mbox_controller_register(), which automatically calls
mbox_controller_unregister() through devres when the device is removed
or probe fails. If devm_request_threaded_irq() subsequently fails in
the channel setup loop, the error path also manually calls
mbox_controller_unregister(), resulting in a double call that corrupts
the global mailbox controller list and causes a kernel panic.
Remove the redundant manual call and rely on devres for cleanup.
Fixes: 7002ca237b21 ("mailbox: arm_mhu: Add ARM MHU doorbell driver")
Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
[ sashal: Dropped the manual mbox_controller_unregister() call but kept the braces and dev_err() in the error block, since the dev_err() cleanup it depends on isn't present here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mailbox/arm_mhu_db.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/mailbox/arm_mhu_db.c b/drivers/mailbox/arm_mhu_db.c
index 27a510d469082..b6eeef867cbfc 100644
--- a/drivers/mailbox/arm_mhu_db.c
+++ b/drivers/mailbox/arm_mhu_db.c
@@ -319,7 +319,6 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id)
IRQF_ONESHOT, "mhu_db_link", mhu);
if (err) {
dev_err(dev, "Can't claim IRQ %d\n", irq);
- mbox_controller_unregister(&mhu->mbox);
return err;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0374/1059] seq_buf: Do not print an empty line from an overflowed seq_buf_do_printk()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (372 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0373/1059] mailbox: arm_mhu_db: " Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0375/1059] ALSA: control_led: Fix deadlock between sysfs writes and card disconnect Greg Kroah-Hartman
` (624 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kees Cook, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <kees@kernel.org>
[ Upstream commit a09fb764832dd7dbb9ccc38a9830f7294889c8ae ]
seq_buf_do_printk() prints a buffer line by line, then prints whatever
follows the last newline. When a string has overflowed at exactly a
newline, an empty line is printed since the pointer hasn't reached the
overflow mark of the seq_buf. Switch to just check if the string is
already empty and only print if not.
The only caller is the memory cgroup OOM report, so this could only ever
add a blank line to a report whose statistics already did not fit.
Add a test that registers a console to count the records that
seq_buf_do_printk() emits. It counts the records carrying the test's
marker, and the records holding nothing but a line feed that arrive
after one, so that unrelated kernel messages do not disturb it. Both
states that reach the flaw are covered: exactly full, and overflowed.
Tests passed under qemu on ARCH=x86_64 with GCC 16.2.0 and CONFIG_KASAN=y,
and on big-endian ARCH=s390 with GCC s390x-linux-gnu 16.2.0.
Fixes: 96928d9032a7c ("seq_buf: Add seq_buf_do_printk() helper")
Assisted-by: LLM
Link: https://patch.msgid.link/20261005155708.1471260-1-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
[ sashal: Dropped the seq_buf KUnit test hunk, since this tree has no seq_buf KUnit test file, and kept only the one-line seq_buf_do_printk() fix. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/seq_buf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/seq_buf.c b/lib/seq_buf.c
index 23518f77ea9c5..1cd32ae73ad32 100644
--- a/lib/seq_buf.c
+++ b/lib/seq_buf.c
@@ -118,7 +118,7 @@ void seq_buf_do_printk(struct seq_buf *s, const char *lvl)
}
/* No trailing LF */
- if (start < s->buffer + s->len)
+ if (*start)
printk("%s%s\n", lvl, start);
}
EXPORT_SYMBOL_GPL(seq_buf_do_printk);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0375/1059] ALSA: control_led: Fix deadlock between sysfs writes and card disconnect
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (373 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0374/1059] seq_buf: Do not print an empty line from an overflowed seq_buf_do_printk() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0376/1059] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Greg Kroah-Hartman
` (623 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ali Ahmet Memiş, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ali Ahmet Memiş <aliamemis@disroot.org>
[ Upstream commit 682d6bb5f783adea7fa2a5b05166bff01b338081 ]
snd_ctl_led_disconnect() removes the ctl-led sysfs files while
holding card->controls_rwsem. device_unregister() waits for running
sysfs callbacks which can deadlock when a concurrent write causes
the attach or detach callback to wait for controls_rwsem.
Break kernfs active protection in the attach, detach and list
callbacks and hold a module reference instead.
Fixes: a135dfb5de15 ("ALSA: led control - add sysfs kcontrol LED marking layer")
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Link: https://patch.msgid.link/20261011180627.1594051-1-aliamemis@disroot.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Adjusted context in snd_ctl_led_list() because the older tree declares the card pointer as NULL-initialized and assigns snd_card_ref() separately. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/control_led.c | 62 ++++++++++++++++++++++++++++++++++++----
1 file changed, 57 insertions(+), 5 deletions(-)
diff --git a/sound/core/control_led.c b/sound/core/control_led.c
index 43d32f188e357..6089c28066dae 100644
--- a/sound/core/control_led.c
+++ b/sound/core/control_led.c
@@ -565,12 +565,43 @@ static ssize_t set_led_id(struct snd_ctl_led_card *led_card, const char *buf, si
return count;
}
+/*
+ * snd_ctl_led_disconnect() removes these files with card->controls_rwsem
+ * held. so don't let the removal wait for a callback that takes it.
+ */
+static struct kernfs_node *snd_ctl_led_sysfs_enter(struct device *dev,
+ struct device_attribute *attr)
+{
+ struct kernfs_node *kn;
+
+ if (!try_module_get(THIS_MODULE))
+ return NULL;
+ kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
+ if (!kn)
+ module_put(THIS_MODULE);
+ return kn;
+}
+
+static void snd_ctl_led_sysfs_exit(struct kernfs_node *kn)
+{
+ sysfs_unbreak_active_protection(kn);
+ module_put(THIS_MODULE);
+}
+
static ssize_t attach_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct snd_ctl_led_card *led_card = container_of(dev, struct snd_ctl_led_card, dev);
- return set_led_id(led_card, buf, count, true);
+ struct kernfs_node *kn;
+ ssize_t ret;
+
+ kn = snd_ctl_led_sysfs_enter(dev, attr);
+ if (!kn)
+ return -ENODEV;
+ ret = set_led_id(led_card, buf, count, true);
+ snd_ctl_led_sysfs_exit(kn);
+ return ret;
}
static ssize_t detach_store(struct device *dev,
@@ -578,7 +609,15 @@ static ssize_t detach_store(struct device *dev,
const char *buf, size_t count)
{
struct snd_ctl_led_card *led_card = container_of(dev, struct snd_ctl_led_card, dev);
- return set_led_id(led_card, buf, count, false);
+ struct kernfs_node *kn;
+ ssize_t ret;
+
+ kn = snd_ctl_led_sysfs_enter(dev, attr);
+ if (!kn)
+ return -ENODEV;
+ ret = set_led_id(led_card, buf, count, false);
+ snd_ctl_led_sysfs_exit(kn);
+ return ret;
}
static ssize_t reset_store(struct device *dev,
@@ -596,10 +635,8 @@ static ssize_t reset_store(struct device *dev,
return count;
}
-static ssize_t list_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t snd_ctl_led_list(struct snd_ctl_led_card *led_card, char *buf)
{
- struct snd_ctl_led_card *led_card = container_of(dev, struct snd_ctl_led_card, dev);
struct snd_card *card __free(snd_card_unref) = NULL;
struct snd_ctl_led_ctl *lctl;
size_t l = 0;
@@ -622,6 +659,21 @@ static ssize_t list_show(struct device *dev,
return l;
}
+static ssize_t list_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct snd_ctl_led_card *led_card = container_of(dev, struct snd_ctl_led_card, dev);
+ struct kernfs_node *kn;
+ ssize_t ret;
+
+ kn = snd_ctl_led_sysfs_enter(dev, attr);
+ if (!kn)
+ return -ENODEV;
+ ret = snd_ctl_led_list(led_card, buf);
+ snd_ctl_led_sysfs_exit(kn);
+ return ret;
+}
+
static DEVICE_ATTR_WO(attach);
static DEVICE_ATTR_WO(detach);
static DEVICE_ATTR_WO(reset);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0376/1059] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (374 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0375/1059] ALSA: control_led: Fix deadlock between sysfs writes and card disconnect Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0377/1059] btrfs: roll back sprout setup after device add failure Greg Kroah-Hartman
` (622 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Boris Brezillon, Steven Price,
Adrián Larumbe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrián Larumbe <adrian.larumbe@collabora.com>
[ Upstream commit e9672bf9382ff80be21d586f88e50339b85f5766 ]
During device probe(), failure to do a PM get() will leave the usage_count
set to 0, which is the value assigned at device creation time. That means
when the autosuspend delay expires, runtime suspend callback won't be
invoked, so the device will remain powered on forever.
On top of that, failure to call PM put() during device unplug means
Panfrost device's PM usage_count increases monotonically for every new
module reload.
The outcome of both of the above meant that:
- Devfreq OPP transition notifications would be printed all the time,
even when no jobs are being submitted. This quickly fills the kernel
ring buffer with junk.
- Because MMU interrupts are only enabled when the device is reset,
the very first job targeting the tiler heap BO after device probe()
would always time out, since the driver's PM runtime resume callback
would not be invoked.
To fix the above:
- Manually adjust the PM refcnt at device probe and removal time.
- Ensure pm_runtime_dont_use_autosuspend is called in the wind-down path.
- Call pm_runtime_put_autosuspend() when device is ready to accept jobs
Fixes: 635430797d3f ("drm/panfrost: Rework runtime PM initialization")
Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20261012-claude-fixes-v15-6-bc0a6c498553@collabora.com
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
[ sashal: Adapted context to the older tree (pfdev->dev instead of pfdev->base.dev, with the shrinker init and drm_dev_put kept), placing put_autosuspend after the shrinker init. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 59415a84cff71..42d2854939ba8 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -593,6 +593,11 @@ static int panfrost_probe(struct platform_device *pdev)
goto err_out0;
}
+ /* The reason we must manually set the PM status and usage counter is
+ * we have just powered the device up but did not go through the PM
+ * runtime resume callback, so we need to update these ourselves.
+ */
+ pm_runtime_get_noresume(pfdev->dev);
pm_runtime_set_active(pfdev->dev);
pm_runtime_mark_last_busy(pfdev->dev);
pm_runtime_enable(pfdev->dev);
@@ -609,12 +614,16 @@ static int panfrost_probe(struct platform_device *pdev)
panfrost_gem_shrinker_init(ddev);
+ pm_runtime_put_autosuspend(pfdev->dev);
+
return 0;
err_out1:
+ pm_runtime_dont_use_autosuspend(pfdev->dev);
pm_runtime_disable(pfdev->dev);
panfrost_device_fini(pfdev);
pm_runtime_set_suspended(pfdev->dev);
+ pm_runtime_put_noidle(pfdev->dev);
err_out0:
drm_dev_put(ddev);
return err;
@@ -629,9 +638,11 @@ static int panfrost_remove(struct platform_device *pdev)
panfrost_gem_shrinker_cleanup(ddev);
pm_runtime_get_sync(pfdev->dev);
+ pm_runtime_dont_use_autosuspend(pfdev->dev);
pm_runtime_disable(pfdev->dev);
panfrost_device_fini(pfdev);
pm_runtime_set_suspended(pfdev->dev);
+ pm_runtime_put_noidle(pfdev->dev);
drm_dev_put(ddev);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0377/1059] btrfs: roll back sprout setup after device add failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (375 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0376/1059] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0378/1059] btrfs: fix incomplete iteration over fs state when logging messages Greg Kroah-Hartman
` (621 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Guanghui Yang,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Yang <3497809730@qq.com>
[ Upstream commit f5166f53b60b4d1ee9957c0baccd3b09735001d4 ]
btrfs_init_new_device() calls btrfs_setup_sprout() before creating the
first writable chunks for a seed filesystem. That moves the seed devices
out of fs_info->fs_devices, clears the seeding state and installs a new
fsid for the sprout filesystem.
If a later step fails, the error path removes the new device but leaves
fs_info->fs_devices in the partially initialized sprout state. The
mounted filesystem can then be left with no open devices after the
failed device add.
Add the inverse of btrfs_setup_sprout() and use it from the error path
so the mounted seed filesystem is restored before the temporary
seed_devices copy is released.
Fixes: 2b82032c34ec ("Btrfs: Seed device support")
Assisted-by: Codex:gpt-5
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Guanghui Yang <3497809730@qq.com>
[ Fix a conflict with per-profile available space, revert sprout before
updating per-profile available space estimation. ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: Dropped the context line calling btrfs_update_per_profile_avail(), which doesn't exist here, so btrfs_rollback_sprout() now sits directly before the chunk_mutex unlock. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/volumes.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 04283d3497e5a..4223defd9ca74 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2717,6 +2717,41 @@ static void btrfs_setup_sprout(struct btrfs_fs_info *fs_info,
btrfs_set_super_flags(disk_super, super_flags);
}
+static void btrfs_rollback_sprout(struct btrfs_fs_info *fs_info,
+ struct btrfs_fs_devices *seed_devices)
+{
+ struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+ struct btrfs_super_block *disk_super = fs_info->super_copy;
+ struct btrfs_device *device;
+ u64 super_flags;
+
+ lockdep_assert_held(&uuid_mutex);
+ lockdep_assert_held(&fs_devices->device_list_mutex);
+
+ list_del_init(&seed_devices->seed_list);
+ list_splice_init_rcu(&seed_devices->devices, &fs_devices->devices, synchronize_rcu);
+ list_for_each_entry(device, &fs_devices->devices, dev_list) {
+ device->fs_devices = fs_devices;
+ }
+
+ fs_devices->seeding = true;
+ fs_devices->num_devices = seed_devices->num_devices;
+ fs_devices->open_devices = seed_devices->open_devices;
+ fs_devices->missing_devices = seed_devices->missing_devices;
+ fs_devices->rotating = seed_devices->rotating;
+ fs_devices->latest_dev = seed_devices->latest_dev;
+
+ memcpy(fs_devices->fsid, seed_devices->fsid, BTRFS_FSID_SIZE);
+ memcpy(fs_devices->metadata_uuid, seed_devices->metadata_uuid, BTRFS_FSID_SIZE);
+ memcpy(disk_super->fsid, seed_devices->fsid, BTRFS_FSID_SIZE);
+
+ super_flags = (btrfs_super_flags(disk_super) | BTRFS_SUPER_FLAG_SEEDING);
+ btrfs_set_super_flags(disk_super, super_flags);
+
+ seed_devices->opened = 0;
+ free_fs_devices(seed_devices);
+}
+
/*
* Store the expected generation for seed devices in device items.
*/
@@ -3032,6 +3067,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
orig_super_total_bytes);
btrfs_set_super_num_devices(fs_info->super_copy,
orig_super_num_devices);
+ if (seeding_dev)
+ btrfs_rollback_sprout(fs_info, seed_devices);
mutex_unlock(&fs_info->chunk_mutex);
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
error_trans:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0378/1059] btrfs: fix incomplete iteration over fs state when logging messages
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (376 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0377/1059] btrfs: roll back sprout setup after device add failure Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0379/1059] btrfs: fix off-by-one end offset check in report_setget_bounds() Greg Kroah-Hartman
` (620 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit d1d74665ab9a8971d42177ca865cfbe2897c1fc7 ]
In btrfs_state_to_string() we iterate over all the bits set in
fs_info->fs_state using for_each_set_bit(), which requires its third
argument to match the number of bits, but we pass it the number of bytes
of the type used by fs_info->fs_state, an unsigned long, which is 8 on
64 bits platforms and 4 on 32 bits platforms. This means we are not
iterating over bits in the ranges [8, 63] or [4, 31].
Fix this by passing BTRFS_FS_STATE_COUNT instead of sizeof(fs_state).
Note that we could pass BITS_PER_TYPE(fs_state), but since
BTRFS_FS_STATE_COUNT is 11 and we have no bits beyond that, it would
cause pointless iterations over fs_state.
This also makes pointless the checks for the bit being inside the limit
of BTRFS_FS_STATE_COUNT inside the loop.
Fixes: c067da878156 ("btrfs: add filesystems state details to error messages")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: Applied the fix to btrfs_state_to_string() in super.c because messages.c doesn't exist here, and the surrounding context differs slightly. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/super.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 3b8afd05e3748..3dcf785e56137 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -97,9 +97,8 @@ static void btrfs_state_to_string(const struct btrfs_fs_info *info, char *buf)
memcpy(curr, STATE_STRING_PREFACE, sizeof(STATE_STRING_PREFACE));
curr += sizeof(STATE_STRING_PREFACE) - 1;
- for_each_set_bit(bit, &fs_state, sizeof(fs_state)) {
- WARN_ON_ONCE(bit >= BTRFS_FS_STATE_COUNT);
- if ((bit < BTRFS_FS_STATE_COUNT) && fs_state_chars[bit]) {
+ for_each_set_bit(bit, &fs_state, BTRFS_FS_STATE_COUNT) {
+ if (fs_state_chars[bit]) {
*curr++ = fs_state_chars[bit];
states_printed = true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0379/1059] btrfs: fix off-by-one end offset check in report_setget_bounds()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (377 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0378/1059] btrfs: fix incomplete iteration over fs state when logging messages Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0380/1059] btrfs: defrag: fix check to see if next extent can be defragged too Greg Kroah-Hartman
` (619 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Daniel Vacek,
Filipe Manana, David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 08f750d9f8930e4ca053913b5ca3fd49fd9268c9 ]
The addressable range with an extent buffer goes from byte 0 to byte
eb->len - 1, so if a byte address matches eb->len, it's already beyond
the addressable range and we should log that it's bad start address
and not end address.
Fixes: 234fdd2815ce ("btrfs: remove redundant check in up check_setget_bounds")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: Applied the fix in struct-funcs.c because accessors.c doesn't exist here, and the surrounding context differs slightly. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/struct-funcs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-funcs.c
index 12455b2b41de8..7d968f857cdb0 100644
--- a/fs/btrfs/struct-funcs.c
+++ b/fs/btrfs/struct-funcs.c
@@ -15,7 +15,7 @@ static bool check_setget_bounds(const struct extent_buffer *eb,
if (unlikely(member_offset + size > eb->len)) {
btrfs_warn(eb->fs_info,
"bad eb member %s: ptr 0x%lx start %llu member offset %lu size %d",
- (member_offset > eb->len ? "start" : "end"),
+ (member_offset >= eb->len ? "start" : "end"),
(unsigned long)ptr, eb->start, member_offset, size);
return false;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0380/1059] btrfs: defrag: fix check to see if next extent can be defragged too
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (378 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0379/1059] btrfs: fix off-by-one end offset check in report_setget_bounds() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0381/1059] ALSA: hda: intel: Dont free card in the probe work Greg Kroah-Hartman
` (618 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit eb55bc2bfe204e6bfccfe179226d7fb5024cb010 ]
We want to check if the next extent is at maximum capacity but we are
passing the current extent map to get_extent_max_capacity() and not
the next extent map. For example if the current extent is compressed (its
maximum capacity is 128K) and the next extent is uncompressed (its
maximum capacity is 128M), then we can bail out and not defrag the next
extent too - when for example the next extent as a size of 128K, is
uncompressed, and the extent threshold is >= 256K.
Fixes: 979b25c300db ("btrfs: defrag: don't defrag extents which are already at max capacity")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: Applied the one-line change to defrag_check_next_extent() in ioctl.c, since the defrag code has not yet been split out into its own file here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1b0dd3228aa1e..42aef738c867e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1308,7 +1308,7 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,
* If the next extent is at its max capacity, defragging current extent
* makes no sense, as the total number of extents won't change.
*/
- if (next->len >= get_extent_max_capacity(fs_info, em))
+ if (next->len >= get_extent_max_capacity(fs_info, next))
goto out;
/* Skip older extent */
if (next->generation < newer_than)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0381/1059] ALSA: hda: intel: Dont free card in the probe work
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (379 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0380/1059] btrfs: defrag: fix check to see if next extent can be defragged too Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0382/1059] platform/x86/amd/pmc: clear devm-managed pointers on remove to prevent stale reuse Greg Kroah-Hartman
` (617 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+40b06a86af225236fdb4,
Ali Ahmet Memiş, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ali Ahmet Memiş <aliamemis@disroot.org>
[ Upstream commit fbaccb1b19c79e79220e3bcc5bb18ca54ffb017b ]
If the delayed probe fails, azx_probe_work() frees the card and clears
the drvdata. azx_remove() reads the card before it waits for the probe
work with cancel_delayed_work_sync() so when the device is removed while
the probe work is running, it frees the card again after the work has
already freed it.
Only disconnect the card in the work so that its slot is released right
away and leave freeing it to azx_remove().
Fixes: 39173303c838 ("ALSA: hda: Free card instance properly at probe errors")
Reported-by: syzbot+40b06a86af225236fdb4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=40b06a86af225236fdb4
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Link: https://patch.msgid.link/20261012162841.1879278-1-aliamemis@disroot.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/hda/hda_intel.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f105b320567ea..09cf67a6a93c4 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1743,7 +1743,12 @@ static void azx_check_snoop_available(struct azx *chip)
static void azx_probe_work(struct work_struct *work)
{
struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
- azx_probe_continue(&hda->chip, true);
+
+ if (azx_probe_continue(&hda->chip, false) < 0) {
+ hda->init_failed = 1;
+ complete_all(&hda->probe_wait);
+ snd_card_disconnect(hda->chip.card);
+ }
}
static int default_bdl_pos_adj(struct azx *chip)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0382/1059] platform/x86/amd/pmc: clear devm-managed pointers on remove to prevent stale reuse
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (380 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0381/1059] ALSA: hda: intel: Dont free card in the probe work Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0383/1059] ALSA: rawmidi: Drain input work before freeing the runtime Greg Kroah-Hartman
` (616 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shyam Sundar S K,
Mario Limonciello (AMD), Ilpo Järvinen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
[ Upstream commit c9ba86f5411730ebd333d94b9e1aa8f652dc743f ]
The driver stores its state in a single file-scope static struct
amd_pmc_dev, which is reused on every bind. Its regbase, smu_virt_addr,
stb_virt_addr and fch_virt_addr members are MMIO mappings created with
devm_ioremap().
On unbind the driver core unmaps these mappings, but it does not clear
the pointers in the static struct. Since the struct is not freed, the
members keep pointing at the now-unmapped addresses.
On the next bind, the probe path re-maps a region only when its pointer
is still NULL, so the stale pointer is reused and the following
memcpy_fromio()/ioread32() touches freed MMIO, causing use-after-unmap
crash. Clear these pointers in amd_pmc_remove() so the next probe re-maps
them instead of reusing stale ones.
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Fixes: 156ec4731cb22b ("platform/x86: amd-pmc: Add AMD platform support for S2Idle")
Link: https://patch.msgid.link/20260929155609.1712638-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
[ sashal: Added four NULL assignments in amd_pmc_remove() after mutex_destroy(), since the function returns int and lacks the upstream deinit call used as context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/platform/x86/amd/pmc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index ca3b874058ff0..9df5f7eb66115 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -1024,6 +1024,10 @@ static int amd_pmc_remove(struct platform_device *pdev)
amd_pmc_dbgfs_unregister(dev);
pci_dev_put(dev->rdev);
mutex_destroy(&dev->lock);
+ dev->regbase = NULL;
+ dev->smu_virt_addr = NULL;
+ dev->stb_virt_addr = NULL;
+ dev->fch_virt_addr = NULL;
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0383/1059] ALSA: rawmidi: Drain input work before freeing the runtime
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (381 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0382/1059] platform/x86/amd/pmc: clear devm-managed pointers on remove to prevent stale reuse Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0384/1059] RDMA/efa: Fix race between admin command timeout and completion Greg Kroah-Hartman
` (615 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cen Zhang, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 8c3529f0a8faaac7d73333486f69da1617ecc579 ]
The input runtime embeds event_work, so the work must be drained before
close_substream() frees the runtime. The cancellation in
snd_rawmidi_input_trigger() runs before close clears substream->opened,
leaving a window for snd_rawmidi_receive() to enqueue more work.
With a sequencer subscription to a USB MIDI input port, an in-flight
completion can overlap the last subscription's midisynth_unsubscribe():
1. snd_usbmidi_input_data() observes input_triggered and is delayed
before calling snd_rawmidi_receive().
2. Unsubscribe enters close_substream(), clears input_triggered through
the provider trigger callback and returns from cancel_work_sync().
The substream is still opened.
3. The completion resumes. snd_rawmidi_receive() takes substream->lock,
sees opened set and queues runtime->event_work before dropping the
lock.
4. Close clears opened under that lock, closes the provider and frees
the runtime. Stopping USB URBs does not drain the raw-MIDI work.
5. The queued work runs and snd_rawmidi_input_event_work() reads event
or substream from the freed runtime, causing a use-after-free.
Cancel input event_work again after clearing opened, before closing the
provider or releasing the runtime's private data. Receive holds
substream->lock through its opened check and work enqueue, so once close
has cleared opened under that lock, no further receive can queue work.
The final cancellation therefore drains any late work before the
runtime is freed. Keep it outside the spinlock so a running callback can
finish.
Fixes: b3c705aa9e91 ("ALSA: rawmidi - Use workq for event handling")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Link: https://patch.msgid.link/pm-pmb-98489078ab56528d8e4a-v2-9408ce8c8f3c70b5c10d@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Context-only adaptation: kept the older spin_lock_irq()/spin_unlock_irq() block instead of scoped_guard(), and added the same cancel_work_sync() lines right after the unlock. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/rawmidi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index a1c4e280e7894..473b41a1a86a4 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -564,6 +564,9 @@ static void close_substream(struct snd_rawmidi *rmidi,
substream->opened = 0;
substream->append = 0;
spin_unlock_irq(&substream->lock);
+ /* Drain input work queued after the earlier cancellation. */
+ if (substream->stream == SNDRV_RAWMIDI_STREAM_INPUT)
+ cancel_work_sync(&substream->runtime->event_work);
substream->ops->close(substream);
if (substream->runtime->private_free)
substream->runtime->private_free(substream);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0384/1059] RDMA/efa: Fix race between admin command timeout and completion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (382 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0383/1059] ALSA: rawmidi: Drain input work before freeing the runtime Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0385/1059] fs/ntfs3: do not mark frame pages uptodate on read error Greg Kroah-Hartman
` (614 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael Margolin, Tom Sela,
Yonatan Nachum, Leon Romanovsky, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Nachum <ynachum@amazon.com>
[ Upstream commit 466612f8a8020c6b3af6377c730775a4c630f12c ]
An admin command that times out can race with the interrupt handler
processing its completion, in two ways.
The timeout path releases the completion context without synchronizing
against the handler. A handler that has already seen the command as
submitted then copies the CQE into the caller's response buffer after
the waiter returned and that buffer went out of scope.
The waiter can also observe the command as completed before the CQE was
copied, since the status is published first. It decodes its own
uninitialized response buffer, returns success with garbage contents and
leaks stack data to the caller. Both wait paths read the status without
the CQ lock.
Add a timed-out state and publish it under the CQ lock in both wait
paths before returning, so the handler, which only completes commands in
submitted state, cannot act on an abandoned context. In the interrupt
wait path test the return value of the wait instead of the status: the
handler signals the completion after copying the CQE, so a successful
wait implies a valid response. Read the status in the polling wait path
inside the critical section that drains the CQ, which also lets a
completion arriving on the last iteration be honored instead of reported
as a timeout.
Fixes: 0420e542569b ("RDMA/efa: Implement functions that submit and complete admin commands")
Reviewed-by: Michael Margolin <mrgolin@amazon.com>
Reviewed-by: Tom Sela <tomsela@amazon.com>
Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
Link: https://patch.msgid.link/20261012165113.576899-1-ynachum@amazon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Context lines differ from upstream (no EFA_CMD_ALLOCATED state, an older log format string, and int err declared at function scope), but the changed lines match upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/efa/efa_com.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/hw/efa/efa_com.c b/drivers/infiniband/hw/efa/efa_com.c
index 00e339abc2c13..fab32b1da93fb 100644
--- a/drivers/infiniband/hw/efa/efa_com.c
+++ b/drivers/infiniband/hw/efa/efa_com.c
@@ -23,6 +23,7 @@
enum efa_cmd_status {
EFA_CMD_SUBMITTED,
EFA_CMD_COMPLETED,
+ EFA_CMD_TIMED_OUT,
};
struct efa_comp_ctx {
@@ -497,6 +498,7 @@ static int efa_com_comp_status_to_errno(u8 comp_status)
static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_ctx,
struct efa_com_admin_queue *aq)
{
+ bool comp_timeout = false;
unsigned long timeout;
unsigned long flags;
int err;
@@ -506,12 +508,19 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_c
while (1) {
spin_lock_irqsave(&aq->cq.lock, flags);
efa_com_handle_admin_completion(aq);
- spin_unlock_irqrestore(&aq->cq.lock, flags);
-
- if (comp_ctx->status != EFA_CMD_SUBMITTED)
+ if (comp_ctx->status != EFA_CMD_SUBMITTED) {
+ spin_unlock_irqrestore(&aq->cq.lock, flags);
break;
+ }
if (time_is_before_jiffies(timeout)) {
+ comp_ctx->status = EFA_CMD_TIMED_OUT;
+ comp_timeout = true;
+ }
+
+ spin_unlock_irqrestore(&aq->cq.lock, flags);
+
+ if (comp_timeout) {
ibdev_err_ratelimited(
aq->efa_dev,
"Wait for completion (polling) timeout\n");
@@ -535,11 +544,12 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_c
static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *comp_ctx,
struct efa_com_admin_queue *aq)
{
- unsigned long flags;
+ unsigned long flags, remaining_jiffies;
+ bool completed;
int err;
- wait_for_completion_timeout(&comp_ctx->wait_event,
- usecs_to_jiffies(aq->completion_timeout));
+ remaining_jiffies = wait_for_completion_timeout(
+ &comp_ctx->wait_event, usecs_to_jiffies(aq->completion_timeout));
/*
* In case the command wasn't completed find out the root cause.
@@ -547,14 +557,16 @@ static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *com
* 1) No completion (timeout reached)
* 2) There is completion but the device didn't get any msi-x interrupt.
*/
- if (comp_ctx->status == EFA_CMD_SUBMITTED) {
+ if (remaining_jiffies == 0) {
spin_lock_irqsave(&aq->cq.lock, flags);
efa_com_handle_admin_completion(aq);
+ completed = (comp_ctx->status == EFA_CMD_COMPLETED);
+ comp_ctx->status = EFA_CMD_TIMED_OUT;
spin_unlock_irqrestore(&aq->cq.lock, flags);
atomic64_inc(&aq->stats.no_completion);
- if (comp_ctx->status == EFA_CMD_COMPLETED)
+ if (completed)
ibdev_err_ratelimited(
aq->efa_dev,
"The device sent a completion but the driver didn't receive any MSI-X interrupt for admin cmd %s(%d) status %d (ctx: 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n",
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0385/1059] fs/ntfs3: do not mark frame pages uptodate on read error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (383 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0384/1059] RDMA/efa: Fix race between admin command timeout and completion Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0386/1059] clk: qcom: mmcc-msm8960: Configure PLL15 only on APQ8064 Greg Kroah-Hartman
` (613 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiang Mei, Weiming Shi,
Konstantin Komarov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <bestswngs@gmail.com>
[ Upstream commit 80218408836fa6fc91a9c26a9c014f81abf9e41f ]
ni_read_frame() ends with a loop that marks every page of a compressed
frame uptodate regardless of whether the read succeeded:
out:
for (i = 0; i < pages_per_frame; i++) {
pg = pages[i];
SetPageUptodate(pg);
}
Non-critical frame pages come from __filemap_get_folio(FGP_CREAT) and are
not zeroed. On an error path that reaches out: before frame_mem is
written, these pages keep uninitialized page-allocator contents but are
still marked uptodate. A later read() is then served from the page cache
and returns that stale kernel memory to user space.
For an unprivileged user mounting a crafted NTFS image this is a
repeatable kernel memory disclosure.
Mark the pages uptodate only on success; on error leave them !uptodate so
the read path re-reads them or reports the error.
Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
Reported-by: Xiang Mei <xmei5@asu.edu>
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
[ sashal: Only the ni_read_frame() out: loop was changed; the unused-variable removal for pg was not carried over because this tree still uses pg elsewhere in the function. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ntfs3/frecord.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index b8b5304be183e..4eab9dda3738e 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2830,11 +2830,10 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
out1:
vunmap(frame_mem);
out:
- for (i = 0; i < pages_per_frame; i++) {
- pg = pages[i];
- if (err)
- clear_highpage(pg);
- SetPageUptodate(pg);
+ if (!err) {
+ for (i = 0; i < pages_per_frame; i++) {
+ SetPageUptodate(pages[i]);
+ }
}
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0386/1059] clk: qcom: mmcc-msm8960: Configure PLL15 only on APQ8064
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (384 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0385/1059] fs/ntfs3: do not mark frame pages uptodate on read error Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0387/1059] perf symbol: Fix symbol loading from libbfd Greg Kroah-Hartman
` (612 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abel Vesa, Konrad Dybcio,
Bjorn Andersson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <abel.vesa@oss.qualcomm.com>
[ Upstream commit 342db3b6cf7bad2a53ccd5e2d844faf260953d9d ]
PLL15 is specific to APQ8064, but the shared probe function configures
it unconditionally, including on MSM8960. Its configuration registers
at offsets 0x33c through 0x348 exceed the MSM8960 regmap maximum of
0x334, so regmap rejects these accesses. The PLL configuration helper
ignores the errors and probe continues.
Only configure PLL15 when the selected descriptor is for APQ8064,
matching the existing variant check for the GFX3D clock adjustments.
Fixes: e216ce60a9e0 ("clk: qcom: Add support for APQ8064 multimedia clocks")
Assisted-by: LLM
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916-clk-qcom-mmcc-msm8960-fix-pll15-config-v1-1-11fae0be111d@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
[ sashal: Replaced the upstream desc == &mmcc_apq8064_desc check with the existing is_8064 variable, because this probe has no desc local. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/clk/qcom/mmcc-msm8960.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c
index 6bf908a51f530..96b5033ed393b 100644
--- a/drivers/clk/qcom/mmcc-msm8960.c
+++ b/drivers/clk/qcom/mmcc-msm8960.c
@@ -3126,7 +3126,8 @@ static int mmcc_msm8960_probe(struct platform_device *pdev)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
- clk_pll_configure_sr(&pll15, regmap, &pll15_config, false);
+ if (is_8064)
+ clk_pll_configure_sr(&pll15, regmap, &pll15_config, false);
return qcom_cc_really_probe(pdev, match->data, regmap);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0387/1059] perf symbol: Fix symbol loading from libbfd
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (385 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0386/1059] clk: qcom: mmcc-msm8960: Configure PLL15 only on APQ8064 Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0388/1059] perf symbol: Add missing symsrc__destroy() for libbfd Greg Kroah-Hartman
` (611 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Ian Rogers, Namhyung Kim,
Remi Bernon, Arnaldo Carvalho de Melo, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <namhyung@kernel.org>
[ Upstream commit f814d9e6cdbef6413a72d6dd6d5e4e79e815cf44 ]
The dso__load() should return a positive number (number of symbols
loaded) when it succeded to load symbols. But dso__load_bfd_symbols()
only returns 0 and it's hard to check if it actually loaded symbols or
not. Let's return the value of dso__has_symbol() and check it in
dso__load() so that it can return 1 for success.
Closes: https://lore.kernel.org/r/sashiko-outbox-162540@kernel.org
Fixes: eac9a4342e5447ca ("perf symbols: Try reading the symbol table with libbfd")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Remi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Moved the libbfd code's hunk into the older symbol.c layout, used old-style dso field accesses, and adjusted the test's dso__find_symbol_by_name() call to lack the idx argument. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/tests/pe-file-parsing.c | 2 +-
tools/perf/util/symbol.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/pe-file-parsing.c b/tools/perf/tests/pe-file-parsing.c
index c09a9fae16897..0a9c08ee7db74 100644
--- a/tools/perf/tests/pe-file-parsing.c
+++ b/tools/perf/tests/pe-file-parsing.c
@@ -58,7 +58,7 @@ static int run_dir(const char *d)
TEST_ASSERT_VAL("Failed to get dso", dso);
ret = dso__load_bfd_symbols(dso, debugfile);
- TEST_ASSERT_VAL("Failed to load symbols", ret == 0);
+ TEST_ASSERT_VAL("Failed to load symbols", ret > 0);
dso__sort_by_name(dso);
sym = dso__find_symbol_by_name(dso, "main");
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b434f2398df5a..2550f62e98d72 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1693,7 +1693,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
symbols__fixup_duplicate(&dso->symbols);
dso->adjust_symbols = 1;
- err = 0;
+ err = dso__has_symbols(dso);
out_free:
free(symbols);
out_close:
@@ -1914,8 +1914,8 @@ int dso__load(struct dso *dso, struct map *map)
if (nsexit)
nsinfo__mountns_enter(dso->nsinfo, &nsc);
- if (bfdrc == 0) {
- ret = 0;
+ if (bfdrc > 0) {
+ ret = 1;
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0388/1059] perf symbol: Add missing symsrc__destroy() for libbfd
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (386 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0387/1059] perf symbol: Fix symbol loading from libbfd Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0389/1059] ARM: 9486/1: set !LPAE MAX_PHYSMEM_BITS to 32 and remove supersection mappings Greg Kroah-Hartman
` (610 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Ian Rogers, Namhyung Kim,
Remi Bernon, Arnaldo Carvalho de Melo, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <namhyung@kernel.org>
[ Upstream commit 35477b351e6a697c85dc7d37e5081621889f8e40 ]
When libbfd loaded symbols and there's a pending syms_ss, it'd be lost
or overwrite existing symbols. Let's destroy it before breaking the
loop so that it can safely return from the function.
Closes: https://lore.kernel.org/r/sashiko-outbox-162540@kernel.org
Fixes: eac9a4342e5447ca ("perf symbols: Try reading the symbol table with libbfd")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Remi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/symbol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2550f62e98d72..ee984bb80f6b4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1916,7 +1916,7 @@ int dso__load(struct dso *dso, struct map *map)
if (bfdrc > 0) {
ret = 1;
- break;
+ goto out_destroy;
}
if (!is_reg || sirc < 0)
@@ -1969,6 +1969,7 @@ int dso__load(struct dso *dso, struct map *map)
ret += nr_plt;
}
+out_destroy:
for (; ss_pos > 0; ss_pos--)
symsrc__destroy(&ss_[ss_pos - 1]);
out_free:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0389/1059] ARM: 9486/1: set !LPAE MAX_PHYSMEM_BITS to 32 and remove supersection mappings
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (387 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0388/1059] perf symbol: Add missing symsrc__destroy() for libbfd Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0390/1059] Bluetooth: btmtk: Validate the firmware layout before parsing it Greg Kroah-Hartman
` (609 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Arnd Bergmann,
Russell King, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit 787a3446cafee59e31deaec662d74f86bff38999 ]
An ARM randconfig with CONFIG_GET_FREE_REGION=y and CONFIG_WERROR=y
fails to build:
include/linux/minmax.h:86:37: error: conversion from 'long long
unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes
value from '68719476735' to '4294967295' [-Werror=overflow]
Commit 14b80582c43e ("resource: Introduce alloc_free_mem_region()")
made kernel/resource.c clamp against
(1ULL << MAX_PHYSMEM_BITS) - 1. resource_size_t is 32-bit without
LPAE, but ARM's default MAX_PHYSMEM_BITS is 36.
That default was added by commit db57f88e4ccb ("ARM: 8411/1: Add
default SPARSEMEM settings") because several platforms needed at
least 36 physical address bits. !LPAE could map addresses above
32 bits only through supersections.
CONFIG_IO_36, added by commit 23bdf86aa06e ("[ARM] 3377/2: add
support for intel xsc3 core"), enabled these for XSC3 I/O. IXP23xx
placed static I/O mappings above 4GiB until its removal in 2012, and
IOP13xx ioremap()ed its PCIe windows there until its removal in 2019.
The only remaining XSC3 platform, PXA3xx, has nothing above 4GiB.
Supersection address bits overlap the descriptor domain field, so
IO_36 also renumbered the domains to make DOMAIN_IO zero. Remove
IO_36, the alternate domain numbering, and ioremap()'s supersection
path. Reject !LPAE ioremap ranges extending past 4GiB before
phys_addr_t truncation, drop the now-unneeded high static-mapping
exclusion, and reduce ioremap alignment from 16MiB to the 2MiB
covered by a PMD's pair of sections.
The other supersection user, create_36bit_mapping(), was added by
commit 0b7cd62ecdc1 ("[ARM] 3017/1: Add support for 36-bit addresses
to create_mapping()") for IXP2350 and carried IXP23xx's high static
mappings. Before this change, its only remaining call path was
efi_create_mapping() -> create_mapping_late(), for an EFI runtime
region above 4GiB.
No real-world user of this !LPAE path is known. AArch32 UEFI
requires RAM described by its memory map to be identity-mapped
during boot services, which a 32-bit virtual address space cannot
provide above 4GiB. Systems needing wider physical addressing are
expected to use LPAE.
Remove create_36bit_mapping() and the supersection definitions. If
firmware nevertheless advertises such a region on !LPAE,
efi_create_mapping() rejects it before __pfn_to_phys() truncates its
address to a low alias. EFI runtime services remain disabled, but
the kernel continues to boot. LPAE kernels are unaffected.
With no remaining !LPAE mappings above 4GiB, set MAX_PHYSMEM_BITS to
32 for !LPAE and retain 36 for LPAE, where phys_addr_t is 64-bit.
Assisted-by: Claude:claude-fable-5
Link: https://lore.kernel.org/all/3c79d2dc-8fbd-40fc-8b2d-9d1b4f8ed34e@app.fastmail.com/
Link: https://lore.kernel.org/all/CAK8P3a2MCdUbN0QSb+M3g5_6HjPsaQwtKxFjADMZWomdry4-Ww@mail.gmail.com/
Fixes: 14b80582c43e ("resource: Introduce alloc_free_mem_region()")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
[ sashal: Adjusted the efi.c include block by adding linux/sizes.h after memblock.h, since the context's screen_info.h include doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/include/asm/domain.h | 17 -----
arch/arm/include/asm/memory.h | 4 +-
arch/arm/include/asm/pgtable-2level-hwdef.h | 1 -
arch/arm/include/asm/pgtable-2level.h | 7 --
arch/arm/include/asm/sparsemem.h | 4 ++
arch/arm/kernel/efi.c | 14 ++++
arch/arm/mm/Kconfig | 7 --
arch/arm/mm/ioremap.c | 53 ++------------
arch/arm/mm/mmu.c | 76 +--------------------
9 files changed, 28 insertions(+), 155 deletions(-)
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index 41536feb43921..02f235f51aedb 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -18,27 +18,10 @@
* DOMAIN_IO - domain 2 includes all IO only
* DOMAIN_USER - domain 1 includes all user memory only
* DOMAIN_KERNEL - domain 0 includes all kernel memory only
- *
- * The domain numbering depends on whether we support 36 physical
- * address for I/O or not. Addresses above the 32 bit boundary can
- * only be mapped using supersections and supersections can only
- * be set for domain 0. We could just default to DOMAIN_IO as zero,
- * but there may be systems with supersection support and no 36-bit
- * addressing. In such cases, we want to map system memory with
- * supersections to reduce TLB misses and footprint.
- *
- * 36-bit addressing and supersections are only available on
- * CPUs based on ARMv6+ or the Intel XSC3 core.
*/
-#ifndef CONFIG_IO_36
#define DOMAIN_KERNEL 0
#define DOMAIN_USER 1
#define DOMAIN_IO 2
-#else
-#define DOMAIN_KERNEL 2
-#define DOMAIN_USER 1
-#define DOMAIN_IO 0
-#endif
#define DOMAIN_VECTORS 3
/*
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index d8eef4bd8c711..1f27089099fcc 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -84,9 +84,9 @@
#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
/*
- * Allow 16MB-aligned ioremap pages
+ * Allow 2MB-aligned ioremap pages
*/
-#define IOREMAP_MAX_ORDER 24
+#define IOREMAP_MAX_ORDER 21
#endif
#define VECTORS_BASE UL(0xffff0000)
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h
index 556937e1790ee..3fa254ac8a265 100644
--- a/arch/arm/include/asm/pgtable-2level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-2level-hwdef.h
@@ -35,7 +35,6 @@
#define PMD_SECT_APX (_AT(pmdval_t, 1) << 15) /* v6 */
#define PMD_SECT_S (_AT(pmdval_t, 1) << 16) /* v6 */
#define PMD_SECT_nG (_AT(pmdval_t, 1) << 17) /* v6 */
-#define PMD_SECT_SUPER (_AT(pmdval_t, 1) << 18) /* v6 */
#define PMD_SECT_AF (_AT(pmdval_t, 0))
#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0))
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 92abd4cd8ca2d..f44cd1b4fd705 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -96,13 +96,6 @@
#define SECTION_SIZE (1UL << SECTION_SHIFT)
#define SECTION_MASK (~(SECTION_SIZE-1))
-/*
- * ARMv6 supersection address mask and size definitions.
- */
-#define SUPERSECTION_SHIFT 24
-#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
-#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
-
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
/*
diff --git a/arch/arm/include/asm/sparsemem.h b/arch/arm/include/asm/sparsemem.h
index d362233856a5b..e32f6637cb487 100644
--- a/arch/arm/include/asm/sparsemem.h
+++ b/arch/arm/include/asm/sparsemem.h
@@ -19,7 +19,11 @@
* These can be overridden in your mach/memory.h.
*/
#if !defined(MAX_PHYSMEM_BITS) || !defined(SECTION_SIZE_BITS)
+#ifdef CONFIG_ARM_LPAE
#define MAX_PHYSMEM_BITS 36
+#else
+#define MAX_PHYSMEM_BITS 32
+#endif
#define SECTION_SIZE_BITS 28
#endif
diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index e50ad7eefc02a..e3afec63b5545 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -5,6 +5,8 @@
#include <linux/efi.h>
#include <linux/memblock.h>
+#include <linux/sizes.h>
+
#include <asm/efi.h>
#include <asm/mach/map.h>
#include <asm/mmu_context.h>
@@ -51,6 +53,18 @@ int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
.length = md->num_pages * EFI_PAGE_SIZE,
};
+ /*
+ * Non-LPAE page tables cannot map EFI runtime regions extending
+ * beyond the 32-bit physical address space.
+ */
+ if (!IS_ENABLED(CONFIG_ARM_LPAE) &&
+ (md->phys_addr >= SZ_4G ||
+ md->num_pages > (SZ_4G - md->phys_addr) / EFI_PAGE_SIZE)) {
+ pr_warn("EFI runtime region at 0x%llx exceeds 32-bit physical address space\n",
+ md->phys_addr);
+ return -ERANGE;
+ }
+
/*
* Order is important here: memory regions may have all of the
* bits below set (and usually do), so we check them in order of
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index fc439c2c16f83..3c2129a006ce2 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -328,7 +328,6 @@ config CPU_XSC3
select CPU_PABRT_LEGACY
select CPU_THUMB_CAPABLE
select CPU_TLB_V4WBI if MMU
- select IO_36
# Marvell PJ1 (Mohawk)
config CPU_MOHAWK
@@ -652,12 +651,6 @@ config CPU_V7M_NUM_IRQ
If unsure, keep default value.
-#
-# CPU supports 36-bit I/O
-#
-config IO_36
- bool
-
comment "Processor Features"
config ARM_LPAE
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 7801c5bb775d9..88c6e67e6df9e 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -30,8 +30,6 @@
#include <linux/sizes.h>
#include <linux/memblock.h>
-#include <asm/cp15.h>
-#include <asm/cputype.h>
#include <asm/cacheflush.h>
#include <asm/early_ioremap.h>
#include <asm/mmu_context.h>
@@ -236,39 +234,6 @@ remap_area_sections(unsigned long virt, unsigned long pfn,
return 0;
}
-static int
-remap_area_supersections(unsigned long virt, unsigned long pfn,
- size_t size, const struct mem_type *type)
-{
- unsigned long addr = virt, end = virt + size;
- pmd_t *pmd = pmd_off_k(addr);
-
- /*
- * Remove and free any PTE-based mapping, and
- * sync the current kernel mapping.
- */
- unmap_area_sections(virt, size);
- do {
- unsigned long super_pmd_val, i;
-
- super_pmd_val = __pfn_to_phys(pfn) | type->prot_sect |
- PMD_SECT_SUPER;
- super_pmd_val |= ((pfn >> (32 - PAGE_SHIFT)) & 0xf) << 20;
-
- for (i = 0; i < 8; i++) {
- pmd[0] = __pmd(super_pmd_val);
- pmd[1] = __pmd(super_pmd_val);
- flush_pmd_entry(pmd);
-
- addr += PMD_SIZE;
- pmd += 2;
- }
-
- pfn += SUPERSECTION_SIZE >> PAGE_SHIFT;
- } while (addr < end);
-
- return 0;
-}
#endif
static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
@@ -278,15 +243,17 @@ static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
int err;
unsigned long addr;
struct vm_struct *area;
- phys_addr_t paddr = __pfn_to_phys(pfn);
+ phys_addr_t paddr;
#ifndef CONFIG_ARM_LPAE
/*
- * High mappings must be supersection aligned
+ * The physical range must not extend beyond the 32-bit
+ * phys_addr_t
*/
- if (pfn >= 0x100000 && (paddr & ~SUPERSECTION_MASK))
+ if (((u64)pfn << PAGE_SHIFT) + offset + size > SZ_4G)
return NULL;
#endif
+ paddr = __pfn_to_phys(pfn);
type = get_mem_type(mtype);
if (!type)
@@ -300,7 +267,7 @@ static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
/*
* Try to reuse one of the static mapping whenever possible.
*/
- if (size && !(sizeof(phys_addr_t) == 4 && pfn >= 0x100000)) {
+ if (size) {
struct static_vm *svm;
svm = find_static_vm_paddr(paddr, size, mtype);
@@ -326,13 +293,7 @@ static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
area->phys_addr = paddr;
#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
- if (DOMAIN_IO == 0 &&
- (((cpu_architecture() >= CPU_ARCH_ARMv6) && (get_cr() & CR_XP)) ||
- cpu_is_xsc3()) && pfn >= 0x100000 &&
- !((paddr | size | addr) & ~SUPERSECTION_MASK)) {
- area->flags |= VM_ARM_SECTION_MAPPING;
- err = remap_area_supersections(addr, pfn, size, type);
- } else if (!((paddr | size | addr) & ~PMD_MASK)) {
+ if (!((paddr | size | addr) & ~PMD_MASK)) {
area->flags |= VM_ARM_SECTION_MAPPING;
err = remap_area_sections(addr, pfn, size, type);
} else
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index a39a7043f1896..9cfb34b09437f 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -865,69 +865,6 @@ static void __init alloc_init_p4d(pgd_t *pgd, unsigned long addr,
} while (p4d++, addr = next, addr != end);
}
-#ifndef CONFIG_ARM_LPAE
-static void __init create_36bit_mapping(struct mm_struct *mm,
- struct map_desc *md,
- const struct mem_type *type,
- bool ng)
-{
- unsigned long addr, length, end;
- phys_addr_t phys;
- pgd_t *pgd;
-
- addr = md->virtual;
- phys = __pfn_to_phys(md->pfn);
- length = PAGE_ALIGN(md->length);
-
- if (!(cpu_architecture() >= CPU_ARCH_ARMv6 || cpu_is_xsc3())) {
- pr_err("MM: CPU does not support supersection mapping for 0x%08llx at 0x%08lx\n",
- (long long)__pfn_to_phys((u64)md->pfn), addr);
- return;
- }
-
- /* N.B. ARMv6 supersections are only defined to work with domain 0.
- * Since domain assignments can in fact be arbitrary, the
- * 'domain == 0' check below is required to insure that ARMv6
- * supersections are only allocated for domain 0 regardless
- * of the actual domain assignments in use.
- */
- if (type->domain) {
- pr_err("MM: invalid domain in supersection mapping for 0x%08llx at 0x%08lx\n",
- (long long)__pfn_to_phys((u64)md->pfn), addr);
- return;
- }
-
- if ((addr | length | __pfn_to_phys(md->pfn)) & ~SUPERSECTION_MASK) {
- pr_err("MM: cannot create mapping for 0x%08llx at 0x%08lx invalid alignment\n",
- (long long)__pfn_to_phys((u64)md->pfn), addr);
- return;
- }
-
- /*
- * Shift bits [35:32] of address into bits [23:20] of PMD
- * (See ARMv6 spec).
- */
- phys |= (((md->pfn >> (32 - PAGE_SHIFT)) & 0xF) << 20);
-
- pgd = pgd_offset(mm, addr);
- end = addr + length;
- do {
- p4d_t *p4d = p4d_offset(pgd, addr);
- pud_t *pud = pud_offset(p4d, addr);
- pmd_t *pmd = pmd_offset(pud, addr);
- int i;
-
- for (i = 0; i < 16; i++)
- *pmd++ = __pmd(phys | type->prot_sect | PMD_SECT_SUPER |
- (ng ? PMD_SECT_nG : 0));
-
- addr += SUPERSECTION_SIZE;
- phys += SUPERSECTION_SIZE;
- pgd += SUPERSECTION_SIZE >> PGDIR_SHIFT;
- } while (addr != end);
-}
-#endif /* !CONFIG_ARM_LPAE */
-
static void __init __create_mapping(struct mm_struct *mm, struct map_desc *md,
void *(*alloc)(unsigned long sz),
bool ng)
@@ -939,16 +876,6 @@ static void __init __create_mapping(struct mm_struct *mm, struct map_desc *md,
type = &mem_types[md->type];
-#ifndef CONFIG_ARM_LPAE
- /*
- * Catch 36-bit addresses
- */
- if (md->pfn >= 0x100000) {
- create_36bit_mapping(mm, md, type, ng);
- return;
- }
-#endif
-
addr = md->virtual & PAGE_MASK;
phys = __pfn_to_phys(md->pfn);
length = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
@@ -975,8 +902,7 @@ static void __init __create_mapping(struct mm_struct *mm, struct map_desc *md,
* Create the page directory entries and any necessary
* page tables for the mapping specified by `md'. We
* are able to cope here with varying sizes and address
- * offsets, and we take full advantage of sections and
- * supersections.
+ * offsets, and we take full advantage of sections.
*/
static void __init create_mapping(struct map_desc *md)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0390/1059] Bluetooth: btmtk: Validate the firmware layout before parsing it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (388 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0389/1059] ARM: 9486/1: set !LPAE MAX_PHYSMEM_BITS to 32 and remove supersection mappings Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0391/1059] Bluetooth: hci_sync: fix mesh adv timeout units Greg Kroah-Hartman
` (608 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <chris.lu@mediatek.com>
[ Upstream commit 760ac9d02dce001f2e20c17deb18e7bb63d8355e ]
btmtk_setup_firmware_79xx() reads the section count out of the firmware's
global descriptor, then walks a 64-byte section map per section and hands
each section's file-supplied offset and length to the WMT download path.
None of that is checked against fw->size, so a truncated or corrupted
file makes the driver read past the end of request_firmware()'s buffer.
On 32-bit the section count can also wrap the section map size
calculation.
Add btmtk_fw_validate_layout() to check that the header, global
descriptor and section map array all fit, and btmtk_fw_validate_section()
to check one section's offset and length, both written so the size
arithmetic cannot wrap. A section count of zero is rejected as well: it
passes every size check but leaves the download loop with nothing to do,
so the function would report success on hardware it never programmed.
They are helpers rather than open-coded because the MT7928 CBMCU download
path added later needs the same arithmetic.
This is hardening against a corrupted /lib/firmware rather than a bug an
unprivileged user can trigger, hence bluetooth-next and no Fixes: tag.
Well-formed firmware files are unaffected.
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Added two firmware bounds-check helpers with no hdr variable or btmtk_coredump() in this tree, so the hunks drop that context and the helpers sit above btmtk_setup_firmware_79xx(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btmtk.c | 74 +++++++++++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index b77e337778a44..1e05f2aba7841 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -4,6 +4,7 @@
*/
#include <linux/module.h>
#include <linux/firmware.h>
+#include <linux/overflow.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -53,11 +54,71 @@ struct btmtk_section_map {
};
} __packed;
+/* Reject a firmware image whose header, global descriptor or section map
+ * array does not fit in the file, and hand back the validated section
+ * count, so that the section map walks stay inside the firmware buffer.
+ */
+static int btmtk_fw_validate_layout(struct hci_dev *hdev,
+ const struct firmware *fw,
+ u32 *section_num)
+{
+ const struct btmtk_global_desc *globaldesc;
+ size_t need;
+
+ if (fw->size < MTK_FW_ROM_PATCH_HEADER_SIZE + MTK_FW_ROM_PATCH_GD_SIZE) {
+ bt_dev_err(hdev, "Firmware too small: %zu bytes, need at least %u",
+ fw->size,
+ MTK_FW_ROM_PATCH_HEADER_SIZE + MTK_FW_ROM_PATCH_GD_SIZE);
+ return -EINVAL;
+ }
+
+ globaldesc = (const struct btmtk_global_desc *)(fw->data +
+ MTK_FW_ROM_PATCH_HEADER_SIZE);
+ *section_num = le32_to_cpu(globaldesc->section_num);
+
+ if (!*section_num) {
+ bt_dev_err(hdev, "Firmware declares no sections");
+ return -EINVAL;
+ }
+
+ if (check_mul_overflow((size_t)MTK_FW_ROM_PATCH_SEC_MAP_SIZE,
+ (size_t)*section_num, &need) ||
+ check_add_overflow(need,
+ (size_t)(MTK_FW_ROM_PATCH_HEADER_SIZE +
+ MTK_FW_ROM_PATCH_GD_SIZE),
+ &need)) {
+ bt_dev_err(hdev, "Firmware section count too large: %u",
+ *section_num);
+ return -EINVAL;
+ }
+
+ if (fw->size < need) {
+ bt_dev_err(hdev, "Firmware truncated: %zu bytes, need %zu for %u sections",
+ fw->size, need, *section_num);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+/* Reject a section whose payload does not lie within the firmware file. */
+static int btmtk_fw_validate_section(struct hci_dev *hdev,
+ const struct firmware *fw, int index,
+ u32 offset, u32 size)
+{
+ if (offset > fw->size || size > fw->size - offset) {
+ bt_dev_err(hdev, "Firmware section %d out of bounds: offset=%u, size=%u, fw_size=%zu",
+ index, offset, size, fw->size);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
wmt_cmd_sync_func_t wmt_cmd_sync)
{
struct btmtk_hci_wmt_params wmt_params;
- struct btmtk_global_desc *globaldesc = NULL;
struct btmtk_section_map *sectionmap;
const struct firmware *fw;
const u8 *fw_ptr;
@@ -73,10 +134,12 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
return err;
}
+ err = btmtk_fw_validate_layout(hdev, fw, §ion_num);
+ if (err < 0)
+ goto err_release_fw;
+
fw_ptr = fw->data;
fw_bin_ptr = fw_ptr;
- globaldesc = (struct btmtk_global_desc *)(fw_ptr + MTK_FW_ROM_PATCH_HEADER_SIZE);
- section_num = le32_to_cpu(globaldesc->section_num);
for (i = 0; i < section_num; i++) {
first_block = 1;
@@ -88,6 +151,11 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
dl_size = le32_to_cpu(sectionmap->bin_info_spec.dlsize);
if (dl_size > 0) {
+ err = btmtk_fw_validate_section(hdev, fw, i,
+ section_offset, dl_size);
+ if (err < 0)
+ goto err_release_fw;
+
retry = 20;
while (retry > 0) {
cmd[0] = 0; /* 0 means legacy dl mode. */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0391/1059] Bluetooth: hci_sync: fix mesh adv timeout units
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (389 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0390/1059] Bluetooth: btmtk: Validate the firmware layout before parsing it Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0392/1059] Bluetooth: hci_event: Fix LE link drop on remote features command status Greg Kroah-Hartman
` (607 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pauli Virtanen,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <pav@iki.fi>
[ Upstream commit 8a8d51eeedebfa5aaaae7720f2fb2aa1a67b8587 ]
Mesh adv instance timeout and duration are in milliseconds, see
mesh_send_sync, hci_add_adv_instance. hci_schedule_adv_instance_sync()
and hci_enable_ext_advertising_sync() ignore this, and scale the timeout
wrong.
Fix for mesh instances by using msecs_to_jiffies() in
hci_schedule_adv_instance_sync and fixing the scaling in
hci_enable_ext_advertising_sync.
Fixes BlueZ "Mesh - Send cancel" test failures.
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Assisted-by: opencode:qwen3.8-flash-next sashiko
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Replaced the non-mesh secs_to_jiffies(timeout) arm with msecs_to_jiffies(timeout * 1000), since this branch lacks secs_to_jiffies(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 2884ca241b526..7d7122c5bb43a 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1731,7 +1731,8 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)
* scheduling it.
*/
if (adv && adv->timeout) {
- u16 duration = adv->timeout * MSEC_PER_SEC;
+ u16 duration = adv->mesh ? adv->timeout :
+ adv->timeout * MSEC_PER_SEC;
/* Time = N * 10 ms */
set->duration = cpu_to_le16(duration / 10);
@@ -2178,7 +2179,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
hdev->adv_instance_timeout = timeout;
queue_delayed_work(hdev->req_workqueue,
&hdev->adv_instance_expire,
- msecs_to_jiffies(timeout * 1000));
+ adv->mesh ? msecs_to_jiffies(timeout) :
+ msecs_to_jiffies(timeout * 1000));
}
/* If we're just re-scheduling the same instance again then do not
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0392/1059] Bluetooth: hci_event: Fix LE link drop on remote features command status
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (390 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0391/1059] Bluetooth: hci_sync: fix mesh adv timeout units Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0393/1059] veth: clear rx queue hint in veth_xmit Greg Kroah-Hartman
` (606 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit 91638f53ff2b8234195ff27ec913e068269a28e9 ]
When the local controller supports peripheral-initiated features
exchange, the LE Read Remote Features procedure also runs for incoming
connections, and it fails with Unsupported Remote Feature (0x1a) if the
central does not support that feature. hci_le_remote_feat_complete_evt()
and hci_le_read_all_remote_features_evt() handle this and let the
connection transition into connected state.
A controller can also return that error in the Command Status event
instead. An Intel controller does so for a central that does not
support peripheral-initiated features exchange, presumably because it
already has the features of the central. hci_cs_le_read_remote_features()
and hci_cs_le_read_all_remote_features() then confirm the connection as
failed while it is still in BT_CONFIG, and the hci_conn_drop() in
le_read_features_complete() disconnects it right away:
> HCI Event: LE Meta Event (0x3e) plen 31
LE Enhanced Connection Complete (0x0a)
Status: Success (0x00)
Role: Peripheral (0x01)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
> HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) ncmd 1
Status: Unsupported Remote Feature / Unsupported LMP Feature (0x1a)
< HCI Command: Disconnect (0x01|0x0006) plen 3
Reason: Remote User Terminated Connection (0x13)
Data the central sends afterwards is reported as:
Bluetooth: hci0: ACL packet for unknown connection handle 3585
Handle Unsupported Remote Feature in the command status the same way as
in the complete events.
Fixes: 0fe29fd1cd77 ("Bluetooth: Read LE remote features during connection establishment")
Fixes: a106e50be74b ("Bluetooth: HCI: Add support for LL Extended Feature Set")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Kept the existing nested if (conn) { if (conn->state == BT_CONFIG) ... } form with hci_conn_drop() and added the fix inside it, and dropped the hci_cs_le_read_all_remote_features() hunk because that function doesn't exist. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_event.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 8e6017834bb59..4aba79ad6dd84 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2936,6 +2936,22 @@ static void hci_cs_le_read_remote_features(struct hci_dev *hdev, u8 status)
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
if (conn) {
if (conn->state == BT_CONFIG) {
+ /* If the local controller supports peripheral-initiated
+ * features exchange, but the remote controller does not,
+ * then the controller may already return the error code
+ * 0x1a for unsupported remote feature in the command
+ * status.
+ *
+ * Handle it as hci_le_remote_feat_complete_evt() does and
+ * allow the connection to transition into connected state.
+ */
+ if (!conn->out &&
+ status == HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE &&
+ (hdev->le_features[0] & HCI_LE_PERIPHERAL_FEATURES)) {
+ conn->state = BT_CONNECTED;
+ status = 0x00;
+ }
+
hci_connect_cfm(conn, status);
hci_conn_drop(conn);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0393/1059] veth: clear rx queue hint in veth_xmit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (391 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0392/1059] Bluetooth: hci_event: Fix LE link drop on remote features command status Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0394/1059] rxrpc: Fix sendmsg length Greg Kroah-Hartman
` (605 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Björn Töpel,
Toshiaki Makita, Lorenzo Bianconi, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit 1b1c0e87cfe78d731bbab99c9c018655980b6790 ]
With more tx queues on one end of a veth pair than rx queues on the
other, and RPS or generic XDP enabled on the receiving end, we get:
veth1 received packet on queue 2, but number of RX queues is 2
WARNING: net/core/dev.c:5212 at get_rps_cpu+0x560/0x1360
Call Trace:
<TASK>
netif_rx_internal+0x1af/0x4c0
__netif_rx+0x99/0x350
veth_xmit+0x713/0xca0
dev_hard_start_xmit+0x166/0x5f0
__dev_queue_xmit+0x1797/0x42d0
ip_finish_output2+0xa34/0x1f40
__ip_finish_output+0x510/0x7e0
ip_finish_output+0x2f/0x320
ip_output+0x17a/0x3f0
ip_send_skb+0x1bc/0x220
......
Easy to hit with "ethtool -L veth0 tx 4", "ethtool -L veth1 rx 2",
rps_cpus set on veth1 and a few flows sent over the pair [1].
veth_xmit() uses skb->queue_mapping to pick the peer rq, but never
clears it before veth_forward_skb(), so the rx side still sees the tx
queue index. Everything on the rx side that goes through
skb_get_rx_queue(), like get_rps_cpu() and netif_get_rxqueue() for
generic XDP, takes it as a recorded rx queue and warns once it is out
of range.
Clear it before handing the skb to the peer:
- It is the tx queue index of this device, it says nothing about the
rx queue of the peer.
- The two sides don't even agree on the encoding. The tx side stores
the index as is, the rx side stores index + 1 so that 0 can mean
"not recorded". So tx queue k is read back as rx queue k - 1, and
tx queue 0 as "not recorded".
- Commit 710ad98c363a ("veth: Do not record rx queue hint in
veth_xmit") already decided that veth should not pass any queue
hint to the peer. There is no tx->rx queue mapping to preserve, so
nothing is lost by clearing it.
On NETDEV_TX_BUSY the skb goes back to the qdisc, which looks up the
txq from skb->queue_mapping to decide when to retry, so restore it
there, next to the existing __skb_push().
[1]: https://lore.kernel.org/netdev/156834bb-8e40-496e-9443-9d515fa18eab@linux.dev/
Fixes: 76ff5cc91935 ("rtnl: allow to specify number of rx and tx queues on device creation")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Toshiaki Makita <toshiaki.makita1@gmail.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261009040412.14571-1-jiayuan.chen@linux.dev
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Dropped the NETDEV_TX_BUSY queue_mapping restore hunk because veth_xmit() has no NETDEV_TX_BUSY path here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/veth.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index b460c021c0ef5..d2ed585a31db3 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -344,6 +344,10 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
}
skb_tx_timestamp(skb);
+
+ /* tx queue index of this device, meaningless as rx queue of the peer */
+ skb_set_queue_mapping(skb, 0);
+
if (likely(veth_forward_skb(rcv, skb, rq, use_napi) == NET_RX_SUCCESS)) {
if (!use_napi)
dev_sw_netstats_tx_add(dev, 1, length);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0394/1059] rxrpc: Fix sendmsg length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (392 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0393/1059] veth: clear rx queue hint in veth_xmit Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0395/1059] irqchip/mst-intc: Validate the DT interrupt range Greg Kroah-Hartman
` (604 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Marc Dionne,
Jeffrey Altman, Eric Dumazet, David S. Miller, Jakub Kicinski,
Paolo Abeni, Simon Horman, linux-afs, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <dhowells@redhat.com>
[ Upstream commit ef369cacbd524931199078427ae152c63a826189 ]
rxrpc_send_data() is given two data lengths (len and msg->msg_iter.count)
and is inconsistent about how it uses them. Fix this by using len in
preference to msg->msg_iter.count. Also limit the amount copied to either
len or msg->msg_iter.count, whichever is smaller.
Note that, currently, all the callers have len and msg->msg_iter.count the
same and so the problem won't occur. This is a prerequisite for another
patch that fixes the handling of encryption errors.
Fixes: 382d7974de31 ("RxRPC: Use iov_iter_count() in rxrpc_send_data() instead of the len argument")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20261006133011.531806-8-dhowells@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Adapted the fix to the older skb-based send code, using len in the buffer sizing, copy clamp, full-packet test, last-packet flag and rxrpc_queue_packet() argument instead of txb-based helpers. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/rxrpc/sendmsg.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 4b5ee70433039..a4ad0dc9f4367 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -318,9 +318,9 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
ret = -EMSGSIZE;
if (call->tx_total_len != -1) {
- if (len - copied > call->tx_total_len)
+ if (len > call->tx_total_len)
goto maybe_error;
- if (!more && len - copied != call->tx_total_len)
+ if (!more && len != call->tx_total_len)
goto maybe_error;
}
@@ -343,7 +343,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
* the security header is going to be in the padded
* region (enc blocksize), but the trailer is not.
*/
- remain = more ? INT_MAX : msg_data_left(msg);
+ remain = more ? INT_MAX : len;
ret = call->conn->security->how_much_data(call, remain,
&bufsize, &chunk, &offset);
if (ret < 0)
@@ -387,9 +387,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
sp = rxrpc_skb(skb);
/* append next segment of data to the current buffer */
- if (msg_data_left(msg) > 0) {
+ if (len > 0) {
int copy = skb_tailroom(skb);
ASSERTCMP(copy, >, 0);
+ if (copy > len)
+ copy = len;
if (copy > msg_data_left(msg))
copy = msg_data_left(msg);
if (copy > sp->remain)
@@ -403,6 +405,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
sp->remain -= copy;
skb->mark += copy;
copied += copy;
+ len -= copy;
if (call->tx_total_len != -1)
call->tx_total_len -= copy;
}
@@ -414,7 +417,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
/* add the packet to the send queue if it's now full */
if (sp->remain <= 0 ||
- (msg_data_left(msg) == 0 && !more)) {
+ (len == 0 && !more)) {
struct rxrpc_connection *conn = call->conn;
uint32_t seq;
@@ -424,7 +427,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
sp->hdr._rsvd = 0;
sp->hdr.flags = conn->out_clientflag;
- if (msg_data_left(msg) == 0 && !more)
+ if (len == 0 && !more)
sp->hdr.flags |= RXRPC_LAST_PACKET;
else if (call->tx_top - call->tx_hard_ack <
call->tx_winsize)
@@ -435,12 +438,12 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
goto out_unlock;
ret = rxrpc_queue_packet(rx, call, skb,
- !msg_data_left(msg) && !more,
+ len == 0 && !more,
notify_end_tx);
/* Should check for failure here */
call->tx_pending = NULL;
}
- } while (msg_data_left(msg) > 0);
+ } while (len > 0 && msg_data_left(msg) > 0);
success:
ret = copied;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0395/1059] irqchip/mst-intc: Validate the DT interrupt range
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (393 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0394/1059] rxrpc: Fix sendmsg length Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0396/1059] irqchip/gic: Fix UBSAN shift-out-of-bounds in GIC helpers Greg Kroah-Hartman
` (603 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Thomas Gleixner,
Radu Rendec, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 16f25d326e5d3b9fd51bc5e3916ecbffbca63e7b ]
The driver takes an inclusive interrupt range from the device tree
without checking its endpoints. A reversed range wraps the unsigned
count calculation, and a range larger than MST_INTC_MAX_IRQS exceeds the
controller capacity used by the driver.
Reject these ranges before calculating nr_irqs or creating the domain.
Check the difference after ordering the endpoints so the validation
itself cannot wrap.
The issue was found by our static-analysis tool.
Fixes: ad4c938c92af ("irqchip/irq-mst: Add MStar interrupt controller support")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: gpt 5
Reviewed-by: Radu Rendec <radu@rendec.net>
Link: https://patch.msgid.link/20260920034236.16229-1-hppiscas@163.com
[ sashal: Kept the branch's kzalloc(sizeof(*cd), GFP_KERNEL) context line instead of upstream's kzalloc_obj(*cd), with the added range check otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-mst-intc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/irqchip/irq-mst-intc.c b/drivers/irqchip/irq-mst-intc.c
index f6133ae281556..e30c91ab4790f 100644
--- a/drivers/irqchip/irq-mst-intc.c
+++ b/drivers/irqchip/irq-mst-intc.c
@@ -259,6 +259,9 @@ static int __init mst_intc_of_init(struct device_node *dn,
of_property_read_u32_index(dn, "mstar,irqs-map-range", 1, &irq_end))
return -EINVAL;
+ if (irq_end < irq_start || irq_end - irq_start >= MST_INTC_MAX_IRQS)
+ return -EINVAL;
+
cd = kzalloc(sizeof(*cd), GFP_KERNEL);
if (!cd)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0396/1059] irqchip/gic: Fix UBSAN shift-out-of-bounds in GIC helpers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (394 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0395/1059] irqchip/mst-intc: Validate the DT interrupt range Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0397/1059] spi: omap2-mcspi: handle DMA setup failures Greg Kroah-Hartman
` (602 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Ling, Thomas Gleixner,
Zenghui Yu (Huawei), Radu Rendec, Marc Zyngier, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Ling <zhuling2709@phytium.com.cn>
[ Upstream commit 13ce14ca41a35f5ee90b77ffa57da91ce6048a2d ]
When running with UBSAN enabled, enabling a GPIO controller that uses a
GIC interrupt as its parent triggers several shift-out-of-bounds warnings:
shift-out-of-bounds in drivers/irqchip/irq-gic-common.c:50:21
left shift of 2 by 30 places cannot be represented in type 'int'
Similar reports are emitted from gic_poke_irq() and gic_peek_irq() in
drivers/irqchip/irq-gic-v3.c. The corresponding GICv2 helpers use the
same signed-shift pattern. These masks are generated by shifting signed
integer constants, which invokes undefined behavior when bit 31 is
selected.
Use BIT() to generate the masks with an unsigned type and make their
intent explicit.
Fixes: f27ecacc54cc ("[ARM] Add support for ARM GIC")
Fixes: 5c0c1f08abf0 ("ARM: 6150/1: gic: implement set_type")
Fixes: 021f653791ad ("irqchip: gic-v3: Initial support for GICv3")
Signed-off-by: Zhu Ling <zhuling2709@phytium.com.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Reviewed-by: Radu Rendec <radu@rendec.net>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/2fJDwUUYdEf2_eaRa041L9xkT8RkSWFeo7euOnqMbbPhUatLlEaAvGfB6sOspDmXaxO87Eh7bQLV9UolyjbMtZBT1wB2UGypjPOo0Z-RC0Q=@proton.me
Link: https://patch.msgid.link/20260929031050.16988-1-zhuling2709@phytium.com.cn
[ sashal: Replaced signed-shift masks with BIT() in irq-gic.c while keeping the existing gic_irq(d) accessor and layout instead of upstream's irqd_to_hwirq(d) context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-common.c | 2 +-
drivers/irqchip/irq-gic-v3.c | 4 ++--
drivers/irqchip/irq-gic.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c
index afd6a1841715a..2efbb880bbc46 100644
--- a/drivers/irqchip/irq-gic-common.c
+++ b/drivers/irqchip/irq-gic-common.c
@@ -47,7 +47,7 @@ void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks,
int gic_configure_irq(unsigned int irq, unsigned int type,
void __iomem *base, void (*sync_access)(void))
{
- u32 confmask = 0x2 << ((irq % 16) * 2);
+ u32 confmask = BIT(((irq % 16) * 2) + 1);
u32 confoff = (irq / 16) * 4;
u32 val, oldval;
int ret = 0;
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 6ef0be2c0ab87..1a327db3d041c 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -382,7 +382,7 @@ static int gic_peek_irq(struct irq_data *d, u32 offset)
u32 index, mask;
offset = convert_offset_index(d, offset, &index);
- mask = 1 << (index % 32);
+ mask = BIT(index % 32);
if (gic_irq_in_rdist(d))
base = gic_data_rdist_sgi_base();
@@ -398,7 +398,7 @@ static void gic_poke_irq(struct irq_data *d, u32 offset)
u32 index, mask;
offset = convert_offset_index(d, offset, &index);
- mask = 1 << (index % 32);
+ mask = BIT(index % 32);
if (gic_irq_in_rdist(d))
base = gic_data_rdist_sgi_base();
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 867b282fa95d4..6bed385d0810b 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -182,13 +182,13 @@ static inline bool cascading_gic_irq(struct irq_data *d)
*/
static void gic_poke_irq(struct irq_data *d, u32 offset)
{
- u32 mask = 1 << (gic_irq(d) % 32);
+ u32 mask = BIT(gic_irq(d) % 32);
writel_relaxed(mask, gic_dist_base(d) + offset + (gic_irq(d) / 32) * 4);
}
static int gic_peek_irq(struct irq_data *d, u32 offset)
{
- u32 mask = 1 << (gic_irq(d) % 32);
+ u32 mask = BIT(gic_irq(d) % 32);
return !!(readl_relaxed(gic_dist_base(d) + offset + (gic_irq(d) / 32) * 4) & mask);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0397/1059] spi: omap2-mcspi: handle DMA setup failures
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (395 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0396/1059] irqchip/gic: Fix UBSAN shift-out-of-bounds in GIC helpers Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0398/1059] RDMA/rxe: Fix out-of-range unsigned-to-signed conversion for RDMA message in 2GiB size Greg Kroah-Hartman
` (601 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sahaj Chaudhari, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
[ Upstream commit c126e07bde21c518f1356937ac240500d1bc81c0 ]
The DMA paths ignore failures from dmaengine_slave_config(), descriptor
preparation and dmaengine_submit(), and carry FIXME comments about
falling back to PIO. A failed setup can leave a half-started transfer
or wait for a completion that never arrives.
Check each step and clean up with dmaengine_terminate_sync() on error.
Prepare both descriptors before issuing either channel. Fall back to
PIO only for host-mode transfers that have a TX buffer, when no DMA has
been started and cleanup succeeded. RX-only and target-mode transfers
return the error instead, since the bus may already be clocking.
The FIFO is enabled before the DMA attempt, but the PIO path polls
per-word TXS/RXS and does not expect FIFO mode. Disable the FIFO, with
the channel off while its bits change, before falling back.
Tested on an AM642 board with a TI 6.12.57 vendor kernel built with
this patch and booted from RAM. On a McSPI bus using DMA, 200
iterations of 4096-byte TX and 1024-byte RX spidev transfers completed
with no errors, timeouts or kernel warnings. With a temporary change
that fails every DMA-sized TX setup, 60 spidev writes fell back to PIO
with no errors or timeouts. That test used a bus with no device
attached and did not show a difference with and without the FIFO
disable, which is based on reading the code.
Fixes: 53741ed8f0a3 ("spi: omap2-mcspi: add DMA engine support")
Link: https://lore.kernel.org/r/20250914022132.319227-1-alex.t.tran@gmail.com
Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com>
Link: https://patch.msgid.link/20261015064341.1100422-1-sahaj123.sc@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Adapted to the older SPI API names (slave/master, spi->chip_select, cur_msg_mapped && can_dma) in place of the newer target/ctlr/spi_get_chipselect/spi_xfer_is_dma_mapped helpers. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-omap2-mcspi.c | 236 ++++++++++++++++++++++++----------
1 file changed, 167 insertions(+), 69 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 16109ff1ba728..aeb3628bbbd29 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -399,10 +399,11 @@ static void omap2_mcspi_tx_callback(void *data)
complete(&mcspi_dma->dma_tx_completion);
}
-static void omap2_mcspi_tx_dma(struct spi_device *spi,
- struct spi_transfer *xfer,
- struct dma_slave_config cfg)
+static int omap2_mcspi_tx_dma(struct spi_device *spi,
+ struct spi_transfer *xfer,
+ struct dma_slave_config cfg)
{
+ int ret;
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
struct dma_async_tx_descriptor *tx;
@@ -410,31 +411,31 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
- dmaengine_slave_config(mcspi_dma->dma_tx, &cfg);
+ ret = dmaengine_slave_config(mcspi_dma->dma_tx, &cfg);
+ if (ret)
+ return ret;
tx = dmaengine_prep_slave_sg(mcspi_dma->dma_tx, xfer->tx_sg.sgl,
xfer->tx_sg.nents,
DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
- if (tx) {
- tx->callback = omap2_mcspi_tx_callback;
- tx->callback_param = spi;
- dmaengine_submit(tx);
- } else {
- /* FIXME: fall back to PIO? */
- }
- dma_async_issue_pending(mcspi_dma->dma_tx);
- omap2_mcspi_set_dma_req(spi, 0, 1);
+ if (!tx)
+ return -EIO;
+
+ tx->callback = omap2_mcspi_tx_callback;
+ tx->callback_param = spi;
+
+ return dma_submit_error(dmaengine_submit(tx));
}
-static unsigned
+static int
omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
- struct dma_slave_config cfg,
- unsigned es)
+ struct dma_slave_config cfg, unsigned int es,
+ unsigned int *count, bool *rx_submitted, bool *dma_started)
{
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
- unsigned int count, transfer_reduction = 0;
+ unsigned int transfer_reduction = 0;
struct scatterlist *sg_out[2];
int nb_sizes = 0, out_mapped_nents[2], ret, x;
size_t sizes[2];
@@ -447,7 +448,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
- count = xfer->len;
+ *count = xfer->len;
+ *rx_submitted = false;
/*
* In the "End-of-Transfer Procedure" section for DMA RX in OMAP35x TRM
@@ -461,14 +463,16 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
l = mcspi_cached_chconf0(spi);
if (word_len <= 8)
- element_count = count;
+ element_count = *count;
else if (word_len <= 16)
- element_count = count >> 1;
+ element_count = *count >> 1;
else /* word_len <= 32 */
- element_count = count >> 2;
+ element_count = *count >> 2;
- dmaengine_slave_config(mcspi_dma->dma_rx, &cfg);
+ ret = dmaengine_slave_config(mcspi_dma->dma_rx, &cfg);
+ if (ret)
+ return ret;
/*
* Reduce DMA transfer length by one more if McSPI is
@@ -479,7 +483,7 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
if (transfer_reduction) {
/* Split sgl into two. The second sgl won't be used. */
- sizes[0] = count - transfer_reduction;
+ sizes[0] = *count - transfer_reduction;
sizes[1] = transfer_reduction;
nb_sizes = 2;
} else {
@@ -487,44 +491,56 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
* Don't bother splitting the sgl. This essentially
* clones the original sgl.
*/
- sizes[0] = count;
+ sizes[0] = *count;
nb_sizes = 1;
}
ret = sg_split(xfer->rx_sg.sgl, xfer->rx_sg.nents, 0, nb_sizes,
sizes, sg_out, out_mapped_nents, GFP_KERNEL);
- if (ret < 0) {
+ if (ret) {
dev_err(&spi->dev, "sg_split failed\n");
- return 0;
+ return ret;
}
tx = dmaengine_prep_slave_sg(mcspi_dma->dma_rx, sg_out[0],
out_mapped_nents[0], DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
- if (tx) {
- tx->callback = omap2_mcspi_rx_callback;
- tx->callback_param = spi;
- dmaengine_submit(tx);
- } else {
- /* FIXME: fall back to PIO? */
+ if (!tx) {
+ ret = -EIO;
+ goto out_free_sg;
}
+ tx->callback = omap2_mcspi_rx_callback;
+ tx->callback_param = spi;
+ ret = dma_submit_error(dmaengine_submit(tx));
+ if (ret)
+ goto out_free_sg;
+
+ *rx_submitted = true;
+ if (mcspi->slave_aborted) {
+ ret = -EINTR;
+ goto out_free_sg;
+ }
+ *dma_started = true;
+ if (xfer->tx_buf) {
+ if (spi_controller_is_slave(mcspi->master))
+ mcspi_write_reg(mcspi->master, OMAP2_MCSPI_IRQENABLE,
+ OMAP2_MCSPI_IRQSTATUS_EOW);
+ dma_async_issue_pending(mcspi_dma->dma_tx);
+ omap2_mcspi_set_dma_req(spi, 0, 1);
+ }
dma_async_issue_pending(mcspi_dma->dma_rx);
omap2_mcspi_set_dma_req(spi, 1, 1);
-
ret = mcspi_wait_for_completion(mcspi, &mcspi_dma->dma_rx_completion);
- if (ret || mcspi->slave_aborted) {
- dmaengine_terminate_sync(mcspi_dma->dma_rx);
- omap2_mcspi_set_dma_req(spi, 1, 0);
- return 0;
- }
+ if (ret || mcspi->slave_aborted)
+ goto out_free_sg;
for (x = 0; x < nb_sizes; x++)
kfree(sg_out[x]);
if (mcspi->fifo_depth > 0)
- return count;
+ return 0;
/*
* Due to the DMA transfer length reduction the missing bytes must
@@ -551,9 +567,9 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
} else {
int bytes_per_word = mcspi_bytes_per_word(word_len);
dev_err(&spi->dev, "DMA RX penultimate word empty\n");
- count -= (bytes_per_word << 1);
+ *count -= (bytes_per_word << 1);
omap2_mcspi_set_enable(spi, 1);
- return count;
+ return 0;
}
}
if (!mcspi_wait_for_reg_bit(chstat_reg, OMAP2_MCSPI_CHSTAT_RXS)) {
@@ -568,19 +584,27 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
((u32 *)xfer->rx_buf)[elements] = w;
} else {
dev_err(&spi->dev, "DMA RX last word empty\n");
- count -= mcspi_bytes_per_word(word_len);
+ *count -= mcspi_bytes_per_word(word_len);
}
omap2_mcspi_set_enable(spi, 1);
- return count;
+ return 0;
+
+out_free_sg:
+ if (!ret)
+ ret = -EINTR;
+ for (x = 0; x < nb_sizes; x++)
+ kfree(sg_out[x]);
+ return ret;
}
-static unsigned
-omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
+static int omap2_mcspi_txrx_dma(struct spi_device *spi,
+ struct spi_transfer *xfer,
+ unsigned int *count,
+ bool *pio_fallback)
{
struct omap2_mcspi *mcspi;
struct omap2_mcspi_cs *cs = spi->controller_state;
struct omap2_mcspi_dma *mcspi_dma;
- unsigned int count;
u8 *rx;
const u8 *tx;
struct dma_slave_config cfg;
@@ -588,10 +612,13 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
unsigned es;
void __iomem *chstat_reg;
void __iomem *irqstat_reg;
- int wait_res;
+ bool tx_submitted = false, rx_submitted = false;
+ bool dma_started = false, terminate_failed = false;
+ int ret, wait_res;
mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
+ *pio_fallback = false;
if (cs->word_len <= 8) {
width = DMA_SLAVE_BUSWIDTH_1_BYTE;
@@ -604,7 +631,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
es = 4;
}
- count = xfer->len;
+ *count = xfer->len;
memset(&cfg, 0, sizeof(cfg));
cfg.src_addr = cs->phys + OMAP2_MCSPI_RX0;
@@ -622,31 +649,39 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
reinit_completion(&mcspi_dma->dma_rx_completion);
reinit_completion(&mcspi->txdone);
if (tx) {
- /* Enable EOW IRQ to know end of tx in slave mode */
+ ret = omap2_mcspi_tx_dma(spi, xfer, cfg);
+ if (ret)
+ goto out;
+ tx_submitted = true;
+ }
+
+ if (rx) {
+ ret = omap2_mcspi_rx_dma(spi, xfer, cfg, es, count,
+ &rx_submitted, &dma_started);
+ if (ret)
+ goto out;
+ } else if (tx) {
+ if (mcspi->slave_aborted) {
+ ret = -EINTR;
+ goto out;
+ }
if (spi_controller_is_slave(spi->master))
- mcspi_write_reg(spi->master,
- OMAP2_MCSPI_IRQENABLE,
+ mcspi_write_reg(spi->master, OMAP2_MCSPI_IRQENABLE,
OMAP2_MCSPI_IRQSTATUS_EOW);
- omap2_mcspi_tx_dma(spi, xfer, cfg);
+ dma_started = true;
+ dma_async_issue_pending(mcspi_dma->dma_tx);
+ omap2_mcspi_set_dma_req(spi, 0, 1);
}
- if (rx != NULL)
- count = omap2_mcspi_rx_dma(spi, xfer, cfg, es);
-
- if (tx != NULL) {
- int ret;
-
+ if (tx) {
ret = mcspi_wait_for_completion(mcspi, &mcspi_dma->dma_tx_completion);
- if (ret || mcspi->slave_aborted) {
- dmaengine_terminate_sync(mcspi_dma->dma_tx);
- omap2_mcspi_set_dma_req(spi, 0, 0);
- return 0;
- }
+ if (ret || mcspi->slave_aborted)
+ goto out;
if (spi_controller_is_slave(mcspi->master)) {
ret = mcspi_wait_for_completion(mcspi, &mcspi->txdone);
if (ret || mcspi->slave_aborted)
- return 0;
+ goto out;
}
if (mcspi->fifo_depth > 0) {
@@ -680,7 +715,43 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
dev_err(&spi->dev, "EOT timed out\n");
}
}
- return count;
+ return 0;
+
+out:
+ if (!ret)
+ ret = -EINTR;
+ if (rx_submitted) {
+ wait_res = dmaengine_terminate_sync(mcspi_dma->dma_rx);
+ if (wait_res) {
+ dev_err(&spi->dev, "failed to terminate RX DMA: %d\n",
+ wait_res);
+ terminate_failed = true;
+ ret = wait_res;
+ }
+ omap2_mcspi_set_dma_req(spi, 1, 0);
+ }
+ if (tx_submitted) {
+ wait_res = dmaengine_terminate_sync(mcspi_dma->dma_tx);
+ if (wait_res) {
+ dev_err(&spi->dev, "failed to terminate TX DMA: %d\n",
+ wait_res);
+ terminate_failed = true;
+ ret = wait_res;
+ }
+ omap2_mcspi_set_dma_req(spi, 0, 0);
+ }
+ if (spi_controller_is_slave(mcspi->master))
+ mcspi_write_reg(mcspi->master, OMAP2_MCSPI_IRQENABLE, 0);
+
+ *pio_fallback = !dma_started && !terminate_failed;
+ return ret;
+}
+
+static bool omap2_mcspi_can_pio_fallback(bool cleanup_ok,
+ const struct spi_transfer *xfer,
+ bool is_target)
+{
+ return cleanup_ok && xfer->tx_buf && !is_target;
}
static unsigned
@@ -1199,6 +1270,8 @@ static int omap2_mcspi_transfer_one(struct spi_master *master,
if (t->len) {
unsigned count;
+ bool pio_fallback;
+ int ret;
if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) &&
master->cur_msg_mapped &&
@@ -1214,10 +1287,31 @@ static int omap2_mcspi_transfer_one(struct spi_master *master,
if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) &&
master->cur_msg_mapped &&
- master->can_dma(master, spi, t))
- count = omap2_mcspi_txrx_dma(spi, t);
- else
+ master->can_dma(master, spi, t)) {
+ ret = omap2_mcspi_txrx_dma(spi, t, &count,
+ &pio_fallback);
+ if (ret) {
+ bool is_target = spi_controller_is_slave(master);
+ bool fallback;
+
+ fallback = omap2_mcspi_can_pio_fallback(pio_fallback, t,
+ is_target);
+ if (!fallback) {
+ status = ret;
+ goto out;
+ }
+
+ dev_warn(&spi->dev,
+ "DMA setup failed, falling back to PIO\n");
+ /* PIO does not use the FIFO enabled for DMA */
+ omap2_mcspi_set_enable(spi, 0);
+ omap2_mcspi_set_fifo(spi, t, 0);
+ omap2_mcspi_set_enable(spi, 1);
+ count = omap2_mcspi_txrx_pio(spi, t);
+ }
+ } else {
count = omap2_mcspi_txrx_pio(spi, t);
+ }
if (count != t->len) {
status = -EIO;
@@ -1233,8 +1327,12 @@ static int omap2_mcspi_transfer_one(struct spi_master *master,
out:
/* Restore defaults if they were overriden */
if (par_override) {
+ int restore_status;
+
par_override = 0;
- status = omap2_mcspi_setup_transfer(spi, NULL);
+ restore_status = omap2_mcspi_setup_transfer(spi, NULL);
+ if (!status)
+ status = restore_status;
}
if (cd && cd->cs_per_word) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0398/1059] RDMA/rxe: Fix out-of-range unsigned-to-signed conversion for RDMA message in 2GiB size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (396 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0397/1059] spi: omap2-mcspi: handle DMA setup failures Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0399/1059] ASoC: rt5645: Shut down the button timer on removal Greg Kroah-Hartman
` (600 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Honggang LI, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Honggang LI <honggangli@163.com>
[ Upstream commit 56a27df6cedd4f3918969d61c7b9d3cc177b2d1b ]
When RDMA READ request for 2GiB in single WR, res->read.resid is u32
0x80000000, which is INT_MIN (-2147483648).
payload = min_t(int, res->read.resid, mtu);
The `min_t` function will return -2147483648 for payload. The wrong
size is propagated through call chain, `read_reply` -> `prepare_ack_packet`
-> `rxe_init_packet` -> `alloc_skb` . `alloc_skb` failed because of
invalid size. The passive side failed to emit response packet for RDMA
READ request.
After fixed it, the active side of RDMA READ failed with error code
"IB_WC_LOC_PROT_ERR". When RDMA_READ_RESPONSE_FIRST packet recived by
the active side, `do_read` call `copy_data`. dma->resid is u32 0x80000000.
int resid = dma->resid;
This conversion set resid to -2147483648. `copy_data` abort as length
greater than resid.
RDMA SEND and WRITE 2GiB message works too, after fixed these two bugs.
Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Honggang LI <honggangli@163.com>
Link: https://patch.msgid.link/20261002142250.657151-1-honggangli@163.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Adjusted two rxe_loc.h prototype hunks to this tree's surrounding declarations, applying only the u32 type changes for copy_data() and rxe_init_packet(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/sw/rxe/rxe_loc.h | 4 ++--
drivers/infiniband/sw/rxe/rxe_mr.c | 8 ++++----
drivers/infiniband/sw/rxe/rxe_net.c | 2 +-
drivers/infiniband/sw/rxe/rxe_resp.c | 17 +++++++++--------
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
index ab638db78594b..5505df192f0aa 100644
--- a/drivers/infiniband/sw/rxe/rxe_loc.h
+++ b/drivers/infiniband/sw/rxe/rxe_loc.h
@@ -71,7 +71,7 @@ int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr);
int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
enum rxe_mr_copy_dir dir);
int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
- void *addr, int length, enum rxe_mr_copy_dir dir);
+ void *addr, u32 length, enum rxe_mr_copy_dir dir);
void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length);
struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,
enum rxe_mr_lookup_type type);
@@ -92,7 +92,7 @@ void rxe_mw_cleanup(struct rxe_pool_elem *elem);
/* rxe_net.c */
struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
- int paylen, struct rxe_pkt_info *pkt);
+ u32 paylen, struct rxe_pkt_info *pkt);
int rxe_prepare(struct rxe_av *av, struct rxe_pkt_info *pkt,
struct sk_buff *skb);
int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index 86f65c17e9b2f..d49e43c64e602 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -366,13 +366,13 @@ int copy_data(
int access,
struct rxe_dma_info *dma,
void *addr,
- int length,
+ u32 length,
enum rxe_mr_copy_dir dir)
{
- int bytes;
+ u32 bytes;
struct rxe_sge *sge = &dma->sge[dma->cur_sge];
- int offset = dma->sge_offset;
- int resid = dma->resid;
+ u32 offset = dma->sge_offset;
+ u32 resid = dma->resid;
struct rxe_mr *mr = NULL;
u64 iova;
int err;
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 779cd547ce839..c75b7d39106f0 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -445,7 +445,7 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
}
struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
- int paylen, struct rxe_pkt_info *pkt)
+ u32 paylen, struct rxe_pkt_info *pkt)
{
unsigned int hdr_len;
struct sk_buff *skb = NULL;
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 3cf214a7b715c..276886687a5d7 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -548,7 +548,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
}
static enum resp_states send_data_in(struct rxe_qp *qp, void *data_addr,
- int data_len)
+ u32 data_len)
{
int err;
@@ -684,20 +684,21 @@ static enum resp_states atomic_reply(struct rxe_qp *qp,
static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
struct rxe_pkt_info *ack,
int opcode,
- int payload,
+ u32 payload,
u32 psn,
u8 syndrome)
{
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
struct sk_buff *skb;
- int paylen;
- int pad;
+ u32 paylen;
+ u32 pad = 0;
int err;
/*
* allocate packet
*/
- pad = (-payload) & 0x3;
+ if (payload % 4)
+ pad = 4 - payload % 4;
paylen = rxe_opcode[opcode].length + payload + pad + RXE_ICRC_SIZE;
skb = rxe_init_packet(rxe, &qp->pri_av, paylen, ack);
@@ -791,9 +792,9 @@ static enum resp_states read_reply(struct rxe_qp *qp,
{
struct rxe_pkt_info ack_pkt;
struct sk_buff *skb;
- int mtu = qp->mtu;
+ u32 mtu = qp->mtu;
enum resp_states state;
- int payload;
+ u32 payload;
int opcode;
int err;
struct resp_res *res = qp->resp.res;
@@ -831,7 +832,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
res->state = rdatm_res_state_next;
- payload = min_t(int, res->read.resid, mtu);
+ payload = min(res->read.resid, mtu);
skb = prepare_ack_packet(qp, &ack_pkt, opcode, payload,
res->cur_psn, AETH_ACK_UNLIMITED);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0399/1059] ASoC: rt5645: Shut down the button timer on removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (397 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0398/1059] RDMA/rxe: Fix out-of-range unsigned-to-signed conversion for RDMA message in 2GiB size Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0400/1059] ASoC: Intel: avs: Unprepare a stream when recovery occurs Greg Kroah-Hartman
` (599 subsequent siblings)
998 siblings, 0 replies; 1065+ 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, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit f0ecc305442f20a6df2575943e9897825d80cc5d ]
jack_detect_work can rearm btn_check_timer, and the timer callback can
queue jack_detect_work. Deleting the timer before cancelling the work
does not break this cycle: an already running worker can rearm the timer
after timer_delete_sync() returns. The timer can then outlive removal.
Use timer_shutdown_sync() before cancelling the delayed work so that
subsequent attempts to rearm the timer are ignored. The IRQ producer has
already been removed at this point. Keep the restartable timer deletion
in the suspend path.
This issue was identified as part of our ongoing research while
reviewing kernel code.
Fixes: 7ff6319e7da5 ("ASoC: rt5645: use polling to support HS button")
Assisted-by: LLM
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Link: https://patch.msgid.link/179203261324.2681924.5002100194676410503.rt5645-button-timer@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Changed the del_timer_sync() context and removed line to match the older name, since the timer_delete_sync() rename isn't present here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/rt5645.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 7d4ebef1edfd7..434c3d527c622 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -19,6 +19,7 @@
#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/regulator/consumer.h>
+#include <linux/timer.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -4189,10 +4190,10 @@ static void rt5645_i2c_remove(struct i2c_client *i2c)
free_irq(i2c->irq, rt5645);
/*
- * Since the rt5645_btn_check_callback() can queue jack_detect_work,
- * the timer need to be delted first
+ * The timer and jack_detect_work can rearm each other. Shut down the
+ * timer before cancelling the work.
*/
- del_timer_sync(&rt5645->btn_check_timer);
+ timer_shutdown_sync(&rt5645->btn_check_timer);
cancel_delayed_work_sync(&rt5645->jack_detect_work);
cancel_delayed_work_sync(&rt5645->rcclock_work);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0400/1059] ASoC: Intel: avs: Unprepare a stream when recovery occurs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (398 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0399/1059] ASoC: rt5645: Shut down the button timer on removal Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0401/1059] ASoC: rockchip: fix device node reference leak in rk3288_hdmi_analog Greg Kroah-Hartman
` (598 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cezary Rojewski, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <cezary.rojewski@intel.com>
[ Upstream commit 85bc213f96ac03d74a3e531968c68861e5598281 ]
Recovery on alsa-lib side is handled with either:
1) snd_pcm_prepare(state=XRUN)
2) snd_pcm_drop/drain() -> snd_pcm_prepare(state=SETUP)
before starting the PCM anew. Relying solely on state=XRUN leaves 2)
unaccounted for. sound/core/pcm_native.c ensures correctness of the
state machine so plain state!=PREPARED check suffices.
This is the BE equivalent of job done previously for FE side only with
commit cfca1637bc2b ("ASoC: Intel: avs: Unprepare a stream when XRUN
occurs") and its follow up titled: ("ASoC: Intel: avs: Reset the stream
unless it is already prepared").
Link: https://lore.kernel.org/linux-sound/20261010103753.16969-1-stiraspo@gmail.com/T/
Fixes: d070002a20fc ("ASoC: Intel: avs: HDA PCM BE operations")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20261015190240.729793-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Inserted the two-line link_prepared reset at the equivalent spot, since this tree's function reads link_stream from runtime->private_data and lacks the upstream context lines. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/intel/avs/pcm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index b6730cbd12224..91446a458d0c3 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -313,6 +313,8 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
unsigned int format_val;
int ret;
+ if (substream->runtime->state != SNDRV_PCM_STATE_PREPARED)
+ link_stream->link_prepared = false;
if (link_stream->link_prepared)
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0401/1059] ASoC: rockchip: fix device node reference leak in rk3288_hdmi_analog
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (399 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0400/1059] ASoC: Intel: avs: Unprepare a stream when recovery occurs Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0402/1059] net: use the full socket in sk_mc_loop() Greg Kroah-Hartman
` (597 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Haotian Zhang, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <vulab@iscas.ac.cn>
[ Upstream commit f15b2df0b940cb2c01797f78791de3279d514086 ]
snd_rk_mc_probe() acquires references to the codec and CPU device nodes
with of_parse_phandle() and stores them in the static rk_dailink, but the
driver never calls of_node_put() on them. All error paths and the success
path simply return, and the driver has no remove callback, so the
references are leaked for the whole lifetime of the card and each failed
or repeated probe leaks another pair. The same pattern was fixed for the
sibling rockchip_rt5645.c driver.
Release the codec and CPU device nodes on every probe error path and in a
new remove callback, and also drop the extra reference placed in args.np
by of_parse_phandle_with_fixed_args().
Fixes: eaae2ea73593 ("ASoC: rockchip: Add machine driver for RK3288 boards that use analog/HDMI")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20261008181459.2762862-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Added a .remove callback returning int (old platform_driver API) and kept dev_err() plus return ret at the codec_dai_name site, using a goto instead of dev_err_probe(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/rk3288_hdmi_analog.c | 38 ++++++++++++++++++++-----
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/sound/soc/rockchip/rk3288_hdmi_analog.c b/sound/soc/rockchip/rk3288_hdmi_analog.c
index 0c6bd9a019dbe..90fc4691e63a5 100644
--- a/sound/soc/rockchip/rk3288_hdmi_analog.c
+++ b/sound/soc/rockchip/rk3288_hdmi_analog.c
@@ -220,13 +220,14 @@ static int snd_rk_mc_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Unable to parse property 'rockchip,audio-codec'\n");
- return ret;
+ goto put_codec_of_node;
}
ret = snd_soc_get_dai_name(&args, &rk_dailink.codecs[0].dai_name);
+ of_node_put(args.np);
if (ret) {
dev_err(&pdev->dev, "Unable to get codec_dai_name\n");
- return ret;
+ goto put_codec_of_node;
}
rk_dailink.cpus->of_node = of_parse_phandle(np, "rockchip,i2s-controller",
@@ -234,7 +235,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev)
if (!rk_dailink.cpus->of_node) {
dev_err(&pdev->dev,
"Property 'rockchip,i2s-controller' missing or invalid\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto put_codec_of_node;
}
rk_dailink.platforms->of_node = rk_dailink.cpus->of_node;
@@ -243,15 +245,36 @@ static int snd_rk_mc_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Unable to parse 'rockchip,routing' property\n");
- return ret;
+ goto put_cpu_of_node;
}
snd_soc_card_set_drvdata(card, machine);
ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret)
- return dev_err_probe(&pdev->dev, ret,
- "Soc register card failed\n");
+ if (ret) {
+ dev_err_probe(&pdev->dev, ret,
+ "Soc register card failed\n");
+ goto put_cpu_of_node;
+ }
+
+ return 0;
+
+put_cpu_of_node:
+ of_node_put(rk_dailink.cpus->of_node);
+ rk_dailink.cpus->of_node = NULL;
+put_codec_of_node:
+ of_node_put(rk_dailink.codecs[0].of_node);
+ rk_dailink.codecs[0].of_node = NULL;
+
+ return ret;
+}
+
+static int snd_rk_mc_remove(struct platform_device *pdev)
+{
+ of_node_put(rk_dailink.cpus->of_node);
+ rk_dailink.cpus->of_node = NULL;
+ of_node_put(rk_dailink.codecs[0].of_node);
+ rk_dailink.codecs[0].of_node = NULL;
return 0;
}
@@ -265,6 +288,7 @@ MODULE_DEVICE_TABLE(of, rockchip_sound_of_match);
static struct platform_driver rockchip_sound_driver = {
.probe = snd_rk_mc_probe,
+ .remove = snd_rk_mc_remove,
.driver = {
.name = DRV_NAME,
.pm = &snd_soc_pm_ops,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0402/1059] net: use the full socket in sk_mc_loop()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (400 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0401/1059] ASoC: rockchip: fix device node reference leak in rk3288_hdmi_analog Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0403/1059] tcp: use the echoed source route in cookie_v4_check() Greg Kroah-Hartman
` (596 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Theodor Arsenij Larionov Trichkine,
Eric Dumazet, Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
[ Upstream commit 31b564f70d8819a1c11d0fd504fe582fc0e0f0cf ]
sk_mc_loop() is called from ip_mc_output() and ip6_finish_output2()
with skb->sk, which is not always a full socket:
- Since commit ca6fb0651883 ("tcp: attach SYNACK messages to request
sockets instead of listener"), a SYNACK is attached to its request
socket.
- Since commit 79636038d37e ("ipv4: tcp: give socket pointer to control
skbs"), an ACK or RST sent by ip_send_unicast_reply() on behalf of a
TIME_WAIT socket is attached to the timewait socket.
When such a packet uses a multicast route, inet_test_bit(MC_LOOP, sk)
reads inet_flags past the end of the request or timewait socket.
This happens for instance when a SYN with a multicast source address
reaches a listener, after being looped back with its dst attached, so
that ip_rcv_finish_core() skips the martian source check. A raw
IP_HDRINCL socket sending to a local address does this, as does
re-injection by nft dup or the iptables TEE target. The destination
can also come from a source route option, or from a route of type
multicast covering a unicast prefix.
BUG: KASAN: slab-out-of-bounds in sk_mc_loop+0x111/0x170
Read of size 8 at addr ffff88800f2b7f10 by task repro-raw/470
Call Trace:
<IRQ>
sk_mc_loop+0x111/0x170
ip_mc_output+0x355/0x930
ip_build_and_send_pkt+0xb87/0xc50
tcp_v4_send_synack+0x500/0x6f0
tcp_conn_request+0x2135/0x2d90
tcp_v4_conn_request+0xa5/0x210
tcp_rcv_state_process+0x136e/0x6920
tcp_v4_do_rcv+0x339/0xb10
tcp_v4_rcv+0x34ab/0x3ab0
ip_protocol_deliver_rcu+0x6e/0x3e0
ip_local_deliver_finish+0x34d/0x510
ip_local_deliver+0x1bc/0x310
ip_rcv+0x390/0x410
__netif_receive_skb_one_core+0x199/0x1e0
process_backlog+0x239/0x680
__napi_poll+0xb5/0x650
net_rx_action+0x980/0xd60
handle_softirqs+0x17f/0x590
do_softirq+0x3f/0x60
</IRQ>
The buggy address belongs to the object at ffff88800f2b7d60
which belongs to the cache request_sock_TCP of size 312
The buggy address is located 120 bytes to the right of
allocated 312-byte region [ffff88800f2b7d60, ffff88800f2b7e98)
Use sk_const_to_full_sk(), which restores the behavior from before
the two commits above: a request socket uses the setting of its
listener, and a timewait socket gets the default (loop back), as the
per-cpu control socket used before had.
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Fixes: 79636038d37e ("ipv4: tcp: give socket pointer to control skbs")
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
[edumazet: rewrote the changelog, added the TIME_WAIT case]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261012101029.927296-2-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Used sk_to_full_sk(sk) instead of upstream's sk_const_to_full_sk(sk), since sk_mc_loop() here takes a non-const socket and the TIME_WAIT mapping isn't present. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/sock.c b/net/core/sock.c
index 211eb9ba9a29a..71b52da060e80 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -761,6 +761,7 @@ bool sk_mc_loop(struct sock *sk)
{
if (dev_recursion_level())
return false;
+ sk = sk_to_full_sk(sk);
if (!sk)
return true;
/* IPV6_ADDRFORM can change sk->sk_family under us. */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0403/1059] tcp: use the echoed source route in cookie_v4_check()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (401 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0402/1059] net: use the full socket in sk_mc_loop() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0404/1059] pinctrl: stm32: Fix the unit of the hwspinlock timeout Greg Kroah-Hartman
` (595 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 54d574d4afd9de820c8a017665c8095f0f5fdbaa ]
When the ACK carries a source route option, cookie_v4_check() routes
the new socket to opt->faddr, where opt points to the options of the
received packet.
ip_options_compile() only fills faddr for options given by
setsockopt() (when called without an skb), so on receive faddr is 0
and the lookup is done for daddr 0, which gives a local route.
Use the options echoed by tcp_v4_save_options() instead, as
inet_csk_route_req() and inet_csk_route_child_sock() do with
ireq->ireq_opt. Read them after security_inet_conn_request(),
since CIPSO can replace ireq->ireq_opt there.
The route now goes to the first hop of the source route, so also
refuse a strict source route through a gateway, as
inet_csk_route_req() does.
Found by sashiko while reviewing the sk_mc_loop() fix.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261012101029.927296-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Replaced the received packet's IP options with the echoed request options and adapted context to older code: RT_CONN_FLAGS, sk->sk_uid, and reqsk_free()/goto out error paths instead of SKB_DR_SET/out_free. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/syncookies.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 0b6e0a9569cb4..0497a2d4a2d75 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -320,13 +320,13 @@ EXPORT_SYMBOL_GPL(cookie_tcp_reqsk_alloc);
*/
struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
{
- struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
struct tcp_options_received tcp_opt;
struct inet_request_sock *ireq;
struct tcp_request_sock *treq;
struct tcp_sock *tp = tcp_sk(sk);
const struct tcphdr *th = tcp_hdr(skb);
__u32 cookie = ntohl(th->ack_seq) - 1;
+ struct ip_options_rcu *opt;
struct sock *ret = sk;
struct request_sock *req;
int full_space, mss;
@@ -408,6 +408,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
reqsk_free(req);
goto out;
}
+ /* Load ireq->ireq_opt after the LSM hook, which can replace it. */
+ opt = rcu_dereference_protected(ireq->ireq_opt, true);
req->num_retrans = 0;
@@ -420,7 +422,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
flowi4_init_output(&fl4, ireq->ir_iif, ireq->ir_mark,
RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP,
inet_sk_flowi_flags(sk),
- opt->srr ? opt->faddr : ireq->ir_rmt_addr,
+ (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
ireq->ir_loc_addr, th->source, th->dest, sk->sk_uid);
security_req_classify_flow(req, flowi4_to_flowi_common(&fl4));
rt = ip_route_output_key(sock_net(sk), &fl4);
@@ -428,6 +430,12 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
reqsk_free(req);
goto out;
}
+ /* Same check as in inet_csk_route_req(). */
+ if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) {
+ ip_rt_put(rt);
+ reqsk_free(req);
+ goto out;
+ }
/* Try to redo what tcp_v4_send_synack did. */
req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0404/1059] pinctrl: stm32: Fix the unit of the hwspinlock timeout
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (402 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0403/1059] tcp: use the echoed source route in cookie_v4_check() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0405/1059] ALSA: hda/realtek: Fix hiss/crackle on Lenovo Xiaoxin 14 GT (17aa:3912) Greg Kroah-Hartman
` (594 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ju Nan, Linus Walleij, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ju Nan <junan76@163.com>
[ Upstream commit 544b3f8042dd7c18baa48dcb1a393ff8b6742322 ]
HWSPNLCK_TIMEOUT is passed to hwspin_lock_timeout_in_atomic(), whose
timeout argument is in milliseconds, not microseconds:
atomic_delay += HWSPINLOCK_RETRY_DELAY_US;
if (atomic_delay > to * 1000)
return -ETIMEDOUT;
The hwspinlock core documents this explicitly:
If the mode is HWLOCK_IN_ATOMIC (called from an atomic context) the
timeout is handled with busy-waiting delays, hence shall not exceed
few msecs.
Fixes: 290a9f937e5a ("pinctrl: stm32: use the hwspin_lock_timeout_in_atomic() API")
Signed-off-by: Ju Nan <junan76@163.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
[ sashal: Dropped the two hunks for functions absent from this tree and renamed only the five existing HWSPNLCK_TIMEOUT call sites to the new millisecond define. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 635bfcdc91423..ba4fd04a4b015 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -66,7 +66,7 @@
#define gpio_range_to_bank(chip) \
container_of(chip, struct stm32_gpio_bank, range)
-#define HWSPNLCK_TIMEOUT 1000 /* usec */
+#define HWSPNLCK_TIMEOUT_MS 1
static const char * const stm32_gpio_functions[] = {
"gpio", "af0", "af1",
@@ -443,7 +443,7 @@ static int stm32_gpio_domain_activate(struct irq_domain *d,
if (pctl->hwlock) {
ret = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (ret) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
return ret;
@@ -779,7 +779,7 @@ static int stm32_pmx_set_mode(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -912,7 +912,7 @@ static int stm32_pconf_set_driving(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -963,7 +963,7 @@ static int stm32_pconf_set_speed(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -1014,7 +1014,7 @@ static int stm32_pconf_set_bias(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0405/1059] ALSA: hda/realtek: Fix hiss/crackle on Lenovo Xiaoxin 14 GT (17aa:3912)
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (403 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0404/1059] pinctrl: stm32: Fix the unit of the hwspinlock timeout Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0406/1059] btrfs: drop the extent maps of the written part of a failed ordered extent Greg Kroah-Hartman
` (593 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Viktor Menshin, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viktor Menshin <ripeeerr@gmail.com>
[ Upstream commit 2fc28b1186d6fce8b046e6118072cf3ca32f2960 ]
Commit 3a3e810e9108 ("ALSA: hda/realtek: Add quirk for Lenovo Xiaoxin
14 GT") added a quirk mapping SSID 17aa:3912 to
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, chosen by analogy with
neighboring SSIDs (0x390d, 0x3911, 0x391a) without being verified on
hardware, as noted in that commit's own message.
I have since tested it on the actual hardware (Lenovo Xiaoxin Pro 14
ASP10, same 17aa:3912 SSID) and confirmed it does not fix the reported
issue. ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN only repoints pin 0x17
and the preferred DAC pairs for the bass speaker; it does not touch
the codec's vendor processing coefficients. The actual symptom -
constant electrical hiss/crackle on both the headphone jack and the
internal speakers, independent of volume - is unrelated to pin/DAC
routing and is also present on stock Windows before the Realtek
driver is installed, which points at those coefficients being left
at their power-on default.
To find the correct values, I passed the physical HD Audio controller
through to a Windows 10 VM (VFIO, with QEMU patched to log CORB verb
traffic) and captured the coefficient writes the vendor Realtek driver
performs at init. Replaying a single one of them on Linux via hda-verb
reproducibly eliminates the headphone jack noise:
hda-verb /dev/snd/hwC#D0 0x20 SET_COEF_INDEX 0x36
hda-verb /dev/snd/hwC#D0 0x20 SET_PROC_COEF 0x77d7
This has held up across reboots and kernel updates for several weeks
(applied via a small systemd oneshot unit while testing).
Add a dedicated fixup that performs this coefficient write and chains
it with the existing ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN (which may
still be relevant for the bass speaker pin wiring on this board), and
point the 17aa:3912 quirk entry at it instead.
Honesty note: this fixes the headphone jack. The internal speakers
still have noise under certain conditions (notably worse on AC power)
that I have not been able to isolate via coefficient-table replay;
that part remains open. Sending what is verified to work rather than
holding this back.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221203
Fixes: 3a3e810e9108 ("ALSA: hda/realtek: Add quirk for Lenovo Xiaoxin 14 GT")
Signed-off-by: Viktor Menshin <ripeeerr@gmail.com>
Link: https://patch.msgid.link/20261015132157.57198-1-ripeeerr@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Added the new fixup, enum value and table entry by hand in the older file location, placing them next to existing neighbours since the upstream anchor functions and enums are missing. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/hda/patch_realtek.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d49a2c74d5af3..a78b23d922ea2 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7207,6 +7207,28 @@ static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
}
}
+/*
+ * The Lenovo Xiaoxin 14 GT (SSID 17aa:3912) uses the same bass-speaker
+ * pin wiring as its 0x390d/0x3911/0x391a siblings, but on this board the
+ * codec's vendor processing coefficients (node 0x20) are left at their
+ * power-on default instead of being programmed the way the vendor
+ * (Windows) driver programs them. That leaves audible hiss/crackle on
+ * both the headphone jack and the internal speakers, independent of
+ * volume, regardless of which pin/DAC routing is used.
+ *
+ * This single coefficient write was captured from the vendor driver's
+ * own init sequence (via a VFIO pass-through of the physical codec to a
+ * Windows VM) and confirmed to eliminate the headphone jack noise.
+ */
+static void alc287_fixup_lenovo_xiaoxin_14gt_hp_noise(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+ if (action != HDA_FIXUP_ACT_INIT)
+ return;
+
+ alc_write_coef_idx(codec, 0x36, 0x77d7);
+}
+
static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
@@ -7547,6 +7569,7 @@ enum {
ALC287_FIXUP_LEGION_16ITHG6,
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
+ ALC287_FIXUP_LENOVO_XIAOXIN_14GT_HP_NOISE,
ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
ALC236_FIXUP_DELL_DUAL_CODECS,
ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
@@ -9718,6 +9741,12 @@ static const struct hda_fixup alc269_fixups[] = {
.chained = true,
.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
},
+ [ALC287_FIXUP_LENOVO_XIAOXIN_14GT_HP_NOISE] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc287_fixup_lenovo_xiaoxin_14gt_hp_noise,
+ .chained = true,
+ .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
+ },
[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc295_fixup_dell_inspiron_top_speakers,
@@ -10454,7 +10483,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
SND_PCI_QUIRK(0x17aa, 0x390d, "Lenovo Yoga Pro 7 14ASP10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
SND_PCI_QUIRK(0x17aa, 0x3911, "Lenovo Yoga Pro 7 14IAH10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
- SND_PCI_QUIRK(0x17aa, 0x3912, "Lenovo Xiaoxin 14 GT", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
+ SND_PCI_QUIRK(0x17aa, 0x3912, "Lenovo Xiaoxin 14 GT", ALC287_FIXUP_LENOVO_XIAOXIN_14GT_HP_NOISE),
SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0406/1059] btrfs: drop the extent maps of the written part of a failed ordered extent
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (404 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0405/1059] ALSA: hda/realtek: Fix hiss/crackle on Lenovo Xiaoxin 14 GT (17aa:3912) Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0407/1059] btrfs: update the inode item when removing a free space inode Greg Kroah-Hartman
` (592 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tal Zussman, David Sterba,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tal Zussman <tz2294@columbia.edu>
[ Upstream commit bca2cf55a7331e6b0ff95ad47fc2a7e8ecc7dc74 ]
If a truncated ordered extent fails to complete, the extent maps for the
part that was written are kept while the extent itself is freed below.
A later read can follow them to blocks that have been reallocated.
Drop the maps for the whole range on error.
Fixes: 77cef2ec5484 ("Btrfs: allow partial ordered extent completion")
Assisted-by: LLM
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: Wrapped the btrfs_drop_extent_map_range() call in a local drop_start that resets to start when truncated and ret, since unwritten_start is shared with clear_extent_uptodate() in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/inode.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index abc834c828519..1c0486591c44f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3434,6 +3434,8 @@ int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
/*
* Drop extent maps for the part of the extent we didn't write.
+ * On error the written part is freed below as well, so drop
+ * its maps too.
*
* We have an exception here for the free_space_inode, this is
* because when we do btrfs_get_extent() on the free space inode
@@ -3446,9 +3448,15 @@ int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
* we don't mess with the extent map tree in the NOCOW case, but
* for now simply skip this if we are the free space inode.
*/
- if (!btrfs_is_free_space_inode(inode))
- btrfs_drop_extent_map_range(inode, unwritten_start,
+ if (!btrfs_is_free_space_inode(inode)) {
+ u64 drop_start = unwritten_start;
+
+ if (truncated && ret)
+ drop_start = start;
+
+ btrfs_drop_extent_map_range(inode, drop_start,
end, false);
+ }
/*
* If the ordered extent had an IOERR or something else went
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0407/1059] btrfs: update the inode item when removing a free space inode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (405 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0406/1059] btrfs: drop the extent maps of the written part of a failed ordered extent Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.1 0408/1059] bpf: Claim the per-CPU send_signal irq_work before filling it Greg Kroah-Hartman
` (591 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tal Zussman, David Sterba,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tal Zussman <tz2294@columbia.edu>
[ Upstream commit 4e89aff9ad6fcbec555c38169807c4023f93450f ]
btrfs_remove_free_space_inode() adds an orphan item for the free space
inode and clears its link count in memory, but never writes the inode
item. The item is only removed once the delayed iput evicts the inode,
which happens in a later transaction, from the cleaner thread or a
throttled transaction end.
If we crash in between, or if evict can't reserve space for the
truncation and leaves the orphan item for the next mount, the on-disk
inode still has a link count of 1. btrfs_orphan_cleanup() then treats it
as an inode with links and only deletes the orphan item. The free space
header item is already gone at that point, so nothing ever finds the
inode again, and its data extents are leaked.
Write the zero link count to the inode item in the same transaction as
the orphan item, so the orphan cleanup evicts the inode instead. Account
for the extra tree root item update when removing a block group.
Fixes: 455757c322cc ("Btrfs: delay iput when deleting a block group")
Assisted-by: LLM
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: adapted to older APIs: kept the extent-map lookup in block-group.c, used the three-argument btrfs_update_inode(), passed a struct inode to btrfs_add_delayed_iput(), and used goto out to free the path. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/block-group.c | 6 ++++--
fs/btrfs/free-space-cache.c | 10 ++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index a8f096b46b7b2..df742b4d2fd7a 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1179,12 +1179,14 @@ struct btrfs_trans_handle *btrfs_start_trans_remove_block_group(
ASSERT(em && em->start == chunk_offset);
/*
- * We need to reserve 3 + N units from the metadata space info in order
+ * We need to reserve 4 + N units from the metadata space info in order
* to remove a block group (done at btrfs_remove_chunk() and at
* btrfs_remove_block_group()), which are used for:
*
* 1 unit for adding the free space inode's orphan (located in the tree
* of tree roots).
+ * 1 unit for updating the free space inode's item (located in the tree
+ * of tree roots).
* 1 unit for deleting the block group item (located in the extent
* tree).
* 1 unit for deleting the free space item (located in tree of tree
@@ -1198,7 +1200,7 @@ struct btrfs_trans_handle *btrfs_start_trans_remove_block_group(
* btrfs_remove_chunk() through a call to check_system_chunk().
*/
map = em->map_lookup;
- num_items = 3 + map->num_stripes;
+ num_items = 4 + map->num_stripes;
free_extent_map(em);
return btrfs_start_transaction_fallback_global_rsv(root, num_items);
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 92933cc5596e0..b9106a28c87cd 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -260,6 +260,16 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans,
goto out;
}
clear_nlink(inode);
+ /*
+ * Persist the zero link count, so that if the delayed iput below
+ * doesn't get to evict the inode, the orphan cleanup on the next mount
+ * evicts it instead of only deleting the orphan item.
+ */
+ ret = btrfs_update_inode(trans, BTRFS_I(inode)->root, BTRFS_I(inode));
+ if (ret) {
+ btrfs_add_delayed_iput(inode);
+ goto out;
+ }
/* One for the block groups ref */
spin_lock(&block_group->lock);
if (test_and_clear_bit(BLOCK_GROUP_FLAG_IREF, &block_group->runtime_flags)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0408/1059] bpf: Claim the per-CPU send_signal irq_work before filling it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (406 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0407/1059] btrfs: update the inode item when removing a free space inode Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0409/1059] bpf: Use the frame mem type in devmap egress XDP Greg Kroah-Hartman
` (590 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Chen, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <chenyuan@kylinos.cn>
[ Upstream commit 2d1f101ee619435873ed8a23fcb3bd09204a5024 ]
irq_work_is_busy() cannot see the per-CPU send_signal_work while
it is being filled: the check only matches after irq_work_queue()
has claimed the work. A concurrent caller therefore passes it, both
callers race for the same irq_work, and the loser's signal is
silently lost along with its task reference while the queued work
runs with a mix of both callers' fields.
kprobe, tracepoint and perf_event programs exclude each other on
the same CPU through bpf_prog_active, so for two callers to meet,
one of the programs has to be a raw tracepoint or an fentry one.
And since commit 87c544108b61 ("bpf: Send signals asynchronously
if !preemptible") this path runs with IRQs enabled too, so a hard
IRQ can interrupt the fill as well, not only an NMI. Found by code
inspection and reproduced with a perf_event NMI program racing an
fentry one.
Claim the work through work->task itself: cmpxchg() it from NULL
to the target task before touching the other fields, and set it
back to NULL once the callback has consumed them. A context
finding the work claimed returns the documented -EBUSY.
Fixes: 1bc7896e9ef4 ("bpf: Fix deadlock with rq_lock in bpf_send_signal()")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261009022427.968304-1-chenyuan@kylinos.cn
[ sashal: Replaced task with current in the cmpxchg claim and get_task_struct() because this tree's bpf_send_signal_common() has no task parameter, and dropped the siginfo lines. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/bpf_trace.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index db5484a1dbd31..aecce50519d56 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -825,6 +825,7 @@ static const struct bpf_func_proto bpf_current_task_under_cgroup_proto = {
struct send_signal_irq_work {
struct irq_work irq_work;
+ /* The claim: NULL marks the slot free for the next caller. */
struct task_struct *task;
u32 sig;
enum pid_type type;
@@ -839,6 +840,8 @@ static void do_bpf_send_signal(struct irq_work *entry)
work = container_of(entry, struct send_signal_irq_work, irq_work);
group_send_sig_info(work->sig, SEND_SIG_PRIV, work->task, work->type);
put_task_struct(work->task);
+ /* Release once the fields are consumed. */
+ smp_store_release(&work->task, NULL);
}
static int bpf_send_signal_common(u32 sig, enum pid_type type)
@@ -866,14 +869,14 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type)
return -EINVAL;
work = this_cpu_ptr(&send_signal_work);
- if (irq_work_is_busy(&work->irq_work))
+ if (cmpxchg(&work->task, NULL, current))
return -EBUSY;
/* Add the current task, which is the target of sending signal,
* to the irq_work. The current task may change when queued
* irq works get executed.
*/
- work->task = get_task_struct(current);
+ get_task_struct(current);
work->sig = sig;
work->type = type;
irq_work_queue(&work->irq_work);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0409/1059] bpf: Use the frame mem type in devmap egress XDP
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (407 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.1 0408/1059] bpf: Claim the per-CPU send_signal irq_work before filling it Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0410/1059] bpf: Reject sleepable programs for task_vma iterator Greg Kroah-Hartman
` (589 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit b3ca872947ef322c475ceaa7a76a9ebb3356152e ]
A devmap egress program that removes a whole fragment of a redirected
xdp_frame with bpf_xdp_adjust_tail() or bpf_xdp_pull_data() frees it
with page_frag_free() whatever the frame's memory type is. For a
MEM_TYPE_PAGE_POOL frame from a page_pool based driver this drops the
page reference owned by the pool while the pool still accounts the
fragment ("page_pool leak" bad page, leaked pp reference).
kernel/bpf/devmap.c:dev_map_bpf_prog_run() points xdp.rxq at an
on-stack
struct xdp_rxq_info rxq = { .dev = rx_dev };
whose mem.type is 0, i.e. MEM_TYPE_PAGE_SHARED, and
net/core/filter.c:bpf_xdp_shrink_data() releases frags according to
rxq->mem.type. cpumap, which runs programs on xdp_frames the same way,
already copies xdpf->mem_type into its private rxq for each frame.
With 9000 byte frames from virtio_net and an egress program that cuts the
fragments off:
BUG: Bad page state in process swapper/3 pfn:10660b
page dumped because: page_pool leak
bad_page+0xbd/0x190
__free_frozen_pages+0x5c7/0x900
bpf_xdp_adjust_tail+0x3be/0x480
bpf_prog_dad43f894a3faff7_egress+0x15c/0x1cd
dev_map_bpf_prog_run+0x288/0x610
The pool waits for these pages for ever when its device is gone. That is
the harmless case. A page of the pool can hold more than one fragment
while its refcount is 1: the first page_frag_free() frees it under the
fragment which is still in use, and the second one runs into
page dumped because: VM_BUG_ON_PAGE(page_ref_count(page) == 0)
kernel BUG at include/linux/mm.h:1846!
veth is not affected. It takes references of its own on the pages and
redirects the frame as MEM_TYPE_PAGE_SHARED.
Fix by setting rxq.mem.type from each frame before running the devmap
program, as cpu_map_bpf_prog_run_xdp() does.
Fixes: ca9984c5f0ab ("bpf: devmap: provide rxq after redirect")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-2-alexei.starovoitov@gmail.com
[ sashal: Changed xdpf->mem_type to xdpf->mem.type in dev_map_bpf_prog_run(), since struct xdp_frame here has an embedded struct xdp_mem_info mem instead of a flat mem_type field. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/devmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index f4e28ad6c920d..22ebd6771d00b 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -341,6 +341,7 @@ static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog,
xdp_convert_frame_to_buff(xdpf, &xdp);
xdp.txq = &txq;
+ rxq.mem.type = xdpf->mem.type;
xdp.rxq = &rxq;
act = bpf_prog_run_xdp(xdp_prog, &xdp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0410/1059] bpf: Reject sleepable programs for task_vma iterator
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (408 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0409/1059] bpf: Use the frame mem type in devmap egress XDP Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0411/1059] bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit Greg Kroah-Hartman
` (588 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit dfcd1765911223df60845e288ad392d5237f47a3 ]
A sleepable "iter.s/task_vma" program can be attached, but its ->show()
callback runs with the mmap_lock of the iterated mm held for read. As soon
as the program runs, bpf_iter_run_prog() calls might_fault(), and any
bpf_copy_from_user() or bpf_copy_from_user_task() it does may really fault
or take mmap_lock again. With lockdep this is reported as recursive
locking of mmap_lock. Without lockdep, a fault on the reader's own mm, or
access_process_vm() on the iterated mm, has to take mmap_lock for read
again. If a writer queued up in the meantime that blocks behind the
writer, which in turn waits for the read lock the iterator already holds,
and the read() hangs:
reader (iter.s/task_vma) other thread of the same mm
task_vma_seq_get_next()
mmap_read_lock(mm)
mmap_write_lock(mm) <- waits
bpf prog: copy_from_user()
page fault
mmap_read_lock(mm) <- queued behind the writer
The reader waits killable, so the hang lasts until it gets a fatal signal.
bpf_iter_link_attach() allows sleepable programs for the targets that set
BPF_ITER_RESCHED, and task_vma sets it because cond_resched() between VMAs
is fine with mmap_lock held. Rescheduling between objects and running a
sleepable program inside ->show() are different properties, though, and
task_vma only has the first one. The open-coded task_vma iterator does not
have this problem since it hands out a snapshot of the VMA and holds no
lock when it returns to the program.
The vma handed to the program is only stable under mmap_lock, so the lock
can't be dropped around ->show(). Add a feature flag BPF_ITER_NOSLEEP for
targets which can't run sleepable programs although they can reschedule,
and set it for task_vma.
The check at attach time is not enough. BPF_LINK_UPDATE replaces the
program of a link, and bpf_iter_link_replace() only compares the type, the
attach type and the BTF id of the two programs, which are the same for a
sleepable and a non-sleepable one. Do the check there as well. That also
closes this way around the existing rule: so far a sleepable program could
be put on a link of a target that doesn't set BPF_ITER_RESCHED, like the
hash map element iterator, which runs it under rcu_read_lock().
BPF_LINK_CREATE of a sleepable program for the task_vma target, and
BPF_LINK_UPDATE to one, now fail with -EINVAL, also for programs that
don't touch user memory and have been working since sleepable iterator
programs exist. The programs can still be loaded. They have to be
loaded as non-sleepable programs, or use the open-coded iterator.
Fixes: b77fb25dcb34 ("bpf: Add support for bpf iterator programs to use sleepable helpers")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-6-alexei.starovoitov@gmail.com
[ sashal: Replaced prog->sleepable with 6.1's prog->aux->sleepable in the new helper and in the conflicting attach-path check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 3 ++-
kernel/bpf/bpf_iter.c | 17 ++++++++++++++---
kernel/bpf/task_iter.c | 6 +++++-
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 53d397b3d54cd..26ff6dc9e4818 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2005,7 +2005,8 @@ typedef const struct bpf_func_proto *
const struct bpf_prog *prog);
enum bpf_iter_feature {
- BPF_ITER_RESCHED = BIT(0),
+ BPF_ITER_RESCHED = BIT(0), /* may cond_resched() between objects */
+ BPF_ITER_NOSLEEP = BIT(1), /* ->show() can't run sleepable progs */
};
#define BPF_ITER_CTX_ARG_MAX 2
diff --git a/kernel/bpf/bpf_iter.c b/kernel/bpf/bpf_iter.c
index f2d32832c407e..7cdbd040f14e9 100644
--- a/kernel/bpf/bpf_iter.c
+++ b/kernel/bpf/bpf_iter.c
@@ -73,6 +73,15 @@ static inline bool bpf_iter_target_support_resched(const struct bpf_iter_target_
return tinfo->reg_info->feature & BPF_ITER_RESCHED;
}
+/* Only allow sleepable program for resched-able iterator that can run one */
+static bool bpf_iter_target_support_prog(const struct bpf_iter_target_info *tinfo,
+ const struct bpf_prog *prog)
+{
+ return !prog->aux->sleepable ||
+ (bpf_iter_target_support_resched(tinfo) &&
+ !(tinfo->reg_info->feature & BPF_ITER_NOSLEEP));
+}
+
static bool bpf_iter_support_resched(struct seq_file *seq)
{
struct bpf_iter_priv_data *iter_priv;
@@ -419,6 +428,8 @@ static int bpf_iter_link_replace(struct bpf_link *link,
struct bpf_prog *new_prog,
struct bpf_prog *old_prog)
{
+ struct bpf_iter_link *iter_link =
+ container_of(link, struct bpf_iter_link, link);
int ret = 0;
mutex_lock(&link_mutex);
@@ -429,7 +440,8 @@ static int bpf_iter_link_replace(struct bpf_link *link,
if (link->prog->type != new_prog->type ||
link->prog->expected_attach_type != new_prog->expected_attach_type ||
- link->prog->aux->attach_btf_id != new_prog->aux->attach_btf_id) {
+ link->prog->aux->attach_btf_id != new_prog->aux->attach_btf_id ||
+ !bpf_iter_target_support_prog(iter_link->tinfo, new_prog)) {
ret = -EINVAL;
goto out_unlock;
}
@@ -554,8 +566,7 @@ int bpf_iter_link_attach(const union bpf_attr *attr, bpfptr_t uattr,
if (!tinfo)
return -ENOENT;
- /* Only allow sleepable program for resched-able iterator */
- if (prog->aux->sleepable && !bpf_iter_target_support_resched(tinfo))
+ if (!bpf_iter_target_support_prog(tinfo, prog))
return -EINVAL;
link = kzalloc(sizeof(*link), GFP_USER | __GFP_NOWARN);
diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
index 481e2b43f0ed1..4163f8be43680 100644
--- a/kernel/bpf/task_iter.c
+++ b/kernel/bpf/task_iter.c
@@ -764,7 +764,11 @@ static const struct bpf_iter_seq_info task_vma_seq_info = {
static struct bpf_iter_reg task_vma_reg_info = {
.target = "task_vma",
.attach_target = bpf_iter_attach_task,
- .feature = BPF_ITER_RESCHED,
+ /*
+ * ->show() runs with the mmap_lock of the iterated mm held, which a
+ * sleepable program takes again when it faults on user memory.
+ */
+ .feature = BPF_ITER_RESCHED | BPF_ITER_NOSLEEP,
.ctx_arg_info_size = 2,
.ctx_arg_info = {
{ offsetof(struct bpf_iter__task_vma, task),
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0411/1059] bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (409 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0410/1059] bpf: Reject sleepable programs for task_vma iterator Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0412/1059] bpf: Read the probe of a perf event under event_mutex Greg Kroah-Hartman
` (587 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit ee4f44e0e3c8125eebe9ac967b6984bc9253d489 ]
In the branch of a BPF_JSET which is taken, the verifier can learn
something about the register only if the mask has a single bit: then this
bit is set. regs_refine_cond_op() tests this with is_power_of_2(val) and
then ORs val into var_off.
val is a u64, but is_power_of_2() takes an unsigned long. On a 32-bit
kernel it only sees the lower half of the mask. For
if r1 & 0xffffffff80000000 goto l
which is a BPF_JSET | BPF_K with an immediate of 0x80000000, the lower
half is a power of two. So the verifier takes all 33 bits for set at l,
while the branch is taken if any of them is. A mask of 0x100000001 from a
register does the same for bit 0.
The log of an i386 kernel, for r6 = bpf_get_prandom_u32() << 31:
3: (45) if r6 & 0x80000000 goto pc+2
from 3 to 6: R6=0xffffffff80000000 R10=fp0
6: (77) r6 >>= 63 ; R6=1
When the program runs, r6 >> 63 is 0.
>From then on the verifier works with known bits which the register does
not have at run time. It accepts, for example, an offset into a map value
which it derives from these bits and believes to be constant, and the
program can access memory outside of the map value.
Count the bits of the whole value.
Only 32-bit kernels are affected. On a 64-bit kernel unsigned long holds
the whole mask, and this patch changes nothing.
Fixes: 960ea056561a ("bpf: verifier: teach the verifier to reason about the BPF_JSET instruction")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-8-alexei.starovoitov@gmail.com
[ sashal: Replaced is_power_of_2(val) with hweight64(val) == 1 in reg_set_min_max(), since regs_refine_cond_op() doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index dee55d5db7da7..49577f7cf6262 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -10048,7 +10048,7 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,
tnum_const(val32));
} else {
false_64off = tnum_and(false_64off, tnum_const(~val));
- if (is_power_of_2(val))
+ if (hweight64(val) == 1)
true_64off = tnum_or(true_64off,
tnum_const(val));
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0412/1059] bpf: Read the probe of a perf event under event_mutex
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (410 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0411/1059] bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0413/1059] bpf: Assume no bounds for buffers behind a tail call Greg Kroah-Hartman
` (586 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 3ccd700543f16a2b2ab656f35dcaeb6bd7c45e22 ]
For a perf event on a kprobe or uprobe event which was made in tracefs,
bpf_get_kprobe_info() and bpf_get_uprobe_info() look the probe up by
name in the list of dynamic events, and hand a pointer to its symbol or
file name back to the caller. None of the callers holds event_mutex.
The perf event keeps its trace event alive, nothing else. Other dynamic
events are removed from the list and freed during the walk. And a probe
which shares its event with other probes can be deleted while the event
is in use, so even the probe which is found can be freed, together with
the string, before the caller has measured and copied it. The result is
a use-after-free in the walk, in strlen() and in the copy to user space,
or a NULL pointer dereference.
The readers are BPF_OBJ_GET_INFO_BY_FD and fdinfo of a perf link, for
whoever holds a descriptor of the link, and BPF_TASK_FD_QUERY. The other
side is anybody who may write to dynamic_events, kprobe_events or
uprobe_events.
Take event_mutex in bpf_get_perf_event_info() and give the caller a copy
of the name, which it has to free.
Fixes: 41bdc4b40ed6 ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-10-alexei.starovoitov@gmail.com
[ sashal: Dropped the perf-link and fdinfo hunks since those functions don't exist here, and added kfree_const(buf) in bpf_task_fd_query(), the only caller of bpf_get_perf_event_info(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 4 +++-
kernel/trace/bpf_trace.c | 13 +++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 97dbfb8832aef..93d9326482245 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -4568,11 +4568,13 @@ static int bpf_task_fd_query(const union bpf_attr *attr,
err = bpf_get_perf_event_info(event, &prog_id, &fd_type,
&buf, &probe_offset,
&probe_addr);
- if (!err)
+ if (!err) {
err = bpf_task_fd_query_copy(attr, uattr, prog_id,
fd_type, buf,
probe_offset,
probe_addr);
+ kfree_const(buf);
+ }
goto put_file;
}
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index aecce50519d56..5521556fedf25 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2364,6 +2364,7 @@ int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *prog)
return tracepoint_probe_unregister(btp->tp, (void *)btp->bpf_func, prog);
}
+/* On success the caller releases *buf with kfree_const() */
int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
u32 *fd_type, const char **buf,
u64 *probe_offset, u64 *probe_addr)
@@ -2372,6 +2373,12 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
struct bpf_prog *prog;
int flags, err = 0;
+ /*
+ * The list of dynamic events is walked, and a probe which has siblings
+ * can be deleted, with its strings, while its event is in use.
+ */
+ guard(mutex)(&event_mutex);
+
prog = event->prog;
if (!prog)
return -ENOENT;
@@ -2408,6 +2415,12 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
#endif
}
+ if (!err && *buf) {
+ *buf = kstrdup_const(*buf, GFP_KERNEL);
+ if (!*buf)
+ err = -ENOMEM;
+ }
+
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0413/1059] bpf: Assume no bounds for buffers behind a tail call
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (411 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0412/1059] bpf: Read the probe of a perf event under event_mutex Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0414/1059] bpf: Assume no bounds for a writable tp with tail calls Greg Kroah-Hartman
` (585 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 7fa323d77688e8b62b2f0bf6c3208a2c96d4a5e7 ]
The bpf_map_elem, bpf_sk_storage_map and sockmap iterators hand the key
and the value of an element to the program as buffers. The verifier notes
how far a program reaches into them, and the iterator compares that with
the map when the program is attached. A program that does not touch the
buffers passes. It can tail-call another program of the same target,
which gets the same context, and whose reach nobody compares with the
map:
BUG: KASAN: slab-out-of-bounds in ___bpf_prog_run+0xa46a/0xae80
The program array can be filled at any time, so there is nothing to look
at when the link is made. For the same reason a program with a tail call
is taken to use the whole stack and the whole packet. Take it to reach
as far as can be into the buffers as well, so that these iterators refuse
it with -EACCES.
Fixes: d6c4503cc296 ("bpf: Implement bpf iterator for hash maps")
Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage map")
Fixes: 0365351524d7 ("net: Allow iterating sockmap and sockhash")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-26-alexei.starovoitov@gmail.com
[ sashal: Adapted the hunk to the pre-split layout, placing the added line in do_misc_fixups() in verifier.c and using the old allow_tail_call_in_subprogs() helper name for context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 49577f7cf6262..da7cfd5320e35 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -14398,6 +14398,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
if (!allow_tail_call_in_subprogs(env))
prog->aux->stack_depth = MAX_BPF_STACK;
prog->aux->max_pkt_offset = MAX_PACKET_OFF;
+ prog->aux->max_rdonly_access = U32_MAX;
+ prog->aux->max_rdwr_access = U32_MAX;
/* mark bpf_tail_call as different opcode to avoid
* conditional branch in the interpreter for every normal
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0414/1059] bpf: Assume no bounds for a writable tp with tail calls
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (412 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0413/1059] bpf: Assume no bounds for buffers behind a tail call Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0415/1059] bpf: Dont take an extension for a writable raw tracepoint program Greg Kroah-Hartman
` (584 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit cd0490e671d70326d70c7d36e82388939fd9b071 ]
A writable raw tracepoint hands a buffer to the program. The verifier
notes how far the program reaches into it, and bpf_probe_register() refuses
a program that reaches further than the tracepoint allows. A program that
does not touch the buffer passes, and can tail-call one of its type that
reads and writes behind it.
Take a BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE program with a tail call to
reach as far as can be, as for the stack, the packet and the buffers of
iterators. It cannot be attached any more. Plain raw tracepoint programs,
for which the limit is zero, cannot get at the buffer, and a tail call
stays within one type: they are left alone.
Fixes: 9df1c28bb752 ("bpf: add writable context for raw tracepoints")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-28-alexei.starovoitov@gmail.com
[ sashal: Changed the path from kernel/bpf/fixups.c bpf_do_misc_fixups() to do_misc_fixups() in kernel/bpf/verifier.c, since the function hasn't been split out there; the hunk is otherwise unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index da7cfd5320e35..2cbf43f3149ed 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -14400,6 +14400,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
prog->aux->max_pkt_offset = MAX_PACKET_OFF;
prog->aux->max_rdonly_access = U32_MAX;
prog->aux->max_rdwr_access = U32_MAX;
+ if (prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE)
+ prog->aux->max_tp_access = U32_MAX;
/* mark bpf_tail_call as different opcode to avoid
* conditional branch in the interpreter for every normal
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0415/1059] bpf: Dont take an extension for a writable raw tracepoint program
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (413 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0414/1059] bpf: Assume no bounds for a writable tp with tail calls Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0416/1059] bpf: Dont let an extension reach further into the context than its target Greg Kroah-Hartman
` (583 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 7fe348f18b37b3f4c8beb981ef3f84564047380a ]
bpf_probe_register() compares max_tp_access of the program that is
attached with the size of the buffer that the tracepoint lets programs
write to. An extension of that program, or of one of its global
functions, gets the same context and the same pointer to the buffer. What
it accesses is noted in its own max_tp_access, which nobody looks at. So
it reads and writes behind the buffer, of a tracepoint that may have none:
BUG: KASAN: stack-out-of-bounds in bpf_prog_5843f2b820eb4929_tr26_ext_far+0xf4/0x10c
Write of size 4 at addr ffffc90000d8f894 by task wext/103
Refuse such extensions.
Fixes: be8704ff07d2 ("bpf: Introduce dynamic program extensions")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-29-alexei.starovoitov@gmail.com
[ sashal: Context-only difference: the hunk's anchor lines for the packet-data-change feature are absent, so the check is inserted as the last statement of the extension-program block after the JIT check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 2cbf43f3149ed..3e2865e0dc80b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -15231,6 +15231,15 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
"Extension programs should be JITed\n");
return -EINVAL;
}
+ /*
+ * How much of the buffer of the tracepoint is used
+ * is checked for the program that is attached to it.
+ */
+ if (tgt_prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE) {
+ bpf_log(log,
+ "Cannot extend a writable raw tracepoint program\n");
+ return -EINVAL;
+ }
}
if (!tgt_prog->jited) {
bpf_log(log, "Can attach to only JITed progs\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0416/1059] bpf: Dont let an extension reach further into the context than its target
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (414 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0415/1059] bpf: Dont take an extension for a writable raw tracepoint program Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0417/1059] bpf: Keep the symbols of a program until it has ended Greg Kroah-Hartman
` (582 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit fcbfa99aa657627528b75e7dc1023bcb0b84e558 ]
How large the context of a raw tracepoint, tracepoint or syscall program
is depends on what the program is attached to, or is run with.
bpf_probe_register(), perf_event_set_bpf_prog() and the test runs compare
that with max_ctx_offset of the program.
An extension of the program, or of one of its global functions, gets the
same context. How far it reaches is noted in its own max_ctx_offset, which
nobody looks at. On a tracepoint with one argument it reads the stack
behind the arguments, in a test run the memory behind the context, or
from NULL if there is none:
BUG: KASAN: stack-out-of-bounds in bpf_prog_954b5d2051843629_ts28_ext_far+0x7e/0x113
Read of size 8 at addr ffffc90000def7b8 by task ts28/104
BUG: KASAN: slab-out-of-bounds in bpf_prog_954b5d2051843629_ts28_ext_far+0x7e/0x113
Read of size 8 at addr ffff88810712c3e8 by task ts28/104
Refuse to attach an extension that reaches further than the program which
it extends. A program that leaves the context to its extensions has to
touch as much of it as they do.
Fixes: be8704ff07d2 ("bpf: Introduce dynamic program extensions")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-3-alexei.starovoitov@gmail.com
[ sashal: dropped the missing kprobe_write_ctx context from the conflicting hunk, leaving only the commit's own 13-line max_ctx_offset check before bpf_link_prime() ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 93d9326482245..2dd4290177808 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3187,6 +3187,19 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
tr = prog->aux->dst_trampoline;
tgt_prog = prog->aux->dst_prog;
}
+ /*
+ * The size of these contexts depends on what the program is attached
+ * to, or run with. That is compared with max_ctx_offset of the program,
+ * and nobody looks at the one of its extensions.
+ */
+ if (prog->type == BPF_PROG_TYPE_EXT &&
+ (tgt_prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT ||
+ tgt_prog->type == BPF_PROG_TYPE_TRACEPOINT ||
+ tgt_prog->type == BPF_PROG_TYPE_SYSCALL) &&
+ prog->aux->max_ctx_offset > tgt_prog->aux->max_ctx_offset) {
+ err = -EINVAL;
+ goto out_unlock;
+ }
err = bpf_link_prime(&link->link.link, &link_primer);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0417/1059] bpf: Keep the symbols of a program until it has ended
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (415 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0416/1059] bpf: Dont let an extension reach further into the context than its target Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0418/1059] bpf, cpumap: Hold the device of frames in the queue Greg Kroah-Hartman
` (581 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 4eaf4d71b91a983489227336adcab33d8eae58a5 ]
When the last reference to a program goes, __bpf_prog_put_noref() takes
its symbols out of the kallsyms tree and frees its line info at once, and
waits for the grace periods only with the rest. But the program may still
be running: the link or the array it was called from is gone, the call is
not over.
search_bpf_extables() finds the exception table of a program by its
symbol. A load that faults, and that the table is there to fix up, is
fatal from then on:
Oops: general protection fault, probably for non-canonical address
0xdead0000000006f8: 0000 [#1] SMP NOPTI
RIP: 0010:0xffffffffc06008f6
It takes a program that is detached and closed on one CPU while it runs on
another. Unwinders and bpf_prog_find_from_stack() do not know the program
any more either, and the stack dump of a BPF stream reads the freed line
info.
Free the line info behind the grace periods the program needs, as it is
done with the BTF that its text comes from. Remove the symbols in
bpf_prog_free_deferred(), which runs behind them as well. The symbols are
looked up under rcu_read_lock(), so the images and the program itself are
freed one more grace period later. All that the program refers to is
released when it was before.
Fixes: 3dec541b2e63 ("bpf: Add support for BTF pointers to x86 JIT")
Fixes: d7c431cafcb4 ("bpf: Add dump_stack() analogue to print to BPF stderr")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-6-alexei.starovoitov@gmail.com
[ sashal: replaced real_func_cnt with func_cnt and system_percpu_wq with system_wq, and adjusted context for members and helper layout absent in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 1 +
kernel/bpf/core.c | 50 +++++++++++++++++++++++++++++++-------------
kernel/bpf/syscall.c | 5 ++---
3 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 26ff6dc9e4818..40996f3b0cf19 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1269,6 +1269,7 @@ struct bpf_prog_aux {
union {
struct work_struct work;
struct rcu_head rcu;
+ struct rcu_work rwork;
};
};
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index a9e7b17af4808..b73a6df03016b 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -2656,12 +2656,40 @@ static void bpf_free_used_btfs(struct bpf_prog_aux *aux)
kfree(aux->used_btfs);
}
-static void bpf_prog_free_deferred(struct work_struct *work)
+static void bpf_prog_free_images(struct work_struct *work)
{
struct bpf_prog_aux *aux;
int i;
+ aux = container_of(to_rcu_work(work), struct bpf_prog_aux, rwork);
+ for (i = 0; i < aux->func_cnt; i++) {
+ /* We can just unlink the subprog poke descriptor table as
+ * it was originally linked to the main program and is also
+ * released along with it.
+ */
+ aux->func[i]->aux->poke_tab = NULL;
+ bpf_jit_free(aux->func[i]);
+ }
+ if (aux->func_cnt) {
+ kfree(aux->func);
+ bpf_prog_unlock_free(aux->prog);
+ } else {
+ bpf_jit_free(aux->prog);
+ }
+}
+
+static void bpf_prog_free_deferred(struct work_struct *work)
+{
+ struct bpf_prog_aux *aux;
+ bool ksyms;
+
aux = container_of(work, struct bpf_prog_aux, work);
+ /*
+ * A prog that still runs when its last reference goes needs its symbols,
+ * by which its exception table is found. It has ended by now.
+ */
+ ksyms = aux->func_cnt || !list_empty(&aux->ksym.lnode);
+ bpf_prog_kallsyms_del_all(aux->prog);
#ifdef CONFIG_BPF_SYSCALL
bpf_free_kfunc_btf_tab(aux->kfunc_btf_tab);
#endif
@@ -2679,20 +2707,12 @@ static void bpf_prog_free_deferred(struct work_struct *work)
#endif
if (aux->dst_trampoline)
bpf_trampoline_put(aux->dst_trampoline);
- for (i = 0; i < aux->func_cnt; i++) {
- /* We can just unlink the subprog poke descriptor table as
- * it was originally linked to the main program and is also
- * released along with it.
- */
- aux->func[i]->aux->poke_tab = NULL;
- bpf_jit_free(aux->func[i]);
- }
- if (aux->func_cnt) {
- kfree(aux->func);
- bpf_prog_unlock_free(aux->prog);
- } else {
- bpf_jit_free(aux->prog);
- }
+ /* The symbols are looked up under rcu_read_lock() */
+ INIT_RCU_WORK(&aux->rwork, bpf_prog_free_images);
+ if (ksyms)
+ queue_rcu_work(system_wq, &aux->rwork);
+ else
+ bpf_prog_free_images(&aux->rwork.work);
}
void bpf_prog_free(struct bpf_prog *fp)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 2dd4290177808..2aa15b0aa0c0e 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2064,6 +2064,8 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu)
{
struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);
+ kvfree(aux->jited_linfo);
+ kvfree(aux->linfo);
kvfree(aux->func_info);
kfree(aux->func_info_aux);
free_uid(aux->user);
@@ -2073,10 +2075,7 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu)
static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred)
{
- bpf_prog_kallsyms_del_all(prog);
btf_put(prog->aux->btf);
- kvfree(prog->aux->jited_linfo);
- kvfree(prog->aux->linfo);
kfree(prog->aux->kfunc_tab);
if (prog->aux->attach_btf)
btf_put(prog->aux->attach_btf);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0418/1059] bpf, cpumap: Hold the device of frames in the queue
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (416 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0417/1059] bpf: Keep the symbols of a program until it has ended Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0419/1059] bpf: Zero-extend the index in inlined bpf_get_func_arg() Greg Kroah-Hartman
` (580 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit f99351272933ba2e1221484a5e53b7a5d2c035f0 ]
A frame that is redirected to another CPU waits in the queue of the cpumap
entry with a plain pointer to the device it came from, and an skb from
generic XDP with skb->dev. Nothing keeps that device. Closing and
unregistering it waits for its NAPI and for RCU, but not for the kthread
of the entry. If the kthread is late by more than that, since its CPU is
busy with something of a higher priority, it builds skbs for a device that
has been freed and hands them to the stack:
BUG: KASAN: use-after-free in dev_gro_receive+0x1f51/0x2b30
Read of size 8 at addr ffff88800a7340b0 by task cpumap/1/map:1/54
Take a reference to the device for each entry of the queue. The kthread
cannot drop it at the end of the batch, since its GRO node may keep the skb
for longer. Let it note the devices and drop the references behind a full
GRO flush, which it does whenever the queue is empty, and from now on also
when it has noted about 2048 of them.
A device whose frames are stuck in a queue is now unregistered only when
the kthread has got to them. RTNL is not held meanwhile, but if the device
goes with its network namespace, the cleanup of all namespaces waits.
Fixes: 1c601d829ab0 ("bpf: cpumap xdp_buff to skb conversion and allocation")
Fixes: 11941f8a8536 ("bpf: cpumap: Implement generic cpumap")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-8-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/cpumap.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 806a7c1b364b6..64691f757f2a9 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -142,9 +142,11 @@ static void __cpu_map_ring_cleanup(struct ptr_ring *ring)
WARN_ON_ONCE(1);
if (unlikely(__ptr_test_bit(0, &ptr))) {
__ptr_clear_bit(0, &ptr);
+ dev_put(((struct sk_buff *)ptr)->dev);
kfree_skb(ptr);
continue;
}
+ dev_put(((struct xdp_frame *)ptr)->dev_rx);
xdp_return_frame(ptr);
}
}
@@ -324,6 +326,8 @@ static int cpu_map_kthread_run(void *data)
void *frames[CPUMAP_BATCH];
void *skbs[CPUMAP_BATCH];
LIST_HEAD(list);
+ struct net_device *held[CPUMAP_BATCH];
+ int nr_held = 0;
/* Release CPU reschedule checks */
if (__ptr_ring_empty(rcpu->queue)) {
@@ -356,10 +360,12 @@ static int cpu_map_kthread_run(void *data)
struct sk_buff *skb = f;
__ptr_clear_bit(0, &skb);
+ held[nr_held++] = skb->dev;
list_add_tail(&skb->list, &list);
continue;
}
+ held[nr_held++] = ((struct xdp_frame *)f)->dev_rx;
frames[xdp_n++] = f;
page = virt_to_page(f);
@@ -396,6 +402,8 @@ static int cpu_map_kthread_run(void *data)
list_add_tail(&skb->list, &list);
}
netif_receive_skb_list(&list);
+ while (nr_held)
+ dev_put(held[--nr_held]);
/* Feedback loop via tracepoint */
trace_xdp_cpumap_kthread(rcpu->map_id, n, kmem_alloc_drops,
@@ -722,12 +730,14 @@ static void bq_flush_to_queue(struct xdp_bulk_queue *bq)
for (i = 0; i < bq->count; i++) {
struct xdp_frame *xdpf = bq->q[i];
- int err;
- err = __ptr_ring_produce(q, xdpf);
- if (err) {
+ if (__ptr_ring_full(q)) {
drops++;
xdp_return_frame_rx_napi(xdpf);
+ } else {
+ /* The device cannot go before the flush, from now on it can */
+ dev_hold(xdpf->dev_rx);
+ __ptr_ring_produce(q, xdpf);
}
processed++;
}
@@ -783,11 +793,15 @@ int cpu_map_generic_redirect(struct bpf_cpu_map_entry *rcpu,
__skb_pull(skb, skb->mac_len);
skb_set_redirected(skb, false);
+ dev_hold(skb->dev);
__ptr_set_bit(0, &skb);
ret = ptr_ring_produce(rcpu->queue, skb);
- if (ret < 0)
+ if (ret < 0) {
+ __ptr_clear_bit(0, &skb);
+ dev_put(skb->dev);
goto trace;
+ }
wake_up_process(rcpu->kthread);
trace:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0419/1059] bpf: Zero-extend the index in inlined bpf_get_func_arg()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (417 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0418/1059] bpf, cpumap: Hold the device of frames in the queue Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0420/1059] gpiolib: clear the event clock flags when a line is released Greg Kroah-Hartman
` (579 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Woojin Ji, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Woojin Ji <random6.xyz@gmail.com>
[ Upstream commit 1c1dda9ba9f3af9cd511a197dcc86de2465d8fe5 ]
bpf_get_func_arg() takes a u32 index, but the inlined expansion compared
only the low 32 bits of R2 with the argument count and then shifted the
full 64-bit register to compute the context address. R2 is ARG_ANYTHING,
so nothing guarantees that its upper bits are zero: an index of
1ULL << 32 passes the bounds check as index zero while the load is
performed at ctx + (1ULL << 35).
Shift the index as a 32-bit value. When the 32-bit bounds check passes,
the low 32 bits of R2 are below R0, and R0 is at most 255: the trampoline
arm masks the argument count with 0xFF and the raw_tp arm uses the BTF
argument count minus one, which the verifier caps at MAX_BPF_FUNC_ARGS.
The 3-bit shift therefore cannot overflow and it clears the upper bits of
the register. Widening the comparison instead would reject indices whose
low 32 bits are valid. The check itself is unchanged, so this cannot
change which programs are accepted, only the address that is computed.
Fixes: f92c1e183604 ("bpf: Add get_func_[arg|ret|arg_cnt] helpers")
Signed-off-by: Woojin Ji <random6.xyz@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261018-get-func-arg-v2-1-048848b3eddf@gmail.com
[ sashal: Changed the inlined bpf_get_func_arg expansion in kernel/bpf/verifier.c instead of the upstream fixups.c, since this tree has no such file; the edit itself is the same. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 3e2865e0dc80b..423f8134cd502 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -14650,7 +14650,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
/* Load nr_args from ctx - 8 */
insn_buf[0] = BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8);
insn_buf[1] = BPF_JMP32_REG(BPF_JGE, BPF_REG_2, BPF_REG_0, 6);
- insn_buf[2] = BPF_ALU64_IMM(BPF_LSH, BPF_REG_2, 3);
+ insn_buf[2] = BPF_ALU32_IMM(BPF_LSH, BPF_REG_2, 3);
insn_buf[3] = BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_1);
insn_buf[4] = BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 0);
insn_buf[5] = BPF_STX_MEM(BPF_DW, BPF_REG_3, BPF_REG_0, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0420/1059] gpiolib: clear the event clock flags when a line is released
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (418 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0419/1059] bpf: Zero-extend the index in inlined bpf_get_func_arg() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0421/1059] netfilter: flowtable: reset transport header after nf_flow_encap_pop() Greg Kroah-Hartman
` (578 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Ambrozewicz,
Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Ambrozewicz <aambrozewicz@nvidia.com>
[ Upstream commit d35f61581ee67f8d4d58c325bac813cea528b6b9 ]
gpiod_free_commit() clears the flags that a request sets on a line, but
not GPIOD_FLAG_EVENT_CLOCK_REALTIME and GPIOD_FLAG_EVENT_CLOCK_HTE,
which gpio_v2_line_config_flags_to_desc_flags() sets from the uAPI v2
line config. Once a line requested with
GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME or
GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE is released, GPIO_V2_GET_LINEINFO_IOCTL
and the line info changed events, the "released" one included, keep
reporting that event clock for the free line:
GPIO_V2_GET_LINE_IOCTL, line 1, input, event clock realtime: ok
close()
GPIO_V2_GET_LINEINFO_IOCTL, line 1: input, event clock realtime
The flags are set before edge detection is set up, so a request that
fails in hte_ts_get(), for instance because no HTE provider handles the
line, leaves GPIOD_FLAG_EVENT_CLOCK_HTE behind as well. The next uAPI v2
request rewrites both flags, but requests through uAPI v1, sysfs exports
and in-kernel consumers do not, and the line info then shows the event
clock of an earlier user for them too.
Clear both flags together with the other flags of the request.
Reproduced under QEMU with a test GPIO chip: after a released request
with the realtime event clock, and on a kernel with CONFIG_HTE=y but no
HTE provider after a failed request with the HTE event clock, the line
info of the free line still reports that event clock. With this change
it reports none.
Fixes: 26d060e47e25 ("gpiolib: cdev: allow edge event timestamps to be configured as REALTIME")
Fixes: 2068339a6c35 ("gpiolib: cdev: Add hardware timestamp clock type")
Signed-off-by: Adrian Ambrozewicz <aambrozewicz@nvidia.com>
Link: https://patch.msgid.link/20261012-gpiolib-event-clock-v1-1-aambrozewicz@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
[ sashal: Replaced the upstream GPIOD_FLAG_* clears on a local flags word with FLAG_* clears directly on desc->flags, since the older function has no local flags variable. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a0c1dabd29398..8e7cc12c55471 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2064,6 +2064,8 @@ static bool gpiod_free_commit(struct gpio_desc *desc)
clear_bit(FLAG_BIAS_DISABLE, &desc->flags);
clear_bit(FLAG_EDGE_RISING, &desc->flags);
clear_bit(FLAG_EDGE_FALLING, &desc->flags);
+ clear_bit(FLAG_EVENT_CLOCK_REALTIME, &desc->flags);
+ clear_bit(FLAG_EVENT_CLOCK_HTE, &desc->flags);
clear_bit(FLAG_IS_HOGGED, &desc->flags);
#ifdef CONFIG_OF_DYNAMIC
desc->hog = NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0421/1059] netfilter: flowtable: reset transport header after nf_flow_encap_pop()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (419 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0420/1059] gpiolib: clear the event clock flags when a line is released Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0422/1059] ALSA: jack: Pin the module while debugfs files are open Greg Kroah-Hartman
` (577 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Pablo Neira Ayuso,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 08f7882637f2db5b98f521498eeaf94770383a6e ]
nf_flow_encap_pop() pulls vlan/pppoe or ip tunnel headers and resets the
network header, but leaves the transport header pointing into the removed
outer header. Reset the transport header to the inner L4 header, otherwise
later consumers (e.g. GSO segmentation) parse a bogus header.
Fixes: 4cd91f7c290f ("netfilter: flowtable: add vlan support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ sashal: adjusted context for the missing flowtable ctx struct, using the local offset variable and two-argument nf_flow_encap_pop() in the IPv4 and IPv6 hook functions. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_flow_table_ip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 92c7ef1f0052b..887dae959fbf3 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -394,6 +394,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
nf_flow_encap_pop(skb, tuplehash);
thoff -= offset;
+ skb_set_transport_header(skb, thoff);
iph = ip_hdr(skb);
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
@@ -656,6 +657,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
flow_offload_refresh(flow_table, flow, false);
nf_flow_encap_pop(skb, tuplehash);
+ skb_set_transport_header(skb, sizeof(*ip6h));
ip6h = ipv6_hdr(skb);
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0422/1059] ALSA: jack: Pin the module while debugfs files are open
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (420 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0421/1059] netfilter: flowtable: reset transport header after nf_flow_encap_pop() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0423/1059] nfsv4/pnfs: use the MDS authflavor for data server connections Greg Kroah-Hartman
` (576 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cen Zhang, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 8b479b265301e97bfbec0ef25de1c1f7eb4d2f74 ]
With CONFIG_SND=m and CONFIG_SND_JACK_INJECTION_DEBUG enabled, an in-tree
HDA jack creates these debugfs files through snd_jack_new() and
snd_jack_add_debugfs(). Their file_operations live in snd, but none sets
.owner. full_proxy_open_regular() therefore takes no snd module reference
when it calls fops_get(real_fops).
A debugfs descriptor can outlive removal of its HDA card. Once the card
and dependent modules, including the OSS emulation modules, have been
removed, snd can be unloaded while that descriptor is still open:
Descriptor holder Card/module teardown
----------------- --------------------
open jack debugfs file
full_proxy_open_regular()
fops_get(real_fops)
owner == NULL: no snd pin
keep descriptor open
remove HDA card
snd_card_disconnect()
snd_jack_dev_disconnect()
remove debugfs nodes
snd_jack_dev_free()
unload dependent modules
rmmod snd
alsa_sound_exit()
free_module(): unmap snd
close descriptor
full_proxy_release()
read real_fops->release
fops_put(real_fops)
read real_fops->owner
debugfs_remove() drains active operations, but does not wait for idle
open descriptors. Release deliberately bypasses removal protection and
reads the real table even when no release callback is installed. The
last close can therefore access unloaded snd storage.
Set .owner to THIS_MODULE in all six tables. The existing proxy
fops_get()/fops_put() pair then keeps snd loaded through the final table
access on close.
Fixes: 2d670ea2bd53 ("ALSA: jack: implement software jack injection via debugfs")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Link: https://patch.msgid.link/pm-pmb-431ddb947e1a13b95d3a-v3-02d37dd7b4eb4774e100@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: adjusted context to match this tree's single-space style (.open = simple_open,) instead of tab-aligned, and added .owner = THIS_MODULE, to the six file_operations tables. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/jack.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/core/jack.c b/sound/core/jack.c
index d5b4330747f22..5147ab8cf9263 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -307,6 +307,7 @@ static ssize_t jack_type_read(struct file *file,
}
static const struct file_operations jack_type_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.read = jack_type_read,
.llseek = default_llseek,
@@ -314,6 +315,7 @@ static const struct file_operations jack_type_fops = {
#endif
static const struct file_operations sw_inject_enable_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.read = sw_inject_enable_read,
.write = sw_inject_enable_write,
@@ -321,24 +323,28 @@ static const struct file_operations sw_inject_enable_fops = {
};
static const struct file_operations jackin_inject_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.write = jackin_inject_write,
.llseek = default_llseek,
};
static const struct file_operations jack_kctl_id_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.read = jack_kctl_id_read,
.llseek = default_llseek,
};
static const struct file_operations jack_kctl_mask_bits_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.read = jack_kctl_mask_bits_read,
.llseek = default_llseek,
};
static const struct file_operations jack_kctl_status_fops = {
+ .owner = THIS_MODULE,
.open = simple_open,
.read = jack_kctl_status_read,
.llseek = default_llseek,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0423/1059] nfsv4/pnfs: use the MDS authflavor for data server connections
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (421 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0422/1059] ALSA: jack: Pin the module while debugfs files are open Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0424/1059] pNFS/flexfiles: make pg_init retry loops killable Greg Kroah-Hartman
` (575 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tigran Mkrtchyan, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
[ Upstream commit 4b27670ea25b955b710021151471cb252240b1e0 ]
When a pNFS client connects to an NFSv4.1 data server, the EXCHANGE_ID
is always attempted with RPCSEC_GSS krb5i first, even if the auth flavor
with the MDS is AUTH_SYS. On a host that runs rpc.gssd but has no usable
machine credential, every first contact with a data server therefore
upcalls to rpc.gssd before falling back to AUTH_SYS.
As nfs4_discover_server_trunking is serialized by nfs_clid_init_mutex
such an extra upcall creates a backlog of DS connections when many files
accessed in parallel.
Pass the authflavor of the MDS lease to nfs4_alloc_client() and skip
the krb5i attempt if the MDS already ended up with AUTH_SYS. Nothing
changes for the MDS itself, or for data servers of an MDS whose lease
was established with krb5i.
Fixes: 4edaa308888b ("NFS: Use "krb5i" to establish NFSv4 state whenever possible")
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
[ sashal: Context-only adaptation: dropped the xprtsec/timeout context lines in internal.h and the TLS xprtsec block in nfs4_set_ds_client(), so the authflavor line follows .cred. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/internal.h | 1 +
fs/nfs/nfs4client.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index d71098bb69e17..456629ba3e7ff 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -81,6 +81,7 @@ struct nfs_client_initdata {
struct net *net;
const struct rpc_timeout *timeparms;
const struct cred *cred;
+ rpc_authflavor_t authflavor; /* Auth flavor to use for DS connection */
};
/*
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index fb5b8f2d1dcca..fa1decf3a225e 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -236,8 +236,12 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
/*
* Set up the connection to the server before we add add to the
* global list.
+ *
+ * Prefer krb5i unless the caller already knows AUTH_UNIX is required.
*/
- err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I);
+ err = -EINVAL;
+ if (cl_init->authflavor != RPC_AUTH_UNIX)
+ err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_GSS_KRB5I);
if (err == -EINVAL)
err = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX);
if (err < 0)
@@ -983,6 +987,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv,
.net = mds_clp->cl_net,
.timeparms = &ds_timeout,
.cred = mds_srv->cred,
+ .authflavor = mds_clp->cl_rpcclient->cl_auth->au_flavor,
};
char buf[INET6_ADDRSTRLEN + 1];
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0424/1059] pNFS/flexfiles: make pg_init retry loops killable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (422 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0423/1059] nfsv4/pnfs: use the MDS authflavor for data server connections Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0425/1059] ALSA: aloop: Keep shared timer callbacks alive through close Greg Kroah-Hartman
` (574 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tigran Mkrtchyan, Anna Schumaker,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
[ Upstream commit fde27289503beabe7e0856dac164a5ced4be0342 ]
When a task is killed while the pNFS client connects to a data server,
nfs4_pnfs_ds_connect() fails with -ERESTARTSYS. If the layout has
FF_FLAGS_NO_IO_THRU_MDS set, ff_layout_pg_init_read() cannot fall back
to the MDS and retries after an uninterruptible ssleep. As the fatal
signal stays pending, every new connect attempt is aborted the same
way and the task loops forever without returning to user space:
# grep -E 'SigPnd|ShdPnd' /proc/156021/status
SigPnd: 0000000000000100
ShdPnd: 0000000000000100
# cat /proc/156021/stack
msleep+0x2e/0x50
ff_layout_pg_init_read+0x267/0x310 [nfs_layout_flexfiles]
__nfs_pageio_add_request+0x1c1/0x480 [nfs]
nfs_pageio_add_request+0x21d/0x2c0 [nfs]
nfs_read_add_folio+0x143/0x200 [nfs]
nfs_readahead+0x204/0x290 [nfs]
read_pages+0x62/0x230
page_cache_ra_unbounded+0x136/0x180
filemap_get_pages+0xf2/0x350
filemap_read+0xd5/0x320
nfs_file_read+0x6d/0xc0 [nfs]
vfs_read+0x24f/0x3a0
__x64_sys_pread64+0x90/0xc0
do_syscall_64+0x5f/0xe0
Previous attempt propagates the error from nfs4_ff_layout_prepare_ds(), but
only ff_layout_{read,write}_pagelist() look at it. The pg_init functions
test IS_ERR() and retry on any error.
Check for a fatal signal or an exiting task before sleeping in
ff_layout_pg_init_read() and ff_layout_pg_init_write() and fail the I/O
instead of retrying.
Fixes: f06bedfa62d5 ("pNFS/flexfiles: don't attempt pnfs on fatal DS errors")
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 60f3fc26f0385..a9945db35ec81 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -819,6 +819,20 @@ ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio,
return ff_layout_choose_best_ds_for_read(lseg, 0, best_idx);
}
+/*
+ * Wait before retrying pg_init. Returns false, with pgio->pg_error set,
+ * if the task was killed or is exiting and must not retry.
+ */
+static bool ff_layout_pg_retry_wait(struct nfs_pageio_descriptor *pgio)
+{
+ if (fatal_signal_pending(current) || nfs_current_task_exiting()) {
+ pgio->pg_error = -ERESTARTSYS;
+ return false;
+ }
+ ssleep(1);
+ return true;
+}
+
static void
ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
struct nfs_page *req,
@@ -877,7 +891,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
goto out_mds;
pnfs_generic_pg_cleanup(pgio);
/* Sleep for 1 second before retrying */
- ssleep(1);
+ if (!ff_layout_pg_retry_wait(pgio))
+ return;
goto retry;
}
@@ -916,7 +931,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
}
pgio->pg_error = 0;
/* Sleep for 1 second before retrying */
- ssleep(1);
+ if (!ff_layout_pg_retry_wait(pgio))
+ return;
goto retry;
out_mds:
trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode,
@@ -965,7 +981,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
goto out_mds;
pnfs_generic_pg_cleanup(pgio);
/* Sleep for 1 second before retrying */
- ssleep(1);
+ if (!ff_layout_pg_retry_wait(pgio))
+ return;
goto retry;
}
pgm = &pgio->pg_mirrors[i];
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0425/1059] ALSA: aloop: Keep shared timer callbacks alive through close
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (423 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0424/1059] pNFS/flexfiles: make pg_init retry loops killable Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0426/1059] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Greg Kroah-Hartman
` (573 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cen Zhang, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit a7d4d780f34b9e43eefab6a7e6c9f4101f2c144e ]
The shared sound-timer callback must finish using the selected PCM
runtimes before a close can detach them. loopback_snd_timer_period_elapsed()
saves the active substreams under cable->lock, then drops the lock before
calling snd_pcm_period_elapsed() or snd_pcm_stop_xrun(). The sound-timer
backend has no per-stream close drain, and free_cable() keeps the timer
open when the paired endpoint remains attached.
With both directions running on a shared sound timer, playback can be
dropped and closed while a notification is pending. Capture keeps the
timer alive, allowing this order:
Timer callback Playback owner
-------------- --------------
select playback under cable->lock
unlock; delay notification
DROP; HW_FREE -> OPEN
close: snd_pcm_drop(); unlock
free_cable(); peer stays alive
snd_pcm_period_elapsed()
lock stream; cache runtime
snd_pcm_detach_substream()
free runtime and its fasync
read runtime->fasync
The stream lock taken by snd_pcm_drop() cannot protect a notification
that starts after it returns, and detach does not take it. The callback
can therefore read runtime->fasync after the runtime has been freed, and
an escaped notification can also reach a replacement runtime if the same
substream slot is reopened before the notification resumes.
Take the existing cable->stop_count reference under cable->lock when
selecting the targets and release it after the PCM callbacks finish,
including the XRUN path. free_cable() already removes the closing
endpoint under that lock and waits for stop_count before returning, so
runtime detach and slot reuse cannot overtake the notification.
Fixes: 26c53379f98d ("ALSA: aloop: Support selection of snd_timer instead of jiffies")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Assisted-by: LLM
Link: https://patch.msgid.link/pm-pmb-275c4399f517e09d7188-v2-2f64c1328529ef7a8fec@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Replaced snd_refcount and scoped_guard with the older stop_count atomic_inc, atomic_dec_and_test plus wake_up, and an exit label, keeping explicit spinlock calls and the existing wait_event in free_cable(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/drivers/aloop.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 0602b81275262..e66aef765c04c 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -98,7 +98,7 @@ struct loopback_ops {
struct loopback_cable {
spinlock_t lock;
struct loopback_pcm *streams[2];
- /* in-flight peer stops running outside cable->lock */
+ /* in-flight PCM callbacks running outside cable->lock */
atomic_t stop_count;
wait_queue_head_t stop_wait;
struct snd_pcm_hardware hw;
@@ -766,6 +766,8 @@ static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable,
valid_runtime = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ?
dpcm_play->substream->runtime :
dpcm_capt->substream->runtime;
+ /* Keep runtimes alive through the PCM callbacks. */
+ atomic_inc(&cable->stop_count);
/* resolution is only valid for SNDRV_TIMER_EVENT_TICK events */
if (event == SNDRV_TIMER_EVENT_TICK) {
@@ -780,7 +782,7 @@ static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable,
snd_pcm_stop_xrun(substream_play);
if (substream_capt)
snd_pcm_stop_xrun(substream_capt);
- return;
+ goto exit;
}
}
@@ -804,6 +806,10 @@ static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable,
snd_pcm_period_elapsed(substream_play);
if (substream_capt)
snd_pcm_period_elapsed(substream_capt);
+
+exit:
+ if (atomic_dec_and_test(&cable->stop_count))
+ wake_up(&cable->stop_wait);
}
static void loopback_snd_timer_function(struct snd_timer_instance *timeri,
@@ -1048,7 +1054,7 @@ static void free_cable(struct snd_pcm_substream *substream)
other_alive = cable->streams[!substream->stream];
}
- /* Pair with the stop_count increment in loopback_check_format(). */
+ /* Wait for PCM callbacks running outside cable->lock. */
wait_event(cable->stop_wait, !atomic_read(&cable->stop_count));
if (other_alive)
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0426/1059] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (424 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0425/1059] ALSA: aloop: Keep shared timer callbacks alive through close Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0427/1059] net: phy: qca83xx: read resolved QCA8337 link status Greg Kroah-Hartman
` (572 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Serhat Kumral, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Serhat Kumral <serhatkumral1@gmail.com>
[ Upstream commit bb75e5580b15cd23ededf15683a5ad67d7b61aab ]
In MLX5_IB_METHOD_STEERING_ANCHOR_CREATE, the user-supplied u16 priority
is passed directly to _get_flow_table() without an upper bound check.
This can lead to out-of-bounds array accesses on dev->flow_db priority
tables.
Check that priority does not exceed MLX5_IB_FLOW_LAST_PRIO before calling
_get_flow_table(), matching the existing validation in raw_fs_rule_add()
and mlx5_ib_create_flow().
Fixes: 0c6ab0ca9a66 ("RDMA/mlx5: Expose steering anchor to userspace")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
Link: https://patch.msgid.link/20261018144907.20123-1-serhatkumral1@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Kept the branch's existing kzalloc(sizeof(*obj), GFP_KERNEL) line as context instead of upstream's kzalloc_obj(*obj), since that helper isn't available here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx5/fs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index 1070d42df312b..f098a07f44d6a 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -2428,6 +2428,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(
if (err)
return err;
+ if (priority > MLX5_IB_FLOW_LAST_PRIO)
+ return -EINVAL;
+
obj = kzalloc(sizeof(*obj), GFP_KERNEL);
if (!obj)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0427/1059] net: phy: qca83xx: read resolved QCA8337 link status
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (425 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0426/1059] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0428/1059] xsk: freeze deferred pool teardown without blocking unregister Greg Kroah-Hartman
` (571 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrew Lunn, Yongzhao Chen,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongzhao Chen <yongzhao.derek@gmail.com>
[ Upstream commit 42a91cbfc7a3ab99d05cb2ed0de5a24b9652cfed ]
After a QCA8337 SmartSpeed downshift, genphy_read_status() can report
1000 Mbit/s from the advertised modes when the PHY is running at
100 Mbit/s. On a Redmi AX5400 running downstream OpenWrt Linux 6.18.52,
this caused qca8k to program the user-port MAC for 1000 Mbit/s and
traffic failed. An earlier prototype that read the resolved speed
from the PHY restored traffic.
Wrap genphy_read_status() and use at803x_read_specific_status() to
replace its speed and duplex result when an autonegotiated link comes
up. Resolve pause for the resulting duplex. Until the PHY reports a
resolved speed and duplex, report the link as down so that the next
poll reads them again, as marvell_read_status_page_an() does. In that
case also clear the duplex, master/slave state and link partner modes
that genphy_read_status() read for an up link. QCA8337's register
layout matches the helper (data sheet 80-Y0619-3 Rev. D, pages
327-328).
Keep the generic master/slave read order and the early return for a
steady autonegotiated link. This avoids additional reads of the
clear-on-read idle error count in MII_STAT1000. Forced mode continues
to use BMCR. Report the MDI-X state read at link-up and invalidate it
when the link goes down or autonegotiation is disabled. Clear
mdix_ctrl because this driver does not implement MDI-X configuration.
The QCA8327 entries keep genphy_read_status(). The AR8327 data sheet
(MKG-15791 Rev. 1.0) lists the QCA8327-A PHY ID and documents the same
PHY-specific status layout, with SmartSpeed enabled after a hardware
reset, so those PHYs may have the same problem. That is untested on
QCA8327 hardware, so limit this change to QCA8337.
Fixes: b3591c2a3661 ("net: dsa: qca8k: Switch to PHYLINK instead of PHYLIB")
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Yongzhao Chen <yongzhao.derek@gmail.com>
Assisted-by: LLM
Link: https://patch.msgid.link/20261013190339.51909-1-yongzhao.derek@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Added qca8337_read_status() to at803x.c, since the qcom/qca83xx.c file doesn't exist here, and dropped the ss_mask argument because at803x_read_specific_status() takes only phydev. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/at803x.c | 54 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 75868e63b81bb..edcdf531b7cc2 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -1594,6 +1594,59 @@ static int at803x_cable_test_start(struct phy_device *phydev)
return 0;
}
+static int qca8337_read_status(struct phy_device *phydev)
+{
+ int ret, old_link = phydev->link;
+
+ ret = genphy_read_status(phydev);
+ if (ret)
+ return ret;
+
+ /* Keep the state resolved at link-up while the link stays up */
+ if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
+ goto out;
+
+ phydev->mdix = ETH_TP_MDI_INVALID;
+
+ /* genphy_read_status() derives speed and duplex from the
+ * advertisements, which is wrong after a SmartSpeed downshift.
+ * Use what the PHY resolved instead.
+ */
+ if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete &&
+ phydev->link) {
+ phydev->speed = SPEED_UNKNOWN;
+ phydev->duplex = DUPLEX_UNKNOWN;
+ phydev->pause = false;
+ phydev->asym_pause = false;
+
+ ret = at803x_read_specific_status(phydev);
+ if (ret)
+ return ret;
+
+ /* Report the link down until speed and duplex are resolved,
+ * so that the next poll reads them again. Also clear what
+ * genphy_read_status() read for an up link, as the
+ * PHY_HALTED path of the state machine does.
+ */
+ if (phydev->speed == SPEED_UNKNOWN ||
+ phydev->duplex == DUPLEX_UNKNOWN) {
+ phydev->link = 0;
+ phydev->duplex = DUPLEX_UNKNOWN;
+ phydev->mdix = ETH_TP_MDI_INVALID;
+ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
+ linkmode_zero(phydev->lp_advertising);
+ } else {
+ phy_resolve_aneg_pause(phydev);
+ }
+ }
+
+out:
+ /* MDI-X configuration is not implemented */
+ phydev->mdix_ctrl = ETH_TP_MDI_INVALID;
+
+ return 0;
+}
+
static int qca83xx_config_init(struct phy_device *phydev)
{
u8 switch_revision;
@@ -2115,6 +2168,7 @@ static struct phy_driver at803x_driver[] = {
.flags = PHY_IS_INTERNAL,
.config_init = qca83xx_config_init,
.soft_reset = genphy_soft_reset,
+ .read_status = qca8337_read_status,
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0428/1059] xsk: freeze deferred pool teardown without blocking unregister
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (426 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0427/1059] net: phy: qca83xx: read resolved QCA8337 link status Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0429/1059] net: phy: marvell: keep WOL_EIE across interrupt reconfiguration Greg Kroah-Hartman
` (570 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard,
Björn Töpel, Jason Xing, Stanislav Fomichev,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit fece8420e76fe53ee84f0439f18d026b4c7641da ]
Deferred pool destruction calls ndo_bpf() under RTNL. system_wq is
not frozen during system sleep, so that callback can run after a
device has suspended and gated its clocks. Use system_freezable_wq
so running destruction finishes before device suspend and new work
waits until process thaw.
Keep assigned pools visible to NETDEV_UNREGISTER independently of
the socket list. A released socket has already left that list, but
its final pool put can queue destruction after workqueues freeze.
A resume-time unregister would then wait for a device reference
whose release cannot run until the resume completes.
Track assigned pools per netdev with netdev operations locking and detach
remaining pools after the notifier socket walk, including copy-mode pools.
This also covers leased queues without scanning pools from unrelated
devices or network namespaces. Remove the entry on assignment failure and
normal teardown. The deferred worker still owns the pool and later observes
the cleared device pointer, avoiding a second driver detach or put.
The lifetime problem was identified by code inspection of the deferred
release and system-sleep paths.
Fixes: 1c1efc2af158 ("xsk: Create and free buffer pool independently from umem")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20261014-xsk-suspend-teardown-v4-1-27795582e4a3@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Replaced the missing ops-lock helpers by using ASSERT_RTNL() for the assertions and dropping the netdev_lock_ops()/netdev_unlock_ops() calls, since RTNL already protects these paths. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/netdevice.h | 5 +++++
include/net/xsk_buff_pool.h | 3 +++
net/xdp/xsk.c | 5 +++++
net/xdp/xsk_buff_pool.c | 39 ++++++++++++++++++++++++++++++++-----
4 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 683896a9af446..d563eb164d295 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2377,6 +2377,11 @@ struct net_device {
/* protected by rtnl_lock */
struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE];
+#ifdef CONFIG_XDP_SOCKETS
+ /** @xsk_pools: assigned AF_XDP pools, ops protected */
+ struct hlist_head xsk_pools;
+#endif
+
u8 dev_addr_shadow[MAX_ADDR_LEN];
netdevice_tracker linkwatch_dev_tracker;
netdevice_tracker watchdog_dev_tracker;
diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
index e436363c21922..0139d6f35193c 100644
--- a/include/net/xsk_buff_pool.h
+++ b/include/net/xsk_buff_pool.h
@@ -43,6 +43,8 @@ struct xsk_buff_pool {
struct device *dev;
struct net_device *netdev;
struct list_head xsk_tx_list;
+ /* Assigned pools, including deferred releases; ops protected. */
+ struct hlist_node dev_node;
/* Protects modifications to the xsk_tx_list */
spinlock_t xsk_tx_list_lock;
refcount_t users;
@@ -106,6 +108,7 @@ bool xp_put_pool(struct xsk_buff_pool *pool);
void xp_clear_dev(struct xsk_buff_pool *pool);
void xp_add_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
void xp_del_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
+void xp_clear_dev_all(struct net_device *dev);
/* AF_XDP, and XDP core. */
void xp_free(struct xdp_buff_xsk *xskb);
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index e55e153377c82..44115a24c69f2 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -1370,6 +1370,11 @@ static int xsk_notifier(struct notifier_block *this,
mutex_unlock(&xs->mutex);
}
mutex_unlock(&net->xdp.lock);
+ /*
+ * A released socket is no longer on xdp.list. Its pool can still
+ * hold a device reference on the frozen release workqueue.
+ */
+ xp_clear_dev_all(dev);
break;
}
return NOTIFY_DONE;
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index b2004a8bf67fc..39d2bc1657142 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -174,6 +174,11 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
pool->cached_need_wakeup = XDP_WAKEUP_TX;
dev_hold(netdev);
+ /*
+ * Socket removal precedes the final pool put. Keep the pool visible to
+ * NETDEV_UNREGISTER even while release work is waiting for process thaw.
+ */
+ hlist_add_head(&pool->dev_node, &netdev->xsk_pools);
if (force_copy)
/* For copy-mode, we are done. */
@@ -208,6 +213,8 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
err = 0; /* fallback to copy mode */
if (err) {
xsk_clear_pool_at_qid(netdev, queue_id);
+ hlist_del(&pool->dev_node);
+ pool->netdev = NULL;
dev_put(netdev);
}
return err;
@@ -230,15 +237,33 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,
return xp_assign_dev(pool, dev, queue_id, flags);
}
+static void __xp_clear_dev(struct xsk_buff_pool *pool)
+{
+ struct net_device *netdev = pool->netdev;
+
+ ASSERT_RTNL();
+ xp_disable_drv_zc(pool);
+ xsk_clear_pool_at_qid(netdev, pool->queue_id);
+ hlist_del(&pool->dev_node);
+ pool->netdev = NULL;
+ dev_put(netdev);
+}
+
void xp_clear_dev(struct xsk_buff_pool *pool)
{
if (!pool->netdev)
return;
- xp_disable_drv_zc(pool);
- xsk_clear_pool_at_qid(pool->netdev, pool->queue_id);
- dev_put(pool->netdev);
- pool->netdev = NULL;
+ __xp_clear_dev(pool);
+}
+
+void xp_clear_dev_all(struct net_device *dev)
+{
+ struct xsk_buff_pool *pool;
+ struct hlist_node *next;
+
+ hlist_for_each_entry_safe(pool, next, &dev->xsk_pools, dev_node)
+ __xp_clear_dev(pool);
}
static void xp_release_deferred(struct work_struct *work)
@@ -276,7 +301,11 @@ bool xp_put_pool(struct xsk_buff_pool *pool)
if (refcount_dec_and_test(&pool->users)) {
INIT_WORK(&pool->work, xp_release_deferred);
- schedule_work(&pool->work);
+ /*
+ * Teardown calls ndo_bpf(), which may need powered hardware.
+ * RTNL alone does not exclude the device's system PM callbacks.
+ */
+ queue_work(system_freezable_wq, &pool->work);
return true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0429/1059] net: phy: marvell: keep WOL_EIE across interrupt reconfiguration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (427 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0428/1059] xsk: freeze deferred pool teardown without blocking unregister Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0430/1059] ip6mr: clear skb->cb[] in reg_vif_xmit() Greg Kroah-Hartman
` (569 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Igor Velkov,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit f434191f93884c9de58c38f18ac7fc7f1fdf9e42 ]
marvell_config_intr() rewrites the whole interrupt enable register, so
the config_intr call from phy_init_hw() on resume silently cleared
WOL_EIE on the 88E1318S and 88E1510: m88e1318_get_wol() still reported
WAKE_MAGIC, but a matched magic packet was no longer routed to INTn and
the board did not wake.
Bit 7 of that register is WOL_EIE only on these two PHYs; on others,
such as the 88E1111, it enables a FIFO error interrupt. So give the
88E1318S and 88E1510 their own config_intr and handle_interrupt, and
leave the shared callbacks unchanged.
m88e1318_set_wol() now records whether WoL is enabled, and both it and
the new config_intr derive WOL_EIE from that state under the MDIO bus
lock. WOL_EIE stays set across config_intr while WoL is enabled, except
when the PHY has an interrupt line and interrupts are being disabled,
as in phy_free_interrupt(): INTn is then the PHY IRQ, and nothing would
read IEVENT after free_irq() to release it. The bit is set again once
interrupts are re-enabled. phy_probe() still clears a WOL_EIE left by a
previous boot, since WoL starts out disabled. The new handler also
claims WoL events, so they do not go unacknowledged when the PHY IRQ is
in use.
Helios4 (Armada 388, 88E1512), 7.2.9. With this patch WOL_EIE stays set
over 3 link down/up cycles, "wol d" clears it, and a magic packet on a
running board is a handled interrupt. Without it, WOL_EIE is lost on the
first down/up, survives "wol d", and the magic packet is an unhandled
interrupt.
Fixes: 3871c3876f80 ("mv643xx_eth with 88E1318S: support Wake on LAN")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Tested-by: Igor Velkov <iav@iav.lv>
Link: https://patch.msgid.link/20261014194818.11640-2-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Context-only differences: hunk offsets and neighbouring lines adjusted because the older tree lacks the newer LED function defines and the vct_phase struct field; the added and removed lines are identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/marvell.c | 97 ++++++++++++++++++++++++++++++---------
1 file changed, 75 insertions(+), 22 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 339285690dd4c..42b8c528b9419 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -55,6 +55,8 @@
#define MII_M1011_IMASK 0x12
#define MII_M1011_IMASK_INIT 0x6400
#define MII_M1011_IMASK_CLEAR 0x0000
+/* WOL Event Interrupt Enable, 88E1318S and 88E1510 only */
+#define MII_M1011_IMASK_WOL BIT(7)
#define MII_M1011_PHY_SCR 0x10
#define MII_M1011_PHY_SCR_DOWNSHIFT_EN BIT(11)
@@ -139,11 +141,6 @@
#define MII_88E1318S_PHY_MSCR1_REG 16
#define MII_88E1318S_PHY_MSCR1_PAD_ODD BIT(6)
-/* Copper Specific Interrupt Enable Register */
-#define MII_88E1318S_PHY_CSIER 0x12
-/* WOL Event Interrupt Enable */
-#define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7)
-
/* LED Timer Control Register */
#define MII_88E1318S_PHY_LED_TCR 0x12
#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15)
@@ -306,6 +303,7 @@ struct marvell_priv {
u32 last;
u32 step;
s8 pair;
+ bool wol_enabled;
};
static int marvell_read_page(struct phy_device *phydev)
@@ -359,7 +357,8 @@ static int marvell_config_intr(struct phy_device *phydev)
return err;
}
-static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev)
+static irqreturn_t __marvell_handle_interrupt(struct phy_device *phydev,
+ u16 mask)
{
int irq_status;
@@ -369,7 +368,7 @@ static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE;
}
- if (!(irq_status & MII_M1011_IMASK_INIT))
+ if (!(irq_status & mask))
return IRQ_NONE;
phy_trigger_machine(phydev);
@@ -377,6 +376,57 @@ static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED;
}
+static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev)
+{
+ return __marvell_handle_interrupt(phydev, MII_M1011_IMASK_INIT);
+}
+
+/* WOL_EIE also routes WoL events to INTn. Keep it set while WoL is enabled,
+ * unless INTn is the PHY interrupt and that interrupt is being disabled:
+ * nothing would read IEVENT after free_irq() to release the line.
+ */
+static u16 m88e1318_wol_imask(struct phy_device *phydev)
+{
+ struct marvell_priv *priv = phydev->priv;
+
+ if (priv->wol_enabled &&
+ (phydev->interrupts == PHY_INTERRUPT_ENABLED ||
+ !phy_interrupt_is_valid(phydev)))
+ return MII_M1011_IMASK_WOL;
+
+ return 0;
+}
+
+static int m88e1318_config_intr(struct phy_device *phydev)
+{
+ bool enable = phydev->interrupts == PHY_INTERRUPT_ENABLED;
+ u16 imask;
+ int err;
+
+ if (enable) {
+ err = marvell_ack_interrupt(phydev);
+ if (err)
+ return err;
+ }
+
+ /* Serialise against m88e1318_set_wol() updating wol_enabled */
+ phy_lock_mdio_bus(phydev);
+ imask = enable ? MII_M1011_IMASK_INIT : MII_M1011_IMASK_CLEAR;
+ imask |= m88e1318_wol_imask(phydev);
+ err = __phy_write(phydev, MII_M1011_IMASK, imask);
+ phy_unlock_mdio_bus(phydev);
+ if (err || enable)
+ return err;
+
+ return marvell_ack_interrupt(phydev);
+}
+
+static irqreturn_t m88e1318_handle_interrupt(struct phy_device *phydev)
+{
+ return __marvell_handle_interrupt(phydev, MII_M1011_IMASK_INIT |
+ MII_M1011_IMASK_WOL);
+}
+
static int marvell_set_polarity(struct phy_device *phydev, int polarity)
{
u16 val;
@@ -1865,18 +1915,27 @@ static void m88e1318_get_wol(struct phy_device *phydev,
static int m88e1318_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
+ struct marvell_priv *priv = phydev->priv;
int err = 0, oldpage;
oldpage = phy_save_page(phydev);
if (oldpage < 0)
goto error;
- if (wol->wolopts & (WAKE_MAGIC | WAKE_PHY)) {
- /* Explicitly switch to page 0x00, just to be sure */
- err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE);
- if (err < 0)
- goto error;
+ priv->wol_enabled = !!(wol->wolopts & (WAKE_MAGIC | WAKE_PHY));
+ /* Explicitly switch to page 0x00, just to be sure */
+ err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE);
+ if (err < 0)
+ goto error;
+
+ /* Update the WOL interrupt enable */
+ err = __phy_modify(phydev, MII_M1011_IMASK, MII_M1011_IMASK_WOL,
+ m88e1318_wol_imask(phydev));
+ if (err < 0)
+ goto error;
+
+ if (priv->wol_enabled) {
/* If WOL event happened once, the LED[2] interrupt pin
* will not be cleared unless we reading the interrupt status
* register. If interrupts are in use, the normal interrupt
@@ -1886,12 +1945,6 @@ static int m88e1318_set_wol(struct phy_device *phydev,
if (!phy_interrupt_is_valid(phydev))
__phy_read(phydev, MII_M1011_IEVENT);
- /* Enable the WOL interrupt */
- err = __phy_set_bits(phydev, MII_88E1318S_PHY_CSIER,
- MII_88E1318S_PHY_CSIER_WOL_EIE);
- if (err < 0)
- goto error;
-
err = marvell_write_page(phydev, MII_MARVELL_LED_PAGE);
if (err < 0)
goto error;
@@ -3107,8 +3160,8 @@ static struct phy_driver marvell_drivers[] = {
.config_init = m88e1318_config_init,
.config_aneg = m88e1318_config_aneg,
.read_status = marvell_read_status,
- .config_intr = marvell_config_intr,
- .handle_interrupt = marvell_handle_interrupt,
+ .config_intr = m88e1318_config_intr,
+ .handle_interrupt = m88e1318_handle_interrupt,
.get_wol = m88e1318_get_wol,
.set_wol = m88e1318_set_wol,
.resume = genphy_resume,
@@ -3207,8 +3260,8 @@ static struct phy_driver marvell_drivers[] = {
.config_init = m88e1510_config_init,
.config_aneg = m88e1510_config_aneg,
.read_status = marvell_read_status,
- .config_intr = marvell_config_intr,
- .handle_interrupt = marvell_handle_interrupt,
+ .config_intr = m88e1318_config_intr,
+ .handle_interrupt = m88e1318_handle_interrupt,
.get_wol = m88e1318_get_wol,
.set_wol = m88e1318_set_wol,
.resume = m88e1510_resume,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0430/1059] ip6mr: clear skb->cb[] in reg_vif_xmit()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (428 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0429/1059] net: phy: marvell: keep WOL_EIE across interrupt reconfiguration Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0431/1059] net: stmmac: Track the TX DMA threshold per queue Greg Kroah-Hartman
` (568 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 238164201431a425e48dfcb8e9a59de63caf175b ]
reg_vif_xmit() hands the skb to ip6mr_cache_report() as an
MRT6MSG_WHOLEPKT report. skb_realloc_headroom() copies skb->cb[]
into the report, which is queued to the mroute socket, where
rawv6_recvmsg() reads it as IP6CB.
By the time the pim6reg device transmits the packet, skb->cb[] is
not IP6CB anymore: qdisc_pkt_len_init() overwrites iif and ra,
and any qdisc installed on the device (fq, fq_codel, pie, cake...)
or a tc BPF program writing skb->cb[] fills the area holding
dst0, srcrt, dst1, lastopt and flags.
Since commit dd433671fef3 ("ipv6: validate extension header length
before copying to cmsg") these stale offsets can no longer cause
out-of-bounds reads, but the mroute socket can still receive bogus
IPV6_PKTINFO ifindex and extension header ancillary data.
Clear IP6CB before building the report. The skb is freed right
after, so nothing else depends on its control block.
Fixes: 14fb64e1f449 ("[IPV6] MROUTE: Support PIM-SM (SSM).")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Kept the existing rcu_read_lock(); line in reg_vif_xmit() as context and added the memset after it, since upstream had a blank line at that spot. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6mr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 6c4ddeb48ec60..f5b3b9b8bb7a2 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -625,6 +625,13 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
DEV_STATS_ADD(dev, tx_bytes, skb->len);
DEV_STATS_INC(dev, tx_packets);
rcu_read_lock();
+
+ /* skb->cb[] holds qdisc/tc state at this point, not IP6CB.
+ * ip6mr_cache_report() copies it to the report delivered to
+ * the mroute socket, where it is read as IP6CB.
+ */
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
+
ip6mr_cache_report(mrt, skb, READ_ONCE(mrt->mroute_reg_vif_num),
MRT6MSG_WHOLEPKT);
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0431/1059] net: stmmac: Track the TX DMA threshold per queue
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (429 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0430/1059] ip6mr: clear skb->cb[] in reg_vif_xmit() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0432/1059] ksmbd: fix iface_list use-after-free during server reset Greg Kroah-Hartman
` (567 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ovidiu Panait, Maxime Chevallier,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
[ Upstream commit 9dd53418781900f02897c805eed397555cf98417 ]
Commit 3a6c12a0c6c3 ("net: stmmac: bump tc when get underflow error from
DMA descriptor") made dwmac4 raise the DMA threshold of the queues that
report TX underflows. This is done by incrementing a module global
parameter 'tc' by 64 on each underflow.
This leads to inconsistent TX DMA thresholds between queues and causes
issues on platforms with multiple stmmac controllers, as 'tc' is shared
by all of them. Once 'tc' goes over 256 the bumping stops, and queues
that did not underflow before are left at the initial threshold.
On the Renesas RZ/V2H platform, which has two dwmac4 controllers, we
observed sporadic iperf3 TCP TX failures:
iperf3 -c <server> -t5 --bind-dev end1
...
[ 5] 0.00-5.00 sec 1.00 MBytes 1.68 Mbits/sec 87 sender
[ 5] 0.00-5.00 sec 768 KBytes 1.26 Mbits/sec receiver
This happens because the TX queues of end1 were underflowing on a large
fraction of the packets, but the DMA TX threshold was never raised from
the default of 64 bytes. The threshold was not raised because end0
had underflowed first and had already pushed 'tc' past 256. Which
controller is affected depends on which one underflows first.
To fix this, make the TX DMA threshold per queue instead of global.
Each time an underflow happens on a queue, its TX DMA threshold gets
incremented, without affecting other queues or controllers. With this
change, 'tc' is only used as the initial value, and the RX threshold
is no longer bumped together with the TX one, as TX underflows have
nothing to do with the RX side.
Fixes: 3a6c12a0c6c3 ("net: stmmac: bump tc when get underflow error from DMA descriptor")
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20261013114503.57487-2-ovidiu.panait.rb@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Replaced per-queue context in the hunks for the TX threshold tracking; code changes are otherwise identical to upstream, with only surrounding context lines adjusted. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 33 +++++++++++--------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 7c7ed92094d11..103e5caca3c40 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -218,6 +218,7 @@ struct stmmac_priv {
unsigned int rx_copybreak;
u32 rx_riwt[MTL_MAX_TX_QUEUES];
+ u32 tx_threshold[MTL_MAX_TX_QUEUES];
int hwts_rx_en;
void __iomem *ioaddr;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c469a800fabb6..944779b0f511b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2376,7 +2376,6 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
txfifosz /= tx_channels_count;
if (priv->plat->force_thresh_dma_mode) {
- txmode = tc;
rxmode = tc;
} else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
/*
@@ -2390,7 +2389,6 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
rxmode = SF_DMA_MODE;
priv->xstats.threshold = SF_DMA_MODE;
} else {
- txmode = tc;
rxmode = SF_DMA_MODE;
}
@@ -2419,8 +2417,11 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
for (chan = 0; chan < tx_channels_count; chan++) {
qmode = priv->plat->tx_queues_cfg[chan].mode_to_use;
- stmmac_dma_tx_mode(priv, priv->ioaddr, txmode, chan,
- txfifosz, qmode);
+ if (txmode == SF_DMA_MODE)
+ priv->tx_threshold[chan] = SF_DMA_MODE;
+
+ stmmac_dma_tx_mode(priv, priv->ioaddr, priv->tx_threshold[chan],
+ chan, txfifosz, qmode);
}
}
@@ -2524,17 +2525,20 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
static void stmmac_bump_dma_threshold(struct stmmac_priv *priv, u32 chan)
{
- if (unlikely(priv->xstats.threshold != SF_DMA_MODE) && tc <= 256) {
- tc += 64;
+ u32 thresh = priv->tx_threshold[chan];
- if (priv->plat->force_thresh_dma_mode)
- stmmac_set_dma_operation_mode(priv, tc, tc, chan);
- else
- stmmac_set_dma_operation_mode(priv, tc, SF_DMA_MODE,
- chan);
+ if (unlikely(thresh == SF_DMA_MODE) || thresh > 256)
+ return;
- priv->xstats.threshold = tc;
- }
+ thresh += 64;
+
+ if (priv->plat->force_thresh_dma_mode)
+ stmmac_set_dma_operation_mode(priv, thresh, tc, chan);
+ else
+ stmmac_set_dma_operation_mode(priv, thresh, SF_DMA_MODE, chan);
+
+ priv->tx_threshold[chan] = thresh;
+ priv->xstats.threshold = thresh;
}
/**
@@ -7446,6 +7450,9 @@ int stmmac_dvr_probe(struct device *device,
priv->xstats.threshold = tc;
+ for (i = 0; i < MTL_MAX_TX_QUEUES; i++)
+ priv->tx_threshold[i] = tc;
+
/* Initialize RSS */
rxq = priv->plat->rx_queues_to_use;
netdev_rss_key_fill(priv->rss.key, sizeof(priv->rss.key));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0432/1059] ksmbd: fix iface_list use-after-free during server reset
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (430 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0431/1059] net: stmmac: Track the TX DMA threshold per queue Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0433/1059] ksmbd: report IPv4 and IPv6 addresses independently in iface query Greg Kroah-Hartman
` (566 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Henry Hu, Namjae Jeon,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Hu <huhai@kylinos.cn>
[ Upstream commit d34d38ab0c62fe4eb9e746420c554e6d0e6f54db ]
ksmbd_find_netdev_name_iface_list() walks iface_list for
fsctl_query_iface_info_ioctl(), which holds RTNL. But during server
reset, ksmbd_tcp_destroy() unlinks and frees the entries without RTNL,
and queued SMB requests can still be running at that point. So an
FSCTL_QUERY_NETWORK_INTERFACE_INFO request can therefore race with
interface destruction and dereference a freed entry. With debug-only
instrumentation to make the race deterministic, KASAN reports:
BUG: KASAN: slab-use-after-free in
ksmbd_find_netdev_name_iface_list
ksmbd_find_netdev_name_iface_list
fsctl_query_iface_info_ioctl
smb2_ioctl
handle_ksmbd_work
Freed by:
kfree
ksmbd_tcp_destroy
ksmbd_conn_transport_destroy
kill_server_store
The fix is to detach iface_list to a temporary list under RTNL, then drop
RTNL before cleanup because the following cleanup may block and hold RTNL
for a long time.
Fixes: b2d99376c5d6 ("ksmbd: browse interfaces list on FSCTL_QUERY_INTERFACE_INFO IOCTL")
Reported-by: Sashiko <sashiko-bot+sashiko@kernel.org>
Link: https://sashiko.dev/#/patchset/20260911163516.6403-1-15815827059%40163.com
Assisted-by: LLM
Signed-off-by: Henry Hu <huhai@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Dropped the ksmbd_tcp_stop_listener() call from the free loop, since the older tree's loop never had that call or function. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/transport_tcp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/transport_tcp.c b/fs/smb/server/transport_tcp.c
index 7b06fff60d6b7..0d31a26da9642 100644
--- a/fs/smb/server/transport_tcp.c
+++ b/fs/smb/server/transport_tcp.c
@@ -652,10 +652,15 @@ static void tcp_stop_kthread(struct task_struct *kthread)
void ksmbd_tcp_destroy(void)
{
struct interface *iface, *tmp;
+ LIST_HEAD(iface_list_to_free);
unregister_netdevice_notifier(&ksmbd_netdev_notifier);
- list_for_each_entry_safe(iface, tmp, &iface_list, entry) {
+ rtnl_lock();
+ list_splice_init(&iface_list, &iface_list_to_free);
+ rtnl_unlock();
+
+ list_for_each_entry_safe(iface, tmp, &iface_list_to_free, entry) {
list_del(&iface->entry);
kfree(iface->name);
kfree(iface);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0433/1059] ksmbd: report IPv4 and IPv6 addresses independently in iface query
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (431 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0432/1059] ksmbd: fix iface_list use-after-free during server reset Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0434/1059] ksmbd: disconnect on invalid encryption transform flags Greg Kroah-Hartman
` (565 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Henry Hu, Namjae Jeon,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Hu <huhai@kylinos.cn>
[ Upstream commit bb0326a5806015fb7e5a6a721a50ff172c92c6e4 ]
fsctl_query_iface_info_ioctl() appends an entry before checking that a
usable address was found, so it advertises unspecified-address
placeholders: an entry containing 0.0.0.0 when an in_device exists but
has no primary IPv4 address, and an entry containing :: when an
inet6_dev exists but its address list is empty or every address is
tentative or deprecated.
The loop also couples IPv6 reporting to IPv4 success: when
__in_dev_get_rtnl() returns NULL it continues to the next interface,
skipping the IPv6 pass, so an interface without an in_device is dropped
even if it has a usable IPv6 address.
Query IPv4 and IPv6 independently and append an entry only when an
address is found. Factor out the common entry initialization and query
the link speed once per interface instead of once per address family.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Reported-by: Sashiko <sashiko-bot+sashiko@kernel.org>
Link: https://sashiko.dev/#/patchset/20260910090818.24479-1-15815827059%40163.com
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Henry Hu <huhai@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Adapted to the older tree's names and endian annotations: cpu_to_le32/cpu_to_le16 around Capability and Family (including in the new helper), IPv4address/IPv6address field names, and dev_get_flags(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 127 ++++++++++++++++++++++------------------
1 file changed, 70 insertions(+), 57 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 5f9b9deb8b819..8639ae4537761 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -7755,6 +7755,27 @@ static __be32 idev_ipv4_address(struct in_device *idev)
return addr;
}
+static struct network_interface_info_ioctl_rsp *
+ksmbd_iface_entry_init(struct smb2_ioctl_rsp *rsp, int nbytes,
+ struct net_device *netdev, unsigned long long speed)
+{
+ struct network_interface_info_ioctl_rsp *nii_rsp;
+
+ nii_rsp = (struct network_interface_info_ioctl_rsp *)&rsp->Buffer[nbytes];
+ nii_rsp->IfIndex = cpu_to_le32(netdev->ifindex);
+ nii_rsp->Capability = 0;
+ if (netdev->real_num_tx_queues > 1)
+ nii_rsp->Capability |= cpu_to_le32(RSS_CAPABLE);
+ if (ksmbd_rdma_capable_netdev(netdev))
+ nii_rsp->Capability |= cpu_to_le32(RDMA_CAPABLE);
+ nii_rsp->Next = cpu_to_le32(152);
+ nii_rsp->Reserved = 0;
+ nii_rsp->LinkSpeed = cpu_to_le64(speed);
+ memset(nii_rsp->SockAddr_Storage, 0, 128);
+
+ return nii_rsp;
+}
+
static int fsctl_query_iface_info_ioctl(struct ksmbd_conn *conn,
struct smb2_ioctl_rsp *rsp,
unsigned int out_buf_len)
@@ -7769,7 +7790,12 @@ static int fsctl_query_iface_info_ioctl(struct ksmbd_conn *conn,
rtnl_lock();
for_each_netdev(&init_net, netdev) {
- bool ipv4_set = false;
+ struct inet6_ifaddr *ifa;
+ struct inet6_dev *idev6;
+ struct in_device *idev;
+ struct in6_addr ip6 = { };
+ bool have_ip6 = false;
+ __be32 ip4 = 0;
if (netdev->type == ARPHRD_LOOPBACK)
continue;
@@ -7780,25 +7806,6 @@ static int fsctl_query_iface_info_ioctl(struct ksmbd_conn *conn,
flags = dev_get_flags(netdev);
if (!(flags & IFF_RUNNING))
continue;
-ipv6_retry:
- if (out_buf_len <
- nbytes + sizeof(struct network_interface_info_ioctl_rsp)) {
- rtnl_unlock();
- return -ENOSPC;
- }
-
- nii_rsp = (struct network_interface_info_ioctl_rsp *)
- &rsp->Buffer[nbytes];
- nii_rsp->IfIndex = cpu_to_le32(netdev->ifindex);
-
- nii_rsp->Capability = 0;
- if (netdev->real_num_tx_queues > 1)
- nii_rsp->Capability |= cpu_to_le32(RSS_CAPABLE);
- if (ksmbd_rdma_capable_netdev(netdev))
- nii_rsp->Capability |= cpu_to_le32(RDMA_CAPABLE);
-
- nii_rsp->Next = cpu_to_le32(152);
- nii_rsp->Reserved = 0;
if (!__ethtool_get_link_ksettings(netdev, &cmd) &&
cmd.base.speed && cmd.base.speed != SPEED_UNKNOWN) {
@@ -7808,60 +7815,66 @@ static int fsctl_query_iface_info_ioctl(struct ksmbd_conn *conn,
"speed is unknown, defaulting to 1Gb/sec");
speed = SPEED_1000;
}
-
speed *= 1000000;
- nii_rsp->LinkSpeed = cpu_to_le64(speed);
- sockaddr_storage = (struct sockaddr_storage_rsp *)
- nii_rsp->SockAddr_Storage;
- memset(sockaddr_storage, 0, 128);
+ /*
+ * Query IPv4 and IPv6 independently; emit an entry only when a
+ * usable address exists, so an interface missing one family is
+ * still reported for the other and 0.0.0.0 / :: placeholders are
+ * never advertised.
+ */
+ idev = __in_dev_get_rtnl(netdev);
+ if (idev)
+ ip4 = idev_ipv4_address(idev);
- if (!ipv4_set) {
- struct in_device *idev;
+ idev6 = __in6_dev_get(netdev);
+ if (idev6) {
+ rcu_read_lock();
+ list_for_each_entry_rcu(ifa, &idev6->addr_list, if_list) {
+ if (ifa->flags & (IFA_F_TENTATIVE | IFA_F_DEPRECATED))
+ continue;
+ memcpy(&ip6, ifa->addr.s6_addr, sizeof(ip6));
+ have_ip6 = true;
+ break;
+ }
+ rcu_read_unlock();
+ }
+ if (ip4) {
+ if (out_buf_len <
+ nbytes + sizeof(struct network_interface_info_ioctl_rsp)) {
+ rtnl_unlock();
+ return -ENOSPC;
+ }
+
+ nii_rsp = ksmbd_iface_entry_init(rsp, nbytes, netdev, speed);
+ sockaddr_storage = (struct sockaddr_storage_rsp *)nii_rsp->SockAddr_Storage;
sockaddr_storage->Family = cpu_to_le16(INTERNETWORK);
sockaddr_storage->addr4.Port = 0;
-
- idev = __in_dev_get_rtnl(netdev);
- if (!idev)
- continue;
- sockaddr_storage->addr4.IPv4address =
- idev_ipv4_address(idev);
+ sockaddr_storage->addr4.IPv4address = ip4;
nbytes += sizeof(struct network_interface_info_ioctl_rsp);
- ipv4_set = true;
- goto ipv6_retry;
- } else {
- struct inet6_dev *idev6;
- struct inet6_ifaddr *ifa;
- __u8 *ipv6_addr = sockaddr_storage->addr6.IPv6address;
+ }
+
+ if (have_ip6) {
+ if (out_buf_len <
+ nbytes + sizeof(struct network_interface_info_ioctl_rsp)) {
+ rtnl_unlock();
+ return -ENOSPC;
+ }
+ nii_rsp = ksmbd_iface_entry_init(rsp, nbytes, netdev, speed);
+ sockaddr_storage = (struct sockaddr_storage_rsp *)nii_rsp->SockAddr_Storage;
sockaddr_storage->Family = cpu_to_le16(INTERNETWORKV6);
sockaddr_storage->addr6.Port = 0;
sockaddr_storage->addr6.FlowInfo = 0;
-
- idev6 = __in6_dev_get(netdev);
- if (!idev6)
- continue;
-
- rcu_read_lock();
- list_for_each_entry_rcu(ifa, &idev6->addr_list, if_list) {
- if (ifa->flags & (IFA_F_TENTATIVE |
- IFA_F_DEPRECATED))
- continue;
- memcpy(ipv6_addr, ifa->addr.s6_addr, 16);
- break;
- }
- rcu_read_unlock();
+ memcpy(sockaddr_storage->addr6.IPv6address, ip6.s6_addr, 16);
sockaddr_storage->addr6.ScopeId = 0;
nbytes += sizeof(struct network_interface_info_ioctl_rsp);
}
}
rtnl_unlock();
- /*
- * nii_rsp may point to an entry not included in nbytes if the IPv4
- * or IPv6 device lookup failed. Clear Next in the last returned entry.
- */
+ /* Clear Next of the last committed entry to terminate the list. */
if (nbytes > 0) {
nii_rsp = (struct network_interface_info_ioctl_rsp *)
&rsp->Buffer[nbytes - sizeof(*nii_rsp)];
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0434/1059] ksmbd: disconnect on invalid encryption transform flags
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (432 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0433/1059] ksmbd: report IPv4 and IPv6 addresses independently in iface query Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0435/1059] selftests/proc: proc-pid-vm: fix unused variable warning on non-x86 Greg Kroah-Hartman
` (564 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 0882f124ae329eefb66b00e63b9043f24c006b0e ]
MS-SMB2 3.3.5.2.1.1 requires the Flags/EncryptionAlgorithm field in an
SMB2 transform header to be 0x0001. The server must disconnect the
connection when it has any other value.
smb3_decrypt_req() currently ignores this field. A client with the
session key can therefore send a correctly authenticated encrypted
request with invalid flags and have it processed. Check the field
before looking up the session key or decrypting the request. The caller
aborts the connection when this check fails.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Added the transform-header flags check to smb3_decrypt_req() with context adjusted for older surrounding code, and without the upstream caller-side connection abort, which isn't present here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 8639ae4537761..a87f10c1e760b 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -9151,6 +9151,12 @@ int smb3_decrypt_req(struct ksmbd_work *work)
return -ECONNABORTED;
}
+ if (tr_hdr->Flags != cpu_to_le16(TRANSFORM_FLAG_ENCRYPTED)) {
+ pr_err_ratelimited("Invalid transform flags 0x%04x\n",
+ le16_to_cpu(tr_hdr->Flags));
+ return -ECONNABORTED;
+ }
+
if (buf_data_size < le32_to_cpu(tr_hdr->OriginalMessageSize)) {
pr_err("Transform message is broken\n");
return -ECONNABORTED;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0435/1059] selftests/proc: proc-pid-vm: fix unused variable warning on non-x86
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (433 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0434/1059] ksmbd: disconnect on invalid encryption transform flags Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0436/1059] virtio-net: fix frag overflow in big packets receive Greg Kroah-Hartman
` (563 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sasha Levin, Andrew Morton,
Shuah Khan, Alexey Dobriyan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c4d9005e7e1ee6ce277f47cf53d44fc5b90b287b ]
g_vsyscall is only used by the x86_64 test, so clang builds for other
architectures get:
proc-pid-vm.c:224:21: warning: unused variable 'g_vsyscall' [-Wunused-variable]
The vsyscall strings next to it had the same problem and were marked
__maybe_unused for it. Move all of the vsyscall variables into the
__x86_64__ block that uses them instead, and drop those annotations
along with the local __maybe_unused fallback that was added for them.
Link: https://lore.kernel.org/20261012115330.3777115-1-sashal@kernel.org
Fixes: 17415606f9d8 ("tools/testing/selftests/proc/proc-pid-vm.c: test with vsyscall in mind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Assisted-by: LLM
Cc: Shuah Khan <shuah@kernel.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
[ sashal: Dropped the #endif after make_exe() and the #ifdef __x86_64__ before the vsyscall variables; the include-block conflict was resolved by keeping this tree's own includes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/proc/proc-pid-vm.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c
index cacbd2a4aec91..fb4b4b648240a 100644
--- a/tools/testing/selftests/proc/proc-pid-vm.c
+++ b/tools/testing/selftests/proc/proc-pid-vm.c
@@ -209,7 +209,6 @@ static int make_exe(const uint8_t *payload, size_t len)
return fd1;
}
-#endif
/*
* 0: vsyscall VMA doesn't exist vsyscall=none
@@ -225,7 +224,6 @@ static const char str_vsyscall_1[] =
static const char str_vsyscall_2[] =
"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n";
-#ifdef __x86_64__
static void sigaction_SIGSEGV(int _, siginfo_t *__, void *___)
{
_exit(g_vsyscall);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0436/1059] virtio-net: fix frag overflow in big packets receive
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (434 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0435/1059] selftests/proc: proc-pid-vm: fix unused variable warning on non-x86 Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0437/1059] zram: fix short reads from block_state Greg Kroah-Hartman
` (562 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Willem de Bruijn, Michael S. Tsirkin,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <willemb@google.com>
[ Upstream commit b0e4ea3a0cd42eccad9cc4153afcad555480b9e6 ]
In big packets mode with guest GSO, add_recvbuf_big() posts a chain of
MAX_SKB_FRAGS + 1 pages. page_to_skb() copies only ETH_HLEN of the
first page into the linear area and adds the rest of that page as a
frag, then one frag per remaining page. A device that fills the entire
buffer therefore causes MAX_SKB_FRAGS + 1 frags, writing one
skb_frag_t past the end of skb_shinfo(skb)->frags[].
Post one page less. The buffer still fits a maximal GSO packet. A well
behaved device does not trigger this, as GSO packets are at most 64KB.
Also check the frag count in page_to_skb() before adding any frag as
defense in depth.
Fixes: 9ab86bbcf8be ("virtio_net: Defer skb allocation in receive path Date: Wed, 13 Jan 2010 12:53:38 -0800")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20261020032108.81879-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Changed the %d in the pr_debug() format string to %lu because MAX_SKB_FRAGS is unsigned long in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/virtio_net.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9773a64c5dba8..09cf03613704f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -544,6 +544,15 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
}
BUG_ON(offset >= PAGE_SIZE);
+
+ /* The first frag starts at offset, each next frag is a full page. */
+ if (unlikely(DIV_ROUND_UP(offset + len, PAGE_SIZE) > MAX_SKB_FRAGS)) {
+ pr_debug("%s: rx error: len %u needs more than %lu frags\n",
+ vi->dev->name, len, MAX_SKB_FRAGS);
+ kfree_skb(skb);
+ return NULL;
+ }
+
while (len) {
unsigned int frag_size = min((unsigned)PAGE_SIZE - offset, len);
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset,
@@ -3833,7 +3842,8 @@ static void virtnet_set_big_packets(struct virtnet_info *vi, const int mtu)
*/
if (mtu > ETH_DATA_LEN || guest_gso) {
vi->big_packets = true;
- vi->big_packets_num_skbfrags = guest_gso ? MAX_SKB_FRAGS : DIV_ROUND_UP(mtu, PAGE_SIZE);
+ vi->big_packets_num_skbfrags = guest_gso ? MAX_SKB_FRAGS - 1 :
+ DIV_ROUND_UP(mtu, PAGE_SIZE);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0437/1059] zram: fix short reads from block_state
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (435 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0436/1059] virtio-net: fix frag overflow in big packets receive Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0438/1059] maple_tree: fix maple_range_64 crashes in RCU mode Greg Kroah-Hartman
` (561 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pooyan Azad, Andrew Morton,
Sergey Senozhatsky, Minchan Kim, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pooyan Azad <pooyan.azadparvar@gmail.com>
[ Upstream commit 372012202260db088b489ed00059c4571a602552 ]
read_block_state() formats each entry directly into the buffer supplied by
read(). If the remaining buffer is too small for one complete record,
snprintf() returns the full record length and the function stops without
copying data or advancing the file position. A read from this debugfs
file which is smaller than a record therefore returns zero at a non-EOF
position and cannot make progress.
Convert block_state to seq_file so formatted records are buffered
independently of the userspace read size. Keep dev_lock held across each
seq_file iteration and continue to protect individual entries with their
slot locks.
Link: https://lore.kernel.org/20260929071846.24829-1-pooyan.azadparvar@gmail.com
Fixes: c0265342bff4 ("zram: introduce zram memory tracking")
Signed-off-by: Pooyan Azad <pooyan.azadparvar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Closes: https://lore.kernel.org/r/CANC3H+LdtoydSp+o2ecErAw7k6R2+gRf9LyxcaoHv_mGhJmyQQ@mail.gmail.com/
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
[ sashal: Converted block_state to a seq_file using this tree's init_lock, zram_* slot helpers, ktime_t access time and four flag characters, instead of upstream's names, u32 time and six flags. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/zram/zram_drv.c | 100 +++++++++++++++++-----------------
1 file changed, 51 insertions(+), 49 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index b8a2cb2f901cf..ef2f6687eeeea 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -31,6 +31,7 @@
#include <linux/idr.h>
#include <linux/sysfs.h>
#include <linux/debugfs.h>
+#include <linux/seq_file.h>
#include <linux/cpuhotplug.h>
#include <linux/part_stat.h>
@@ -904,69 +905,70 @@ static void zram_accessed(struct zram *zram, u32 index)
zram->table[index].ac_time = ktime_get_boottime();
}
-static ssize_t read_block_state(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static void *zram_block_state_start(struct seq_file *seq, loff_t *pos)
{
- char *kbuf;
- ssize_t index, written = 0;
- struct zram *zram = file->private_data;
+ struct zram *zram = seq->private;
unsigned long nr_pages;
- kbuf = kvmalloc(count, GFP_KERNEL);
- if (!kbuf)
- return -ENOMEM;
-
down_read(&zram->init_lock);
- if (!init_done(zram)) {
- up_read(&zram->init_lock);
- kvfree(kbuf);
- return -EINVAL;
- }
+ if (!init_done(zram))
+ return ERR_PTR(-EINVAL);
nr_pages = zram->disksize >> PAGE_SHIFT;
+ if (*pos >= nr_pages)
+ return NULL;
- for (index = *ppos; index < nr_pages; index++) {
- int copied;
- struct timespec64 ts;
+ return pos;
+}
- zram_slot_lock(zram, index);
- if (!zram_allocated(zram, index))
- goto next;
+static void *zram_block_state_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct zram *zram = seq->private;
+ unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
- ts = ktime_to_timespec64(zram->table[index].ac_time);
- copied = snprintf(kbuf + written, count,
- "%12zd %12lld.%06lu %c%c%c%c\n",
- index, (s64)ts.tv_sec,
- ts.tv_nsec / NSEC_PER_USEC,
- zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
- zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
- zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.',
- zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.');
-
- if (count <= copied) {
- zram_slot_unlock(zram, index);
- break;
- }
- written += copied;
- count -= copied;
-next:
- zram_slot_unlock(zram, index);
- *ppos += 1;
- }
+ ++*pos;
+ if (*pos >= nr_pages)
+ return NULL;
+
+ return pos;
+}
+
+static void zram_block_state_stop(struct seq_file *seq, void *v)
+{
+ struct zram *zram = seq->private;
up_read(&zram->init_lock);
- if (copy_to_user(buf, kbuf, written))
- written = -EFAULT;
- kvfree(kbuf);
+}
- return written;
+static int zram_block_state_show(struct seq_file *seq, void *v)
+{
+ struct zram *zram = seq->private;
+ unsigned long index = *(loff_t *)v;
+ struct timespec64 ts;
+
+ zram_slot_lock(zram, index);
+ if (zram_allocated(zram, index)) {
+ ts = ktime_to_timespec64(zram->table[index].ac_time);
+ seq_printf(seq, "%12lu %12lld.%06lu %c%c%c%c\n",
+ index, (s64)ts.tv_sec,
+ ts.tv_nsec / NSEC_PER_USEC,
+ zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
+ zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
+ zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.',
+ zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.');
+ }
+ zram_slot_unlock(zram, index);
+
+ return 0;
}
-static const struct file_operations proc_zram_block_state_op = {
- .open = simple_open,
- .read = read_block_state,
- .llseek = default_llseek,
+static const struct seq_operations zram_block_state_sops = {
+ .start = zram_block_state_start,
+ .next = zram_block_state_next,
+ .stop = zram_block_state_stop,
+ .show = zram_block_state_show,
};
+DEFINE_SEQ_ATTRIBUTE(zram_block_state);
static void zram_debugfs_register(struct zram *zram)
{
@@ -976,7 +978,7 @@ static void zram_debugfs_register(struct zram *zram)
zram->debugfs_dir = debugfs_create_dir(zram->disk->disk_name,
zram_debugfs_root);
debugfs_create_file("block_state", 0400, zram->debugfs_dir,
- zram, &proc_zram_block_state_op);
+ zram, &zram_block_state_fops);
}
static void zram_debugfs_unregister(struct zram *zram)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0438/1059] maple_tree: fix maple_range_64 crashes in RCU mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (436 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0437/1059] zram: fix short reads from block_state Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0439/1059] ceph: wait for pending fscache write in write_folio_nounlock() Greg Kroah-Hartman
` (560 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dimitris Charisis, Andrew Morton,
Liam R. Howlett (Google), Florian Schmaus, Alice Ryhl,
Andrew Ballance, Suren Baghdasaryan, Matthew Wilcox (Oracle),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dimitris Charisis <dchar@cslab.ece.ntua.gr>
[ Upstream commit baed735a956f2a7badb5436bef6810303034f920 ]
Patch series "maple_tree: fix maple_range_64 crashes in RCU mode", v3.
The patch series fixes two RCU destroy path issues on maple_range_64
nodes. Both arising from the fact that a maple_range_64 node repurposes
the last slot to hold metadata when the node is not full. Patch 1
addresses the issues, and patch 2 adds a test used to catch them.
Currently there is no in-tree user of maple_range_64 nodes in RCU mode.
All in-tree users of MT_FLAGS_USE_RCU also set MT_FLAGS_ALLOC_RANGE which
makes the internal nodes maple_arange_64.
Below is the minimal reproducer used during debugging:
static DEFINE_MTREE(tree);
static int __init maple_fix_init(void)
{
unsigned long i, j;
for (i = 10; i < 4000; i++) {
mt_init_flags(&tree, MT_FLAGS_USE_RCU);
for (j = 0; j < i; j++) {
mtree_insert_range(&tree, j * 10, j * 10 + 9,
xa_mk_value(j), GFP_KERNEL);
}
mtree_destroy(&tree);
rcu_barrier();
}
return 0;
}
The splat for the first issue addressed by the first patch is shown below.
mt_clear_meta() runs after the slots have been rewritten with raw
pointers by mte_dead_leaves(), so it cannot recognize a valid last pointer
because the type information is stripped. On my 64-bit LE machine, it
clears bytes 248 and 249 of the maple_range_64 which are the two least
significant bytes of the last pointer. The lowest byte is already zero,
since nodes are 256-byte aligned, but zeroing byte 249 corrupts the
pointer.
KASAN catches it as a double-free, because that corrupted pointer happens
to land on a node that was freed previously. The splat appears at 226
insertions in the reproducer. This is when the tree has a full root node
on a 64-bit build.
==================================================================
BUG: KASAN: double-free in mt_free_walk+0x138/0x3a0
Free of addr ffff0000f3d40000 by task swapper/2/0
[...]
Call trace:
[...]
kmem_cache_free_bulk+0x5b8/0xc18
mt_free_walk+0x138/0x3a0
rcu_core+0x5d0/0x1638
rcu_core_si+0x18/0x30
[...]
Allocated by task 1218:
[...]
kmem_cache_alloc_from_sheaf_noprof+0xa8/0x2f0
dst_setup+0x210/0x630
mas_wr_split+0x568/0x26e0
mas_wr_store_entry+0x98c/0x1de0
mas_insert.isra.0+0x3d0/0x5d8
mtree_insert_range+0xec/0x1c8
maple_fix_init+0x94/0xff8 [maple_fix_obj]
[...]
Freed by task 0:
[...]
__kasan_slab_free+0x88/0xb8
__rcu_free_sheaf_prepare+0x94/0x360
rcu_free_sheaf+0x30/0x138
rcu_core+0x5d0/0x1638
rcu_core_si+0x18/0x30
[...]
The buggy address belongs to the object at ffff0000f3d40000
which belongs to the cache maple_node of size 256
The buggy address is located 0 bytes inside of
256-byte region [ffff0000f3d40000, ffff0000f3d40100)
[...]
Memory state around the buggy address:
ffff0000f3d3ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000f3d3ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000f3d40000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000f3d40080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000f3d40100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
The second issue fixed in the first patch is in the mt_free_walk().
mt_free_walk() descends by checking if the corresponding slot[offset]
entry is non-zero. In a maple_range_64 node that has
MAPLE_RANGE64_SLOTS-1 valid pointers to child nodes, all slots will be
non-zero, since the last slot holds the metadata. Thus, mte_dead_walk()
dereferences the metadata as if it were a node and hits the
null-ptr-deref as shown in the splat below.
After fixing the first issue, the reproducer reaches this case at 3166
insertions. The affected node is the root on a tree with height 3 and it
has 15 valid child nodes on a 64-bit machine. The first fix does not
introduce this bug, but it exposes it for the root node because it no
longer clears the root metadata. On an unmodified kernel, the same bug
exists and is reachable when such a maple_range_64 node appears below
the root, where mt_clear_meta() is not called.
Second KASAN splat:
Unable to handle kernel paging request at virtual address dfff800000000006
KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
[...]
Call trace:
mte_dead_walk+0x78/0x140 (P)
mt_free_walk+0x1f8/0x3a0
rcu_core+0x5d0/0x1638
rcu_core_si+0x18/0x30
[..]
Both splats are from an arm64 QEMU guest. The test_maple_tree and the
userspace suite pass after each patch in the series.
This patch (of 2):
This commit fixes two issues in maple_range_64 nodes under RCU mode. A
maple_range_64 node repurposes its last slot to hold metadata whenever
the node is not full. Both issues arise from mishandling that last slot.
More specifically the two fixes are:
1. Remove mt_clear_meta() function. mt_clear_meta() decides whether the
last slot of a maple_range_64 node holds a child pointer or a
struct maple_metadata with the check
if (unlikely((mte_to_node(next) &&
mte_node_type(next))))
return; /* no metadata, could be node */
The check expects the pointer to be encoded. But the only callsite
of mt_clear_meta() is mt_destroy_walk() on the RCU destroy path, and
by the time it runs, mte_dead_leaves() has overwritten every slot on
a full node with a raw pointer, stripping the type information. Thus,
the check above never returns early for a full node as it should. It
falls through and then:
meta->gap = 0;
meta->end = 0;
zeroes two bytes of a valid child pointer. Later, mt_free_walk()
dereferences the corrupted pointer.
Fix this by removing mt_clear_meta() along with its only callsite.
mt_clear_meta() is only called for the root of each sub-tree destroyed
under RCU. Descendant nodes retain their metadata until they are
freed. RCU readers may use the metadata while traversing a node, but
do not use cleared metadata to detect that a node has been removed.
They detect a dead node via ma_dead_node().
2. Fix invalid memory access in mt_free_walk(). mt_free_walk() descends
to the left-most unvisited "parent-of-a-leaf" node by checking the
condition:
if ((offset < mt_slots[type]) &&
rcu_dereference_protected(slots[offset],
lock_is_held(&rcu_callback_map)))
slots = mte_dead_walk(&enode, offset);
On a maple_range_64 node with MAPLE_RANGE64_SLOTS-1 children *all*
slots are non-NULL. The first MAPLE_RANGE64_SLOTS-1 hold valid
pointers to child nodes, and the last slot contains metadata. The
above check therefore passes for all offsets, and mte_dead_walk()
dereferences the metadata as if it were a node.
To trigger this, a node at least two levels above the leaves has to
have exactly MAPLE_RANGE64_SLOTS-1 valid pointers to other nodes.
maple_arange_64 nodes cannot hit this since they store the metadata
in a separate field.
Fix this by bounding the descent with slot_len which holds the number
of children of a dead node.
Link: https://lore.kernel.org/20261005-fix-maple-tree-range64-rcu-v3-0-ebe7fb278e20@cslab.ece.ntua.gr
Link: https://lore.kernel.org/20261005-fix-maple-tree-range64-rcu-v3-1-ebe7fb278e20@cslab.ece.ntua.gr
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Fixes: 2e5b4921f8ef ("maple_tree: fix freeing of nodes in rcu mode")
Signed-off-by: Dimitris Charisis <dchar@cslab.ece.ntua.gr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Liam R. Howlett (Google) <liam@infradead.org>
Reviewed-by: Florian Schmaus <florian.schmaus@codasip.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
[ sashal: Dropped the mt_clear_meta() function (including its stale extra kerneldoc lines) and kept the existing mt_free_rcu(&node->rcu) in free_leaf instead of upstream's kfree(node). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/maple_tree.c | 45 +--------------------------------------------
1 file changed, 1 insertion(+), 44 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 958a610b70cac..9855fa96be34c 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -903,45 +903,6 @@ static inline void ma_set_meta(struct maple_node *mn, enum maple_type mt,
meta->end = end;
}
-/*
- * mt_clear_meta() - clear the metadata information of a node, if it exists
- * @mt: The maple tree
- * @mn: The maple node
- * @type: The maple node type
- * @offset: The offset of the highest sub-gap in this node.
- * @end: The end of the data in this node.
- */
-static inline void mt_clear_meta(struct maple_tree *mt, struct maple_node *mn,
- enum maple_type type)
-{
- struct maple_metadata *meta;
- unsigned long *pivots;
- void __rcu **slots;
- void *next;
-
- switch (type) {
- case maple_range_64:
- pivots = mn->mr64.pivot;
- if (unlikely(pivots[MAPLE_RANGE64_SLOTS - 2])) {
- slots = mn->mr64.slot;
- next = mt_slot_locked(mt, slots,
- MAPLE_RANGE64_SLOTS - 1);
- if (unlikely((mte_to_node(next) &&
- mte_node_type(next))))
- return; /* no metadata, could be node */
- }
- fallthrough;
- case maple_arange_64:
- meta = ma_meta(mn, type);
- break;
- default:
- return;
- }
-
- meta->gap = 0;
- meta->end = 0;
-}
-
/*
* ma_meta_end() - Get the data end of a node from the metadata
* @mn: The maple node
@@ -5569,9 +5530,7 @@ static void mt_free_walk(struct rcu_head *head)
type = mte_node_type(enode);
slots = ma_slots(mte_to_node(enode), type);
- if ((offset < mt_slots[type]) &&
- rcu_dereference_protected(slots[offset],
- lock_is_held(&rcu_callback_map)))
+ if (offset < mte_to_node(enode)->slot_len)
slots = mte_dead_walk(&enode, offset);
node = mte_to_node(enode);
} while ((node != start) || (node->slot_len < offset));
@@ -5665,8 +5624,6 @@ static void mt_destroy_walk(struct maple_enode *enode, struct maple_tree *mt,
free_leaf:
if (free)
mt_free_rcu(&node->rcu);
- else
- mt_clear_meta(mt, node, node->type);
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0439/1059] ceph: wait for pending fscache write in write_folio_nounlock()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (437 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0438/1059] maple_tree: fix maple_range_64 crashes in RCU mode Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0440/1059] gtp: hold RCU in gtp_genl_send_echo_req() Greg Kroah-Hartman
` (559 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tal Zussman, Alex Markuze,
Ilya Dryomov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tal Zussman <tz2294@columbia.edu>
[ Upstream commit 3f7655f0d9186656c6f1cbc012a39c866d4aaabf ]
write_folio_nounlock() marks the folio with PG_private_2 via
ceph_set_page_fscache() and starts an async write to the cache via
ceph_fscache_write_to_cache(). PG_private_2 is only cleared once that
write completes.
If the OSD write fails, the error paths return without waiting for the
cache write. On retry, ceph_find_incompatible() would wait for
writeback, but not for PG_private_2, before calling
write_folio_nounlock() again, which would trip the VM_BUG_ON_FOLIO() in
folio_start_private_2().
Wait for any pending cache write before starting writeback on the
folio. Do so before bumping the writeback congestion count and
allocating the possibly mempool-backed OSD request, so that a thread
sleeping on the cache I/O does not hold either while it waits.
Add ceph_folio_wait_fscache(), a wrapper for folio_wait_private_2(), and
use it.
Fixes: 1702e7973410 ("ceph: add fscache writeback support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260804-remove-wait-on-page-writeback-v2-0-81f0ab065284%40columbia.edu?part=7
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
[ sashal: Added a ceph_folio_wait_fscache() wrapper and stub, and placed the call in the older writepage_nounlock() with dout() macros, keeping the extra was_async argument in ceph_fscache_write_terminated(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ceph/addr.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 11bbcda371124..0e5fa2617c6cc 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -479,6 +479,11 @@ static void ceph_set_page_fscache(struct page *page)
set_page_fscache(page);
}
+static void ceph_folio_wait_fscache(struct folio *folio)
+{
+ folio_wait_private_2(folio); /* [DEPRECATED] */
+}
+
static void ceph_fscache_write_terminated(void *priv, ssize_t error, bool was_async)
{
struct inode *inode = priv;
@@ -500,6 +505,10 @@ static inline void ceph_set_page_fscache(struct page *page)
{
}
+static inline void ceph_folio_wait_fscache(struct folio *folio)
+{
+}
+
static inline void ceph_fscache_write_to_cache(struct inode *inode, u64 off, u64 len, bool caching)
{
}
@@ -660,6 +669,9 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
dout("writepage %p page %p index %lu on %llu~%llu snapc %p seq %lld\n",
inode, page, page->index, page_off, len, snapc, snapc->seq);
+ /* wait for a cache write left pending by a previously failed attempt */
+ ceph_folio_wait_fscache(folio);
+
if (atomic_long_inc_return(&fsc->writeback_count) >
CONGESTION_ON_THRESH(fsc->mount_options->congestion_kb))
fsc->write_congested = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0440/1059] gtp: hold RCU in gtp_genl_send_echo_req()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (438 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0439/1059] ceph: wait for pending fscache write in write_folio_nounlock() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0441/1059] net/rds: do not fail init when CONFIG_SYSCTL=n Greg Kroah-Hartman
` (558 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paolo Abeni, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <pabeni@redhat.com>
[ Upstream commit a204e9c001dfafe83cac01b16508b1cf5c953355 ]
Such function is invoked in process context, performs an RCU device
lookup and dereference the found device with no additional protection.
=============================
WARNING: suspicious RCU usage
7.3.0-virtme #7 Not tainted
-----------------------------
net/core/dev.c:1047 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by python3/233: 2, last CPU#5:
#0: ffffffffbab93268 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40
#1: ffffffffbab93320 (genl_mutex){+.+.}-{4:4}, at:
genl_rcv_msg+0x12c/0x160
stack backtrace:
CPU: 5 UID: 0 PID: 233 Comm: python3 Not tainted 7.3.0#7 PREEMPT(full)
Hardware name: Bochs, BIOS Bochs 01/01/2011
Call Trace:
<TASK>
dump_stack_lvl+0x6f/0xb0
lockdep_rcu_suspicious.cold+0x37/0x8e
dev_get_by_index_rcu+0x135/0x180
gtp_find_dev+0xe7/0x360 [gtp]
gtp_genl_send_echo_req+0x298/0xb30 [gtp]
genl_family_rcv_msg_doit+0x20f/0x310
genl_family_rcv_msg+0x3a8/0x640
genl_rcv_msg+0xbb/0x160
netlink_rcv_skb+0x154/0x3a0
genl_rcv+0x28/0x40
netlink_unicast+0x54b/0x860
netlink_sendmsg+0x7fb/0xf60
__sys_sendto+0x3d6/0x450
__x64_sys_sendto+0xe4/0x1f0
do_syscall_64+0xff/0x530
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ffa43b0256e
Code: 4d 89 d8 e8 d4 bd 00 00 4c 8b 5d f8 41 8b 93 08 03 00 00 59 5e 48 83
f8 fc 74 11 c9 c3 0f 1f 80 00 00 00 00 48 8b 45 10 0f 05 <c9> c3 83 e2 39
83 fa 08 75 e7 e8 03 ff ff ff 0f 1f 00 f3 0f 1e fa
RSP: 002b:00007ffd3b8828d0 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007ffd3b8829e0 RCX: 00007ffa43b0256e
RDX: 0000000000000034 RSI: 00007ffa3519d0d0 RDI: 0000000000000006
RBP: 00007ffd3b8828e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffa351cc0c0
R13: 00007ffd3b8829e0 R14: 00007ffa354ca130 R15: 00007ffa4433d498
</TASK>
Add the missing RCU guards and keep it for the whole function body,
while the RCU-protected device is used.
Found by code inspection, validated explicitly testing the relevant
code path.
Fixes: d33bd757d362 ("gtp: Implement GTP echo request")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Link: https://patch.msgid.link/ed27d133fe73afd377d3fa4e553c34e7987b6dd9.1792744478.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Kept the local udp_tunnel_xmit_skb() call without local_bh_* and the extra argument, and added only the unlock: tail after it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/gtp.c | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 0303f24815a1b..94f4be527e539 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -1760,9 +1760,9 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
struct gtp_dev *gtp;
struct flowi4 fl4;
struct rtable *rt;
+ int len, ret = 0;
struct sock *sk;
__be16 port;
- int len;
if (!info->attrs[GTPA_VERSION] ||
!info->attrs[GTPA_LINK] ||
@@ -1774,14 +1774,21 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
dst_ip = nla_get_be32(info->attrs[GTPA_PEER_ADDRESS]);
src_ip = nla_get_be32(info->attrs[GTPA_MS_ADDRESS]);
+ rcu_read_lock();
gtp = gtp_find_dev(sock_net(skb->sk), info->attrs);
- if (!gtp)
- return -ENODEV;
+ if (!gtp) {
+ ret = -ENODEV;
+ goto unlock;
+ }
- if (!gtp->sk_created)
- return -EOPNOTSUPP;
- if (!(gtp->dev->flags & IFF_UP))
- return -ENETDOWN;
+ if (!gtp->sk_created) {
+ ret = -EOPNOTSUPP;
+ goto unlock;
+ }
+ if (!(gtp->dev->flags & IFF_UP)) {
+ ret = -ENETDOWN;
+ goto unlock;
+ }
if (version == GTP_V0) {
struct gtp0_header *gtp0_h;
@@ -1790,8 +1797,10 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
sizeof(struct iphdr) + sizeof(struct udphdr);
skb_to_send = netdev_alloc_skb_ip_align(gtp->dev, len);
- if (!skb_to_send)
- return -ENOMEM;
+ if (!skb_to_send) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
sk = gtp->sk0;
port = htons(GTP0_PORT);
@@ -1807,8 +1816,10 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
sizeof(struct iphdr) + sizeof(struct udphdr);
skb_to_send = netdev_alloc_skb_ip_align(gtp->dev, len);
- if (!skb_to_send)
- return -ENOMEM;
+ if (!skb_to_send) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
sk = gtp->sk1u;
port = htons(GTP1U_PORT);
@@ -1818,7 +1829,8 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
memset(gtp1u_h, 0, sizeof(struct gtp1_header_long));
gtp1u_build_echo_msg(gtp1u_h, GTP_ECHO_REQ);
} else {
- return -ENODEV;
+ ret = -ENODEV;
+ goto unlock;
}
rt = ip4_route_output_gtp(&fl4, sk, dst_ip, src_ip);
@@ -1826,7 +1838,8 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
netdev_dbg(gtp->dev, "no route for echo request to %pI4\n",
&dst_ip);
kfree_skb(skb_to_send);
- return -ENODEV;
+ ret = -ENODEV;
+ goto unlock;
}
udp_tunnel_xmit_skb(rt, sk, skb_to_send,
@@ -1838,7 +1851,10 @@ static int gtp_genl_send_echo_req(struct sk_buff *skb, struct genl_info *info)
!net_eq(sock_net(sk),
dev_net(gtp->dev)),
false);
- return 0;
+
+unlock:
+ rcu_read_unlock();
+ return ret;
}
static const struct nla_policy gtp_genl_policy[GTPA_MAX + 1] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0441/1059] net/rds: do not fail init when CONFIG_SYSCTL=n
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (439 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0440/1059] gtp: hold RCU in gtp_genl_send_echo_req() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0442/1059] devlink: region: fix snapshot id leak on kernel-allocated ids Greg Kroah-Hartman
` (557 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Joel Granados,
Allison Henderson, Oleg Nesterov, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <achender@kernel.org>
[ Upstream commit fbea154a86641d2543a871aa19f7c77a366de542 ]
With CONFIG_SYSCTL=n, register_net_sysctl() and register_net_sysctl_sz()
are inline stubs that return NULL. rds_sysctl_init(),
rds_ib_sysctl_init() and rds_tcp_init_net() all treat that NULL as
-ENOMEM, so RDS refuses to initialize at all even though every tunable
has a sane compiled-in default.
When RDS is built in, that is worse than a missing feature: the failed
rds_init() destroys rds_wq, but the rds_rdma initcall still runs, and
when rds_ib_sysctl_init() fails the same way, the error path in
rds_ib_init() flushes the already freed workqueue:
BUG: KASAN: slab-use-after-free in touch_wq_lockdep_map
...
__flush_workqueue
rds_ib_init
rds_rdma_init
...
Allocated by task 1:
alloc_workqueue_noprof
rds_threads_init
rds_init
...
Freed by task 0:
kfree
rcu_do_batch
Only treat the NULL return as a failure when sysctl support is actually
compiled in. The exit paths need no change: unregister_net_sysctl_table()
is an empty stub with CONFIG_SYSCTL=n and already tolerates a NULL header
otherwise.
The underlying problem of built-in transports initializing after
rds_init() has failed is independent of sysctl and is addressed
separately.
Reported-by: kernel test robot <yi1.lai@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202610190310.9737b2e3-lkp@intel.com
Fixes: 3e5048495c85 ("RDS: sysctls")
Fixes: e6babe4cc4ce ("RDS/IB: Stats and sysctls")
Fixes: c6a58ffed536 ("RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket")
Suggested-by: Joel Granados <joel.granados@kernel.org>
Signed-off-by: Allison Henderson <achender@kernel.org>
Reviewed-by: Joel Granados <joel.granados@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Link: https://patch.msgid.link/20261021195837.142802-2-achender@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Kept the existing register_net_sysctl() call in tcp.c context, since register_net_sysctl_sz() doesn't exist here, and changed only the if condition. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/rds/ib_sysctl.c | 2 +-
net/rds/sysctl.c | 2 +-
net/rds/tcp.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
index e4e41b3afce71..e957c4317df97 100644
--- a/net/rds/ib_sysctl.c
+++ b/net/rds/ib_sysctl.c
@@ -115,7 +115,7 @@ void rds_ib_sysctl_exit(void)
int rds_ib_sysctl_init(void)
{
rds_ib_sysctl_hdr = register_net_sysctl(&init_net, "net/rds/ib", rds_ib_sysctl_table);
- if (!rds_ib_sysctl_hdr)
+ if (!rds_ib_sysctl_hdr && IS_ENABLED(CONFIG_SYSCTL))
return -ENOMEM;
return 0;
}
diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
index e381bbcd9cc1c..271113373bad1 100644
--- a/net/rds/sysctl.c
+++ b/net/rds/sysctl.c
@@ -104,7 +104,7 @@ int rds_sysctl_init(void)
rds_sysctl_reg_table =
register_net_sysctl(&init_net, "net/rds", rds_sysctl_rds_table);
- if (!rds_sysctl_reg_table)
+ if (!rds_sysctl_reg_table && IS_ENABLED(CONFIG_SYSCTL))
return -ENOMEM;
return 0;
}
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 495fce3f7e459..fa04f71c9050c 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -644,7 +644,7 @@ static __net_init int rds_tcp_init_net(struct net *net)
tbl[RDS_TCP_SNDBUF].data = &rtn->sndbuf_size;
tbl[RDS_TCP_RCVBUF].data = &rtn->rcvbuf_size;
rtn->rds_tcp_sysctl = register_net_sysctl(net, "net/rds/tcp", tbl);
- if (!rtn->rds_tcp_sysctl) {
+ if (!rtn->rds_tcp_sysctl && IS_ENABLED(CONFIG_SYSCTL)) {
pr_warn("could not register sysctl\n");
err = -ENOMEM;
goto fail;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0442/1059] devlink: region: fix snapshot id leak on kernel-allocated ids
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (440 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0441/1059] net/rds: do not fail init when CONFIG_SYSCTL=n Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0443/1059] tls: keep TX and RX hardware offload on the same device Greg Kroah-Hartman
` (556 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guikun Yang,
Fernando Fernandez Mancera, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <fmancera@suse.de>
[ Upstream commit ef8f0a1d888e0280452792f6d4edad237c934a51 ]
When DEVLINK_CMD_REGION_NEW is issued without a snapshot id, the kernel
allocates one with __devlink_region_snapshot_id_get(). That helper counts
the caller as a user of the id, and the caller must release this hold
once it is done.
devlink_nl_region_new_doit() never drops it. The refcount of the id goes
1 (allocation) -> 2 (snapshot created) and stays at 2. When the snapshot
is deleted the count only drops to 1, so the id is never erased from
the snapshot_ids xarray. The id then stays in use for the lifetime of
the devlink instance: requesting a snapshot with that explicit id fails
with -EEXIST, and there is no snapshot left to delete to clean it up.
Reproducer steps:
# devlink region new pci/0000:13:00.0/device-caps
pci/0000:13:00.0/device-caps: snapshot 0
# devlink region del pci/0000:13:00.0/device-caps snapshot 0
# devlink region new pci/0000:13:00.0/device-caps snapshot 0
kernel answers: File exists
Drop the caller's reference right after the snapshot has been created,
as the snapshot then holds its own.
Fixes: 043b3e22768d ("devlink: let kernel allocate region snapshot id")
Reported-by: Guikun Yang <yangguikun19@qq.com>
Closes: https://lore.kernel.org/netdev/tencent_BE912BA710539F285F9FCF28E854ABEFCD07@qq.com/
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20261026174403.512-1-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Applied the hunk to devlink_nl_cmd_region_new() in leftover.c, since this tree has no region.c and devlink_nl_region_new_doit() under its newer name. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/devlink/leftover.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index 568e4efd8868a..7f526cbe0d33d 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -6310,6 +6310,11 @@ devlink_nl_cmd_region_new(struct sk_buff *skb, struct genl_info *info)
if (!snapshot_id_attr) {
struct sk_buff *msg;
+ /* Drop the allocation reference, the snapshot
+ * now holds its own.
+ */
+ __devlink_snapshot_id_decrement(devlink, snapshot_id);
+
snapshot = devlink_region_snapshot_get_by_id(region,
snapshot_id);
if (WARN_ON(!snapshot)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0443/1059] tls: keep TX and RX hardware offload on the same device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (441 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0442/1059] devlink: region: fix snapshot id leak on kernel-allocated ids Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0444/1059] ksmbd: return complete and aligned stream information Greg Kroah-Hartman
` (555 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rishikesh Jethwani, Dave Miller,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rishikesh Jethwani <rjethwani@purestorage.com>
[ Upstream commit 1c8a70075235cd733095532a97f2405037c52a7b ]
After TX is offloaded on device A, a route change, or a change in the
usable-slave set of an 802.3ad or balance-xor (layer3+4) bond, can make
RX setup program device B. tls_device_attach() sees the existing TLS
destructor and keeps ctx->netdev pointing at A. The RX driver state on B
is then untracked: tls_dev_resync() and tls_dev_del() are invoked on A
for a context it never created, and neither socket close nor
NETDEV_DOWN on B calls tls_dev_del() for B, so the driver context leaks.
The reverse setup order has the same problem.
Check the shared device binding under device_offload_lock before each
tls_dev_add(). Permit the first attachment and a second direction on the
same device. Reject a different device, including when the old binding
was cleared by NETDEV_DOWN: the TLS destructor remains installed and
tls_device_attach() cannot establish a new binding. Setup then falls
back to software for the requested direction.
The RX check precedes allocation and software setup. TX uses its existing
resource unwind path without calling the driver. Document the shared
binding and clarify that fallback is per direction.
This issue was discovered during code review and subsequently
reproduced on hardware using mlx5 and TLS 1.2 AES-GCM-128.
Changing the route between TX and RX setup installed the second
direction on a different device. Driver traces showed successful adds
on both devices, but both deletes at socket close targeted the first
device, leaving an orphaned context on the second. Both setup orders
reproduced the leak, even though all current core TLS context counters
returned to zero. No crash was observed.
With the fix, the same tests correctly fall back to software for the
second direction and leave no orphaned hardware context.
Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload")
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
[ sashal: Replaced kzalloc_obj(*context) with this tree's kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_RX, GFP_KERNEL) in the RX offload setup, with the new attach check placed just before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/networking/tls-offload.rst | 16 ++++++++++------
net/tls/tls_device.c | 24 ++++++++++++++++++++++++
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/tls-offload.rst b/Documentation/networking/tls-offload.rst
index 5f0dea3d571e3..371cbd2824c65 100644
--- a/Documentation/networking/tls-offload.rst
+++ b/Documentation/networking/tls-offload.rst
@@ -76,12 +76,16 @@ During driver initialization device sets the ``NETIF_F_HW_TLS_RX`` and
pointer in the :c:member:`tlsdev_ops` member of the
:c:type:`struct net_device <net_device>`.
-When TLS cryptographic connection state is installed on a ``ktls`` socket
-(note that it is done twice, once for RX and once for TX direction,
-and the two are completely independent), the kernel checks if the underlying
-network device is offload-capable and attempts the offload. In case offload
-fails the connection is handled entirely in software using the same mechanism
-as if the offload was never tried.
+TLS cryptographic connection state is installed separately for RX and TX
+on a ``ktls`` socket. For each direction, the kernel checks if the underlying
+network device is offload-capable and attempts the offload. If offload fails,
+that direction is handled in software as if offload had never been tried.
+
+Both hardware directions share one device binding. Once one direction is
+offloaded, the other direction must use the same device. If a route change
+selects a different device, or ``NETDEV_DOWN`` has cleared the binding,
+hardware offload of the other direction is declined and it uses software
+instead.
Offload request is performed via the :c:member:`tls_dev_add` callback of
:c:type:`struct tlsdev_ops <tlsdev_ops>`:
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index f03920c17711f..e4f79fe1cbfe8 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1052,6 +1052,20 @@ int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx)
return tls_device_reencrypt(sk, tls_ctx);
}
+/* Both directions share ctx->netdev. A second direction must use that
+ * device; after NETDEV_DOWN clears it, no new direction can be offloaded.
+ */
+static bool tls_device_can_attach(struct tls_context *ctx, struct sock *sk,
+ struct net_device *netdev)
+{
+ struct net_device *ctx_netdev;
+
+ ctx_netdev = rcu_dereference_protected(ctx->netdev,
+ lockdep_is_held(&device_offload_lock));
+ return sk->sk_destruct != tls_device_sk_destruct ||
+ ctx_netdev == netdev;
+}
+
static void tls_device_attach(struct tls_context *ctx, struct sock *sk,
struct net_device *netdev)
{
@@ -1208,6 +1222,11 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
goto release_lock;
}
+ if (!tls_device_can_attach(ctx, sk, netdev)) {
+ rc = -EOPNOTSUPP;
+ goto release_lock;
+ }
+
ctx->priv_ctx_tx = offload_ctx;
rc = netdev->tlsdev_ops->tls_dev_add(netdev, sk, TLS_OFFLOAD_CTX_DIR_TX,
&ctx->crypto_send.info,
@@ -1282,6 +1301,11 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
goto release_lock;
}
+ if (!tls_device_can_attach(ctx, sk, netdev)) {
+ rc = -EOPNOTSUPP;
+ goto release_lock;
+ }
+
context = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_RX, GFP_KERNEL);
if (!context) {
rc = -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0444/1059] ksmbd: return complete and aligned stream information
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (442 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0443/1059] tls: keep TX and RX hardware offload on the same device Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0445/1059] blk-cgroup: dont free a blkg with its punt work queued Greg Kroah-Hartman
` (554 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 206fc30f71b005156085fd8523ccc84a2c67791b ]
FILE_STREAM_INFORMATION responses are assembled without aligning entries
and truncated to the client buffer length after the fact. A short query
can therefore return STATUS_BUFFER_OVERFLOW with an incomplete entry and
a nonzero NextEntryOffset, which clients may reject as an invalid
network response. Standalone queries can also exhaust the server
response buffer and silently omit streams while reporting success.
Allocate the same large response buffer used by other variable-length
QUERY_INFO classes for stream queries. Pack only complete entries within
the requested output length and available response space, aligning each
entry to eight bytes and sizing names after UTF-16 conversion. Return
STATUS_BUFFER_OVERFLOW when more entries remain, using an SMB2 error
response if no entry fits.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Fixes: 6b8b79226bc3 ("ksmbd: fix partial file information responses")
Link: https://github.com/namjaejeon/ksmbd/issues/522#issuecomment-6391152923
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Adapted to the older tree: GFP_KERNEL replaces KSMBD_DEFAULT_GFP, generic_fillattr replaces vfs_getattr, normalized-name class dropped, and stream size stays the name length. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 185 +++++++++++++++++++++++++---------------
1 file changed, 118 insertions(+), 67 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index a87f10c1e760b..70150e016e6f7 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -554,7 +554,8 @@ int smb2_allocate_rsp_buf(struct ksmbd_work *work)
req = smb_get_msg(work->request_buf);
if ((req->InfoType == SMB2_O_INFO_FILE &&
(req->FileInfoClass == FILE_FULL_EA_INFORMATION ||
- req->FileInfoClass == FILE_ALL_INFORMATION)) ||
+ req->FileInfoClass == FILE_ALL_INFORMATION ||
+ req->FileInfoClass == FILE_STREAM_INFORMATION)) ||
req->InfoType == SMB2_O_INFO_SECURITY)
sz = large_sz;
}
@@ -4843,38 +4844,103 @@ static void get_file_alternate_info(struct ksmbd_work *work,
cpu_to_le32(sizeof(struct smb2_file_alt_name_info) + conv_len);
}
-static void get_file_stream_info(struct ksmbd_work *work,
- struct smb2_query_info_rsp *rsp,
- struct ksmbd_file *fp,
- void *rsp_org)
+struct smb2_stream_info_buffer {
+ struct smb2_query_info_rsp *rsp;
+ struct smb2_file_stream_info *last;
+ const struct nls_table *local_nls;
+ unsigned int length;
+ unsigned int capacity;
+};
+
+static int smb2_add_stream_info(struct smb2_stream_info_buffer *buf,
+ const char *name, loff_t size, u64 allocation_size)
{
- struct ksmbd_conn *conn = work->conn;
struct smb2_file_stream_info *file_info;
+ __le16 *utf16_name;
+ size_t name_len = strlen(name);
+ unsigned int offset = ALIGN(buf->length, 8), name_bytes;
+ int conv_len, ret = 0;
+
+ if (offset > buf->capacity ||
+ buf->capacity - offset < sizeof(*file_info))
+ return -ENOSPC;
+
+ utf16_name = kmalloc_array(name_len + 1, sizeof(*utf16_name),
+ GFP_KERNEL);
+ if (!utf16_name)
+ return -ENOMEM;
+
+ conv_len = smbConvertToUTF16(utf16_name, name, name_len,
+ buf->local_nls, 0);
+ if (conv_len < 0) {
+ ret = conv_len;
+ goto out;
+ }
+
+ name_bytes = conv_len * sizeof(*utf16_name);
+ if (name_bytes > buf->capacity - offset - sizeof(*file_info)) {
+ ret = -ENOSPC;
+ goto out;
+ }
+
+ file_info = (struct smb2_file_stream_info *)&buf->rsp->Buffer[offset];
+ if (buf->last) {
+ memset(&buf->rsp->Buffer[buf->length], 0, offset - buf->length);
+ buf->last->NextEntryOffset =
+ cpu_to_le32((char *)file_info - (char *)buf->last);
+ }
+ file_info->NextEntryOffset = 0;
+ file_info->StreamNameLength = cpu_to_le32(name_bytes);
+ file_info->StreamSize = cpu_to_le64(size);
+ file_info->StreamAllocationSize = cpu_to_le64(allocation_size);
+ memcpy(file_info->StreamName, utf16_name, name_bytes);
+
+ buf->last = file_info;
+ buf->length = offset + sizeof(*file_info) + name_bytes;
+out:
+ kfree(utf16_name);
+ return ret;
+}
+
+static int get_file_stream_info(struct ksmbd_work *work,
+ struct smb2_query_info_req *req,
+ struct smb2_query_info_rsp *rsp,
+ struct ksmbd_file *fp)
+{
+ struct smb2_stream_info_buffer buf = {
+ .rsp = rsp,
+ .local_nls = work->conn->local_nls,
+ };
char *stream_name, *xattr_list = NULL, *stream_buf;
struct kstat stat;
const struct path *path = &fp->filp->f_path;
ssize_t xattr_list_len;
- int nbytes = 0, streamlen, stream_name_len, next, idx = 0;
+ unsigned int req_output_len = le32_to_cpu(req->OutputBufferLength);
+ int streamlen, stream_name_len, idx = 0;
int buf_free_len;
- struct smb2_query_info_req *req = ksmbd_req_buf_next(work);
+ int ret;
- generic_fillattr(file_mnt_user_ns(fp->filp), file_inode(fp->filp),
- &stat);
- file_info = (struct smb2_file_stream_info *)rsp->Buffer;
+ if (req_output_len < FILE_STREAM_INFORMATION_SIZE) {
+ rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
+ return -EINVAL;
+ }
- buf_free_len =
- smb2_calc_max_out_buf_len(work,
- offsetof(struct smb2_query_info_rsp, Buffer),
- le32_to_cpu(req->OutputBufferLength));
+ buf_free_len = smb2_calc_max_out_buf_len(work,
+ offsetof(struct smb2_query_info_rsp, Buffer),
+ req_output_len);
if (buf_free_len < 0)
- goto out;
+ return buf_free_len;
+ buf.capacity = buf_free_len;
+
+ generic_fillattr(file_mnt_user_ns(fp->filp), file_inode(fp->filp),
+ &stat);
xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
if (xattr_list_len < 0) {
- goto out;
+ goto default_stream;
} else if (!xattr_list_len) {
ksmbd_debug(SMB, "empty xattr in the file\n");
- goto out;
+ goto default_stream;
}
while (idx < xattr_list_len) {
@@ -4884,64 +4950,49 @@ static void get_file_stream_info(struct ksmbd_work *work,
ksmbd_debug(SMB, "%s, len %d\n", stream_name, streamlen);
- if (strncmp(&stream_name[XATTR_USER_PREFIX_LEN],
- STREAM_PREFIX, STREAM_PREFIX_LEN))
+ if (strncmp(stream_name, XATTR_NAME_STREAM,
+ XATTR_NAME_STREAM_LEN))
continue;
- stream_name_len = streamlen - (XATTR_USER_PREFIX_LEN +
- STREAM_PREFIX_LEN);
- streamlen = stream_name_len;
-
- /* plus : size */
- streamlen += 1;
- stream_buf = kmalloc(streamlen + 1, GFP_KERNEL);
- if (!stream_buf)
- break;
-
- streamlen = snprintf(stream_buf, streamlen + 1,
- ":%s", &stream_name[XATTR_NAME_STREAM_LEN]);
+ stream_name_len = streamlen - XATTR_NAME_STREAM_LEN;
- next = sizeof(struct smb2_file_stream_info) + streamlen * 2;
- /* smbConvertToUTF16() also writes a terminating UTF-16 unit. */
- if (next + sizeof(__le16) > buf_free_len) {
- kfree(stream_buf);
- break;
+ stream_buf = kasprintf(GFP_KERNEL, ":%s",
+ &stream_name[XATTR_NAME_STREAM_LEN]);
+ if (!stream_buf) {
+ ret = -ENOMEM;
+ goto out;
}
-
- file_info = (struct smb2_file_stream_info *)&rsp->Buffer[nbytes];
- streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
- stream_buf, streamlen,
- conn->local_nls, 0);
- streamlen *= 2;
+ ret = smb2_add_stream_info(&buf, stream_buf, stream_name_len,
+ stream_name_len);
kfree(stream_buf);
- file_info->StreamNameLength = cpu_to_le32(streamlen);
- file_info->StreamSize = cpu_to_le64(stream_name_len);
- file_info->StreamAllocationSize = cpu_to_le64(stream_name_len);
+ if (ret == -ENOSPC)
+ goto overflow;
+ if (ret)
+ goto out;
+ }
- nbytes += next;
- buf_free_len -= next;
- file_info->NextEntryOffset = cpu_to_le32(next);
+default_stream:
+ if (!S_ISDIR(stat.mode)) {
+ ret = smb2_add_stream_info(&buf, "::$DATA", stat.size,
+ stat.blocks << 9);
+ if (ret == -ENOSPC)
+ goto overflow;
+ if (ret)
+ goto out;
}
+ ret = 0;
+ goto out;
+
+overflow:
+ rsp->hdr.Status = STATUS_BUFFER_OVERFLOW;
+ /* An empty overflow needs an SMB2 error response. */
+ ret = buf.length ? 0 : -EOVERFLOW;
out:
- if (!S_ISDIR(stat.mode) &&
- buf_free_len >= sizeof(struct smb2_file_stream_info) + (7 + 1) * 2) {
- file_info = (struct smb2_file_stream_info *)
- &rsp->Buffer[nbytes];
- streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
- "::$DATA", 7, conn->local_nls, 0);
- streamlen *= 2;
- file_info->StreamNameLength = cpu_to_le32(streamlen);
- file_info->StreamSize = cpu_to_le64(stat.size);
- file_info->StreamAllocationSize = cpu_to_le64(stat.blocks << 9);
- nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
- }
-
- /* last entry offset should be 0 */
- file_info->NextEntryOffset = 0;
+ if (!ret)
+ rsp->OutputBufferLength = cpu_to_le32(buf.length);
kvfree(xattr_list);
-
- rsp->OutputBufferLength = cpu_to_le32(nbytes);
+ return ret;
}
static void get_file_internal_info(struct smb2_query_info_rsp *rsp,
@@ -5169,7 +5220,7 @@ static int smb2_get_info_file(struct ksmbd_work *work,
break;
case FILE_STREAM_INFORMATION:
- get_file_stream_info(work, rsp, fp, work->response_buf);
+ rc = get_file_stream_info(work, req, rsp, fp);
break;
case FILE_INTERNAL_INFORMATION:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0445/1059] blk-cgroup: dont free a blkg with its punt work queued
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (443 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0444/1059] ksmbd: return complete and aligned stream information Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0446/1059] blk-iolatency: flush enable_work after going offline Greg Kroah-Hartman
` (553 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Josef Bacik, Jens Axboe,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 4def096314cf29fb6940b74c087a0b923185580e ]
blkg_async_bio_workfn() relies on the bios on the list pinning the blkg.
But blkcg_punt_bio_submit() can call queue_work() after a running
instance already took and completed the bio, and queue_work() succeeds
on an empty list for the same reason. Nothing holds the blkg then, and
free_work shares its memory with async_bio_work on top of that.
Hold a reference across blkcg_punt_bio_submit(), give the two works
memory of their own, and cancel async_bio_work in blkg_free_workfn().
Fixes: d3f77dfdc718 ("blkcg: implement REQ_CGROUP_PUNT")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-20-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Moved INIT_WORK of async_bio_work earlier in blkg_alloc() so early-failure frees don't cancel an uninitialized work, and dropped upstream's CONFIG_BLK_CGROUP_PUNT_BIO guards and adapted to the older punt helper layout. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-cgroup.c | 14 ++++++++++++--
block/blk-cgroup.h | 6 ++----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index b65aaf585f04d..2ba82bd2dd422 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -90,6 +90,9 @@ static void blkg_free_workfn(struct work_struct *work)
free_work);
int i;
+ /* It may have been queued for bios which an earlier run has taken */
+ cancel_work_sync(&blkg->async_bio_work);
+
for (i = 0; i < BLKCG_MAX_POLS; i++)
if (blkg->pd[i])
blkcg_policy[i]->pd_free_fn(blkg->pd[i]);
@@ -157,7 +160,7 @@ static void blkg_async_bio_workfn(struct work_struct *work)
struct blk_plug plug;
bool need_plug = false;
- /* as long as there are pending bios, @blkg can't go away */
+ /* blkg_free_workfn() waits for us */
spin_lock_bh(&blkg->async_bio_lock);
bio_list_merge(&bios, &blkg->async_bios);
bio_list_init(&blkg->async_bios);
@@ -220,6 +223,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
if (!blkg)
return NULL;
+ INIT_WORK(&blkg->async_bio_work, blkg_async_bio_workfn);
+
if (percpu_ref_init(&blkg->refcnt, blkg_release, 0, gfp_mask))
goto err_free;
@@ -234,7 +239,6 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
INIT_LIST_HEAD(&blkg->q_node);
spin_lock_init(&blkg->async_bio_lock);
bio_list_init(&blkg->async_bios);
- INIT_WORK(&blkg->async_bio_work, blkg_async_bio_workfn);
blkg->blkcg = blkcg;
u64_stats_init(&blkg->iostat.sync);
@@ -1683,11 +1687,17 @@ bool __blkcg_punt_bio_submit(struct bio *bio)
if (!blkg->parent)
return false;
+ /*
+ * Once it is on the list, a run which is under way can submit
+ * @bio, and its reference goes when it completes.
+ */
+ blkg_get(blkg);
spin_lock_bh(&blkg->async_bio_lock);
bio_list_add(&blkg->async_bios, bio);
spin_unlock_bh(&blkg->async_bio_lock);
queue_work(blkcg_punt_bio_wq, &blkg->async_bio_work);
+ blkg_put(blkg);
return true;
}
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 840deb32746c1..4619aef1bc6f5 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -71,10 +71,8 @@ struct blkcg_gq {
spinlock_t async_bio_lock;
struct bio_list async_bios;
- union {
- struct work_struct async_bio_work;
- struct work_struct free_work;
- };
+ struct work_struct async_bio_work;
+ struct work_struct free_work;
atomic_t use_delay;
atomic64_t delay_nsec;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0446/1059] blk-iolatency: flush enable_work after going offline
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (444 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0445/1059] blk-cgroup: dont free a blkg with its punt work queued Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0447/1059] blk-throttle: pass the I/O counts of a dead group on Greg Kroah-Hartman
` (552 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Josef Bacik, Jens Axboe,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 020f61242d6ebeba5f8f2ef6e429aeffdd63f1c1 ]
blkcg_iolatency_exit() flushes enable_work before it deactivates the
policy, but iolatency_pd_offline() schedules it again for the last group
with a target, so the blk_iolatency is freed with the work queued. Flush
it after the deactivation.
Fixes: 8a177a36da6c ("blk-iolatency: Fix inflight count imbalances and IO hangs on offline")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-24-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: adjusted context lines to the older spellings, del_timer_sync() and rqos->q, instead of timer_shutdown_sync() and rqos->disk; the flush_work reorder itself is identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-iolatency.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 10d0ffccc874d..5562c48b25ae3 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -646,8 +646,9 @@ static void blkcg_iolatency_exit(struct rq_qos *rqos)
struct blk_iolatency *blkiolat = BLKIOLATENCY(rqos);
del_timer_sync(&blkiolat->timer);
- flush_work(&blkiolat->enable_work);
blkcg_deactivate_policy(rqos->q, &blkcg_policy_iolatency);
+ /* iolatency_pd_offline() schedules it for the last group with a target */
+ flush_work(&blkiolat->enable_work);
kfree(blkiolat);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0447/1059] blk-throttle: pass the I/O counts of a dead group on
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (445 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0446/1059] blk-iolatency: flush enable_work after going offline Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0448/1059] blk-throttle: make blkio.reset_stats reset I/O counts Greg Kroah-Hartman
` (551 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Josef Bacik, Jens Axboe,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 587edb931fdda032bcd63fdfb0db4ded75159ee9 ]
The recursive io_service_bytes and io_serviced files sum up the online
groups plus what dead descendants left in aux_cnt. That worked while the
counters lived in the blkg. Since commit 7ca464383aec they're in the
throtl_grp and nobody passes them up, so the files go backwards when a
child is removed. Add them to the parent in throtl_pd_offline().
Fixes: 7ca464383aec ("blk-throtl: stop using blkg->stat_bytes and ->stat_ios")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-26-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Moved the stat propagation into this tree's throtl_pd_offline(), which has no tg_flush_bios(), adding a parent local and placing the block at the top before the existing limit-clearing code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-throttle.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 084ae45efd118..869c92ab87c59 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -474,6 +474,15 @@ static void throtl_upgrade_state(struct throtl_data *td);
static void throtl_pd_offline(struct blkg_policy_data *pd)
{
struct throtl_grp *tg = pd_to_tg(pd);
+ struct throtl_grp *parent = blkg_to_tg(tg_to_blkg(tg)->parent);
+
+ /* the recursive files of the ancestors go on counting what it did */
+ if (parent) {
+ blkg_rwstat_add_aux(&parent->stat_bytes, &tg->stat_bytes);
+ blkg_rwstat_add_aux(&parent->stat_ios, &tg->stat_ios);
+ blkg_rwstat_reset(&tg->stat_bytes);
+ blkg_rwstat_reset(&tg->stat_ios);
+ }
tg->bps[READ][LIMIT_LOW] = 0;
tg->bps[WRITE][LIMIT_LOW] = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0448/1059] blk-throttle: make blkio.reset_stats reset I/O counts
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (446 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0447/1059] blk-throttle: pass the I/O counts of a dead group on Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0449/1059] tls: Honor O_NONBLOCK in tls_sw_splice_read() Greg Kroah-Hartman
` (550 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Josef Bacik, Jens Axboe,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit ac81a07a0bd5e75e8edc0eb5be563be1b2d56554 ]
blkio.throttle.io_service_bytes and io_serviced were reset by
blkcg_reset_stats() while the counters were part of the blkg. Now that
they live in the throtl_grp, add a pd_reset_stats_fn for them.
Fixes: 7ca464383aec ("blk-throtl: stop using blkg->stat_bytes and ->stat_ios")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-27-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Adjusted context because the surrounding functions are ordered differently, so the new reset-stats function and its ops hook land after a different neighbor. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-throttle.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 869c92ab87c59..0256a53258c4e 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1733,6 +1733,14 @@ static void throtl_shutdown_wq(struct request_queue *q)
cancel_work_sync(&td->dispatch_work);
}
+static void throtl_pd_reset_stats(struct blkg_policy_data *pd)
+{
+ struct throtl_grp *tg = pd_to_tg(pd);
+
+ blkg_rwstat_reset(&tg->stat_bytes);
+ blkg_rwstat_reset(&tg->stat_ios);
+}
+
struct blkcg_policy blkcg_policy_throtl = {
.dfl_cftypes = throtl_files,
.legacy_cftypes = throtl_legacy_files,
@@ -1742,6 +1750,7 @@ struct blkcg_policy blkcg_policy_throtl = {
.pd_online_fn = throtl_pd_online,
.pd_offline_fn = throtl_pd_offline,
.pd_free_fn = throtl_pd_free,
+ .pd_reset_stats_fn = throtl_pd_reset_stats,
};
void blk_throtl_cancel_bios(struct gendisk *disk)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0449/1059] tls: Honor O_NONBLOCK in tls_sw_splice_read()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (447 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0448/1059] blk-throttle: make blkio.reset_stats reset I/O counts Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0450/1059] net: bridge: netlink: do not clear the vlan info dump error Greg Kroah-Hartman
` (549 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <cel@kernel.org>
[ Upstream commit 78ded647d43e335891f981f68c5992a2e763cfcc ]
tls_sw_splice_read() takes its blocking behavior from
SPLICE_F_NONBLOCK alone. When splicing from a socket to a pipe,
do_splice() sets that flag from the pipe's O_NONBLOCK, not the
socket's. On a nonblocking socket, a splice(2) call without
SPLICE_F_NONBLOCK therefore sleeps in tls_rx_rec_wait() until a
record arrives. tcp_splice_read() instead reads sock->file->f_flags
and returns -EAGAIN.
Polling first does not avoid the sleep once tls_sw_splice_read()
consumes zero-length records, as it does after a later patch in this
series. tls_sw_sock_is_readable() reports the socket readable while
any record sits on rx_list, including a zero-length record that
delivers no bytes to the pipe. For TLS 1.3 the strparser announces a
record before decryption, when its plaintext length is still unknown,
so the readiness test cannot screen such a record out. A splice that
consumes the record and waits for the next stalls every connection
an event loop multiplexes.
An LLM audit of the TLS read paths found this defect.
Treat the socket's O_NONBLOCK as nonblocking too. A caller that
sets O_NONBLOCK on the socket and splices without SPLICE_F_NONBLOCK
now gets -EAGAIN where the splice blocked before. sendfile(2) from
a TLS socket changes the same way, because do_sendfile() leaves the
input file's O_NONBLOCK out of the splice flags. Both now behave as
they do on a plain TCP socket.
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
Signed-off-by: Chuck Lever <cel@kernel.org>
Link: https://patch.msgid.link/20261027015215.605919-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Changed the tls_rx_rec_wait() call to the older (sk, psock, nonblock, released) signature, passing nonblock as the third argument in place of flags & SPLICE_F_NONBLOCK. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tls/tls_sw.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 6354cb42cbe13..12dcafd4b6b5a 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2353,10 +2353,14 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
struct tls_msg *tlm;
struct sk_buff *skb;
ssize_t copied = 0;
+ bool nonblock;
int chunk;
int err;
- err = tls_rx_reader_lock(sk, ctx, flags & SPLICE_F_NONBLOCK);
+ nonblock = flags & SPLICE_F_NONBLOCK ||
+ sock->file->f_flags & O_NONBLOCK;
+
+ err = tls_rx_reader_lock(sk, ctx, nonblock);
if (err < 0)
return err;
@@ -2370,8 +2374,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
} else {
struct tls_decrypt_arg darg;
- err = tls_rx_rec_wait(sk, NULL, flags & SPLICE_F_NONBLOCK,
- true);
+ err = tls_rx_rec_wait(sk, NULL, nonblock, true);
if (err <= 0)
goto splice_read_end;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0450/1059] net: bridge: netlink: do not clear the vlan info dump error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (448 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0449/1059] tls: Honor O_NONBLOCK in tls_sw_splice_read() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0451/1059] xattr: always invoke cap_convert_nscap() for security.capability writes Greg Kroah-Hartman
` (548 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linkui Xiao, Eric Dumazet,
Nikolay Aleksandrov, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linkui Xiao <xiaolinkui@kylinos.cn>
[ Upstream commit fcc00b15cb21a6de76826e5012b2c758505f5e65 ]
br_fill_ifinfo() assigns the result of br_fill_vlan_tunnel_info() over
the result of br_fill_ifvlaninfo() or br_fill_ifvlaninfo_compressed()
instead of only running the second helper when the first one succeeded.
When the vlan information no longer fits in the skb but the port has no
vlan mapped to a tunnel dst, br_fill_vlan_tunnel_info() walks the vlan
list and returns 0 without touching the skb. The -EMSGSIZE is lost,
br_fill_ifinfo() completes a message whose IFLA_AF_SPEC is truncated,
and the dump carries on to the next interface instead of stopping, so
userspace silently sees an incomplete vlan list.
Only fill the tunnel information when the vlan information was filled
successfully.
This was flagged as a pre-existing issue in the Sashiko review of the
net-next series, which noted that the VLAN fill result is overwritten
before it is tested (see the Link tag below). Not triggered or tested.
Fixes: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support")
Link: https://lore.kernel.org/bridge/ed1de95e-e112-4076-93f0-6f7668e657ad@blackwall.org/T/#u#5
Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20261027085200.1501599-1-xiaolinkui@126.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adapted the one-line !err && guard to this branch's older flag test, port->flags & BR_VLAN_TUNNEL, in place of test_bit(BR_VLAN_TUNNEL_BIT, ...). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bridge/br_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e9e5c77ef0f4a..bd99091edeb6f 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -518,7 +518,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
else
err = br_fill_ifvlaninfo(skb, vg);
- if (port && (port->flags & BR_VLAN_TUNNEL))
+ if (!err && port && (port->flags & BR_VLAN_TUNNEL))
err = br_fill_vlan_tunnel_info(skb, vg);
rcu_read_unlock();
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0451/1059] xattr: always invoke cap_convert_nscap() for security.capability writes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (449 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0450/1059] net: bridge: netlink: do not clear the vlan info dump error Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0452/1059] blk-mq: exit the hctxs of a queue under tag_list_lock Greg Kroah-Hartman
` (547 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dominik Maier,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Maier <dmnk@google.com>
[ Upstream commit 0f4a9e682f7fa5becc3af7204606d9bf4780e425 ]
Commit 8db6c34f1dbc ("Introduce v3 namespaced file capabilities") changed
cap_inode_setxattr() to return 0 unconditionally for XATTR_NAME_CAPS
("security.capability") and moved capability validation into
cap_convert_nscap(), but placed the call inside the "if (size)" block in
setxattr(). Commit 7c03e2cda4a5 ("vfs: move cap_convert_nscap() call into
vfs_setxattr()") preserved that "size &&" condition in vfs_setxattr():
if (size && strcmp(name, XATTR_NAME_CAPS) == 0) {
error = cap_convert_nscap(idmap, dentry, &value, size);
...
}
For security.* extended attributes, xattr_permission() skips
inode_permission(MAY_WRITE) and leaves permission checks to the security
module, while cap_inode_setxattr() returns 0 for XATTR_NAME_CAPS assuming
cap_convert_nscap() has already validated the write. Because
__vfs_setxattr() treats size == 0 as an empty attribute write (setting
value = "") rather than a removal, calling setxattr(2) on
"security.capability" with size == 0 bypasses cap_convert_nscap() and
allows an unprivileged caller without CAP_SETFCAP or write permission on
the target inode to write a 0-byte security.capability xattr (or
overwrite an existing one).
When that binary is subsequently executed, get_vfs_caps_from_disk() reads
the 0-byte security.capability xattr and fails the
size < sizeof(magic_etc) check with -EINVAL, causing execve(2) to fail
with -EINVAL.
Always invoke cap_convert_nscap() when strcmp(name, XATTR_NAME_CAPS) == 0
regardless of size, so that 0-byte writes hit the existing !*ivalue /
!validheader() checks in cap_convert_nscap() and are rejected with
-EINVAL.
Fixes: 8db6c34f1dbc ("Introduce v3 namespaced file capabilities")
Signed-off-by: Dominik Maier <dmnk@google.com>
Link: https://patch.msgid.link/20261022232119.2537209-1-dmnk@google.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Adjusted the context lines to use struct user_namespace *mnt_userns instead of const struct mnt_idmap *idmap in the cap_convert_nscap() call. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xattr.c b/fs/xattr.c
index 427b8cea1f968..deae26650abda 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -297,7 +297,7 @@ vfs_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry,
const void *orig_value = value;
int error;
- if (size && strcmp(name, XATTR_NAME_CAPS) == 0) {
+ if (strcmp(name, XATTR_NAME_CAPS) == 0) {
error = cap_convert_nscap(mnt_userns, dentry, &value, size);
if (error < 0)
return error;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0452/1059] blk-mq: exit the hctxs of a queue under tag_list_lock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (450 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0451/1059] xattr: always invoke cap_convert_nscap() for security.capability writes Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0453/1059] drbd: stop the start_resync timer of a dying device Greg Kroah-Hartman
` (546 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Josef Bacik, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 89a2381482d8ff8e4fe0b7d32797bb4f77503b89 ]
blk_mq_update_nr_hw_queues() exits and replaces the hctxs of every queue
on set->tag_list under tag_list_lock. blk_mq_exit_queue() exits its
hctxs without the lock and only then takes the queue off the list, so an
update running at the same time exits them again and sets up new ones
that nobody exits. del_gendisk() is kept away by update_nr_hwq_lock,
disk_release() of a never added disk and blk_mq_destroy_queue() are not,
and nvme_alloc_ns() drops such a disk when it finds the queues frozen by
a reset.
Hold tag_list_lock for both steps.
Fixes: 630ef623ed26 ("blk-mq: Swap two calls in blk_mq_exit_queue()")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-38-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Adapted the context to the older tree's plain list_del() and trailing INIT_LIST_HEAD() in blk_mq_del_queue_tag_set(), which has no RCU conversion. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-mq.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a918e1188f233..933ce75f4b965 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4057,7 +4057,8 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
{
struct blk_mq_tag_set *set = q->tag_set;
- mutex_lock(&set->tag_list_lock);
+ lockdep_assert_held(&set->tag_list_lock);
+
list_del(&q->tag_set_list);
if (list_is_singular(&set->tag_list)) {
/* just transitioned to unshared */
@@ -4065,7 +4066,6 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
/* update existing queue */
blk_mq_update_tag_set_shared(set, false);
}
- mutex_unlock(&set->tag_list_lock);
INIT_LIST_HEAD(&q->tag_set_list);
}
@@ -4395,10 +4395,16 @@ void blk_mq_exit_queue(struct request_queue *q)
{
struct blk_mq_tag_set *set = q->tag_set;
+ /*
+ * As long as the queue is on set->tag_list, its hctxs belong to
+ * blk_mq_update_nr_hw_queues() as well, which exits and replaces them.
+ */
+ mutex_lock(&set->tag_list_lock);
/* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */
blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
/* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */
blk_mq_del_queue_tag_set(q);
+ mutex_unlock(&set->tag_list_lock);
}
static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0453/1059] drbd: stop the start_resync timer of a dying device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (451 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0452/1059] blk-mq: exit the hctxs of a queue under tag_list_lock Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0454/1059] blk-iocost: publish hweights as one atomic value Greg Kroah-Hartman
` (545 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Philipp Reisner, Lars Ellenberg,
Christoph Böhmwalder, Josef Bacik, Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit a439d3fe3ec2bfe0b4ccb77973ae97949bcf46ec ]
start_resync_timer gets armed for up to a second and nothing ever
deletes it, so drbd_destroy_device() can free the device with the timer
pending. Shut it down where request_timer is shut down.
Fixes: 370a43e7982d ("drbd: Work on the Ahead -> SyncSource transition")
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-13-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: kept the branch's existing del_timer_sync() context line for request_timer and added the start_resync_timer shutdown line after it unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/drbd/drbd_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index b84d079d80b24..76af49ae899f9 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2185,6 +2185,7 @@ void drbd_destroy_device(struct kref *kref)
struct drbd_peer_device *peer_device, *tmp_peer_device;
del_timer_sync(&device->request_timer);
+ timer_shutdown_sync(&device->start_resync_timer);
/* paranoia asserts */
D_ASSERT(device, device->open_cnt == 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0454/1059] blk-iocost: publish hweights as one atomic value
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (452 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0453/1059] drbd: stop the start_resync timer of a dying device Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0455/1059] apparmor: fix table_size() integer overflow on 32 bit Greg Kroah-Hartman
` (544 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kunhai Dai, Tao Cui, Tejun Heo,
Jens Axboe, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunhai Dai <daikunhai@didiglobal.com>
[ Upstream commit 0150554a3f38e1850d5964102eb89a720c5fe789 ]
current_hweight() publishes the cache generation and both weights with
separate stores. Refreshers running on different CPUs can interleave
their stores and leave a new generation paired with weights from an older
calculation. The compiler can also reorder the generation store before
the weight stores, so a reader that sees the new generation can accept
stale weights.
A stale weight is not only a reporting artifact. It feeds the cost
calculation and the donation logic, where an inconsistent combination can
lead to a zero divisor in transfer_surpluses().
In addition, the slow path rereads iocg->hweight_active/inuse after
publishing them, so the value it returns can be the one written by another
refresher instead of the locally computed one.
Pack the generation and both weights into a single atomic64_t and publish
them with one atomic write. Readers take one atomic snapshot and return
the local values. Weights are in [1, WEIGHT_ONE]; storing each minus one
preserves the full range in 16 bits and leaves 32 bits for the generation.
The two weight fields remain as the donation workspace used under
ioc->lock. Tracepoints decode the packed cache without refreshing it and
iocost_monitor.py is updated accordingly.
Developed with assistance from Claude Code (Anthropic): the assistant
drafted the packed representation, the helpers and the tracepoint/monitor
changes, and ran the checks listed below. The author reviewed the result
and remains responsible for it.
Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost")
Signed-off-by: Kunhai Dai <daikunhai@didiglobal.com>
Tested-by: Tao Cui <cuitao@kylinos.cn>
Reviewed-by: Tao Cui <cuitao@kylinos.cn>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261019125412.3123895-3-daikunhai@didiglobal.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Context-only conflicts resolved by keeping the older iocg_lock helpers, the older declarations and the two-argument __assign_str() calls, with the new hweight-cache code added alongside. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-iocost.c | 109 +++++++++++++++++++++++++++------
include/trace/events/iocost.h | 7 ++-
tools/cgroup/iocost_monitor.py | 7 ++-
3 files changed, 99 insertions(+), 24 deletions(-)
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 16477d10ed7a2..7f3c76f804072 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -173,6 +173,7 @@
*/
#include <linux/kernel.h>
+#include <linux/bitfield.h>
#include <linux/module.h>
#include <linux/timer.h>
#include <linux/time64.h>
@@ -472,8 +473,8 @@ struct ioc_gq {
*
* When an idle cgroup becomes active its `active` goes from 0 to
* `weight`. `inuse` is the surplus adjusted active weight.
- * `active` and `inuse` are used to calculate `hweight_active` and
- * `hweight_inuse`.
+ * `active` and `inuse` determine the hierarchical weights cached in
+ * `hweight_cache`.
*
* `last_inuse` remembers `inuse` while an iocg is idle to persist
* surplus adjustments.
@@ -520,7 +521,9 @@ struct ioc_gq {
u64 child_active_sum;
u64 child_inuse_sum;
u64 child_adjusted_sum;
- int hweight_gen;
+ /* Generation in bits 63:32; active - 1 and inuse - 1 in 31:16/15:0. */
+ atomic64_t hweight_cache;
+ /* Donation workspace, protected by ioc->lock. */
u32 hweight_active;
u32 hweight_inuse;
u32 hweight_donating;
@@ -748,6 +751,54 @@ static void iocg_unlock(struct ioc_gq *iocg, bool unlock_ioc, unsigned long *fla
}
}
+/*
+ * The hierarchical weights are in [1, WEIGHT_ONE] and the generation is a
+ * 32-bit counter. Pack generation and both weights into one 64-bit value so
+ * that a reader or a refresher always observes a complete snapshot:
+ *
+ * bits 63:32 generation
+ * bits 31:16 hweight_active - 1
+ * bits 15:0 hweight_inuse - 1
+ */
+#define HWEIGHT_GEN_MASK GENMASK_ULL(63, 32)
+#define HWEIGHT_ACTIVE_MASK GENMASK_ULL(31, 16)
+#define HWEIGHT_INUSE_MASK GENMASK_ULL(15, 0)
+
+static inline u64 hweight_cache_pack(u32 gen, u32 active, u32 inuse)
+{
+ return FIELD_PREP(HWEIGHT_GEN_MASK, gen) |
+ FIELD_PREP(HWEIGHT_ACTIVE_MASK, active - 1) |
+ FIELD_PREP(HWEIGHT_INUSE_MASK, inuse - 1);
+}
+
+static inline void hweight_cache_unpack(u64 cache, u32 *genp, u32 *activep,
+ u32 *inusep)
+{
+ if (genp)
+ *genp = FIELD_GET(HWEIGHT_GEN_MASK, cache);
+ if (activep)
+ *activep = FIELD_GET(HWEIGHT_ACTIVE_MASK, cache) + 1;
+ if (inusep)
+ *inusep = FIELD_GET(HWEIGHT_INUSE_MASK, cache) + 1;
+}
+
+/* Decode the published weights without refreshing the cache. */
+static inline void iocg_hweight_cache(struct ioc_gq *iocg, u32 *activep,
+ u32 *inusep)
+{
+ hweight_cache_unpack(atomic64_read(&iocg->hweight_cache), NULL,
+ activep, inusep);
+}
+
+/* Decode the cached inuse weight; only used by tracepoints. */
+static inline u32 iocg_hweight_cache_inuse(struct ioc_gq *iocg)
+{
+ u32 inuse;
+
+ iocg_hweight_cache(iocg, NULL, &inuse);
+ return inuse;
+}
+
#define CREATE_TRACE_POINTS
#include <trace/events/iocost.h>
@@ -1158,12 +1209,15 @@ static void current_hweight(struct ioc_gq *iocg, u32 *hw_activep, u32 *hw_inusep
{
struct ioc *ioc = iocg->ioc;
int lvl;
- u32 hwa, hwi;
- int ioc_gen;
+ u32 hwa, hwi, ioc_gen, cache_gen;
+ u64 cache;
+
+ ioc_gen = (u32)atomic_read(&ioc->hweight_gen);
- /* hot path - if uptodate, use cached */
- ioc_gen = atomic_read(&ioc->hweight_gen);
- if (ioc_gen == iocg->hweight_gen)
+ /* hot path - if uptodate, use the cached snapshot */
+ cache = atomic64_read(&iocg->hweight_cache);
+ hweight_cache_unpack(cache, &cache_gen, &hwa, &hwi);
+ if (cache_gen == ioc_gen)
goto out;
/*
@@ -1198,14 +1252,20 @@ static void current_hweight(struct ioc_gq *iocg, u32 *hw_activep, u32 *hw_inusep
hwi = div64_u64((u64)hwi * inuse, inuse_sum);
}
- iocg->hweight_active = max_t(u32, hwa, 1);
- iocg->hweight_inuse = max_t(u32, hwi, 1);
- iocg->hweight_gen = ioc_gen;
+ hwa = max_t(u32, hwa, 1);
+ hwi = max_t(u32, hwi, 1);
+ /*
+ * Publish the generation and both weights as one atomic snapshot.
+ * A concurrent refresher may overwrite this with its own snapshot,
+ * but the generation travels with the weights so the next reader
+ * detects the mismatch and refreshes again.
+ */
+ atomic64_set(&iocg->hweight_cache, hweight_cache_pack(ioc_gen, hwa, hwi));
out:
if (hw_activep)
- *hw_activep = iocg->hweight_active;
+ *hw_activep = hwa;
if (hw_inusep)
- *hw_inusep = iocg->hweight_inuse;
+ *hw_inusep = hwi;
}
/*
@@ -1253,7 +1313,8 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
{
struct ioc *ioc = iocg->ioc;
u64 last_period, cur_period;
- u64 vtime, vtarget;
+ u64 vtime, vtarget, cache;
+ u32 active, inuse;
int i;
/*
@@ -1303,11 +1364,16 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
vtime = vtarget;
/*
- * Activate, propagate weight and start period timer if not
- * running. Reset hweight_gen to avoid accidental match from
- * wrapping.
+ * Activate, propagate weight and start period timer if not running.
+ * Invalidate the cached generation to avoid an accidental match from
+ * wrapping. Keep the last published weights so that the activation
+ * tracepoint can report them; the next current_hweight() recomputes.
*/
- iocg->hweight_gen = atomic_read(&ioc->hweight_gen) - 1;
+ cache = atomic64_read(&iocg->hweight_cache);
+ hweight_cache_unpack(cache, NULL, &active, &inuse);
+ atomic64_set(&iocg->hweight_cache,
+ hweight_cache_pack((u32)(atomic_read(&ioc->hweight_gen) - 1),
+ active, inuse));
list_add(&iocg->active_list, &ioc->active_iocgs);
propagate_weights(iocg, iocg->weight,
@@ -2042,7 +2108,7 @@ static void transfer_surpluses(struct list_head *surpluses, struct ioc_now *now)
TRACE_IOCG_PATH(inuse_transfer, iocg, now,
iocg->inuse, inuse,
- iocg->hweight_inuse,
+ iocg_hweight_cache_inuse(iocg),
iocg->hweight_after_donation);
__propagate_weights(iocg, iocg->active, inuse, true, now);
@@ -2355,7 +2421,7 @@ static void ioc_timer_fn(struct timer_list *timer)
*/
TRACE_IOCG_PATH(inuse_shortage, iocg, &now,
iocg->inuse, iocg->active,
- iocg->hweight_inuse, new_hwi);
+ old_hwi, new_hwi);
__propagate_weights(iocg, iocg->active,
iocg->active, true, &now);
@@ -2991,6 +3057,9 @@ static void ioc_pd_init(struct blkg_policy_data *pd)
INIT_LIST_HEAD(&iocg->active_list);
INIT_LIST_HEAD(&iocg->walk_list);
INIT_LIST_HEAD(&iocg->surplus_list);
+ atomic64_set(&iocg->hweight_cache,
+ hweight_cache_pack((u32)(atomic_read(&ioc->hweight_gen) - 1),
+ WEIGHT_ONE, WEIGHT_ONE));
iocg->hweight_active = WEIGHT_ONE;
iocg->hweight_inuse = WEIGHT_ONE;
diff --git a/include/trace/events/iocost.h b/include/trace/events/iocost.h
index 6d1626e7a4ce1..ef0490fc33a0a 100644
--- a/include/trace/events/iocost.h
+++ b/include/trace/events/iocost.h
@@ -34,6 +34,9 @@ DECLARE_EVENT_CLASS(iocost_iocg_state,
),
TP_fast_assign(
+ u32 hwa, hwi;
+
+ iocg_hweight_cache(iocg, &hwa, &hwi);
__assign_str(devname, ioc_name(iocg->ioc));
__assign_str(cgroup, path);
__entry->now = now->now;
@@ -44,8 +47,8 @@ DECLARE_EVENT_CLASS(iocost_iocg_state,
__entry->vtime = vtime;
__entry->weight = iocg->weight;
__entry->inuse = iocg->inuse;
- __entry->hweight_active = iocg->hweight_active;
- __entry->hweight_inuse = iocg->hweight_inuse;
+ __entry->hweight_active = hwa;
+ __entry->hweight_inuse = hwi;
),
TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
diff --git a/tools/cgroup/iocost_monitor.py b/tools/cgroup/iocost_monitor.py
index 0dbbc67400fcb..fc5100ac48f06 100644
--- a/tools/cgroup/iocost_monitor.py
+++ b/tools/cgroup/iocost_monitor.py
@@ -146,8 +146,11 @@ class IocgStat:
self.weight = iocg.weight.value_() / WEIGHT_ONE
self.active = iocg.active.value_() / WEIGHT_ONE
self.inuse = iocg.inuse.value_() / WEIGHT_ONE
- self.hwa_pct = iocg.hweight_active.value_() * 100 / WEIGHT_ONE
- self.hwi_pct = iocg.hweight_inuse.value_() * 100 / WEIGHT_ONE
+ hweight_cache = iocg.hweight_cache.counter.value_()
+ hwa = ((hweight_cache >> 16) & (WEIGHT_ONE - 1)) + 1
+ hwi = (hweight_cache & (WEIGHT_ONE - 1)) + 1
+ self.hwa_pct = hwa * 100 / WEIGHT_ONE
+ self.hwi_pct = hwi * 100 / WEIGHT_ONE
self.address = iocg.value_()
vdone = iocg.done_vtime.counter.value_()
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0455/1059] apparmor: fix table_size() integer overflow on 32 bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (453 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0454/1059] blk-iocost: publish hweights as one atomic value Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0456/1059] apparmor: convert duplicated dfa transitions to match_char() Greg Kroah-Hartman
` (543 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maxime Bélair, John Johansen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <maxime.belair@canonical.com>
[ Upstream commit 449195a4bb7d9c456c02b871eec6905edb449bd2 ]
table_size() checks ALIGN(sizeof(struct table_header) + len * el_size, 8)
in size_t, where @len is td_lolen, a u32 user-provided value from the
policy blob. On 32 bit kernels both operations can overflow.
Triggering this bug allows to:
- overflow a 16 byte allocation with up to 4GiB of policy data
- store the table header at address ZERO_SIZE_PTR (kvzalloc(0))
However, this bug requires CAP_MAC_ADMIN, only affects 32 bit kernels,
and the copy runs until the machine is destroyed, so it gives no
controllable primitive and is therefore not a security issue.
Compute the size with the checked helpers and return 0 when the result is
not representable, so the callers can reject the table. A valid table is
never 0 bytes, the header alone is 12.
64 bit kernels cannot overflow (these structs are 32 bit), and are hence
not affected.
Fixes: e06f75a6a2b4 ("AppArmor: dfa match engine")
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
[ sashal: Dropped the remap_data16_to_data32() and unpack_pdb() caller hunks since those functions don't exist here, keeping only the table_size() overflow check and the unpack_table() zero check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/include/match.h | 11 ++++++++++-
security/apparmor/match.c | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h
index 72562aaab9aea..b0215ab950e79 100644
--- a/security/apparmor/include/match.h
+++ b/security/apparmor/include/match.h
@@ -12,6 +12,7 @@
#define __AA_MATCH_H
#include <linux/kref.h>
+#include <linux/overflow.h>
#define DFA_NOMATCH 0
#define DFA_START 1
@@ -121,7 +122,15 @@ extern struct aa_dfa *stacksplitdfa;
static inline size_t table_size(size_t len, size_t el_size)
{
- return ALIGN(sizeof(struct table_header) + len * el_size, 8);
+ size_t size;
+
+ /* Need check_*_overflow for 32 bit machines */
+ if (check_mul_overflow(len, el_size, &size) ||
+ check_add_overflow(size, sizeof(struct table_header), &size) ||
+ size > SIZE_MAX - 7)
+ return 0;
+
+ return ALIGN(size, 8);
}
int aa_setup_dfa_engine(void);
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index c284614dc0286..adcf27ac94600 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -102,7 +102,7 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
if (th.td_lolen == 0)
goto out;
tsize = table_size(th.td_lolen, th.td_flags);
- if (bsize < tsize)
+ if (!tsize || bsize < tsize)
goto out;
table = kvzalloc(tsize, GFP_KERNEL);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0456/1059] apparmor: convert duplicated dfa transitions to match_char()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (454 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0455/1059] apparmor: fix table_size() integer overflow on 32 bit Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0457/1059] apparmor: check connect permission for SCTP Greg Kroah-Hartman
` (542 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maxime Bélair, John Johansen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Bélair <maxime.belair@canonical.com>
[ Upstream commit e667fc72f7f4a54674962c324048ca2cc58bc703 ]
For historical reasons several matchers duplicate the dfa character
transition instead of using match_char().
This is because aa_dfa_match_until() and aa_dfa_matchn_until() were
written on a branch that did not yet have match_char(), and copied code
from aa_dfa_match(). leftmatch_fb() used the same pattern.
When match_char() added support for diff-encoded states, the change was
never ported to these copies.
match_char() resolves a diff encoded state by using def[state] and
retrying the same character, until it reaches a state with a valid
transition. The copies instead do a simple `state = def[state];` after
the character is consumed, so on a diff encoded state one byte is dropped
and the walk continues from the diff parent in the wrong state.
This makes an unnamed px/Px/cx/Cx transition resolve to no profile, and
exec fails with
apparmor="DENIED" operation="exec" info="profile transition not found"
Convert the three copies to match_char(). For a dfa with no diff
encoded state this is a no-op.
This bug is latent until the kernel advertises policy/diff-encode.
Closes: https://gitlab.com/apparmor/apparmor/-/work_items/663
Fixes: 21f606610502 ("apparmor: improve overlapping domain attachment resolution")
Fixes: 031dcc8f4e84f ("apparmor: dfa add support for state differential encoding")
Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
[ sashal: Kept the tree's older types (unsigned int state, u16 tables, non-const dfa) in the three function declarations and only dropped the unused pos variable. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/match.c | 52 ++++++++++++++-------------------------
1 file changed, 19 insertions(+), 33 deletions(-)
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index adcf27ac94600..77947afd85463 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -598,7 +598,7 @@ unsigned int aa_dfa_match_until(struct aa_dfa *dfa, unsigned int start,
u16 *next = NEXT_TABLE(dfa);
u16 *check = CHECK_TABLE(dfa);
u32 *accept = ACCEPT_TABLE(dfa);
- unsigned int state = start, pos;
+ unsigned int state = start;
if (state == 0)
return 0;
@@ -609,22 +609,18 @@ unsigned int aa_dfa_match_until(struct aa_dfa *dfa, unsigned int start,
u8 *equiv = EQUIV_TABLE(dfa);
/* default is direct to next state */
while (*str) {
- pos = base_idx(base[state]) + equiv[(u8) *str++];
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ u8 c = equiv[(u8) *str++];
+
+ match_char(state, def, base, next, check, c);
if (accept[state])
break;
}
} else {
/* default is direct to next state */
while (*str) {
- pos = base_idx(base[state]) + (u8) *str++;
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ u8 c = (u8) *str++;
+
+ match_char(state, def, base, next, check, c);
if (accept[state])
break;
}
@@ -659,7 +655,7 @@ unsigned int aa_dfa_matchn_until(struct aa_dfa *dfa, unsigned int start,
u16 *next = NEXT_TABLE(dfa);
u16 *check = CHECK_TABLE(dfa);
u32 *accept = ACCEPT_TABLE(dfa);
- unsigned int state = start, pos;
+ unsigned int state = start;
*retpos = NULL;
if (state == 0)
@@ -671,22 +667,18 @@ unsigned int aa_dfa_matchn_until(struct aa_dfa *dfa, unsigned int start,
u8 *equiv = EQUIV_TABLE(dfa);
/* default is direct to next state */
for (; n; n--) {
- pos = base_idx(base[state]) + equiv[(u8) *str++];
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ u8 c = equiv[(u8) *str++];
+
+ match_char(state, def, base, next, check, c);
if (accept[state])
break;
}
} else {
/* default is direct to next state */
for (; n; n--) {
- pos = base_idx(base[state]) + (u8) *str++;
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ u8 c = (u8) *str++;
+
+ match_char(state, def, base, next, check, c);
if (accept[state])
break;
}
@@ -735,7 +727,7 @@ static unsigned int leftmatch_fb(struct aa_dfa *dfa, unsigned int start,
u32 *base = BASE_TABLE(dfa);
u16 *next = NEXT_TABLE(dfa);
u16 *check = CHECK_TABLE(dfa);
- unsigned int state = start, pos;
+ unsigned int state = start;
AA_BUG(!dfa);
AA_BUG(!str);
@@ -753,13 +745,10 @@ static unsigned int leftmatch_fb(struct aa_dfa *dfa, unsigned int start,
/* default is direct to next state */
while (*str) {
unsigned int adjust;
+ u8 c = equiv[(u8) *str++];
wb->history[wb->pos] = state;
- pos = base_idx(base[state]) + equiv[(u8) *str++];
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ match_char(state, def, base, next, check, c);
if (is_loop(wb, state, &adjust)) {
state = aa_dfa_match(dfa, state, str);
*count -= adjust;
@@ -772,13 +761,10 @@ static unsigned int leftmatch_fb(struct aa_dfa *dfa, unsigned int start,
/* default is direct to next state */
while (*str) {
unsigned int adjust;
+ u8 c = (u8) *str++;
wb->history[wb->pos] = state;
- pos = base_idx(base[state]) + (u8) *str++;
- if (check[pos] == state)
- state = next[pos];
- else
- state = def[state];
+ match_char(state, def, base, next, check, c);
if (is_loop(wb, state, &adjust)) {
state = aa_dfa_match(dfa, state, str);
*count -= adjust;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0457/1059] apparmor: check connect permission for SCTP
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (455 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0456/1059] apparmor: convert duplicated dfa transitions to match_char() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0458/1059] eth: bnxt: dont leak buffers when XDP agg buffer allocation fails Greg Kroah-Hartman
` (541 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean, John Johansen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
[ Upstream commit 2f764c08bb191a8c8f4051926dba0d25d195f39b ]
SCTP can start an association through sendmsg() or CONNECTX. These paths
call the SCTP-specific sctp_bind_connect hook instead of the normal socket
connect hook, but AppArmor does not register it. As a result, a profile can
deny connect and allow send or setopt, yet a task can still create an SCTP
association.
Register the SCTP hook. Ask for connect permission when SENDMSG_CONNECT
or CONNECTX creates an association.
Fixes: 56974a6fcfef ("apparmor: add base infastructure for socket mediation")
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: John Johansen <john.johansen@canonical.com>
[ sashal: Adjusted context: the new SCTP hook function is inserted before the kerneldoc comment above apparmor_socket_listen(), and the neighbouring include and af_select() context differ. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/lsm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 501e3ec6c3e7d..65d09c76a0670 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -15,6 +15,7 @@
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/ptrace.h>
+#include <linux/sctp.h>
#include <linux/ctype.h>
#include <linux/sysctl.h>
#include <linux/audit.h>
@@ -915,6 +916,18 @@ static int apparmor_socket_connect(struct socket *sock,
aa_sk_perm(OP_CONNECT, AA_MAY_CONNECT, sock->sk));
}
+static int apparmor_sctp_bind_connect(struct sock *sk, int optname,
+ struct sockaddr *address, int addrlen)
+{
+ switch (optname) {
+ case SCTP_SOCKOPT_CONNECTX:
+ case SCTP_SENDMSG_CONNECT:
+ return aa_sk_perm(OP_CONNECT, AA_MAY_CONNECT, sk);
+ }
+
+ return 0;
+}
+
/**
* apparmor_socket_listen - check perms before allowing listen
*/
@@ -1256,6 +1269,7 @@ static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = {
LSM_HOOK_INIT(socket_getsockopt, apparmor_socket_getsockopt),
LSM_HOOK_INIT(socket_setsockopt, apparmor_socket_setsockopt),
LSM_HOOK_INIT(socket_shutdown, apparmor_socket_shutdown),
+ LSM_HOOK_INIT(sctp_bind_connect, apparmor_sctp_bind_connect),
#ifdef CONFIG_NETWORK_SECMARK
LSM_HOOK_INIT(socket_sock_rcv_skb, apparmor_socket_sock_rcv_skb),
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0458/1059] eth: bnxt: dont leak buffers when XDP agg buffer allocation fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (456 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0457/1059] apparmor: check connect permission for SCTP Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0459/1059] tcp: avoid double destroy in tcp_abort() of an unaccepted child Greg Kroah-Hartman
` (540 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael Chan, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 1b2f02fb4ba92d01603c8261c94be8d348de65b0 ]
If a replacement agg buffer can't be allocated for a packet received
with XDP attached, bnxt_rx_pkt() drops the packet without returning
its head buffer to the ring. The head buffer leaks, and since rx_prod
still advances, the device gets a BD with a stale DMA address which
points at a buffer the driver no longer owns. When that BD completes
the driver finds no buffer in the slot.
The agg buffers consumed before the failing one have already been
replaced on the agg ring, they are referenced only by the frags of
the xdp_buff, which nobody frees. bnxt_xdp_buff_frags_free() would
skip them since the frags flag is set only on success, so set it
upfront.
Pointed out in LLM review of the first patch of the series.
Tested on a BCM57504 at MTU 9000 with a frags-capable XDP_PASS
program, receiving 8000B ICMPv6 echo requests (a head and two agg
buffers each) while page_pool_alloc_netmems() called from
bnxt_rx_agg_netmems_xdp() failed half of the time (bpftrace
override()). 44.7k packets were dropped, the page pools' inflight
count stayed flat and there were no KASAN or DEBUG_PAGEALLOC splats.
Fixes: 4c6c123c9af9 ("bnxt: adding bnxt_rx_agg_pages_xdp for aggregated xdp")
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20261027234940.1267225-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Renamed bnxt_rx_agg_netmems_xdp() to bnxt_rx_agg_pages_xdp() and adapted the __bnxt_rx_agg_netmems() call to the older __bnxt_rx_agg_pages() signature with an explicit shinfo argument. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 3519dd4c3d911..0ea54713c1d7f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1223,16 +1223,19 @@ static u32 bnxt_rx_agg_pages_xdp(struct bnxt *bp,
struct skb_shared_info *shinfo = xdp_get_shared_info_from_buff(xdp);
u32 total_frag_len = 0;
- if (!xdp_buff_has_frags(xdp))
+ if (!xdp_buff_has_frags(xdp)) {
+ xdp_buff_set_frags_flag(xdp);
shinfo->nr_frags = 0;
+ }
total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo,
idx, agg_bufs, tpa, xdp);
- if (total_frag_len) {
- xdp_buff_set_frags_flag(xdp);
- shinfo->nr_frags = agg_bufs;
- shinfo->xdp_frags_size = total_frag_len;
+ if (!total_frag_len) {
+ bnxt_xdp_buff_frags_free(cpr->bnapi->rx_ring, xdp);
+ return 0;
}
+ shinfo->nr_frags = agg_bufs;
+ shinfo->xdp_frags_size = total_frag_len;
return total_frag_len;
}
@@ -2003,8 +2006,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
u32 frag_len = bnxt_rx_agg_pages_xdp(bp, cpr, &xdp,
cp_cons, agg_bufs,
false);
- if (!frag_len)
+ if (!frag_len) {
+ bnxt_reuse_rx_data(rxr, cons, data);
goto oom_next_rx;
+ }
}
xdp_active = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0459/1059] tcp: avoid double destroy in tcp_abort() of an unaccepted child
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (457 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0458/1059] eth: bnxt: dont leak buffers when XDP agg buffer allocation fails Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0460/1059] apparmor: fix check SCTP bind, and connect permission checks Greg Kroah-Hartman
` (539 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit dbd62ad55a4c898f5a4c9edb20c0c062afb799df ]
tcp_abort() checks for TCP_CLOSE while only owning the socket lock,
then grabs the BH lock before calling tcp_done_with_error().
For a child still sitting in a listener accept queue (which can be
reached via SOCK_DESTROY or bpf_sock_destroy()), inet_csk_listen_stop()
can run in this window: it only holds the child BH lock, and calls
inet_child_forget(), which disconnects, orphans and destroys the child.
tcp_abort() then calls tcp_done_with_error() -> tcp_done(), which sees
SOCK_DEAD and calls inet_csk_destroy_sock() a second time, leading to
a double sock_put() and a use-after-free.
Recheck TCP_CLOSE after acquiring the BH lock, unless we just closed
a listener ourselves, in which case tcp_done_with_error() must still
run to report the error.
Note that the WARN_ON(sock_owned_by_user(child)) in
inet_csk_listen_stop() can still trigger in this window.
Fixes: bac76cf89816 ("tcp: fix forever orphan socket caused by tcp_abort")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[edumazet: recheck TCP_CLOSE under the BH lock instead of moving the test, smaller diff]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261028160847.2170959-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Kept the unconditional release_sock() and returned ret at the end of tcp_abort(), since the has_current_bpf_ctx() guard is not in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0d0cf7848d83b..19359e35bb8d2 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4744,6 +4744,8 @@ EXPORT_SYMBOL_GPL(tcp_done);
int tcp_abort(struct sock *sk, int err)
{
int state = inet_sk_state_load(sk);
+ bool listener = false;
+ int ret = 0;
if (state == TCP_NEW_SYN_RECV) {
struct request_sock *req = inet_reqsk(sk);
@@ -4775,20 +4777,30 @@ int tcp_abort(struct sock *sk, int err)
if (sk->sk_state == TCP_LISTEN) {
tcp_set_state(sk, TCP_CLOSE);
inet_csk_listen_stop(sk);
+ listener = true;
}
/* Don't race with BH socket closes such as inet_csk_listen_stop. */
local_bh_disable();
bh_lock_sock(sk);
+ /* An unaccepted child might have been closed by
+ * inet_csk_listen_stop() while we were not holding its BH lock.
+ */
+ if (!listener && sk->sk_state == TCP_CLOSE) {
+ ret = -ENOENT;
+ goto out;
+ }
+
if (tcp_need_reset(sk->sk_state))
tcp_send_active_reset(sk, GFP_ATOMIC);
tcp_done_with_error(sk, err);
+out:
bh_unlock_sock(sk);
local_bh_enable();
release_sock(sk);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(tcp_abort);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0460/1059] apparmor: fix check SCTP bind, and connect permission checks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (458 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0459/1059] tcp: avoid double destroy in tcp_abort() of an unaccepted child Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0461/1059] apparmor: advertise that sctp is being mediated Greg Kroah-Hartman
` (538 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, John Johansen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <john.johansen@canonical.com>
[ Upstream commit 7a82f9a06459ff1c37b5e97b204430442cc076e3 ]
SCTP mediation of bind is not being checked correctly because bind
permission needs to be checked in the sctp_bind_connect() hook.
Require for bind permissions when CTP_SET_PEER_PRIMARY_ADDR, and
SCTP_SOCKOPT_BINDX_ADD are asked for.
The peer initialized ASCONF cases (SCTP_PARAM_ADD_IP and
SCTP_PARAM_SET_PRIMARY) are processed in softirq context and are not
mediated atm. SCTP_PRIMATEY_ADDR, and SCTP_SET_PEER_PRIMARY_ADDR only
select among address already in the association.
Fixes: 56974a6fcfef ("apparmor: add base infastructure for socket mediation")
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/lsm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 65d09c76a0670..325dd91e3f4df 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -920,6 +920,11 @@ static int apparmor_sctp_bind_connect(struct sock *sk, int optname,
struct sockaddr *address, int addrlen)
{
switch (optname) {
+ /* Bind checks */
+ case SCTP_SET_PEER_PRIMARY_ADDR:
+ case SCTP_SOCKOPT_BINDX_ADD:
+ return aa_sk_perm(OP_BIND, AA_MAY_BIND, sk);
+ /* Connect checks */
case SCTP_SOCKOPT_CONNECTX:
case SCTP_SENDMSG_CONNECT:
return aa_sk_perm(OP_CONNECT, AA_MAY_CONNECT, sk);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0461/1059] apparmor: advertise that sctp is being mediated
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (459 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0460/1059] apparmor: fix check SCTP bind, and connect permission checks Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0462/1059] kernfs: avoid READ_ONCE() on a kgid_t in kernfs_new_node() Greg Kroah-Hartman
` (537 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, John Johansen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <john.johansen@canonical.com>
[ Upstream commit 35b8ab3f36ac0fcd8fc910da0bed889b6c75c426 ]
Enable the test harness to detect that the kernel should be properly
mediating sctp.
Fixes: 7a82f9a06459f ("apparmor: fix check SCTP bind, and connect permission checks")
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/apparmor/net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/security/apparmor/net.c b/security/apparmor/net.c
index a140d14eafdf3..b4351c94b9a54 100644
--- a/security/apparmor/net.c
+++ b/security/apparmor/net.c
@@ -22,6 +22,7 @@
struct aa_sfs_entry aa_sfs_entry_network[] = {
AA_SFS_FILE_STRING("af_mask", AA_SFS_AF_MASK),
AA_SFS_FILE_BOOLEAN("tcp-fast-open", 1),
+ AA_SFS_FILE_BOOLEAN("sctp", 1),
{ }
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0462/1059] kernfs: avoid READ_ONCE() on a kgid_t in kernfs_new_node()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (460 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0461/1059] apparmor: advertise that sctp is being mediated Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0463/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2) Greg Kroah-Hartman
` (536 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Shakeel Butt,
Tejun Heo, Danilo Krummrich, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <shakeel.butt@linux.dev>
[ Upstream commit ef179363b04306dbc645c53207b9ad3516ebc75f ]
kernfs_new_node() reads the parent's gid with READ_ONCE(attrs->ia_gid).
That gid is a kgid_t, which is a struct.
On SMP alpha, READ_ONCE() ends by casting the value it loaded back to
the type of its argument. Here that is a cast from a struct to the same
struct. GCC accepts that as an extension, but ISO C does not allow a
cast to or from a struct type, so sparse warns:
fs/kernfs/dir.c:751:31: sparse: sparse: cast to non-scalar
fs/kernfs/dir.c:751:31: sparse: sparse: cast from non-scalar
Read the gid_t inside the kgid_t instead, and wrap it back up with
KGIDT_INIT(). This is still a single marked load of the same four bytes.
There is no functional change. With GCC 12 for alpha (the config from
the report) and GCC 14 for x86-64 (with and without KCSAN),
fs/kernfs/dir.o has the same object code before and after this change.
Fixes: 81bdc85b4c08 ("kernfs: fix up the unlocked attribute reads on the creation paths")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610261608.vItiXCGW-lkp@intel.com/
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261027143247.3537239-1-shakeel.butt@linux.dev
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/kernfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 0798f582149f1..7d422925fc8de 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -687,7 +687,7 @@ struct kernfs_node *kernfs_new_node(struct kernfs_node *parent,
struct kernfs_iattrs *attrs = READ_ONCE(parent->iattr);
if (attrs)
- gid = READ_ONCE(attrs->ia_gid);
+ gid = KGIDT_INIT(READ_ONCE(attrs->ia_gid.val));
if (flags & KERNFS_DIR)
mode |= S_ISGID;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0463/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2)
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (461 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0462/1059] kernfs: avoid READ_ONCE() on a kgid_t in kernfs_new_node() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0464/1059] Bluetooth: L2CAP: take chan->lock for l2cap_chan_add/ready/del Greg Kroah-Hartman
` (535 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Brian Norris, Rafael J. Wysocki,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <briannorris@chromium.org>
[ Upstream commit bd56424ce808fb1f92a4dc5bdeedc45b85c5d6cd ]
Commit be5755f023e7 ("PM: runtime: Only queue an idle check for
RPM-linked suppliers") was incomplete. There are two other cases where
we perform idle checks on non-DL_FLAG_PM_RUNTIME suppliers -- in
pm_runtime_set_suspended(), and in cases where we failed to resume
suppliers.
Fixes: be5755f023e7 ("PM: runtime: Only queue an idle check for RPM-linked suppliers")
Fixes: 5244f5e2d801 ("PM: runtime: Defer suspending suppliers")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/20261103141442.v2.1.If69ddc515c2e9fd4338441e87688b9d690d2ef36@changeid
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Replaced device_link_test(link, DL_FLAG_PM_RUNTIME) with a direct link->flags & DL_FLAG_PM_RUNTIME test, since device_link_test() doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/power/runtime.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 24348c597b218..ce9703b93fdf6 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -332,6 +332,9 @@ static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend)
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
device_links_read_lock_held()) {
+ if (!(link->flags & DL_FLAG_PM_RUNTIME))
+ continue;
+
pm_runtime_release_supplier(link);
if (try_to_suspend)
pm_request_idle(link->supplier);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0464/1059] Bluetooth: L2CAP: take chan->lock for l2cap_chan_add/ready/del
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (462 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0463/1059] PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2) Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0465/1059] tun: clear stale skb->protocol of NAPI frags skbs Greg Kroah-Hartman
` (534 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pauli Virtanen, Eulgyu Kim,
Jaeyoung Chung, Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <pav@iki.fi>
[ Upstream commit 385c0829e09e7a6380ae67998ac6ef6f4dfd5303 ]
chan->lock must be held for __l2cap_chan_add as eg. calls to
l2cap_chan_close assume chan->conn writes are guarded by it.
It must be held for l2cap_chan_del() due to
l2cap_sock.c:l2cap_chan_conn, l2cap_monitor_timeout, etc.
Similarly it should be held for l2cap_ops::ready (assumed in 6lowpan.c).
Also teardown usually has chan->lock held, it should always have it held
to have the same locking context.
The lock is not correctly held by l2cap_core in several places.
Add the missing locks for l2cap_chan_del/add/ready(), except in
l2cap_ecred_rsp_defer() which needs separate fix as it needs lock
nesting.
Fixes: 6fef032af009 ("Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_new_connection_cb()")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Reported-by: Eulgyu Kim <eulgyukim@snu.ac.kr>
Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Used conn->chan_lock instead of upstream's conn->lock in l2cap_chan_add() when adding the chan->lock take/release around __l2cap_chan_add(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/l2cap.h | 3 ++-
net/bluetooth/l2cap_core.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b317c89935e90..b15ab4ead3bc3 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -967,7 +967,8 @@ int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator);
void l2cap_chan_set_defaults(struct l2cap_chan *chan, struct l2cap_chan *pchan);
int l2cap_ertm_init(struct l2cap_chan *chan);
void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
-void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
+void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
+ __must_hold(&chan->lock);
typedef void (*l2cap_chan_func_t)(struct l2cap_chan *chan, void *data);
void l2cap_chan_list(struct l2cap_conn *conn, l2cap_chan_func_t func,
void *data);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 86e229a593f83..c6231c630ad50 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -711,7 +711,9 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
{
mutex_lock(&conn->chan_lock);
+ l2cap_chan_lock(chan);
__l2cap_chan_add(conn, chan);
+ l2cap_chan_unlock(chan);
mutex_unlock(&conn->chan_lock);
}
@@ -4113,6 +4115,8 @@ static struct l2cap_chan *l2cap_new_connection(struct l2cap_conn *conn,
if (!chan)
return NULL;
+ l2cap_chan_lock(chan);
+
l2cap_chan_set_defaults(chan, pchan);
chan->ops = pchan->ops;
@@ -4121,10 +4125,13 @@ static struct l2cap_chan *l2cap_new_connection(struct l2cap_conn *conn,
if (pchan->ops->new_connection &&
pchan->ops->new_connection(pchan, chan) < 0) {
l2cap_chan_del(chan, 0);
+ l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
return NULL;
}
+ l2cap_chan_unlock(chan);
+
return chan;
}
@@ -5151,6 +5158,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
goto response_unlock;
}
+ l2cap_chan_lock(chan);
+
bacpy(&chan->src, &conn->hcon->src);
bacpy(&chan->dst, &conn->hcon->dst);
chan->src_type = bdaddr_src_type(conn->hcon);
@@ -5184,6 +5193,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
result = L2CAP_CR_LE_SUCCESS;
}
+ l2cap_chan_unlock(chan);
+
response_unlock:
l2cap_chan_unlock(pchan);
mutex_unlock(&conn->chan_lock);
@@ -5377,6 +5388,8 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
continue;
}
+ l2cap_chan_lock(chan);
+
bacpy(&chan->src, &conn->hcon->src);
bacpy(&chan->dst, &conn->hcon->dst);
chan->src_type = bdaddr_src_type(conn->hcon);
@@ -5409,6 +5422,8 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
} else {
l2cap_chan_ready(chan);
}
+
+ l2cap_chan_unlock(chan);
}
unlock:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0465/1059] tun: clear stale skb->protocol of NAPI frags skbs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (463 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0464/1059] Bluetooth: L2CAP: take chan->lock for l2cap_chan_add/ready/del Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0466/1059] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access Greg Kroah-Hartman
` (533 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Willem de Bruijn,
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 3287cd714a853d9443c4a743eca010aedcfbbcdd ]
With IFF_NAPI_FRAGS, tun_napi_alloc_frags() gets its skb from
napi_get_frags(). If GRO merged the previous frame with
GRO_MERGED_FREE, that skb was recycled by napi_reuse_skb(), which does
not reset skb->protocol set by napi_frags_skb() for the previous frame.
tun_get_user() calls tun_vnet_hdr_tnl_to_skb() before eth_type_trans(),
so the virtio header checks see the protocol of the previous frame:
GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are dissected with the
wrong protocol. A following change checks the outer protocol of UDP
tunnel GSO packets, which would then reject a valid frame when the two
ethertypes differ.
This needs GRO to hold packets across writes, and IFF_NAPI_FRAGS needs
CAP_NET_ADMIN.
Clear skb->protocol in tun_napi_alloc_frags(), like skbs allocated
by tun_alloc_skb() or build_skb(). eth_type_trans() sets it later.
Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179386753589.488856.11455181721004759454@kernel.org/
Suggested-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261110213628.3476051-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index df786382da6b1..b03628642c2c2 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1485,6 +1485,12 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile,
if (!skb)
return ERR_PTR(-ENOMEM);
+ /* An skb recycled by napi_reuse_skb() keeps the protocol of a
+ * previous frame. eth_type_trans() sets it after the virtio
+ * header checks, which must not see a stale one.
+ */
+ skb->protocol = 0;
+
linear = iov_iter_single_seg_count(it);
err = __skb_grow(skb, linear);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0466/1059] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (464 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0465/1059] tun: clear stale skb->protocol of NAPI frags skbs Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0467/1059] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Greg Kroah-Hartman
` (532 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yishai Hadas, Leon Romanovsky,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <yishaih@nvidia.com>
[ Upstream commit 89abac4b60b708037595255ea2614b6967c86ee5 ]
pvrdma embeds a pvrdma_ring_state header directly inside the QP and SRQ
ring buffers, and the hypervisor writes cons_head into that header.
Pinning with access=0 does not force a private page copy (no
FOLL_WRITE), so the hypervisor may write into a shared page.
Pass IB_ACCESS_LOCAL_WRITE for all three rings. The SRQ ring_state is
not currently used by the driver but is pinned writable for consistency.
Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/20260915140933.40580-4-yishaih@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Replaced ib_umem_get_va() with ib_umem_get(), since the helper is missing here, and re-wrapped the arguments to match. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 6 ++++--
drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
index f83cd4a9d9923..7ba9669053040 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
@@ -270,7 +270,8 @@ int pvrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
/* set qp->sq.wqe_cnt, shift, buf_size.. */
qp->rumem = ib_umem_get(ibqp->device,
ucmd.rbuf_addr,
- ucmd.rbuf_size, 0);
+ ucmd.rbuf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(qp->rumem)) {
ret = PTR_ERR(qp->rumem);
goto err_qp;
@@ -282,7 +283,8 @@ int pvrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
}
qp->sumem = ib_umem_get(ibqp->device, ucmd.sbuf_addr,
- ucmd.sbuf_size, 0);
+ ucmd.sbuf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(qp->sumem)) {
if (!is_srq)
ib_umem_release(qp->rumem);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
index bdc2703532c6c..99748f0f296dd 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
@@ -146,7 +146,8 @@ int pvrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
goto err_srq;
}
- srq->umem = ib_umem_get(ibsrq->device, ucmd.buf_addr, ucmd.buf_size, 0);
+ srq->umem = ib_umem_get(ibsrq->device, ucmd.buf_addr, ucmd.buf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(srq->umem)) {
ret = PTR_ERR(srq->umem);
goto err_srq;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0467/1059] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (465 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0466/1059] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.1 0468/1059] KEYS: Verify the key identity in __key_unlink_begin Greg Kroah-Hartman
` (531 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Eric Biggers,
Jarkko Sakkinen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
commit 094c53d2994975e36d4cab7cf5d9f34c1b0f1916 upstream.
KEY_MAX_DESC_SIZE includes the trailing NULL character. Descriptions
generated from payloads and in-kernel paths bypass the userspace limit.
Reject descriptions at or above KEY_MAX_DESC_SIZE with -EINVAL at the
following sites:
- key_alloc(): before quota calculation
- __key_create_or_update(): before key_set_index_key()
- keyring_search(): before match_preparse
- request_key_and_link(): before match_preparse
- request_key_rcu(): before check_cached_key()
Cc: stable@vger.kernel.org
Fixes: f771fde82051 ("keys: Simplify key description management")
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/r/20261020174325.2229448-3-jarkko@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/key.h | 3 +++
security/keys/key.c | 10 +++++++++-
security/keys/keyctl.c | 2 --
security/keys/keyring.c | 7 ++++++-
security/keys/request_key.c | 14 ++++++++++++--
5 files changed, 30 insertions(+), 6 deletions(-)
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -37,6 +37,9 @@ struct net;
#undef KEY_DEBUGGING
+/* Maximum length of a key description, including the trailing NUL */
+#define KEY_MAX_DESC_SIZE 4096
+
#define KEY_POS_VIEW 0x01000000 /* possessor can view a key's attributes */
#define KEY_POS_READ 0x02000000 /* possessor can read key payload / view keyring */
#define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -245,6 +245,8 @@ struct key *key_alloc(struct key_type *t
}
desclen = strlen(desc);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ goto error;
quotalen = desclen + 1 + type->def_datalen;
/* get hold of the key tracking for this user */
@@ -834,6 +836,7 @@ key_ref_t key_create_or_update(key_ref_t
key_ref_t key_ref;
int ret;
struct key_restriction *restrict_link = NULL;
+ size_t desclen;
/* look up the key type to see if it's one of the registered kernel
* types */
@@ -874,7 +877,12 @@ key_ref_t key_create_or_update(key_ref_t
if (!index_key.description)
goto error_free_prep;
}
- index_key.desc_len = strlen(index_key.description);
+ desclen = strlen(index_key.description);
+ if (desclen >= KEY_MAX_DESC_SIZE) {
+ key_ref = ERR_PTR(-EINVAL);
+ goto error_free_prep;
+ }
+ index_key.desc_len = desclen;
key_set_index_key(&index_key);
ret = __key_link_lock(keyring, &index_key);
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -24,8 +24,6 @@
#include <keys/request_key_auth-type.h>
#include "internal.h"
-#define KEY_MAX_DESC_SIZE 4096
-
static const unsigned char keyrings_capabilities[2] = {
[0] = (KEYCTL_CAPS0_CAPABILITIES |
(IS_ENABLED(CONFIG_PERSISTENT_KEYRINGS) ? KEYCTL_CAPS0_PERSISTENT_KEYRINGS : 0) |
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -957,7 +957,6 @@ key_ref_t keyring_search(key_ref_t keyri
struct keyring_search_context ctx = {
.index_key.type = type,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -965,8 +964,14 @@ key_ref_t keyring_search(key_ref_t keyri
.flags = KEYRING_SEARCH_DO_STATE_CHECK,
};
key_ref_t key;
+ size_t desclen;
int ret;
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
+
if (recurse)
ctx.flags |= KEYRING_SEARCH_RECURSE;
if (type->match_preparse) {
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -584,7 +584,6 @@ struct key *request_key_and_link(struct
.index_key.type = type,
.index_key.domain_tag = domain_tag,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -595,8 +594,14 @@ struct key *request_key_and_link(struct
};
struct key *key;
key_ref_t key_ref;
+ size_t desclen;
int ret;
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
+
kenter("%s,%s,%p,%zu,%p,%p,%lx",
ctx.index_key.type->name, ctx.index_key.description,
callout_info, callout_len, aux, dest_keyring, flags);
@@ -787,7 +792,6 @@ struct key *request_key_rcu(struct key_t
.index_key.type = type,
.index_key.domain_tag = domain_tag,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -797,6 +801,12 @@ struct key *request_key_rcu(struct key_t
};
struct key *key;
key_ref_t key_ref;
+ size_t desclen;
+
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
kenter("%s,%s", type->name, description);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0468/1059] KEYS: Verify the key identity in __key_unlink_begin
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (466 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0467/1059] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0469/1059] bootconfig: Allow keys with the maximum supported depth Greg Kroah-Hartman
` (530 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Eric Biggers,
Jarkko Sakkinen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
commit 7a7f70ff7b26519c98b339a3e0cd9ee3c8d17f77 upstream.
When two keys have identical type and description, linking the second key
replaces the first in a keyring. However, attempting to unlink the first
key (no longer in the keyring) unlinks the second key.
This happens because __key_unlink_begin() calls assoc_array_delete() with
&key->index_key, matching only on type and description rather than the
key's identity.
Example:
keyctl new_session >/dev/null
keyctl newring ring_a @s
keyctl newring ring_b @s
A=$(keyctl add user A ss %:ring_a)
B=$(keyctl add user A qq %:ring_b)
keyctl newring R @s
keyctl link $A %:R
keyctl link $B %:R
keyctl unlink $A %:R
keyctl show
Verify the key identity before unlinking, and return -ENOENT on mismatch,
instead of unlinking the key with the wrong identity.
Cc: stable@vger.kernel.org
Fixes: b2a4df200d57 ("KEYS: Expand the capacity of a keyring")
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/r/20261020174325.2229448-4-jarkko@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
security/keys/keyring.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -1506,9 +1506,15 @@ static int __key_unlink_begin(struct key
struct assoc_array_edit **_edit)
{
struct assoc_array_edit *edit;
+ const void *object;
BUG_ON(*_edit != NULL);
+ object = assoc_array_find(&keyring->keys, &keyring_assoc_array_ops,
+ &key->index_key);
+ if (!object || keyring_ptr_to_key(object) != key)
+ return -ENOENT;
+
edit = assoc_array_delete(&keyring->keys, &keyring_assoc_array_ops,
&key->index_key);
if (IS_ERR(edit))
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0469/1059] bootconfig: Allow keys with the maximum supported depth
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (467 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.1 0468/1059] KEYS: Verify the key identity in __key_unlink_begin Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0470/1059] ALSA: caiaq: Kill EP1 URB before unregistering the input device Greg Kroah-Hartman
` (529 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhiqi Zhang,
Masami Hiramatsu (Google)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiqi Zhang <zhiqizhangg@gmail.com>
commit cab697164b47eecfa2f146024f5d661f99a1a1e7 upstream.
xbc_verify_tree() accepts keys with XBC_DEPTH_MAX (16) components,
but xbc_node_compose_key_after() returns -ERANGE immediately after
storing the sixteenth component. It rejects the key before discovering
that there are no more ancestors to collect.
For example, a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p = value can be attached
to an initrd successfully. However, bootconfig -l stops listing and
prints "Failed to compose key -34". In the kernel, the same error
propagates through copy_xbc_key_value_list() during its length probe,
so proc_boot_config_init() returns before creating /proc/bootconfig.
Check the array capacity before storing the next component. This lets
exactly XBC_DEPTH_MAX components be composed while retaining the check
before any out-of-bounds store.
I found this issue while reviewing bootconfig's depth handling and used
OpenAI Codex to verify the failure and develop the fix. I reviewed the
change and wrote and ran the regression tests.
Link: https://lore.kernel.org/all/20261104073742.21202-2-zhiqizhangg@gmail.com/
Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/bootconfig.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -304,9 +304,9 @@ int __init xbc_node_compose_key_after(st
node = xbc_node_get_parent(node);
while (node && node != root) {
- keys[depth++] = xbc_node_index(node);
if (depth == XBC_DEPTH_MAX)
return -ERANGE;
+ keys[depth++] = xbc_node_index(node);
node = xbc_node_get_parent(node);
}
if (!node && root)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0470/1059] ALSA: caiaq: Kill EP1 URB before unregistering the input device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (468 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0469/1059] bootconfig: Allow keys with the maximum supported depth Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0471/1059] ALSA: usb-audio: Drop capture packets with bogus actual_length Greg Kroah-Hartman
` (528 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sergei Nizovtsev, Takashi Iwai
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Nizovtsev <snizovtsev@cloudlinux.com>
commit 5d325345185015024a86abca4cc5fa6a3f75294e upstream.
snd_disconnect() unregisters the input device via
snd_usb_caiaq_input_disconnect() and only afterwards kills the EP1
command URB (cdev->ep1_in_urb). The EP1 completion handler
usb_ep1_command_reply_dispatch() feeds snd_usb_caiaq_input_dispatch()
for EP1_CMD_READ_{ERP,ANALOG,IO} replies, which report into
cdev->input_dev. Since commit b04dcbb7f7b1 ("ALSA: caiaq: Use
snd_card_free_when_closed() at disconnection") the input device is
unregistered from snd_usb_caiaq_input_disconnect() but cdev->input_dev
is cleared only later, in snd_usb_caiaq_input_free() from the card
destructor. As the dispatch guard only tests cdev->input_dev for NULL,
an EP1 reply that completes after input_unregister_device() but before
cdev->ep1_in_urb is killed reports into an input device that has
already been unregistered and, with no evdev client holding it open,
freed.
Normally the window is closed by the USB core: usb_unbind_interface()
calls usb_disable_interface() before ->disconnect(), which flushes the
EP1 URB as long as endpoint 0x81 belongs to the interface being
unbound. But caiaq addresses EP1 through the device-wide pipe
usb_rcvbulkpipe(usb_dev, 0x1) without checking which interface owns
the endpoint. If a device declares it in another interface, the URB
stays live across snd_disconnect() of the interface that owns the card.
This needs a crafted device descriptor; a device that has EP1 in the
interface caiaq is bound to is not affected.
Kill cdev->ep1_in_urb (and the paired midi_out_urb) before the input
and audio disconnect helpers, so no EP1 completion can run once the
input device has been unregistered.
Reproduced under KASAN with raw-gadget + dummy_hcd emulating an Audio
Kontrol 1 (17cc:0815) with the EP1 bulk pair in interface 1: only
interface 0 was bound to snd-usb-caiaq and then unbound through sysfs
while the gadget flooded EP1 with EP1_CMD_READ_ERP replies. With no PCM
stream running the window is very short and was only hit by stalling
the unbinding CPU with a kgdb breakpoint at
snd_usb_caiaq_audio_disconnect(). With the fix applied, the same test
runs clean.
BUG: KASAN: slab-use-after-free in input_event+0x3a/0xc0
Read of size 8 at addr ffff8880151a4028 by task sh/118
Call Trace:
<IRQ>
input_event+0x3a/0xc0
snd_usb_caiaq_input_dispatch+0xab2/0xf00
usb_ep1_command_reply_dispatch+0x1f3/0x580
__usb_hcd_giveback_urb+0x246/0x400
dummy_timer+0x1415/0x3380
__hrtimer_run_queues+0x39d/0x800
hrtimer_run_softirq+0x187/0x2d0
handle_softirqs+0x1ff/0x930
__irq_exit_rcu+0x15b/0x210
irq_exit_rcu+0xe/0x20
sysvec_apic_timer_interrupt+0x81/0xb0
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20
RIP: 0010:snd_usb_caiaq_audio_disconnect+0x0/0x70
snd_disconnect+0x81/0x110
usb_unbind_interface+0x1a0/0x860
device_release_driver_internal+0x2c5/0x470
unbind_store+0xde/0x100
</TASK>
Allocated by task 80:
input_allocate_device+0x47/0x340
snd_usb_caiaq_input_init+0x4c/0x1ac0
snd_probe+0xab3/0x1160
usb_probe_interface+0x2ea/0x810
Freed by task 118:
kfree+0x1ea/0x5c0
input_dev_release+0xab/0xd0
device_release+0xcf/0x250
kobject_put+0x169/0x320
snd_disconnect+0x79/0x110
usb_unbind_interface+0x1a0/0x860
Fixes: b04dcbb7f7b1 ("ALSA: caiaq: Use snd_card_free_when_closed() at disconnection")
Cc: stable@vger.kernel.org
Signed-off-by: Sergei Nizovtsev <snizovtsev@cloudlinux.com>
Assisted-by: Claude:claude-opus-4-8
Link: https://patch.msgid.link/20261112094904.2430318-1-snizovtsev@cloudlinux.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/usb/caiaq/device.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -593,14 +593,19 @@ static void snd_disconnect(struct usb_in
snd_card_disconnect(card);
+ /*
+ * Kill the EP1 URB before disconnecting the input device: its
+ * completion reports into cdev->input_dev, which input_disconnect()
+ * frees without clearing the pointer.
+ */
+ usb_kill_urb(cdev->ep1_in_urb);
+ usb_kill_urb(cdev->midi_out_urb);
+
#ifdef CONFIG_SND_USB_CAIAQ_INPUT
snd_usb_caiaq_input_disconnect(cdev);
#endif
snd_usb_caiaq_audio_disconnect(cdev);
- usb_kill_urb(cdev->ep1_in_urb);
- usb_kill_urb(cdev->midi_out_urb);
-
snd_card_free_when_closed(card);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0471/1059] ALSA: usb-audio: Drop capture packets with bogus actual_length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (469 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0470/1059] ALSA: caiaq: Kill EP1 URB before unregistering the input device Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0472/1059] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Greg Kroah-Hartman
` (527 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Gichoon Han, Takashi Iwai
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gichoon Han <gichoon.han@samsung.com>
commit eed0e9583a290e6adbe3a8480bdae911f31e1ed9 upstream.
retire_capture_urb() copies urb->iso_frame_desc[i].actual_length bytes
out of urb->transfer_buffer at the packet's offset, but never checks
that value against the requested packet length. A host controller
reporting more data than requested makes memcpy() read past the end
of the URB transfer buffer.
Commit 06be918062ad ("ALSA: usb-audio: Bound packet copies by the PCM
buffer size") clamps the count to the PCM ring buffer size, which
protects the destination. The source slot is only ep->curpacksize
bytes per packet, though, so the over-read remains.
This was hit on an ARM32 system (vendor 5.4 kernel; the code path is
unchanged in mainline) with a full-speed UAC1 microphone behind a
high-speed hub, i.e. the EHCI siTD path. sitd_complete() computes
actual_length as desc->length - SITD_LENGTH(t); the controller
reported a remaining length larger than the programmed one, the value
wrapped to ~4G, and the capture copy faulted on the first unmapped
page after the URB buffer:
Unable to handle kernel paging request at virtual address e8756000
Internal error: Oops: 7 [#1] PREEMPT SMP ARM
r3 : 00000000 r2 : 0001e700 r1 : e8756000 r0 : e878fc80
Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b151f8)
A packet can never legitimately carry more than its requested length,
so warn and skip it instead of copying.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Gichoon Han <gichoon.han@samsung.com>
Link: https://patch.msgid.link/20261110060021.2146383-1-gichoon.han@samsung.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/usb/pcm.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1242,6 +1242,12 @@ static void retire_capture_urb(struct sn
// continue;
}
bytes = urb->iso_frame_desc[i].actual_length;
+ if (unlikely(bytes > urb->iso_frame_desc[i].length)) {
+ dev_warn_ratelimited(&subs->dev->dev,
+ "packet %d: actual_length %u exceeds length %u, dropping\n",
+ i, bytes, urb->iso_frame_desc[i].length);
+ continue;
+ }
if (subs->stream_offset_adj > 0) {
unsigned int adj = min(subs->stream_offset_adj, bytes);
cp += adj;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0472/1059] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (470 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0471/1059] ALSA: usb-audio: Drop capture packets with bogus actual_length Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0473/1059] mmc: mmci: fix DMA channel leak when mmc_add_host() fails Greg Kroah-Hartman
` (526 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Steven Rostedt,
Masami Hiramatsu (Google), Shuah Khan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <rostedt@goodmis.org>
commit 88d5f8cb8a6276194ac8c1de44f3ed77d7e938ce upstream.
The checkbashism is giving a false positive to the kprobe test of:
($"foo" should be eval_gettext "foo"):
if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
This is because it sees the $" at the end of the grep as a bash symbol.
Instead, escape the '$' with a backslash as it is within quotes and that
'$' is for grep to process an end of line character and not a bash
variable.
Link: https://lore.kernel.org/r/20261029211218.3749963a@fedora
Cc: stable@vger.kernel.org
Fixes: d22c3e0088e85 ("selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
@@ -6,7 +6,7 @@
SYMBOL='name_show'
# We skip this test on kernel where SYMBOL is unique or does not exist.
-if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
+if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}\$" /proc/kallsyms)" -le '1' ]; then
exit_unsupported
fi
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0473/1059] mmc: mmci: fix DMA channel leak when mmc_add_host() fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (471 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0472/1059] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0474/1059] mmc: meson-gx: report busy from DAT0 alone Greg Kroah-Hartman
` (525 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Anfernee Cao, Ulf Hansson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anfernee Cao <anferneemelokc5@gmail.com>
commit 2d8927fadbf95e2d2dfa95bcc73882d6e19c2ce4 upstream.
mmci_probe() calls mmci_dma_setup(), which acquires the RX and TX DMA
channels via dma_request_chan(). These channels are not managed by
devres, and are released only by mmci_dma_release().
If the following mmc_add_host() fails, probe jumps to the clk_disable
label, which only disables the clock. As probe then fails,
mmci_remove() is never called, so both DMA channels are leaked.
Release them by adding a dedicated unwind label, reached only after
mmci_dma_setup().
This issue was found by manual code inspection.
Fixes: b38a20f29a49 ("mmc: mmci: fix return value check of mmc_add_host()")
Cc: stable@vger.kernel.org
Signed-off-by: Anfernee Cao <anferneemelokc5@gmail.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/mmci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -2259,11 +2259,13 @@ static int mmci_probe(struct amba_device
ret = mmc_add_host(mmc);
if (ret)
- goto clk_disable;
+ goto dma_release;
pm_runtime_put(&dev->dev);
return 0;
+dma_release:
+ mmci_dma_release(host);
clk_disable:
clk_disable_unprepare(host->clk);
host_free:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0474/1059] mmc: meson-gx: report busy from DAT0 alone
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (472 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0473/1059] mmc: mmci: fix DMA channel leak when mmc_add_host() fails Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0475/1059] mmc: meson-gx: honour the busy timeout for R1b commands Greg Kroah-Hartman
` (524 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 318fdb75f4dc9d18ae621b9fb25eb11160c95649 upstream.
meson_mmc_card_busy() reports busy only while DAT0..3 are all low. A
busy card drives DAT0 low and leaves DAT1..3 to the pull-ups, and the
callback is defined as "Check if the card is pulling dat[0] low". So a
busy card is reported free, and the core, which prefers card_busy over
CMD13 in mmc_busy_cb(), stops polling after CMD6 and erase at once. The
controller hides this on R1b commands, where it waits for busy itself.
Once max_busy_timeout is reported, the core sends the longer waits, the
120 s BKOPS and 240 s sanitize switches among them, as R1 and has only
the polling left.
Look at DAT0 only, as sdhci_card_busy() does. The checks around the
voltage switch in mmc_set_uhs_voltage() still hold: the card drives
DAT0..3 low together after CMD11 and keeps them low together on
failure.
Fixes: 186cd8b7f586 ("mmc: meson-gx: implement card_busy callback")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1112,8 +1112,8 @@ static int meson_mmc_card_busy(struct mm
regval = readl(host->regs + SD_EMMC_STATUS);
- /* We are only interrested in lines 0 to 3, so mask the other ones */
- return !(FIELD_GET(STATUS_DATI, regval) & 0xf);
+ /* The card signals busy on DAT0 alone. */
+ return !(FIELD_GET(STATUS_DATI, regval) & BIT(0));
}
static int meson_mmc_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0475/1059] mmc: meson-gx: honour the busy timeout for R1b commands
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (473 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0474/1059] mmc: meson-gx: report busy from DAT0 alone Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0476/1059] mmc: meson-gx: report the longest busy wait the controller can do Greg Kroah-Hartman
` (523 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 7e3cc541aa5855bc36e6cbffa82efc2795955a10 upstream.
For a command without data the driver programs a fixed 1024 ms into the
CMD_CFG timeout field, and for R1b the controller waits for the card to
release busy within that time. The core sends erase and cache flush as
R1b with busy timeouts of up to 60 s and 30 s, and the controller gives
up after one second:
mmc_erase: erase error -110, status 0x0
mmc1: cache flush error -110
Program the timeout from cmd->busy_timeout, kept between 1024 ms, the
fixed value until now, and 32768 ms, the most the field holds, and
rounded up to a power of two. The clamp comes first: MMC_IOC_CMD passes
cmd_timeout_ms from user space straight into busy_timeout, and
roundup_pow_of_two() of a value above 2^31 does not fit in unsigned
int. sdhci takes its command timeout from cmd->busy_timeout in the
same way.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -216,6 +216,20 @@ static unsigned int meson_mmc_get_timeou
return min(timeout, 32768U); /* max. 2^15 ms */
}
+/* For R1b the controller waits for busy to be released within this timeout. */
+static unsigned int meson_mmc_get_cmd_timeout_msecs(struct mmc_command *cmd)
+{
+ unsigned int timeout = cmd->busy_timeout;
+
+ if (!timeout)
+ return SD_EMMC_CMD_TIMEOUT;
+
+ timeout = clamp_t(unsigned int, timeout, SD_EMMC_CMD_TIMEOUT,
+ SD_EMMC_CMD_TIMEOUT_MAX);
+
+ return roundup_pow_of_two(timeout);
+}
+
static struct mmc_command *meson_mmc_get_next_command(struct mmc_command *cmd)
{
if (cmd->opcode == MMC_SET_BLOCK_COUNT && !cmd->error)
@@ -856,7 +870,7 @@ static void meson_mmc_start_cmd(struct m
cmd_data = host->bounce_dma_addr & CMD_DATA_MASK;
} else {
cmd_cfg |= FIELD_PREP(CMD_CFG_TIMEOUT_MASK,
- ilog2(SD_EMMC_CMD_TIMEOUT));
+ ilog2(meson_mmc_get_cmd_timeout_msecs(cmd)));
}
/* Last descriptor */
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0476/1059] mmc: meson-gx: report the longest busy wait the controller can do
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (474 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0475/1059] mmc: meson-gx: honour the busy timeout for R1b commands Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0477/1059] mmc: meson-gx: name the limit of the CMD_CFG timeout field Greg Kroah-Hartman
` (522 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 18e9f7fb05ada68d491ff49165b9644f790e0e0c upstream.
The driver does not set max_busy_timeout, so the core takes the host
for one that can wait for busy indefinitely and sends erase and cache
flush as R1b with busy timeouts of up to 60 s and 30 s. The CMD_CFG
timeout field holds at most 32768 ms, so the controller times out first.
Report 32768 ms as max_busy_timeout. The core then sizes discards to
fit and, for a longer wait, sends R1 and polls for busy itself.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1216,6 +1216,9 @@ static int meson_mmc_probe(struct platfo
mmc->caps |= MMC_CAP_CMD23;
+ /* The longest busy wait the CMD_CFG timeout field can hold. */
+ mmc->max_busy_timeout = SD_EMMC_CMD_TIMEOUT_MAX;
+
if (mmc->caps & MMC_CAP_SDIO_IRQ)
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0477/1059] mmc: meson-gx: name the limit of the CMD_CFG timeout field
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (475 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0476/1059] mmc: meson-gx: report the longest busy wait the controller can do Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0478/1059] eventpoll: wake the next waiter when a woken waiter is killed Greg Kroah-Hartman
` (521 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit e1644210d15f7f8adbe6315199b4b73bead63a2c upstream.
The data timeout is capped at a literal 32768 ms with a comment next to
it. Give the limit a name beside the other timeout constants.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -125,6 +125,7 @@
#define SD_EMMC_CFG_RESP_TIMEOUT 256 /* in clock cycles */
#define SD_EMMC_CMD_TIMEOUT 1024 /* in ms */
#define SD_EMMC_CMD_TIMEOUT_DATA 4096 /* in ms */
+#define SD_EMMC_CMD_TIMEOUT_MAX 32768 /* in ms, 2^15: limit of CMD_CFG_TIMEOUT_MASK */
#define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */
#define SD_EMMC_DESC_BUF_LEN PAGE_SIZE
@@ -213,7 +214,7 @@ static unsigned int meson_mmc_get_timeou
timeout = roundup_pow_of_two(timeout);
- return min(timeout, 32768U); /* max. 2^15 ms */
+ return min_t(unsigned int, timeout, SD_EMMC_CMD_TIMEOUT_MAX);
}
/* For R1b the controller waits for busy to be released within this timeout. */
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0478/1059] eventpoll: wake the next waiter when a woken waiter is killed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (476 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0477/1059] mmc: meson-gx: name the limit of the CMD_CFG timeout field Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0479/1059] aio: dont let exit_aio() return before complete() is done Greg Kroah-Hartman
` (520 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mani Tofigh,
Christian Brauner (Amutable)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mani Tofigh <mt4022@columbia.edu>
commit 9f4413e522faed76f4cf610098b2369eb3ba1f1c upstream.
Processes sharing an epoll instance can sleep forever while an event is
ready. An event wakes only one waiter, which then wakes the next one in
ep_done_scan() if events are still ready. Since commit c257a340ede0
("fs, epoll: short circuit fetching events if thread has been killed"),
ep_send_events() returns before the scan when the waiter has a fatal
signal. If the woken waiter is killed before it runs, nobody wakes the
next one:
Task A Task B Task C
epoll_wait(ep, -1) epoll_wait(ep, -1)
write(efd)
/* wakes A only */
kill(A, SIGKILL)
ep_send_events()
return -EINTR
/* skips ep_done_scan() */
/* still asleep */
B then sleeps until another file on the instance becomes ready, if ever.
This can hit eg a pre-fork server whose worker gets OOM killed. Commit
7fab29e35630 ("fs/epoll: restore waking from ep_done_scan()") fixed the
same kind of hang when the wakeup in ep_done_scan() was removed.
Keep the early return so that a dying task still doesn't take events
nobody will see, but wake the next waiter there if events are ready, as
ep_done_scan() would have. With the fix, B gets the event.
This bug was identified and confirmed with the help of a deterministic
hypervisor currently under development. The C reproducer below however
hits it within about 2s.
Fixes: c257a340ede0 ("fs, epoll: short circuit fetching events if thread has been killed")
Cc: stable@vger.kernel.org
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Link: https://patch.msgid.link/20261103-epoll-killed-waiter-v1-1-36e08c16b8a2@columbia.edu
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/eventpoll.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1673,10 +1673,17 @@ static int ep_send_events(struct eventpo
/*
* Always short-circuit for fatal signals to allow threads to make a
* timely exit without the chance of finding more events available and
- * fetching repeatedly.
+ * fetching repeatedly. The wakeup that got us here may have been the
+ * only one for the events on ->rdllist, so pass it on to the next
+ * waiter, as ep_done_scan() would have.
*/
- if (fatal_signal_pending(current))
+ if (fatal_signal_pending(current)) {
+ spin_lock_irq(&ep->lock);
+ if (!list_empty(&ep->rdllist))
+ wake_up(&ep->wq);
+ spin_unlock_irq(&ep->lock);
return -EINTR;
+ }
init_poll_funcptr(&pt, NULL);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0479/1059] aio: dont let exit_aio() return before complete() is done
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (477 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0478/1059] eventpoll: wake the next waiter when a woken waiter is killed Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0480/1059] mm/mmzone: read the zoneref slot once in zonelist_zone() Greg Kroah-Hartman
` (519 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Jan Kara,
Christian Brauner (Amutable)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
commit ac4b449b39e605123c12ea10042cafc9b6f39603 upstream.
exit_aio() kills all contexts in one go and waits for them with a
single on-stack struct ctx_rq_wait. The count starts at table->nr, each
killed context drops one count in free_ioctx_reqs() and exit_aio()
subtracts the empty slots afterwards. Whoever drops the last count
either calls complete() or, if it is exit_aio(), skips the wait.
With a full table skipped is zero and atomic_sub_and_test(0, ...) only
tells us whether the count already hit zero. free_ioctx_reqs() runs from
the percpu_ref RCU callback, so if exit_aio() is off the CPU long enough
the last callback can have done its atomic_dec_and_test() but not yet
called complete():
free_ioctx_reqs() exit_aio()
atomic_dec_and_test() // 1 -> 0
atomic_sub_and_test(0) // true
kfree(table)
return
complete(&wait.comp)
complete() then locks and writes a completion on a stack frame that is
gone. So hold an extra count for exit_aio() itself. Then the last count
is always dropped by exit_aio() after it waited, or by a callback while
exit_aio() waits for it. An unprivileged user gets there with four
io_setup() calls and an exit without io_destroy().
Reported-by: Kyle Zeng <kylebot@openai.com>
Fixes: dc48e56d7616 ("aio: fix serial draining in exit_aio()")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261030-work-aio-exit_aio-v1-1-83942022a4c4@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/aio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -919,7 +919,7 @@ void exit_aio(struct mm_struct *mm)
if (!table)
return;
- atomic_set(&wait.count, table->nr);
+ atomic_set(&wait.count, table->nr + 1);
init_completion(&wait.comp);
skipped = 0;
@@ -943,7 +943,7 @@ void exit_aio(struct mm_struct *mm)
kill_ioctx(mm, ctx, &wait);
}
- if (!atomic_sub_and_test(skipped, &wait.count)) {
+ if (!atomic_sub_and_test(skipped + 1, &wait.count)) {
/* Wait until all IO for the context are done. */
wait_for_completion(&wait.comp);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0480/1059] mm/mmzone: read the zoneref slot once in zonelist_zone()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (478 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0479/1059] aio: dont let exit_aio() return before complete() is done Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0481/1059] mm/memory_hotplug: resize zones under their seqlock Greg Kroah-Hartman
` (518 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit 9c52ebe9c89d41c56fcb5d94efe9e539414175a9 upstream.
Memory hotplug rebuilds zonelists in place while allocations walk them,
so a zoneref slot can change between two loads of it.
zonelist_zone() loads the slot with a plain access. The compiler may
load it again later instead of keeping the zone it already read, so a
caller can check one zone and then use another, or the NULL terminator.
Use READ_ONCE(). Callers that take a zone from a slot and keep using
it, such as get_page_from_freelist() with ac->preferred_zoneref, need
that single load.
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-6-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/mmzone.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1439,7 +1439,8 @@ extern struct zone *next_zone(struct zon
static inline struct zone *zonelist_zone(struct zoneref *zoneref)
{
- return zoneref->zone;
+ /* Memory hotplug rewrites zonelists in place. */
+ return READ_ONCE(zoneref->zone);
}
static inline int zonelist_zone_idx(struct zoneref *zoneref)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0481/1059] mm/memory_hotplug: resize zones under their seqlock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (479 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0480/1059] mm/mmzone: read the zoneref slot once in zonelist_zone() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0482/1059] mm/page_alloc: keep the pagesets of an empty zone Greg Kroah-Hartman
` (517 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Vlastimil Babka (SUSE)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 58e81bb7de5aac8ec5e4aa21d401e7dafbd4058b upstream.
With CONFIG_DEBUG_VM the page allocator checks that a page which is
freed, split or allocated lies within its zone. The check reads
zone->zone_start_pfn and zone->spanned_pages under zone->span_seqlock, as
memory hotplug can change the two at any time.
Commit 27cacaad16c5 ("mm,memory_hotplug: drop unneeded locking") removed
the write side, since all resizing is serialized by the hotplug lock. That
leaves the reader without protection. When memory below the start of a
zone goes online, the start is lowered first and the size is raised
afterwards. When the lowest memory of a zone goes offline, the size is
reduced first. In between, the zone seems to end before its last pages. If
one of them goes through the allocator at that moment, it is reported as
being outside of the zone triggers VM_BUG_ON_PAGE().
Write the two fields in a write section of the seqlock. Interrupts are
disabled as pages are freed from interrupts, too, and the reader would
wait for the writer which it has interrupted.
Fixes: 27cacaad16c5 ("mm,memory_hotplug: drop unneeded locking")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-4-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/memory_hotplug.c | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -389,6 +389,22 @@ static unsigned long find_biggest_sectio
return 0;
}
+/*
+ * The page allocator checks pages against the span of their zone while the
+ * zone is resized, see page_outside_zone_boundaries(). It must not see the
+ * new value of one field together with the old value of the other one.
+ */
+static void zone_set_span(struct zone *zone, unsigned long start_pfn,
+ unsigned long spanned_pages)
+{
+ unsigned long flags;
+
+ write_seqlock_irqsave(&zone->span_seqlock, flags);
+ zone->zone_start_pfn = start_pfn;
+ zone->spanned_pages = spanned_pages;
+ write_sequnlock_irqrestore(&zone->span_seqlock, flags);
+}
+
static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
unsigned long end_pfn)
{
@@ -404,13 +420,10 @@ static void shrink_zone_span(struct zone
*/
pfn = find_smallest_section_pfn(nid, zone, end_pfn,
zone_end_pfn(zone));
- if (pfn) {
- zone->spanned_pages = zone_end_pfn(zone) - pfn;
- zone->zone_start_pfn = pfn;
- } else {
- zone->zone_start_pfn = 0;
- zone->spanned_pages = 0;
- }
+ if (pfn)
+ zone_set_span(zone, pfn, zone_end_pfn(zone) - pfn);
+ else
+ zone_set_span(zone, 0, 0);
} else if (zone_end_pfn(zone) == end_pfn) {
/*
* If the section is biggest section in the zone, it need
@@ -421,11 +434,10 @@ static void shrink_zone_span(struct zone
pfn = find_biggest_section_pfn(nid, zone, zone->zone_start_pfn,
start_pfn);
if (pfn)
- zone->spanned_pages = pfn - zone->zone_start_pfn + 1;
- else {
- zone->zone_start_pfn = 0;
- zone->spanned_pages = 0;
- }
+ zone_set_span(zone, zone->zone_start_pfn,
+ pfn - zone->zone_start_pfn + 1);
+ else
+ zone_set_span(zone, 0, 0);
}
}
@@ -642,12 +654,12 @@ static void node_states_set_node(int nod
static void __meminit resize_zone_range(struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages)
{
- unsigned long old_end_pfn = zone_end_pfn(zone);
+ unsigned long end_pfn = max(start_pfn + nr_pages, zone_end_pfn(zone));
- if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn)
- zone->zone_start_pfn = start_pfn;
+ if (!zone_is_empty(zone) && start_pfn > zone->zone_start_pfn)
+ start_pfn = zone->zone_start_pfn;
- zone->spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - zone->zone_start_pfn;
+ zone_set_span(zone, start_pfn, end_pfn - start_pfn);
}
static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned long start_pfn,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0482/1059] mm/page_alloc: keep the pagesets of an empty zone
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (480 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0481/1059] mm/memory_hotplug: resize zones under their seqlock Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0483/1059] mm/page_alloc: detect zonelist rebuilds from memory hot-add Greg Kroah-Hartman
` (516 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Johannes Weiner, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 7bfcf81b1cb469bc016fa8e07939c0924b9ff8db upstream.
When the last memory of a zone goes offline, zone_pcp_reset() frees
zone->per_cpu_pageset and zone->per_cpu_zonestats. Nothing waits for those
who found the zone populated and still use the two pointers. They take
neither the memory hotplug lock nor any other lock which offline_pages()
holds, and some of them can sleep:
CPU0 vmstat_update() CPU1 offline_pages()
refresh_cpu_vm_stats()
for_each_populated_zone(zone)
pcp = zone->per_cpu_pageset
cond_resched()
adjust_present_page_count()
zone_pcp_reset(zone)
free_percpu(zone->per_cpu_pageset)
decay_pcp_high(zone, pcp)
__this_cpu_write(pcp->expire, 0)
The same goes for drain_all_pages(NULL), which takes pcp->lock, for
zone_pcp_update(), show_free_areas() and the readers and writers of the
zonestats. If the per-cpu memory has got a new owner in the meantime, it
is corrupted.
The pagesets are only freed because setup_zone_pageset() would otherwise
leak them when the zone gets memory again. Keep them instead and let
setup_zone_pageset() and zone_pcp_init() use them again, like it is done
with pgdat->per_cpu_nodestats. Their lists are empty, and their limits
have been calculated for a zone without memory by the
init_per_zone_wmark_min() of offline_pages(), which is what
setup_zone_pageset() would come up with as well.
Fixes: 340175b7d14d ("mm/hotplug: free zone->pageset when a zone becomes empty")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-3-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7233,6 +7233,10 @@ void __meminit setup_zone_pageset(struct
{
int cpu;
+ /* The zone has been populated before, see zone_pcp_reset(). */
+ if (zone->per_cpu_pageset != &boot_pageset)
+ return;
+
/* Size may be 0 on !SMP && !NUMA */
if (sizeof(struct per_cpu_zonestat) > 0)
zone->per_cpu_zonestats = alloc_percpu(struct per_cpu_zonestat);
@@ -7295,6 +7299,10 @@ void __init setup_per_cpu_pageset(void)
static __meminit void zone_pcp_init(struct zone *zone)
{
+ /* This initialization only needs to be done once */
+ if (zone->per_cpu_pageset)
+ return;
+
/*
* per cpu subsystem is not up at this point. The following code
* relies on the ability of the linker to provide the
@@ -9540,6 +9548,12 @@ void zone_pcp_enable(struct zone *zone)
mutex_unlock(&pcp_batch_high_lock);
}
+/*
+ * The zone has become empty. Its pagesets and zonestats are not freed: nothing
+ * keeps somebody who found the zone populated, such as refresh_cpu_vm_stats()
+ * or drain_all_pages(), from still using them. They are used again when the
+ * zone gets memory again.
+ */
void zone_pcp_reset(struct zone *zone)
{
int cpu;
@@ -9550,12 +9564,6 @@ void zone_pcp_reset(struct zone *zone)
pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu);
drain_zonestat(zone, pzstats);
}
- free_percpu(zone->per_cpu_pageset);
- zone->per_cpu_pageset = &boot_pageset;
- if (zone->per_cpu_zonestats != &boot_zonestats) {
- free_percpu(zone->per_cpu_zonestats);
- zone->per_cpu_zonestats = &boot_zonestats;
- }
}
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0483/1059] mm/page_alloc: detect zonelist rebuilds from memory hot-add
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (481 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0482/1059] mm/page_alloc: keep the pagesets of an empty zone Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0484/1059] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp Greg Kroah-Hartman
` (515 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vlastimil Babka (SUSE),
Gregory Price (Meta), Zi Yan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit e5db040c3d09c5d85dda70f736d4d1a6714b741e upstream.
The zonelist_update_seq retry was limited to CONFIG_MEMORY_HOTREMOVE,
presumably because only hot-remove takes zones out of a zonelist.
However, build_zonerefs_node() rewrites the zonelists in place, so
onlining the first block of a zone shifts the entries that follow it
in every zonelist containing that zone. This can cause a spurious
allocation failure for a __GFP_THISNODE caller.
For a node with only ZONE_NORMAL, onlining its first ZONE_MOVABLE block
rewrites the node's ZONELIST_NOFALLBACK list as:
[NORMAL, NULL] -> [MOVABLE, NULL] -> [MOVABLE, NORMAL, NULL]
A concurrent GFP_KERNEL | __GFP_THISNODE allocation can observe the
intermediate list, skip ZONE_MOVABLE, and find no eligible zone. With
CONFIG_MEMORY_HOTREMOVE=n, check_retry_zonelist() returns 0 and the
allocation fails even though the node has free ZONE_NORMAL memory.
Gate the sequence checks on CONFIG_MEMORY_HOTPLUG, which covers every
configuration that rebuilds zonelists after boot.
Fixes: 3d36424b3b58 ("mm/page_alloc: fix race condition between build_all_zonelists and page allocation")
Cc: stable@vger.kernel.org
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-5-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4803,7 +4803,7 @@ static DEFINE_SEQLOCK(zonelist_update_se
static unsigned int zonelist_iter_begin(void)
{
- if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE))
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqbegin(&zonelist_update_seq);
return 0;
@@ -4811,7 +4811,7 @@ static unsigned int zonelist_iter_begin(
static unsigned int check_retry_zonelist(unsigned int seq)
{
- if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE))
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqretry(&zonelist_update_seq, seq);
return seq;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0484/1059] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (482 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0483/1059] mm/page_alloc: detect zonelist rebuilds from memory hot-add Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0485/1059] ext4: avoid infinite loops caused by residual data Greg Kroah-Hartman
` (514 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Maximets, Sasha Levin,
Jakub Kicinski, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Sridhar Samudrala, Kees Cook, Jean-Paul Sergent
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Paul Sergent <jpsergent@gmail.com>
commit 74a7db839308dd7d1c3f72dd1e3299784df3affb upstream.
Commit 3fcece12bc1b6 ("net: store port/representator id in
metadata_dst") dropped the options_len equality check when converting
skb_metadata_dst_cmp() to a type switch, so the memcmp length is taken
from skb a alone. When skb b carries fewer options than a, the
comparison reads past b's allocation.
Hit in practice with Cilium geneve GRO aggregation, comparing an skb
carrying 12 bytes of tunnel options against one carrying none:
memcmp: detected buffer overflow: 108 byte read of buffer size 96
WARNING: CPU: 0 PID: 15 at lib/string_helpers.c:1036 __fortify_report
__fortify_panic+0x9/0x10
skb_metadata_dst_cmp+0x11b/0x120
dev_gro_receive+0x303/0x620
gro_cell_poll+0x67/0xa0
Restore the check: unequal options_len means different metadata and no
aggregation; the memcmp only runs when both sides carry the same
options length.
Fixes: 3fcece12bc1b6 ("net: store port/representator id in metadata_dst")
Cc: stable@vger.kernel.org
Cc: Ilya Maximets <i.maximets@ovn.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Sridhar Samudrala <sridhar.samudrala@intel.com>
Cc: Kees Cook <kees@kernel.org>
Signed-off-by: Jean-Paul Sergent <jpsergent@gmail.com>
Link: https://patch.msgid.link/20261109082410.206140-1-jpsergent@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/dst_metadata.h | 2 ++
1 file changed, 2 insertions(+)
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -114,6 +114,8 @@ static inline int skb_metadata_dst_cmp(c
return memcmp(&a->u.port_info, &b->u.port_info,
sizeof(a->u.port_info));
case METADATA_IP_TUNNEL:
+ if (a->u.tun_info.options_len != b->u.tun_info.options_len)
+ return 1;
return memcmp(&a->u.tun_info, &b->u.tun_info,
sizeof(a->u.tun_info) +
a->u.tun_info.options_len);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0485/1059] ext4: avoid infinite loops caused by residual data
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (483 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0484/1059] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0486/1059] macsec: reject frames that decapsulate into runt Ethernet frames Greg Kroah-Hartman
` (513 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+512459401510e2a9a39f,
syzbot+1659aaaaa8d9d11265d7, Edward Adam Davis, Jan Kara,
Theodore Tso, stable, Bin Lan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <eadavis@qq.com>
[ Upstream commit 5422fe71d26d42af6c454ca9527faaad4e677d6c ]
On the mkdir/mknod path, when mapping logical blocks to physical blocks,
if inserting a new extent into the extent tree fails (in this example,
because the file system disabled the huge file feature when marking the
inode as dirty), ext4_ext_map_blocks() only calls ext4_free_blocks() to
reclaim the physical block without deleting the corresponding data in
the extent tree. This causes subsequent mkdir operations to reference
the previously reclaimed physical block number again, even though this
physical block is already being used by the xattr block. Therefore, a
situation arises where both the directory and xattr are using the same
buffer head block in memory simultaneously.
The above causes ext4_xattr_block_set() to enter an infinite loop about
"inserted" and cannot release the inode lock, ultimately leading to the
143s blocking problem mentioned in [1].
If the metadata is corrupted, then trying to remove some extent space
can do even more harm. Also in case EXT4_GET_BLOCKS_DELALLOC_RESERVE
was passed, remove space wrongly update quota information.
Jan Kara suggests distinguishing between two cases:
1) The error is ENOSPC or EDQUOT - in this case the filesystem is fully
consistent and we must maintain its consistency including all the
accounting. However these errors can happen only early before we've
inserted the extent into the extent tree. So current code works correctly
for this case.
2) Some other error - this means metadata is corrupted. We should strive to
do as few modifications as possible to limit damage. So I'd just skip
freeing of allocated blocks.
[1]
INFO: task syz.0.17:5995 blocked for more than 143 seconds.
Call Trace:
inode_lock_nested include/linux/fs.h:1073 [inline]
__start_dirop fs/namei.c:2923 [inline]
start_dirop fs/namei.c:2934 [inline]
Reported-by: syzbot+512459401510e2a9a39f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1659aaaaa8d9d11265d7
Tested-by: syzbot+1659aaaaa8d9d11265d7@syzkaller.appspotmail.com
Reported-by: syzbot+1659aaaaa8d9d11265d7@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=512459401510e2a9a39f
Tested-by: syzbot+1659aaaaa8d9d11265d7@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Tested-by: syzbot+512459401510e2a9a39f@syzkaller.appspotmail.com
Link: https://patch.msgid.link/tencent_43696283A68450B761D76866C6F360E36705@qq.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
[ Minor context conflict resolved. ]
Signed-off-by: Bin Lan <lanbincn@139.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/extents.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d95bc66f07433..174cc15e3b260 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4389,9 +4389,13 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
err = ext4_ext_insert_extent(handle, inode, &path, &newex, flags);
if (err) {
- if (allocated_clusters) {
+ /*
+ * Gracefully handle out of space conditions. If the filesystem
+ * is inconsistent, we'll just leak allocated blocks to avoid
+ * causing even more damage.
+ */
+ if (allocated_clusters && (err == -EDQUOT || err == -ENOSPC)) {
int fb_flags = 0;
-
/*
* free data blocks we just allocated.
* not a good idea to call discard here directly,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0486/1059] macsec: reject frames that decapsulate into runt Ethernet frames
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (484 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0485/1059] ext4: avoid infinite loops caused by residual data Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0487/1059] mctp: accept MSG_CMSG_COMPAT in recvmsg Greg Kroah-Hartman
` (512 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Dave Miller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 1d5e2c57e9ffc134e14b3f837c8d7c53b508bd22 upstream.
When an SCI is unknown and the C bit is clear, macsec_handle_frame()
removes the SecTAG and the default ICV without checking how much of the
frame remains. A short frame can therefore become an skb shorter than
ETH_HLEN. eth_type_trans() cannot pull its Ethernet header, and a second
stacked MACsec device can copy stale skb headroom into a packet delivered
to a packet socket.
The matched-SCI path has a related hole: macsec_validate_skb() accepts a
short_length of one, so a frame that passes the existing length check can
still become a 13-byte Ethernet frame.
Require enough bytes for the MACsec overhead and a complete Ethernet
header before decapsulating an unknown-SCI frame. Apply the same bound
in macsec_validate_skb(), using the selected SecY's ICV length, to cover
the no-SA, synchronous-decrypt and asynchronous-decrypt delivery paths.
Leave other unknown-SCI handling unchanged.
Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/macsec.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -399,8 +399,10 @@ static bool macsec_validate_skb(struct s
int len = skb->len - 2 * ETH_ALEN;
int extra_len = macsec_extra_len(!!(h->tci_an & MACSEC_TCI_SC)) + icv_len;
- /* a) It comprises at least 17 octets */
- if (skb->len <= 16)
+ /* a) It comprises at least 17 octets. The SecTAG and ICV must
+ * also leave a complete Ethernet header.
+ */
+ if (skb->len < ETH_HLEN + extra_len)
return false;
/* b) MACsec EtherType: already checked */
@@ -1327,9 +1329,12 @@ drop_direct:
nosci:
/* 10.6.1 if the SC is not found */
cbit = !!(hdr->tci_an & MACSEC_TCI_C);
- if (!cbit)
- macsec_finalize_skb(skb, MACSEC_DEFAULT_ICV_LEN,
- macsec_extra_len(macsec_skb_cb(skb)->has_sci));
+ if (!cbit) {
+ len = macsec_extra_len(macsec_skb_cb(skb)->has_sci);
+ if (skb->len < ETH_HLEN + len + MACSEC_DEFAULT_ICV_LEN)
+ goto drop_nosc;
+ macsec_finalize_skb(skb, MACSEC_DEFAULT_ICV_LEN, len);
+ }
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0487/1059] mctp: accept MSG_CMSG_COMPAT in recvmsg
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (485 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0486/1059] macsec: reject frames that decapsulate into runt Ethernet frames Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0488/1059] net/rds: Do not unpin a page after a failed atomic pin Greg Kroah-Hartman
` (511 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Davidlohr Bueso, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <dave@stgolabs.net>
commit 350e1d0d3b386fcc0cff2d37aa920fab4800bf72 upstream.
32-bit userspace running on a 64-bit kernel is unable to receive MCTP
messages on an AF_MCTP socket, even though sending succeeds. There is
nothing for MCTP to do with it beyond not rejecting it, as af_packet,
af_key and can/isotp already do, for example.
Fixes: 833ef3b91de6 ("mctp: Populate socket implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://patch.msgid.link/20261105160704.2546031-1-dave@stgolabs.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mctp/af_mctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -212,7 +212,7 @@ static int mctp_recvmsg(struct socket *s
u8 type;
int rc;
- if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK))
+ if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK | MSG_CMSG_COMPAT))
return -EOPNOTSUPP;
skb = skb_recv_datagram(sk, flags, &rc);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0488/1059] net/rds: Do not unpin a page after a failed atomic pin
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (486 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0487/1059] mctp: accept MSG_CMSG_COMPAT in recvmsg Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0489/1059] net: bridge: use one headroom snapshot for ND replies Greg Kroah-Hartman
` (510 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Kyle Zeng, Allison Henderson,
Dave Miller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 8d5ce4751fad9499ea408163af7f410f18a85782 upstream.
rds_cmsg_atomic() assumes that a non-NULL output from rds_pin_pages()
represents a pin that it owns. However, pin_user_pages_fast() can roll
back a fast-GUP pin after racing fork() and then fail in the slow path,
for example after a concurrent mprotect(PROT_NONE). The output slot can
still contain the already-unpinned page.
The common error path calls unpin_user_page() on that stale pointer.
This can consume another subsystem's pin and allow the page to be freed
while it is still in use. A local unprivileged reproducer triggers a
KASAN use-after-free write through an io_uring registered buffer.
Clear page when rds_pin_pages() does not return one. The error path
continues to release the page on errors after a successful pin, and
successful requests retain their existing ownership and behavior. All
four RDS atomic ancillary operations share this path.
The issue was found by an LLM.
Fixes: 15133f6e67d8 ("RDS: Implement atomic operations")
Cc: stable@kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Allison Henderson <achender@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/rds/rdma.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -960,8 +960,11 @@ int rds_cmsg_atomic(struct rds_sock *rs,
}
ret = rds_pin_pages(args->local_addr, 1, &page, 1);
- if (ret != 1)
+ if (ret != 1) {
+ /* A failed pin can leave a stale page pointer. */
+ page = NULL;
goto err;
+ }
ret = 0;
sg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0489/1059] net: bridge: use one headroom snapshot for ND replies
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (487 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0488/1059] net/rds: Do not unpin a page after a failed atomic pin Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0490/1059] net: dsa: microchip: initialize the IRQ access mutex Greg Kroah-Hartman
` (509 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, TencentOS Corvus AI,
Jun Yang, Nikolay Aleksandrov, Ido Schimmel, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun Yang <junvyyang@tencent.com>
commit e573df093ef849bb7c763aed591cb6556b110671 upstream.
br_nd_send() calls LL_RESERVED_SPACE(dev) once to size the reply skb and
again to reserve its headroom. When a port requiring more headroom is
added to the bridge, br_add_if() can increase dev->needed_headroom
between the two calls. The reserved headroom can then exceed the space
accounted for by alloc_skb().
Take one headroom snapshot and use it for both the allocation size and
skb_reserve().
Fixes: ed842faeb2bd ("bridge: suppress nd pkts on BR_NEIGH_SUPPRESS ports")
Cc: stable@kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Signed-off-by: Jun Yang <junvyyang@tencent.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261103075439.43644-1-juny24602@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bridge/br_arp_nd_proxy.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/net/bridge/br_arp_nd_proxy.c
+++ b/net/bridge/br_arp_nd_proxy.c
@@ -259,6 +259,7 @@ static void br_nd_send(struct net_bridge
struct sk_buff *reply;
struct ipv6hdr *pip6;
int na_olen = 8; /* opt hdr + ETH_ALEN for target */
+ int headroom;
int ns_olen;
int i, len;
u8 *daddr;
@@ -268,7 +269,8 @@ static void br_nd_send(struct net_bridge
if (!dev || skb_linearize(request))
return;
- len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr) +
+ headroom = LL_RESERVED_SPACE(dev);
+ len = headroom + sizeof(struct ipv6hdr) +
sizeof(*na) + na_olen + dev->needed_tailroom;
reply = alloc_skb(len, GFP_ATOMIC);
@@ -277,7 +279,7 @@ static void br_nd_send(struct net_bridge
reply->protocol = htons(ETH_P_IPV6);
reply->dev = dev;
- skb_reserve(reply, LL_RESERVED_SPACE(dev));
+ skb_reserve(reply, headroom);
skb_push(reply, sizeof(struct ethhdr));
skb_set_mac_header(reply, 0);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0490/1059] net: dsa: microchip: initialize the IRQ access mutex
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (488 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0489/1059] net: bridge: use one headroom snapshot for ND replies Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0491/1059] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Greg Kroah-Hartman
` (508 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tapio Reijonen, Daniel Machon,
Paolo Abeni
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <tapio.reijonen@vaisala.com>
commit ba1dc196502f3435f4ae53ed6745caacf066f83e upstream.
ksz_switch_register() initializes dev_mutex, regmap_mutex, alu_mutex and
vlan_mutex but not lock_irq, which the IRQ chip takes in its bus lock
callbacks on every mask and unmask of a switch interrupt, and the PTP
code takes the same way. The zeroed mutex happens to work on the
uncontended fast path, but with CONFIG_DEBUG_MUTEXES the first lock,
from the IRQ domain mapping during probe, warns:
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock
...
ksz_irq_domain_map
irq_domain_associate_locked
irq_create_mapping_affinity
ksz_irq_common_setup
ksz9477_setup
dsa_register_switch
ksz_spi_probe
and turns lock debugging off for the rest of the boot.
Initialize it with the other mutexes.
Triggered at every boot of a KSZ9897S over SPI on an i.MX6 SoloX board
with CONFIG_DEBUG_MUTEXES, on v7.4-rc1 and earlier. With this patch the
same board boots with lock debugging enabled and it stays enabled
(debug_locks 1) through two hours of unrelated stress tests.
Fixes: c9cd961c0d43 ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Cc: stable@vger.kernel.org
Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261104-ksz-irq-mutex-init-v1-1-e3bb7d9dbd80@vaisala.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/dsa/microchip/ksz_common.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -2923,6 +2923,7 @@ int ksz_switch_register(struct ksz_devic
mutex_init(&dev->regmap_mutex);
mutex_init(&dev->alu_mutex);
mutex_init(&dev->vlan_mutex);
+ mutex_init(&dev->lock_irq);
ret = ksz_switch_detect(dev);
if (ret)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0491/1059] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (489 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0490/1059] net: dsa: microchip: initialize the IRQ access mutex Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0492/1059] net: mana: report RX checksum offload for IPv6 Greg Kroah-Hartman
` (507 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lukáš Lalinský,
Jens Axboe, Dave Miller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <axboe@kernel.dk>
commit bdc350ddbcbe4788158019d4d8e8e9345cb16235 upstream.
____sys_sendmsg() and ____sys_recvmsg() turn O_NONBLOCK on the socket
into MSG_DONTWAIT. That is right for the system calls, but io_uring uses
__sys_sendmsg_sock() and __sys_recvmsg_sock() for a blocking attempt
from io-wq as well, after the non-blocking attempts with MSG_DONTWAIT
have failed. On an O_NONBLOCK socket that attempt can't block either and
the request completes with -EAGAIN, unlike IORING_OP_SEND and RECV,
which call sock_sendmsg() and sock_recvmsg() directly and don't look at
O_NONBLOCK at all.
Move the O_NONBLOCK handling to ___sys_sendmsg() and ___sys_recvmsg(),
which the sendmsg, sendmmsg, recvmsg and recvmmsg system calls go
through. The io_uring helpers then pass the flags the caller asked for.
Cc: stable@vger.kernel.org
Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
Link: https://lore.kernel.org/io-uring/a5589b66-9a20-4b1c-a0f1-1b5b31af3667@app.fastmail.com/
Reported-by: Lukáš Lalinský <lukas@lalinsky.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/socket.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- a/net/socket.c
+++ b/net/socket.c
@@ -2501,8 +2501,6 @@ static int ____sys_sendmsg(struct socket
flags &= ~MSG_INTERNAL_SENDMSG_FLAGS;
msg_sys->msg_flags = flags;
- if (sock->file->f_flags & O_NONBLOCK)
- msg_sys->msg_flags |= MSG_DONTWAIT;
/*
* If this is sendmmsg() and current destination address is same as
* previously succeeded address, omit asking LSM's decision.
@@ -2566,6 +2564,9 @@ static int ___sys_sendmsg(struct socket
msg_sys->msg_name = &address;
+ if (sock->file->f_flags & O_NONBLOCK)
+ flags |= MSG_DONTWAIT;
+
err = sendmsg_copy_msghdr(msg_sys, msg, flags, &iov);
if (err < 0)
return err;
@@ -2729,9 +2730,6 @@ static int ____sys_recvmsg(struct socket
/* We assume all kernel code knows the size of sockaddr_storage */
msg_sys->msg_namelen = 0;
- if (sock->file->f_flags & O_NONBLOCK)
- flags |= MSG_DONTWAIT;
-
if (unlikely(nosec))
err = sock_recvmsg_nosec(sock, msg_sys, flags);
else
@@ -2773,6 +2771,9 @@ static int ___sys_recvmsg(struct socket
struct sockaddr __user *uaddr;
ssize_t err;
+ if (sock->file->f_flags & O_NONBLOCK)
+ flags |= MSG_DONTWAIT;
+
err = recvmsg_copy_msghdr(msg_sys, msg, flags, &uaddr, &iov);
if (err < 0)
return err;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0492/1059] net: mana: report RX checksum offload for IPv6
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (490 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0491/1059] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0493/1059] tsacct: Keep task begin times stable across suspend Greg Kroah-Hartman
` (506 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haiyang Zhang, Hamza Mahfooz,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
commit bbcd02741c4cfbf9e1c59b1906f21ef772bd15eb upstream.
The hardware validates TCP and UDP checksums for both IPv4 and IPv6 and
reports the result in rx_tcp_csum_succeed and rx_udp_csum_succeed.
However, mana_rx_skb() also requires rx_iphdr_csum_succeed before it
sets CHECKSUM_UNNECESSARY. That bit is only set for IPv4 (since IPv6
has no header checksum), so IPv6 TCP and UDP traffic is always
checksummed again in software.
So, only look at the L4 result. For IPv4 this makes no material
difference since CHECKSUM_UNNECESSARY only covers the L4 checksum, and
ip_rcv_core() always verifies the IPv4 header checksum in software.
Between two Azure Standard_E16s_v6 VMs (VF enabled), IPv6 TCP and UDP
packets (including VXLAN over IPv6), now arrive with
CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE, so GRO no longer
checksums them in software. Calls to __skb_gro_checksum_complete() on
the receiver during an 8 second iperf3 run:
before after
TCP/IPv4, 12.2 Gbps 23 28
TCP/IPv6, 12.1 Gbps 8728419 25
UDP/IPv6, 1.5 Gbps 1071380 20
TCP/VXLAN/IPv6, 10.9 Gbps 7934373 18
Cc: stable@vger.kernel.org
Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Link: https://patch.msgid.link/20261109142856.779955-1-hamzamahfooz@linux.microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1153,10 +1153,9 @@ static void mana_rx_skb(void *buf_va, st
skb_checksum_none_assert(skb);
skb_record_rx_queue(skb, rxq_idx);
- if ((ndev->features & NETIF_F_RXCSUM) && cqe->rx_iphdr_csum_succeed) {
- if (cqe->rx_tcp_csum_succeed || cqe->rx_udp_csum_succeed)
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- }
+ if ((ndev->features & NETIF_F_RXCSUM) &&
+ (cqe->rx_tcp_csum_succeed || cqe->rx_udp_csum_succeed))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
if (cqe->rx_hashtype != 0 && (ndev->features & NETIF_F_RXHASH)) {
hash_value = cqe->ppi[0].pkt_hash;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0493/1059] tsacct: Keep task begin times stable across suspend
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (491 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0492/1059] net: mana: report RX checksum offload for IPv6 Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0494/1059] tls: only install push_pending_record for a TX context Greg Kroah-Hartman
` (505 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Nesterov, Thomas Gleixner,
Hungyu Lin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
commit c49b3c20a2d0b22700e2100a527e68e829ece7f0 upstream.
bacct_add_tsk() derives ac_btime and ac_btime64 by subtracting a
CLOCK_MONOTONIC elapsed duration from CLOCK_REALTIME. MONOTONIC stops
during suspend while REALTIME continues, so querying an existing task
after resume moves its reported begin time forward by the time spent
suspended.
Calculate the begin time from the wall-clock boot timestamp and the
task's CLOCK_BOOTTIME start timestamp instead. This accounts for suspend
and adds the nanoseconds before truncating to seconds. Keep ac_etime and
ac_tgetime on CLOCK_MONOTONIC and retain the existing rebasing when the
wall clock is adjusted.
The new begin time can be negative: setting CLOCK_REALTIME is bounded
by CLOCK_MONOTONIC, which excludes suspend, rather than CLOCK_BOOTTIME.
A permitted backward clock adjustment after suspend can therefore put
the task's begin time before the epoch. Clamp ac_btime64 at zero too,
instead of wrapping in the unsigned field, and retain its positive range.
Fixes: f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20130611200600.GA15168@redhat.com
Link: https://lore.kernel.org/r/alpine.DEB.2.21.1911071335320.4256@nanos.tec.linutronix.de
Link: https://patch.msgid.link/20261030054227.35453-3-dennylin0707@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/tsacct.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -24,7 +24,7 @@ void bacct_add_tsk(struct user_namespace
const struct cred *tcred;
u64 utime, stime, utimescaled, stimescaled;
u64 now_ns, delta;
- time64_t btime;
+ struct timespec64 btime;
BUILD_BUG_ON(TS_COMM_LEN < TASK_COMM_LEN);
@@ -39,9 +39,11 @@ void bacct_add_tsk(struct user_namespace
do_div(delta, NSEC_PER_USEC);
stats->ac_etime = delta;
/* Convert to seconds for btime (note y2106 limit) */
- btime = ktime_get_real_seconds() - div_u64(delta, USEC_PER_SEC);
- stats->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX);
- stats->ac_btime64 = btime;
+ getboottime64(&btime);
+ btime = timespec64_add(btime, ns_to_timespec64(tsk->start_boottime));
+ stats->ac_btime = clamp_t(time64_t, btime.tv_sec, 0, U32_MAX);
+ /* Setting the clock back after suspend can make btime negative. */
+ stats->ac_btime64 = max_t(time64_t, btime.tv_sec, 0);
if (tsk->flags & PF_EXITING)
stats->ac_exitcode = tsk->exit_code;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0494/1059] tls: only install push_pending_record for a TX context
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (492 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0493/1059] tsacct: Keep task begin times stable across suspend Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0495/1059] seg6: validate state in netfilter continuations Greg Kroah-Hartman
` (504 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rishikesh Jethwani, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rishikesh Jethwani <rjethwani@purestorage.com>
commit c47e766c5307c06a78304582b2b5b5ab01ee1358 upstream.
tls_set_sw_offload() assigns ctx->push_pending_record for both
directions, but the hook is a TX-side dispatcher. On a socket whose TX
side is HW offloaded, tls_set_device_offload() installs
tls_device_push_pending_record(); any later TLS_RX setsockopt
overwrites it with tls_sw_push_pending_record(), because
tls_set_device_offload_rx() itself calls tls_set_sw_offload(sk, 0, NULL)
for the software half of a successful HW RX offload, and so does the
fallback when the RX offload is declined (NIC with TX-only offload,
tls_dev_add() failure).
>From then on tls_handle_open_record() (a TLS_SET_RECORD_TYPE cmsg after
a MSG_MORE send, or the close path with a pending writer) runs
tls_sw_push_pending_record() against priv_ctx_tx, which is a
struct tls_offload_context_tx, not a struct tls_sw_context_tx, and
reads open_rec from inside the offload context. On x86_64 without lock
debugging that field overlays sg_tx_data[2].dma_address, which is never
set, so the push is silently skipped and the data buffered by the
MSG_MORE send is later sent under the cmsg's record type, e.g.
application data in a handshake or alert record. Enabling
CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_LOCK_ALLOC and CONFIG_LOCKDEP, but
not CONFIG_LOCK_STAT, in the tested x86_64 configuration moves open_rec
over sg_tx_data[5].page_link. Once populated, its page pointer and
scatterlist flags are interpreted as a tls_rec pointer and dereferenced
while reading msg_plaintext.sg.size.
Only set the hook when initialising the TX side.
Found by code review while developing TLS 1.3 HW offload rekey support.
Tested with HW TLS TX and RX offload on Mellanox ConnectX-6 Dx (Crypto
Enabled): after setting TLS_RX, send() "AAAA" with MSG_MORE, then
sendmsg() "BBBB" with a TLS_SET_RECORD_TYPE cmsg for a handshake
record. Without this patch the peer receives a single handshake record
"AAAABBBB"; with it, an application data record "AAAA" followed by a
handshake record "BBBB".
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Cc: stable@vger.kernel.org
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
Link: https://patch.msgid.link/20261102213011.4191020-1-rjethwani@purestorage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/tls/tls_sw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2971,7 +2971,8 @@ int tls_set_sw_offload(struct sock *sk,
}
}
- ctx->push_pending_record = tls_sw_push_pending_record;
+ if (tx)
+ ctx->push_pending_record = tls_sw_push_pending_record;
rc = crypto_aead_setkey(*aead, key, keysize);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0495/1059] seg6: validate state in netfilter continuations
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (493 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0494/1059] tls: only install push_pending_record for a TX context Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0496/1059] mptcp: reject DATA_ACKs against a reversed send interval Greg Kroah-Hartman
` (503 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Sashiko, Zixuan Chai, Ren Wei,
Hangbin Liu, Pablo Neira Ayuso, Andrea Mayer, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zixuan Chai <petalzu987@gmail.com>
commit 549484dd3e80a721d51bd695f22a800d2e05bea1 upstream.
When nf_hooks_lwtunnel is enabled, End.DX4 sends decapsulated packets
through NF_INET_PRE_ROUTING. If DNAT changes the inner destination,
nf_nat_ipv4_pre_routing() drops skb_dst(), and the continuation then
dereferences the missing dst's lwtstate. This causes a KASAN NULL
pointer dereference and fatal exception panic.
End.DX6 has the same issue with IPv6 DNAT. In seg6_iptunnel,
POST_ROUTING SNAT with an outbound XFRM policy can replace the dst before
the continuation resumes.
Validate the current dst and expected lwtstate type in each NF_HOOK()
continuation before calling the existing handler. Drop packets with
missing or incompatible state while preserving direct no-hook paths.
The helpers return bool because callers only need a validity check.
Testing shows that the End.DX4 DNAT reproducer triggers a KASAN NULL
pointer dereference without this change and no longer does so with the
fix. The SNAT+ESP/XFRM reproducer also completes without the reported
fault. The in-tree End.DX4 netfilter forwarding selftest passes all four
bidirectional checks with nf_hooks_lwtunnel disabled and enabled.
Fixes: 7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260720204430.1886091-1-xmei5@asu.edu
Signed-off-by: Zixuan Chai <petalzu987@gmail.com>
Signed-off-by: Ren Wei <weir@nebusec.ai>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/8574739acd6f5d9eb0a5640e893122619e9f79ef.1793726355.git.petalzu987@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/seg6_iptunnel.c | 46 +++++++++++++++++++++++++++++++++++----
net/ipv6/seg6_local.c | 55 ++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 94 insertions(+), 7 deletions(-)
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -18,6 +18,7 @@
#include <net/ip6_fib.h>
#include <net/route.h>
#include <net/seg6.h>
+#include <net/dst_metadata.h>
#include <linux/seg6.h>
#include <linux/seg6_iptunnel.h>
#include <net/addrconf.h>
@@ -58,6 +59,21 @@ static inline struct seg6_lwt *seg6_lwt_
return (struct seg6_lwt *)lwt->data;
}
+static bool seg6_skb_has_lwtstate(struct sk_buff *skb)
+{
+ struct dst_entry *dst;
+
+ if (unlikely(!skb_valid_dst(skb)))
+ return false;
+
+ dst = skb_dst(skb);
+ if (unlikely(!dst->lwtstate ||
+ dst->lwtstate->type != LWTUNNEL_ENCAP_SEG6))
+ return false;
+
+ return true;
+}
+
static inline struct seg6_iptunnel_encap *
seg6_encap_lwtunnel(struct lwtunnel_state *lwt)
{
@@ -535,6 +551,17 @@ drop:
return err;
}
+static int seg6_input_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_input_core(net, sk, skb);
+}
+
static int seg6_input_nf(struct sk_buff *skb)
{
struct net_device *dev = skb_dst(skb)->dev;
@@ -543,10 +570,10 @@ static int seg6_input_nf(struct sk_buff
switch (skb->protocol) {
case htons(ETH_P_IP):
return NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, NULL,
- skb, NULL, dev, seg6_input_core);
+ skb, NULL, dev, seg6_input_core_nf);
case htons(ETH_P_IPV6):
return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, NULL,
- skb, NULL, dev, seg6_input_core);
+ skb, NULL, dev, seg6_input_core_nf);
}
return -EINVAL;
@@ -621,6 +648,17 @@ drop:
return err;
}
+static int seg6_output_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_output_core(net, sk, skb);
+}
+
static int seg6_output_nf(struct net *net, struct sock *sk, struct sk_buff *skb)
{
struct net_device *dev = skb_dst(skb)->dev;
@@ -628,10 +666,10 @@ static int seg6_output_nf(struct net *ne
switch (skb->protocol) {
case htons(ETH_P_IP):
return NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb,
- NULL, dev, seg6_output_core);
+ NULL, dev, seg6_output_core_nf);
case htons(ETH_P_IPV6):
return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, sk, skb,
- NULL, dev, seg6_output_core);
+ NULL, dev, seg6_output_core_nf);
}
return -EINVAL;
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -24,6 +24,7 @@
#include <net/addrconf.h>
#include <net/ip6_route.h>
#include <net/dst_cache.h>
+#include <net/dst_metadata.h>
#include <net/ip_tunnels.h>
#ifdef CONFIG_IPV6_SEG6_HMAC
#include <net/seg6_hmac.h>
@@ -200,6 +201,21 @@ static struct seg6_local_lwt *seg6_local
return (struct seg6_local_lwt *)lwt->data;
}
+static bool seg6_local_skb_has_lwtstate(struct sk_buff *skb)
+{
+ struct dst_entry *dst;
+
+ if (unlikely(!skb_valid_dst(skb)))
+ return false;
+
+ dst = skb_dst(skb);
+ if (unlikely(!dst->lwtstate ||
+ dst->lwtstate->type != LWTUNNEL_ENCAP_SEG6_LOCAL))
+ return false;
+
+ return true;
+}
+
static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)
{
struct ipv6_sr_hdr *srh;
@@ -556,6 +572,17 @@ static int input_action_end_dx6_finish(s
return dst_input(skb);
}
+static int input_action_end_dx6_finish_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return input_action_end_dx6_finish(net, sk, skb);
+}
+
/* decapsulate and forward to specified nexthop */
static int input_action_end_dx6(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
@@ -576,7 +603,7 @@ static int input_action_end_dx6(struct s
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING,
dev_net(skb->dev), NULL, skb, skb->dev,
- NULL, input_action_end_dx6_finish);
+ NULL, input_action_end_dx6_finish_nf);
return input_action_end_dx6_finish(dev_net(skb->dev), NULL, skb);
drop:
@@ -644,6 +671,17 @@ static int input_action_end_dx4_finish(s
return dst_input(skb);
}
+static int input_action_end_dx4_finish_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return input_action_end_dx4_finish(net, sk, skb);
+}
+
static int input_action_end_dx4(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
{
@@ -664,7 +702,7 @@ static int input_action_end_dx4(struct s
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING,
dev_net(skb->dev), NULL, skb, skb->dev,
- NULL, input_action_end_dx4_finish);
+ NULL, input_action_end_dx4_finish_nf);
return input_action_end_dx4_finish(dev_net(skb->dev), NULL, skb);
drop:
@@ -1290,6 +1328,17 @@ static int seg6_local_input_core(struct
return rc;
}
+static int seg6_local_input_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_local_input_core(net, sk, skb);
+}
+
static int seg6_local_input(struct sk_buff *skb)
{
if (skb->protocol != htons(ETH_P_IPV6)) {
@@ -1300,7 +1349,7 @@ static int seg6_local_input(struct sk_bu
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_IN,
dev_net(skb->dev), NULL, skb, skb->dev, NULL,
- seg6_local_input_core);
+ seg6_local_input_core_nf);
return seg6_local_input_core(dev_net(skb->dev), NULL, skb);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0496/1059] mptcp: reject DATA_ACKs against a reversed send interval
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (494 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0495/1059] seg6: validate state in netfilter continuations Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0497/1059] ipv4: keep XFRM headers out of corked skb lengths Greg Kroah-Hartman
` (502 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Matthieu Baerts (NGI0), Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit d75e5cd72995ec2fa77ec77a593cea28e2490ff1 upstream.
ack_update_msk() samples snd_nxt before taking the data lock, but reads
snd_una after taking it. Concurrent transmission and ACK processing can
therefore leave the sampled upper bound behind snd_una. Active-open
completion also exposes a reversed interval when it initializes snd_una
to IDSN + 1 while the socket-owned state synchronization is deferred.
A peer-supplied 64-bit Data ACK half a sequence space away can pass both
wraparound comparisons against such an interval. The resulting snd_una
can make __mptcp_retrans() inflate a fragment's already_sent field. Later
ACKs can then underflow data_len and cause out-of-bounds page fragments
to be passed to TCP.
Read snd_nxt after acquiring the data lock and reject reversed intervals
before checking the received Data ACK. This keeps the interval shorter
than half the sequence space, so the existing upper-bound check cannot
accept an advance beyond snd_nxt. Preserve the existing handling of old
ACKs and keep the transmit fields under their existing socket locking.
Cc: stable@vger.kernel.org
Fixes: 7439d687b79c ("mptcp: avoid a few atomic ops in the rx path")
Fixes: 3f83d8a77eee ("mptcp: fix more tx path fields initialization")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20261104130747.1045741-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mptcp/options.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -1142,9 +1142,9 @@ static void ack_update_msk(struct mptcp_
struct sock *ssk,
struct mptcp_options_received *mp_opt)
{
- u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt);
+ u64 new_wnd_end, new_snd_una, old_snd_una;
struct sock *sk = (struct sock *)msk;
- u64 old_snd_una;
+ u64 snd_nxt;
mptcp_data_lock(sk);
@@ -1153,10 +1153,14 @@ static void ack_update_msk(struct mptcp_
* more dangerous than missing an ack
*/
old_snd_una = msk->snd_una;
+ snd_nxt = READ_ONCE(msk->snd_nxt);
new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64);
- /* ACK for data not even sent yet? Ignore.*/
- if (unlikely(after64(new_snd_una, snd_nxt)))
+ /* The active-open state sync can defer the snd_nxt update. Do not
+ * accept an ACK against a reversed interval, or beyond snd_nxt.
+ */
+ if (unlikely(before64(snd_nxt, old_snd_una) ||
+ after64(new_snd_una, snd_nxt)))
new_snd_una = old_snd_una;
new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0497/1059] ipv4: keep XFRM headers out of corked skb lengths
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (495 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0496/1059] mptcp: reject DATA_ACKs against a reversed send interval Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0498/1059] ipv4: fib_trie: prevent speculative out-of-bounds child access Greg Kroah-Hartman
` (501 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 0f47fce51a98d3d9f439c16861d519a7b833a176 upstream.
__ip_append_data() allocates space for dst.header_len in the first skb,
but includes that space in skb->len until __ip_make_skb() pulls it.
Fragment accounting uses an MTU that already excludes the XFRM headers.
As a result, the next skb can have a fraggap larger than its capped
datalen, and skb_copy_and_csum_bits() can overwrite its shared info.
For example, five AH tunnel states can reserve 500 bytes while leaving
an effective MTU of 348. With 40 bytes of IPv4 options, the second skb
has room for 288 bytes of fragment data but receives a 500-byte gap
copy. The overwritten shared info is subsequently consumed by the skb
release paths.
Reserve the XFRM headers together with the link-layer headroom instead.
This keeps skb->len, the gap-copy offsets and the trim lengths relative
to the IPv4 packet throughout corking. The network and transport header
addresses and the headroom available to XFRM at output are unchanged.
Both paged and linear allocations, including subsequent corked appends,
use the corrected accounting.
Fixes: 353e5c9abd90 ("ipv4: Fix IPsec slowpath fragmentation problem")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Link: https://patch.msgid.link/20261030042229.74068-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/ip_output.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1151,16 +1151,16 @@ alloc_new_skb:
*/
skb->ip_summed = csummode;
skb->csum = 0;
- skb_reserve(skb, hh_len);
+ skb_reserve(skb, hh_len + exthdrlen);
/*
* Find where to start putting bytes.
*/
- data = skb_put(skb, fraglen + exthdrlen - pagedlen);
- skb_set_network_header(skb, exthdrlen);
+ data = skb_put(skb, fraglen - pagedlen);
+ skb_reset_network_header(skb);
skb->transport_header = (skb->network_header +
fragheaderlen);
- data += fragheaderlen + exthdrlen;
+ data += fragheaderlen;
if (fraggap) {
skb->csum = skb_copy_and_csum_bits(
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0498/1059] ipv4: fib_trie: prevent speculative out-of-bounds child access
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (496 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0497/1059] ipv4: keep XFRM headers out of corked skb lengths Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0499/1059] ipv6: fix cached route reuse for control messages Greg Kroah-Hartman
` (500 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Daniël Trujillo,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniël Trujillo <datrujillo@nvidia.com>
commit fd3d73286662950656f54616d0b3fea29e2dc99a upstream.
fib_table_lookup() checks the child index against the bounds before
passing it to get_child_rcu().
The index is derived from the lookup key, which in turn is derived from
flp->daddr. A userspace process can therefore influence the index by
triggering lookups for chosen destination IPv4 addresses.
If this bounds check is mispredicted as in-bounds, an out-of-bounds index
can be transiently passed to get_child_rcu(). The value loaded beyond the
child array is then treated as a node pointer. A later transient
dereference of that pointer can cause a data-dependent cache footprint.
This was found during Spectre-v1 research. Leakage was demonstrated with
instrumentation that delays branch resolution with a CLFLUSH before the
mispredicted branch and makes the leaked location deterministic for
reproducible measurement. In that setup, a userspace-controlled IPv4
lookup key was able to trigger a transient out-of-bounds child access.
The transient use of the loaded value as a pointer caused a
data-dependent cache footprint that was recoverable from userspace using
Prime+Probe. A real-world attacker would likely need to delay branch
resolution, which was not demonstrated end-to-end without the added
CLFLUSH.
Sanitize the index with array_index_nospec() before accessing the child
array. This removed the observed leakage in the described setup.
Apply the hardening before setting cindex in fib_table_lookup(), because
cindex can later be used by the backtrace path to load another child
pointer. fib_find_node() has the same pattern, with the checked index
derived from a user-provided key in fib_table_insert() and
fib_table_delete(). leaf_walk_rcu() has a similar checked cindex before
get_child_rcu(), and the traversed state can be influenced by userspace
actions. fib_find_node() runs under RTNL and leaf_walk_rcu() is not on
the packet lookup hot path, so harden those analogous accesses in the
same way. Also harden fib_trie_get_next(), where a mispredicted loop
condition could transiently read one child past the array.
I see a slowdown of roughly 10% in a microbenchmark where we call
fib_table_lookup() with 64 routes directly from inside the kernel. I
observed no slowdown in a loopback UDP sendto() microbenchmark.
Fixes: 9f9e636d4f89 ("fib_trie: Optimize fib_table_lookup to avoid wasting time on loops/variables")
Cc: stable@vger.kernel.org
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Daniël Trujillo <datrujillo@nvidia.com>
Link: https://patch.msgid.link/20261106-fib-trie-nospec-v3-1-53da6550dcf8@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/fib_trie.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -60,6 +60,7 @@
#include <linux/export.h>
#include <linux/vmalloc.h>
#include <linux/notifier.h>
+#include <linux/nospec.h>
#include <net/net_namespace.h>
#include <net/inet_dscp.h>
#include <net/ip.h>
@@ -966,6 +967,8 @@ static struct key_vector *fib_find_node(
break;
}
+ index = array_index_nospec(index, 1ul << n->bits);
+
/* keep searching until we find a perfect match leaf or NULL */
} while (IS_TNODE(n));
@@ -1471,6 +1474,8 @@ int fib_table_lookup(struct fib_table *t
if (IS_LEAF(n))
goto found;
+ index = array_index_nospec(index, 1ul << n->bits);
+
/* only record pn and cindex if we are going to be chopping
* bits later. Otherwise we are just wasting cycles.
*/
@@ -1772,6 +1777,8 @@ static struct key_vector *leaf_walk_rcu(
if (cindex >> pn->bits)
break;
+ cindex = array_index_nospec(cindex, 1ul << pn->bits);
+
/* descend into the next child */
n = get_child_rcu(pn, cindex++);
if (!n)
@@ -1793,6 +1800,8 @@ static struct key_vector *leaf_walk_rcu(
continue;
}
+ cindex = array_index_nospec(cindex, 1ul << pn->bits);
+
/* grab the next available node */
n = get_child_rcu(pn, cindex++);
if (!n)
@@ -2444,7 +2453,10 @@ static struct key_vector *fib_trie_get_n
while (!IS_TRIE(pn)) {
while (cindex < child_length(pn)) {
- struct key_vector *n = get_child_rcu(pn, cindex++);
+ struct key_vector *n;
+
+ cindex = array_index_nospec(cindex, child_length(pn));
+ n = get_child_rcu(pn, cindex++);
if (!n)
continue;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0499/1059] ipv6: fix cached route reuse for control messages
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (497 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0498/1059] ipv4: fib_trie: prevent speculative out-of-bounds child access Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0500/1059] ipv6: reject routes without an inet6_dev Greg Kroah-Hartman
` (499 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Willem de Bruijn, Xia Yan,
Willem de Bruijn, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xia Yan <yanxia@cmss.chinamobile.com>
commit f778e80b3daf5033fb996f45c2b5d0ce1e82c0a7 upstream.
A connected IPv6 UDP or ping socket can reuse its cached route when an
SO_MARK cmsg requests another mark. A packet can then bypass a prohibit
rule instead of failing with EACCES.
ip6_sk_dst_lookup_flow() reads the cache even when connected is false.
UDP clears connected after parsing IP or socket control messages. Ping
always passes false.
Only read the cache when connected is true. Ordinary connected UDP
sends keep using the cache. Ping sends do a fresh lookup.
Found during code review of IPv6 UDP route caching. On UML, the same
connected-socket selftest fails four IPv6 cases before the fix and
passes all 54 with it.
Fixes: c6af0c227a22 ("ip: support SO_MARK cmsg")
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Link: https://lore.kernel.org/netdev/willemdebruijn.kernel.1e0038bcc3ef8@gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261109014400.9025-1-yanxia@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/ip6_output.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1278,7 +1278,7 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
* @sk: socket which provides the dst cache and route info
* @fl6: flow to lookup
* @final_dst: final destination address for ipsec lookup
- * @connected: whether @sk is connected or not
+ * @connected: whether the flow can use and update the socket dst cache
*
* This function performs a route lookup on the given flow with the
* possibility of using the cached route in the socket if it is valid.
@@ -1295,11 +1295,14 @@ struct dst_entry *ip6_sk_dst_lookup_flow
const struct in6_addr *final_dst,
bool connected)
{
- struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
+ struct dst_entry *dst;
- dst = ip6_sk_dst_check(sk, dst, fl6);
- if (dst)
- return dst;
+ if (connected) {
+ dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
+ dst = ip6_sk_dst_check(sk, dst, fl6);
+ if (dst)
+ return dst;
+ }
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_dst);
if (connected && !IS_ERR(dst))
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0500/1059] ipv6: reject routes without an inet6_dev
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (498 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0499/1059] ipv6: fix cached route reuse for control messages Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0501/1059] ipvs: Defer application parent freeing until after RCU readers Greg Kroah-Hartman
` (498 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Hangbin Liu,
Yingjie Wang, Ido Schimmel, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <1075151112@qq.com>
commit 08a1eb7a634f665718ebe74e0960e242f597135e upstream.
ip6_route_output() and ip6_route_lookup() can return an error-free route
whose rt6i_idev is NULL. Lowering an external nexthop device's MTU below
IPV6_MIN_MTU tears down its inet6_dev, while fib6_ifdown() leaves routes
using nexthop objects in the FIB.
An unprivileged user with CAP_NET_ADMIN in a private user and network
namespace can construct this state. Consumers which treat a route without
an error as usable can then dereference the NULL rt6i_idev. This was
reproduced as a KASAN NULL pointer dereference in ip6_tnl_xmit().
An audit of IPv6 route and tunnel users found this unchecked
ip6_dst_idev() dereference.
A similar missing inet6_dev check was fixed in commit 1b9b5323725e
("netfilter: ip6t_rpfilter: reject routes without inet6_dev"). However,
the route construction path still marks routes without an inet6_dev as
successful, leaving every consumer responsible for the same check.
Acquire the inet6_dev reference before initializing the destination. If a
non-reject route has no inet6_dev, initialize it as RTN_UNREACHABLE instead
of a successful route. Explicit reject routes keep their original type and
error. This establishes that ordinary error-free IPv6 routes have an
inet6_dev while retaining the existing defensive checks at callers.
The modified route object builds cleanly with W=1. A full x86_64 KASAN
bzImage build completes; it reports two pre-existing kernel-doc warnings
outside this change.
Tests:
- `make W=1 net/ipv6/route.o`
- full x86_64 KASAN `bzImage` build with `W=1`
- KASAN QEMU with an unprivileged user and network namespace: after
lowering the MTU, the stale route returned `No route to host`, a normal
route still resolved, and the collect_md trigger completed without
KASAN, oops, or panic
- `tools/testing/selftests/net/ip6_tunnel.sh` in the same KASAN QEMU
Fixes: 5b98324ebe29 ("ipv6: Allow routes to use nexthop objects")
Closes: https://lore.kernel.org/netdev/DMP4WRIOGMBX.3VW2KNLBGDZ0K@gmail.com/
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <1075151112@qq.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/tencent_91DA7FD8277B509C55906702D1E425FBC906@qq.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/route.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1137,6 +1137,12 @@ static void ip6_rt_init_dst(struct rt6_i
return;
}
+ /* addrconf_ifdown() removed inet6_dev. The device can't do IPv6. */
+ if (!rt->rt6i_idev) {
+ ip6_rt_init_dst_reject(rt, RTN_UNREACHABLE);
+ return;
+ }
+
rt->dst.error = 0;
rt->dst.output = ip6_output;
@@ -1171,10 +1177,10 @@ static void ip6_rt_copy_init(struct rt6_
const struct net_device *dev = nh->fib_nh_dev;
struct fib6_info *f6i = res->f6i;
+ rt->rt6i_idev = dev ? in6_dev_get(dev) : NULL;
ip6_rt_init_dst(rt, res);
rt->rt6i_dst = f6i->fib6_dst;
- rt->rt6i_idev = dev ? in6_dev_get(dev) : NULL;
rt->rt6i_flags = res->fib6_flags;
if (nh->fib_nh_gw_family) {
rt->rt6i_gateway = nh->fib_nh_gw6;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0501/1059] ipvs: Defer application parent freeing until after RCU readers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (499 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0500/1059] ipv6: reject routes without an inet6_dev Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0502/1059] ipvs: fix protocol data lifetime during namespace teardown Greg Kroah-Hartman
` (497 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengfeng Ye, Julian Anastasov,
Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <nicoyip.dev@gmail.com>
commit 1e0808008e44d736e57a897a51d14fa995099010 upstream.
unregister_ip_vs_app() removes each incarnation from its protocol list and
uses call_rcu() to defer freeing it, but frees the parent application
immediately. An RCU reader that already found an incarnation can still
access the parent through inc->app in ip_vs_app_inc_get().
During FTP helper module unload, the following interleaving is possible:
CPU 0 (RCU reader) CPU 1 (module unload)
tcp_app_conn_bind()
find inc in protocol list
unregister_ip_vs_app()
ip_vs_app_inc_release(inc)
list_del_rcu(&inc->p_list)
call_rcu(&inc->rcu_head, ...)
kfree(a)
ip_vs_app_inc_get(inc)
try_module_get(inc->app->module)
The helper module is already going away, so try_module_get() would fail,
but evaluating its argument first reads the freed parent. The subsequent
rcu_barrier() in pernet unregistration cannot protect this earlier free.
KASAN reported:
BUG: KASAN: slab-use-after-free in ip_vs_app_inc_get+0x7c/0x90
Call Trace:
ip_vs_app_inc_get+0x7c/0x90
tcp_app_conn_bind+0x1bc/0x290
ip_vs_conn_new+0x1915/0x20d0
ip_vs_schedule+0x697/0xea0
tcp_conn_schedule+0x489/0x820
ip_vs_in_hook+0x7bf/0x1f40
Allocated by task 88:
kmemdup_noprof+0x20/0x50
register_ip_vs_app+0x12d/0x2c0
__ip_vs_ftp_init+0x56/0x160 [ip_vs_ftp]
Freed by task 104:
kfree+0x131/0x3c0
unregister_ip_vs_app+0x2f4/0x5b0
unregister_pernet_operations+0x232/0x490
unregister_pernet_subsys+0x1c/0x30
__do_sys_delete_module+0x346/0x510
Use kfree_rcu() with the existing rcu_head to keep the parent alive until
these readers finish. Successful helper references already prevent normal
module unload, and incarnation RCU callbacks do not access the parent.
Fixes: 363c97d7435e ("ipvs: convert app locks")
Cc: stable@vger.kernel.org
Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -243,7 +243,7 @@ void unregister_ip_vs_app(struct netns_i
}
list_del(&a->a_list);
- kfree(a);
+ kfree_rcu(a, rcu_head);
/* decrease the module use count */
ip_vs_use_count_dec();
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0502/1059] ipvs: fix protocol data lifetime during namespace teardown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (500 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0501/1059] ipvs: Defer application parent freeing until after RCU readers Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0503/1059] hv_netvsc: Stop PPI parsing on invalid metadata Greg Kroah-Hartman
` (496 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengfeng Ye, Julian Anastasov,
Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <nicoyip.dev@gmail.com>
commit 832aa3e89e806bb2667fe4e656b705f4088b3c9d upstream.
IPVS frees its per-net protocol data before control cleanup cancels
defense work and unregisters the sysctl table. A defense worker can load
a protocol data pointer, then namespace cleanup can unlink and free that
object before the worker dereferences pd->pp or pd->next. The worker's
securetcp_lock does not serialize with protocol cleanup. A concurrent
defense-mode sysctl write can reach the same timeout update path.
KASAN reported:
BUG: KASAN: slab-use-after-free in ip_vs_protocol_timeout_change
Workqueue: events_long defense_work_handler
Call Trace:
ip_vs_protocol_timeout_change+0x1b4/0x1e0
update_defense_level+0x63e/0xd80
defense_work_handler+0x1e/0xc0
Allocated by task 125:
ip_vs_protocol_net_init+0xda/0x2f0
__ip_vs_init+0x16b/0x240
setup_net+0xfc/0x310
Freed by task 12:
ip_vs_protocol_net_cleanup+0x1d6/0x2e0
__ip_vs_cleanup_batch+0x7d/0x100
cleanup_net+0x38c/0x770
Run control cleanup before protocol cleanup so that defense work and
active sysctl handlers have finished before their protocol data is freed.
Initialize protocols before exposing the control interface, and unwind
in reverse order, to enforce the same lifetime on initialization failure.
Protocol initialization and exit do not depend on control state.
Fixes: 9330419d9aa4 ("IPVS: netns, use ip_vs_proto_data as param.")
Cc: stable@vger.kernel.org
Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -2324,12 +2324,12 @@ static int __net_init __ip_vs_init(struc
if (ip_vs_estimator_net_init(ipvs) < 0)
goto estimator_fail;
- if (ip_vs_control_net_init(ipvs) < 0)
- goto control_fail;
-
if (ip_vs_protocol_net_init(ipvs) < 0)
goto protocol_fail;
+ if (ip_vs_control_net_init(ipvs) < 0)
+ goto control_fail;
+
if (ip_vs_app_net_init(ipvs) < 0)
goto app_fail;
@@ -2349,10 +2349,10 @@ sync_fail:
conn_fail:
ip_vs_app_net_cleanup(ipvs);
app_fail:
- ip_vs_protocol_net_cleanup(ipvs);
-protocol_fail:
ip_vs_control_net_cleanup(ipvs);
control_fail:
+ ip_vs_protocol_net_cleanup(ipvs);
+protocol_fail:
ip_vs_estimator_net_cleanup(ipvs);
estimator_fail:
net->ipvs = NULL;
@@ -2369,8 +2369,8 @@ static void __net_exit __ip_vs_cleanup_b
ipvs = net_ipvs(net);
ip_vs_conn_net_cleanup(ipvs);
ip_vs_app_net_cleanup(ipvs);
- ip_vs_protocol_net_cleanup(ipvs);
ip_vs_control_net_cleanup(ipvs);
+ ip_vs_protocol_net_cleanup(ipvs);
ip_vs_estimator_net_cleanup(ipvs);
IP_VS_DBG(2, "ipvs netns %d released\n", ipvs->gen);
net->ipvs = NULL;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0503/1059] hv_netvsc: Stop PPI parsing on invalid metadata
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (501 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0502/1059] ipvs: fix protocol data lifetime during namespace teardown Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0504/1059] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Greg Kroah-Hartman
` (495 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Erni Sri Satya Vennela,
Haiyang Zhang, Wei Liu, Simon Horman, Dave Miller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
commit 19a227903e65c7a9c179156485660a4e017575fe upstream.
rndis_get_ppi() uses continue when a per-packet information entry has an
invalid size or offset, or cannot hold the requested metadata. However,
the remaining length and entry pointer are only updated at the bottom
of the loop. Each error path therefore retries the same invalid entry
indefinitely, repeatedly logging the error and preventing receive
processing from completing.
Return NULL on these validation failures instead of continuing. This
terminates the lookup when malformed metadata is encountered while
preserving the existing behavior for valid entries.
The issue was reported through an internal bug-tracking system and
confirmed by manual code inspection. The pre-fix hang has not been
reproduced locally.
Fixes: 44144185951a ("hv_netvsc: Add validation for untrusted Hyper-V values")
Cc: stable@vger.kernel.org
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Wei Liu <liuwe@microsoft.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/hyperv/rndis_filter.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -402,12 +402,12 @@ static inline void *rndis_get_ppi(struct
/* Validate ppi_offset and ppi_size */
if (ppi->size > len) {
netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size);
- continue;
+ return NULL;
}
if (ppi->ppi_offset >= ppi->size) {
netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset);
- continue;
+ return NULL;
}
if (ppi->type == type && ppi->internal == internal) {
@@ -415,7 +415,7 @@ static inline void *rndis_get_ppi(struct
if (ppi->size - ppi->ppi_offset < ppi_size) {
netdev_err(ndev, "Invalid ppi: size %u ppi_offset %u\n",
ppi->size, ppi->ppi_offset);
- continue;
+ return NULL;
}
return (void *)((ulong)ppi + ppi->ppi_offset);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0504/1059] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (502 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0503/1059] hv_netvsc: Stop PPI parsing on invalid metadata Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0505/1059] net/sched: sch_teql: reject qdiscs from another network namespace Greg Kroah-Hartman
` (494 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, AutonomousCodeSecurity,
Cen Zhang (Microsoft), Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
commit 17c2e41736b62cfe444c64d67860b1fbc1e886ac upstream.
recent_proc_net_exit() removes the /proc/net/xt_recent/<name> entries of
a dying network namespace while holding spin_lock_bh(&recent_lock).
remove_proc_entry() may sleep: proc_entry_rundown() waits until every
task that is still inside the entry's file operations has left. A reader
of such an entry is counted in by proc_reg_read() before
recent_seq_start() takes recent_lock. So if a read is in flight when the
namespace is torn down, cleanup_net() sleeps in atomic context holding
the spinlock that the reader is spinning on, and neither side can ever
make progress.
An unprivileged user can trigger this from a user namespace by adding a
rule with the "recent" match and reading its proc file while the
namespace is being destroyed. As recent_lock is global, every later
attempt to take it spins forever too: the spinning can spread to all
CPUs, and network namespace teardown stops system-wide.
BUG: sleeping function called from invalid context at
kernel/sched/completion.c:116
#3: (recent_lock){+...}-{3:3}, at: recent_net_exit+0x2b/0x140
Workqueue: netns cleanup_net
Call Trace:
proc_entry_rundown+0x185/0x1b0
remove_proc_entry+0x21a/0x520
recent_net_exit+0x7f/0x140
cleanup_net+0x414/0x8f0
...
rcu: INFO: rcu_preempt self-detected stall on CPU
Call Trace:
queued_spin_lock_slowpath+0x313/0xc20
recent_seq_start+0x87/0x1b0
seq_read_iter+0x265/0x11e0
proc_reg_read+0x1ab/0x270
Fix by taking recent_mutex instead of recent_lock. According to
commit a0e889bb1bdc ("[NETFILTER]: recent match: fix "sleeping function
called from invalid context""), recent_mutex is the lock to use here: it
protects recent_net->tables and was introduced so that proc entries are
created and removed without recent_lock held, because those calls may
sleep. hashlimit_proc_net_exit() does the same for xt_hashlimit.
Fixes: 665e205c16c1 ("netfilter: xt_recent: fix namespace destroy path")
Cc: stable@vger.kernel.org
Cc: AutonomousCodeSecurity@microsoft.com
Signed-off-by: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/xt_recent.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -649,14 +649,15 @@ static void __net_exit recent_proc_net_e
/* recent_net_exit() is called before recent_mt_destroy(). Make sure
* that the parent xt_recent proc entry is empty before trying to
- * remove it.
+ * remove it. Use recent_mutex instead of recent_lock since
+ * remove_proc_entry() may sleep.
*/
- spin_lock_bh(&recent_lock);
+ mutex_lock(&recent_mutex);
list_for_each_entry(t, &recent_net->tables, list)
remove_proc_entry(t->name, recent_net->xt_recent);
recent_net->xt_recent = NULL;
- spin_unlock_bh(&recent_lock);
+ mutex_unlock(&recent_mutex);
remove_proc_entry("xt_recent", net->proc_net);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0505/1059] net/sched: sch_teql: reject qdiscs from another network namespace
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (503 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0504/1059] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0506/1059] net/sched: act_ife: encode configured zero metadata values Greg Kroah-Hartman
` (493 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, shaos, Victor Nogueira,
Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 1ae84bdd736f8fab30180159996e1d193f8029ff upstream.
Reported by shaos <shawnq1@163.com> with a reproducer, which was
reproduced and verified in our test environment.
The issue:
The teql master devices are created once in the initial network
namespace and their Qdisc_ops are global. teql_qdisc_init() takes the
teql_master embedded in the registered sch->ops and uses it without
checking whether the new qdisc's device lives in the same network
namespace as the master. A qdisc created in another netns can therefore
attach to the init-net master and change its MTU and flags.
The Fix:
Reject a teql qdisc whose device is not in the master's network
namespace with -EOPNOTSUPP and an extack message; same-netns teql still
works.
Initialize the private skb queue before any validation so every
constructor failure path, including qdisc_create_dflt(), which resets the
qdisc before destroying it, sees an initialized empty queue.
Conditions to recreate the bug:
CONFIG_NET_SCH_TEQL=y, CONFIG_DUMMY=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y.
As an unprivileged UID, unshare a user and network namespace, create a
dummy device, set its MTU to 60000, and add a root teql0 qdisc:
unshare -Urn
ip link add dummy0 type dummy
ip link set dummy0 mtu 60000
tc qdisc add dev dummy0 root teql0
The init-net teql0 device changes from MTU 1500 to 60000. A pfifo control
on the same device leaves the MTU unchanged, and a direct MTU change on
init-net teql0 is denied. The namespace needs CAP_NET_ADMIN; no init-net
privilege is required. With the fix the attach fails with
"Operation not supported" and the init-net MTU stays 1500.
Fixes: 7316ae88c43d ("net_sched: make traffic control network namespace aware")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144830.67948-1-shawnq1@163.com/
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v1.r2.20261031160050-3%40mojatatu.com
Link: https://lore.kernel.org/netdev/179366641863.488856.17368571591466000274@kernel.org/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-3@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/sch_teql.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -198,6 +198,8 @@ static int teql_qdisc_init(struct Qdisc
struct Qdisc *first;
unsigned long flags;
+ skb_queue_head_init(&q->q);
+
if (dev->hard_header_len > m->dev->hard_header_len)
return -EINVAL;
@@ -209,9 +211,12 @@ static int teql_qdisc_init(struct Qdisc
return -EOPNOTSUPP;
}
- q->m = m;
+ if (dev_net(dev) != dev_net(m->dev)) {
+ NL_SET_ERR_MSG_MOD(extack, "teql master is in a different network namespace");
+ return -EOPNOTSUPP;
+ }
- skb_queue_head_init(&q->q);
+ q->m = m;
raw_spin_lock_irqsave(&m->slaves_lock, flags);
first = rcu_dereference_protected(m->slaves, lockdep_is_held(&m->slaves_lock));
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0506/1059] net/sched: act_ife: encode configured zero metadata values
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (504 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0505/1059] net/sched: sch_teql: reject qdiscs from another network namespace Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0507/1059] net/sched: act_ife: require a full Ethernet header on egress Greg Kroah-Hartman
` (492 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, shaos, Victor Nogueira,
Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 7d02c07c738bf5c4b9a7d7ef498fbf465c446853 upstream.
Reported by shaos <shawnq1@163.com> with a reproducer for the 32-bit
case, which was reproduced and verified in our test environment.
The issue:
ife_check_meta_u32() and ife_check_meta_u16() both reserve eight bytes
of metadata for a configured value even when that value is zero, but the
matching encoder returns without calling ife_tlv_meta_encode(). The
encoder therefore writes neither the TLV header nor its value, while the
enclosing IFE length still includes the reserved bytes, exposing stale
skb headroom contents to the peer.
The 32-bit helper has been present since the IFE action was introduced
(v4.6); the 16-bit helper was added with the 16-bit metadata helpers used
by the skbtcindex callback (v4.9). Both defects predate the oldest
supported stable kernel (5.10), so they are fixed together in this patch.
Each hunk keeps its own Fixes: tag for provenance.
The fix:
Encode any configured value, including zero; skip the TLV only when
there is neither a configured nor a runtime value. The runtime fallback
is unchanged.
A raw TCA_IFE_METALST netlink request is needed to express the
configured zero: the IFE_META_SKBMARK attribute carries four zero
payload bytes for the u32 helper, and IFE_META_TCINDEX two zero payload
bytes for the 16-bit helper (not an absent or zero-length attribute).
Stock tc cannot build these requests; "use mark 0x0" emits no mark
attribute and "allow mark" emits a zero-length one.
Conditions to recreate the bug:
CONFIG_NET_ACT_IFE=y, CONFIG_NET_IFE_SKBMARK=y,
CONFIG_NET_IFE_SKBTCINDEX=y, CONFIG_NET_CLS_MATCHALL=y,
CONFIG_NET_SCH_INGRESS=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y,
CONFIG_VETH=y. In a fresh user and network namespace create a veth pair
and attach clsact to the egress side. Install a matchall filter whose
ife encode action carries a zero skb mark (or a zero tcindex) in
TCA_IFE_METALST. Send a frame through the veth and inspect the IFE
metadata in the received frame. The metadata region is eight bytes but
holds neither a valid TLV header nor a value; it exposes prior headroom
contents. Setting the value to a nonzero one does not trigger the leak.
The namespace needs CAP_NET_ADMIN; no additional privilege is required.
With the fix the zero TLVs are 0001000800000000 (u32) and
0005000600000000 (u16).
Fixes: ef6980b6becb ("introduce IFE action")
Fixes: 6a5d58b67e20 ("net sched ife action: add 16 bit helpers")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144739.61342-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-1@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/act_ife.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -49,8 +49,7 @@ int ife_encode_meta_u16(u16 metaval, voi
edata = *(u16 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htons(edata);
@@ -93,8 +92,7 @@ int ife_encode_meta_u32(u32 metaval, voi
edata = *(u32 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htonl(edata);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0507/1059] net/sched: act_ife: require a full Ethernet header on egress
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (505 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0506/1059] net/sched: act_ife: encode configured zero metadata values Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0508/1059] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Greg Kroah-Hartman
` (491 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko (nipa), shaos,
Victor Nogueira, Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 11dbce09083473249c3843ff31bf8d8fa01bdeef upstream.
This is a followup of commit 5b483f7791b0 ("net/sched: act_ife: Only
operate on Ethernet frames") as reported by Sashiko.
The finding was raised by both Sashiko providers (nipa and gemini)
while reviewing the parent patchset. shaos <shawnq1@163.com>
independently reported the same undersized-egress path with a
reproducer, which was reproduced and verified in our test environment.
The issue:
On egress tcf_ife_is_eth_skb() only checks the device type; it does not
check that the skb carries a full Ethernet header. For an Ethernet or
loopback device it returns true even when the skb has no Ethernet
header. tcf_ife_encode() then calls ife_encode(), which copies ETH_HLEN
bytes from skb->data. A short skb therefore reads past its linear data
and the copied bytes, including stale kernel memory, are emitted in the
outer Ethernet header.
The parent commit fixed the reported ingress mac_len case but left the
egress path without a length check.
A total-length test is not sufficient: a non-GSO TUN skb can have a
large total length while only a single byte sits in the linear area, so
ife_encode() still reads past the linear header. Require instead that
the Ethernet header the encoder copies is present in the linear part of
the skb.
The Fix:
On egress require pskb_may_pull(skb, ETH_HLEN) before encoding, which
ensures the Ethernet header is present in the linear data ife_encode()
copies from; the ingress mac_len check is unchanged. A short egress skb
is now dropped instead of being encoded.
Conditions to recreate the bug:
CONFIG_NET_ACT_IFE=y, CONFIG_NET_CLS_MATCHALL=y, CONFIG_NET_SCH_INGRESS=y,
CONFIG_TUN=y, CONFIG_NET_ACT_MIRRED=y. In two user and network
namespaces (a victim and an attacker), open a TUN device in IFF_TUN mode
and attach clsact to it and to lo. Redirect ingress traffic from the TUN
device to lo egress with mirred, and install an ife encode action on lo
egress:
tc qdisc add dev <tun> clsact
tc qdisc add dev lo clsact
tc filter add dev <tun> ingress matchall action mirred egress \
redirect dev lo
tc filter add dev lo egress matchall action ife encode use mark 1 \
action ok
Send a TUN packet shorter than ETH_HLEN (a one-byte payload is enough)
and receive the emitted frame on the other side. Without the fix the
outer Ethernet header contains bytes copied past the short packet; with
the fix the short skb is dropped. The attacker needs CAP_NET_ADMIN in
its user namespace; no init-net privilege is required.
The same path is reachable when the total length is large but the
Ethernet header is not linear: write a non-GSO virtio header with
hdr_len=1 followed by an 8192-byte packet so that only one byte stays
linear. Without the fix the copied header reads past the linear data;
with the fix the header is pulled into the linear area before the copy.
Fixes: 295a6e06d21e ("net/sched: act_ife: Change to use ife module")
Reported-by: Sashiko (nipa) <sashiko-bot@kernel.org>
Reported-by: Sashiko (gemini) <sashiko-bot@kernel.org>
Reported-by: shaos <shawnq1@163.com>
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260821164031.32824-1-victor%40mojatatu.com
Link: https://sashiko.dev/#/patchset/20260821164031.32824-1-victor@mojatatu.com
Link: https://lore.kernel.org/netdev/20261022144736.61227-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-2@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/act_ife.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -870,13 +870,16 @@ drop:
* is an Ethernet header because the skb could've been redirected with mirred
* from a non-Ethernet device.
*/
-static bool tcf_ife_is_eth_skb(const struct sk_buff *skb)
+static bool tcf_ife_is_eth_skb(struct sk_buff *skb)
{
if (skb->dev->type != ARPHRD_ETHER &&
skb->dev->type != ARPHRD_LOOPBACK)
return false;
- return !skb_at_tc_ingress(skb) || skb->mac_len == ETH_HLEN;
+ if (skb_at_tc_ingress(skb))
+ return skb->mac_len == ETH_HLEN;
+
+ return pskb_may_pull(skb, ETH_HLEN);
}
static int tcf_ife_act(struct sk_buff *skb, const struct tc_action *a,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0508/1059] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (506 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0507/1059] net/sched: act_ife: require a full Ethernet header on egress Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0509/1059] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Greg Kroah-Hartman
` (490 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Menninger, Anna Schumaker
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
commit 151d95a1e696979a7d54b23c96338754be2fcc1f upstream.
When processing an out-of-order OPEN stateid on an NFSv4.1 or later
mount, nfs_set_open_stateid_locked() waits for stateid updates to be
processed in order. A five-second timeout is intended to prevent
indefinite waits when preceding updates never arrive.
However, each iteration calls schedule_timeout() with a fresh
five-second timeout. An update to the shared open state can wake the
caller without satisfying its ordering check. The remaining timeout
is then discarded, and the next iteration starts another full wait.
Under sustained concurrent OPEN/CLOSE activity on the same open state,
repeated wakeups can prevent the timeout from ever expiring. Some
tasks can remain stuck in update_open_stateid() while others continue
making progress.
Compute a single deadline on entry and pass only the remaining time
to schedule_timeout(). Once the deadline expires, take the existing
timeout path rather than starting another wait. This prevents
wakeups from extending the wait indefinitely.
Observed on Linux 6.8.0 and reproduced on 7.3.0 with 96 concurrent
O_RDWR|O_TRUNC open/close loops on one NFSv4.1/TCP file (nconnect=16).
Ten workers made no progress for over 300 seconds while others ran.
With the fix, all workers resumed after transient stalls.
Fixes: c9399f21c215 ("NFSv4: Fix OPEN / CLOSE race")
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/nfs/nfs4proc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1695,6 +1695,8 @@ static void nfs_set_open_stateid_locked(
{
DEFINE_WAIT(wait);
int status = 0;
+ unsigned long deadline = jiffies + 5 * HZ;
+ signed long remaining;
for (;;) {
if (nfs_stateid_is_sequential(state, stateid))
@@ -1729,7 +1731,8 @@ static void nfs_set_open_stateid_locked(
if (!fatal_signal_pending(current) &&
!nfs_current_task_exiting()) {
- if (schedule_timeout(5*HZ) == 0)
+ remaining = (long)(deadline - jiffies);
+ if (remaining <= 0 || schedule_timeout(remaining) == 0)
status = -EAGAIN;
else
status = 0;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0509/1059] openvswitch: advance by the real header length in get_ipv6_ext_hdrs()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (507 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0508/1059] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0510/1059] PM: runtime: Update last_busy in rpm_resume() for active devices Greg Kroah-Hartman
` (489 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Simon Horman, Aaron Conole, Eelco Chaudron, Paolo Abeni
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit dbce972650ed6348e3d3856e49308aa5603e02a7 upstream.
get_ipv6_ext_hdrs() walks the IPv6 extension header chain to fill
key->ipv6.exthdrs, but advances to the next header with ipv6_optlen()
whatever the current header is. That is only right for Hop-by-Hop,
Destination Options and Routing headers:
- an Authentication Header is ((hdrlen + 2) << 2) bytes long
(ipv6_authlen()), so with hdrlen = 4 the walk skips 40 bytes instead
of 24 and reads the next "header" from the ICV and payload;
- a Fragment header is always 8 bytes, and the byte read as hdrlen is
its Reserved field, which the sender controls and receivers ignore,
so a non-zero value makes the walk skip up to 2048 bytes and miss
the headers that follow;
- in a non-first fragment nothing after the Fragment header is a
header at all, it is the middle of the fragmentable part, yet the
walk keeps parsing it as an extension header chain.
In all cases the OFPIEH12_* bits stored in key->ipv6.exthdrs depend on
bytes chosen by the sender rather than on the headers that are actually
present: payload bytes that look like another AH or a Hop-by-Hop header
add OFPIEH12_UNREP/OFPIEH12_UNSEQ, and real headers after a Fragment
header can go unreported. Flows that match on OVS_KEY_ATTR_IPV6_EXTHDRS
then classify such packets wrongly. There is no memory safety issue,
skb_header_pointer() bounds every read.
Advance by sizeof(struct frag_hdr) for Fragment headers and by
ipv6_authlen() for AH, and stop at the Fragment header if its offset is
non-zero, as ipv6_find_hdr() does.
Fixes: 28a3f0601727 ("net: openvswitch: IPv6: Add IPv6 extension header support")
Link: https://lore.kernel.org/all/178905555085.219967.6617611783437228045@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Eelco Chaudron <echaudron@ovn.org>
Link: https://patch.msgid.link/20261102-ovs-exthdrs-v2-1-21ceef6a243d@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/openvswitch/flow.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -371,11 +371,28 @@ static void get_ipv6_ext_hdrs(struct sk_
return;
}
+ if (next_type == IPPROTO_FRAGMENT) {
+ struct frag_hdr _fh, *fh;
+
+ fh = skb_header_pointer(skb, start, sizeof(_fh), &_fh);
+ if (!fh)
+ break;
+ /* Only the first fragment has the headers that follow. */
+ if (fh->frag_off & htons(IP6_OFFSET))
+ break;
+ start += sizeof(_fh);
+ next_type = fh->nexthdr;
+ continue;
+ }
+
hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
if (!hp)
break;
+ if (next_type == IPPROTO_AH)
+ start += ipv6_authlen(hp);
+ else
+ start += ipv6_optlen(hp);
next_type = hp->nexthdr;
- start += ipv6_optlen(hp);
}
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0510/1059] PM: runtime: Update last_busy in rpm_resume() for active devices
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (508 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0509/1059] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0511/1059] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Greg Kroah-Hartman
` (488 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Brian Norris, Rafael J. Wysocki,
Alan Stern
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 55b2b8af704f845e01fa2f31ee259b07641ce3a9 upstream.
Setting an autosuspend delay for a device can be expected to cause a
runtime suspend of the device after calling, say, pm_runtime_put() to
be deferred, so the time between the last successful attempt to resume
the device and its subsequent suspend is at least equal to the
autosuspend delay.
However, that expectation is only met after the device has been actually
resumed in rpm_resume() by invoking its runtime resume callback. If the
runtime PM status of the device is already "active" when rpm_resume()
runs for it, the device's last_busy timestamp is not updated which may
allow a subsequent pm_runtime_put() invocation (or similar) to suspend
it right away.
This is arguably inconsistent and confusing, so make rpm_resume() also
update the device's last_busy timestamp when it finds that the device is
already "active" and it is about to return 1 early.
Fixes: 56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
Link: https://lore.kernel.org/linux-pm/CAJZ5v0jTX1FgeS9FCV=+V4uacSgLQBVsSPnU27ybgUGg57GUOA@mail.gmail.com/
Reported-by: Brian Norris <briannorris@chromium.org>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/13032301.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/power/runtime.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -797,6 +797,12 @@ static int rpm_resume(struct device *dev
pm_runtime_deactivate_timer(dev);
if (dev->power.runtime_status == RPM_ACTIVE) {
+ /*
+ * The attempt to resume the device means that it is needed for
+ * something, so update its last_busy timestamp as in the case
+ * in which it actually resumes below.
+ */
+ pm_runtime_mark_last_busy(dev);
retval = 1;
goto out;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0511/1059] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (509 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0510/1059] PM: runtime: Update last_busy in rpm_resume() for active devices Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0512/1059] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Greg Kroah-Hartman
` (487 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, YuanZhe Liu, Bartosz Golaszewski,
Luiz Augusto von Dentz
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit eeca795cec6d9c6c193c2c1bd0cb26cde44f9fc3 upstream.
qca_debugfs_init() creates an "ibs" directory under hdev->debugfs and
stores pointers to fields of struct qca_data in the debugfs files.
qca_close() frees qca_data without removing that directory, while
hdev->debugfs is only removed when the HCI device is released. The HCI
device can outlive the driver data, for example when an HCI socket still
references it, so reading or writing one of the ibs files then
dereferences freed memory.
Store the directory dentry in struct qca_data and remove the directory
with debugfs_remove_recursive() before qca_data is freed.
debugfs_remove() waits for callers that are already inside the file
operations, and any later access fails with -EIO instead of reaching the
debugfs helpers. This covers the two writable files as well.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102113654.8724-1-25031212351%40stu.xidian.edu.cn
Fixes: 0ff252c1976d ("Bluetooth: hciuart: Add support QCA chipset for UART")
Cc: stable@vger.kernel.org
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/bluetooth/hci_qca.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -161,6 +161,7 @@ struct qca_data {
struct delayed_work ctrl_memdump_timeout;
struct qca_memdump_data *qca_memdump;
unsigned long flags;
+ struct dentry *debugfs_ibs_dir;
struct completion drop_ev_comp;
wait_queue_head_t suspend_wait_q;
enum qca_memdump_states memdump_state;
@@ -649,6 +650,7 @@ static void qca_debugfs_init(struct hci_
return;
ibs_dir = debugfs_create_dir("ibs", hdev->debugfs);
+ qca->debugfs_ibs_dir = ibs_dir;
/* read only */
mode = 0444;
@@ -724,6 +726,9 @@ static int qca_close(struct hci_uart *hu
hu->priv = NULL;
+ debugfs_remove_recursive(qca->debugfs_ibs_dir);
+ qca->debugfs_ibs_dir = NULL;
+
kfree(qca);
return 0;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0512/1059] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (510 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0511/1059] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0513/1059] crypto: essiv - fix use-after-free in AEAD path Greg Kroah-Hartman
` (486 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 1f2ac56137c51be0601e18a163d817e02a15913f upstream.
Reading buffered ERTM data after ACL link loss can clear local busy and
send a supervisory frame after l2cap_conn_del() has destroyed the HCI
channel, which oopses on a NULL pointer in hci_send_acl(). The socket still
owns its L2CAP channel, so its lifetime does not protect the underlying HCI
channel.
Require BT_CONNECTED before clearing local busy in recvmsg. The socket lock
already held here serializes this check and send with teardown, which
closes the socket before the HCI channel is destroyed. Continue to allow
buffered data to be read after disconnection.
AI assistance was used.
Fixes: 61aa4f5b9f43 ("Bluetooth: Use the transmit state machine for busy state changes")
Cc: stable@vger.kernel.org # needs adjustments for 5.15
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bluetooth/l2cap_sock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1273,7 +1273,8 @@ static int l2cap_sock_recvmsg(struct soc
* available. This avoids resending large numbers of
* frames.
*/
- if (test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) &&
+ if (sk->sk_state == BT_CONNECTED &&
+ test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) &&
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf >> 1)
l2cap_chan_busy(pi->chan, 0);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0513/1059] crypto: essiv - fix use-after-free in AEAD path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (511 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0512/1059] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0514/1059] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Greg Kroah-Hartman
` (485 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jérémy Jean, Herbert Xu
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
commit e9ce64dce975a14700e835003847415e29918474 upstream.
The request that ESSIV submits to its wrapped AEAD transform may
finish before crypto_aead_encrypt() or crypto_aead_decrypt() returns.
In case this happens, essiv_aead_done() calls aead_request_complete()
on the original ESSIV request, which can end up freeing the request
before essiv_aead_crypt() resumes, creating a UAF:
BUG: KASAN: slab-use-after-free in essiv_aead_crypt+0x8e6/0x950
Read of size 8 at addr ffff888102af1360 by task init/66
Check the return status before dereferencing rctx after submitting that
request. If the operation did not return -EINPROGRESS or -EBUSY, then
the request cannot have been freed yet.
Fixes: be1eb7f78aa8 ("crypto: essiv - create wrapper template for ESSIV generation")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/essiv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/crypto/essiv.c
+++ b/crypto/essiv.c
@@ -250,7 +250,7 @@ static int essiv_aead_crypt(struct aead_
err = enc ? crypto_aead_encrypt(subreq) :
crypto_aead_decrypt(subreq);
- if (rctx->assoc && err != -EINPROGRESS && err != -EBUSY)
+ if (err != -EINPROGRESS && err != -EBUSY)
kfree(rctx->assoc);
return err;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0514/1059] fs/adfs: bound directory entry name length in adfs_fplus_getnext()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (512 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0513/1059] crypto: essiv - fix use-after-free in AEAD path Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0515/1059] fs/proc: fix the write length returned by proc_sys_call_handler() Greg Kroah-Hartman
` (484 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyungjung Joo, HyeongJun An,
Christian Brauner (Amutable)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <sammiee5311@gmail.com>
commit ebf5025b0d989f95542fc9da899b7de2fec499f2 upstream.
adfs_fplus_getnext() reads the per-entry name length bigdirobnamelen
straight from the on-disk big directory and passes it to
adfs_dir_copyfrom() as the copy length into obj->name[], a fixed
ADFS_MAX_NAME_LEN (260) byte buffer. adfs_dir_copyfrom() only bounds
the copy against the number of directory buffers, not the size of the
destination, so a crafted image with bigdirobnamelen larger than the
buffer overflows the stack-allocated object_info::name that
adfs_fplus_iterate() passes in.
adfs_object_fixup() may additionally append a four byte ",xyz" filetype
suffix, so the accepted length must also leave room for that.
The old-style directory parser (dir_f.c) already clamps names to
ADFS_F_NAME_LEN, and adfs_fplus_validate_header() validates the header
name fields, but the per-entry name length in the big directory format
was never checked. Reject over-long entries, using -EIO as elsewhere
in this file for a corrupt big directory.
Reported-by: Hyungjung Joo <jhj140711@gmail.com>
Closes: https://lore.kernel.org/all/CAP_j_b9BqyQrk3D5nj6RSa=eGcs2HkRYsWc3WdXeXp9O3=z4nQ@mail.gmail.com/
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://patch.msgid.link/20260715115231.1585166-1-sammiee5311@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/adfs/dir_fplus.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -192,6 +192,8 @@ adfs_fplus_getnext(struct adfs_dir *dir,
obj->indaddr = le32_to_cpu(bde.bigdirindaddr);
obj->attr = le32_to_cpu(bde.bigdirattr);
obj->name_len = le32_to_cpu(bde.bigdirobnamelen);
+ if (obj->name_len > ADFS_MAX_NAME_LEN - 4) /* leave room for ,xyz suffix */
+ return -EIO;
offset = adfs_fplus_offset(h, le32_to_cpu(h->bigdirentries));
offset += le32_to_cpu(bde.bigdirobnameptr);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0515/1059] fs/proc: fix the write length returned by proc_sys_call_handler()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (513 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0514/1059] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0516/1059] arm64: ptrace: dont warn on missing siginfo in a group-stop Greg Kroah-Hartman
` (483 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cheng Yongkang,
Christian Brauner (Amutable)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
commit fbdc020ee1b82079102e493aaa7200de5f497a38 upstream.
proc_sys_call_handler() reads the write length from iov_iter_count() and
copies that many bytes from the iterator into kbuf. A cgroup/sysctl BPF
program can replace the new value through bpf_sysctl_set_new_value() and
update count to the length of the replacement value. The handler then
returns that adjusted count as the number of bytes written, even though
the iterator originally held a different number of bytes.
If the replacement value is longer than the original input, ->write_iter()
reports more bytes than the iterator held. splice(2) passes that value to
iter_file_splice_write(), which subtracts it from the pipe length and
walks past the pipe head:
Splice Exceeded! ret=7 tot=1 left=0
Oops: general protection fault
RIP: 0010:iter_file_splice_write+0xb6f/0x1170
The write path consumes at most the original iterator length in
copy_from_iter_full() before the BPF hook runs. Return the smaller of the
adjusted and original counts on the write path, so an expanded BPF value
cannot exceed the iterator while a handler that reports a shorter parsed
length still produces a short write. The read path keeps using the
adjusted count for copy_to_iter().
Fixes: 4e63acdff864 ("bpf: Introduce bpf_sysctl_{get,set}_new_value helpers")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314073.648427.7892850166511253762@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/proc/proc_sysctl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -559,6 +559,8 @@ static ssize_t proc_sys_call_handler(str
struct ctl_table_header *head = grab_header(inode);
struct ctl_table *table = PROC_I(inode)->sysctl_entry;
size_t count = iov_iter_count(iter);
+ /* ->write_iter() must never report more than the iterator held */
+ size_t orig_count = count;
char *kbuf;
ssize_t error;
@@ -609,7 +611,8 @@ static ssize_t proc_sys_call_handler(str
goto out_free_buf;
}
- error = count;
+ /* the write path consumed at most the original iterator length */
+ error = write ? min(count, orig_count) : count;
out_free_buf:
kvfree(kbuf);
out:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0516/1059] arm64: ptrace: dont warn on missing siginfo in a group-stop
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (514 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0515/1059] fs/proc: fix the write length returned by proc_sys_call_handler() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0517/1059] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io() Greg Kroah-Hartman
` (482 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Gongyi, Oleg Nesterov,
Will Deacon, Catalin Marinas
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Gongyi <zhaogongyi@bytedance.com>
commit 5306f124f3171289b2ef5bac1e08aad175f66d1e upstream.
PTRACE_ATTACH to a group-stopped child can enter do_jobctl_trap(),
which calls ptrace_stop() without siginfo. If the tracer writes
NT_ARM_SYSTEM_CALL, system_call_set() can change syscallno from
NO_SYSCALL before update_syscall_orig_x0_after_ptrace() checks
last_siginfo. WARN_ON_ONCE(!info) then fires for a valid ptrace stop.
Keep the early return when siginfo is absent, but remove the warning.
This leaves orig_x0 untouched at a non-seized group-stop and preserves
the existing syscall-exit-stop handling.
Fixes: 88b839ce497c ("arm64: ptrace: Keep 'orig_x0' in-sync with x0 on syscall entry")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Gongyi <zhaogongyi@bytedance.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Will Deacon <will@kernel.org>
[catalin.marinas@arm.com: modified comment as per Will's suggestion]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/kernel/ptrace.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -577,8 +577,12 @@ static void update_syscall_orig_x0_after
if (regs->syscallno == NO_SYSCALL)
return;
- /* We should only be called when target is in a ptrace stop */
- if (WARN_ON_ONCE(!info))
+ /*
+ * For exit-stops, info is always non-NULL, but that's not true for other
+ * stops such as non-seized group-stops. In those cases, just return early
+ * as there's no need to update orig_x0 anyway.
+ */
+ if (!info)
return;
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0517/1059] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (515 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0516/1059] arm64: ptrace: dont warn on missing siginfo in a group-stop Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0518/1059] cpufreq: intel_pstate: Clear last written P-state value on suspend Greg Kroah-Hartman
` (481 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Li RongQing, Zhongqiu Han,
Rafael J. Wysocki
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <lirongqing@baidu.com>
commit 6bc092a0fc4d331a4adbbb664078af149c580834 upstream.
When policy->freq_table is built in acpi_cpufreq_cpu_init(), entries
that are not lower in frequency than the previous one are skipped.
For each remaining entry, freq_table[].driver_data stores the
original ACPI P-state index, so the index space of freq_table no
longer matches perf->states[].
extract_io() currently walks perf->states[] with index i and uses the
same i to index policy->freq_table[i]. When duplicate frequencies
exist, this can associate a P-state status with the frequency of a
different P-state. It can also access an invalid or sentinel entry in
freq_table when the number of entries in perf->states[] is greater than
the number of entries remaining in the frequency table.
extract_io() is used on ACPI_ADR_SPACE_SYSTEM_IO platforms by the
frequency verification path, which is enabled by the
acpi_pstate_strict module parameter. With the mismatched lookup,
check_freqs() can fail to match the frequency of the P-state that
drv_write() has already programmed. It then sleeps through all 100
iterations - at least ~1 ms of usleep_range() plus 100 cross-CPU
calls and I/O port reads, all with policy->rwsem held, and
.target_index() returns -EAGAIN, leaving perf->state at its previous
value while the hardware is running at the newly requested P-state.
The cpufreq core consequently keeps policy->cur at the old frequency.
Since __cpufreq_driver_target() returns early when the requested
frequency equals policy->cur, the driver is not called again for that
frequency and the control register is not rewritten. The hardware can
therefore remain at a frequency that differs from the frequency known
to the cpufreq core.
Fix this by iterating over policy->freq_table and using
pos->driver_data as the original ACPI P-state index when accessing
perf->states[], as extract_msr() already does.
Fixes: fe27cb358835 ("[CPUFREQ][2/8] acpi: reorganize code to make MSR support addition easier")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Cc: All applicable <stable@vger.kernel.org>
Link: https://patch.msgid.link/20260910111329.2220-2-lirongqing@baidu.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/acpi-cpufreq.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -200,14 +200,13 @@ static unsigned extract_io(struct cpufre
{
struct acpi_cpufreq_data *data = policy->driver_data;
struct acpi_processor_performance *perf;
- int i;
+ struct cpufreq_frequency_table *pos;
perf = to_perf_data(data);
- for (i = 0; i < perf->state_count; i++) {
- if (value == perf->states[i].status)
- return policy->freq_table[i].frequency;
- }
+ cpufreq_for_each_entry(pos, policy->freq_table)
+ if (value == perf->states[pos->driver_data].status)
+ return pos->frequency;
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0518/1059] cpufreq: intel_pstate: Clear last written P-state value on suspend
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (516 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0517/1059] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0519/1059] cpufreq: Cache post-resolution target frequency in __resolve_freq() Greg Kroah-Hartman
` (480 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zak Brighton Knight, Doug Smythies,
Rafael J. Wysocki, Zhongqiu Han, Viresh Kumar, Christian Loehle
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 02e77af824d5be3a94fdd885835a352f90d24c5c upstream.
Preserving cpu->pstate.current_pstate across system suspend-resume
cycles, when running in the passive mode with HWP disabled, is a mistake
because its value from before system suspend may become stale after the
subsequent system resume and in some cases it prevents MSR_IA32_PERF_CTL
from being updated properly after system resume [1].
Address this by clearing cpu->pstate.current_pstate after the governor
has been stopped during system suspend.
Fixes: 001c76f05b01 ("cpufreq: intel_pstate: Generic governors support")
Fixes: 4adcf2e5829f ("cpufreq: intel_pstate: Add ->offline and ->online callbacks")
Link: https://lore.kernel.org/linux-pm/20261027143725.3763827-1-zakbrightonknight@gmail.com/ [1]
Reported-by: Zak Brighton Knight <zakbrightonknight@gmail.com>
Reported-by: Doug Smythies <dsmythies@telus.net>
Cc: All applicable <stable@vger.kernel.org> # 342d3a73c5db cpufreq: Force passing target frequency to driver during resume
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Zak Brighton Knight <zakbrightonknight@gmail.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/14150222.uLZWGnKmhe@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/intel_pstate.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -3024,10 +3024,11 @@ static int intel_cpufreq_cpu_exit(struct
static int intel_cpufreq_suspend(struct cpufreq_policy *policy)
{
+ struct cpudata *cpu = all_cpu_data[policy->cpu];
+
intel_pstate_suspend(policy);
if (hwp_active) {
- struct cpudata *cpu = all_cpu_data[policy->cpu];
u64 value = READ_ONCE(cpu->hwp_req_cached);
/*
@@ -3038,6 +3039,17 @@ static int intel_cpufreq_suspend(struct
value &= ~HWP_DESIRED_PERF(~0L);
wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
WRITE_ONCE(cpu->hwp_req_cached, value);
+ } else {
+ /*
+ * Invalidate the cached P-state value that may be stale when
+ * the governor is started again during resume and may prevent
+ * MSR_IA32_PERF_CTL from being updated.
+ *
+ * This does not require synchronization because the core
+ * prevents frequency updates for suspended policies from
+ * occurring.
+ */
+ cpu->pstate.current_pstate = 0;
}
return 0;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0519/1059] cpufreq: Cache post-resolution target frequency in __resolve_freq()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (517 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0518/1059] cpufreq: intel_pstate: Clear last written P-state value on suspend Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0520/1059] software node: only let the owner release a managed node Greg Kroah-Hartman
` (479 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Christian Loehle
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 166207cac45191637c47a457a5c16ca6b6773a16 upstream.
get_next_freq() in the schedutil governor returns the resolved
frequency from cpufreq_driver_resolve_freq(), and that resolved value
is then passed to cpufreq_driver_fast_switch(). The only reader of
cached_target_freq, acpi_cpufreq_fast_switch(), compares it with the
post-resolution target frequency, but it holds the pre-resolution
clamped frequency, so any request that falls between table entries
misses the cache and falls back to a table scan.
Address this by making __resolve_freq() store the post-resolution
frequency in cached_target_freq.
Fixes: e3c062360870 ("cpufreq: add cpufreq_driver_resolve_freq()")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/14161745.uLZWGnKmhe@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -541,8 +541,8 @@ static unsigned int __resolve_freq(struc
idx = cpufreq_frequency_table_target(policy, target_freq, min, max, relation);
policy->cached_resolved_idx = idx;
- policy->cached_target_freq = target_freq;
- return policy->freq_table[idx].frequency;
+ policy->cached_target_freq = policy->freq_table[idx].frequency;
+ return policy->cached_target_freq;
}
/**
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0520/1059] software node: only let the owner release a managed node
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (518 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0519/1059] cpufreq: Cache post-resolution target frequency in __resolve_freq() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0521/1059] timekeeping: Read getboottime64() offsets under the sequence counter Greg Kroah-Hartman
` (478 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Balasubramani Vivekanandan,
Bartosz Golaszewski, Heikki Krogerus, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
commit f8623ce596492d2e96ca57eeec992938d3d79f00 upstream.
device_create_managed_software_node() creates a node whose lifetime is
tied to the device it was created for. software_node_notify_remove() is
called for every device that has the node as its fwnode (primary OR
secondary) and, if the node is managed, unconditionally detaches it from
that device and drops the creation reference.
This breaks when the node is shared with another device. Example: the
i2c-designware copies the parent's fwnode to the adapter's struct device.
When the adapter is deleted, it releases the reference that belongs to
the owner and the latter ends up with a dangling pointer.
Record the device's "manager" and only perform the actual release when
notify is called for that "owner" device.
Note that it was never the intention that managed software nodes would
be shared, but descendants reusing ancestor firmware nodes is not
uncommon and such use is hard to predict when allocating software nodes.
Reported-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Closes: https://lore.kernel.org/all/20261009164241.923756-2-balasubramani.vivekanandan@intel.com/
Fixes: 151f6ff78cdf ("software node: Provide replacement for device_add_properties()")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Fixes: 0f485f88656a ("drm/xe/i2c: use device_create_managed_software_node()")
Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Tested-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261102-swnode-only-owner-release-v1-1-ee4c9022a629@oss.qualcomm.com
[ johan: drop temporary variable; skip clearing owner field;
mention reuse not intended in commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/swnode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -18,6 +18,8 @@ struct swnode {
struct fwnode_handle fwnode;
const struct software_node *node;
int id;
+ /* Device the managed node's lifetime is tied to. */
+ struct device *owner;
/* hierarchy */
struct ida child_ids;
@@ -26,7 +28,6 @@ struct swnode {
struct swnode *parent;
unsigned int allocated:1;
- unsigned int managed:1;
};
static DEFINE_IDA(swnode_root_ids);
@@ -1110,7 +1111,7 @@ int device_create_managed_software_node(
if (IS_ERR(fwnode))
return PTR_ERR(fwnode);
- to_swnode(fwnode)->managed = true;
+ to_swnode(fwnode)->owner = dev;
set_secondary_fwnode(dev, fwnode);
if (device_is_registered(dev))
@@ -1154,7 +1155,7 @@ void software_node_notify_remove(struct
sysfs_remove_link(&dev->kobj, "software_node");
kobject_put(&swnode->kobj);
- if (swnode->managed) {
+ if (swnode->owner == dev) {
set_secondary_fwnode(dev, NULL);
kobject_put(&swnode->kobj);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0521/1059] timekeeping: Read getboottime64() offsets under the sequence counter
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (519 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0520/1059] software node: only let the owner release a managed node Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0522/1059] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Greg Kroah-Hartman
` (477 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hungyu Lin, Thomas Gleixner,
John Stultz
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
commit 385b5ec1f31dd39297578eed42be74b07ae74017 upstream.
getboottime64() computes the wall-clock boot timestamp from offs_real
minus offs_boot without checking tk_core.seq. A concurrent timekeeping
update can leave the reader with an inconsistent pair of offsets or,
on 32-bit systems, a torn 64-bit offset, producing an incorrect boot
timestamp.
Read both offsets under tk_core.seq and retry if an update overlaps
the sample. Convert the resulting local value to a timespec64 afterward.
Fixes: 7c3f1a573237 ("Introduce boot based time")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: John Stultz <jstultz@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261030054227.35453-2-dennylin0707@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/time/timekeeping.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2252,7 +2252,13 @@ void update_wall_time(void)
void getboottime64(struct timespec64 *ts)
{
struct timekeeper *tk = &tk_core.timekeeper;
- ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot);
+ unsigned int seq;
+ ktime_t t;
+
+ do {
+ seq = read_seqcount_begin(&tk_core.seq);
+ t = ktime_sub(tk->offs_real, tk->offs_boot);
+ } while (read_seqcount_retry(&tk_core.seq, seq));
*ts = ktime_to_timespec64(t);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0522/1059] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (520 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0521/1059] timekeeping: Read getboottime64() offsets under the sequence counter Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0523/1059] tpm: eventlog: check the payload size before reading tag events Greg Kroah-Hartman
` (476 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Paul Menzel,
Jarkko Sakkinen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
commit 03fcb358249dc715124b3616f814ea0ecc6ec36c upstream.
When devm_add_action() returns an error, tpm_read_log_acpi() clears
log->bios_event_log unnecessarily to NULL before calling
tpm_bios_log_free(), and it would lead to a memory leak of the
allocated log buffer.
Fix it by simply jumping to the err.
Cc: stable@vger.kernel.org # v6.18+
Fixes: a3a860bc0fd6 ("tpm: Change to kvalloc() in eventlog/acpi.c")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261109173756.742248-1-tiwai@suse.de
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/eventlog/acpi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/char/tpm/eventlog/acpi.c
+++ b/drivers/char/tpm/eventlog/acpi.c
@@ -168,10 +168,8 @@ int tpm_read_log_acpi(struct tpm_chip *c
}
ret = devm_add_action(&chip->dev, tpm_bios_log_free, log->bios_event_log);
- if (ret) {
- log->bios_event_log = NULL;
+ if (ret)
goto err;
- }
return format;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0523/1059] tpm: eventlog: check the payload size before reading tag events
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (521 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0522/1059] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0524/1059] x86/mm: Ensure write visibility during LDT installation Greg Kroah-Hartman
` (475 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guanglei Zhu, Jarkko Sakkinen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanglei Zhu <zhugl3@xiaopeng.com>
commit 0a385f668ba77d29ae167c1668fd452418ebc9d6 upstream.
The EVENT_TAG branch of get_event_name() casts the event payload to
struct tcpa_pc_event and reads from it:
pc_event = (struct tcpa_pc_event *)event_entry;
switch (do_endian_conversion(pc_event->event_id)) {
...
for (i = 0; i < 20; i++)
d_len += sprintf(&data[2*i], "%02x",
pc_event->event_data[i]);
The log iterators only verify that the event header plus the declared
event_size stays within the log buffer; they do not require the
payload of an EVENT_TAG entry to be large enough for the fields the
branch reads. A truncated entry makes the branch read up to 20 bytes
of event_data[] past the end of the entry, and, for the last entry in
the log, past the end of the buffer itself.
The legacy PC Client spec defines the EV_EVENT_TAG payload as a
TCPA_PC_EVENT - event_id, event_size and event-type-specific data -
so a conformant entry carries the 8-byte header and the hash-type
ids carry a full digest. The log itself, however, is an ACPI table
the firmware leaves in memory: the TPM never measures the log, so
the kernel cannot tell a conformant log from a corrupted one. The
iterators already work on that assumption - they stop once the
declared event_size runs past the buffer end - and the readers
should apply the same rule to what they take off the payload.
Skip entries whose payload cannot even hold the event id, and skip
the 20-byte digest dump when the payload cannot hold the full
tcpa_pc_event header plus the digest, so the branch never reads
beyond the entry it is formatting.
Cc: stable@vger.kernel.org
Fixes: 55a82ab3181b ("[PATCH] tpm: add bios measurement log")
Signed-off-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/eventlog/tpm1.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/char/tpm/eventlog/tpm1.c
+++ b/drivers/char/tpm/eventlog/tpm1.c
@@ -178,6 +178,10 @@ static int get_event_name(char *dest, st
}
break;
case EVENT_TAG:
+ if (do_endian_conversion(event->event_size) <
+ sizeof(pc_event->event_id))
+ break;
+
pc_event = (struct tcpa_pc_event *)event_entry;
/* ToDo Row data -> Base64 */
@@ -203,6 +207,9 @@ static int get_event_name(char *dest, st
name = tcpa_pc_event_id_strings[do_endian_conversion
(pc_event->event_id)];
n_len = strlen(name);
+ if (do_endian_conversion(event->event_size) <
+ sizeof(struct tcpa_pc_event) + 20)
+ break;
for (i = 0; i < 20; i++)
d_len += sprintf(&data[2*i], "%02x",
pc_event->event_data[i]);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0524/1059] x86/mm: Ensure write visibility during LDT installation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (522 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0523/1059] tpm: eventlog: check the payload size before reading tag events Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0525/1059] xen/gntdev: fix deadlock between map ioctl and mmap Greg Kroah-Hartman
` (474 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jaeyoung Chung, Dave Hansen,
Ingo Molnar, Linus Torvalds, Peter Zijlstra (Intel)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <dave.hansen@linux.intel.com>
commit 0dc2a4dac3d04e9e4479aeb0b46172feab1cca0a upstream.
During LDT installation, the intent is to overwrite the old per-mm
LDT value, then send an IPI to the mm user CPUs to have each load
the new value.
But there is an ordering problem: a new mm user CPU sets itself in
mm_cpumask() and then reads mm->context.ldt. The LDT-installing CPU
writes mm->context.ldt and then reads mm_cpumask(). But, there is
nothing which orders the LDT installation side actions. The CPU
can read mm_cpumask() before its write becomes visible.
Ensure that new mm user CPUs see the new mm->context.ldt. Make
mm->context.ldt visible before reading mm_cpumask().
Also convert the smp_store_release() over to a WRITE_ONCE().
smp_store_release() has an internal barrier which is weaker than
the new smp_mb(). Avoid an extra barrier by converting it to
WRITE_ONCE().
Also refresh/correct misleading comments. READ/WRITE_ONCE() do not
"synchronize" anything themselves.
Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Acked-by: Linus Torvalds <torvalds@linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/ldt.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -43,7 +43,7 @@ void load_mm_ldt(struct mm_struct *mm)
{
struct ldt_struct *ldt;
- /* READ_ONCE synchronizes with smp_store_release */
+ /* Pairs with WRITE_ONCE() in install_ldt() */
ldt = READ_ONCE(mm->context.ldt);
/*
@@ -420,8 +420,14 @@ static void install_ldt(struct mm_struct
{
mutex_lock(&mm->context.lock);
- /* Synchronizes with READ_ONCE in load_mm_ldt. */
- smp_store_release(&mm->context.ldt, ldt);
+ /*
+ * Ensure that new mm user CPUs either see the new LDT value
+ * or get an IPI. Make the store visible before reading
+ * mm_cpumask(). New mm users make their mm_cpumask() writes
+ * visible before reading mm->context.ldt.
+ */
+ WRITE_ONCE(mm->context.ldt, ldt);
+ smp_mb();
/* Activate the LDT for all CPUs using currents mm. */
on_each_cpu_mask(mm_cpumask(mm), flush_ldt, mm, true);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0525/1059] xen/gntdev: fix deadlock between map ioctl and mmap
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (523 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0524/1059] x86/mm: Ensure write visibility during LDT installation Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0526/1059] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Greg Kroah-Hartman
` (473 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrey Misiurov, Juergen Gross
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <andrey.misyrov@gmail.com>
commit 7620a997e4854c94eacebf0c2d453fbd78ccdb46 upstream.
Commit 45ca1afe2fd1 ("xen/gntdev: fix error handling in ioctl") moved
copy_to_user() in gntdev_ioctl_map_grant_ref() under priv->lock. A
fault in copy_to_user() takes mmap_lock, while gntdev_mmap() is called
with mmap_lock held and takes priv->lock:
ioctl thread mmap thread
mutex_lock(&priv->lock)
mmap_write_lock(mm)
gntdev_mmap()
mutex_lock(&priv->lock)
copy_to_user() faults
mmap_read_lock(mm)
Reproduced on Debian 6.12.111 in a Xen guest, with the ioctl argument
on a MAP_PRIVATE file page that has not been written yet. sysrq-w:
task:repro state:D stack:0 pid:4479 tgid:4477 ppid:1 flags:0x00000000
rwsem_down_read_slowpath+0x25c/0x480
down_read_killable+0x48/0xc0
lock_mm_and_find_vma+0x96/0x250
do_user_addr_fault+0x12d/0x620
exc_page_fault+0x7e/0x180
asm_exc_page_fault+0x26/0x30
_copy_to_user+0x36/0x50
gntdev_ioctl+0x3b9/0xa00 [xen_gntdev]
__x64_sys_ioctl+0x97/0xc0
task:repro state:D stack:0 pid:4480 tgid:4477 ppid:1 flags:0x00000000
__mutex_lock.constprop.0+0x41b/0x720
gntdev_mmap+0x4d/0x330 [xen_gntdev]
__mmap_region+0x697/0xb10
mmap_region+0x78/0xa0
do_mmap+0x45d/0x630
vm_mmap_pgoff+0xf8/0x1c0
Drop priv->lock before copy_to_user() again. On failure, re-take it
and remove the map by index, as IOCTL_GNTDEV_UNMAP_GRANT_REF does,
since another thread may have unmapped it meanwhile.
Fixes: 45ca1afe2fd1 ("xen/gntdev: fix error handling in ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Misiurov <andrey.misyrov@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261013170745.583279-1-andrey.misyrov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/gntdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -678,15 +678,19 @@ static long gntdev_ioctl_map_grant_ref(s
mutex_lock(&priv->lock);
gntdev_add_map(priv, map);
op.index = map->index << PAGE_SHIFT;
+ mutex_unlock(&priv->lock);
if (copy_to_user(u, &op, sizeof(op)) != 0) {
- list_del(&map->next);
+ mutex_lock(&priv->lock);
+ map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT,
+ op.count);
+ if (map)
+ list_del(&map->next);
mutex_unlock(&priv->lock);
gntdev_put_map(priv, map);
return -EFAULT;
}
- mutex_unlock(&priv->lock);
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0526/1059] xen/pvcalls: unwind pvcalls_new_active_socket() step by step
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (524 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0525/1059] xen/gntdev: fix deadlock between map ioctl and mmap Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0527/1059] xen/pvcalls: destroy the per-socket workqueue on release Greg Kroah-Hartman
` (472 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefano Stabellini, Yehyeong Lee,
Juergen Gross
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 702ba3c80a8736898813a2c7484d695278aa114d upstream.
Every error path in pvcalls_new_active_socket() jumps to one shared label
that does list_del(&map->list) and then hands map to
pvcalls_back_release_active(). But map comes from kzalloc() and its
list_head is only published at the very end of the function, after the last
of those jumps:
down(&fedata->socket_lock);
list_add_tail(&map->list, &fedata->socket_mappings);
up(&fedata->socket_lock);
so on the error path map->list is still {NULL, NULL} and __list_del()
writes through a NULL pointer.
A frontend gets there with one value it owns: the ring_order field of the
page it granted. Anything above MAX_RING_ORDER takes the second goto, and
nothing else in the function has run by then.
The result is an oops in whichever context handled the request - the
pvcalls-back threaded IRQ handler for PVCALLS_CONNECT, mappass->wq for
PVCALLS_ACCEPT - and because it happens after down(&fedata->socket_lock)
that semaphore is never released, so every later operation on the frontend
blocks on it and the backend never completes backend_disconnect(). (With
CONFIG_DEBUG_LIST the list_del() only reports and returns, and
pvcalls_back_release_active() then runs on a map whose irq is still 0 and
whose bytes, ioworker.wq and saved_data_ready are all NULL.)
A frontend asking for ring_order 5, on a dom0 built with KASAN
(the request was issued by a test-only change to the frontend):
[ 133.728877] pvcalls_new_active_socket frontend requested ring_order 5, which is > MAX (4)
[ 133.732868] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
[ 133.737910] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
[ 133.741666] CPU: 0 UID: 0 PID: 133 Comm: irq/39-pvcalls- Not tainted 7.3.0-kCTLblk2-15482-g21a7f44fd076-dirty #1 PREEMPT(full)
[ 133.746986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 133.751512] RIP: 0010:pvcalls_new_active_socket+0x821/0xb90
[ 133.754237] Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 f6 01 00 00 48 8d 79 08 4c 8b 6b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 14 02 00 00 4c 89 ea 4c 89 69 08 48 b8 00 00 00
[ 133.763126] RSP: 0018:ffffc900004afb38 EFLAGS: 00010202
[ 133.765861] RAX: dffffc0000000000 RBX: ffff88810886c900 RCX: 0000000000000000
[ 133.769348] RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000008
[ 133.772787] RBP: 1ffff92000095f6b R08: 0000000000000001 R09: fffff52000095f58
[ 133.776260] R10: 0000000000000003 R11: ffff888100077320 R12: ffff88810858b410
[ 133.779823] R13: 0000000000000000 R14: ffff88810858b460 R15: ffff88810858b400
[ 133.783382] FS: 0000000000000000(0000) GS:ffff8881b034c000(0000) knlGS:0000000000000000
[ 133.787351] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 133.790308] CR2: 00000000006042c0 CR3: 0000000108400001 CR4: 0000000000770ef0
[ 133.793822] PKRU: 55555554
[ 133.795347] Call Trace:
[ 133.796778] <TASK>
[ 133.798082] ? __pfx_pvcalls_new_active_socket+0x10/0x10
[ 133.800801] ? security_socket_post_create+0x4d/0x60
[ 133.803275] ? release_sock+0x1a/0x1d0
[ 133.805182] pvcalls_back_event+0x1b09/0x23e0
[ 133.807431] ? __pfx_pvcalls_back_event+0x10/0x10
[ 133.809814] ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[ 133.812251] ? __pfx_pvcalls_back_event+0x10/0x10
[ 133.814554] irq_thread_fn+0x86/0x150
[ 133.816468] irq_thread+0x2da/0x580
[ 133.818363] ? __pfx_irq_thread_fn+0x10/0x10
[ 133.820586] ? __pfx_irq_thread+0x10/0x10
[ 133.822670] ? __kthread_parkme+0x88/0x170
[ 133.824803] ? __pfx_irq_thread+0x10/0x10
[ 133.827153] ? __pfx_irq_thread+0x10/0x10
[ 133.829304] kthread+0x2c8/0x3b0
[ 133.831176] ? recalc_sigpending+0x15c/0x1e0
[ 133.833570] ? __pfx_kthread+0x10/0x10
[ 133.835572] ret_from_fork+0x373/0x5b0
[ 133.837581] ? __pfx_ret_from_fork+0x10/0x10
[ 133.839978] ? __switch_to+0x3c4/0xb40
[ 133.841984] ? __pfx_kthread+0x10/0x10
[ 133.843970] ret_from_fork_asm+0x1a/0x30
[ 133.846031] </TASK>
[ 133.847420] Modules linked in:
[ 133.849240] ---[ end trace 0000000000000000 ]---
Give each failure its own label, so that only resources that were actually
acquired are released and the list the map was never added to is left
alone. The map is not published anywhere at that point, so the error path
needs no socket_lock at all. sock_release() stays in the callee on every
error path, the way
commit 8fafac202d18 ("xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()")
arranged it.
Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command")
Cc: stable@vger.kernel.org
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110125002.46683-2-yhlee@isslab.korea.ac.kr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/pvcalls-back.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -333,7 +333,7 @@ static struct sock_mapping *pvcalls_new_
ret = xenbus_map_ring_valloc(fedata->dev, &ref, 1, &page);
if (ret < 0)
- goto out;
+ goto out_map;
map->ring = page;
map->ring_order = map->ring->ring_order;
/* first read the order, then map the data ring */
@@ -341,19 +341,19 @@ static struct sock_mapping *pvcalls_new_
if (map->ring_order > MAX_RING_ORDER) {
pr_warn("%s frontend requested ring_order %u, which is > MAX (%u)\n",
__func__, map->ring_order, MAX_RING_ORDER);
- goto out;
+ goto out_unmap_ring;
}
ret = xenbus_map_ring_valloc(fedata->dev, map->ring->ref,
(1 << map->ring_order), &page);
if (ret < 0)
- goto out;
+ goto out_unmap_ring;
map->bytes = page;
ret = bind_interdomain_evtchn_to_irqhandler_lateeoi(
fedata->dev, evtchn,
pvcalls_back_conn_event, 0, "pvcalls-backend", map);
if (ret < 0)
- goto out;
+ goto out_unmap_bytes;
map->irq = ret;
map->data.in = map->bytes;
@@ -361,7 +361,7 @@ static struct sock_mapping *pvcalls_new_
map->ioworker.wq = alloc_workqueue("pvcalls_io", WQ_UNBOUND, 1);
if (!map->ioworker.wq)
- goto out;
+ goto out_unbind;
atomic_set(&map->io, 1);
INIT_WORK(&map->ioworker.register_work, pvcalls_back_ioworker);
@@ -377,11 +377,16 @@ static struct sock_mapping *pvcalls_new_
write_unlock_bh(&map->sock->sk->sk_callback_lock);
return map;
-out:
- down(&fedata->socket_lock);
- list_del(&map->list);
- pvcalls_back_release_active(fedata->dev, fedata, map);
- up(&fedata->socket_lock);
+
+out_unbind:
+ unbind_from_irqhandler(map->irq, map);
+out_unmap_bytes:
+ xenbus_unmap_ring_vfree(fedata->dev, map->bytes);
+out_unmap_ring:
+ xenbus_unmap_ring_vfree(fedata->dev, (void *)map->ring);
+out_map:
+ sock_release(sock);
+ kfree(map);
return NULL;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0527/1059] xen/pvcalls: destroy the per-socket workqueue on release
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (525 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0526/1059] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.1 0528/1059] hwmon: (aht10) Fix update_interval overflow on 64-bit Greg Kroah-Hartman
` (471 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefano Stabellini, Yehyeong Lee,
Juergen Gross
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 6b3feb6bfa9ac384f7a3ec25c40b9b4d3da96d25 upstream.
pvcalls_new_active_socket() gives every active socket its own ordered
workqueue:
map->ioworker.wq = alloc_ordered_workqueue("pvcalls_io", 0);
and nothing ever destroys it. pvcalls_back_release_active() flushes
map->ioworker.register_work and frees map, but the workqueue and its
pool_workqueues stay allocated, so a frontend leaks a workqueue per socket
it connects and releases - a loop a guest can run as long as it likes.
Destroy it right after flush_work(): the IRQ is disabled and sk_data_ready
restored by then, so nothing can queue new work, and the rings are still
mapped while it drains - pvcalls_conn_back_read() reads map->ring and
map->data, which xenbus_unmap_ring_vfree() takes away a few lines later.
pvcalls_back_ioworker() does not take fedata->socket_lock, which the
backend_disconnect() caller holds here - only the socket's own
sk_receive_queue lock - so draining it from this point is safe; the
flush_work() just above already has the same requirement.
Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command")
Cc: stable@vger.kernel.org
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110125002.46683-3-yhlee@isslab.korea.ac.kr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/pvcalls-back.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -448,6 +448,7 @@ static int pvcalls_back_release_active(s
atomic_set(&map->release, 1);
flush_work(&map->ioworker.register_work);
+ destroy_workqueue(map->ioworker.wq);
xenbus_unmap_ring_vfree(dev, map->bytes);
xenbus_unmap_ring_vfree(dev, (void *)map->ring);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0528/1059] hwmon: (aht10) Fix update_interval overflow on 64-bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (526 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0527/1059] xen/pvcalls: destroy the per-socket workqueue on release Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0529/1059] hwmon: (sy7636a) fix negative temperatures Greg Kroah-Hartman
` (470 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rupesh Majhi, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rupesh Majhi <zoone.rupert@gmail.com>
commit b5c5b67e02406fb48acf57cf2c30a570230fd6aa upstream.
On 64-bit, update_interval writes are clamped to LONG_MAX ms, but
ms_to_ktime() overflows above 9223372036854 ms and the interval wraps.
LONG_MAX becomes -1 ms, so every read starts a new measurement and
update_interval reads back -1.
Clamp to INT_MAX like sht4x, so the limit is the same on all platforms.
Fixes: 8c78f0dee437 ("hwmon: Add AHT10 Temperature and Humidity Sensor Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
Link: https://patch.msgid.link/20261108172651.220121-1-zoone.rupert@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/aht10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/aht10.c
+++ b/drivers/hwmon/aht10.c
@@ -182,7 +182,7 @@ static int aht10_read_values(struct aht1
static ssize_t aht10_interval_write(struct aht10_data *data,
long val)
{
- data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, LONG_MAX));
+ data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, INT_MAX));
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0529/1059] hwmon: (sy7636a) fix negative temperatures
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (527 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.1 0528/1059] hwmon: (aht10) Fix update_interval overflow on 64-bit Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0530/1059] hwmon: (scmi) Check channel config allocation Greg Kroah-Hartman
` (469 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Pablo Mazzini, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Mazzini <pmazzini@gmail.com>
commit fc8519fab34e162b0c29dacccf73031820878917 upstream.
The thermistor readout is a signed 8-bit value in degrees Celsius.
Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a")
Cc: stable@vger.kernel.org
Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
Link: https://patch.msgid.link/20261108093602.329554-3-pmazzini@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/sy7636a-hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/sy7636a-hwmon.c
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -29,7 +29,7 @@ static int sy7636a_read(struct device *d
if (ret)
return ret;
- *temp = reg_val * 1000;
+ *temp = (s8)reg_val * 1000;
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0530/1059] hwmon: (scmi) Check channel config allocation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (528 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0529/1059] hwmon: (sy7636a) fix negative temperatures Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0531/1059] hwmon: (max31760) Fix the local temperature limit registers Greg Kroah-Hartman
` (468 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Sudeep Holla, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
commit a2996d892d0150d059d39c683d95d6fd7a37630a upstream.
scmi_hwmon_add_chan_info() can fail to allocate a channel's config
array. Ignoring that error leaves a channel with a NULL config pointer
in the hwmon chip info, which hwmon dereferences while registering the
device.
Check the helper's return value and abort probe on failure.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-d10ced6b-a6f0-403b-9619-f5a6573f9e7f
Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
Cc: stable@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Link: https://patch.msgid.link/20261109151927.1672956-1-sudeep.holla@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/scmi-hwmon.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -228,8 +228,8 @@ static int scmi_thermal_sensor_register(
static int scmi_hwmon_probe(struct scmi_device *sdev)
{
- int i, idx;
u16 nr_sensors;
+ int i, idx, ret;
enum hwmon_sensor_types type;
struct scmi_sensors *scmi_sensors;
const struct scmi_sensor_info *sensor;
@@ -297,8 +297,12 @@ static int scmi_hwmon_probe(struct scmi_
if (!nr_count[type])
continue;
- scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
- type, hwmon_attributes[type]);
+ ret = scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev,
+ nr_count[type], type,
+ hwmon_attributes[type]);
+ if (ret)
+ return ret;
+
*ptr_scmi_ci++ = scmi_hwmon_chan++;
scmi_sensors->info[type] =
@@ -333,8 +337,6 @@ static int scmi_hwmon_probe(struct scmi_
return PTR_ERR(hwdev);
for (i = 0; i < nr_count_temp; i++) {
- int ret;
-
sensor = *(scmi_sensors->info[hwmon_temp] + i);
if (!sensor)
continue;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0531/1059] hwmon: (max31760) Fix the local temperature limit registers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (529 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0530/1059] hwmon: (scmi) Check channel config allocation Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0532/1059] hwmon: (max31760) Leave standby mode at probe Greg Kroah-Hartman
` (467 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 028ed93145d9be88eee670088ef13482b5d36c1a upstream.
temp2_max and temp2_crit use each other's registers, so reading them
shows the local limits swapped and writing temp2_max changes the
overtemperature (SHDN) threshold.
Use the high limit (0x0C) for temp2_max and the overtemperature limit
(0x08) for temp2_crit.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-1-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c
index d88c1eff9146..c16066f72c86 100644
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -27,8 +27,8 @@
#define REG_TACH(ch) (0x52 + (ch) * 2)
#define REG_TEMP_INPUT(ch) (0x56 + (ch) * 2)
-#define REG_TEMP_MAX(ch) (0x06 + (ch) * 2)
-#define REG_TEMP_CRIT(ch) (0x0A + (ch) * 2)
+#define REG_TEMP_MAX(ch) ((ch) ? 0x0C : 0x06)
+#define REG_TEMP_CRIT(ch) ((ch) ? 0x08 : 0x0A)
#define TEMP11_FROM_REG(reg) ((reg) / 32 * 125)
#define TEMP11_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), -128000, \
--
2.56.1
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0532/1059] hwmon: (max31760) Leave standby mode at probe
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (530 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0531/1059] hwmon: (max31760) Fix the local temperature limit registers Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0533/1059] hwmon: (max31760) Report 0 RPM before the first fan speed measurement Greg Kroah-Hartman
` (466 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 95bddc5252a4c0a2ed9d62e7e53a3461265d9603 upstream.
The driver never clears the standby bit (CR2_STBY) during probe.
While max31760_resume() clears this bit on resume, probe only
configured CR2_ALERTS.
If the chip was left in standby (for example, by boot firmware or a
previously running OS before a warm reboot), it remains in standby:
temperature sensing, fan speed counting, and PWM output are halted.
This occurs on the Samsung Galaxy XR, where the bootloader places the
chip in standby during boot.
Clear CR2_STBY alongside setting CR2_ALERTS in probe.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-2-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c
index c16066f72c86..ff55f7fc0f1b 100644
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -533,8 +533,9 @@ static int max31760_probe(struct i2c_client *client)
dev_set_drvdata(dev, state);
- /* Set alert output to comparator mode */
- ret = regmap_set_bits(state->regmap, REG_CR2, CR2_ALERTS);
+ /* Leave standby mode, set alert output to comparator mode */
+ ret = regmap_update_bits(state->regmap, REG_CR2, CR2_STBY | CR2_ALERTS,
+ CR2_ALERTS);
if (ret)
return dev_err_probe(dev, ret, "cannot write register\n");
--
2.56.1
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0533/1059] hwmon: (max31760) Report 0 RPM before the first fan speed measurement
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (531 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0532/1059] hwmon: (max31760) Leave standby mode at probe Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0534/1059] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Greg Kroah-Hartman
` (465 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 33d58cbf2ab26bda81bc3052158d8b9867d5b9a6 upstream.
The tachometer count registers initialize to 0 until the first
measurement cycle completes after power-on. To prevent division by
zero, tach_to_rpm() clamped tach == 0 to 1, causing it to compute
and report 3,000,000 RPM (60 * 100000 / 1 / 2).
Return 0 RPM when tach == 0 instead.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-3-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c
index ff55f7fc0f1b..cf9ee0ed1389 100644
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -68,8 +68,9 @@ static const int max31760_pwm_freq[] = {33, 150, 1500, 25000};
static int tach_to_rpm(u16 tach)
{
+ /* The count is 0 until the first measurement */
if (tach == 0)
- tach = 1;
+ return 0;
return 60 * 100000 / tach / 2;
}
--
2.56.1
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0534/1059] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (532 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0533/1059] hwmon: (max31760) Report 0 RPM before the first fan speed measurement Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0535/1059] s390/dasd: Dont trust userspace-supplied result field in format check Greg Kroah-Hartman
` (464 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jan Höppner,
Stefan Haberland, Jens Axboe
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
commit df56f7a6c20a5eb2794c0a7391bde50ba7c8c54b upstream.
dasd_eckd_build_check_tcw() allocates its request with
dasd_fmalloc_request(), but its out_err path frees it with
dasd_sfree_request(). The latter uses a different pool and therefor,
leading to invalid pointer arithmetic and a crash.
Use the matching dasd_ffree_request() instead.
The same error path also leaves start_priv->count incremented
without ever decrementing it again.
This leaks a permanent reference on every build failure.
Decrement it before freeing the request.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260722103704.1709668-1-sth@linux.ibm.com
Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT")
Cc: stable@vger.kernel.org #4.7
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Fixes: 5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes")
Link: https://patch.msgid.link/20261112102608.1057852-4-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/s390/block/dasd_eckd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2606,7 +2606,8 @@ dasd_eckd_build_check_tcw(struct dasd_de
return cqr;
out_err:
- dasd_sfree_request(cqr, startdev);
+ start_priv->count--;
+ dasd_ffree_request(cqr, startdev);
return ERR_PTR(rc);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0535/1059] s390/dasd: Dont trust userspace-supplied result field in format check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (533 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0534/1059] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0536/1059] sctp: abort unordered partial delivery when its message is skipped Greg Kroah-Hartman
` (463 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jan Höppner,
Stefan Haberland, Jens Axboe
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
commit 7cc2dda4f7aaf596c1796184649007151ff98f8d upstream.
BIODASDCHECKFMT used to copy the entire format_check_t struct from
userspace, including the result/unit/rec/num_records/blksize/
key_length fields that are output fields only.
dasd_eckd_format_evaluate_tracks() relies on cdata->result being zero
to decide whether to apply an index correction (i--/pos--) after a
successful check. A caller that pre-sets result to a non-zero value
can suppress that correction, leaving pos advanced past the last valid
entry; the (partially out-of-bounds) fmt_buffer[pos] fields are then
copied back to userspace, leaking heap contents.
Only expect is an Input field; copy just that member in and zero
the rest of cdata.
Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260722103704.1709668-1-sth@linux.ibm.com
Cc: stable@vger.kernel.org #4.7
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-5-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/s390/block/dasd_ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -309,7 +309,9 @@ static int dasd_ioctl_check_format(struc
goto out_err;
}
- if (copy_from_user(&cdata, argp, sizeof(cdata))) {
+ /* copy only input fields, clear the rest */
+ memset(&cdata, 0, sizeof(cdata));
+ if (copy_from_user(&cdata.expect, argp, sizeof(cdata.expect))) {
rc = -EFAULT;
goto out_err;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0536/1059] sctp: abort unordered partial delivery when its message is skipped
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (534 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0535/1059] s390/dasd: Dont trust userspace-supplied result field in format check Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0537/1059] sctp: avoid requeueing pending control chunks Greg Kroah-Hartman
` (462 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Budding, Xin Long,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 05852c8b70f2291a50bb3f740a66ce9caf9cb98d upstream.
When an I-FORWARD-TSN skips unordered messages on a stream,
sctp_intl_skip() only aborts the stream's unordered partial delivery if
the MID being delivered is lower than the skipped MID. If the skipped
message is the one being partially delivered, partial delivery stays in
progress: no PARTIAL_DELIVERY_ABORTED is sent, and the next unordered
message on the stream is delivered as the rest of the abandoned one.
Abort the partial delivery when the MID being delivered is at or below
the skipped MID, as the ordered case already does.
Reproduced on an unmodified kernel with the uo_pd test of the
sctp_ifwdtsn.sh selftest added later in this series; its partial
delivery checks pass with this fix. Reproduction and fix done with AI
assistance.
Fixes: de60fe910543 ("sctp: implement handle_ftsn for sctp_stream_interleave")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-2-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream_interleave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1261,7 +1261,7 @@ static void sctp_intl_skip(struct sctp_u
struct sctp_stream *stream = &ulpq->asoc->stream;
if (flags & SCTP_FTSN_U_BIT) {
- if (sin->pd_mode_uo && MID_lt(sin->mid_uo, mid)) {
+ if (sin->pd_mode_uo && !MID_lt(mid, sin->mid_uo)) {
sin->pd_mode_uo = 0;
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
GFP_ATOMIC);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0537/1059] sctp: avoid requeueing pending control chunks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (535 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0536/1059] sctp: abort unordered partial delivery when its message is skipped Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0538/1059] sctp: fix ASCONF address change on single-homed hosts Greg Kroah-Hartman
` (461 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Xin Long, Kyle Zeng,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 665b4149e91b781a71bce8637c3a4d7d64dba05f upstream.
The T4 and RE-CONFIG timeout handlers take a reference to their cached
control chunk and submit it through SCTP_CMD_REPLY. A previous
transmission can still be on the control outqueue when output is corked
or suppressed, or when sctp_packet_transmit_chunk() could not append the
chunk.
sctp_outq_tail() then adds the same list node a second time. Re-adding a
non-tail entry can corrupt the list without being caught by the
insertion-time list checks. A subsequent flush or association teardown
can access an already freed chunk. The ASCONF path is reproducible by an
unprivileged SCTP socket owner in a user/network namespace, with KASAN
reporting a use-after-free in __sctp_outq_teardown().
Check sctp_chunk_pending() in both timeout handlers before taking the
extra reference and issuing SCTP_CMD_REPLY. If the chunk is already
linked, leave the existing entry for normal output processing. Keep
the remaining timer and error-handling commands unchanged. This also
covers RE-CONFIG retransmission after sctp_assoc_rm_peer() moves the
request to another transport and starts its timer.
The issue was found by an LLM.
Fixes: 2e3216cd54b1 ("sctp: Follow security requirement of responding with 1 packet")
Fixes: 7b9438de0cd4 ("sctp: add stream reconf timer")
Cc: stable@kernel.org
Suggested-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261107030532.32310-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/sm_statefuns.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1121,9 +1121,11 @@ enum sctp_disposition sctp_sf_send_recon
return SCTP_DISPOSITION_DELETE_TCB;
}
- sctp_chunk_hold(asoc->strreset_chunk);
- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
- SCTP_CHUNK(asoc->strreset_chunk));
+ if (!sctp_chunk_pending(asoc->strreset_chunk)) {
+ sctp_chunk_hold(asoc->strreset_chunk);
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+ SCTP_CHUNK(asoc->strreset_chunk));
+ }
sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE, SCTP_TRANSPORT(transport));
return SCTP_DISPOSITION_CONSUME;
@@ -6193,9 +6195,11 @@ enum sctp_disposition sctp_sf_t4_timer_e
* chunk, it MUST be the same (including its serial number) as the last
* ASCONF sent.
*/
- sctp_chunk_hold(asoc->addip_last_asconf);
- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
- SCTP_CHUNK(asoc->addip_last_asconf));
+ if (!sctp_chunk_pending(asoc->addip_last_asconf)) {
+ sctp_chunk_hold(asoc->addip_last_asconf);
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+ SCTP_CHUNK(asoc->addip_last_asconf));
+ }
/* ADDIP 4.1 B5) Restart the T-4 RTO timer. Note that if a different
* destination is selected, then the RTO used will be that of the new
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0538/1059] sctp: fix ASCONF address change on single-homed hosts
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (536 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0537/1059] sctp: avoid requeueing pending control chunks Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0539/1059] sctp: fix I-FORWARD-TSN handling of fragments on other streams Greg Kroah-Hartman
` (460 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrey Misiurov, Xin Long,
Dave Miller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <andrey.misyrov@gmail.com>
commit 5175b2fb34c77cf2cd56a290affa45412cb3a228 upstream.
Commit 9b2854f86f0b ("sctp: don't free the ASCONF's own transport in
DEL-IP processing") refuses a DEL-IP of the transport the ASCONF was
located by, so that a later wildcard DEL-IP cannot use it after free.
This also breaks the single-homed address change (RFC 5061 5.3.2). The
host sends [Address Parameter L] [ADD-IP S] [DEL-IP L], the association
is located by L, and DEL-IP L is now refused. The sender never gets an
all-success ASCONF-ACK, keeps src_out_of_asoc_ok set and stops sending
data, so the association stalls.
Fix the wildcard DEL-IP instead: look up the transport of the packet
source rather than reusing asconf->transport. Both DEL-IP paths can
now free asconf->transport, and chunks bundled after the ASCONF still
use it, so point it at a surviving transport: the packet source for the
wildcard delete, the primary path for a plain one.
Found by manual code inspection while reviewing a backport of commit
9b2854f86f0b; reproduced on a two-namespace single-homed renumber.
Fixes: 9b2854f86f0b ("sctp: don't free the ASCONF's own transport in DEL-IP processing")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Misiurov <andrey.misyrov@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/sm_make_chunk.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3196,9 +3196,12 @@ static __be16 sctp_process_asconf_param(
* packet MUST be deleted.
*/
if (af->is_any(&addr)) {
- sctp_assoc_set_primary(asoc, asconf->transport);
- sctp_assoc_del_nonprimary_peers(asoc,
- asconf->transport);
+ peer = sctp_assoc_lookup_paddr(asoc, &asconf->source);
+ if (!peer)
+ return SCTP_ERROR_REQ_REFUSED;
+ sctp_assoc_set_primary(asoc, peer);
+ sctp_assoc_del_nonprimary_peers(asoc, peer);
+ asconf->transport = peer;
return SCTP_ERROR_NO_ERROR;
}
@@ -3211,13 +3214,9 @@ static __be16 sctp_process_asconf_param(
if (!peer)
return SCTP_ERROR_DNS_FAILED;
- /* Don't free asconf->transport; a later wildcard DEL-IP
- * parameter reuses it.
- */
- if (peer == asconf->transport)
- return SCTP_ERROR_REQ_REFUSED;
-
sctp_assoc_rm_peer(asoc, peer);
+ if (asconf->transport == peer)
+ asconf->transport = asoc->peer.primary_path;
break;
case SCTP_PARAM_SET_PRIMARY:
/* ADDIP Section 4.2.4
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0539/1059] sctp: fix I-FORWARD-TSN handling of fragments on other streams
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (537 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0538/1059] sctp: fix ASCONF address change on single-homed hosts Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0540/1059] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED Greg Kroah-Hartman
` (459 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Budding, Xin Long,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 5b9cfc6491a6e32e7315dc222992c7dbd5baa3e9 upstream.
sctp_report_iftsn() incorrectly frees queued I-DATA fragments in two
cases. First, it drops any queued fragments with TSN less than or equal
to the New Cumulative TSN. This prevents reconstruction of messages
still being received on other streams and can fully block an ordered
stream. Second, it calls sctp_intl_abort_pd() if the New Cumulative TSN
equals the highest TSN seen. This check exists for association resets
but can be inadvertently triggered by any I-FORWARD-TSN that arrives
before data with a higher TSN, causing data loss and, if a partial
delivery is in progress on an ordered stream, an aborted association.
Fix the first by freeing fragments from sctp_intl_skip() based on
stream, U bit, and MID instead of TSN. Fix the second by moving the call
to sctp_intl_abort_pd() from sctp_report_iftsn() to the corresponding
reset handlers.
Observed in real use as unexpected message loss. Reproduced on an
unmodified kernel with the sctp_ifwdtsn.sh selftest added later in this
series, which passes with this fix. Reproduction and fix done with AI
assistance.
Fixes: 47b20a88566f ("sctp: implement report_ftsn for sctp_stream_interleave")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-4-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream.c | 2 ++
net/sctp/stream_interleave.c | 32 +++++++++++---------------------
2 files changed, 13 insertions(+), 21 deletions(-)
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -749,6 +749,7 @@ struct sctp_chunk *sctp_process_strreset
*/
max_tsn_seen = sctp_tsnmap_get_max_tsn_seen(&asoc->peer.tsn_map);
asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen);
+ asoc->stream.si->abort_pd(&asoc->ulpq, GFP_ATOMIC);
/* G1: Compute an appropriate value for the Receiver's Next TSN -- the
* TSN that the peer should use to send the next DATA chunk. The
@@ -1028,6 +1029,7 @@ struct sctp_chunk *sctp_process_strreset
LIST_HEAD(temp);
asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn);
+ asoc->stream.si->abort_pd(&asoc->ulpq, GFP_ATOMIC);
sctp_tsnmap_init(&asoc->peer.tsn_map,
SCTP_TSN_MAP_INITIAL,
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1209,28 +1209,21 @@ static void sctp_report_fwdtsn(struct sc
sctp_ulpq_abort_pd(ulpq, GFP_ATOMIC);
}
-static void sctp_intl_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 ftsn)
+static void sctp_intl_reasm_flush_mid(struct sk_buff_head *reasm, __u16 sid,
+ __u32 mid)
{
struct sk_buff *pos, *tmp;
- skb_queue_walk_safe(&ulpq->reasm, pos, tmp) {
+ skb_queue_walk_safe(reasm, pos, tmp) {
struct sctp_ulpevent *event = sctp_skb2event(pos);
- __u32 tsn = event->tsn;
- if (TSN_lte(tsn, ftsn)) {
- __skb_unlink(pos, &ulpq->reasm);
- sctp_ulpevent_free(event);
- }
- }
+ if (event->stream < sid)
+ continue;
+ if (event->stream > sid || MID_lt(mid, event->mid))
+ break;
- skb_queue_walk_safe(&ulpq->reasm_uo, pos, tmp) {
- struct sctp_ulpevent *event = sctp_skb2event(pos);
- __u32 tsn = event->tsn;
-
- if (TSN_lte(tsn, ftsn)) {
- __skb_unlink(pos, &ulpq->reasm_uo);
- sctp_ulpevent_free(event);
- }
+ __skb_unlink(pos, reasm);
+ sctp_ulpevent_free(event);
}
}
@@ -1238,11 +1231,6 @@ static void sctp_report_iftsn(struct sct
{
/* Move the Cumulattive TSN Ack ahead. */
sctp_tsnmap_skip(&ulpq->asoc->peer.tsn_map, ftsn);
- /* purge the fragmentation queue */
- sctp_intl_reasm_flushtsn(ulpq, ftsn);
- /* abort only when it's for all data */
- if (ftsn == sctp_tsnmap_get_max_tsn_seen(&ulpq->asoc->peer.tsn_map))
- sctp_intl_abort_pd(ulpq, GFP_ATOMIC);
}
static void sctp_handle_fwdtsn(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk)
@@ -1266,6 +1254,7 @@ static void sctp_intl_skip(struct sctp_u
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
GFP_ATOMIC);
}
+ sctp_intl_reasm_flush_mid(&ulpq->reasm_uo, sid, mid);
return;
}
@@ -1277,6 +1266,7 @@ static void sctp_intl_skip(struct sctp_u
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x0, GFP_ATOMIC);
}
+ sctp_intl_reasm_flush_mid(&ulpq->reasm, sid, mid);
sctp_mid_skip(stream, in, sid, mid);
sctp_intl_reap_ordered(ulpq, sid);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0540/1059] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (538 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0539/1059] sctp: fix I-FORWARD-TSN handling of fragments on other streams Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0541/1059] sctp: reset stored flag for each association Greg Kroah-Hartman
` (458 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tim Budding, Xin Long,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 3097fba868019924e92b8786ebd473992565f015 upstream.
When an I-FORWARD-TSN skips the message being partially delivered on a
stream, sctp_intl_skip() passes the MID from the I-FORWARD-TSN to the
PARTIAL_DELIVERY_ABORTED notification as pdapi_seq. That MID is the
highest one skipped on the stream, so when more than one message is
skipped, the notification names a later message instead of the one
whose partial delivery was aborted.
Report the MID being partially delivered, sin->mid_uo or sin->mid,
instead.
Reproduced on an unmodified kernel with the pdapi and pdapi_uo tests of
the sctp_ifwdtsn.sh selftest added later in this series, which pass
with this fix. Reproduction and fix done with AI assistance.
Fixes: de60fe910543 ("sctp: implement handle_ftsn for sctp_stream_interleave")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/179293012867.3134.16497481637722705271@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-3-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream_interleave.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1251,7 +1251,7 @@ static void sctp_intl_skip(struct sctp_u
if (flags & SCTP_FTSN_U_BIT) {
if (sin->pd_mode_uo && !MID_lt(mid, sin->mid_uo)) {
sin->pd_mode_uo = 0;
- sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
+ sctp_intl_stream_abort_pd(ulpq, sid, sin->mid_uo, 0x1,
GFP_ATOMIC);
}
sctp_intl_reasm_flush_mid(&ulpq->reasm_uo, sid, mid);
@@ -1263,7 +1263,7 @@ static void sctp_intl_skip(struct sctp_u
if (sin->pd_mode) {
sin->pd_mode = 0;
- sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x0, GFP_ATOMIC);
+ sctp_intl_stream_abort_pd(ulpq, sid, sin->mid, 0x0, GFP_ATOMIC);
}
sctp_intl_reasm_flush_mid(&ulpq->reasm, sid, mid);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0541/1059] sctp: reset stored flag for each association
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (539 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0540/1059] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0542/1059] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field() Greg Kroah-Hartman
` (457 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiang Mei, Weiming Shi, Xin Long,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <bestswngs@gmail.com>
commit 173712d868eb20628ad82deb07f6829a68a9e064 upstream.
sctp_send_asconf_del_ip() walks every association on an endpoint. The
stored flag records that the current association took the single-homed
deferral path and therefore did not allocate an ASCONF chunk. It is
currently scoped to the whole function. Once one association sets it,
later eligible multihomed associations allocate chunks but skip
sctp_send_asconf(), leaking each chunk and its skb.
Reset stored for every association so only an association taking the
deferral path skips transmission. In an A/B kmemleak test, the
vulnerable kernel reported 210 leaked objects from this call path and the
fixed kernel reported none.
Cc: stable@vger.kernel.org
Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host")
Reported-by: Xiang Mei <xmei5@asu.edu>
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261108161149.2774119-1-bestswngs@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -807,7 +807,6 @@ static int sctp_send_asconf_del_ip(struc
struct sctp_sockaddr_entry *saddr;
int i;
int retval = 0;
- int stored = 0;
chunk = NULL;
sp = sctp_sk(sk);
@@ -820,6 +819,7 @@ static int sctp_send_asconf_del_ip(struc
__func__, sk, addrs, addrcnt);
list_for_each_entry(asoc, &ep->asocs, asocs) {
+ int stored = 0;
if (!asoc->peer.asconf_capable)
continue;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0542/1059] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (540 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0541/1059] sctp: reset stored flag for each association Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0543/1059] wifi: ath9k_htc: do not start ANI before the first channel is set Greg Kroah-Hartman
` (456 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit a0f836eea463d4c468edb58eedb03911c9c0791d upstream.
Because the kernel is built with -funsigned-char, plain 'char' is
unsigned on all architectures. Reading 1-byte signed trace event fields
via *(char *)addr in get_event_field() therefore zero-extends instead of
sign-extending negative s8 values.
Use explicit fixed-width integer types (s8/u8, s16/u16, s32/u32) when
reading event fields.
Link: https://lore.kernel.org/all/179455852542.403392.15666310371702309464.stgit@devnote2/
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_eprobe.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -353,21 +353,21 @@ static unsigned long get_event_field(str
switch (field->size) {
case 1:
if (field->is_signed)
- val = *(char *)addr;
+ val = *(s8 *)addr;
else
- val = *(unsigned char *)addr;
+ val = *(u8 *)addr;
break;
case 2:
if (field->is_signed)
- val = *(short *)addr;
+ val = *(s16 *)addr;
else
- val = *(unsigned short *)addr;
+ val = *(u16 *)addr;
break;
case 4:
if (field->is_signed)
- val = *(int *)addr;
+ val = *(s32 *)addr;
else
- val = *(unsigned int *)addr;
+ val = *(u32 *)addr;
break;
default:
if (field->is_signed)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0543/1059] wifi: ath9k_htc: do not start ANI before the first channel is set
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (541 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0542/1059] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0544/1059] wifi: cfg80211: release rejected nontransmitted BSS reference Greg Kroah-Hartman
` (455 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mehmet Fide,
Toke Høiland-Jørgensen, Jeff Johnson
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
commit dda63dd136ba2bc3b297079b190ac81a0aea40ae upstream.
ath9k_htc_add_interface() starts ANI for the first AP interface, before
any channel is configured. The per-channel calibration data only gets
attached by the first ath9k_htc_set_channel() that is not a fast
channel change, and that same call cancels the ANI work a few
milliseconds after add_interface, so normally the work never runs.
When the bring-up stalls for more than the 100 ms ANI poll interval in
between, it does run, and ar9002_hw_per_calibration() records the IQ
calibration result in the calibration data that does not exist yet:
Unable to handle kernel NULL pointer dereference at virtual address
00000008
PC is at ar9002_hw_calibrate+0x1f8/0x570 [ath9k_hw]
Workqueue: phy0 ath9k_htc_ani_work [ath9k_htc]
Seen about once per thousand AP starts with an AR9271 on a Cortex-A5
board that starts hostapd while still booting; a 500 ms delay after
add_interface reproduces it on every start. The crashed work never
completes, so the next cancel_delayed_work_sync() blocks for good.
Drop the start; it has nothing to calibrate against and is cancelled
anyway. The TSF adjust bit that shared its condition is now set for
every AP interface, which is harmless: the next reset applies it. The
next patch starts ANI once the interface beacons.
Fixes: a236254c35f0 ("ath9k_htc: Add ANI for AP mode")
Cc: stable@vger.kernel.org
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20261005072209.4101009-2-mehmet.fide@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1098,11 +1098,8 @@ static int ath9k_htc_add_interface(struc
ath9k_htc_set_opmode(priv);
- if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
- !test_bit(ATH_OP_ANI_RUN, &common->op_flags)) {
+ if (priv->ah->opmode == NL80211_IFTYPE_AP)
ath9k_hw_set_tsfadjust(priv->ah, true);
- ath9k_htc_start_ani(priv);
- }
ath_dbg(common, CONFIG, "Attach a VIF of type: %d at idx: %d\n",
vif->type, avp->index);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0544/1059] wifi: cfg80211: release rejected nontransmitted BSS reference
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (542 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0543/1059] wifi: ath9k_htc: do not start ANI before the first channel is set Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0545/1059] wifi: cfg80211: dont truncate the merged MBSSID profile length Greg Kroah-Hartman
` (454 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit f3c45d5b741a7d7586e639c2f55d2557029f2e1a upstream.
Repeated MBSSID reports without an SSID can leak BSS entries outside the
scan cache, where the BSS entry limit cannot account for them.
__cfg80211_bss_update() returns a referenced BSS. If adding it to the
transmitting BSS list fails, unlinking drops the cache reference, but the
caller reference is lost when res is cleared.
Release the caller reference before discarding the unlinked BSS.
LLM assistance was used to find the bug and review.
Fixes: 0b7808818cb9 ("wifi: cfg80211: fix BSS refcounting bugs")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141731.6185-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/wireless/scan.c | 1 +
1 file changed, 1 insertion(+)
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2175,6 +2175,7 @@ cfg80211_inform_single_bss_data(struct w
&res->pub)) {
if (__cfg80211_unlink_bss(rdev, res)) {
rdev->bss_generation++;
+ bss_ref_put(rdev, res);
res = NULL;
}
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0545/1059] wifi: cfg80211: dont truncate the merged MBSSID profile length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (543 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0544/1059] wifi: cfg80211: release rejected nontransmitted BSS reference Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0546/1059] wifi: mac80211: recheck injected headers after removing FCS Greg Kroah-Hartman
` (453 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wahid Khan, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wahid Khan <wahidzk0091@gmail.com>
commit 3ea152f3f77eeffc37b2f4423688b4df9136f90c upstream.
cfg80211_parse_mbssid_data() keeps the length of a non-transmitted BSSID
profile in a u8. cfg80211_merge_profile() returns a size_t, and it
concatenates a profile that is split over several Multiple BSSID
elements, so the merged length can be well above 255 even though every
single sub-element is at most 255 bytes long.
The value is then cut to its low 8 bits. A 300 byte profile is handled
as a 44 byte one: the elements after the cut are lost from the generated
non-transmitted BSS, and if the Multiple BSSID-Index element lies past
the cut the BSS is dropped altogether. Any AP in range can send such a
profile.
The multi-link code further down in the same file already uses a signed
size type for the profile length. Do the same here, cfg80211_find_ie()
and cfg80211_gen_new_ie() take a size_t anyway.
Fixes: fe806e4992c9 ("cfg80211: support profile split between elements")
Cc: stable@vger.kernel.org
Signed-off-by: Wahid Khan <wahidzk0091@gmail.com>
Link: https://patch.msgid.link/20261104211451.693451-1-wahidzk0091@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/wireless/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2307,7 +2307,7 @@ static void cfg80211_parse_mbssid_data(s
if (elem->data[0] < 1 || (int)elem->data[0] > 8)
continue;
for_each_element(sub, elem->data + 1, elem->datalen - 1) {
- u8 profile_len;
+ size_t profile_len;
if (sub->id != 0 || sub->datalen < 4) {
/* not a valid BSS profile */
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0546/1059] wifi: mac80211: recheck injected headers after removing FCS
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (544 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0545/1059] wifi: cfg80211: dont truncate the merged MBSSID profile length Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0547/1059] wifi: mac80211: recheck the IBSS station limit before insertion Greg Kroah-Hartman
` (452 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 339564c7ac50464695dfed847f89d118f4cc1dc5 upstream.
Injecting a short frame with IEEE80211_RADIOTAP_F_FCS on a monitor
interface can pass a truncated 802.11 header to transmit handlers.
ieee80211_monitor_start_xmit() validates the linear 802.11 header before
parsing radiotap. Radiotap parsing then removes the four-byte FCS without
rechecking the remaining header length. Software encryption can subtract
the larger header length and pass the resulting negative length as an
unsigned size.
Recheck the required linear header length after pulling the radiotap
header and before handing the frame to the transmit path. Require at
least addr1, which the transmit path reads even for extension frames
whose header is shorter.
LLM assistance was used to find the bug and review.
Fixes: bddc0c411a45 ("mac80211: Fix NULL ptr deref for injected rate info")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142101.11994-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/tx.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2505,6 +2505,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
/* remove the injection radiotap header */
skb_pull(skb, len_rthdr);
+ /* FCS removal may have shortened the 802.11 header. */
+ hdrlen = max_t(int, hdrlen,
+ offsetofend(struct ieee80211_hdr, addr1));
+ if (skb_headlen(skb) < hdrlen)
+ goto fail_rcu;
+
ieee80211_xmit(sdata, NULL, skb);
rcu_read_unlock();
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0547/1059] wifi: mac80211: recheck the IBSS station limit before insertion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (545 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0546/1059] wifi: mac80211: recheck injected headers after removing FCS Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0548/1059] wifi: mac80211: recheck the OCB " Greg Kroah-Hartman
` (451 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit f7670bcdf650b37551a9c5d084521f877d939f11 upstream.
Frames from successive unknown IBSS peers can make the deferred worker
install more than 128 stations.
The receive path checks local->num_sta before allocating each station,
but pending stations are not included in that count. Several allocations
can therefore pass before the worker inserts any of them, and the worker
then drains the list without rechecking the limit.
Recheck the installed-station limit in the worker under the wiphy mutex
and free entries that no longer fit.
LLM assistance was used to find the bug and review.
Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142235.15428-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ibss.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1695,8 +1695,12 @@ void ieee80211_ibss_work(struct ieee8021
list_del(&sta->list);
spin_unlock_bh(&ifibss->incomplete_lock);
- ieee80211_ibss_finish_sta(sta);
- rcu_read_unlock();
+ if (sdata->local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
+ sta_info_free(sdata->local, sta);
+ } else {
+ ieee80211_ibss_finish_sta(sta);
+ rcu_read_unlock();
+ }
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0548/1059] wifi: mac80211: recheck the OCB station limit before insertion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (546 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0547/1059] wifi: mac80211: recheck the IBSS station limit before insertion Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0549/1059] wifi: mac80211: bound pending IBSS station allocations Greg Kroah-Hartman
` (450 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 27e29a077b4887d0e0a813337f8b7e06bd020c81 upstream.
Frames from successive unknown OCB peers can make the deferred worker
install more than 128 stations.
The receive path checks local->num_sta before allocating each station,
but pending stations are not included in that count. Several allocations
can therefore pass before the worker inserts any of them, and the worker
then drains the list without rechecking the limit.
Recheck the installed-station limit in the worker under the wiphy mutex
and free entries that no longer fit.
LLM assistance was used to find the bug and review.
Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142302.16634-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ocb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/net/mac80211/ocb.c
+++ b/net/mac80211/ocb.c
@@ -139,8 +139,12 @@ void ieee80211_ocb_work(struct ieee80211
list_del(&sta->list);
spin_unlock_bh(&ifocb->incomplete_lock);
- ieee80211_ocb_finish_sta(sta);
- rcu_read_unlock();
+ if (sdata->local->num_sta >= IEEE80211_OCB_MAX_STA_ENTRIES) {
+ sta_info_free(sdata->local, sta);
+ } else {
+ ieee80211_ocb_finish_sta(sta);
+ rcu_read_unlock();
+ }
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0549/1059] wifi: mac80211: bound pending IBSS station allocations
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (547 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0548/1059] wifi: mac80211: recheck the OCB " Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0550/1059] wifi: mac80211: bound pending OCB " Greg Kroah-Hartman
` (449 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 3029ca2112d7bee4d3e3eadd02decdb3eddb9485 upstream.
Delaying the IBSS station worker while frames arrive from new peers can
retain an unbounded number of station allocations.
The receive-side limit counts installed stations, while new allocations
wait on incomplete_stations until process context inserts them. The list
lock does not cover the interval between allocation and list insertion.
Reserve one of 128 pending slots per interface before allocation. Release
the reservation on allocation failure, after the worker inserts or frees
the station, and when disconnect frees the pending list.
LLM assistance was used to find the bug and review.
Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142235.15428-3-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ibss.c | 13 ++++++++++++-
net/mac80211/ieee80211_i.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -704,6 +704,7 @@ static void ieee80211_ibss_disconnect(st
spin_unlock_bh(&ifibss->incomplete_lock);
sta_info_free(local, sta);
+ atomic_dec(&ifibss->incomplete_sta_count);
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
@@ -1231,9 +1232,18 @@ void ieee80211_ibss_rx_no_sta(struct iee
scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
rcu_read_unlock();
+ if (!atomic_add_unless(&ifibss->incomplete_sta_count, 1,
+ IEEE80211_IBSS_MAX_STA_ENTRIES)) {
+ net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
+ sdata->name, addr);
+ return;
+ }
+
sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
- if (!sta)
+ if (!sta) {
+ atomic_dec(&ifibss->incomplete_sta_count);
return;
+ }
/* make sure mandatory rates are always added */
sband = local->hw.wiphy->bands[band];
@@ -1701,6 +1711,7 @@ void ieee80211_ibss_work(struct ieee8021
ieee80211_ibss_finish_sta(sta);
rcu_read_unlock();
}
+ atomic_dec(&ifibss->incomplete_sta_count);
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -589,6 +589,7 @@ struct ieee80211_if_ibss {
spinlock_t incomplete_lock;
struct list_head incomplete_stations;
+ atomic_t incomplete_sta_count;
enum {
IEEE80211_IBSS_MLME_SEARCH,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0550/1059] wifi: mac80211: bound pending OCB station allocations
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (548 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0549/1059] wifi: mac80211: bound pending IBSS station allocations Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0551/1059] gpio: brcmstb: fix UAF after IRQ domain setup failure Greg Kroah-Hartman
` (448 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit ee1a5e92dba0a98cabe476c780e3af4f0ab88b27 upstream.
Delaying the OCB station worker while frames arrive from new peers can
retain an unbounded number of station allocations.
The receive-side limit counts installed stations, while new allocations
wait on incomplete_stations until process context inserts them. The list
lock does not cover the interval between allocation and list insertion.
Reserve one of 128 pending slots per interface before allocation. Release
the reservation on allocation failure, after the worker inserts or frees
the station, and when leave frees the pending list.
LLM assistance was used to find the bug and review.
Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142302.16634-3-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/ocb.c | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -604,6 +604,7 @@ struct ieee80211_if_ibss {
* @wrkq_flags: OCB deferred task action
* @incomplete_lock: delayed STA insertion lock
* @incomplete_stations: list of STAs waiting for delayed insertion
+ * @incomplete_sta_count: pending entries and reserved allocations
* @joined: indication if the interface is connected to an OCB network
*/
struct ieee80211_if_ocb {
@@ -612,6 +613,7 @@ struct ieee80211_if_ocb {
spinlock_t incomplete_lock;
struct list_head incomplete_stations;
+ atomic_t incomplete_sta_count;
bool joined;
};
--- a/net/mac80211/ocb.c
+++ b/net/mac80211/ocb.c
@@ -72,9 +72,18 @@ void ieee80211_ocb_rx_no_sta(struct ieee
scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
rcu_read_unlock();
+ if (!atomic_add_unless(&ifocb->incomplete_sta_count, 1,
+ IEEE80211_OCB_MAX_STA_ENTRIES)) {
+ net_info_ratelimited("%s: No room for a new OCB STA entry %pM\n",
+ sdata->name, addr);
+ return;
+ }
+
sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
- if (!sta)
+ if (!sta) {
+ atomic_dec(&ifocb->incomplete_sta_count);
return;
+ }
/* Add only mandatory rates for now */
sband = local->hw.wiphy->bands[band];
@@ -145,6 +154,7 @@ void ieee80211_ocb_work(struct ieee80211
ieee80211_ocb_finish_sta(sta);
rcu_read_unlock();
}
+ atomic_dec(&ifocb->incomplete_sta_count);
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
@@ -227,6 +237,7 @@ int ieee80211_ocb_leave(struct ieee80211
spin_unlock_bh(&ifocb->incomplete_lock);
sta_info_free(local, sta);
+ atomic_dec(&ifocb->incomplete_sta_count);
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0551/1059] gpio: brcmstb: fix UAF after IRQ domain setup failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (549 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0550/1059] wifi: mac80211: bound pending OCB " Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0552/1059] gpio: rockchip: Fix debounce arithmetic for GPIO v2 Greg Kroah-Hartman
` (447 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Florian Fainelli,
Bartosz Golaszewski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
commit baa14758afb3e2828de1f76511edc1de50216f39 upstream.
When devm_request_irq() fails in brcmstb_gpio_irq_setup(), the error
path removes the IRQ domain but leaves priv->irq_domain non-NULL.
The probe error path subsequently calls brcmstb_gpio_remove(), which
checks priv->irq_domain and attempts to access the already-freed
domain through irq_find_mapping(). It also attempts to remove the
domain again, resulting in a use-after-free and potentially further
memory corruption.
Set priv->irq_domain to NULL after removing it so that the common
cleanup path skips the already-freed IRQ domain.
This issue was found by our static analysis tool under development.
Fixes: 0ba31dc201de ("gpio: brcmstb: consolidate interrupt domains")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20261026115227.41779-1-lgs201920130244@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-brcmstb.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -490,6 +490,7 @@ static int brcmstb_gpio_irq_setup(struct
out_free_domain:
irq_domain_remove(priv->irq_domain);
+ priv->irq_domain = NULL;
return err;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0552/1059] gpio: rockchip: Fix debounce arithmetic for GPIO v2
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (550 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0551/1059] gpio: brcmstb: fix UAF after IRQ domain setup failure Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0553/1059] gpio: sodaville: fix use-after-free bug when registering the irqchip Greg Kroah-Hartman
` (446 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cunhao Lu, Bartosz Golaszewski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cunhao Lu <1579567540@qq.com>
commit 13467fd6998f5da4f5b4f172f1af3d9c48d5de8f upstream.
The debounce interval calculations use unsigned long operands. On 32-bit
systems, the numerator used to calculate the maximum interval overflows
before division, while multiplying the requested interval by the clock
rate overflows before it is assigned to a u64. A zero debounce clock rate
also causes division by zero.
Use 64-bit arithmetic for both calculations and reject a zero clock rate
before division.
At 32768 Hz, a 1 us request rounds to zero divider periods. Subtracting
one then wraps the divider value to ULONG_MAX. Decrement only a nonzero
rounded period count so that such requests use the smallest divider
value.
Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller")
Cc: stable@vger.kernel.org
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/20261023-fix-rockchip-gpio-v2-debounce-v1-1-f1141bd5b58f@qq.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-rockchip.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -192,20 +192,25 @@ static int rockchip_gpio_set_debounce(st
{
struct rockchip_pin_bank *bank = gpiochip_get_data(gc);
const struct rockchip_gpio_regs *reg = bank->gpio_regs;
- unsigned long flags, div_reg, freq, max_debounce;
+ unsigned long flags, div_reg, freq;
bool div_debounce_support;
unsigned int cur_div_reg;
- u64 div;
+ u64 div, max_debounce;
if (bank->gpio_type == GPIO_TYPE_V2 && !IS_ERR(bank->db_clk)) {
div_debounce_support = true;
freq = clk_get_rate(bank->db_clk);
- max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
+ if (!freq)
+ return -EINVAL;
+
+ div = (u64)(GENMASK(23, 0) + 1) * 2 * USEC_PER_SEC;
+ max_debounce = div64_u64(div, freq);
if (debounce > max_debounce)
return -EINVAL;
- div = debounce * freq;
- div_reg = DIV_ROUND_CLOSEST_ULL(div, 2 * USEC_PER_SEC) - 1;
+ div = (u64)debounce * freq;
+ div_reg = DIV_ROUND_CLOSEST_ULL(div, 2 * USEC_PER_SEC);
+ div_reg = div_reg ? div_reg - 1 : 0;
} else {
div_debounce_support = false;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0553/1059] gpio: sodaville: fix use-after-free bug when registering the irqchip
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (551 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0552/1059] gpio: rockchip: Fix debounce arithmetic for GPIO v2 Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0554/1059] smb: client: bound invalid NTLMSSP signature diagnostic Greg Kroah-Hartman
` (445 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
commit ab9102375b7c77e0c4d33c7594e514454dc9f2b3 upstream.
In sdv_register_irqsupport(), if irq_domain_create_legacy() fails during
device probing, a generic IRQ chip is left registered in the global gc_list
while its underlying memory is freed, leading to a use-after-free. Use
the managed variant of irq_setup_generic_chip() to ensure that the chip
gets unregistered before the memory it uses is freed.
Cc: stable@vger.kernel.org
Fixes: 9381fc5d655d ("gpio: sodaville: Convert to use managed functions pcim_* and devm_*")
Closes: https://sashiko.dev/#/bug/linux-2f7ac8b6-5034-4ff1-9afa-5700ff44e3e9
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261105-gpio-sodaville-use-after-free-v1-1-f572f40feedd@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-sodaville.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/gpio/gpio-sodaville.c
+++ b/drivers/gpio/gpio-sodaville.c
@@ -165,9 +165,12 @@ static int sdv_register_irqsupport(struc
ct->chip.irq_eoi = irq_gc_eoi;
ct->chip.irq_set_type = sdv_gpio_pub_set_type;
- irq_setup_generic_chip(sd->gc, IRQ_MSK(SDV_NUM_PUB_GPIOS),
- IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST,
- IRQ_LEVEL | IRQ_NOPROBE);
+ ret = devm_irq_setup_generic_chip(&pdev->dev, sd->gc,
+ IRQ_MSK(SDV_NUM_PUB_GPIOS),
+ IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST,
+ IRQ_LEVEL | IRQ_NOPROBE);
+ if (ret)
+ return ret;
sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS,
sd->irq_base, 0, &irq_domain_sdv_ops, sd);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0554/1059] smb: client: bound invalid NTLMSSP signature diagnostic
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (552 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0553/1059] gpio: sodaville: fix use-after-free bug when registering the irqchip Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0555/1059] smb: client: dont block dying tasks waiting for writeback on close Greg Kroah-Hartman
` (444 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Yifan Zhang,
Paulo Alcantara
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
commit 0584b02669c3e76188097174b4f25ed13723e94c upstream.
The NTLMSSP Signature field is an eight-byte binary value and need not be
NUL-terminated. decode_ntlmssp_challenge() prints it with %s on the
signature-mismatch path, so the diagnostic can continue beyond the received
blob until it encounters a zero byte.
KASAN reports:
BUG: KASAN: slab-out-of-bounds in string
Read of size 1
string
vsnprintf
_printk
decode_ntlmssp_challenge
Print the fixed-width field with the bounded hexadecimal format.
The patched kernel reaches the invalid-signature path and returns -EINVAL
without a KASAN report.
Fixes: 0b3cc858003b ("[CIFS] NTLMSSP reenabled after move from connect.c to sess.c")
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/sess.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -937,8 +937,8 @@ int decode_ntlmssp_challenge(char *bcc_p
}
if (memcmp(pblob->Signature, "NTLMSSP", 8)) {
- cifs_dbg(VFS, "blob signature incorrect %s\n",
- pblob->Signature);
+ cifs_dbg(VFS, "%s: blob signature incorrect: %8phN\n",
+ __func__, pblob->Signature);
return -EINVAL;
}
if (pblob->MessageType != NtLmChallenge) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0555/1059] smb: client: dont block dying tasks waiting for writeback on close
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (553 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0554/1059] smb: client: bound invalid NTLMSSP signature diagnostic Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0556/1059] smb: client: flush deferred handles of other names before a hard link open Greg Kroah-Hartman
` (443 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Paulo Alcantara
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit 15ea186abbcd04157c62e0901701870b812bb2bd upstream.
cifs_flush() waits uninterruptibly for the writeback it starts. A task
that gets killed while closing a file on a hard mount with an
unresponsive server is stuck in D state until the server comes back. It
also consumes any writeback error for a caller that is about to exit,
hiding it from everyone else.
Wait killably instead. If the closer gets killed, stop waiting and leave
the error bits in the mapping for others to see; writeback already in
flight completes on its own. Don't wait at all, nor check for errors,
if it is already dying.
This is also needed before letting dying tasks issue their writes from a
worker, which would otherwise make them wait for every one of them.
Fixes: d3f1322af8f8 ("cifs: wait for writeback to complete in cifs_flush")
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3148,17 +3148,44 @@ fsync_exit:
return rc;
}
+static int cifs_wait_writeback_killable(struct address_space *mapping)
+{
+ struct folio_batch fbatch;
+ pgoff_t index = 0;
+ int rc = 0;
+
+ folio_batch_init(&fbatch);
+ while (!rc &&
+ filemap_get_folios_tag(mapping, &index, (pgoff_t)-1,
+ PAGECACHE_TAG_WRITEBACK, &fbatch)) {
+ for (unsigned int i = 0;
+ !rc && i < folio_batch_count(&fbatch); i++)
+ rc = folio_wait_writeback_killable(fbatch.folios[i]);
+ folio_batch_release(&fbatch);
+ cond_resched();
+ }
+ return rc;
+}
+
/*
* As file closes, flush all cached write data for this inode checking
* for write behind errors.
*/
int cifs_flush(struct file *file, fl_owner_t id)
{
+ struct address_space *mapping = file->f_mapping;
struct inode *inode = file_inode(file);
- int rc = 0;
+ int rc = 0, rc2;
- if (file->f_mode & FMODE_WRITE)
- rc = filemap_write_and_wait(inode->i_mapping);
+ if (file->f_mode & FMODE_WRITE) {
+ rc = filemap_fdatawrite(mapping);
+ if (fatal_signal_pending(current) ||
+ cifs_wait_writeback_killable(mapping))
+ return 0;
+ rc2 = filemap_check_errors(mapping);
+ if (!rc)
+ rc = rc2;
+ }
cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
if (rc) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0556/1059] smb: client: flush deferred handles of other names before a hard link open
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (554 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0555/1059] smb: client: dont block dying tasks waiting for writeback on close Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0557/1059] smb: client: hold the inode across cifs_oplock_break() Greg Kroah-Hartman
` (442 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giuseppe Piscitelli, Namjae Jeon,
Paulo Alcantara
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit 25912ed3b75dcf5ff623dcb549b925dd0d0948f7 upstream.
Opening a hard link of a file whose other name still holds a deferred,
leased handle fails with EINVAL over SMB3. The client caches lease keys
per inode, but the server ties a lease to the file name it was granted
under, so reusing the inode's lease key to open a different name of the
same inode is rejected with STATUS_INVALID_PARAMETER (MS-SMB2 3.3.5.9.11).
Commit 262b73ef442e ("smb3 client: fix open hardlink on deferred close
file error") already closes the inode's deferred handles before such an
open so the new name can take a fresh lease, but cifs_get_hardlink_path()
only triggered that flush when a cached handle had the same open flags as
the new open, so a differently accessed name - written then read, say -
slipped through and still failed.
Match on the name instead: flush when a cached handle for another name of
the inode is open, regardless of access mode.
Reported-by: Giuseppe Piscitelli <ooonea@gmail.com>
Closes: https://lore.kernel.org/r/CACmoRBbDZR3eyEM65j73sWMS7A=T89z1QAvCP=+u0WGzZhwW6g@mail.gmail.com
Fixes: 262b73ef442e ("smb3 client: fix open hardlink on deferred close file error")
Cc: stable@vger.kernel.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -1757,7 +1757,7 @@ cifs_get_hardlink_path(struct cifs_tcon
spin_lock(&cinode->open_file_lock);
list_for_each_entry(open_file, &cinode->openFileList, flist) {
- if (file->f_flags == open_file->f_flags) {
+ if (open_file->dentry != file_dentry(file)) {
rc = -EINVAL;
break;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0557/1059] smb: client: hold the inode across cifs_oplock_break()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (555 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0556/1059] smb: client: flush deferred handles of other names before a hard link open Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0558/1059] dm log userspace: drop the device reference on error Greg Kroah-Hartman
` (441 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joseph Qi, Paulo Alcantara
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <joseph.qi@linux.alibaba.com>
commit fce78321f1b59531cf6fc94860550db1db8dec55 upstream.
cifs_oplock_break() drops the handle reference in the middle of the
handler and keeps using cinode afterwards, to send the break
acknowledgment and again in cifs_done_oplock_break(). The reference
cifs_queue_oplock_break() takes is the only pin: the handle holds the
dentry and the dentry is what keeps the inode alive.
When that put is the last reference, the dput() in
cifsFileInfo_put_final() kills an unhashed dentry, drops the last
i_count and evicts the inode, so the rest of the handler runs on an
object whose free is only RCU-deferred. An unhashed dentry that a
handle still references is an ordinary state: unlinking an open file
leaves the dentry that way, and so does the dcache teardown at unmount.
Take a reference on the inode for the lifetime of the handler and drop
it once the break has been reported. This also covers the
cifs_get_tlink() failure path, where the put is followed directly by
the out label.
Fixes: b98749cac4a6 ("CIFS: keep FileInfo handle live during oplock break")
Fixes: 23b26f4408ac ("smb: client: avoid leaking refcount when cifs_sb_tlink() fails")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -5254,6 +5254,14 @@ void cifs_oplock_break(struct work_struc
__u64 persistent_fid, volatile_fid;
__u16 net_fid;
+ /*
+ * Dropping the handle reference below also drops the dentry
+ * reference that pins this inode, and cinode is still needed to
+ * acknowledge the break and to report it as complete. Hold the inode
+ * until that is done.
+ */
+ ihold(inode);
+
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
TASK_UNINTERRUPTIBLE);
@@ -5329,6 +5337,7 @@ oplock_break_ack:
cifs_put_tlink(tlink);
out:
cifs_done_oplock_break(cinode);
+ iput(inode);
}
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0558/1059] dm log userspace: drop the device reference on error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (556 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0557/1059] smb: client: hold the inode across cifs_oplock_break() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0559/1059] dm cache: reject kcopyd client destory if it setup failed Greg Kroah-Hartman
` (440 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
commit 0550d3b14e008b033b02cfce668008ec6addffe4 upstream.
userspace_ctr() takes a reference on the log device with
dm_get_device(). When the integrated-flush workqueue allocation fails it
jumps to the shared error path, which frees the log context without
dropping that reference, so the device stays busy and cannot be removed.
userspace_dtr() drops the reference correctly; do the same here.
Fixes: 5066a4df1f42 ("dm log userspace: allow mark requests to piggyback on flush requests")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-log-userspace-base.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -293,9 +293,11 @@ static int userspace_ctr(struct dm_dirty
}
r = dm_get_device(ti, devices_rdata,
dm_table_get_mode(ti->table), &lc->log_dev);
- if (r)
+ if (r) {
DMERR("Failed to register %s with device-mapper",
devices_rdata);
+ goto out;
+ }
}
if (lc->integrated_flush) {
@@ -313,6 +315,8 @@ static int userspace_ctr(struct dm_dirty
out:
kfree(devices_rdata);
if (r) {
+ if (lc->log_dev)
+ dm_put_device(lc->ti, lc->log_dev);
mempool_exit(&lc->flush_entry_pool);
kfree(lc);
kfree(ctr_str);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0559/1059] dm cache: reject kcopyd client destory if it setup failed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (557 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0558/1059] dm log userspace: drop the device reference on error Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0560/1059] dm crypt: fix use of uninitialized percpu_counter in ctr error path Greg Kroah-Hartman
` (439 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+a2626a25eb2595e3ec3c,
Edward Adam Davis, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <eadavis@sina.com>
commit 8b97b168eb4d3affcf23d2980a0c3f35ed9262e2 upstream.
The value of cache->copier is -EINTR when failed to create a rescuer
kthread for wq kcopyd, in cache_create(), the code jumps directly to
__destroy(cache), it merely performs a simple check to see whether copier
is NULL, potentially hitting:
BUG: KASAN: null-ptr-deref in dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980
Read of size 4 at addr 0000000000000174 by task syz.2.19/6560
Call Trace:
dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980
__destroy+0x172/0x2f0 drivers/md/dm-cache-target.c:1973
cache_create drivers/md/dm-cache-target.c:2604 [inline]
cache_ctr+0x1674/0x2bf0 drivers/md/dm-cache-target.c:2649
dm_table_add_target+0x58d/0xc70 drivers/md/dm-table.c:749
populate_table drivers/md/dm-ioctl.c:1602 [inline]
table_load+0x325/0x8a0 drivers/md/dm-ioctl.c:1645
ctl_ioctl drivers/md/dm-ioctl.c:2221 [inline]
Set copier to NULL to avoid destroying a invalid kcopy client.
Cc: stable@vger.kernel.org
Fixes: c6b4fcbad044 ("dm: add cache target")
Reported-by: syzbot+a2626a25eb2595e3ec3c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a2626a25eb2595e3ec3c
Signed-off-by: Edward Adam Davis <eadavis@sina.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-cache-target.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2552,6 +2552,7 @@ static int cache_create(struct cache_arg
if (IS_ERR(cache->copier)) {
*error = "could not create kcopyd client";
r = PTR_ERR(cache->copier);
+ cache->copier = NULL;
goto bad;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0560/1059] dm crypt: fix use of uninitialized percpu_counter in ctr error path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (558 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0559/1059] dm cache: reject kcopyd client destory if it setup failed Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0561/1059] dm mpath: fix buffer overflow in parse_hw_handler() Greg Kroah-Hartman
` (438 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+4b232570d625662eaab4,
Zhao Feng, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
commit 8ba1ade3e6b595b9091040feaa3341d7e45ba95d upstream.
If percpu_counter_init() fails in crypt_ctr() (e.g. when the
underlying percpu allocation fails under memory pressure or fault
injection), the error path jumps to "bad", which calls
crypt_dtr(). crypt_dtr() then evaluates
WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0) and calls
percpu_counter_destroy() on a counter that was never initialized,
because __percpu_counter_init_many() returns -ENOMEM before
calling raw_spin_lock_init() on fbc->lock.
With lockdep enabled this triggers "INFO: trying to register
non-static key" in __percpu_counter_sum(), as reported by syzbot.
The console additionally shows "crypt: Unknown error (-ENOMEM)"
because this failure path sets no ti->error.
Move percpu_counter_init() to right after the allocation of cc,
before ti->private is set and before any "goto bad" can happen.
On failure, set ti->error and free cc directly, so that
crypt_dtr() is only ever called with an initialized counter.
Reported-by: syzbot+4b232570d625662eaab4@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=4b232570d625662eaab4
Fixes: 5059353df86e ("dm crypt: limit the number of allocated pages")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-crypt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3218,6 +3218,14 @@ static int crypt_ctr(struct dm_target *t
ti->error = "Cannot allocate encryption context";
return -ENOMEM;
}
+
+ ret = percpu_counter_init(&cc->n_allocated_pages, 0, GFP_KERNEL);
+ if (ret < 0) {
+ ti->error = "Cannot initialize page counter";
+ kfree_sensitive(cc);
+ return ret;
+ }
+
cc->key_size = key_size;
cc->sector_size = (1 << SECTOR_SHIFT);
cc->sector_shift = 0;
@@ -3229,10 +3237,6 @@ static int crypt_ctr(struct dm_target *t
crypt_calculate_pages_per_client();
spin_unlock(&dm_crypt_clients_lock);
- ret = percpu_counter_init(&cc->n_allocated_pages, 0, GFP_KERNEL);
- if (ret < 0)
- goto bad;
-
/* Optional parameters need to be read before cipher constructor */
if (argc > 5) {
ret = crypt_ctr_optional(ti, argc - 5, &argv[5]);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0561/1059] dm mpath: fix buffer overflow in parse_hw_handler()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (559 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0560/1059] dm crypt: fix use of uninitialized percpu_counter in ctr error path Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0562/1059] dm mpath: cap queue_if_no_path_timeout_secs Greg Kroah-Hartman
` (437 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
commit 8f611fe94a781c6fb658488cc7eab4e4923e6df6 upstream.
parse_hw_handler() builds the hw_handler parameter string in a buffer
sized with
len = 4;
plus one byte per argument. Those four bytes were meant for the decimal
form of the parameter count, three digits plus the terminating NUL.
dm_read_arg_group() accepts up to 1024 arguments and the count written is
'hw_argc - 1', so a count of 1000 or more needs four digits plus the NUL
and sprintf() writes one byte past the allocation.
Size the buffer from the actual string length instead.
Fixes: 2bfd2e1337f0 ("[SCSI] scsi_dh: Use scsi_dh_set_params() in multipath.")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-mpath.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1082,8 +1082,9 @@ static int parse_hw_handler(struct dm_ar
if (hw_argc > 1) {
char *p;
- int i, j, len = 4;
+ int i, j, len;
+ len = snprintf(NULL, 0, "%d", hw_argc - 1) + 1;
for (i = 0; i <= hw_argc - 2; i++)
len += strlen(as->argv[i]) + 1;
p = m->hw_handler_params = kzalloc(len, GFP_KERNEL);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0562/1059] dm mpath: cap queue_if_no_path_timeout_secs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (560 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0561/1059] dm mpath: fix buffer overflow in parse_hw_handler() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0563/1059] dm thin: avoid wrapping no_space_timeout Greg Kroah-Hartman
` (436 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <x-professor@outlook.com>
commit ae5b40accbc06f93e6a513e0e9a07fd32b197e49 upstream.
enable_nopath_timeout() arms the no-path timer with
jiffies + queue_if_no_path_timeout_secs * HZ. The module parameter is an
unbounded unsigned long, so the delay can exceed what mod_timer()
handles: a delay above LONG_MAX is treated as already expired, and
values above ULONG_MAX / HZ also wrap in the multiplication. The timer
then clears queue_if_no_path right away, and I/O queued after the last
path fails gets -EIO instead of waiting for the configured time.
On x86-64 with HZ=1000, 9223372036854776 seconds failed a write after
124 ms while one second less remained queued throughout a 4.2-second
observation window. A value of 18446744073709552 seconds wrapped to 384
jiffies and failed the write after 455 ms. On 32-bit kernels with
HZ=1000 the delay passes LONG_MAX above 2147483 seconds, a little under
25 days.
Cap the seconds value at the largest whole-second delay not exceeding
MAX_JIFFY_OFFSET before multiplying by HZ. This prevents signed-delta
overflow and multiplication wrap. The timer wheel's existing handling
of very long delays is unchanged.
Fixes: be240ff5e402 ("dm mpath: Add timeout mechanism for queue_if_no_path")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-mpath.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -801,7 +801,8 @@ static void queue_if_no_path_timeout_wor
static void enable_nopath_timeout(struct multipath *m)
{
unsigned long queue_if_no_path_timeout =
- READ_ONCE(queue_if_no_path_timeout_secs) * HZ;
+ min_t(unsigned long, READ_ONCE(queue_if_no_path_timeout_secs),
+ MAX_JIFFY_OFFSET / HZ) * HZ;
lockdep_assert_held(&m->lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0563/1059] dm thin: avoid wrapping no_space_timeout
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (561 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0562/1059] dm mpath: cap queue_if_no_path_timeout_secs Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0564/1059] dm-sysfs: fix misbehavior if kobject_init_and_add fails Greg Kroah-Hartman
` (435 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <1075151112@qq.com>
commit bcb78d49620f666b4a9d62997691e8d031fd4ebc upstream.
set_pool_mode() converts the no_space_timeout module parameter with
READ_ONCE(no_space_timeout_secs) * HZ. The usual arithmetic conversions
evaluate the product as unsigned int, so it can wrap before being stored
in the unsigned long delay. With HZ=1000, 4294968 seconds becomes 704
jiffies: a pool that runs out of data space switches to
error_if_no_space and fails queued writes with -ENOSPC after about 0.7
seconds.
Widen the value before the multiplication and cap it at
MAX_JIFFY_OFFSET / HZ, so large timeouts no longer wrap into short
delays. On 32-bit kernels, values beyond the supported jiffies range
saturate at the largest whole-second delay not exceeding
MAX_JIFFY_OFFSET. The timer wheel's existing handling of very long
delays is unchanged.
Fixes: 80c578930ce7 ("dm thin: add 'no_space_timeout' dm-thin-pool module param")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <1075151112@qq.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-thin.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2524,7 +2524,9 @@ static void set_pool_mode(struct pool *p
struct pool_c *pt = pool->ti->private;
bool needs_check = dm_pool_metadata_needs_check(pool->pmd);
enum pool_mode old_mode = get_pool_mode(pool);
- unsigned long no_space_timeout = READ_ONCE(no_space_timeout_secs) * HZ;
+ unsigned long no_space_timeout =
+ min_t(unsigned long, READ_ONCE(no_space_timeout_secs),
+ MAX_JIFFY_OFFSET / HZ) * HZ;
/*
* Never allow the pool to transition to PM_WRITE mode if user
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0564/1059] dm-sysfs: fix misbehavior if kobject_init_and_add fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (562 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0563/1059] dm thin: avoid wrapping no_space_timeout Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0565/1059] dm persistent data: test return value of node_copy Greg Kroah-Hartman
` (434 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka, Wentao Liang
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 406d576cc457203cf86eac7f17839b2efec81db4 upstream.
If kobject_init_and_add fails, we must call kobject_put (see the comment
at kobject_init_and_add).
Before calling kobject_init_and_add, we must zero the kobject (see
https://lwn.net/Articles/52085/). If the first call to dm_sysfs_init
failed, it may be called again, and that second call would see an
uninitialized kobject.
Cc: stable@vger.kernel.org
Fixes: 784aae735d9b ("dm: add name and uuid to sysfs")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-sysfs.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -131,9 +131,20 @@ static struct kobj_type dm_ktype = {
*/
int dm_sysfs_init(struct mapped_device *md)
{
- return kobject_init_and_add(dm_kobject(md), &dm_ktype,
- &disk_to_dev(dm_disk(md))->kobj,
- "%s", "dm");
+ struct kobject *kobj = dm_kobject(md);
+ int r;
+
+ /* The kobject must be zeroed before calling kobject_init */
+ memset(kobj, 0, sizeof(struct kobject));
+ r = kobject_init_and_add(kobj, &dm_ktype,
+ &disk_to_dev(dm_disk(md))->kobj,
+ "%s", "dm");
+ if (unlikely(r)) {
+ /* Weird semantics - we must call kobject_put on failure */
+ dm_sysfs_exit(md);
+ return r;
+ }
+ return 0;
}
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0565/1059] dm persistent data: test return value of node_copy
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (563 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0564/1059] dm-sysfs: fix misbehavior if kobject_init_and_add fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0566/1059] dm persistent data: dont ignore writeback errors Greg Kroah-Hartman
` (433 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 624d146d97c5fbe7200ef4b2dd5350ecf57d6b79 upstream.
There were 3 places where the return value of node_copy was not tested.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: c671ffa55d8b ("dm btree remove: change a bunch of BUG_ON() calls to proper errors")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/persistent-data/dm-btree-remove.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/md/persistent-data/dm-btree-remove.c
+++ b/drivers/md/persistent-data/dm-btree-remove.c
@@ -252,7 +252,9 @@ static int __rebalance2(struct dm_btree_
/*
* Merge
*/
- node_copy(left, right, -nr_right);
+ ret = node_copy(left, right, -nr_right);
+ if (unlikely(ret))
+ return ret;
left->header.nr_entries = cpu_to_le32(nr_left + nr_right);
delete_at(parent, r->index);
@@ -314,13 +316,16 @@ static int delete_center_node(struct dm_
{
uint32_t max_entries = le32_to_cpu(left->header.max_entries);
unsigned int shift = min(max_entries - nr_left, nr_center);
+ int ret;
if (nr_left + shift > max_entries) {
DMERR("node shift out of bounds");
return -EINVAL;
}
- node_copy(left, center, -shift);
+ ret = node_copy(left, center, -shift);
+ if (unlikely(ret))
+ return ret;
left->header.nr_entries = cpu_to_le32(nr_left + shift);
if (shift != nr_center) {
@@ -332,7 +337,9 @@ static int delete_center_node(struct dm_
}
node_shift(right, shift);
- node_copy(center, right, shift);
+ ret = node_copy(center, right, shift);
+ if (unlikely(ret))
+ return ret;
right->header.nr_entries = cpu_to_le32(nr_right + shift);
}
*key_ptr(parent, r->index) = right->keys[0];
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0566/1059] dm persistent data: dont ignore writeback errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (564 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0565/1059] dm persistent data: test return value of node_copy Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0567/1059] dm persistent data: dont leak bufio buffer if find_leaf fails Greg Kroah-Hartman
` (432 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit fa887f2ebee7aff97eb87b3365939616ade09774 upstream.
An error returned by ie_cache_writeback could be silently overwritten by
another successful ie_cache_writeback. This commit fixes disk_ll_commit,
so that it doesn't ignore the error and returns it immediatelly.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 6b06dd5a9722 ("dm space map disk: cache a small number of index entries")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/persistent-data/dm-space-map-common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -1190,17 +1190,20 @@ static dm_block_t disk_ll_max_entries(st
static int disk_ll_commit(struct ll_disk *ll)
{
- int r = 0;
+ int r;
unsigned int i;
for (i = 0; i < IE_CACHE_SIZE; i++) {
struct ie_cache *iec = ll->ie_cache + i;
- if (iec->valid && iec->dirty)
+ if (iec->valid && iec->dirty) {
r = ie_cache_writeback(ll, iec);
+ if (unlikely(r))
+ return r;
+ }
}
- return r;
+ return 0;
}
int sm_ll_new_disk(struct ll_disk *ll, struct dm_transaction_manager *tm)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0567/1059] dm persistent data: dont leak bufio buffer if find_leaf fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (565 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0566/1059] dm persistent data: dont ignore writeback errors Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0568/1059] dm snapshot: fix discard writing into the next COW chunk Greg Kroah-Hartman
` (431 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit b27523a0781aae0b51ac13f29dc65373d14b8434 upstream.
If find_leaf fails, the function dm_btree_cursor_begin would return an
error, but it would keep the dm-bufio buffers held. This would result in
a memory leak and a warning when releasing the dm-bufio cache.
This commit fixes it, so that dm_btree_cursor_begin releases the buffers
on error.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 7d111c81fa29 ("dm btree: introduce cursor api")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/persistent-data/dm-btree.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -1582,7 +1582,13 @@ int dm_btree_cursor_begin(struct dm_btre
if (r)
return r;
- return find_leaf(c);
+ r = find_leaf(c);
+ if (unlikely(r)) {
+ dm_btree_cursor_end(c);
+ return r;
+ }
+
+ return 0;
}
EXPORT_SYMBOL_GPL(dm_btree_cursor_begin);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0568/1059] dm snapshot: fix discard writing into the next COW chunk
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (566 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0567/1059] dm persistent data: dont leak bufio buffer if find_leaf fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0569/1059] dm zoned: back off when reclaim cannot make progress Greg Kroah-Hartman
` (430 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Chen Cheng, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <chencheng@fnnas.com>
commit 73174b4bb6fcd0e6cf973c9402a0fae2e567ad9f upstream.
zero_exception() zeroes one chunk of the COW device and takes the start
sector from bio->bi_iter.bi_sector. remap_exception() has already set
that to the COW chunk start plus the offset inside the chunk. That
offset is needed for reads and writes, but for a discard it is wrong:
the zeroing window is shifted, so the head of the target chunk keeps
its old data and the tail lands in the next COW chunk, which holds a
different exception.
io_overlaps_chunk() should have caught this, but it only compares the
length. "maps to entire chunks" in snapshot.rst also means the discard
has to start on a chunk boundary.
A discard that is not a full chunk has a second problem: after
remap_exception() it is sent to the COW device, where it hits a chunk
that still backs a live exception. After a discard the contents are
undefined, but the exception stays in the table and keeps pointing at
that chunk, so a later read returns whatever the discard left instead
of the snapshot's data.
Reproducer:
truncate -s 4M o.img c.img
o=$(losetup -f --show o.img)
c=$(losetup -f --show c.img)
dmsetup create snap --table \
"0 8192 snapshot $o $c P 512 1 discard_zeroes_cow"
# write two chunks, this creates two exceptions
head -c 256K /dev/zero | tr '\000' '\252' > pat
dd if=pat of=/dev/mapper/snap bs=256K seek=1 count=1 conv=notrunc
dd if=pat of=/dev/mapper/snap bs=256K seek=2 count=1 conv=notrunc
# shift the snapshot by 8 sectors, so a discard that is aligned on
# top is unaligned inside the snapshot
dmsetup create top --table "0 8184 linear /dev/mapper/snap 8"
blkdiscard -o 262144 -l 262144 /dev/mapper/top
sync
echo 3 > /proc/sys/vm/drop_caches
# chunk 1
dd if=/dev/mapper/snap bs=512 skip=512 count=8 | od -An -tx1 -N1
# chunk 2
dd if=/dev/mapper/snap bs=512 skip=1024 count=8 | od -An -tx1 -N1
Before: aa 00 <- chunk 2 was zeroed although it was not discarded
After: aa aa <- nothing written, a discard is only a hint
Fix it by requiring the discard to start on a chunk boundary in
io_overlaps_chunk(), and by finishing a discard that is not a full
chunk with bio_endio() instead of passing it down to the COW device.
Fixes: 2e6023850e17 ("dm snapshot: add optional discard support features")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Cheng <chencheng@fnnas.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-snap.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1958,8 +1958,8 @@ static void zero_exception(struct dm_sna
static bool io_overlaps_chunk(struct dm_snapshot *s, struct bio *bio)
{
- return bio->bi_iter.bi_size ==
- (s->store->chunk_size << SECTOR_SHIFT);
+ return bio->bi_iter.bi_size == (s->store->chunk_size << SECTOR_SHIFT) &&
+ !(bio->bi_iter.bi_sector & s->store->chunk_mask);
}
static int snapshot_map(struct dm_target *ti, struct bio *bio)
@@ -2019,11 +2019,13 @@ static int snapshot_map(struct dm_target
e = dm_lookup_exception(&s->complete, chunk);
if (e) {
remap_exception(s, e, bio, chunk);
- if (unlikely(bio_op(bio) == REQ_OP_DISCARD) &&
- io_overlaps_chunk(s, bio)) {
+ if (unlikely(bio_op(bio) == REQ_OP_DISCARD)) {
dm_exception_table_unlock(&lock);
up_read(&s->lock);
- zero_exception(s, e, bio, chunk);
+ if (io_overlaps_chunk(s, bio))
+ zero_exception(s, e, bio, chunk);
+ else
+ bio_endio(bio);
r = DM_MAPIO_SUBMITTED; /* discard is not issued */
goto out;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0569/1059] dm zoned: back off when reclaim cannot make progress
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (567 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0568/1059] dm snapshot: fix discard writing into the next COW chunk Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0570/1059] dm zoned: do not reclaim a random zone into another random zone Greg Kroah-Hartman
` (429 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyrylo Biryuk, Damien Le Moal,
Hannes Reinecke, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyrylo Biryuk <illofspeed@gmail.com>
commit 9bb1d14877f4929be17f7fdbeb4cfdf5025d464b upstream.
When a reclaim pass cannot make progress, dmz_reclaim_work() still ends
with dmz_schedule_reclaim(). If the target is idle, dmz_should_reclaim()
keeps returning true, the work is queued again with no delay and the
worker spins on the same failing pass. This patch handles two such
cases:
- dmz_do_reclaim() fails with -ENOSPC because no free zone is
available to copy the data into, for example on a target without
cache zones that has no free sequential zone left. The next patch
also makes this the expected result when an idle target with cache
zones has random zones but no free sequential zone.
- dmz_do_reclaim() finds no zone it can lock for reclaim and returns
-EBUSY. Since commit 90a9b8693f1b ("dm zoned: reclaim random zones
when idle"), dmz_should_reclaim() returns true on an idle target
whenever the total number of random (and cache) zones is non-zero,
whether or not any of them holds data. Each pass then also runs
dmz_check_dev(), which checks every device for media events (a TEST
UNIT READY on SCSI disks).
The -EBUSY loop lasts as long as the target stays idle; it ends when a
pass finishes while the target is busy and has enough free zones. On
three 27 TB host-managed SATA drives used as md RAID5 members (7.2.10
with the module built out of tree, all random zones free, target idle
for 300 seconds, kprobes attached, two other drives on the controller
being zero-filled), each member's SCSI device counted about 108,000
requests per second with the stock module and the system used about
915 s of CPU time, against about 46 s with this series. libata completes
TEST UNIT READY in software, so these counters do not measure commands
sent to the drives; the cost is CPU time.
When a pass fails with -ENOSPC or -EBUSY, retrying at once is unlikely
to make progress: re-arm the idle poll instead, so that reclaim is
retried after DMZ_IDLE_PERIOD unless a zone allocation or a "reclaim"
message queues it earlier. On a busy target, zone allocations can
restart reclaim immediately when free space is low enough to require
reclaim. Re-arming also keeps the poll running after a complete idle
drain. The poll can still stop after a pass that ends while reclaim is
not needed; that is unchanged.
Skip the device check for these two results: they normally mean that
there is no zone to copy into or no zone to reclaim, not that a device
failed, and the I/O paths check the devices themselves. Use
queue_delayed_work() so that work an allocation has already queued is
not postponed.
A pass that fails with an I/O error, for example on an unreadable block
of a device that stays online, is still retried at once while the
target is idle; this patch does not change that.
Tested on 7.4-rc1 with this patch and the next one, on three emulated
host-managed drives (scsi_debug, 1 GiB, 32 MiB zones) each under
dm-zoned as md RAID5 members, all random zones free and the target idle
for 300 seconds. With the stock module each member's SCSI device counted
about 70.2 million requests and the reclaim workers used 726 s of CPU.
With this series: 75 requests per member, 30 passes per worker (one per
DMZ_IDLE_PERIOD) and 0.08 s of CPU. Data written during the tests read
back with matching checksums, and no kernel warnings were logged.
Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target")
Fixes: 90a9b8693f1b ("dm zoned: reclaim random zones when idle")
Cc: stable@vger.kernel.org
Signed-off-by: Kyrylo Biryuk <illofspeed@gmail.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-zoned-reclaim.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/md/dm-zoned-reclaim.c
+++ b/drivers/md/dm-zoned-reclaim.c
@@ -539,6 +539,16 @@ static void dmz_reclaim_work(struct work
dmz_nr_rnd_zones(zmd, zrc->dev_idx));
ret = dmz_do_reclaim(zrc);
+ if (ret == -ENOSPC || ret == -EBUSY) {
+ /*
+ * No zone to copy into (-ENOSPC) or no zone to reclaim
+ * (-EBUSY): retrying at once cannot make progress and would
+ * spin. Poll again after the idle period instead, without
+ * postponing work that an allocation has already queued.
+ */
+ queue_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD);
+ return;
+ }
if (ret && ret != -EINTR) {
if (!dmz_check_dev(zmd))
return;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0570/1059] dm zoned: do not reclaim a random zone into another random zone
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (568 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0569/1059] dm zoned: back off when reclaim cannot make progress Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0571/1059] dm-cache: fix NULL pointer dereference on open failure Greg Kroah-Hartman
` (428 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Hannes Reinecke,
Kyrylo Biryuk, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyrylo Biryuk <illofspeed@gmail.com>
commit dab527d83462a618d99bfc96370ce45ae3428706 upstream.
dmz_reclaim_rnd_data() falls back to a random destination zone when no
free sequential zone is available and the target has cache zones. When
the target is idle and the cache zone list is empty,
dmz_get_rnd_zone_for_reclaim() selects random zones of the zoned device
as well, so a random zone is then copied into another random zone. That
frees nothing: the next pass picks the next random zone and copies it
again, for as long as the target stays idle.
Seen on a two-device target (256 GiB regular cache device plus a 27 TB
host-managed drive) used as an md RAID5 member: after a full rebuild
every chunk was mapped and no sequential zone was free, and the idle
drive kept reading and writing while the free zone counters
in "dmsetup status" did not change.
Only switch to a random destination zone when the zone being reclaimed
is a cache zone: moving it to the zoned device still frees cache space.
This depends on "dm zoned: back off when reclaim cannot make progress":
without it, dmz_reclaim_work() would retry the resulting -ENOSPC at
once, and run dmz_check_dev(), for as long as the target stays idle.
Tested on 7.4-rc1 together with the previous patch, on a two-device
target (a 512 MiB RAM-backed regular cache device plus a 1 GiB
scsi_debug host-managed drive) filled until no sequential zone was
free, then idle for 60 seconds: the stock module made 877
random-to-random copies; with this series it made none, and each pass
failed with -ENOSPC once per DMZ_IDLE_PERIOD without a device check.
Fixes: c5c788595292 ("dm zoned: start reclaim with sequential zones")
Cc: stable@vger.kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Kyrylo Biryuk <illofspeed@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-zoned-reclaim.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-zoned-reclaim.c
+++ b/drivers/md/dm-zoned-reclaim.c
@@ -290,7 +290,13 @@ static int dmz_reclaim_rnd_data(struct d
again:
szone = dmz_alloc_zone(zmd, zrc->dev_idx,
alloc_flags | DMZ_ALLOC_RECLAIM);
- if (!szone && alloc_flags == DMZ_ALLOC_SEQ && dmz_nr_cache_zones(zmd)) {
+ /*
+ * If no free sequential zone is available, a cache zone can still be
+ * moved into a free random zone of the zoned device, which frees cache
+ * space. Do not do this for a random zone: moving it into another
+ * random zone frees nothing and, on an idle target, repeats forever.
+ */
+ if (!szone && alloc_flags == DMZ_ALLOC_SEQ && dmz_is_cache(dzone)) {
alloc_flags = DMZ_ALLOC_RND;
goto again;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0571/1059] dm-cache: fix NULL pointer dereference on open failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (569 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0570/1059] dm zoned: do not reclaim a random zone into another random zone Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0572/1059] dm-cache: fix ending a cursor that never began Greg Kroah-Hartman
` (427 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit d12afc2f9ed6e14019fed9c02a74ad699915dc85 upstream.
When __begin_transaction_flags in metadata_open fails,
dm_cache_metadata_close is called. dm_cache_metadata_close attempts to
execute list_del(&cmd->list);, but the "cmd" object is not on any list
yet, thus it crashes with NULL pointer dereference.
Fix this by initializing cmd->list after cmd is allocated.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 9b1cc9f251af ("dm cache: share cache-metadata object across inactive and active DM tables")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-cache-metadata.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -765,6 +765,7 @@ static struct dm_cache_metadata *metadat
return ERR_PTR(-ENOMEM);
}
+ INIT_LIST_HEAD(&cmd->list);
cmd->version = metadata_version;
refcount_set(&cmd->ref_count, 1);
init_rwsem(&cmd->root_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0572/1059] dm-cache: fix ending a cursor that never began
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (570 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0571/1059] dm-cache: fix NULL pointer dereference on open failure Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0573/1059] dm-crypt: defer async write submission to write thread Greg Kroah-Hartman
` (426 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 421420758be348cb90715bfaa26e1211a12ff1d0 upstream.
If dm_bitset_cursor_begin fails, dm_array_cursor_end(&cmd->hint_cursor)
is called. However, cmd->hint_cursor was only initialized if the variable
hints_valid is true. Thus, we must also destroy hint_cursor only if
hints_valid is true.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 629d0a8a1a10 ("dm cache metadata: add "metadata2" feature")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-cache-metadata.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -1450,7 +1450,8 @@ static int __load_mappings(struct dm_cac
from_cblock(cmd->cache_blocks),
&cmd->dirty_cursor);
if (r) {
- dm_array_cursor_end(&cmd->hint_cursor);
+ if (hints_valid)
+ dm_array_cursor_end(&cmd->hint_cursor);
dm_array_cursor_end(&cmd->mapping_cursor);
return r;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0573/1059] dm-crypt: defer async write submission to write thread
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (571 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0572/1059] dm-cache: fix ending a cursor that never began Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0574/1059] dm-integrity: dont recalculate with HMAC because of a dirty bitmap Greg Kroah-Hartman
` (425 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Josef Schlehofer, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Schlehofer <pepe.schlehofer@gmail.com>
commit 6fed9e26810f0b466dbcebe35a73d1fd48793ff5 upstream.
With no_write_workqueue, kcryptd_crypt_write_io_submit() submits the
bio directly, even when called from kcryptd_async_done(). An async
cipher may run this callback in softirq or with BH disabled, where
submit_bio_noacct() must not be called because it can sleep.
Submit inline only when async is false. Async completions are sent to
the write thread, as is already done for submit_from_crypt_cpus. Use
the async flag rather than in_interrupt(), since callback context
depends on the cipher driver. Sync ciphers still submit inline.
Tested with cryptd in QEMU (x86_64 and arm64) with
CONFIG_DEBUG_ATOMIC_SLEEP, and on a P2020 running 6.18.55 without it.
In QEMU:
- 4k writes logging "sleeping function called from invalid context":
100/100 unpatched, 0/155 patched.
- nr_requests=4 on a loop device: 0/6 unpatched runs completed,
4/4 patched runs completed.
On the P2020, a warning in blk_mq_run_hw_queue() appeared in the
6th unpatched run and did not appear in 30 patched runs.
Fixes: 39d42fa96ba1 ("dm crypt: add flags to optionally bypass kcryptd workqueues")
Cc: stable@vger.kernel.org
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-crypt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1981,8 +1981,9 @@ static void kcryptd_crypt_write_io_submi
clone->bi_iter.bi_sector = cc->start + io->sector;
- if ((likely(!async) && test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags)) ||
- test_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags)) {
+ if (likely(!async) &&
+ (test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags) ||
+ test_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags))) {
dm_submit_bio_remap(io->base_bio, clone);
return;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0574/1059] dm-integrity: dont recalculate with HMAC because of a dirty bitmap
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (572 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0573/1059] dm-crypt: defer async write submission to write thread Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0575/1059] dm-integrity: dont attempt to commit journal on disabled device Greg Kroah-Hartman
` (424 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sinan Polat, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sinan Polat <sinan86polat@gmail.com>
commit 875a7161fe1574205293c36f7bbd0815023e48a1 upstream.
Commit 5c02406428d5 ("dm integrity: conditionally disable "recalculate"
feature") refuses a superblock with SB_FLAG_RECALCULATING if a keyed
hash is used without "legacy_recalculate". Otherwise someone who can
write to the device, but does not know the key, could modify data and
have the kernel compute valid tags for it.
dm_integrity_resume() can still start the same recalculation in J or D
mode: if SB_FLAG_DIRTY_BITMAP is set and the bitmap is not clear, or
log2_blocks_per_bitmap_bit does not match, it sets
SB_FLAG_RECALCULATING and recalc_sector = 0. The superblock is not
authenticated unless fix_hmac and journal_mac are both used, so the
flag can be set offline. Resume also runs on the first activation.
Apply the constructor's policy there. If recalculation is not allowed,
log an error and keep the existing tags, so modified blocks fail
verification. This also avoids queueing recalc_work on a NULL
recalc_wq when internal_hash is not used.
Fixes: 5c02406428d5 ("dm integrity: conditionally disable "recalculate" feature")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sinan Polat <sinan86polat@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-integrity.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -3267,6 +3267,24 @@ static bool superblock_changed(struct dm
memcmp(ic->sb->salt, ic->sb_copy->salt, SALT_SIZE) != 0;
}
+/*
+ * The superblock is authenticated only if fix_hmac and journal_mac are used,
+ * so SB_FLAG_DIRTY_BITMAP may have been set by someone who doesn't know the
+ * key. Apply the policy that the constructor applies to SB_FLAG_RECALCULATING.
+ */
+static bool dm_integrity_may_recalc_dirty_bitmap(struct dm_integrity_c *ic)
+{
+ if (!ic->internal_hash) {
+ DMERR("Dirty bitmap found, but internal_hash is not used");
+ return false;
+ }
+ if (dm_integrity_disable_recalculate(ic)) {
+ DMERR("Dirty bitmap found, but HMAC recalculation requires \"legacy_recalculate\"");
+ return false;
+ }
+ return true;
+}
+
static void dm_integrity_resume(struct dm_target *ti)
{
struct dm_integrity_c *ic = (struct dm_integrity_c *)ti->private;
@@ -3354,8 +3372,10 @@ static void dm_integrity_resume(struct d
if (!(ic->sb->log2_blocks_per_bitmap_bit == ic->log2_blocks_per_bitmap_bit &&
block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_TEST_ALL_CLEAR)) ||
ic->reset_recalculate_flag) {
- ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
- ic->sb->recalc_sector = cpu_to_le64(0);
+ if (dm_integrity_may_recalc_dirty_bitmap(ic)) {
+ ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
+ ic->sb->recalc_sector = cpu_to_le64(0);
+ }
}
init_journal(ic, 0, ic->journal_sections, 0);
replay_journal(ic);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0575/1059] dm-integrity: dont attempt to commit journal on disabled device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (573 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0574/1059] dm-integrity: dont recalculate with HMAC because of a dirty bitmap Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0576/1059] dm-raid: bound array_position before indexing failed_devices Greg Kroah-Hartman
` (423 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+94dac3c75477e184f0b0,
Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit e5e03918fbec31f0c896f4f43c2bd2aadf35d43d upstream.
If the device is disabled due to an error, we shouldn't attempt to flush
the journal. We jump straight to the label release_flush_bios, that will
call do_endio on all queued bios. do_endio will terminate the bios with
the error.
This fixes WARN_ON in the function pad_uncommitted reported by syzkaller.
Reported-by: syzbot+94dac3c75477e184f0b0@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=94dac3c75477e184f0b0
Fixes: 7eada909bfd7 ("dm: add integrity target")
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-integrity.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -2460,6 +2460,11 @@ static void integrity_commit(struct work
spin_lock_irq(&ic->endio_wait.lock);
flushes = bio_list_get(&ic->flush_bio_list);
+ if (unlikely(dm_integrity_failed(ic))) {
+ wake_up_locked(&ic->endio_wait);
+ spin_unlock_irq(&ic->endio_wait.lock);
+ goto release_flush_bios;
+ }
if (unlikely(ic->mode != 'J')) {
spin_unlock_irq(&ic->endio_wait.lock);
dm_integrity_flush_buffers(ic, true);
@@ -4669,7 +4674,6 @@ try_smaller_buffer:
r = create_journal(ic, &ti->error);
if (r)
goto bad;
-
}
if (ic->mode == 'B') {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0576/1059] dm-raid: bound array_position before indexing failed_devices
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (574 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0575/1059] dm-integrity: dont attempt to commit journal on disabled device Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0577/1059] dm-thin: fix leak if __set_snapshot_details fails Greg Kroah-Hartman
` (422 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jay Vadayath, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vadayath <jay@artiphishell.com>
commit 11b5cd14c0eecae458cecbe53d21a3dbc10190f5 upstream.
super_init_validation() reads role = le32_to_cpu(sb2->array_position)
out of an on-disk dm_raid_superblock and then uses it as a bit index into
the failed_devices bitmap via test_bit(role, (void *)failed_devices).
failed_devices is a uint64_t[DISKS_ARRAY_ELEMS] (DISKS_ARRAY_ELEMS == 4,
i.e. 256 bits) living on the stack. The only guard is role < 0, so any
on-disk array_position >= 256 makes test_bit() read past the end of the
stack array (array_position == 256 reads failed_devices[4], 8 bytes past
the object). For a raid1 set the role != raid_disk reorder branch falls
through to the same test_bit().
A crafted dm-raid superblock therefore causes a stack out-of-bounds read
during table load. Reachable by anyone able to issue a dmsetup create
with attacker-controlled metadata (CAP_SYS_ADMIN in the target
namespace); the crash fires in the constructor / analyse_superblocks
path, before any md_run or array sizing.
BUG: KASAN: stack-out-of-bounds in super_validate+0x1cd0/0x3390
Read of size 8 at addr ffff888007b17828 by task poc/152
Call Trace:
dump_stack_lvl+0x64/0x80
print_report+0xd0/0x630
kasan_report+0xe5/0x120
kasan_check_range+0x105/0x1b0
super_validate+0x1cd0/0x3390 (super_init_validation, inlined)
raid_ctr+0x2c4b/0xa0f0
dm_table_add_target+0x66f/0xf80
table_load+0x2ee/0x780
ctl_ioctl+0x362/0x9f0
dm_ctl_ioctl+0x9/0x10
__x64_sys_ioctl+0x134/0x1c0
do_syscall_64+0xe2/0x4b0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
role is a device position that must refer to an actual member of the
array, so reject anything outside [0, rs->raid_disks) instead of only the
negative case. rs->raid_disks is always <= the 256-bit capacity of
failed_devices, so this both closes the out-of-bounds access and matches
the intended semantics.
This bug was discovered by Artiphishell's vTriage pipeline, which
generated a crafted raid1 superblock (magic "DmRd", compat_features=1,
num_devices=2, array_position=256, level=1) and a dmsetup-create
reproducer that reliably triggers the KASAN report on an unpatched kernel
(the precursor DMINFO "raid device #256 now at position #0" is visible in
the serial log just before the splat). The fix below was drafted with the
Claude coding assistant; a userspace reproducer is available on request.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jay Vadayath <jay@artiphishell.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-raid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2395,7 +2395,8 @@ static int super_init_validation(struct
*/
if (!test_bit(FirstUse, &r->flags) && (r->raid_disk >= 0)) {
role = le32_to_cpu(sb2->array_position);
- if (role < 0)
+ /* Bound @role before it indexes the failed_devices stack bitmap. */
+ if (role < 0 || role >= rs->raid_disks)
continue;
if (role != r->raid_disk) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0577/1059] dm-thin: fix leak if __set_snapshot_details fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (575 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0576/1059] dm-raid: bound array_position before indexing failed_devices Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0578/1059] dm-thin: fix parsing of feature arguments Greg Kroah-Hartman
` (421 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit dfb95816cf6f2f2660af2ec64c65dc204c60b5e7 upstream.
If __set_snapshot_details fails, the variable td is leaked - this
prevents any other snapshot with the same id from being created.
Fix this by removing it from the list and freeing it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 991d9fa02da0 ("dm: add thin provisioning target")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-thin-metadata.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -1224,10 +1224,13 @@ static int __create_snap(struct dm_pool_
__close_device(td);
if (r)
- goto bad;
+ goto bad2;
return 0;
+bad2:
+ list_del(&td->list);
+ kfree(td);
bad:
dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root);
dm_btree_remove(&pmd->details_info, pmd->details_root,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0578/1059] dm-thin: fix parsing of feature arguments
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (576 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0577/1059] dm-thin: fix leak if __set_snapshot_details fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0579/1059] vt: serialise the producers of the flip buffer Greg Kroah-Hartman
` (420 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit c557fa19a83efad1e20eb733df821b745a4589ff upstream.
"struct dm_arg _args" limits the number of arguments to 4, but there are
5 possible arguments that can be specified.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5
Cc: stable@vger.kernel.org
Fixes: 787a996cb251 ("dm thin: add error_if_no_space feature")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-thin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3130,7 +3130,7 @@ static int parse_pool_features(struct dm
const char *arg_name;
static const struct dm_arg _args[] = {
- {0, 4, "Invalid number of pool feature arguments"},
+ {0, 5, "Invalid number of pool feature arguments"},
};
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0579/1059] vt: serialise the producers of the flip buffer
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (577 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0578/1059] dm-thin: fix parsing of feature arguments Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0580/1059] comedi: addi_apci_1500: fix clearing of the gate enable Greg Kroah-Hartman
` (419 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jiri Slaby, Nicolas Pitre,
Kees Cook, Joshua Rogers, Chris Mason, Helge Deller,
Thomas Zimmermann, Mingyu Wang, Randy Dunlap, Ronan Pigott,
Liav Mordouch
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
commit 5d1d814408c1c8e797031eac8ddd40de1a9e8e93 upstream.
Typing on a virtual console while the console replies to an escape
sequence can make the kernel write past the end of a buffer. A user who
can write to the foreground console can cause this on purpose if they
can also inject key events, through /dev/uinput or by writing to the
/dev/input/event* node of a keyboard.
Input for a tty goes through the flip buffer of its port. A driver
inserts the data with tty_insert_flip_*() and then calls
tty_flip_buffer_push() to pass it on to the line discipline. The insert
functions take no lock: they check that the current struct tty_buffer
has room, copy the data to offset ->used, and then advance ->used. So a
flip buffer supports only one producer at a time, and a driver that has
several must serialise them.
Four functions feed the flip buffer of a virtual console:
- put_queue(), puts_queue() and fn_send_intr() insert typed characters
and breaks for the keyboard handler. They run under kbd_event_lock.
- respond_string() inserts the reply when a program writes an escape
sequence that requests one, such as a cursor position report. It runs
under the console lock.
The keyboard handler gets its events from the input layer and feeds the
foreground console. Key events that a program writes to /dev/uinput or
to an event node reach it in the same way as typed keys.
The keyboard handler and respond_string() share no lock, so they can
interleave:
keyboard handler respond_string()
================ ================
room check passes
room check passes
memcpy() to offset used
used += len
memcpy() to offset used
used += len
/* used > size of the buffer */
The room check subtracts ->used from the size, and both are unsigned.
Once ->used exceeds the size, the result wraps, so the check always
passes, and each later insert lands further past the buffer.
Reproduced as root, with keys from a uinput keyboard and cursor position
reports on the same console: KFENCE reported an out-of-bounds write
1,024 bytes past the buffer in under 10 s.
Fix this by taking port->lock, with interrupts disabled, around the
insert and the push in these four functions. kbd_keycode() already takes
port->lock under kbd_event_lock, so this lock ordering is not new.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@kernel.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Nicolas Pitre <npitre@baylibre.com>
Cc: Kees Cook <kees+treewide@kernel.org>
Cc: Joshua Rogers <linux@joshua.hu>
Cc: Chris Mason <mason@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Mingyu Wang <25181214217@stu.xidian.edu.cn>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Ronan Pigott <ronan@rjp.ie>
Cc: Liav Mordouch <liavmordouch@gmail.com>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20261027-tty-llm-v1-1-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/vt/keyboard.c | 6 ++++++
drivers/tty/vt/vt.c | 2 ++
2 files changed, 8 insertions(+)
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -321,15 +321,20 @@ int kbd_rate(struct kbd_repeat *rpt)
/*
* Helper Functions.
+ *
+ * A flip buffer allows one producer at a time, and respond_string() in vt.c
+ * feeds the same one under the console lock. So take the lock of the port.
*/
static void put_queue(struct vc_data *vc, int ch)
{
+ guard(spinlock_irqsave)(&vc->port.lock);
tty_insert_flip_char(&vc->port, ch, 0);
tty_flip_buffer_push(&vc->port);
}
static void puts_queue(struct vc_data *vc, const char *cp)
{
+ guard(spinlock_irqsave)(&vc->port.lock);
tty_insert_flip_string(&vc->port, cp, strlen(cp));
tty_flip_buffer_push(&vc->port);
}
@@ -590,6 +595,7 @@ static void fn_inc_console(struct vc_dat
static void fn_send_intr(struct vc_data *vc)
{
+ guard(spinlock_irqsave)(&vc->port.lock);
tty_insert_flip_char(&vc->port, 0, TTY_BREAK);
tty_flip_buffer_push(&vc->port);
}
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1834,6 +1834,8 @@ static void csi_m(struct vc_data *vc)
static void respond_string(const char *p, size_t len, struct tty_port *port)
{
+ /* The keyboard handler feeds the same flip buffer. */
+ guard(spinlock_irqsave)(&port->lock);
tty_insert_flip_string(port, p, len);
tty_flip_buffer_push(port);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0580/1059] comedi: addi_apci_1500: fix clearing of the gate enable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (578 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0579/1059] vt: serialise the producers of the flip buffer Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0581/1059] comedi: ni_660x: dont poll without a DMA channel Greg Kroah-Hartman
` (418 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit ade85ceef46892425a08f3ee52ca06729ee4922e upstream.
INSN_CONFIG_SET_GATE_SRC reads the mode register of the counter/timer,
is meant to clear the External Gate Enable bit, sets it again if the
external gate was asked for, and writes the register back. The mask lacks
its '~': all the bits but EGE are cleared instead. So
- the external gate can be enabled but never be disabled again, and
- the instruction wipes the mode (continuous or single cycle, external
output, count and trigger enables, retrigger, duty cycle) which
INSN_CONFIG_SET_COUNTER_MODE has programmed: the timer silently falls
back to a single cycle pulse.
With the right mask, the instruction only changes the gate bit. An
application which sets the gate source after the counter mode now keeps
the mode it has asked for.
Fixes: a8c66b684efa ("staging: comedi: addi_apci_1500: rewrite the subdevice support functions")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-2-1899771ee15b@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/comedi/drivers/addi_apci_1500.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/comedi/drivers/addi_apci_1500.c
+++ b/drivers/comedi/drivers/addi_apci_1500.c
@@ -696,7 +696,7 @@ static int apci1500_timer_insn_config(st
return -EINVAL;
val = z8536_read(dev, Z8536_CT_MODE_REG(chan));
- val &= Z8536_CT_MODE_EGE;
+ val &= ~Z8536_CT_MODE_EGE;
if (data[1] == 1)
val |= Z8536_CT_MODE_EGE;
else if (data[1] > 1)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0581/1059] comedi: ni_660x: dont poll without a DMA channel
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (579 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0580/1059] comedi: addi_apci_1500: fix clearing of the gate enable Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0582/1059] comedi: ni_tio: Fix overflow of the clock period Greg Kroah-Hartman
` (417 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 5a0c88567a5ebbe24ecb7828e200f63ed972718f upstream.
A counter command owns a MITE DMA channel from ni_660x_cmd() to
ni_660x_cancel(). A command does not only end by COMEDI_CANCEL: when the
reader is too slow mite_sync_input_dma() sets COMEDI_CB_OVERFLOW, and
counter errors set COMEDI_CB_ERROR, and comedi_handle_events() then calls
->cancel() from the interrupt handler. That releases the channel and
clears counter->mite_chan, but s->busy stays set until the owner has read
the rest of the data and seen the end of the acquisition.
do_poll_ioctl() only looks at s->busy, so a COMEDI_POLL in that state
ends in mite_sync_dma(NULL, s), which dereferences the channel.
Test the channel like ni_pcidio_poll() and ni_sync_ai_dma() do. The
pointer only changes under dev->mutex, which the ioctl holds, or in the
interrupt handler under interrupt_lock, which is taken here.
Fixes: 894db1197347 ("Staging: Comedi: ni_600x: Added support for comedi_poll.")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-3-1899771ee15b@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/comedi/drivers/ni_660x.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/comedi/drivers/ni_660x.c
+++ b/drivers/comedi/drivers/ni_660x.c
@@ -459,7 +459,8 @@ static int ni_660x_input_poll(struct com
/* lock to avoid race with comedi_poll */
spin_lock_irqsave(&devpriv->interrupt_lock, flags);
- mite_sync_dma(counter->mite_chan, s);
+ if (counter->mite_chan)
+ mite_sync_dma(counter->mite_chan, s);
spin_unlock_irqrestore(&devpriv->interrupt_lock, flags);
return comedi_buf_read_n_available(s);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0582/1059] comedi: ni_tio: Fix overflow of the clock period
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (580 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0581/1059] comedi: ni_660x: dont poll without a DMA channel Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0583/1059] comedi: vmk80xx: report failed transfers of the K8061 Greg Kroah-Hartman
` (416 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik, Ian Abbott
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit ec214735bb113be747454812035b83010892e0d2 upstream.
ni_tio_set_clock_src() stores the period of the clock source, which the
user passes in nanoseconds, in picoseconds:
counter->clock_period_ps = period_ns * 1000;
period_ns is an unsigned int, so that the product is computed in 32
bits, although clock_period_ps is a u64. It wraps for periods above
4294967 ns, that is for external clocks slower than 233 Hz.
INSN_CONFIG_GET_CLOCK_SRC then reports a wrong period, and
ni_tio_set_sync_mode() decides on a wrong one: 4294968 ns become 704 ps,
which is below the limit of 25 ns under which the alternate
synchronization mode for fast clocks is switched on.
The multiplication was done in 64 bits until the constant
pico_per_nano, a uint64_t, was replaced by a literal. Widen again.
Fixes: 3e90b1c7ebe9 ("staging: comedi: ni_tio: tidy up ni_tio_set_clock_src() and helpers")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-4-1899771ee15b@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/comedi/drivers/ni_tio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/comedi/drivers/ni_tio.c
+++ b/drivers/comedi/drivers/ni_tio.c
@@ -800,7 +800,7 @@ static int ni_tio_set_clock_src(struct n
GI_PRESCALE_X2(counter_dev->variant) |
GI_PRESCALE_X8(counter_dev->variant), bits);
}
- counter->clock_period_ps = period_ns * 1000;
+ counter->clock_period_ps = (u64)period_ns * 1000;
ni_tio_set_sync_mode(counter);
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0583/1059] comedi: vmk80xx: report failed transfers of the K8061
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (581 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0582/1059] comedi: ni_tio: Fix overflow of the clock period Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0584/1059] iio: addac: ad74413r: fix the values of set_multiple Greg Kroah-Hartman
` (415 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 92fa93505576188acc22c5de1999db9a1c70c09b upstream.
For the K8061 board vmk80xx_read_packet() and vmk80xx_write_packet() call
vmk80xx_do_bulk_msg(), which ignores the result of its two bulk transfers,
and return 0. After a timeout, a stall or an unplug the instruction
handlers therefore go on and hand the old content of usb_rx_buf to user
space as a fresh sample (analog and digital inputs, counters, PWM and
output read-back), and writes to the outputs are reported as done.
All callers check the result already, because the K8055 branch of the two
functions returns that of usb_interrupt_msg(). Return the error of the
bulk transfers as well, and don't wait for an answer to a command that
could not be sent.
Fixes: 985cafccbf9b ("Staging: Comedi: vmk80xx: Add k8061 support")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-5-1899771ee15b@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/comedi/drivers/vmk80xx.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -151,7 +151,7 @@ struct vmk80xx_private {
enum vmk80xx_model model;
};
-static void vmk80xx_do_bulk_msg(struct comedi_device *dev)
+static int vmk80xx_do_bulk_msg(struct comedi_device *dev)
{
struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb = comedi_to_usb_dev(dev);
@@ -161,6 +161,7 @@ static void vmk80xx_do_bulk_msg(struct c
unsigned int rx_pipe;
size_t tx_size;
size_t rx_size;
+ int ret;
tx_addr = devpriv->ep_tx->bEndpointAddress;
rx_addr = devpriv->ep_rx->bEndpointAddress;
@@ -169,11 +170,13 @@ static void vmk80xx_do_bulk_msg(struct c
tx_size = usb_endpoint_maxp(devpriv->ep_tx);
rx_size = usb_endpoint_maxp(devpriv->ep_rx);
- usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf, tx_size, NULL,
- PACKET_TIMEOUT);
+ ret = usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf, tx_size, NULL,
+ PACKET_TIMEOUT);
+ if (ret)
+ return ret;
- usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL,
- PACKET_TIMEOUT);
+ return usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL,
+ PACKET_TIMEOUT);
}
static int vmk80xx_read_packet(struct comedi_device *dev)
@@ -183,10 +186,8 @@ static int vmk80xx_read_packet(struct co
struct usb_endpoint_descriptor *ep;
unsigned int pipe;
- if (devpriv->model == VMK8061_MODEL) {
- vmk80xx_do_bulk_msg(dev);
- return 0;
- }
+ if (devpriv->model == VMK8061_MODEL)
+ return vmk80xx_do_bulk_msg(dev);
ep = devpriv->ep_rx;
pipe = usb_rcvintpipe(usb, ep->bEndpointAddress);
@@ -204,10 +205,8 @@ static int vmk80xx_write_packet(struct c
devpriv->usb_tx_buf[0] = cmd;
- if (devpriv->model == VMK8061_MODEL) {
- vmk80xx_do_bulk_msg(dev);
- return 0;
- }
+ if (devpriv->model == VMK8061_MODEL)
+ return vmk80xx_do_bulk_msg(dev);
ep = devpriv->ep_tx;
pipe = usb_sndintpipe(usb, ep->bEndpointAddress);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0584/1059] iio: addac: ad74413r: fix the values of set_multiple
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (582 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0583/1059] comedi: vmk80xx: report failed transfers of the K8061 Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0585/1059] iio: hid-sensors: fix a division by zero Greg Kroah-Hartman
` (414 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik, Nuno Sá,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit e6dfbd84b833ed595a5236b027357e917de28260 upstream.
ad74413r_gpio_set_multiple() walks over the lines in the mask and looks up
the new value of each with
if (*bits & offset)
offset is the number of the line, not a bit mask. Line 0 is always driven
low, line 1 gets the value meant for line 0, line 2 the one meant for line
1, and line 3 is driven high if either of these two is.
Test the bit which belongs to the line.
Fixes: fea251b6a5db ("iio: addac: add AD74413R driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/addac/ad74413r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -296,7 +296,7 @@ static void ad74413r_gpio_set_multiple(s
return;
real_mask |= BIT(real_offset);
- if (*bits & offset)
+ if (test_bit(offset, bits))
real_bits |= BIT(real_offset);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0585/1059] iio: hid-sensors: fix a division by zero
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (583 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0584/1059] iio: addac: ad74413r: fix the values of set_multiple Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0586/1059] misc: bcm-vk: fix DMA allocation memory leak Greg Kroah-Hartman
` (413 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Srinivas Pandruvada, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit fd4c92bbd3a64556e81042ff8d30545b15a3b93a upstream.
convert_to_vtf_format() divides the micro part of a value by
10^(6 + exp). The unit exponent of a HID field is a nibble and goes
down to -8. For -7 and -8 the argument of int_pow() is negative, which
the unsigned parameter turns into a huge power of ten: 0 modulo 2^64.
The division by it is a divide error. The exponent comes from the report
descriptor of the sensor hub, the value from a write to the hysteresis
attribute of the IIO device.
Multiply by 10^(-exp - 6) in these two cases.
Fixes: 73c6768b710a ("iio: hid-sensors: Common attribute and trigger")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -137,7 +137,10 @@ static u32 convert_to_vtf_format(int siz
if (val1 < 0 || val2 < 0)
sign = -1;
exp = hid_sensor_convert_exponent(exp);
- if (exp < 0) {
+ if (exp < -6) {
+ value = abs(val1) * int_pow(10, -exp);
+ value += abs(val2) * int_pow(10, -exp - 6);
+ } else if (exp < 0) {
divisor = int_pow(10, 6 + exp);
value = abs(val1) * int_pow(10, -exp);
value += abs(val2) / divisor;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0586/1059] misc: bcm-vk: fix DMA allocation memory leak
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (584 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0585/1059] iio: hid-sensors: fix a division by zero Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0587/1059] misc: ibmvmc: initialize HMC state before device registration Greg Kroah-Hartman
` (412 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guangshuo Li
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
commit a36b3db60466d44eefcc5c252ce927c043429922 upstream.
bcm_vk_dma_alloc() leaks dma->pages and pinned user-page references
when page pinning or coherent SG allocation fails. DMA mapping
failures can also leave the SG list and earlier mappings unreleased,
as bcm_vk_sg_alloc() skips the partially initialized slot.
This issue was found by our static analysis tool under development.
Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20261027150921.137189-1-lgs201920130244@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/misc/bcm-vk/bcm_vk_sg.c | 43 +++++++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 7 deletions(-)
--- a/drivers/misc/bcm-vk/bcm_vk_sg.c
+++ b/drivers/misc/bcm-vk/bcm_vk_sg.c
@@ -80,7 +80,8 @@ static int bcm_vk_dma_alloc(struct devic
dma->nr_pages = (err >= 0) ? err : 0;
dev_err(dev, "get_user_pages_fast, err=%d [%d]\n",
err, dma->nr_pages);
- return err < 0 ? err : -EINVAL;
+ err = err < 0 ? err : -EINVAL;
+ goto err_pages;
}
/* Max size of sg list is 1 per mapped page + fields at start */
@@ -92,8 +93,10 @@ static int bcm_vk_dma_alloc(struct devic
dma->sglen,
&dma->handle,
GFP_KERNEL);
- if (!dma->sglist)
- return -ENOMEM;
+ if (!dma->sglist) {
+ err = -ENOMEM;
+ goto err_pages;
+ }
dma->sglist[SGLIST_NUM_SG] = 0;
dma->sglist[SGLIST_TOTALSIZE] = vkdata->size;
@@ -110,8 +113,8 @@ static int bcm_vk_dma_alloc(struct devic
dma->direction);
transfer_size = size;
if (unlikely(dma_mapping_error(dev, sg_addr))) {
- __free_page(dma->pages[0]);
- return -EIO;
+ err = -EIO;
+ goto err_sglist;
}
for (i = 1; i < dma->nr_pages; i++) {
@@ -123,8 +126,8 @@ static int bcm_vk_dma_alloc(struct devic
size,
dma->direction);
if (unlikely(dma_mapping_error(dev, addr))) {
- __free_page(dma->pages[i]);
- return -EIO;
+ err = -EIO;
+ goto err_unmap;
}
/*
@@ -169,6 +172,32 @@ static int bcm_vk_dma_alloc(struct devic
#endif
return 0;
+
+err_unmap:
+ /*
+ * Unmap completed SG entries and the in-progress DMA range,
+ * which has not been written to the SG list yet.
+ */
+ sgdata = (struct _vk_data *)&dma->sglist[SGLIST_VKDATA_START];
+ for (i = 0; i < dma->sglist[SGLIST_NUM_SG]; i++) {
+ size = sgdata[i].size;
+ addr = get_unaligned(&sgdata[i].address);
+ dma_unmap_page(dev, addr, size, dma->direction);
+ }
+ dma_unmap_page(dev, sg_addr, transfer_size, dma->direction);
+
+err_sglist:
+ dma_free_coherent(dev, dma->sglen, dma->sglist, dma->handle);
+
+err_pages:
+ for (i = 0; i < dma->nr_pages; i++)
+ put_page(dma->pages[i]);
+ kfree(dma->pages);
+ dma->pages = NULL;
+ dma->sglist = NULL;
+ dma->sglen = 0;
+ dma->nr_pages = 0;
+ return err;
}
int bcm_vk_sg_alloc(struct device *dev,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0587/1059] misc: ibmvmc: initialize HMC state before device registration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (585 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0586/1059] misc: bcm-vk: fix DMA allocation memory leak Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.1 0588/1059] serial: 8250_lpss: dont divide by 0 above 6.25 Mbaud Greg Kroah-Hartman
` (411 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Jiale Yao
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
commit 2022f170e5655c40b93ed98629f7d0adb98cea49 upstream.
misc_register() exposes the IBM VMC device before the HMC state and
spinlocks are initialized. A userspace operation racing module
initialization can therefore access an HMC through an uninitialized
spinlock.
Initialize all HMC state before registering the misc device.
Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
Cc: stable <stable@kernel.org>
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Link: https://patch.msgid.link/20261028044828.96177-5-yaojiale02@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/misc/ibmvmc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -2367,14 +2367,6 @@ static int __init ibmvmc_module_init(voi
ibmvmc.state = ibmvmc_state_initial;
pr_info("ibmvmc: version %s\n", IBMVMC_DRIVER_VERSION);
- rc = misc_register(&ibmvmc_miscdev);
- if (rc) {
- pr_err("ibmvmc: misc registration failed\n");
- goto misc_register_failed;
- }
- pr_info("ibmvmc: node %d:%d\n", MISC_MAJOR,
- ibmvmc_miscdev.minor);
-
/* Initialize data structures */
memset(hmcs, 0, sizeof(struct ibmvmc_hmc) * MAX_HMCS);
for (i = 0; i < MAX_HMCS; i++) {
@@ -2384,6 +2376,14 @@ static int __init ibmvmc_module_init(voi
hmcs[i].queue_outbound_msgs[j] = VMC_INVALID_BUFFER_ID;
}
+ rc = misc_register(&ibmvmc_miscdev);
+ if (rc) {
+ pr_err("ibmvmc: misc registration failed\n");
+ goto misc_register_failed;
+ }
+ pr_info("ibmvmc: node %d:%d\n", MISC_MAJOR,
+ ibmvmc_miscdev.minor);
+
/* Sanity check module parms */
ibmvmc_scrub_module_parms();
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0588/1059] serial: 8250_lpss: dont divide by 0 above 6.25 Mbaud
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (586 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0587/1059] misc: ibmvmc: initialize HMC state before device registration Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0589/1059] serial: samsung: dont leak the tty on an RX IRQ Greg Kroah-Hartman
` (410 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Ilpo Järvinen,
Andy Shevchenko, Jiri Slaby, Heikki Krogerus, Peter Hurley,
Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 08daebfd63e9054e097eb2653eff9381de43a422 upstream.
byt_set_termios() derives the clock of the UART from the baud rate in
the termios, which nobody has looked at yet:
fuart = baud * 16;
...
fuart *= rounddown_pow_of_two(fref / fuart);
...
p->uartclk = fuart;
fref is 100 MHz. For a baud rate above 6250000, which BOTHER allows,
fref / fuart is 0, and rounddown_pow_of_two(0) shifts 1UL by -1. On x86
that is 1UL << 63, the product with a multiple of 16 is 0, and so is
uartclk. serial8250_get_baud_rate() then passes 0 for both limits,
uart_get_baud_rate() finds no rate which fits, WARNs and returns 0, and
uart_get_divisor() or dw8250_get_divisor() divide by 16 * 0.
Everybody who may open the tty can oops the kernel with one TCSETS2.
Don't ask for more than fref. The limits are those of a 100 MHz clock
then, and uart_get_baud_rate() falls back to the old rate as for any
other rate that the port cannot do. 8250_mid, which has the same
formula, treats this case separately.
Fixes: 21947ba654a6 ("serial: 8250_pci: replace switch-case by formula")
Cc: stable <stable@kernel.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20261027-tty-llm-v1-16-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/8250/8250_lpss.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -82,6 +82,9 @@ static void byt_set_termios(struct uart_
/* Gracefully handle the B0 case: fall back to B9600 */
fuart = fuart ? fuart : 9600 * 16;
+ /* Fuart <= Fref: leave it to the core to refuse a higher baud rate */
+ fuart = min(fuart, fref);
+
/* Get Fuart closer to Fref */
fuart *= rounddown_pow_of_two(fref / fuart);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0589/1059] serial: samsung: dont leak the tty on an RX IRQ
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (587 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.1 0588/1059] serial: 8250_lpss: dont divide by 0 above 6.25 Mbaud Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0590/1059] serial: samsung: put the previous baud clock Greg Kroah-Hartman
` (409 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Krzysztof Kozlowski,
Peter Griffin, Alim Akhtar, Jiri Slaby, Robert Baldyga,
Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 7ada442f5ef77f8d53f608a0141a5e88a888ca9f upstream.
s3c24xx_serial_rx_chars_dma() starts by taking a reference to the tty.
If the interrupt is not a receive timeout, it switches the port from PIO
back to DMA and leaves through the "finish" label, which does not drop
the reference.
A port with RX DMA changes to PIO on every receive timeout, that is at
the end of every burst of data, and comes back this way when the next
burst starts. So each burst takes a reference which is never dropped,
and the tty structure is not freed when the port is closed for the last
time.
Drop the reference on both paths.
Fixes: b543c301c2c5 ("serial: samsung: add DMA support for RX")
Cc: stable <stable@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20261027-tty-llm-v1-21-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/samsung_tty.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -742,14 +742,13 @@ static irqreturn_t s3c24xx_serial_rx_cha
s3c24xx_serial_rx_drain_fifo(ourport);
- if (tty) {
+ if (tty)
tty_flip_buffer_push(t);
- tty_kref_put(tty);
- }
wr_regl(port, S3C2410_UTRSTAT, S3C2410_UTRSTAT_TIMEOUT);
finish:
+ tty_kref_put(tty);
uart_port_unlock(port);
return IRQ_HANDLED;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0590/1059] serial: samsung: put the previous baud clock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (588 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0589/1059] serial: samsung: dont leak the tty on an RX IRQ Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0591/1059] tty: fix misapplied compat_ptr() in tty_compat_ioctl() Greg Kroah-Hartman
` (408 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Krzysztof Kozlowski,
Peter Griffin, Alim Akhtar, Jiri Slaby, Kukjin Kim,
Thomas Abraham, Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit eedf2cf3505c1562a2fb24f8b997056f023d242b upstream.
s3c24xx_serial_getclk() returns the best baud clock with the reference
which clk_get() has taken. s3c24xx_serial_set_termios() stores it in
ourport->baudclk and disables the clock which was there before, but does
not put it.
clk_get() hands out a new handle on every call, so the new clock never
equals the old one, and every call of ->set_termios() leaks a handle: a
struct clk and a copy of the connection name. Whoever has the port open
can repeat that at will with tcsetattr().
Put the old clock when it is replaced, and the new one in case it is not
stored.
Fixes: 5f5a7a5578c5 ("serial: samsung: switch to clkdev based clock lookup")
Cc: stable <stable@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20261027-tty-llm-v1-22-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/samsung_tty.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -1570,11 +1570,14 @@ static void s3c24xx_serial_set_termios(s
if (!IS_ERR(ourport->baudclk)) {
clk_disable_unprepare(ourport->baudclk);
+ clk_put(ourport->baudclk);
ourport->baudclk = ERR_PTR(-EINVAL);
}
ourport->baudclk = clk;
ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
+ } else {
+ clk_put(clk);
}
if (ourport->info->has_divslot) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0591/1059] tty: fix misapplied compat_ptr() in tty_compat_ioctl()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (589 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0590/1059] serial: samsung: put the previous baud clock Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0592/1059] usb: pci-quirks: always assert xHCI OS ownership Greg Kroah-Hartman
` (407 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiri Slaby (SUSE)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby (SUSE) <jirislaby@kernel.org>
commit 895dc0eaa2779ff46a0b2a20b5ce9eb0b1125cb2 upstream.
Since commit f0193d3ea73b below, `cmd` was converted with compat_ptr(),
while `arg` was passed to ld->ops->ioctl() unmodified. Fix it so `cmd`
stays `cmd` and `arg` gets converted through compat_ptr() as intended.
Notes:
2) compat_ptr() did nothing to `cmd`, provided it is uint,
1) compat_ptr() is no-op everywhere (was different on s390 before
8e0b986c59c6 ("s390: Remove compat support")),
3) `arg` might not have been chopped correctly until 8e0b986c59c6. But I
am not sure why noone noticed all those (7) years (from f0193d3ea73b
to 8e0b986c59c6)?
Fixes: f0193d3ea73b ("change semantics of ldisc ->compat_ioctl()")
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: stable@vger.kernel.org # applicable from 4.20 to 6.18 incl
Assisted-by: LLM
Link: https://patch.msgid.link/63e9d84a1e8e23852423206cf3f8907aafc88f17.1793704520.git.jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/tty_io.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2980,8 +2980,7 @@ static long tty_compat_ioctl(struct file
if (ld->ops->compat_ioctl)
retval = ld->ops->compat_ioctl(tty, cmd, arg);
if (retval == -ENOIOCTLCMD && ld->ops->ioctl)
- retval = ld->ops->ioctl(tty, (unsigned long)compat_ptr(cmd),
- arg);
+ retval = ld->ops->ioctl(tty, cmd, (unsigned long)compat_ptr(arg));
tty_ldisc_deref(ld);
return retval;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0592/1059] usb: pci-quirks: always assert xHCI OS ownership
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (590 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0591/1059] tty: fix misapplied compat_ptr() in tty_compat_ioctl() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0593/1059] USB: serial: garmin_gps: fix deadlock on reset request Greg Kroah-Hartman
` (406 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mario Limonciello (AMD), McKenna Fan,
Quinn Schive, Bruno Filipe, Maciej Zonski, Rishabh Jain,
Mathias Nyman
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rishabh Jain <rishabh.jain1198@gmail.com>
commit 5550405351199fe78f4a3cd606c07f5ad7220e1b upstream.
The xHCI ownership protocol requires the OS driver to assert the HC OS
Owned semaphore before using the host controller, then wait for HC BIOS
Owned to clear if firmware owns it.
quirk_usb_handoff_xhci() currently asserts OS Owned only when BIOS Owned
is already set. If firmware leaves BIOS Owned clear, Linux uses the xHC
while both ownership semaphores remain clear.
The timeout fallback also clears BIOS Owned using the original register
value, which can clear OS Owned at the same time.
On an AMD PROM21 xHCI controller (1022:43fc), this caused every S3
resume to terminate Controller Restore State with USBSTS 0x401. Linux
then reset the host controller, both root hubs and the USB Bluetooth
adapter.
The controller entered resume ready and halted with USBSTS 0x1.
Endpoint state, 100 ms save/restore delays, scratchpads, the DCBAA,
device contexts and command, event and transfer rings were verified not
to cause the restore error.
Across four S3 cycles, asserting only HC OS Owned changed USBLEGSUP from
0x00000801 to 0x01000801 and eliminated the restore failure. Testing
included the unmodified 7.1.8-ogc1.1.fc44.x86_64 distribution kernel
using a test module that set the HC OS Owned semaphore. The same test
was repeated after review with the same result. Clearing USBLEGCTLSTS
was independently verified to be unnecessary.
Always assert OS Owned for controllers using the standard xHCI handoff,
and leave the existing TI/Renesas forced handoff unchanged. Keep OS
Owned asserted after the standard handoff, including when forcing BIOS
Owned clear after a timeout, to prevent firmware from reclaiming the
controller during subsequent suspends.
Fixes: 66d4eadd8d06 ("USB: xhci: BIOS handoff and HW initialization.")
Cc: stable@vger.kernel.org
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Tested-by: McKenna Fan <blue_sun@tuta.io>
Tested-by: Quinn Schive <quinnschive@hotmail.com>
Tested-by: Bruno Filipe <bmilreu@gmail.com>
Tested-by: Maciej Zonski <me@zonni.pl>
Signed-off-by: Rishabh Jain <rishabh.jain1198@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20261105175106.241182-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/host/pci-quirks.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -1182,10 +1182,11 @@ static void quirk_usb_handoff_xhci(struc
&& pdev->device == 0x0014)) {
val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED;
writel(val, base + ext_cap_offset);
- }
-
- /* If the BIOS owns the HC, signal that the OS wants it, and wait */
- if (val & XHCI_HC_BIOS_OWNED) {
+ } else {
+ /*
+ * Perform the standard handoff and leave OS ownership set to
+ * keep the BIOS at bay during subsequent suspends.
+ */
writel(val | XHCI_HC_OS_OWNED, base + ext_cap_offset);
/* Wait for 1 second with 10 microsecond polling interval */
@@ -1197,7 +1198,9 @@ static void quirk_usb_handoff_xhci(struc
dev_warn(&pdev->dev,
"xHCI BIOS handoff failed (BIOS bug ?) %08x\n",
val);
- writel(val & ~XHCI_HC_BIOS_OWNED, base + ext_cap_offset);
+ writel((val | XHCI_HC_OS_OWNED) &
+ ~XHCI_HC_BIOS_OWNED,
+ base + ext_cap_offset);
}
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0593/1059] USB: serial: garmin_gps: fix deadlock on reset request
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (591 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0592/1059] usb: pci-quirks: always assert xHCI OS ownership Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0594/1059] USB: serial: oti6858: fix the teardown order in close Greg Kroah-Hartman
` (405 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Josef Bacik, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit ab89a9dab02d9553eb0cc27fd3e4a4998acbc8e9 upstream.
The garmin_gps driver has a reset feature that is supposed to reset the
device when writing a private reset request packet. The reset is however
done synchronously from the write() callback (and without holding the
required device lock) which leads to a deadlock in the line discipline
when hanging up the port as part of disconnect.
Switch to using the asynchronous reset interface while dropping the
redundant and synchronous stopping of the interrupt urb (write()
callbacks are supposed to be atomic and USB core, USB serial core and
the driver itself will unlink and kill all URBs during disconnect).
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/2026102733-prayer-drainer-56f3@gregkh
Cc: stable@vger.kernel.org
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/garmin_gps.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -822,10 +822,9 @@ static void priv_status_resp(struct usb_
* Garmin specific driver functions
******************************************************************************/
-static int process_resetdev_request(struct usb_serial_port *port)
+static void process_resetdev_request(struct usb_serial_port *port)
{
unsigned long flags;
- int status;
struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
spin_lock_irqsave(&garmin_data_p->lock, flags);
@@ -834,13 +833,8 @@ static int process_resetdev_request(stru
garmin_data_p->serial_num = 0;
spin_unlock_irqrestore(&garmin_data_p->lock, flags);
- usb_kill_urb(port->interrupt_in_urb);
- dev_dbg(&port->dev, "%s - usb_reset_device\n", __func__);
- status = usb_reset_device(port->serial->dev);
- if (status)
- dev_dbg(&port->dev, "%s - usb_reset_device failed: %d\n",
- __func__, status);
- return status;
+ dev_dbg(&port->dev, "%s - usb_queue_reset_device\n", __func__);
+ usb_queue_reset_device(port->serial->interface);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0594/1059] USB: serial: oti6858: fix the teardown order in close
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (592 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0593/1059] USB: serial: garmin_gps: fix deadlock on reset request Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0595/1059] usb: uas: ignore UAS for ASMT135x bridges (174c:55aa) Greg Kroah-Hartman
` (404 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Johan Hovold, Josef Bacik
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit f184ae84a5d19554d980a918a9c8baaef87ac301 upstream.
The driver passes a baton around: the completion handler of the
interrupt urb either resubmits the urb, submits the read urb or
schedules one of the two delayed works, and the works and the bulk
completion handlers submit the interrupt urb again.
oti6858_close() cancels the works first and kills the urbs afterwards.
An interrupt urb that completes in between schedules a work again:
oti6858_close()
cancel_delayed_work_sync(setup)
cancel_delayed_work_sync(write)
oti6858_read_int_callback()
schedule_delayed_work(setup)
usb_kill_urb(interrupt_in_urb) /* not in flight */
setup_line()
usb_submit_urb(interrupt_in_urb)
The port is now closed with the baton still going round. The next open
fails because the interrupt urb is already submitted, and if the device
is unplugged, oti6858_port_remove() frees the private data while a work
may be pending or running.
Poison the interrupt urb first: that waits for the handler and makes all
further submissions fail, so nothing schedules the works any more. Then
cancel the works, after which only the bulk urbs are left, kill those,
and make the interrupt urb usable again for the next open. Don't print
an error for the submissions that fail with -EPERM in this window, as
oti6858_read_bulk_callback() already does.
Fixes: 49cdee0ed0fc ("USB: oti6858 usb-serial driver (in Nokia CA-42 cable)")
Cc: stable <stable@kernel.org>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/oti6858.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -252,7 +252,7 @@ static void setup_line(struct work_struc
dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
- if (result != 0) {
+ if (result != 0 && result != -EPERM) {
dev_err(&port->dev, "%s(): usb_submit_urb() failed with error %d\n",
__func__, result);
}
@@ -304,7 +304,7 @@ static void send_data(struct work_struct
dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO);
- if (result != 0) {
+ if (result != 0 && result != -EPERM) {
dev_err(&port->dev, "%s(): usb_submit_urb() failed with error %d\n",
__func__, result);
}
@@ -566,6 +566,13 @@ static void oti6858_close(struct usb_ser
dev_dbg(&port->dev, "%s(): after buf_clear()\n", __func__);
+ /*
+ * The interrupt urb schedules the works, and the works and the bulk
+ * urbs resubmit the interrupt urb: keep it from being submitted until
+ * all of them are gone.
+ */
+ usb_poison_urb(port->interrupt_in_urb);
+
/* cancel scheduled setup */
cancel_delayed_work_sync(&priv->delayed_setup_work);
cancel_delayed_work_sync(&priv->delayed_write_work);
@@ -574,7 +581,8 @@ static void oti6858_close(struct usb_ser
dev_dbg(&port->dev, "%s(): shutting down urbs\n", __func__);
usb_kill_urb(port->write_urb);
usb_kill_urb(port->read_urb);
- usb_kill_urb(port->interrupt_in_urb);
+
+ usb_unpoison_urb(port->interrupt_in_urb);
}
static int oti6858_tiocmset(struct tty_struct *tty,
@@ -831,7 +839,7 @@ static void oti6858_write_bulk_callback(
/* schedule the interrupt urb if we are still open */
dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
- if (result != 0) {
+ if (result != 0 && result != -EPERM) {
dev_err(&port->dev, "%s(): failed submitting int urb,"
" error %d\n", __func__, result);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0595/1059] usb: uas: ignore UAS for ASMT135x bridges (174c:55aa)
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (593 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0594/1059] USB: serial: oti6858: fix the teardown order in close Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0596/1059] usb: usbtest: prevent divide by zero in simple_io() with zero length Greg Kroah-Hartman
` (403 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Olivier Kaloudoff, stable,
Alan Stern
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Kaloudoff <olivier.kaloudoff@gmail.com>
commit fafd23d61494461256d374f67c121f2712e1af2f upstream.
The ASMedia chip detection in uas_use_uas_driver() assumes that every
device with idVendor/idProduct 174c:5106 or 174c:55aa reporting a
config.MaxPower of 0 is an ASM1153 with working UAS.
ASMT135x bridges (iProduct "ASMT135x") share the same 174c:55aa id and
also report MaxPower == 0, so they take the "ASM1153, do nothing"
path — but their UAS implementation is broken:
- The first READ(16) issued by sd probing times out after 30 s;
enumeration only completes after a uas_eh_abort_handler plus a full
uas_eh_host_reset_handler cycle:
scsi 3:0:0:0: Direct-Access ASMT ASMT135x 0 PQ: 0 ANSI: 6
sd 3:0:0:0: [sdb] tag#26 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
sd 3:0:0:0: [sdb] tag#26 CDB: Read(16) 88 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00
scsi host3: uas_eh_host_reset_handler start
usb 6-2: reset SuperSpeed USB device number 2 using xhci_hcd
scsi host3: uas_eh_host_reset_handler success
- Under concurrent load the bridge stalls: all inflight commands (20+
UAS tags in the captured incident, mixed READ(16)/WRITE(16)) hit the
30 s UAS timeout in the same event, forcing repeated abort/reset
cycles and eventually a USB disconnect. Writes dropped mid-flight
during these resets returned zeros to the filesystem (observed as
XFS metadata corruption on the mounted volume).
- Sequential-write throughput is ~45 MiB/s under UAS versus ~136 MiB/s
after disabling UAS (usb-storage BOT mode), which is fully stable:
several tens of GiB written without a single error.
- Bulk reads of healthy LBA ranges do work under UAS (~190 MiB/s, no
errors); the failure pattern is command-timeout at enumeration and
under queue depth / write load, not a broken transfer path.
Since 174c:55aa is shared across several ASMedia bridges and enclosure
rebrandings, distinguish the ASMT135x by its product string — the same
approach used for the HIKSEMI MD202 check a few lines below. The
product strings of working bridges using the same id ("ASM1053E",
"ASM1153", "ASM1153E", "ASM1351", vendor rebrands such as "YZWY_TECH")
do not contain "ASMT135", so the match is safe.
Verified on an ORICO enclosure (iManufacturer "ASMT", iProduct
"ASMT135x", bcdDevice 1.00) attached through an Alpine Ridge TB3 dock:
with the equivalent usb-storage quirks parameter (174c:55aa:u) the
device is completely stable.
Signed-off-by: Olivier Kaloudoff <olivier.kaloudoff@gmail.com>
Cc: stable <stable@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://patch.msgid.link/20261014165741.35758-1-olivier.kaloudoff@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/storage/uas-detect.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/usb/storage/uas-detect.h
+++ b/drivers/usb/storage/uas-detect.h
@@ -78,6 +78,8 @@ static int uas_use_uas_driver(struct usb
* ASM1051 - with broken (*) uas support
* ASM1053 - with working uas support, but problems with large xfers
* ASM1153 - with working uas support
+ * ASMT135x - broken uas support, shares the ASM1153 MaxPower == 0
+ * signature, identify it by its product string
*
* Devices with these chips re-use a number of device-ids over the
* entire line, so the device-id is useless to determine if we're
@@ -99,7 +101,11 @@ static int uas_use_uas_driver(struct usb
(le16_to_cpu(udev->descriptor.idProduct) == 0x5106 ||
le16_to_cpu(udev->descriptor.idProduct) == 0x55aa)) {
if (udev->actconfig->desc.bMaxPower == 0) {
- /* ASM1153, do nothing */
+ if (udev->product && strstr(udev->product, "ASMT135")) {
+ /* ASMT135x, broken uas */
+ flags |= US_FL_IGNORE_UAS;
+ }
+ /* else ASM1153, do nothing */
} else if (udev->speed < USB_SPEED_SUPER) {
/* No streams info, assume ASM1051 */
flags |= US_FL_IGNORE_UAS;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0596/1059] usb: usbtest: prevent divide by zero in simple_io() with zero length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (594 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0595/1059] usb: uas: ignore UAS for ASMT135x bridges (174c:55aa) Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0597/1059] usb: typec: ucsi: Set ucsi->connector before enabling notifications Greg Kroah-Hartman
` (402 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Bin Yu, Cheng Wen,
YuanZhe Liu, Alan Stern
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit fdaca138694111153f96c7d76877734b9dbf0e01 upstream.
A divide error oops was observed in simple_io():
usbtest 1-1:1.0: TEST 3: write/1 0..0 bytes 16307 times
Oops: divide error: 0000 [#1] SMP KASAN
RIP: 0010:simple_io+0x2c4/0x540 drivers/usb/misc/usbtest.c:497
The variable-length tests (test 3 and test 4) compute the next URB
size with "len %= max", where max is the original
urb->transfer_buffer_length. However, when a zero-length transfer is
requested (param->length == 0), simple_alloc_urb() still returns a valid
URB with transfer_buffer_length set to 0. On the first vary update,
"len %= max" divides by zero and the kernel oopses.
Commit 564e69893c63 ("USB: usbtest: prevent a divide by zero bug") added
the equivalent zero check to alloc_sglist(), which covers the
scatterlist tests (test 7/8), but the single-URB variable-length path in
simple_io() was left unprotected.
Fix this by returning -EINVAL early from simple_io() when vary is
requested but max is zero, so the divide by zero never occurs.
Zero-length transfers without vary remain valid for the other callers of
simple_io().
Cc: stable <stable@kernel.org>
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://patch.msgid.link/20261016072750.34256-1-25031212351@stu.xidian.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/misc/usbtest.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -466,6 +466,9 @@ static int simple_io(
int retval = 0;
unsigned long expire;
+ if (vary && !max)
+ return -EINVAL;
+
urb->context = &completion;
while (retval == 0 && iterations-- > 0) {
init_completion(&completion);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0597/1059] usb: typec: ucsi: Set ucsi->connector before enabling notifications
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (595 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0596/1059] usb: usbtest: prevent divide by zero in simple_io() with zero length Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0598/1059] usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF Greg Kroah-Hartman
` (401 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Uttkarsh Aggarwal,
Peter Chen, Heikki Krogerus
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uttkarsh Aggarwal <uttkarsh.aggarwal@oss.qualcomm.com>
commit 5b4b83c2ffe8740f6f3e54ea4d4962a62c063ef1 upstream.
In ucsi_init(), ucsi->connector is assigned only after the
UCSI_SET_NOTIFICATION_ENABLE command completes. But once that command
is sent, the PPM is free to raise a connector change notification at
any time, which is handled through:
ucsi_notify_common() -> ucsi_connector_change()
ucsi_connector_change() indexes into ucsi->connector to get the
connector and schedule its work item. If this notification arrives
before ucsi_init() reaches the "ucsi->connector = connector;" line,
ucsi->connector is still NULL and the driver crashes dereferencing it.
Fix this by setting ucsi->connector right after the connectors are
registered, before notifications are enabled, so it is always valid
by the time a connector change event can be delivered. Also clear
ucsi->connector in the err_unregister path so it isn't left pointing
at freed memory if a later step in ucsi_init() fails.
Fixes: 0482c34ec6f8 ("usb: ucsi: Fix ucsi->connector race")
Cc: stable <stable@kernel.org>
Signed-off-by: Uttkarsh Aggarwal <uttkarsh.aggarwal@oss.qualcomm.com>
Reviewed-by: Peter Chen <peter.chen@oss.qualcomm.com>
Reviewed-by: Heikki Krogerus <heikki.krogeurs@linuc.intel.com>
Link: https://patch.msgid.link/20260929092939.1806907-1-uttkarsh.aggarwal@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1393,6 +1393,14 @@ static int ucsi_init(struct ucsi *ucsi)
goto err_unregister;
}
+ /*
+ * Set ucsi->connector before enabling notifications. A connector
+ * change event can be handled as soon as the notifications are
+ * enabled below, and ucsi_connector_change() indexes into
+ * ucsi->connector, so it must not be NULL at that point.
+ */
+ ucsi->connector = connector;
+
/* Enable all supported notifications */
ntfy = ucsi_get_supported_notifications(ucsi);
command = UCSI_SET_NOTIFICATION_ENABLE | ntfy;
@@ -1400,7 +1408,6 @@ static int ucsi_init(struct ucsi *ucsi)
if (ret < 0)
goto err_unregister;
- ucsi->connector = connector;
ucsi->ntfy = ntfy;
mutex_lock(&ucsi->ppm_lock);
@@ -1414,6 +1421,7 @@ static int ucsi_init(struct ucsi *ucsi)
return 0;
err_unregister:
+ ucsi->connector = NULL;
for (con = connector; con->port; con++)
ucsi_unregister_port(con);
for (i = 0; i < ucsi->cap.num_connectors; i++)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0598/1059] usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (596 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0597/1059] usb: typec: ucsi: Set ucsi->connector before enabling notifications Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0599/1059] usb: gadget: f_midi: fix UAF race during IN request handling Greg Kroah-Hartman
` (400 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Yu Zhang, Alan Stern
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhang <yuz08559@gmail.com>
commit 450fa94d7ae9fc91c3df525f5d1322bf8fecf7b2 upstream.
fsg_store_nofua() syncs the LUN's backing file when switching from async
to sync mode:
if (!nofua && curlun->nofua)
fsg_lun_fsync_sub(curlun);
fsg_lun_fsync_sub() dereferences curlun->filp (vfs_fsync(filp)). Unlike
every other store that touches the backing file -- fsg_store_ro() and
fsg_store_cdrom() (down_read), fsg_store_file() (down_write) --
fsg_store_nofua() holds no filesem while doing so.
A concurrent close of the backing file runs under down_write(filesem) and
does fput(curlun->filp) in fsg_lun_close() (fsg_store_file() with an empty
path, the SCSI START_STOP eject in do_start_stop(), or forced_eject), so
it can free the file while fsg_store_nofua() is dereferencing it:
BUG: KASAN: slab-use-after-free in vfs_fsync+0x20/0xe0
vfs_fsync+0x20/0xe0
fsg_lun_fsync_sub+0xa0/0xd0
fsg_store_nofua+0x138/0x160
configfs_write_iter+0x1a7/0x250
vfs_write+0x5df/0x940
Allocated by task 3459:
fsg_store_file+0x150/0x1f0
configfs_write_iter+0x1a7/0x250
Freed by task 3459:
__fput+0x456/0x6c0
__fput_deferred+0x10d/0x330
fsg_store_file+0x9e/0x1f0
configfs_write_iter+0x1a7/0x250
Hold filesem for read around the fsync in fsg_store_nofua() so the backing
file cannot be closed underneath it. The lock is only needed when the
fsync actually runs, so it is taken only in that branch.
Reproduced on a mass_storage gadget over dummy_hcd by writing lun.N/nofua
(1 then 0) from one task while another task rewrites and clears lun.N/file.
Cc: stable <stable@kernel.org>
Signed-off-by: Yu Zhang <yuz08559@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://patch.msgid.link/20261020023050.87701-1-yuz08559@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/function/f_mass_storage.c | 8 ++++++--
drivers/usb/gadget/function/storage_common.c | 7 +++++--
drivers/usb/gadget/function/storage_common.h | 3 ++-
3 files changed, 13 insertions(+), 5 deletions(-)
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2667,8 +2667,9 @@ static ssize_t nofua_store(struct device
const char *buf, size_t count)
{
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
+ struct rw_semaphore *filesem = dev_get_drvdata(dev);
- return fsg_store_nofua(curlun, buf, count);
+ return fsg_store_nofua(curlun, filesem, buf, count);
}
static ssize_t file_store(struct device *dev, struct device_attribute *attr,
@@ -3251,7 +3252,10 @@ static ssize_t fsg_lun_opts_nofua_show(s
static ssize_t fsg_lun_opts_nofua_store(struct config_item *item,
const char *page, size_t len)
{
- return fsg_store_nofua(to_fsg_lun_opts(item)->lun, page, len);
+ struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
+ struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
+
+ return fsg_store_nofua(opts->lun, &fsg_opts->common->filesem, page, len);
}
CONFIGFS_ATTR(fsg_lun_opts_, nofua);
--- a/drivers/usb/gadget/function/storage_common.c
+++ b/drivers/usb/gadget/function/storage_common.c
@@ -414,7 +414,8 @@ ssize_t fsg_store_ro(struct fsg_lun *cur
}
EXPORT_SYMBOL_GPL(fsg_store_ro);
-ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count)
+ssize_t fsg_store_nofua(struct fsg_lun *curlun, struct rw_semaphore *filesem,
+ const char *buf, size_t count)
{
bool nofua;
int ret;
@@ -424,8 +425,10 @@ ssize_t fsg_store_nofua(struct fsg_lun *
return ret;
/* Sync data when switching from async mode to sync */
- if (!nofua && curlun->nofua)
+ if (!nofua && curlun->nofua) {
+ guard(rwsem_read)(filesem);
fsg_lun_fsync_sub(curlun);
+ }
curlun->nofua = nofua;
--- a/drivers/usb/gadget/function/storage_common.h
+++ b/drivers/usb/gadget/function/storage_common.h
@@ -210,7 +210,8 @@ ssize_t fsg_show_cdrom(struct fsg_lun *c
ssize_t fsg_show_removable(struct fsg_lun *curlun, char *buf);
ssize_t fsg_store_ro(struct fsg_lun *curlun, struct rw_semaphore *filesem,
const char *buf, size_t count);
-ssize_t fsg_store_nofua(struct fsg_lun *curlun, const char *buf, size_t count);
+ssize_t fsg_store_nofua(struct fsg_lun *curlun, struct rw_semaphore *filesem,
+ const char *buf, size_t count);
ssize_t fsg_store_file(struct fsg_lun *curlun, struct rw_semaphore *filesem,
const char *buf, size_t count);
ssize_t fsg_store_cdrom(struct fsg_lun *curlun, struct rw_semaphore *filesem,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0599/1059] usb: gadget: f_midi: fix UAF race during IN request handling
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (597 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0598/1059] usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0600/1059] usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty Greg Kroah-Hartman
` (399 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Sonali Pradhan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sonali Pradhan <sonalipradhan@google.com>
commit 78a8d6537f1de34770e460edee360b556ef40427 upstream.
f_midi_disable() drains and frees pre-allocated IN requests from
in_req_fifo without holding midi->transmit_lock. If f_midi_transmit()
runs concurrently on the workqueue, f_midi_do_transmit() can peek a
request from in_req_fifo and write into its buffer while
f_midi_disable() frees it, leading to a use-after-free.
Additionally, when usb_ep_queue() fails in f_midi_do_transmit() (such
as with -ESHUTDOWN when the endpoint is disabled concurrently), it
resets req->length = 0 and returns active instead of the error code,
causing the do-while loop in f_midi_transmit() to keep spinning under
midi->transmit_lock until the substream is drained.
Fix this by acquiring midi->transmit_lock in f_midi_disable() while
releasing IN requests from in_req_fifo, and returning the error code
from f_midi_do_transmit() when usb_ep_queue() fails so f_midi_transmit()
aborts immediately and drops active substreams.
Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests")
Cc: stable <stable@kernel.org>
Signed-off-by: Sonali Pradhan <sonalipradhan@google.com>
Link: https://patch.msgid.link/20261028074821.579450-1-sonalipradhan@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/function/f_midi.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -419,6 +419,7 @@ static void f_midi_disable(struct usb_fu
struct f_midi *midi = func_to_midi(f);
struct usb_composite_dev *cdev = f->config->cdev;
struct usb_request *req = NULL;
+ unsigned long flags;
DBG(cdev, "disable\n");
@@ -430,8 +431,10 @@ static void f_midi_disable(struct usb_fu
usb_ep_disable(midi->out_ep);
/* release IN requests */
+ spin_lock_irqsave(&midi->transmit_lock, flags);
while (kfifo_get(&midi->in_req_fifo, &req))
free_ep_req(midi->in_ep, req);
+ spin_unlock_irqrestore(&midi->transmit_lock, flags);
f_midi_drop_out_substreams(midi);
}
@@ -660,6 +663,7 @@ static int f_midi_do_transmit(struct f_m
ERROR(midi, "%s failed to queue req: %d\n",
midi->in_ep->name, err);
req->length = 0; /* Re-use request next time. */
+ return err;
} else {
/* Upon success, put request at the back of the queue. */
kfifo_skip(&midi->in_req_fifo);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0600/1059] usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (598 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0599/1059] usb: gadget: f_midi: fix UAF race during IN request handling Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0601/1059] usb: gadget: u_serial: fix NULL deref in gs_close() after failed open Greg Kroah-Hartman
` (398 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Cosmin Tanislav,
Vladyslav Tymoshchuk, Leonardo Costa, Hiago De Franco
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 78585f90feb3bbaf3b1c642294c8c47e451dc3cf upstream.
ncm_wrap_ntb() aggregates datagrams into a pending NTB, which is sent
either when it becomes full, or after 300us since the NTB was started,
using ndo_start_xmit() (eth_start_xmit()).
ndo_start_xmit() returns NETDEV_TX_BUSY when the TX freelist is empty.
For regular packets this is fine since the networking core will requeue
them, but for timer-flushed packets there is no logic to handle this
situation, and HRTIMER_NORESTART is returned from ncm_tx_timeout()
without checking eth_start_xmit()'s return value.
Under sustained TX saturation the request freelist is empty most of the
time. Since the timer is never restarted, small packets keep getting
accumulated into the NTB, until either TX_MAX_NUM_DPE packets are stored
or NTB_DEFAULT_IN_SIZE is reached, which is an unknown amount of time.
Check the return value of ndo_start_xmit() and restart the timer after
another 300us.
Cc: stable <stable@kernel.org>
Fixes: 6d3865f9d41f ("usb: gadget: NCM: Add transmit multi-frame.")
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Tested-by: Vladyslav Tymoshchuk <tvlad744@gmail.com>
Tested-by: Leonardo Costa <leonardo.costa@toradex.com>
Reported-by: Hiago De Franco <hiago.franco@toradex.com>
Closes: https://lore.kernel.org/all/20231204183751.64202-1-hiagofranco@gmail.com/
Link: https://patch.msgid.link/20260817192638.437798-1-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/function/f_ncm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1153,6 +1153,7 @@ static enum hrtimer_restart ncm_tx_timeo
{
struct f_ncm *ncm = container_of(data, struct f_ncm, task_timer);
struct net_device *netdev = READ_ONCE(ncm->netdev);
+ netdev_tx_t ret;
if (netdev) {
/* XXX This allowance of a NULL skb argument to ndo_start_xmit
@@ -1163,7 +1164,11 @@ static enum hrtimer_restart ncm_tx_timeo
*
* This will call directly into u_ether's eth_start_xmit()
*/
- netdev->netdev_ops->ndo_start_xmit(NULL, netdev);
+ ret = netdev->netdev_ops->ndo_start_xmit(NULL, netdev);
+ if (ret == NETDEV_TX_BUSY) {
+ hrtimer_forward_now(data, TX_TIMEOUT_NSECS);
+ return HRTIMER_RESTART;
+ }
}
return HRTIMER_NORESTART;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0601/1059] usb: gadget: u_serial: fix NULL deref in gs_close() after failed open
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (599 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0600/1059] usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0602/1059] usb: dwc3: gadget: Clear delayed stop on End Transfer completion Greg Kroah-Hartman
` (397 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+782b2f1063e38ba8fa6e, stable,
Brian Ellis
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Ellis <brianellis@gotenna.com>
commit ea6cf69ad03c8d85138830c0d2c3b946b5ae231d upstream.
gs_close() opens with
struct gs_port *port = tty->driver_data;
...
spin_lock_irq(&port->port_lock);
and never checks port. gs_open() assigns tty->driver_data only on the
port.count 0 -> 1 edge, so any failure earlier in gs_open() leaves it NULL,
and tty_open() calls tty_release(), and hence ->close(), when ->open()
fails.
syzbot hit exactly this on arm64. Fault injection failed the kfifo_alloc()
of the write buffer in gs_open():
__kfifo_alloc_node+0x10c/0x208 lib/kfifo.c:44
gs_open+0x144/0x514 drivers/usb/gadget/function/u_serial.c:636
tty_open+0x404/0x89c drivers/tty/tty_io.c:2137
and the tty core's close of the failed open then took port_lock through
the NULL port:
BUG: unable to handle kernel paging request in gs_close
KASAN: null-ptr-deref in range [0x00000000000003a0-0x00000000000003a7]
Call trace:
spin_lock_irq include/linux/spinlock.h:372 [inline]
gs_close+0xac/0x65c drivers/usb/gadget/function/u_serial.c:698
tty_release+0x2c4/0xffc drivers/tty/tty_io.c:1745
tty_open+0x46c/0x89c drivers/tty/tty_io.c:2146
Return early instead. There is nothing to release when the open never got
far enough to claim the port.
Unlike the check reverted by commit f6c7bc4a6823 ("Revert "usb: gadget:
u_serial: Add null pointer check in gs_start_io""), this is not hiding a
race: the tty core calls ->close() for an ->open() that failed by design,
so driver_data is legitimately unset on that path.
Fixes: c1dca562be8a ("usb gadget: split out serial core")
Reported-by: syzbot+782b2f1063e38ba8fa6e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=782b2f1063e38ba8fa6e
Cc: stable <stable@kernel.org>
Assisted-by: LLM
Signed-off-by: Brian Ellis <brianellis@gotenna.com>
Link: https://patch.msgid.link/20261013-u_serial-gs-close-null-v4-1-9ea038501994@gotenna.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/function/u_serial.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -678,6 +678,9 @@ static void gs_close(struct tty_struct *
struct gs_port *port = tty->driver_data;
struct gserial *gser;
+ if (!port)
+ return;
+
spin_lock_irq(&port->port_lock);
if (port->port.count != 1) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0602/1059] usb: dwc3: gadget: Clear delayed stop on End Transfer completion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (600 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0601/1059] usb: gadget: u_serial: fix NULL deref in gs_close() after failed open Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0603/1059] usb: dwc3: gadget: Recover from End Transfer timeout Greg Kroah-Hartman
` (396 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Thinh Nguyen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
commit f2bd20f92a7dc68980a6098397503067192ce63a upstream.
When an End Transfer command times out outside of the SETUP phase, the
driver sets DWC3_EP_DELAY_STOP to retry it on the next SETUP phase. If
the command completes in the meantime, the flag is left set. Requests
queued to the endpoint are then deferred, and the retry may end a
transfer that is started later.
Clear DWC3_EP_DELAY_STOP when the End Transfer command completes.
Fixes: 4db0fbb60136 ("usb: dwc3: gadget: Don't delay End Transfer on delayed_status")
Cc: stable <stable@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/c28a9660f7b6bfa626077ddcfbadd50e6b503f86.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/gadget.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3663,6 +3663,7 @@ static void dwc3_gadget_endpoint_command
if (dep->stream_capable)
dep->flags |= DWC3_EP_IGNORE_NEXT_NOSTREAM;
+ dep->flags &= ~DWC3_EP_DELAY_STOP;
dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING;
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
dwc3_gadget_ep_cleanup_cancelled_requests(dep);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0603/1059] usb: dwc3: gadget: Recover from End Transfer timeout
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (601 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0602/1059] usb: dwc3: gadget: Clear delayed stop on End Transfer completion Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0604/1059] usb: dwc3: gadget: Reject requests to a disabled endpoint Greg Kroah-Hartman
` (395 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Thinh Nguyen, stable
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
commit 61575534fb05d52d36979f38976ece74649f091a upstream.
If the End Transfer command times out, the endpoint resource is never
released and every subsequent Start Transfer to the endpoint fails with
"No Resource". Schedule an error recovery to reset the controller.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: stable <stable@kernel.org>
Link: https://patch.msgid.link/7523e9a11303a33acd0b92a092fb0e8218d509d2.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/gadget.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1702,6 +1702,8 @@ static int __dwc3_gadget_get_frame(struc
return DWC3_DSTS_SOFFN(reg);
}
+static void dwc3_schedule_err_recovery(struct dwc3 *dwc);
+
/**
* __dwc3_stop_active_transfer - stop the current active transfer
* @dep: isoc endpoint
@@ -1740,6 +1742,9 @@ static int __dwc3_stop_active_transfer(s
dev_err_ratelimited(dep->dwc->dev,
"end transfer failed: %d\n", ret);
+ if (ret == -ETIMEDOUT && dep->dwc->err_state == DWC3_ERR_NONE)
+ dwc3_schedule_err_recovery(dep->dwc);
+
dep->resource_index = 0;
if (!interrupt)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0604/1059] usb: dwc3: gadget: Reject requests to a disabled endpoint
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (602 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0603/1059] usb: dwc3: gadget: Recover from End Transfer timeout Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0605/1059] usb: dwc3: gadget: Reset endpoint flags on controller start Greg Kroah-Hartman
` (394 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Thinh Nguyen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
commit 5eb11b1647b0534b3a61a21473d77ebf4ffbed7c upstream.
__dwc3_gadget_ep_disable() releases the lock while giving back requests,
and DWC3_EP_ENABLED is only cleared afterward. A function driver can
queue a new request in this window, and the driver would start a
transfer on an endpoint that is already disabled in hardware.
Clear DWC3_EP_ENABLED before giving back the requests, and reject
requests queued to an endpoint that is not enabled.
Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/4ceab6aa5d6af0e4780f9d3a964fd5d8168a0a02.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/gadget.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1043,6 +1043,8 @@ static int __dwc3_gadget_ep_disable(stru
reg &= ~DWC3_DALEPENA_EP(dep->number);
dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);
+ dep->flags &= ~DWC3_EP_ENABLED;
+
dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
dep->stream_capable = false;
@@ -1941,7 +1943,8 @@ static int __dwc3_gadget_ep_queue(struct
{
struct dwc3 *dwc = dep->dwc;
- if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) {
+ if (!(dep->flags & DWC3_EP_ENABLED) || !dep->endpoint.desc ||
+ !dwc->pullups_connected || !dwc->connected) {
dev_dbg(dwc->dev, "%s: can't queue to disabled endpoint\n",
dep->name);
return -ESHUTDOWN;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0605/1059] usb: dwc3: gadget: Reset endpoint flags on controller start
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (603 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0604/1059] usb: dwc3: gadget: Reject requests to a disabled endpoint Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0606/1059] usb: dwc3: gadget: Track a timed out End Transfer Greg Kroah-Hartman
` (393 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Thinh Nguyen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
commit 7c9bc134e5b3315e0456cda9e8e59c752309ea78 upstream.
The flags of a disabled endpoint may be preserved while its End
Transfer command is pending. If the command never completes, the stale
flags persist across a soft disconnect or an error recovery, and the
endpoint can't be used again.
Reset the flags of all non-control endpoints when starting the
controller.
Fixes: 76bff31c7fba ("usb: dwc3: gadget: Do not clear ep delayed stop flag during ep disable")
Cc: stable <stable@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/21cd189962b9d32a4f9df381df4947d35341d5a9.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/gadget.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2824,6 +2824,7 @@ static int __dwc3_gadget_start(struct dw
{
struct dwc3_ep *dep;
int ret = 0;
+ u32 epnum;
u32 reg;
/*
@@ -2881,6 +2882,15 @@ static int __dwc3_gadget_start(struct dw
return ret;
}
+ for (epnum = 2; epnum < dwc->num_eps; epnum++) {
+ dep = dwc->eps[epnum];
+ if (!dep)
+ continue;
+
+ dep->flags &= (DWC3_EP_TXFIFO_RESIZED |
+ DWC3_EP_RESOURCE_ALLOCATED);
+ }
+
dep = dwc->eps[0];
dep->flags = 0;
ret = __dwc3_gadget_ep_enable(dep, DWC3_DEPCFG_ACTION_INIT);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0606/1059] usb: dwc3: gadget: Track a timed out End Transfer
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (604 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0605/1059] usb: dwc3: gadget: Reset endpoint flags on controller start Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0607/1059] usb: dwc3: xilinx: fix system suspend and resume PHY handling Greg Kroah-Hartman
` (392 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Selvarasu Ganesan,
Thinh Nguyen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
commit af91c6322e633504aa45de278f5d520f39d127be upstream.
If an End Transfer command with CMDIOC times out, the driver clears the
resource index but keeps DWC3_EP_TRANSFER_STARTED without setting
DWC3_EP_END_TRANSFER_PENDING. The command is still outstanding, but a
later stop issues another End Transfer with resource index 0, and the
next Start Transfer fails with "No Resource".
Mark the timed out End Transfer as pending so that no other command is
issued to the endpoint until it completes. For any other failure, there
is no outstanding command, so clear DWC3_EP_TRANSFER_STARTED.
Fixes: e192cc7b5239 ("usb: dwc3: gadget: move cmd_endtransfer to extra function")
Cc: stable <stable@kernel.org>
Reported-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
Closes: https://lore.kernel.org/linux-usb/3fdda532-8181-48e9-b58d-cad7289408e7@samsung.com/
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/5815c41a7e7923edb114741f29697cf0161f523c.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/gadget.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1749,9 +1749,9 @@ static int __dwc3_stop_active_transfer(s
dep->resource_index = 0;
- if (!interrupt)
+ if (!interrupt || (ret && ret != -ETIMEDOUT))
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
- else if (!ret)
+ else
dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
dep->flags &= ~DWC3_EP_DELAY_STOP;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0607/1059] usb: dwc3: xilinx: fix system suspend and resume PHY handling
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (605 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0606/1059] usb: dwc3: gadget: Track a timed out End Transfer Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0608/1059] w1: dont hold list_mutex while a slave is torn down Greg Kroah-Hartman
` (391 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Radhey Shyam Pandey,
Thinh Nguyen
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
commit 2fad8d241a6833d0c7aeafa0ab596e83c7b4ec9c upstream.
System suspend and resume error paths do not handle PHY and clock
resources correctly. Suspend calls phy_exit() without first powering
off the PHY and ignores failures, while resume can leave clocks
enabled if PHY reinitialization fails.
Propagate errors to the PM core and unwind resources to ensure a
consistent state on suspend and resume failures.
Fixes: d6edcdc1ef06 ("usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure")
Cc: stable <stable@kernel.org>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260928120015.3152461-2-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -353,13 +353,26 @@ static int __maybe_unused dwc3_xlnx_runt
static int __maybe_unused dwc3_xlnx_suspend(struct device *dev)
{
struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
+ int ret;
+
+ ret = phy_power_off(priv_data->usb3_phy);
+ if (ret < 0)
+ return ret;
- phy_exit(priv_data->usb3_phy);
+ ret = phy_exit(priv_data->usb3_phy);
+ if (ret < 0)
+ goto err_phy_power_on;
/* Disable the clocks */
clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
return 0;
+
+err_phy_power_on:
+ if (phy_power_on(priv_data->usb3_phy))
+ dev_err(dev, "failed to restore PHY power after suspend error\n");
+
+ return ret;
}
static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
@@ -373,15 +386,20 @@ static int __maybe_unused dwc3_xlnx_resu
ret = phy_init(priv_data->usb3_phy);
if (ret < 0)
- return ret;
+ goto err_clk_disable;
ret = phy_power_on(priv_data->usb3_phy);
if (ret < 0) {
phy_exit(priv_data->usb3_phy);
- return ret;
+ goto err_clk_disable;
}
return 0;
+
+err_clk_disable:
+ clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
+
+ return ret;
}
static const struct dev_pm_ops dwc3_xlnx_dev_pm_ops = {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0608/1059] w1: dont hold list_mutex while a slave is torn down
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (606 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0607/1059] usb: dwc3: xilinx: fix system suspend and resume PHY handling Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0609/1059] w1: ds2482: set the strong pull-up with its byte Greg Kroah-Hartman
` (390 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 7ef382cb0ae0b2d6df4fbc5c822cd80394308839 upstream.
When the last reference to a slave is dropped, w1_unref_slave() holds
list_mutex of the master until the slave has been freed. In between it
calls the ->remove_slave() callback of the family driver and
device_unregister(). Both wait for others: for the sysfs callbacks
which are running, and in the case of w1_therm also for the file
therm_bulk_read of the master and for everybody who is talking to the
sensor. None of those can therefore take list_mutex, although the
callbacks of therm_bulk_read walk the list which it protects.
The mutex is only needed to make the decrement of the reference count and
the removal from the list one step for w1_search_slave() and
w1_slave_search_device(), which look the slave up in the list and, in the
first case, take a reference. Once the slave is off the list, nobody can
find it any more. Drop the mutex at that point.
The callers which hold the mutex of the master, which serialises
attaching and detaching, are not affected. The one which does not is
w1_process_cb(), when it drops the last reference to a slave which has
been detached while a netlink command for it was queued. Somebody who
attaches a slave with the same ID through sysfs or netlink at that very
moment used to wait until the old device was gone. Now the registration
of the new device may fail because the name is still in use.
This is a preparation for "w1: w1_therm: lock the list of slaves for the
bulk read".
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-7-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/w1.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -785,16 +785,24 @@ int w1_unref_slave(struct w1_slave *sl)
{
struct w1_master *dev = sl->master;
int refcnt;
+
+ /*
+ * Once it is off the list nobody can find the slave and take a new
+ * reference. The lock must not be held any longer than that: the rest
+ * waits for sysfs callbacks and for users of the family data.
+ */
mutex_lock(&dev->list_mutex);
refcnt = atomic_sub_return(1, &sl->refcnt);
+ if (refcnt == 0)
+ list_del(&sl->w1_slave_entry);
+ mutex_unlock(&dev->list_mutex);
+
if (refcnt == 0) {
struct w1_netlink_msg msg;
dev_dbg(&sl->dev, "%s: detaching %s [%p].\n", __func__,
sl->name, sl);
- list_del(&sl->w1_slave_entry);
-
memset(&msg, 0, sizeof(msg));
memcpy(msg.id.id, &sl->reg_num, sizeof(msg.id));
msg.type = W1_SLAVE_REMOVE;
@@ -808,7 +816,6 @@ int w1_unref_slave(struct w1_slave *sl)
kfree(sl);
}
atomic_dec(&dev->refcnt);
- mutex_unlock(&dev->list_mutex);
return refcnt;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0609/1059] w1: ds2482: set the strong pull-up with its byte
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (607 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0608/1059] w1: dont hold list_mutex while a slave is torn down Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0610/1059] w1: ds2805: use the bus mutex to talk on the bus Greg Kroah-Hartman
` (389 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit e4f673632fa8292a2922bcfbb39519b08016b382 upstream.
The eight channels of a DS2482-800 are eight independent 1-wire masters
for the w1 core, but share one I2C device. Each bus operation consists of
several I2C transfers: select the channel, send the command, poll the
status, set the read pointer, read the result. access_lock keeps the
operations of the channels apart.
ds2482_w1_set_pullup() polls the status, writes the configuration and
polls again without the lock. Polling sets the read pointer of the device
to the status register. In the middle of a read on another channel, after
that one has set the pointer to the data register, this makes the read
return the status instead of the data. The cached copy of the pointer in
pdev->read_prt can go wrong as well.
The lock alone is not enough. The strong pull-up is a setting of the
whole chip which is used up by the next byte. If an operation of another
channel gets in before the byte it was meant for, that channel gets the
pull-up, and the sensor converts without power.
So only note the request in ds2482_w1_set_pullup(), and write the
configuration in ds2482_w1_write_byte(), under the lock and after the
channel has been selected. The w1 core calls the former right before the
latter, under the bus mutex of the channel.
Fixes: 9c95bb6f25ff ("w1: ds2482: Added 1-Wire pull-up support to the driver")
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-3-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/masters/ds2482.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -105,6 +105,7 @@ struct ds2482_data;
struct ds2482_w1_chan {
struct ds2482_data *pdev;
u8 channel;
+ bool spu; /* strong pullup after the next byte */
struct w1_bus_master w1_bm;
};
@@ -338,6 +339,19 @@ static void ds2482_w1_write_byte(void *d
if (pdev->w1_count > 1)
ds2482_set_channel(pdev, pchan->channel);
+ if (pchan->spu) {
+ pchan->spu = false;
+ /* the wait above and this one are crucial, otherwise devices
+ * might not be powered long enough, causing e.g. a w1_therm
+ * sensor to provide wrong conversion results
+ */
+ /* note: it seems like both SPU and APU have to be set! */
+ ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
+ ds2482_calculate_config(DS2482_REG_CFG_SPU |
+ DS2482_REG_CFG_APU));
+ ds2482_wait_1wire_idle(pdev);
+ }
+
/* Send the write byte command */
ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_WRITE_BYTE, byte);
@@ -422,27 +436,19 @@ static u8 ds2482_w1_reset_bus(void *data
static u8 ds2482_w1_set_pullup(void *data, int delay)
{
struct ds2482_w1_chan *pchan = data;
- struct ds2482_data *pdev = pchan->pdev;
- u8 retval = 1;
/* if delay is non-zero activate the pullup,
* the strong pullup will be automatically deactivated
* by the master, so do not explicitly deactive it
+ *
+ * The setting is used up by the next byte on any channel of the chip:
+ * ds2482_w1_write_byte() makes it, in one go with the byte.
*/
- if (delay) {
- /* both waits are crucial, otherwise devices might not be
- * powered long enough, causing e.g. a w1_therm sensor to
- * provide wrong conversion results
- */
- ds2482_wait_1wire_idle(pdev);
- /* note: it seems like both SPU and APU have to be set! */
- retval = ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
- ds2482_calculate_config(DS2482_REG_CFG_SPU |
- DS2482_REG_CFG_APU));
- ds2482_wait_1wire_idle(pdev);
- }
+ if (!delay)
+ return 1;
- return retval;
+ pchan->spu = true;
+ return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0610/1059] w1: ds2805: use the bus mutex to talk on the bus
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (608 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0609/1059] w1: ds2482: set the strong pull-up with its byte Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0611/1059] w1: ds28e04: " Greg Kroah-Hartman
` (388 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit a2e52ccce044e13d2695bb1bbdc07942727f28dd upstream.
Since commit b02f8bede217 ("W1: split master mutex to avoid deadlocks.")
the slave drivers serialise their accesses to the bus with bus_mutex.
This driver takes the mutex of the master in the callbacks of its eeprom
file instead.
That mutex is held while a slave which has disappeared from the bus is
removed, which waits for the sysfs callbacks of the slave to return. A
callback which is waiting for the mutex at that moment never does: both
tasks are stuck, and with them the thread of the bus master.
Besides, it does not keep the other slave drivers off the bus, so that two
transactions can get mixed up on the wire.
Fixes: f6887531c0c6 ("drivers: w1: Add 1w slave driver for DS28E05 EEPROM")
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-5-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/slaves/w1_ds2805.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/w1/slaves/w1_ds2805.c
+++ b/drivers/w1/slaves/w1_ds2805.c
@@ -102,7 +102,7 @@ static ssize_t w1_f0d_read_bin(struct fi
if (count == 0)
return 0;
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
/* read directly from the EEPROM in chunks of W1_F0D_READ_MAXLEN */
while (todo > 0) {
@@ -123,7 +123,7 @@ static ssize_t w1_f0d_read_bin(struct fi
off += W1_F0D_READ_MAXLEN;
}
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
@@ -211,7 +211,7 @@ static ssize_t w1_f0d_write_bin(struct f
if (count == 0)
return 0;
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
/* Can only write data in blocks of the size of the scratchpad */
addr = off;
@@ -256,7 +256,7 @@ static ssize_t w1_f0d_write_bin(struct f
}
out_up:
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0611/1059] w1: ds28e04: use the bus mutex to talk on the bus
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (609 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0610/1059] w1: ds2805: use the bus mutex to talk on the bus Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0612/1059] w1: netlink: drop the slave after the bus is unlocked Greg Kroah-Hartman
` (387 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 5bc51235d0ad4a4991e38f4e9dc3440738296850 upstream.
Since commit b02f8bede217 ("W1: split master mutex to avoid deadlocks.")
the slave drivers serialise their accesses to the bus with bus_mutex.
This driver, which was merged shortly afterwards, takes the mutex of the
master in the callbacks of its eeprom and pio files instead.
That mutex is held while a slave which has disappeared from the bus is
removed, which waits for the sysfs callbacks of the slave to return. A
callback which is waiting for the mutex at that moment never does: both
tasks are stuck, and with them the thread of the bus master.
Besides, it does not keep the other slave drivers off the bus, so that two
transactions can get mixed up on the wire.
Fixes: fbf7f7b4e2ae ("w1: Add 1-wire slave device driver for DS28E04-100")
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-4-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/slaves/w1_ds28e04.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/drivers/w1/slaves/w1_ds28e04.c
+++ b/drivers/w1/slaves/w1_ds28e04.c
@@ -123,7 +123,7 @@ static ssize_t eeprom_read(struct file *
if (count == 0)
return 0;
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
if (w1_enable_crccheck) {
min_page = (off >> W1_PAGE_BITS);
@@ -140,7 +140,7 @@ static ssize_t eeprom_read(struct file *
}
out_up:
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
@@ -250,7 +250,7 @@ static ssize_t eeprom_write(struct file
}
}
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
/* Can only write data to one page at a time */
idx = 0;
@@ -268,7 +268,7 @@ static ssize_t eeprom_write(struct file
}
out_up:
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
@@ -287,9 +287,9 @@ static ssize_t pio_read(struct file *fil
if (off != 0 || count != 1 || buf == NULL)
return -EINVAL;
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
ret = w1_f1C_read(sl, W1_1C_REG_LOGIC_STATE, count, buf);
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return ret;
}
@@ -307,11 +307,11 @@ static ssize_t pio_write(struct file *fi
if (off != 0 || count != 1 || buf == NULL)
return -EINVAL;
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
/* Write the PIO data */
if (w1_reset_select_slave(sl)) {
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return -1;
}
@@ -325,7 +325,7 @@ static ssize_t pio_write(struct file *fi
w1_read_block(sl->master, &ack, sizeof(ack));
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
/* check for acknowledgement */
if (ack != 0xAA)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0612/1059] w1: netlink: drop the slave after the bus is unlocked
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (610 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0611/1059] w1: ds28e04: " Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0613/1059] w1: remove the masters files before taking its locks Greg Kroah-Hartman
` (386 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 847fa880a3e1b2fdbbf72d89e830566108457637 upstream.
w1_process_cb() executes the commands of a netlink message with bus_mutex
held, and drops the reference to the slave which the message was
addressed to before it unlocks the mutex. If the slave has been detached
in the meantime, this is the last reference, and w1_unref_slave() tears
the slave down on the spot. That waits
- in device_unregister(), for the sysfs callbacks of the slave which are
running, and
- in w1_therm_remove_slave(), for the readers which have taken a
reference to the family data,
and both kinds take bus_mutex to talk to the slave. Whoever is waiting
for the mutex at that moment is never going to finish, and neither is the
thread of the bus master.
Unlock the bus first. The reference keeps the slave, and with it the
master, alive until then.
Fixes: d3a8a9dbb903 ("w1: hold bus_mutex in netlink and search")
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-6-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/w1_netlink.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -478,15 +478,17 @@ static void w1_process_cb(struct w1_mast
if (!cmd || err)
w1_netlink_queue_status(node->block, node->msg, cmd, err);
+ dev->priv = NULL;
+ mutex_unlock(&dev->bus_mutex);
+
/* ref taken in w1_search_slave or w1_search_master_id when building
- * the block
+ * the block. If it is the last one, the slave is removed, which waits
+ * for users of the bus.
*/
if (sl)
w1_unref_slave(sl);
else
atomic_dec(&dev->refcnt);
- dev->priv = NULL;
- mutex_unlock(&dev->bus_mutex);
mutex_lock(&dev->list_mutex);
list_del(&async_cmd->async_entry);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0613/1059] w1: remove the masters files before taking its locks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (611 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0612/1059] w1: netlink: drop the slave after the bus is unlocked Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0614/1059] w1: use the bus mutex for the "rw" file Greg Kroah-Hartman
` (385 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit dfc57752ec53c3cc6105656d3037fb2f5e80e9cc upstream.
__w1_remove_master_device() calls w1_destroy_master_attributes() with
both the mutex of the master and list_mutex held. Removing the files
waits for the callbacks which are running, and nearly all of them take
one of these two locks:
__w1_remove_master_device() read() of .../w1_master_slaves
mutex_lock(&dev->mutex) kernfs active reference
mutex_lock(&dev->list_mutex) w1_master_attribute_show_slaves()
w1_destroy_master_attributes() mutex_lock(&md->list_mutex)
sysfs_remove_group() waits
waits for the reference
The files are readable for everybody, and a bus master goes away when, for
instance, a DS2490 USB adapter is unplugged.
Remove the files first, before the locks are taken. That has to be done
before the slaves are detached and not afterwards: as long as the files
exist, a write to w1_master_add could attach a new slave behind the back
of this function, which would then wait for the reference count of the
master for ever. And it is done before the thread is stopped, because a
write to w1_master_search wakes the thread up.
Fixes: c30c9b15187e ("W1: fix deadlocks and remove w1_control_thread")
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-2-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/w1_int.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -180,6 +180,13 @@ void __w1_remove_master_device(struct w1
mutex_unlock(&w1_mlock);
set_bit(W1_ABORT_SEARCH, &dev->flags);
+
+ /*
+ * This waits for the callbacks, which take the locks below. One of
+ * them wakes the thread up.
+ */
+ w1_destroy_master_attributes(dev);
+
kthread_stop(dev->thread);
mutex_lock(&dev->mutex);
@@ -189,7 +196,6 @@ void __w1_remove_master_device(struct w1
w1_slave_detach(sl);
mutex_lock(&dev->list_mutex);
}
- w1_destroy_master_attributes(dev);
mutex_unlock(&dev->list_mutex);
mutex_unlock(&dev->mutex);
atomic_dec(&dev->refcnt);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0614/1059] w1: use the bus mutex for the "rw" file
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (612 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0613/1059] w1: remove the masters files before taking its locks Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0615/1059] w1: w1_therm: leave the slaves of other families alone Greg Kroah-Hartman
` (384 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 8599e08648c0b4913ea7b202511f1294d176e793 upstream.
Commit b02f8bede217 ("W1: split master mutex to avoid deadlocks.") gave
the bus a mutex of its own, because the lock which protects the list of
slaves is held while a slave is removed, which waits for the sysfs
callbacks of the slave, so these must not take it. It converted all the
slave drivers, but not the "rw" file of the default family in w1.c,
which still takes the mutex of the master to talk on the bus. That has
two consequences:
- A deadlock. w1_process() holds the mutex of the master while it
searches the bus and detaches the slaves which have gone:
w1_process() read() of .../rw
mutex_lock(&dev->mutex) kernfs active reference
w1_search_process() rw_read()
w1_slave_detach() mutex_lock(&master->mutex)
w1_unref_slave() waits
device_unregister()
waits for the reference
The file is readable for everybody.
- The accesses through this file are not serialised with those of the
slave drivers, which take bus_mutex, so that two transactions can get
mixed up on the wire.
Take bus_mutex here as well. It also excludes the search, which takes it
for every pass.
Fixes: b02f8bede217 ("W1: split master mutex to avoid deadlocks.")
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-1-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/w1.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -121,7 +121,7 @@ static ssize_t rw_write(struct file *fil
{
struct w1_slave *sl = kobj_to_w1_slave(kobj);
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl)) {
count = 0;
goto out_up;
@@ -130,7 +130,7 @@ static ssize_t rw_write(struct file *fil
w1_write_block(sl->master, buf, count);
out_up:
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
@@ -140,9 +140,9 @@ static ssize_t rw_read(struct file *filp
{
struct w1_slave *sl = kobj_to_w1_slave(kobj);
- mutex_lock(&sl->master->mutex);
+ mutex_lock(&sl->master->bus_mutex);
w1_read_block(sl->master, buf, count);
- mutex_unlock(&sl->master->mutex);
+ mutex_unlock(&sl->master->bus_mutex);
return count;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0615/1059] w1: w1_therm: leave the slaves of other families alone
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (613 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0614/1059] w1: use the bus mutex for the "rw" file Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0616/1059] USB: serial: garmin_gps: validate packet data length in nat_receive() Greg Kroah-Hartman
` (383 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit c0eadd2e06e52563cae2b80491e56eb9712eb727 upstream.
The file therm_bulk_read belongs to the bus master. Its callbacks walk
all the slaves of the bus and look at sl->family_data as if every slave
were a temperature sensor. A 1-wire bus can carry other devices too:
- The family data of a slave which is driven by another driver, such as
w1_ds2433, w1_ds250x, w1_ds28e04 or w1_ds28e17, is a structure of that
driver. bulk_read_support() takes whatever is at the offset of
specific_functions for a pointer and dereferences it, and if the
result happens not to be 0, the callbacks write the state of the
conversion into that foreign structure.
- For a slave without family data, which is the case for most of the
other drivers and for the default family, trigger_bulk_read() gives up
with -ENODEV. A single serial number chip on the bus is enough to
make the bulk read unusable for all the sensors.
Only look at the slaves whose family is one of ours. A bulk conversion
now works on a bus with other devices.
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-9-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/w1/slaves/w1_therm.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -917,6 +917,19 @@ static inline bool bulk_read_support(str
}
/**
+ * bulk_read_slave() - check if a slave of the bus takes part in a bulk read
+ * @sl: any slave on the list of the master
+ *
+ * The family data of the slaves of other families is none of our business.
+ *
+ * Return: true if it is one of our devices and supports bulk read
+ */
+static bool bulk_read_slave(struct w1_slave *sl)
+{
+ return device_family(sl) && sl->family_data && bulk_read_support(sl);
+}
+
+/**
* conversion_time() - get the Tconv for the slave
* @sl: device to get the conversion time
*
@@ -1507,9 +1520,7 @@ static int trigger_bulk_read(struct w1_m
* so we can apply a strong pullup if required
*/
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
- if (!sl->family_data)
- goto error;
- if (bulk_read_support(sl)) {
+ if (bulk_read_slave(sl)) {
int t_cur = conversion_time(sl);
t_conv = t_cur > t_conv ? t_cur : t_conv;
@@ -1547,7 +1558,7 @@ static int trigger_bulk_read(struct w1_m
/* set a flag to instruct that converT pending */
list_for_each_entry(sl,
&dev_master->slist, w1_slave_entry) {
- if (bulk_read_support(sl))
+ if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = -1;
}
@@ -1576,7 +1587,7 @@ mt_unlock:
set_flag:
/* set a flag to register convsersion is done */
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
- if (bulk_read_support(sl))
+ if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = 1;
}
error:
@@ -1944,16 +1955,14 @@ static ssize_t therm_bulk_read_show(stru
int ret = 0;
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
- if (sl->family_data) {
- if (bulk_read_support(sl)) {
- if (SLAVE_CONVERT_TRIGGERED(sl) == -1) {
- ret = -1;
- goto show_result;
- }
- if (SLAVE_CONVERT_TRIGGERED(sl) == 1)
- /* continue to check other slaves */
- ret = 1;
+ if (bulk_read_slave(sl)) {
+ if (SLAVE_CONVERT_TRIGGERED(sl) == -1) {
+ ret = -1;
+ goto show_result;
}
+ if (SLAVE_CONVERT_TRIGGERED(sl) == 1)
+ /* continue to check other slaves */
+ ret = 1;
}
}
show_result:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0616/1059] USB: serial: garmin_gps: validate packet data length in nat_receive()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (614 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0615/1059] w1: w1_therm: leave the slaves of other families alone Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0617/1059] USB: serial: sierra: validate URB length in instat callback Greg Kroah-Hartman
` (382 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hui Peng, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <benquike@gmail.com>
commit ca783a2d55b3361493917ad4a3573715ba902503 upstream.
In nat_receive() (called from garmin_write() when userspace writes to
/dev/ttyUSBn in MODE_NATIVE mode), while garmin_data_p->insize is less
than GARMIN_PKTHDR_LENGTH (12), the loop copies up to 12 bytes into
garmin_data_p->inbuffer. Once garmin_data_p->insize reaches
GARMIN_PKTHDR_LENGTH, nat_receive() computes the total packet size as:
len = GARMIN_PKTHDR_LENGTH + getDataLength(garmin_data_p->inbuffer);
Because getDataLength() returns a signed int from __le32_to_cpup(), a
12-byte header with a negative 32-bit length field (such as 0xfffffff5,
i.e., -11) causes len to underflow to a small positive value (12 + (-11)
= 1) without any bounds check at that point. Then garmin_data_p->insize
>= len (12 >= 1) evaluates to true and nat_receive() calls
garmin_write_bulk(port, inbuffer, 1, 0), which allocates a 1-byte slab
buffer via kmemdup() and immediately reads 4 bytes from it in
getLayerId(buffer) (and again in garmin_write_bulk_callback() when the
URB completes):
BUG: KASAN: slab-out-of-bounds in garmin_write_bulk.constprop.0+0x3eb/0x500
Read of size 4 at addr ffff888002cc0ba0 by task init/1
Call Trace:
<TASK>
dump_stack_lvl+0x70/0xa0
print_report+0x153/0x4c6
kasan_report+0xf1/0x120
garmin_write_bulk.constprop.0+0x3eb/0x500
garmin_write+0x60f/0x1450
serial_write+0x123/0x200
n_tty_write+0x8ea/0xeb0
file_tty_write.isra.0+0x44f/0x7a0
vfs_write+0x671/0xd20
Validate the unsigned 32-bit data length (dlen >= GPS_IN_BUFSIZ -
GARMIN_PKTHDR_LENGTH, matching the existing len >= GPS_IN_BUFSIZ bound)
in nat_receive() as soon as the 12-byte header is present, resetting
insize and returning -EINVPKT on invalid lengths so garmin_write_bulk()
is only ever called with a full valid packet header (12 <= len <
GPS_IN_BUFSIZ).
Tested in QEMU against Linux 7.3.0-rc3 by emulating a Garmin USB GPS
device (091e:0003) via dummy_hcd + raw-gadget, switching /dev/ttyUSB0
to MODE_NATIVE via PRIV_PKTID_SET_MODE, and writing a 12-byte native
packet with data length 0xfffffff5: on the unfixed kernel this triggers
KASAN slab-out-of-bounds reads in garmin_write_bulk() and
garmin_write_bulk_callback(), whereas on the fixed kernel nat_receive()
rejects the packet with -EINVPKT and 0 KASAN faults.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
[ johan: move comment and dev_dbg(); add comment about redundant check ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/garmin_gps.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -750,11 +750,7 @@ static int nat_receive(struct garmin_dat
len = GARMIN_PKTHDR_LENGTH;
if (len >= GPS_IN_BUFSIZ) {
- /* seems to be an invalid packet, ignore rest
- of input */
- dev_dbg(&garmin_data_p->port->dev,
- "%s - packet size too large: %d\n",
- __func__, len);
+ /* should never end up here given the dlen check below */
garmin_data_p->insize = 0;
count = 0;
result = -EINVPKT;
@@ -773,8 +769,17 @@ static int nat_receive(struct garmin_dat
/* do we have a complete packet ? */
if (garmin_data_p->insize >= GARMIN_PKTHDR_LENGTH) {
- len = GARMIN_PKTHDR_LENGTH+
- getDataLength(garmin_data_p->inbuffer);
+ u32 dlen = getDataLength(garmin_data_p->inbuffer);
+
+ if (dlen >= GPS_IN_BUFSIZ - GARMIN_PKTHDR_LENGTH) {
+ /* invalid packet, ignore rest of input */
+ dev_dbg(&garmin_data_p->port->dev, "%s - invalid length: %u\n",
+ __func__, dlen);
+ garmin_data_p->insize = 0;
+ result = -EINVPKT;
+ break;
+ }
+ len = GARMIN_PKTHDR_LENGTH + dlen;
if (garmin_data_p->insize >= len) {
garmin_write_bulk(garmin_data_p->port,
garmin_data_p->inbuffer,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0617/1059] USB: serial: sierra: validate URB length in instat callback
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (615 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0616/1059] USB: serial: garmin_gps: validate packet data length in nat_receive() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0618/1059] USB: serial: upd78f0730: fix NULL-deref on hangup Greg Kroah-Hartman
` (381 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tristan Madani, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Madani <tristan@talencesecurity.com>
commit a3d43b39032cc5565a5693a10c581844342372cd upstream.
sierra_instat_callback() reads request fields and one byte past the
usb_ctrlrequest header without first checking that urb->actual_length
is large enough. A short USB interrupt transfer could cause an
out-of-bounds read.
Add two length checks matching the pattern already present in the
option driver (option_instat_callback): one for the request header
before accessing bRequestType, and one for the line-state data byte
inside the serial-state notification handler. Use dev_err() since
failing these checks causes the interrupt URB not to be resubmitted.
Fixes: 033a3fb980b041 ("USB: Sierra Wireless driver update")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
[ johan: use sizeof(*req_pkt) consistently ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/sierra.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -575,12 +575,24 @@ static void sierra_instat_callback(struc
__func__);
return;
}
+ if (urb->actual_length < sizeof(*req_pkt)) {
+ dev_err(&port->dev, "%s: short transfer\n",
+ __func__);
+ return;
+ }
if ((req_pkt->bRequestType == 0xA1) &&
(req_pkt->bRequest == 0x20)) {
int old_dcd_state;
- unsigned char signals = *((unsigned char *)
- urb->transfer_buffer +
- sizeof(struct usb_ctrlrequest));
+ unsigned char signals;
+
+ if (urb->actual_length < sizeof(*req_pkt) + 1) {
+ dev_err(&port->dev,
+ "%s: short interrupt transfer\n",
+ __func__);
+ return;
+ }
+ signals = *((unsigned char *)urb->transfer_buffer +
+ sizeof(*req_pkt));
dev_dbg(&port->dev, "%s: signal x%x\n", __func__,
signals);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0618/1059] USB: serial: upd78f0730: fix NULL-deref on hangup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (616 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0617/1059] USB: serial: sierra: validate URB length in instat callback Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0619/1059] USB: serial: io_edgeport: fix NULL-deref on early status Greg Kroah-Hartman
` (380 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Maksim Salau, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 0e0b1fcfb80c0490bda7f7eb633ebb5e431c2e16 upstream.
The port tty pointer is cleared on hangup before deasserting the modem
control signals and should not be used in the dtr_rts() callback.
Factor out a new upd78f0730_port_tiocmset() helper that can be used in
upd78f0730_dtr_rts() to avoid dereferencing a NULL-pointer on hangup
(e.g. on disconnect).
This issue was flagged by an LLM.
Fixes: ea534e0b4047 ("USB: serial: add uPD78F0730 USB to Serial Adaptor Driver")
Cc: stable@vger.kernel.org # 4.11
Cc: Maksim Salau <maksim.salau@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/upd78f0730.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/drivers/usb/serial/upd78f0730.c
+++ b/drivers/usb/serial/upd78f0730.c
@@ -201,10 +201,9 @@ static int upd78f0730_tiocmget(struct tt
return res;
}
-static int upd78f0730_tiocmset(struct tty_struct *tty,
+static int upd78f0730_port_tiocmset(struct usb_serial_port *port,
unsigned int set, unsigned int clear)
{
- struct usb_serial_port *port = tty->driver_data;
struct upd78f0730_port_private *private;
struct upd78f0730_set_dtr_rts request;
struct device *dev = &port->dev;
@@ -238,6 +237,13 @@ static int upd78f0730_tiocmset(struct tt
return res;
}
+static int upd78f0730_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
+{
+ struct usb_serial_port *port = tty->driver_data;
+
+ return upd78f0730_port_tiocmset(port, set, clear);
+}
+
static int upd78f0730_break_ctl(struct tty_struct *tty, int break_state)
{
struct upd78f0730_port_private *private;
@@ -267,7 +273,6 @@ static int upd78f0730_break_ctl(struct t
static void upd78f0730_dtr_rts(struct usb_serial_port *port, int on)
{
- struct tty_struct *tty = port->port.tty;
unsigned int set = 0;
unsigned int clear = 0;
@@ -276,7 +281,7 @@ static void upd78f0730_dtr_rts(struct us
else
clear = TIOCM_DTR | TIOCM_RTS;
- upd78f0730_tiocmset(tty, set, clear);
+ upd78f0730_port_tiocmset(port, set, clear);
}
static speed_t upd78f0730_get_baud_rate(struct tty_struct *tty)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0619/1059] USB: serial: io_edgeport: fix NULL-deref on early status
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (617 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0618/1059] USB: serial: upd78f0730: fix NULL-deref on hangup Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0620/1059] USB: serial: io_edgeport: fix potential close() use-after-free Greg Kroah-Hartman
` (379 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+763813d65c7e18c1b6d5,
Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit ae22e9b6412e5dc99e1cf8bd13c6176d44c7d42e upstream.
The driver submits the interrupt-in URB during probe or on first port
open, which on completion may submit the bulk-in URB before all ports
have been opened and their waitqueues have been initialised.
If a (malicious) device sends a status message for a port that has not
yet been opened this may lead to a NULL-pointer dereference in the
bulk-in completion handler when attempting to wakeup blocked tasks.
Move waitqueue initialisation from open() to port_probe() to address
this.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+763813d65c7e18c1b6d5@syzkaller.appspotmail.com
Link: https://lore.kernel.org/6a8818d8.ae6ddae5.3da009.0031.GAE@google.com
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -877,11 +877,6 @@ static int edge_open(struct tty_struct *
}
}
- /* initialize our wait queues */
- init_waitqueue_head(&edge_port->wait_open);
- init_waitqueue_head(&edge_port->wait_chase);
- init_waitqueue_head(&edge_port->wait_command);
-
/* initialize our port settings */
edge_port->txCredits = 0; /* Can't send any data yet */
/* Must always set this bit to enable ints! */
@@ -2965,6 +2960,11 @@ static int edge_port_probe(struct usb_se
return -ENOMEM;
spin_lock_init(&edge_port->ep_lock);
+
+ init_waitqueue_head(&edge_port->wait_open);
+ init_waitqueue_head(&edge_port->wait_chase);
+ init_waitqueue_head(&edge_port->wait_command);
+
edge_port->port = port;
usb_set_serial_port_data(port, edge_port);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0620/1059] USB: serial: io_edgeport: fix potential close() use-after-free
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (618 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0619/1059] USB: serial: io_edgeport: fix NULL-deref on early status Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0621/1059] USB: serial: io_edgeport: fix potential NULL-deref at open Greg Kroah-Hartman
` (378 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 839ff5fa30995c40cd5fba15fd976ad63416738a upstream.
Add the missing open check on write() and locking when updating the port
status during close() to prevent a racing interrupt completion handler
from trying to submit more data for the port while its write URB and
FIFO are being deallocated.
This issue was flagged by Sashiko when reviewing a related fix.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20260714101316.823942-1-shpark061104%40gmail.com?part=1
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1085,7 +1085,9 @@ static void edge_close(struct usb_serial
/* port->close = true; */
edge_port->closePending = false;
+ spin_lock_irq(&edge_port->ep_lock);
edge_port->open = false;
+ spin_unlock_irq(&edge_port->ep_lock);
edge_port->openPending = false;
usb_kill_urb(edge_port->write_urb);
@@ -1127,6 +1129,12 @@ static int edge_write(struct tty_struct
spin_lock_irqsave(&edge_port->ep_lock, flags);
+ /* avoid accessing freed fifo if tty_wakeup() races with close() */
+ if (!edge_port->open) {
+ spin_unlock_irqrestore(&edge_port->ep_lock, flags);
+ return 0;
+ }
+
/* calculate number of bytes to put in fifo */
copySize = min((unsigned int)count,
(edge_port->txCredits - fifo->count));
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0621/1059] USB: serial: io_edgeport: fix potential NULL-deref at open
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (619 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0620/1059] USB: serial: io_edgeport: fix potential close() use-after-free Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0622/1059] USB: serial: io_edgeport: move initial termios update to open() Greg Kroah-Hartman
` (377 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit a0403880a0a638f189e5187068244d9fd5bc8d4d upstream.
Do not mark the port as open until after the write FIFO has been
allocated and initialised to prevent a racing interrupt completion from
attempting to send stale data and dereference the FIFO buffer pointer.
Note that the open flag defaults to false and is cleared on close() so
there is no need to reinitialise it on every open().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -885,9 +885,7 @@ static int edge_open(struct tty_struct *
/* send a open port command */
edge_port->openPending = true;
- edge_port->open = false;
response = send_iosp_ext_cmd(edge_port, IOSP_CMD_OPEN_PORT, 0);
-
if (response < 0) {
dev_err(dev, "%s - error sending open port command\n", __func__);
edge_port->openPending = false;
@@ -897,8 +895,7 @@ static int edge_open(struct tty_struct *
/* now wait for the port to be completely opened */
wait_event_timeout(edge_port->wait_open, !edge_port->openPending,
OPEN_TIMEOUT);
-
- if (!edge_port->open) {
+ if (edge_port->openPending) {
/* open timed out */
dev_dbg(dev, "%s - open timeout\n", __func__);
edge_port->openPending = false;
@@ -926,6 +923,10 @@ static int edge_open(struct tty_struct *
return -ENOMEM;
}
+ spin_lock_irq(&edge_port->ep_lock);
+ edge_port->open = true;
+ spin_unlock_irq(&edge_port->ep_lock);
+
dev_dbg(dev, "%s - Initialize TX fifo to %d bytes\n",
__func__, edge_port->maxTxCredits);
@@ -1818,7 +1819,6 @@ static void process_rcvd_status(struct e
/* we have completed the open */
edge_port->openPending = false;
- edge_port->open = true;
wake_up(&edge_port->wait_open);
return;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0622/1059] USB: serial: io_edgeport: move initial termios update to open()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (620 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0621/1059] USB: serial: io_edgeport: fix potential NULL-deref at open Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0623/1059] USB: serial: io_edgeport: fix potential fifo corruption Greg Kroah-Hartman
` (376 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit febadc65a4ef8d08a12e76d6ec50834d72cc0e59 upstream.
Explicitly update the terminal settings on open() instead of doing so
from the interrupt completion handler when receiving an open command
response, which in theory can be received after a failed open attempt.
Note that this will be used to fix a FIFO corruption issue and also
allows for switching to synchronous commands.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 64 ++++++---------------------------------
1 file changed, 10 insertions(+), 54 deletions(-)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -281,8 +281,7 @@ static void handle_new_lsr(struct edgepo
static int send_iosp_ext_cmd(struct edgeport_port *edge_port, __u8 command,
__u8 param);
static int calc_baud_rate_divisor(struct device *dev, int baud_rate, int *divisor);
-static void change_port_settings(struct tty_struct *tty,
- struct edgeport_port *edge_port,
+static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port,
const struct ktermios *old_termios);
static int send_cmd_write_uart_register(struct edgeport_port *edge_port,
__u8 regNum, __u8 regValue);
@@ -923,6 +922,9 @@ static int edge_open(struct tty_struct *
return -ENOMEM;
}
+ if (tty)
+ edge_set_termios(tty, port, NULL);
+
spin_lock_irq(&edge_port->ep_lock);
edge_port->open = true;
spin_unlock_irq(&edge_port->ep_lock);
@@ -1444,30 +1446,6 @@ static void edge_unthrottle(struct tty_s
/*****************************************************************************
- * SerialSetTermios
- * this function is called by the tty driver when it wants to change
- * the termios structure
- *****************************************************************************/
-static void edge_set_termios(struct tty_struct *tty,
- struct usb_serial_port *port,
- const struct ktermios *old_termios)
-{
- struct edgeport_port *edge_port = usb_get_serial_port_data(port);
-
- if (edge_port == NULL)
- return;
-
- if (!edge_port->open) {
- dev_dbg(&port->dev, "%s - port not opened\n", __func__);
- return;
- }
-
- /* change the port settings to the new ones specified */
- change_port_settings(tty, edge_port, old_termios);
-}
-
-
-/*****************************************************************************
* get_lsr_info - get line status register info
*
* Purpose: Let user call ioctl() to get info when the UART physically
@@ -1756,7 +1734,6 @@ static void process_rcvd_status(struct e
{
struct usb_serial_port *port;
struct edgeport_port *edge_port;
- struct tty_struct *tty;
struct device *dev;
__u8 code = edge_serial->rxStatusCode;
@@ -1808,15 +1785,6 @@ static void process_rcvd_status(struct e
__func__, edge_serial->rxPort, byte2, edge_port->txCredits);
handle_new_msr(edge_port, byte2);
- /* send the current line settings to the port so we are
- in sync with any further termios calls */
- tty = tty_port_tty_get(&edge_port->port->port);
- if (tty) {
- change_port_settings(tty,
- edge_port, &tty->termios);
- tty_kref_put(tty);
- }
-
/* we have completed the open */
edge_port->openPending = false;
wake_up(&edge_port->wait_open);
@@ -2328,18 +2296,12 @@ static int send_cmd_write_uart_register(
}
-/*****************************************************************************
- * change_port_settings
- * This routine is called to set the UART on the device to match the
- * specified new settings.
- *****************************************************************************/
-
-static void change_port_settings(struct tty_struct *tty,
- struct edgeport_port *edge_port, const struct ktermios *old_termios)
+static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port,
+ const struct ktermios *old_termios)
{
- struct device *dev = &edge_port->port->dev;
- struct edgeport_serial *edge_serial =
- usb_get_serial_data(edge_port->port->serial);
+ struct edgeport_serial *edge_serial = usb_get_serial_data(port->serial);
+ struct edgeport_port *edge_port = usb_get_serial_port_data(port);
+ struct device *dev = &port->dev;
int baud;
unsigned cflag;
__u8 mask = 0xff;
@@ -2350,12 +2312,6 @@ static void change_port_settings(struct
__u8 txFlow;
int status;
- if (!edge_port->open &&
- !edge_port->openPending) {
- dev_dbg(dev, "%s - port not opened\n", __func__);
- return;
- }
-
cflag = tty->termios.c_cflag;
switch (cflag & CSIZE) {
@@ -2489,7 +2445,7 @@ static void change_port_settings(struct
dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
status = send_cmd_write_baud_rate(edge_port, baud);
- if (status == -1) {
+ if (status == -1 && old_termios) {
/* Speed change was not possible - put back the old speed */
baud = tty_termios_baud_rate(old_termios);
tty_encode_baud_rate(tty, baud, baud);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0623/1059] USB: serial: io_edgeport: fix potential fifo corruption
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (621 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0622/1059] USB: serial: io_edgeport: move initial termios update to open() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0624/1059] USB: serial: io_edgeport: fix potential use-after-free on disconnect Greg Kroah-Hartman
` (375 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 270f76c3b88c9cc3d6ca58c5c0c0f34c2373b27c upstream.
The device buffer size is determined during open() and the driver
allocates a TX FIFO of corresponding size.
Add the missing sanity check to prevent memory corruption in case a
malicious device sends a second open response with a different buffer
size.
This issue was flagged by Sashiko when reviewing a related fix.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20260714101316.823942-1-shpark061104%40gmail.com?part=1
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -877,13 +877,17 @@ static int edge_open(struct tty_struct *
}
/* initialize our port settings */
+ spin_lock_irq(&edge_port->ep_lock);
edge_port->txCredits = 0; /* Can't send any data yet */
+ edge_port->maxTxCredits = 0;
+ edge_port->openPending = true;
+ spin_unlock_irq(&edge_port->ep_lock);
+
/* Must always set this bit to enable ints! */
edge_port->shadowMCR = MCR_MASTER_IE;
edge_port->chaseResponsePending = false;
/* send a open port command */
- edge_port->openPending = true;
response = send_iosp_ext_cmd(edge_port, IOSP_CMD_OPEN_PORT, 0);
if (response < 0) {
dev_err(dev, "%s - error sending open port command\n", __func__);
@@ -1736,6 +1740,7 @@ static void process_rcvd_status(struct e
struct edgeport_port *edge_port;
struct device *dev;
__u8 code = edge_serial->rxStatusCode;
+ unsigned long flags;
/* switch the port pointer to the one being currently talked about */
if (edge_serial->rxPort >= edge_serial->serial->num_ports)
@@ -1779,6 +1784,12 @@ static void process_rcvd_status(struct e
}
if (code == IOSP_STATUS_OPEN_RSP) {
+ spin_lock_irqsave(&edge_port->ep_lock, flags);
+ /* reject stray open responses to avoid FIFO corruption */
+ if (!edge_port->openPending) {
+ spin_unlock_irqrestore(&edge_port->ep_lock, flags);
+ return;
+ }
edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3);
edge_port->maxTxCredits = edge_port->txCredits;
dev_dbg(dev, "%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d\n",
@@ -1787,6 +1798,8 @@ static void process_rcvd_status(struct e
/* we have completed the open */
edge_port->openPending = false;
+ spin_unlock_irqrestore(&edge_port->ep_lock, flags);
+
wake_up(&edge_port->wait_open);
return;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0624/1059] USB: serial: io_edgeport: fix potential use-after-free on disconnect
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (622 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0623/1059] USB: serial: io_edgeport: fix potential fifo corruption Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0625/1059] USB: serial: io_edgeport: serialise MCR accesses Greg Kroah-Hartman
` (374 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 50613e6380db7a904ef15c60ed0c436baf308f0a upstream.
The driver submits command URBs asynchronously but fails to stop them on
disconnect, something which could lead to a use-after-free when
accessing driver data in the completion handler after a port has been
unbound.
Add an URB anchor to track and kill outstanding command URBs on
disconnect.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -225,6 +225,7 @@ struct edgeport_serial {
__u8 rxStatusParam; /* the receive status parameter */
__s16 rxBytesRemaining; /* the number of port bytes left to read */
struct usb_serial *serial; /* loop back to the owner of this object */
+ struct usb_anchor cmd_anchor;
};
/* baud rate information */
@@ -261,9 +262,6 @@ static const struct divisor_table_entry
{ 230400, 1},
};
-/* Number of outstanding Command Write Urbs */
-static atomic_t CmdUrbs = ATOMIC_INIT(0);
-
/* function prototypes */
@@ -776,11 +774,6 @@ static void edge_bulk_out_cmd_callback(s
struct device *dev = &urb->dev->dev;
int status = urb->status;
- atomic_dec(&CmdUrbs);
- dev_dbg(dev, "%s - FREE URB %p (outstanding %d)\n", __func__, urb,
- atomic_read(&CmdUrbs));
-
-
/* clean up the transfer buffer */
kfree(urb->transfer_buffer);
@@ -2127,24 +2120,21 @@ static int write_cmd_usb(struct edgeport
if (!urb)
return -ENOMEM;
- atomic_inc(&CmdUrbs);
- dev_dbg(dev, "%s - ALLOCATE URB %p (outstanding %d)\n",
- __func__, urb, atomic_read(&CmdUrbs));
-
usb_fill_bulk_urb(urb, edge_serial->serial->dev,
usb_sndbulkpipe(edge_serial->serial->dev,
edge_serial->bulk_out_endpoint),
buffer, length, edge_bulk_out_cmd_callback, edge_port);
edge_port->commandPending = true;
+ usb_anchor_urb(urb, &edge_serial->cmd_anchor);
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
/* something went wrong */
dev_err(dev, "%s - usb_submit_urb(write command) failed, status = %d\n",
__func__, status);
+ usb_unanchor_urb(urb);
usb_free_urb(urb);
- atomic_dec(&CmdUrbs);
return status;
}
@@ -2696,6 +2686,7 @@ static int edge_startup(struct usb_seria
spin_lock_init(&edge_serial->es_lock);
edge_serial->serial = serial;
+ init_usb_anchor(&edge_serial->cmd_anchor);
usb_set_serial_data(serial, edge_serial);
/* get the name for the device from the device */
@@ -2900,6 +2891,8 @@ static void edge_disconnect(struct usb_s
{
struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
+ usb_kill_anchored_urbs(&edge_serial->cmd_anchor);
+
if (edge_serial->is_epic) {
usb_kill_urb(edge_serial->interrupt_read_urb);
usb_kill_urb(edge_serial->read_urb);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0625/1059] USB: serial: io_edgeport: serialise MCR accesses
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (623 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0624/1059] USB: serial: io_edgeport: fix potential use-after-free on disconnect Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0626/1059] dt-bindings: iio: adc: Add syscon property for multi-SCU SoCs Greg Kroah-Hartman
` (373 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 6e4629504d7e5a22dd26f3b262f0a0f80e3cad6a upstream.
Add a mutex to serialise modem control register updates to prevent
concurrent tasks from interfering with each other.
Note that the register updates are currently asynchronous so a task may
read back a value which has not yet taken effect.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/serial/io_edgeport.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -168,6 +168,7 @@ struct edgeport_port {
struct urb *write_urb; /* write URB for this port */
bool write_in_progress; /* 'true' while a write URB is outstanding */
spinlock_t ep_lock;
+ struct mutex mutex;
__u8 shadowLCR; /* last LCR value received */
__u8 shadowMCR; /* last MCR value received */
@@ -877,7 +878,10 @@ static int edge_open(struct tty_struct *
spin_unlock_irq(&edge_port->ep_lock);
/* Must always set this bit to enable ints! */
+ mutex_lock(&edge_port->mutex);
edge_port->shadowMCR = MCR_MASTER_IE;
+ mutex_unlock(&edge_port->mutex);
+
edge_port->chaseResponsePending = false;
/* send a open port command */
@@ -1398,9 +1402,11 @@ static void edge_throttle(struct tty_str
/* if we are implementing RTS/CTS, toggle that line */
if (C_CRTSCTS(tty)) {
+ mutex_lock(&edge_port->mutex);
edge_port->shadowMCR &= ~MCR_RTS;
status = send_cmd_write_uart_register(edge_port, MCR,
edge_port->shadowMCR);
+ mutex_unlock(&edge_port->mutex);
if (status != 0)
return;
}
@@ -1435,9 +1441,11 @@ static void edge_unthrottle(struct tty_s
}
/* if we are implementing RTS/CTS, toggle that line */
if (C_CRTSCTS(tty)) {
+ mutex_lock(&edge_port->mutex);
edge_port->shadowMCR |= MCR_RTS;
send_cmd_write_uart_register(edge_port, MCR,
edge_port->shadowMCR);
+ mutex_unlock(&edge_port->mutex);
}
}
@@ -1478,6 +1486,7 @@ static int edge_tiocmset(struct tty_stru
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
unsigned int mcr;
+ mutex_lock(&edge_port->mutex);
mcr = edge_port->shadowMCR;
if (set & TIOCM_RTS)
mcr |= MCR_RTS;
@@ -1496,6 +1505,7 @@ static int edge_tiocmset(struct tty_stru
edge_port->shadowMCR = mcr;
send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR);
+ mutex_unlock(&edge_port->mutex);
return 0;
}
@@ -1509,6 +1519,7 @@ static int edge_tiocmget(struct tty_stru
unsigned int mcr;
msr = edge_port->shadowMSR;
+ mutex_lock(&edge_port->mutex);
mcr = edge_port->shadowMCR;
result = ((mcr & MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */
| ((mcr & MCR_RTS) ? TIOCM_RTS: 0) /* 0x004 */
@@ -1516,6 +1527,7 @@ static int edge_tiocmget(struct tty_stru
| ((msr & EDGEPORT_MSR_CD) ? TIOCM_CAR: 0) /* 0x040 */
| ((msr & EDGEPORT_MSR_RI) ? TIOCM_RI: 0) /* 0x080 */
| ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */
+ mutex_unlock(&edge_port->mutex);
return result;
}
@@ -2430,12 +2442,14 @@ static void edge_set_termios(struct tty_
return;
/* set up the MCR register and send it to the EdgePort */
+ mutex_lock(&edge_port->mutex);
edge_port->shadowMCR = MCR_MASTER_IE;
if (cflag & CBAUD)
edge_port->shadowMCR |= (MCR_DTR | MCR_RTS);
status = send_cmd_write_uart_register(edge_port, MCR,
edge_port->shadowMCR);
+ mutex_unlock(&edge_port->mutex);
if (status != 0)
return;
@@ -2930,6 +2944,7 @@ static int edge_port_probe(struct usb_se
return -ENOMEM;
spin_lock_init(&edge_port->ep_lock);
+ mutex_init(&edge_port->mutex);
init_waitqueue_head(&edge_port->wait_open);
init_waitqueue_head(&edge_port->wait_chase);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0626/1059] dt-bindings: iio: adc: Add syscon property for multi-SCU SoCs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (624 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0625/1059] USB: serial: io_edgeport: serialise MCR accesses Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0627/1059] iio: accel: kxsd9: Fix potential use-after-free on removal Greg Kroah-Hartman
` (372 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Krzysztof Kozlowski, Billy Tsai,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <billy_tsai@aspeedtech.com>
commit 6ec0623a7c77bc2c383e9971d7b0c9df3ec988fb upstream.
The ADC's reference-voltage trimming data lives in a System Control
Unit (SCU) register. SoCs with a single SCU instance let the driver
locate it without any additional information, but SoCs such as AST2700
that expose more than one SCU node need an explicit phandle to
disambiguate which one holds the trimming data.
Add an "aspeed,trim-syscon" phandle property, and require it for the
AST2700 compatibles since they are the first multi-SCU SoCs supported
by this driver.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml | 17 ++++++++++
1 file changed, 17 insertions(+)
--- a/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/aspeed,ast2600-adc.yaml
@@ -62,6 +62,11 @@ properties:
description:
Inform the driver that last channel will be used to sensor battery.
+ aspeed,trim-syscon:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ Phandle to the SCU holding the ADC's reference-voltage trimming data.
+
required:
- compatible
- reg
@@ -69,6 +74,18 @@ required:
- resets
- "#io-channel-cells"
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - aspeed,ast2700-adc0
+ - aspeed,ast2700-adc1
+ then:
+ required:
+ - aspeed,trim-syscon
+
additionalProperties: false
examples:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0627/1059] iio: accel: kxsd9: Fix potential use-after-free on removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (625 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0626/1059] dt-bindings: iio: adc: Add syscon property for multi-SCU SoCs Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0628/1059] iio: afe: rescale: expose offset if rescaler or source has one Greg Kroah-Hartman
` (371 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Joshua Crofts,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
commit fd7334314f63a3a2a4927f209b2ca0e33d111840 upstream.
Unregistering an IIO device with an active triggered buffer detaches its
poll function. Freeing the poll function first can therefore make
iio_device_unregister() access freed memory.
Unregister the device before cleaning up the triggered buffer.
This issue was found by our static analysis tool under development.
Fixes: 0427a106a98a ("iio: accel: kxsd9: Add triggered buffer handling")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/accel/kxsd9.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -484,8 +484,8 @@ void kxsd9_common_remove(struct device *
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct kxsd9_state *st = iio_priv(indio_dev);
- iio_triggered_buffer_cleanup(indio_dev);
iio_device_unregister(indio_dev);
+ iio_triggered_buffer_cleanup(indio_dev);
pm_runtime_get_sync(dev);
pm_runtime_put_noidle(dev);
pm_runtime_disable(dev);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0628/1059] iio: afe: rescale: expose offset if rescaler or source has one
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (626 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0627/1059] iio: accel: kxsd9: Fix potential use-after-free on removal Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0629/1059] iio: atlas-ezo: Fix humidity channel read support Greg Kroah-Hartman
` (370 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrea Amer, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Amer <and.amer@gmail.com>
commit c293f0db308fe76a0a9b0f6674cd2dea149b03aa upstream.
A rescale channel advertises IIO_CHAN_INFO_OFFSET only when its own
offset is non-zero. A child rescale therefore hides a source offset,
and consumers apply raw * scale and drop it, even though
rescale_read_raw() folds the source offset in.
Expose the attribute when either the rescaler or the source channel
provides an offset.
Fixes: a29c3283653b ("iio: afe: rescale: add offset support")
Signed-off-by: Andrea Amer <and.amer@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/afe/iio-rescale.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/iio/afe/iio-rescale.c
+++ b/drivers/iio/afe/iio-rescale.c
@@ -304,7 +304,8 @@ static int rescale_configure_channel(str
chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE);
- if (rescale->offset)
+ if (rescale->offset ||
+ iio_channel_has_info(schan, IIO_CHAN_INFO_OFFSET))
chan->info_mask_separate |= BIT(IIO_CHAN_INFO_OFFSET);
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0629/1059] iio: atlas-ezo: Fix humidity channel read support
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (627 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0628/1059] iio: afe: rescale: expose offset if rescaler or source has one Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0630/1059] iio: dac: mcp4725: Update the cached DAC value only on success Greg Kroah-Hartman
` (369 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nikhil Gautam, Joshua Crofts,
Matt Ranostay, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikhil Gautam <nikhilgtr@gmail.com>
commit 0cb3fc8987038a26ac0f581bfa26b16daf6ca6a7 upstream.
The atlas_ezo_read_raw() function rejects channels that are not of
type IIO_CONCENTRATION, preventing the relative humidity channel
from reading raw and scale values.
Remove the early channel type check to allow both concentration
and relative humidity channels to reach the mask-specific handling.
Fixes: dc3ebfcaa51f ("iio: chemical: atlas-ezo-sensor: add humidity sensor support")
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Matt Ranostay <matt@ranostay.sg>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/chemical/atlas-ezo-sensor.c | 3 ---
1 file changed, 3 deletions(-)
--- a/drivers/iio/chemical/atlas-ezo-sensor.c
+++ b/drivers/iio/chemical/atlas-ezo-sensor.c
@@ -117,9 +117,6 @@ static int atlas_ezo_read_raw(struct iio
struct atlas_ezo_data *data = iio_priv(indio_dev);
struct i2c_client *client = data->client;
- if (chan->type != IIO_CONCENTRATION)
- return -EINVAL;
-
switch (mask) {
case IIO_CHAN_INFO_RAW: {
int ret;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0630/1059] iio: dac: mcp4725: Update the cached DAC value only on success
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (628 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0629/1059] iio: atlas-ezo: Fix humidity channel read support Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0631/1059] iio: gyro: bmg160: reject duplicate event disable Greg Kroah-Hartman
` (368 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Baek Kyu, Kim, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baek Kyu, Kim <pocj8ur4in@gmail.com>
commit 098a4c37dc8815ea941866179220394e4d182c67 upstream.
mcp4725_write_raw() updates dac_value even if mcp4725_set_value() rejects
the requested value or reports an I2C transfer error. After writing 1000,
a rejected write of 4096 returns -EINVAL without an I2C transfer, but
out_voltage0_raw reports 4096. A later powerdown exit sends 00 00 instead
of the 03 e8 frame for the last successful value. The EEPROM store path
uses the same cache.
Return the setter error before updating dac_value. This keeps the last
successful software value for readback, powerdown exit and EEPROM writes.
Fixes: cf35ad61aca2 ("iio: add mcp4725 I2C DAC driver")
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/dac/mcp4725.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -354,6 +354,8 @@ static int mcp4725_write_raw(struct iio_
switch (mask) {
case IIO_CHAN_INFO_RAW:
ret = mcp4725_set_value(indio_dev, val);
+ if (ret)
+ return ret;
data->dac_value = val;
break;
default:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0631/1059] iio: gyro: bmg160: reject duplicate event disable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (629 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0630/1059] iio: dac: mcp4725: Update the cached DAC value only on success Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0632/1059] iio: hid-sensor: Fix scale for magnetic north heading Greg Kroah-Hartman
` (367 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
commit d0c8bd5d18a492d64d05482f4b1700e14df7ff84 upstream.
The IIO core does not filter duplicate writes to the event enable
attribute. bmg160_write_event_config() already ignores repeated enable
requests, but a repeated disable request still calls
bmg160_set_power_state(data, false), dropping a runtime PM reference
that was not acquired for this request. This can underflow the runtime
PM usage count and trigger a "Runtime PM usage count underflow" warning.
Return early when the requested state already matches ev_enable_state.
Fixes: 22b46c45fb9b ("iio:gyro:bmg160 Gyro Sensor driver")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/gyro/bmg160_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/gyro/bmg160_core.c
+++ b/drivers/iio/gyro/bmg160_core.c
@@ -767,7 +767,7 @@ static int bmg160_write_event_config(str
struct bmg160_data *data = iio_priv(indio_dev);
int ret;
- if (state && data->ev_enable_state)
+ if (state == data->ev_enable_state)
return 0;
mutex_lock(&data->mutex);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0632/1059] iio: hid-sensor: Fix scale for magnetic north heading
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (630 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0631/1059] iio: gyro: bmg160: reject duplicate event disable Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0633/1059] iio: hid-sensors: fix fractional part for unit exponents -7 and -8 Greg Kroah-Hartman
` (366 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maximilian Czirr,
Srinivas Pandruvada, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maximilian Czirr <maxx-cz@web.de>
commit c72dcaeaabd60e164e7324f80ccb037e879eefdd upstream.
hid_sensor_format_scale() applies the HID unit exponent only when
the usage and unit match an entry in unit_conversion[].
Rotation-from-north support uses
HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, but that usage has no entry in
the conversion table. As a result, the unit exponent is ignored and the
heading can be exposed with a scale of 1 instead of the scale specified
by the HID descriptor.
Add a unitless conversion entry so the HID unit exponent is applied to
the magnetic north heading. A sensor reporting an exponent of -5 then
correctly exposes a scale of 0.00001 instead of 1.
Fixes: abea9c62c32f ("iio: hid-sensor-magn-3d: Add support for rotation from north")
Cc: stable@vger.kernel.org
Signed-off-by: Maximilian Czirr <maxx-cz@web.de>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -38,6 +38,8 @@ static struct {
{HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000000},
{HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0},
+ {HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, 0, 1, 0},
+
{HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453293},
{HID_USAGE_SENSOR_INCLINOMETER_3D,
HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453293},
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0633/1059] iio: hid-sensors: fix fractional part for unit exponents -7 and -8
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (631 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0632/1059] iio: hid-sensor: Fix scale for magnetic north heading Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0634/1059] iio: humidity: am2315: fix negative temperature decoding Greg Kroah-Hartman
` (365 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Srinivas Pandruvada, Semyon Maryasin,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
commit 79c8dffd84e9784ec05bea68dbe5e71f7ec9941a upstream.
split_micro_fraction() scales the remainder to micro units by
multiplying it by 10^(6 - exp). The unit exponent of a HID field goes
down to -8, so exp can be 7 or 8 here. Then the argument of int_pow()
is negative, which the unsigned parameter turns into a huge power of
ten: 0 modulo 2^64. As a result, the fractional part of a value read
from the hysteresis attributes is always reported as 0.
Divide by 10^(exp - 6) in these two cases. This matches the reverse
conversion in convert_to_vtf_format().
Fixes: 73c6768b710a ("iio: hid-sensors: Common attribute and trigger")
Cc: stable@vger.kernel.org
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -95,9 +95,14 @@ static void simple_div(int dividend, int
static void split_micro_fraction(unsigned int no, int exp, int *val1, int *val2)
{
int divisor = int_pow(10, exp);
+ unsigned int rem;
*val1 = no / divisor;
- *val2 = no % divisor * int_pow(10, 6 - exp);
+ rem = no % divisor;
+ if (exp > 6)
+ *val2 = rem / (unsigned int)int_pow(10, exp - 6);
+ else
+ *val2 = rem * int_pow(10, 6 - exp);
}
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0634/1059] iio: humidity: am2315: fix negative temperature decoding
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (632 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0633/1059] iio: hid-sensors: fix fractional part for unit exponents -7 and -8 Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0635/1059] iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes Greg Kroah-Hartman
` (364 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vidhu Sarwal, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidhu Sarwal <vidhu.linux@gmail.com>
commit 0a570feeca37d85fbfd6b4f6e3d9f33e1461c634 upstream.
The AM2315/AM2320 report temperature as a sign-magnitude value,
with bit 15 as the sign and bits 14-0 as the magnitude.
am2315_read_data() stores the raw value directly in an s16, causing
negative temperatures to be interpreted as two's complement. Both the
read_raw and the triggered buffer paths are affected.
Decode the sign bit before storing the temperature value. Positive
readings are unaffected.
Fixes: 366a3270c1c5 ("iio: humidity: Add support for AM2315")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/humidity/am2315.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--- a/drivers/iio/humidity/am2315.c
+++ b/drivers/iio/humidity/am2315.c
@@ -113,6 +113,7 @@ static int am2315_read_data(struct am231
*/
u8 rx_buf[8];
u16 crc;
+ u16 temp_raw;
/* First wake up the device. */
am2315_ping(data->client);
@@ -144,8 +145,15 @@ static int am2315_read_data(struct am231
sensor_data->hum_data = (rx_buf[AM2315_HUM_OFFSET] << 8) |
rx_buf[AM2315_HUM_OFFSET + 1];
- sensor_data->temp_data = (rx_buf[AM2315_TEMP_OFFSET] << 8) |
- rx_buf[AM2315_TEMP_OFFSET + 1];
+
+ /*
+ * Temperature is sign-magnitude, not two's complement:
+ * bit 15 is the sign, bits 14-0 are the magnitude (x0.1 degC).
+ */
+ temp_raw = (rx_buf[AM2315_TEMP_OFFSET] << 8) |
+ rx_buf[AM2315_TEMP_OFFSET + 1];
+ sensor_data->temp_data = (temp_raw & 0x8000) ?
+ -(temp_raw & 0x7fff) : temp_raw;
return ret;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0635/1059] iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (633 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0634/1059] iio: humidity: am2315: fix negative temperature decoding Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0636/1059] iio: imu: kmx61: reject duplicate event disable Greg Kroah-Hartman
` (363 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Jean-Baptiste Maneyrol,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit e5f7a6684a23d9b20184a81b4ebded3b3504ccdc upstream.
inv_mpu_magn_get_scale() returns st->magn_raw_to_gauss[chan->address],
where magn_raw_to_gauss[] holds one coefficient per axis, computed in
inv_magn_init() from the per-axis factory sensitivity adjustment values
(ASAX, ASAY, ASAZ) of the AK8975/AK8963 magnetometer.
However INV_MPU9X50_MAGN_CHAN() never sets .address, so it is 0 for all
three magnetometer channels. As a result the Y and Z channels report the
scale computed from the X axis adjustment value, and userspace scales
the Y and Z readings with the wrong per-axis calibration.
Set .address to the axis index (0 for X, 1 for Y, 2 for Z) in the
channel macro, matching the order used to fill magn_raw_to_gauss[].
Fixes: b1392de06184 ("iio: imu: inv_mpu6050: add MPU925x magnetometer support")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1162,6 +1162,8 @@ static const unsigned long inv_mpu_scan_
.type = IIO_MAGN, \
.modified = 1, \
.channel2 = _chan2, \
+ /* index of the axis in magn_raw_to_gauss[] */ \
+ .address = (_chan2) - IIO_MOD_X, \
.info_mask_separate = BIT(IIO_CHAN_INFO_SCALE) | \
BIT(IIO_CHAN_INFO_RAW), \
.scan_index = _index, \
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0636/1059] iio: imu: kmx61: reject duplicate event disable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (634 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0635/1059] iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0637/1059] iio: light: tsl2591: dont divide by zero Greg Kroah-Hartman
` (362 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
commit 9a60b35fe45801d45454e1efe90569c9cc6ea736 upstream.
The IIO core does not filter duplicate writes to the event enable
attribute. kmx61_write_event_config() already ignores repeated enable
requests, but a repeated disable request still calls
kmx61_set_power_state(data, false, KMX61_ACC), dropping a runtime PM
reference that was not acquired for this request. This can underflow the
runtime PM usage count and trigger a "Runtime PM usage count underflow"
warning.
Return early when the requested state already matches ev_enable_state.
Fixes: fd3ae7a9f21c ("iio: imu: kmx61: Add support for any motion trigger")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/imu/kmx61.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -946,7 +946,7 @@ static int kmx61_write_event_config(stru
struct kmx61_data *data = kmx61_get_data(indio_dev);
int ret = 0;
- if (state && data->ev_enable_state)
+ if (state == data->ev_enable_state)
return 0;
mutex_lock(&data->lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0637/1059] iio: light: tsl2591: dont divide by zero
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (635 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0636/1059] iio: imu: kmx61: reject duplicate event disable Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0638/1059] iio: light: vcnl4035: Fix reversed ALS mode bit Greg Kroah-Hartman
` (361 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Martin Triska, Andy Shevchenko,
Jan Remes, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Remes <jan.remes@mycroftmind.com>
commit bd63c89aac5672f40cdc123a856493b628fc1abb upstream.
The TSL2591 has two raw light channels - CH0 and CH1. The algorithm for
calculating illumination from the raw channels requires division by CH0
(which can be zero) and by "counts per lux" (CPL) value which is also zero
for (gain = LOW, integration time <= 400 ms).
Furthermore, the algorithm assumes CH0 > CH1, which can be violated in
almost complete darkness.
As a result, reading from 'in_illuminance_input' results in
division-by-zero whenever CH0 is 0 (complete darkness) or whenever the
parameters result in CPL being zero. This results in kernel oops on
x86_64 and in reading the value as 0 on arm64.
Fix that by:
- reporting CH0 <= CH1 as zero (catches also CH0 = 0)
- updating the lux algorithm to only do the division at the end
Fixes: 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")
Cc: stable@vger.kernel.org
Reported-by: Martin Triska <martin.triska@mycroftmind.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jan Remes <jan.remes@mycroftmind.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/light/tsl2591.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
--- a/drivers/iio/light/tsl2591.c
+++ b/drivers/iio/light/tsl2591.c
@@ -16,6 +16,7 @@
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
@@ -425,6 +426,10 @@ static int tsl2591_wait_adc_complete(str
* Scale values to get more representative value of lux i.e.
* lux = ((C0DATA - C1DATA) * (1000 - ((C1DATA * 1000) / C0DATA))) / CPL
*
+ * CPL is not computed on its own: at 1x gain it is below 1 for integration
+ * times under 500 ms, so the division by LUX DF is folded into the final
+ * division instead.
+ *
* Channel 0 = IR + Visible
* Channel 1 = IR only
*/
@@ -436,8 +441,10 @@ static int tsl2591_read_channel_data(str
struct tsl2591_als_settings *settings = &chip->als_settings;
struct i2c_client *client = chip->client;
u8 als_data[TSL2591_NUM_DATA_REGISTERS];
- int counts_per_lux, int_time_fval, gain_multi, lux;
+ int int_time_fval, gain_multi;
u16 als_ch0, als_ch1;
+ u64 lux;
+ u32 rem;
int ret;
ret = tsl2591_wait_adc_complete(chip);
@@ -473,23 +480,28 @@ static int tsl2591_read_channel_data(str
return gain_multi;
}
- int_time_fval = TSL2591_FVAL_TO_MSEC(settings->als_int_time);
- /* Calculate counts per lux value */
- counts_per_lux = (int_time_fval * gain_multi) / TSL2591_LUX_COEFFICIENT;
+ /* No visible light, this also catches C0DATA == 0 */
+ if (als_ch0 <= als_ch1) {
+ *val = 0;
+ *val2 = 0;
+ break;
+ }
- dev_dbg(&client->dev, "Counts Per Lux: %d\n", counts_per_lux);
+ int_time_fval = TSL2591_FVAL_TO_MSEC(settings->als_int_time);
/* Calculate lux value */
- lux = ((als_ch0 - als_ch1) *
- (1000 - ((als_ch1 * 1000) / als_ch0))) / counts_per_lux;
+ lux = (u64)(als_ch0 - als_ch1) *
+ (1000 - ((als_ch1 * 1000) / als_ch0)) *
+ TSL2591_LUX_COEFFICIENT;
+ lux = div_u64(lux, int_time_fval * gain_multi);
- dev_dbg(&client->dev, "Raw lux calculation: %d\n", lux);
+ dev_dbg(&client->dev, "Raw lux calculation: %llu\n", lux);
/* Divide by 1000 to get real lux value before scaling */
- *val = lux / 1000;
+ *val = div_u64_rem(lux, 1000, &rem);
/* Get the decimal part of lux reading */
- *val2 = (lux - (*val * 1000)) * 1000;
+ *val2 = rem * 1000;
break;
default:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0638/1059] iio: light: vcnl4035: Fix reversed ALS mode bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (636 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0637/1059] iio: light: tsl2591: dont divide by zero Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0639/1059] iio: magnetometer: mmc35240: leave cache-only mode before the cache sync Greg Kroah-Hartman
` (360 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Sarmanow, Nuno Sá,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sarmanow <as@discnull.de>
commit 6bcabc30b89f31e2925647d1ffa5a0e4b7919829 upstream.
According to the datasheet (table 2) the ALS_SD bit behaves the opposite
way the current ALS mode defines are set, writing 0 powers the sensor
and writing 1 shuts it down.
The current driver thinks the ALS is up while it's actually shut down
and it's down when the systems powers it up.
Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sarmanow <as@discnull.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/light/vcnl4035.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -46,8 +46,8 @@
#define VCNL4035_DEV_ID_MASK GENMASK(7, 0)
/* Default values */
-#define VCNL4035_MODE_ALS_ENABLE BIT(0)
-#define VCNL4035_MODE_ALS_DISABLE 0x00
+#define VCNL4035_MODE_ALS_ENABLE 0x00
+#define VCNL4035_MODE_ALS_DISABLE BIT(0)
#define VCNL4035_MODE_ALS_INT_ENABLE BIT(1)
#define VCNL4035_MODE_ALS_INT_DISABLE 0
#define VCNL4035_DEV_ID_VAL 0x80
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0639/1059] iio: magnetometer: mmc35240: leave cache-only mode before the cache sync
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (637 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0638/1059] iio: light: vcnl4035: Fix reversed ALS mode bit Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0640/1059] iio: proximity: sx9324: fix out-of-bounds read of scan period table Greg Kroah-Hartman
` (359 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
commit 38e05cf38df705b7fa9e8ada931589fa96816f09 upstream.
mmc35240_resume() marks the register cache dirty and calls
regcache_sync_region() while the regmap is still in cache-only mode.
It calls regcache_cache_only(false) only after the sync. This
ordering has been wrong since the resume support was added; it happened
to work until regmap started rejecting a sync in cache-only mode.
Since commit afc8e3ee8307 ("regcache: Validate cache_only state in
regcache_sync_region()") a sync in cache-only mode is refused with a
WARN and -EINVAL. Every resume now gives
WARNING: drivers/base/regmap/regcache.c:536 at regcache_sync_region+0x1a4/0x1c0
...
mmc35240_resume+0x30/0x70
dpm_run_callback+0x7d/0x1c0
device_resume+0x175/0x270
...
mmc35240 1-0030: Failed to restore control registers
and the control registers are not written. If the chip lost its state
during suspend, it runs with the reset value of CTRL1 while the cache,
and with it the sampling frequency attribute, still has the configured
value. Writing the same frequency again does not repair this, because
regmap_update_bits() finds no difference to the cache.
Leave cache-only mode first, then mark the cache dirty and sync it.
Reproduced in qemu with the driver bound to an i2c-stub device: set
in_magn_sampling_frequency to 25 (CTRL1 = 0x02), clear CTRL0 and CTRL1
of the stub behind the driver's back to emulate the power loss, and run
a suspend/resume cycle with "devices" in /sys/power/pm_test. Without
this change CTRL1 is still 0x00 after resume and the warning is
printed. With it, and also with the regcache commit reverted, CTRL1 is
0x02 again and there is no warning. Not tested on real hardware.
Fixes: 553a776b7908 ("iio: magnetometer: mmc35240: Add PM sleep support")
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/magnetometer/mmc35240.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -537,14 +537,13 @@ static int mmc35240_resume(struct device
struct mmc35240_data *data = iio_priv(indio_dev);
int ret;
+ regcache_cache_only(data->regmap, false);
regcache_mark_dirty(data->regmap);
ret = regcache_sync_region(data->regmap, MMC35240_REG_CTRL0,
MMC35240_REG_CTRL1);
if (ret < 0)
dev_err(dev, "Failed to restore control registers\n");
- regcache_cache_only(data->regmap, false);
-
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0640/1059] iio: proximity: sx9324: fix out-of-bounds read of scan period table
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (638 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0639/1059] iio: magnetometer: mmc35240: leave cache-only mode before the cache sync Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0641/1059] iio: trigger: free the trigger ID after device_del() Greg Kroah-Hartman
` (358 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Andy Shevchenko,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit 7b5f54280f8e6ef07664f6705dd005feefbe87d1 upstream.
The scan period of the SX9324 is selected by the 5 bit wide
SX9324_REG_GNRL_CTRL0_SCANPERIOD field, so it has 32 possible values.
sx9324_scan_period_table[] however only has 16 entries, it was copied
over from the SX9310 driver where the field is only 4 bits wide.
sx9324_wait_for_sample() indexes the table with the raw field value, so
all the codes from 16 to 31 read past the end of the array. The default
value of the register is SX9324_REG_GNRL_CTRL0_SCANPERIOD_100MS (0x16,
i.e. 22), so the out-of-bounds read happens with the default
configuration of the device. It is only avoided when the device has an
interrupt line, as the wait is only done in the polling case.
The value read is then used as the duration of an msleep() call, so the
sensor is polled with a completely random delay.
Fill the table with the scan periods of all 32 codes, which are the
periods documented for the corresponding sx9324_samp_freq_table[]
entries, and add a static assertion to keep both tables in sync.
Fixes: 4c18a890dff8 ("iio:proximity:sx9324: Add SX9324 support")
Cc: stable@vger.kernel.org
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/proximity/sx9324.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/drivers/iio/proximity/sx9324.c
+++ b/drivers/iio/proximity/sx9324.c
@@ -280,11 +280,20 @@ static const struct {
{ 0, 250000 }, /* 11111: 4 s */
};
+/*
+ * The scan period of the SX9324 is selected by the 5-bit wide
+ * SX9324_REG_GNRL_CTRL0_SCANPERIOD field. The values below are the scan
+ * periods in ms of the corresponding sx9324_samp_freq_table[] entries.
+ */
static const unsigned int sx9324_scan_period_table[] = {
- 2, 15, 30, 45, 60, 90, 120, 200,
- 400, 600, 800, 1000, 2000, 3000, 4000, 5000,
+ 1, 2, 4, 6, 8, 10, 14, 18, /* 0x00 - 0x07 */
+ 22, 26, 30, 34, 38, 42, 46, 50, /* 0x08 - 0x0f */
+ 56, 62, 68, 74, 80, 90, 100, 200, /* 0x10 - 0x17 */
+ 300, 400, 600, 800, 1000, 2000, 3000, 4000, /* 0x18 - 0x1f */
};
+static_assert(ARRAY_SIZE(sx9324_scan_period_table) == ARRAY_SIZE(sx9324_samp_freq_table));
+
static const struct regmap_range sx9324_writable_reg_ranges[] = {
/*
* To set COMPSTAT for compensation, even if datasheet says register is
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0641/1059] iio: trigger: free the trigger ID after device_del()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (639 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0640/1059] iio: proximity: sx9324: fix out-of-bounds read of scan period table Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0642/1059] iio: trigger: Return an error when the trigger has no free irq Greg Kroah-Hartman
` (357 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Changyul Lee, Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changyul Lee <lcy8047@gmail.com>
commit d32bf759801e6df23038dc834622a122ec76a4dd upstream.
iio_trigger_unregister() returns the trigger ID to iio_trigger_ida
before device_del() removes the "trigger<N>" device. A trigger
registered in between can get the same ID, and its device_add() fails:
sysfs: cannot create duplicate filename '/bus/iio/devices/trigger0'
For example, adding a sysfs trigger while an hrtimer trigger is being
removed through configfs, or the other way around, hits this because the
two paths do not share a lock.
Free the ID after device_del(), as the error path of
iio_trigger_register() already does, and drop the "Possible issue in
here" comment.
Fixes: 1637db44413e ("Staging: IIO: Trigger support added to core.")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/industrialio-trigger.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -106,9 +106,8 @@ void iio_trigger_unregister(struct iio_t
list_del(&trig_info->list);
mutex_unlock(&iio_trigger_list_lock);
- ida_free(&iio_trigger_ida, trig_info->id);
- /* Possible issue in here */
device_del(&trig_info->dev);
+ ida_free(&iio_trigger_ida, trig_info->id);
}
EXPORT_SYMBOL(iio_trigger_unregister);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0642/1059] iio: trigger: Return an error when the trigger has no free irq
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (640 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0641/1059] iio: trigger: free the trigger ID after device_del() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0643/1059] fou: reserve headroom before pushing the encap header Greg Kroah-Hartman
` (356 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Joshua Crofts,
Jonathan Cameron
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
commit dff701806ab6252f6a0fccba880c47cd09602625 upstream.
iio_trigger_attach_poll_func() prints an error when all
CONFIG_IIO_CONSUMERS_PER_TRIGGER irqs of the trigger are in use, but
returns 0. The buffer of the extra consumer is enabled without a poll
function.
Disabling that buffer calls clear_bit() with a negative bit number and
drops a module reference for the second time. On arm and arm64 the
clear_bit() goes about 512 MB past the pool bitmap. That is an oops if
the address is not mapped, and a bit cleared in unrelated memory if it
is.
Return the error from iio_trigger_get_irq().
Fixes: 995438233579 ("iio: Fix error handling in iio_trigger_attach_poll_func")
Cc: stable@vger.kernel.org
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/industrialio-trigger.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -286,6 +286,7 @@ int iio_trigger_attach_poll_func(struct
if (pf->irq < 0) {
pr_err("Could not find an available irq for trigger %s, CONFIG_IIO_CONSUMERS_PER_TRIGGER=%d limit might be exceeded\n",
trig->name, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
+ ret = pf->irq;
goto out_put_module;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0643/1059] fou: reserve headroom before pushing the encap header
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (641 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0642/1059] iio: trigger: Return an error when the trigger has no free irq Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0644/1059] sctp: fix skb_over_panic when adding addresses with a pending delete of another family Greg Kroah-Hartman
` (355 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengfeng Ye,
Theodor Arsenij Larionov Trichkine, Ido Schimmel, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
commit bcb42672751a8786dce871a35bde363b041cb2f7 upstream.
ip_tunnel_xmit() and ip_md_tunnel_xmit() push the encap header before
reserving headroom. A packet redirected into the tunnel (tc mirred, nft
fwd/dup) keeps the headroom of its original device, so fou_build_udp()
panics:
kernel BUG at net/core/skbuff.c:214!
Call Trace:
skb_push+0xcc/0xf0
fou_build_udp+0x2f/0x380
gue_build_header+0xfa/0x150
ip_tunnel_xmit+0x87f/0x21c0
With a mirred mirror, the push overwrites the original packet instead.
Reachable with CAP_NET_ADMIN in a user namespace.
Reserve the headroom in fou_build_header() and gue_build_header(); GUE
sizes and builds the header from one copy of the encap fields. The skb
head may move, so reload inner_iph after ip_tunnel_encap() and read
tnl_params, which points into the head for GRE with header_ops, before
the call. sit's ipip6_tunnel_xmit() holds no head pointer across it.
Fixes: 56328486539d ("net: Changes to ip_tunnel to support foo-over-udp encapsulation")
Fixes: ac931d4cdec3 ("ipip,ip_tunnel,sit: Add FOU support for externally controlled ipip devices")
Reported-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Closes: https://lore.kernel.org/netdev/20260801060115.3538849-1-nicoyip.dev@gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261116113845.166280-1-theodorlarionov@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/fou_core.c | 19 +++++++++++++++----
net/ipv4/ip_tunnel.c | 6 ++++--
2 files changed, 19 insertions(+), 6 deletions(-)
--- a/net/ipv4/fou_core.c
+++ b/net/ipv4/fou_core.c
@@ -1078,6 +1078,9 @@ static int fou_build_header(struct sk_bu
__be16 sport;
int err;
+ if (skb_cow_head(skb, fou_encap_hlen(e)))
+ return -ENOMEM;
+
err = __fou_build_header(skb, e, protocol, &sport, type);
if (err)
return err;
@@ -1090,16 +1093,24 @@ static int fou_build_header(struct sk_bu
static int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
u8 *protocol, struct flowi4 *fl4)
{
- int type = e->flags & TUNNEL_ENCAP_FLAG_CSUM ? SKB_GSO_UDP_TUNNEL_CSUM :
- SKB_GSO_UDP_TUNNEL;
+ struct ip_tunnel_encap encap = {
+ .flags = READ_ONCE(e->flags),
+ .sport = READ_ONCE(e->sport),
+ .dport = READ_ONCE(e->dport),
+ };
+ int type = encap.flags & TUNNEL_ENCAP_FLAG_CSUM ?
+ SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
__be16 sport;
int err;
- err = __gue_build_header(skb, e, protocol, &sport, type);
+ if (skb_cow_head(skb, gue_encap_hlen(&encap)))
+ return -ENOMEM;
+
+ err = __gue_build_header(skb, &encap, protocol, &sport, type);
if (err)
return err;
- fou_build_udp(skb, e, fl4, protocol, sport);
+ fou_build_udp(skb, &encap, fl4, protocol, sport);
return 0;
}
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -603,6 +603,7 @@ void ip_md_tunnel_xmit(struct sk_buff *s
if (ip_tunnel_encap(skb, &tun_info->encap, &proto, &fl4) < 0)
goto tx_error;
+ inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
use_cache = ip_tunnel_dst_cache_usable(skb, tun_info);
if (use_cache)
@@ -745,6 +746,8 @@ void ip_tunnel_xmit(struct sk_buff *skb,
}
tos = tnl_params->tos;
+ df = tnl_params->frag_off;
+ ttl = tnl_params->ttl;
if (tos & 0x1) {
tos &= ~0x1;
if (payload_protocol == htons(ETH_P_IP)) {
@@ -763,6 +766,7 @@ void ip_tunnel_xmit(struct sk_buff *skb,
if (ip_tunnel_encap(skb, &tunnel->encap, &protocol, &fl4) < 0)
goto tx_error;
+ inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
if (connected && md) {
use_cache = ip_tunnel_dst_cache_usable(skb, tun_info);
@@ -795,7 +799,6 @@ void ip_tunnel_xmit(struct sk_buff *skb,
goto tx_error;
}
- df = tnl_params->frag_off;
if (payload_protocol == htons(ETH_P_IP) && !tunnel->ignore_df)
df |= (inner_iph->frag_off & htons(IP_DF));
@@ -815,7 +818,6 @@ void ip_tunnel_xmit(struct sk_buff *skb,
}
tos = ip_tunnel_ecn_encap(tos, inner_iph, skb);
- ttl = tnl_params->ttl;
if (ttl == 0) {
if (payload_protocol == htons(ETH_P_IP))
ttl = inner_iph->ttl;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0644/1059] sctp: fix skb_over_panic when adding addresses with a pending delete of another family
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (642 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0643/1059] fou: reserve headroom before pushing the encap header Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0645/1059] nvme: fix deadlock on nvme_subsystems_lock in nvme_init_subsystem() Greg Kroah-Hartman
` (354 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Henry Martin, Xin Long,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <bsdhenrymartin@gmail.com>
commit ce09d8c13a15fe881d0a04c91979dcdf45ed9543 upstream.
sctp_make_asconf_update_ip() accounts for a pending DEL_IP
parameter by reusing the length of the address being added. The
write-back side instead serializes the pending address itself,
with its own address family. If the pending delete is IPv6
(20-byte parameter) while the added addresses are IPv4 (8-byte),
the chunk is allocated 12 bytes short and sctp_addto_chunk()
writes past the end of the skb. E.g. on mainline (05441d697f7f):
skbuff: skb_over_panic: text:ffffffff84859c77 len:392 put:20
tail:0x188 end:0x180 dev:<NULL>
kernel BUG at net/core/skbuff.c:215!
CPU: 0 UID: 1000 PID: 379 Comm: poc_sctp
Call Trace:
skb_panic
skb_put
sctp_addto_chunk
sctp_make_asconf_update_ip
sctp_send_asconf_add_ip
sctp_setsockopt_bindx
__x64_sys_setsockopt
Requires addip enabled on the endpoint (net.sctp.addip_enable=1).
Account for the pending delete with its own address family, as the
write-back side already does.
This issue was discovered by an LLM code scanner.
Cc: stable@vger.kernel.org
Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261111082313.1606366-1-bsdhenrymartin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/sm_make_chunk.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2906,7 +2906,6 @@ struct sctp_chunk *sctp_make_asconf_upda
int addr_param_len = 0;
union sctp_addr *addr;
int totallen = 0, i;
- int del_pickup = 0;
struct sctp_af *af;
void *addr_buf;
@@ -2921,16 +2920,21 @@ struct sctp_chunk *sctp_make_asconf_upda
totallen += addr_param_len;
addr_buf += af->sockaddr_len;
- if (asoc->asconf_addr_del_pending && !del_pickup) {
- /* reuse the parameter length from the same scope one */
- totallen += paramlen;
- totallen += addr_param_len;
- del_pickup = 1;
-
- pr_debug("%s: picked same-scope del_pending addr, "
- "totallen for all addresses is %d\n",
- __func__, totallen);
- }
+ }
+
+ if (asoc->asconf_addr_del_pending) {
+ /* The DEL_IP parameter is serialized from the pending address
+ * itself below; account for its own address family, which may
+ * differ from the added ones.
+ */
+ addr = asoc->asconf_addr_del_pending;
+ af = sctp_get_af_specific(addr->v4.sin_family);
+ totallen += paramlen;
+ totallen += af->to_addr_param(addr, &addr_param);
+
+ pr_debug("%s: picked del_pending addr, "
+ "totallen for all addresses is %d\n",
+ __func__, totallen);
}
/* Create an asconf chunk with the required length. */
@@ -2953,7 +2957,7 @@ struct sctp_chunk *sctp_make_asconf_upda
addr_buf += af->sockaddr_len;
}
- if (flags == SCTP_PARAM_ADD_IP && del_pickup) {
+ if (flags == SCTP_PARAM_ADD_IP && asoc->asconf_addr_del_pending) {
addr = asoc->asconf_addr_del_pending;
af = sctp_get_af_specific(addr->v4.sin_family);
addr_param_len = af->to_addr_param(addr, &addr_param);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0645/1059] nvme: fix deadlock on nvme_subsystems_lock in nvme_init_subsystem()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (643 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0644/1059] sctp: fix skb_over_panic when adding addresses with a pending delete of another family Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0646/1059] tcp: fix NULL pointer dereference when restarting a Fast Open listener Greg Kroah-Hartman
` (353 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mani Tofigh, Christoph Hellwig,
Keith Busch
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mani Tofigh <mt4022@columbia.edu>
commit ba1213be15c613a1c03db69ea6480ca140a6ca00 upstream.
Connecting a controller to a new subsystem deadlocks when
sysfs_create_link() fails in nvme_init_subsystem(), e.g., on an
allocation failure. The error path drops the last subsystem reference
with nvme_subsystems_lock held and nvme_destroy_subsystem() takes the
same lock again:
nvme nvme0: failed to create sysfs link from subsystem.
============================================
WARNING: possible recursive locking detected
...
nvmesubsys/95 is trying to acquire lock:
(nvme_subsystems_lock){+.+.}-{4:4}, at: nvme_destroy_subsystem+0x1b/0x1e0
but task is already holding lock:
(nvme_subsystems_lock){+.+.}-{4:4}, at: nvme_init_identify+0x81e/0x34b0
...
Call Trace:
__mutex_lock+0x1a2/0x26e0
nvme_destroy_subsystem+0x1b/0x1e0
nvme_init_identify.cold+0x3bc/0x56f
nvme_init_ctrl_finish+0x1bc/0x7a0
nvme_loop_configure_admin_queue+0x205/0x2b0
nvme_loop_create_ctrl+0x480/0xd10
nvmf_dev_write+0x365/0x650
vfs_write+0x1e3/0x1250
ksys_write+0xfa/0x200
do_syscall_64+0xfb/0x590
entry_SYSCALL_64_after_hwframe+0x77/0x7f
...
INFO: task nvmesubsys:95 blocked for more than 20 seconds.
INFO: task nvmesubsys:95 is blocked on a mutex likely owned by task nvmesubsys:95.
Every later controller setup or removal then waits for the lock too.
The nvme_validate_cntlid() error path for an existing subsystem does the
same put, and deadlocks the same way if the other references go away in
between.
Drop the lock before the put. For a new subsystem, take it off the list
first so another controller can't find it in between. With the fix,
the connect fails and the next connect works.
This bug was identified and confirmed with the help of a deterministic
hypervisor currently under development. The C reproducer below however
hits it within about 30s.
Fixes: 32fd90c40768 ("nvme: change locking for the per-subsystem controller list")
Cc: stable@vger.kernel.org
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvme/host/core.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3088,7 +3088,11 @@ static int nvme_init_subsystem(struct nv
return 0;
out_put_subsystem:
+ if (!found)
+ list_del_init(&subsys->entry);
+ mutex_unlock(&nvme_subsystems_lock);
nvme_put_subsystem(subsys);
+ return ret;
out_unlock:
mutex_unlock(&nvme_subsystems_lock);
return ret;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0646/1059] tcp: fix NULL pointer dereference when restarting a Fast Open listener
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (644 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0645/1059] nvme: fix deadlock on nvme_subsystems_lock in nvme_init_subsystem() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0647/1059] powerpc/watchdog: disable watchdog when watchdog_thresh=0 Greg Kroah-Hartman
` (352 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyunwoo Kim, Kuniyuki Iwashima,
Eric Dumazet, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <imv4bel@gmail.com>
commit aa40afa831ebfe45e40a23721711059f2ac584d4 upstream.
When a valid RST is received for a Fast Open child accepted before the
three-way handshake completes, reqsk_fastopen_remove() adds the
request_sock to the listener's RST list if the listener is in TCP_LISTEN.
An application can call shutdown(SHUT_RD) on a listener socket.
inet_csk_listen_stop() checks rskq_rst_head without holding
fastopenq.lock. If rskq_rst_head is NULL, it does not acquire the lock
and therefore does not synchronize with an insertion by
reqsk_fastopen_remove() after that function has passed the TCP_LISTEN
check.
The more likely outcome of this race, even without a subsequent
listen(), is a leak. If reqsk_fastopen_remove() inserts a request_sock
after inet_csk_listen_stop() observes an empty list and returns, the
request_sock is stranded in rskq_rst_head and keeps a reference on the
listener. The socket is already in TCP_CLOSE, so a subsequent close()
does not call inet_csk_listen_stop() again.
If listen() is called again on the same socket before the delayed list
insertion, the insertion can overlap the queue initialization in
reqsk_queue_alloc(). If it occurs after rskq_rst_head is set to NULL but
before rskq_rst_tail is set to NULL, rskq_rst_head points to the
request_sock while rskq_rst_tail is NULL.
When a valid RST is later received for another accepted Fast Open child,
rskq_rst_head is not NULL, so reqsk_fastopen_remove() attempts to write
the request_sock pointer to rskq_rst_tail->dl_next while rskq_rst_tail is
NULL. KASAN reports:
BUG: KASAN: null-ptr-deref in reqsk_fastopen_remove+0x147/0x210
Write of size 8 at addr 0000000000000088 by task swapper/3/0
...
Call Trace:
<IRQ>
...
reqsk_fastopen_remove+0x147/0x210
tcp_check_req+0xa70/0x1060
...
tcp_rcv_state_process+0x1cb/0x2ae0
...
tcp_v4_do_rcv+0x1fe/0x740
tcp_v4_rcv+0x1744/0x2070
...
ip_protocol_deliver_rcu+0x5c/0x280
ip_local_deliver_finish+0x171/0x330
ip_local_deliver+0x107/0x370
...
</IRQ>
To widen the race window, the issue was reproduced after adding
mdelay(3000) immediately after reqsk_fastopen_remove() checks that the
listener is in TCP_LISTEN and immediately after reqsk_queue_alloc() sets
rskq_rst_head to NULL.
Make inet_csk_listen_stop() acquire fastopenq.lock regardless of the
value of rskq_rst_head and detach the list while holding the lock. With
this synchronization, reqsk_fastopen_remove() either inserts the
request_sock before inet_csk_listen_stop() acquires the lock, in which
case inet_csk_listen_stop() reclaims it, or sees that the listener is
not in TCP_LISTEN and does not insert anything.
Fixes: 0536fcc039a8 ("tcp: prepare fastopen code for upcoming listener changes")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/avMkfJrXhCFXn8M_@v4bel
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/inet_connection_sock.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1488,17 +1488,15 @@ skip_child_forget:
cond_resched();
}
- if (queue->fastopenq.rskq_rst_head) {
- /* Free all the reqs queued in rskq_rst_head. */
- spin_lock_bh(&queue->fastopenq.lock);
- req = queue->fastopenq.rskq_rst_head;
- queue->fastopenq.rskq_rst_head = NULL;
- spin_unlock_bh(&queue->fastopenq.lock);
- while (req != NULL) {
- next = req->dl_next;
- reqsk_put(req);
- req = next;
- }
+ /* Free all the reqs queued in rskq_rst_head. */
+ spin_lock_bh(&queue->fastopenq.lock);
+ req = queue->fastopenq.rskq_rst_head;
+ queue->fastopenq.rskq_rst_head = NULL;
+ spin_unlock_bh(&queue->fastopenq.lock);
+ while (req != NULL) {
+ next = req->dl_next;
+ reqsk_put(req);
+ req = next;
}
WARN_ON_ONCE(sk->sk_ack_backlog);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0647/1059] powerpc/watchdog: disable watchdog when watchdog_thresh=0
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (645 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0646/1059] tcp: fix NULL pointer dereference when restarting a Fast Open listener Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.1 0648/1059] perf/x86/amd/uncore: Avoid PMU registration if counters are unavailable Greg Kroah-Hartman
` (351 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Luiz Capitulino (Red Hat),
Michael Ellerman, Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Capitulino (Red Hat) <luiz.capitulino@linux.dev>
commit d513ec3c907b067d4a32b14ec6f73c3e041cb136 upstream.
On powerpc, trying to disable the hardlockup detector with:
# echo 0 > /proc/sys/kernel/watchdog_thresh
causes an immediate and endless hardlockup detection, eventually leading
to an unusable system (splat example below). This happens because
watchdog_calc_timeouts() sets wd_timer_period_ms, wd_panic_timeout_tb
and wd_smp_panic_timeout_tb to zero, but start_watchdog() still starts
the timer (with expiry=0) in this code path:
proc_watchdog_thresh()
proc_watchdog_update()
__lockup_detector_reconfigure()
watchdog_hardlockup_start()
start_watchdog_on_cpu()
start_watchdog()
hrtimer_start() /* wd_timer_period_ms=0 */
However, according to Documentation/admin-guide/sysctl/kernel.rst,
setting watchdog_thresh=0 should disable both the soft and hard lockup
detectors.
This condition is already checked in __lockup_detector_reconfigure() for
the soft lockup detector and the arch-independent hardlockup detector,
what's missing is powerpc performing the same check in start_watchdog().
[ 278.110085] watchdog: CPU 0 detected hard LOCKUP on other CPUs 1
[ 278.110086] watchdog: CPU 1 became unstuck TB:33050716089564575
[ 278.110097] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Kdump: loaded Tainted: G E 7.4.0-rc1 #1 PREEMPT(full)
[ 278.110103] watchdog: CPU 0 TB:33050716089564185, last SMP heartbeat TB:33050716089563885 (0ms ago)
[ 278.110109] Tainted: [E]=UNSIGNED_MODULE
[ 278.110126] Hardware name: IBM,8375-42A POWER9 (architected) 0x4e0202 0xf000005 of:IBM,FW940.00 (VL940_027) hv:phyp pSeries
[ 278.110136] NIP: c0000000001bd518 LR: c0000000014dedf8 CTR: 0000000000000000
[ 278.110145] REGS: c000000004b17a80 TRAP: 0900 Tainted: G E (7.4.0-rc1)
[ 278.110155] MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 22000224 XER: 20040004
[ 278.110189] CFAR: 0000000000000000 IRQMASK: 0
GPR00: 0000000000000000 c000000004b17d20 c000000001c38100 0000000000000000
GPR04: 000000000000ffff 0000000000000000 0000000000000000 0000000000000000
GPR08: 0000000000000000 0000000000000080 0000000000000080 ffffffffffffffff
GPR12: 0000000000000000 c000000017fff300 0000000000000000 000000002ef3d820
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000001
GPR24: 0000000000000001 00000040c0a6075e 0000000000000000 0000000000000001
GPR28: c0000001fdb5b140 0000000000000001 c000000002291968 c000000002291970
[ 278.110306] NIP [c0000000001bd518] plpar_hcall_norets_notrace+0x18/0x2c
[ 278.110319] LR [c0000000014dedf8] check_and_cede_processor+0x48/0x60
[ 278.110333] Call Trace:
[ 278.110338] [c000000004b17d20] [c000000004b17dd0] 0xc000000004b17dd0 (unreliable)
[ 278.110354] [c000000004b17d80] [c0000000014df020] shared_cede_loop+0x70/0x170
[ 278.110367] [c000000004b17dc0] [c0000000014de460] cpuidle_enter_state+0x2f0/0x748
[ 278.110381] [c000000004b17e70] [c000000000fe43b8] cpuidle_enter+0x48/0x70
[ 278.110397] [c000000004b17eb0] [c0000000002cdcf8] call_cpuidle+0x48/0x90
[ 278.110409] [c000000004b17ed0] [c0000000002d6300] cpuidle_idle_call+0x160/0x2d0
[ 278.110422] [c000000004b17f20] [c0000000002d6578] do_idle+0x108/0x1f0
[ 278.110434] [c000000004b17f60] [c0000000002d6938] cpu_startup_entry+0x48/0x50
[ 278.110446] [c000000004b17f90] [c0000000000615c0] start_secondary+0x290/0x2a0
[ 278.110459] [c000000004b17fe0] [c00000000000e258] start_secondary_prolog+0x10/0x14
Fixes: 2104180a5369 ("powerpc/64s: implement arch-specific hardlockup watchdog")
Cc: stable@vger.kernel.org
Signed-off-by: Luiz Capitulino (Red Hat) <luiz.capitulino@linux.dev>
Reviewed-by: Michael Ellerman <mpe@kernel.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261104034018.2676750-1-luiz.capitulino@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/watchdog.c | 3 +++
1 file changed, 3 insertions(+)
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -482,6 +482,9 @@ static void start_watchdog(void *arg)
if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
return;
+ if (!watchdog_thresh)
+ return;
+
if (!cpumask_test_cpu(cpu, &watchdog_cpumask))
return;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0648/1059] perf/x86/amd/uncore: Avoid PMU registration if counters are unavailable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (646 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0647/1059] powerpc/watchdog: disable watchdog when watchdog_thresh=0 Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0649/1059] fs/stat.c: avoid harmless garbage value problem in vfs_statx_path() Greg Kroah-Hartman
` (350 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sandipan Das, Peter Zijlstra (Intel)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <sandipan.das@amd.com>
commit f997e208b6c96858a2f6c0855debfbdb9b52f131 upstream.
X86_FEATURE_PERFCTR_NB and X86_FEATURE_PERFCTR_LLC are derived from
CPUID leaf 0x80000001 ECX bits 24 and 28 respectively and denote the
availability of DF and L3 counters. When these bits are not set, the
corresponding PMUs have no counters and hence, should not be registered.
Fixes: 07888daa056e ("perf/x86/amd/uncore: Move discovery and registration")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20240626074404.1044230-1-sandipan.das@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/events/amd/uncore.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -634,17 +634,20 @@ int amd_uncore_df_ctx_init(struct amd_un
{
struct attribute **df_attr = amd_uncore_df_format_attr;
struct amd_uncore_pmu *pmu;
+ int num_counters;
/* Run just once */
if (uncore->init_done)
return amd_uncore_ctx_init(uncore, cpu);
+ num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
+ if (!num_counters)
+ goto done;
+
/* No grouping, single instance for a system */
uncore->pmus = kzalloc(sizeof(*uncore->pmus), GFP_KERNEL);
- if (!uncore->pmus) {
- uncore->num_pmus = 0;
+ if (!uncore->pmus)
goto done;
- }
/*
* For Family 17h and above, the Northbridge counters are repurposed
@@ -654,7 +657,7 @@ int amd_uncore_df_ctx_init(struct amd_un
pmu = &uncore->pmus[0];
strscpy(pmu->name, boot_cpu_data.x86 >= 0x17 ? "amd_df" : "amd_nb",
sizeof(pmu->name));
- pmu->num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
+ pmu->num_counters = num_counters;
pmu->msr_base = MSR_F15H_NB_PERF_CTL;
pmu->rdpmc_base = RDPMC_BASE_NB;
@@ -763,17 +766,20 @@ int amd_uncore_l3_ctx_init(struct amd_un
{
struct attribute **l3_attr = amd_uncore_l3_format_attr;
struct amd_uncore_pmu *pmu;
+ int num_counters;
/* Run just once */
if (uncore->init_done)
return amd_uncore_ctx_init(uncore, cpu);
+ num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
+ if (!num_counters)
+ goto done;
+
/* No grouping, single instance for a system */
uncore->pmus = kzalloc(sizeof(*uncore->pmus), GFP_KERNEL);
- if (!uncore->pmus) {
- uncore->num_pmus = 0;
+ if (!uncore->pmus)
goto done;
- }
/*
* For Family 17h and above, L3 cache counters are available instead
@@ -783,7 +789,7 @@ int amd_uncore_l3_ctx_init(struct amd_un
pmu = &uncore->pmus[0];
strscpy(pmu->name, boot_cpu_data.x86 >= 0x17 ? "amd_l3" : "amd_l2",
sizeof(pmu->name));
- pmu->num_counters = amd_uncore_ctx_num_pmcs(uncore, cpu);
+ pmu->num_counters = num_counters;
pmu->msr_base = MSR_F16H_L2I_PERF_CTL;
pmu->rdpmc_base = RDPMC_BASE_LLC;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0649/1059] fs/stat.c: avoid harmless garbage value problem in vfs_statx_path()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (647 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.1 0648/1059] perf/x86/amd/uncore: Avoid PMU registration if counters are unavailable Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0650/1059] bootconfig: Trim unquoted values at end of file Greg Kroah-Hartman
` (349 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Su Hui, Christian Brauner,
Petr Vaganov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <suhui@nfschina.com>
commit 0fac3ed473dd2955053be6671cdd747807f5e488 upstream.
Clang static checker(scan-build) warning:
fs/stat.c:287:21: warning: The left expression of the compound assignment is
an uninitialized value. The computed value will also be garbage.
287 | stat->result_mask |= STATX_MNT_ID_UNIQUE;
| ~~~~~~~~~~~~~~~~~ ^
fs/stat.c:290:21: warning: The left expression of the compound assignment is
an uninitialized value. The computed value will also be garbage.
290 | stat->result_mask |= STATX_MNT_ID;
When vfs_getattr() failed because of security_inode_getattr(), 'stat' is
uninitialized. In this case, there is a harmless garbage problem in
vfs_statx_path(). It's better to return error directly when
vfs_getattr() failed, avoiding garbage value and more clearly.
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20250119025946.1168957-1-suhui@nfschina.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
[ Petr: There is no vfs_statx_path() in this tree. The fix is applied
directly in vfs_statx() by jumping to path_put() via a new out_path
label, preserving the reference drop and the ESTALE retry. ]
Fixes: fa2fcf4f1df1 ("statx: add mount ID")
Signed-off-by: Petr Vaganov <petrvaganoff@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/stat.c | 3 +++
1 file changed, 3 insertions(+)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -235,6 +235,8 @@ retry:
goto out;
error = vfs_getattr(&path, stat, request_mask, flags);
+ if (error)
+ goto out_path;
stat->mnt_id = real_mount(path.mnt)->mnt_id;
stat->result_mask |= STATX_MNT_ID;
@@ -251,6 +253,7 @@ retry:
bdev_statx_dioalign(inode, stat);
}
+out_path:
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0650/1059] bootconfig: Trim unquoted values at end of file
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (648 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0649/1059] fs/stat.c: avoid harmless garbage value problem in vfs_statx_path() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0651/1059] Bluetooth: L2CAP: Fix corrupted list in hci_chan_del Greg Kroah-Hartman
` (348 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eduardo Mucelli Rezende Oliveira,
Masami Hiramatsu (Google)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
commit 381b391bfaa3f10d52da4740529804b0b6b8160d upstream.
__xbc_parse_value() trims an unquoted value when it encounters a
delimiter, but leaves trailing whitespace intact when it reaches the end
of the input. Thus "key = value " has a different value depending on
whether the file ends with a newline. The extra whitespace also reaches
the rendered kernel command line.
Trim unquoted values after the scan finishes, including at end of input.
Skip trimming after a closing quote so intentional whitespace in quoted
values remains unchanged. Add checks for scalars, arrays and quoted
values without a final newline.
Link: https://lore.kernel.org/all/31f248f330e716b925add3a0ba76f62826527312.1794337724.git.edumucelli@gmail.com/
Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support")
Cc: stable@vger.kernel.org
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/bootconfig.c | 5 +++--
tools/bootconfig/test-bootconfig.sh | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -654,16 +654,17 @@ static int __init __xbc_parse_value(char
return xbc_parse_error("No value delimiter", p);
if (*p)
p++;
- break;
+ goto skip_trim;
}
if (strchr(",;\n#}", c)) {
*p++ = '\0';
- v = strim(v);
break;
}
}
if (quotes)
return xbc_parse_error("No closing quotes", p);
+ v = strim(v);
+skip_trim:
if (c == '#') {
p = skip_comment(p);
c = '\n'; /* A comment must be treated as a newline */
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -170,6 +170,24 @@ $BOOTCONF $INITRD > $OUTFILE
xfail grep -q val[[:space:]] $OUTFILE
xpass grep -q val2[[:space:]] $OUTFILE
+echo "Remove unquoted trailing whitespace at end of file"
+printf 'foo = val \t' > $TEMPCONF
+$BOOTCONF -l $TEMPCONF > $OUTFILE
+printf 'foo = "val"\n' > $TEMPCONF
+xpass cmp $TEMPCONF $OUTFILE
+
+echo "Remove trailing whitespace from the last array value at end of file"
+printf 'foo = first, last \t' > $TEMPCONF
+$BOOTCONF -l $TEMPCONF > $OUTFILE
+printf 'foo = "first", "last"\n' > $TEMPCONF
+xpass cmp $TEMPCONF $OUTFILE
+
+echo "Keep quoted trailing whitespace at end of file"
+printf 'foo = "val "' > $TEMPCONF
+$BOOTCONF -l $TEMPCONF > $OUTFILE
+printf 'foo = "val "\n' > $TEMPCONF
+xpass cmp $TEMPCONF $OUTFILE
+
echo "=== expected failure cases ==="
for i in samples/bad-* ; do
xfail $BOOTCONF -a $i $INITRD
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0651/1059] Bluetooth: L2CAP: Fix corrupted list in hci_chan_del
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (649 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0650/1059] bootconfig: Trim unquoted values at end of file Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0652/1059] Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user Greg Kroah-Hartman
` (347 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+10bd8fe6741eedd2be2e,
Luiz Augusto von Dentz, Dan Carpenter, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit ab4eedb790cae44313759b50fe47da285e2519d5 ]
This fixes the following trace by reworking the locking of l2cap_conn
so instead of only locking when changing the chan_l list this promotes
chan_lock to a general lock of l2cap_conn so whenever it is being held
it would prevents the likes of l2cap_conn_del to run:
list_del corruption, ffff888021297e00->prev is LIST_POISON2 (dead000000000122)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:61!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 UID: 0 PID: 5896 Comm: syz-executor213 Not tainted 6.14.0-rc1-next-20250204-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
RIP: 0010:__list_del_entry_valid_or_report+0x12c/0x190 lib/list_debug.c:59
Code: 8c 4c 89 fe 48 89 da e8 32 8c 37 fc 90 0f 0b 48 89 df e8 27 9f 14 fd 48 c7 c7 a0 c0 60 8c 4c 89 fe 48 89 da e8 15 8c 37 fc 90 <0f> 0b 4c 89 e7 e8 0a 9f 14 fd 42 80 3c 2b 00 74 08 4c 89 e7 e8 cb
RSP: 0018:ffffc90003f6f998 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 01454d423f7fbf00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff819f077c R09: 1ffff920007eded0
R10: dffffc0000000000 R11: fffff520007eded1 R12: dead000000000122
R13: dffffc0000000000 R14: ffff8880352248d8 R15: ffff888021297e00
FS: 00007f7ace6686c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7aceeeb1d0 CR3: 000000003527c000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__list_del_entry_valid include/linux/list.h:124 [inline]
__list_del_entry include/linux/list.h:215 [inline]
list_del_rcu include/linux/rculist.h:168 [inline]
hci_chan_del+0x70/0x1b0 net/bluetooth/hci_conn.c:2858
l2cap_conn_free net/bluetooth/l2cap_core.c:1816 [inline]
kref_put include/linux/kref.h:65 [inline]
l2cap_conn_put+0x70/0xe0 net/bluetooth/l2cap_core.c:1830
l2cap_sock_shutdown+0xa8a/0x1020 net/bluetooth/l2cap_sock.c:1377
l2cap_sock_release+0x79/0x1d0 net/bluetooth/l2cap_sock.c:1416
__sock_release net/socket.c:642 [inline]
sock_close+0xbc/0x240 net/socket.c:1393
__fput+0x3e9/0x9f0 fs/file_table.c:448
task_work_run+0x24f/0x310 kernel/task_work.c:227
ptrace_notify+0x2d2/0x380 kernel/signal.c:2522
ptrace_report_syscall include/linux/ptrace.h:415 [inline]
ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
syscall_exit_work+0xc7/0x1d0 kernel/entry/common.c:173
syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
syscall_exit_to_user_mode+0x24a/0x340 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7aceeaf449
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7ace668218 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: fffffffffffffffc RBX: 00007f7acef39328 RCX: 00007f7aceeaf449
RDX: 000000000000000e RSI: 0000000020000100 RDI: 0000000000000004
RBP: 00007f7acef39320 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 0000000000000004 R14: 00007f7ace668670 R15: 000000000000000b
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_del_entry_valid_or_report+0x12c/0x190 lib/list_debug.c:59
Code: 8c 4c 89 fe 48 89 da e8 32 8c 37 fc 90 0f 0b 48 89 df e8 27 9f 14 fd 48 c7 c7 a0 c0 60 8c 4c 89 fe 48 89 da e8 15 8c 37 fc 90 <0f> 0b 4c 89 e7 e8 0a 9f 14 fd 42 80 3c 2b 00 74 08 4c 89 e7 e8 cb
RSP: 0018:ffffc90003f6f998 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 01454d423f7fbf00
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff819f077c R09: 1ffff920007eded0
R10: dffffc0000000000 R11: fffff520007eded1 R12: dead000000000122
R13: dffffc0000000000 R14: ffff8880352248d8 R15: ffff888021297e00
FS: 00007f7ace6686c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7acef05b08 CR3: 000000003527c000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Reported-by: syzbot+10bd8fe6741eedd2be2e@syzkaller.appspotmail.com
Tested-by: syzbot+10bd8fe6741eedd2be2e@syzkaller.appspotmail.com
Fixes: b4f82f9ed43a ("Bluetooth: L2CAP: Fix slab-use-after-free Read in l2cap_send_cmd")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
[ sashal: adapted context for existing local changes (non-static l2cap_conn_hold_unless_zero, chan_lock rename, earlier backports), dropping hunks the tree already has. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 134 ++++++++++++----------------------
net/bluetooth/l2cap_sock.c | 15 ++--
3 files changed, 55 insertions(+), 96 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b15ab4ead3bc3..9ba36d4a06cb7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -666,7 +666,7 @@ struct l2cap_conn {
struct l2cap_chan *smp;
struct list_head chan_l;
- struct mutex chan_lock;
+ struct mutex lock;
struct kref ref;
struct list_head users;
};
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c6231c630ad50..bd6e9de10d76b 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -119,7 +119,6 @@ static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn,
{
struct l2cap_chan *c;
- mutex_lock(&conn->chan_lock);
c = __l2cap_get_chan_by_scid(conn, cid);
if (c) {
/* Only lock if chan reference is not 0 */
@@ -127,7 +126,6 @@ static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn,
if (c)
l2cap_chan_lock(c);
}
- mutex_unlock(&conn->chan_lock);
return c;
}
@@ -140,7 +138,6 @@ static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
{
struct l2cap_chan *c;
- mutex_lock(&conn->chan_lock);
c = __l2cap_get_chan_by_dcid(conn, cid);
if (c) {
/* Only lock if chan reference is not 0 */
@@ -148,7 +145,6 @@ static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
if (c)
l2cap_chan_lock(c);
}
- mutex_unlock(&conn->chan_lock);
return c;
}
@@ -446,7 +442,7 @@ static void l2cap_chan_timeout(struct work_struct *work)
return;
}
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
/* __set_chan_timer() calls l2cap_chan_hold(chan) while scheduling
* this work. No need to call l2cap_chan_hold(chan) here again.
*/
@@ -470,7 +466,7 @@ static void l2cap_chan_timeout(struct work_struct *work)
unlock:
l2cap_chan_unlock(chan);
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
l2cap_chan_put(chan);
}
@@ -710,11 +706,11 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
{
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
l2cap_chan_lock(chan);
__l2cap_chan_add(conn, chan);
l2cap_chan_unlock(chan);
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
}
void l2cap_chan_del(struct l2cap_chan *chan, int err)
@@ -798,9 +794,9 @@ void l2cap_chan_list(struct l2cap_conn *conn, l2cap_chan_func_t func,
if (!conn)
return;
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
__l2cap_chan_list(conn, func, data);
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
}
EXPORT_SYMBOL_GPL(l2cap_chan_list);
@@ -812,7 +808,7 @@ static void l2cap_conn_update_id_addr(struct work_struct *work)
struct hci_conn *hcon = conn->hcon;
struct l2cap_chan *chan;
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
list_for_each_entry(chan, &conn->chan_l, list) {
l2cap_chan_lock(chan);
@@ -821,7 +817,7 @@ static void l2cap_conn_update_id_addr(struct work_struct *work)
l2cap_chan_unlock(chan);
}
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
}
static void l2cap_chan_le_connect_reject(struct l2cap_chan *chan)
@@ -1593,8 +1589,6 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
BT_DBG("conn %p", conn);
- mutex_lock(&conn->chan_lock);
-
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
l2cap_chan_lock(chan);
@@ -1663,8 +1657,6 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
l2cap_chan_unlock(chan);
}
-
- mutex_unlock(&conn->chan_lock);
}
static void l2cap_le_conn_ready(struct l2cap_conn *conn)
@@ -1710,7 +1702,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
if (hcon->type == ACL_LINK)
l2cap_request_info(conn);
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
list_for_each_entry(chan, &conn->chan_l, list) {
@@ -1728,7 +1720,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
l2cap_chan_unlock(chan);
}
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
if (hcon->type == LE_LINK)
l2cap_le_conn_ready(conn);
@@ -1743,14 +1735,10 @@ static void l2cap_conn_unreliable(struct l2cap_conn *conn, int err)
BT_DBG("conn %p", conn);
- mutex_lock(&conn->chan_lock);
-
list_for_each_entry(chan, &conn->chan_l, list) {
if (test_bit(FLAG_FORCE_RELIABLE, &chan->flags))
l2cap_chan_set_err(chan, err);
}
-
- mutex_unlock(&conn->chan_lock);
}
static void l2cap_info_timeout(struct work_struct *work)
@@ -1761,7 +1749,9 @@ static void l2cap_info_timeout(struct work_struct *work)
conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
conn->info_ident = 0;
+ mutex_lock(&conn->lock);
l2cap_conn_start(conn);
+ mutex_unlock(&conn->lock);
}
/*
@@ -1858,6 +1848,8 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
cancel_work_sync(&conn->pending_rx_work);
+ mutex_lock(&conn->lock);
+
kfree_skb(conn->rx_skb);
skb_queue_purge(&conn->pending_rx);
@@ -1868,8 +1860,6 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
/* Force the connection to be immediately dropped */
hcon->disc_timeout = 0;
- mutex_lock(&conn->chan_lock);
-
/* Kill channels */
list_for_each_entry_safe(chan, l, &conn->chan_l, list) {
l2cap_chan_hold(chan);
@@ -1883,9 +1873,11 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
l2cap_chan_put(chan);
}
- mutex_unlock(&conn->chan_lock);
+ hci_chan_del(conn->hchan);
+ conn->hchan = NULL;
hcon->l2cap_data = NULL;
+ mutex_unlock(&conn->lock);
l2cap_conn_put(conn);
}
@@ -1893,7 +1885,6 @@ static void l2cap_conn_free(struct kref *ref)
{
struct l2cap_conn *conn = container_of(ref, struct l2cap_conn, ref);
- hci_chan_del(conn->hchan);
hci_conn_put(conn->hcon);
kfree(conn);
}
@@ -3007,8 +2998,6 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p", conn);
- mutex_lock(&conn->chan_lock);
-
list_for_each_entry(chan, &conn->chan_l, list) {
if (chan->chan_type != L2CAP_CHAN_RAW)
continue;
@@ -3023,8 +3012,6 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
if (chan->ops->recv(chan, nskb))
kfree_skb(nskb);
}
-
- mutex_unlock(&conn->chan_lock);
}
/* ---- L2CAP signalling commands ---- */
@@ -4156,7 +4143,6 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
goto response;
}
- mutex_lock(&conn->chan_lock);
l2cap_chan_lock(pchan);
/* Check if the ACL is secure enough (if not SDP) */
@@ -4262,7 +4248,6 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
}
l2cap_chan_unlock(pchan);
- mutex_unlock(&conn->chan_lock);
l2cap_chan_put(pchan);
}
@@ -4301,27 +4286,19 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
BT_DBG("dcid 0x%4.4x scid 0x%4.4x result 0x%2.2x status 0x%2.2x",
dcid, scid, result, status);
- mutex_lock(&conn->chan_lock);
-
if (scid) {
chan = __l2cap_get_chan_by_scid(conn, scid);
- if (!chan) {
- err = -EBADSLT;
- goto unlock;
- }
+ if (!chan)
+ return -EBADSLT;
} else {
chan = __l2cap_get_connect_chan_by_ident(conn, cmd->ident);
- if (!chan) {
- err = -EBADSLT;
- goto unlock;
- }
+ if (!chan)
+ return -EBADSLT;
}
chan = l2cap_chan_hold_unless_zero(chan);
- if (!chan) {
- err = -EBADSLT;
- goto unlock;
- }
+ if (!chan)
+ return -EBADSLT;
err = 0;
@@ -4367,9 +4344,6 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
-unlock:
- mutex_unlock(&conn->chan_lock);
-
return err;
}
@@ -4672,11 +4646,7 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn,
chan->ops->set_shutdown(chan);
- l2cap_chan_unlock(chan);
- mutex_lock(&conn->chan_lock);
- l2cap_chan_lock(chan);
l2cap_chan_del(chan, ECONNRESET);
- mutex_unlock(&conn->chan_lock);
chan->ops->close(chan);
@@ -4713,11 +4683,7 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn,
return 0;
}
- l2cap_chan_unlock(chan);
- mutex_lock(&conn->chan_lock);
- l2cap_chan_lock(chan);
l2cap_chan_del(chan, 0);
- mutex_unlock(&conn->chan_lock);
chan->ops->close(chan);
@@ -4917,13 +4883,9 @@ 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);
- mutex_lock(&conn->chan_lock);
-
chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
- if (!chan) {
- err = -EBADSLT;
- goto unlock;
- }
+ if (!chan)
+ return -EBADSLT;
chan = l2cap_chan_hold_unless_zero(chan);
if (!chan)
@@ -4976,9 +4938,6 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
-unlock:
- mutex_unlock(&conn->chan_lock);
-
return err;
}
@@ -5120,7 +5079,6 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
goto response;
}
- mutex_lock(&conn->chan_lock);
l2cap_chan_lock(pchan);
if (!smp_sufficient_security(conn->hcon, pchan->sec_level,
@@ -5197,7 +5155,6 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
response_unlock:
l2cap_chan_unlock(pchan);
- mutex_unlock(&conn->chan_lock);
l2cap_chan_put(pchan);
if (result == L2CAP_CR_PEND)
@@ -5342,7 +5299,6 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
goto response;
}
- mutex_lock(&conn->chan_lock);
l2cap_chan_lock(pchan);
if (!smp_sufficient_security(conn->hcon, pchan->sec_level,
@@ -5428,7 +5384,6 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
unlock:
l2cap_chan_unlock(pchan);
- mutex_unlock(&conn->chan_lock);
l2cap_chan_put(pchan);
response:
@@ -5465,8 +5420,6 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
BT_DBG("mtu %u mps %u credits %u result 0x%4.4x", mtu, mps, credits,
result);
- mutex_lock(&conn->chan_lock);
-
cmd_len -= sizeof(*rsp);
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
@@ -5574,8 +5527,6 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
l2cap_chan_put(chan);
}
- mutex_unlock(&conn->chan_lock);
-
return err;
}
@@ -5727,8 +5678,6 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
if (cmd_len < sizeof(*rej))
return -EPROTO;
- mutex_lock(&conn->chan_lock);
-
chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
if (!chan)
goto done;
@@ -5743,7 +5692,6 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
l2cap_chan_put(chan);
done:
- mutex_unlock(&conn->chan_lock);
return 0;
}
@@ -7283,8 +7231,12 @@ static void process_pending_rx(struct work_struct *work)
BT_DBG("");
+ mutex_lock(&conn->lock);
+
while ((skb = skb_dequeue(&conn->pending_rx)))
l2cap_recv_frame(conn, skb);
+
+ mutex_unlock(&conn->lock);
}
static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
@@ -7322,7 +7274,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP)))
conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR;
- mutex_init(&conn->chan_lock);
+ mutex_init(&conn->lock);
INIT_LIST_HEAD(&conn->chan_l);
INIT_LIST_HEAD(&conn->users);
@@ -7516,7 +7468,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
}
}
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
l2cap_chan_lock(chan);
if ((cid && __l2cap_get_chan_by_dcid(conn, cid)) || chan->conn ||
@@ -7558,7 +7510,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
chan_unlock:
l2cap_chan_unlock(chan);
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
done:
hci_dev_unlock(hdev);
hci_dev_put(hdev);
@@ -7772,7 +7724,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
BT_DBG("conn %p status 0x%2.2x encrypt %u", conn, status, encrypt);
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
list_for_each_entry(chan, &conn->chan_l, list) {
l2cap_chan_lock(chan);
@@ -7846,7 +7798,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
l2cap_chan_unlock(chan);
}
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
}
/* Append fragment into frame respecting the maximum len of rx_skb */
@@ -7915,6 +7867,9 @@ static void l2cap_recv_reset(struct l2cap_conn *conn)
struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
{
+ if (!c)
+ return NULL;
+
BT_DBG("conn %p orig refcnt %u", c, kref_read(&c->ref));
if (!kref_get_unless_zero(&c->ref))
@@ -7941,11 +7896,15 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
hci_dev_unlock(hcon->hdev);
- if (!conn)
- goto drop;
+ if (!conn) {
+ kfree_skb(skb);
+ return;
+ }
BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
+ mutex_lock(&conn->lock);
+
switch (flags) {
case ACL_START:
case ACL_START_NO_FLUSH:
@@ -7970,7 +7929,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
if (len == skb->len) {
/* Complete frame received */
l2cap_recv_frame(conn, skb);
- return;
+ goto unlock;
}
BT_DBG("Start: total len %d, frag len %u", len, skb->len);
@@ -8032,10 +7991,11 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
break;
}
- l2cap_conn_put(conn);
-
drop:
kfree_skb(skb);
+unlock:
+ mutex_unlock(&conn->lock);
+ l2cap_conn_put(conn);
}
static struct hci_cb l2cap_cb = {
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 180df4501461d..8a3c949d981c8 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1396,9 +1396,10 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
/* prevent sk structure from being freed whilst unlocked */
sock_hold(sk);
- chan = l2cap_pi(sk)->chan;
/* prevent chan structure from being freed whilst unlocked */
- l2cap_chan_hold(chan);
+ chan = l2cap_chan_hold_unless_zero(l2cap_pi(sk)->chan);
+ if (!chan)
+ goto shutdown_already;
BT_DBG("chan %p state %s", chan, state_to_string(chan->state));
@@ -1428,22 +1429,20 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
release_sock(sk);
l2cap_chan_lock(chan);
- conn = chan->conn;
- if (conn)
- /* prevent conn structure from being freed */
- l2cap_conn_get(conn);
+ /* prevent conn structure from being freed */
+ conn = l2cap_conn_hold_unless_zero(chan->conn);
l2cap_chan_unlock(chan);
if (conn)
/* mutex lock must be taken before l2cap_chan_lock() */
- mutex_lock(&conn->chan_lock);
+ mutex_lock(&conn->lock);
l2cap_chan_lock(chan);
l2cap_chan_close(chan, 0);
l2cap_chan_unlock(chan);
if (conn) {
- mutex_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->lock);
l2cap_conn_put(conn);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0652/1059] Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (650 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0651/1059] Bluetooth: L2CAP: Fix corrupted list in hci_chan_del Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0653/1059] Bluetooth: L2CAP: hold l2cap_conn::lock in l2cap_connect_cfm() Greg Kroah-Hartman
` (346 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+14b6d57fb728e27ce23c,
Shaurya Rane, Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
[ Upstream commit 752a6c9596dd25efd6978a73ff21f3b592668f4a ]
After commit ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in
hci_chan_del"), l2cap_conn_del() uses conn->lock to protect access to
conn->users. However, l2cap_register_user() and l2cap_unregister_user()
don't use conn->lock, creating a race condition where these functions can
access conn->users and conn->hchan concurrently with l2cap_conn_del().
This can lead to use-after-free and list corruption bugs, as reported
by syzbot.
Fix this by changing l2cap_register_user() and l2cap_unregister_user()
to use conn->lock instead of hci_dev_lock(), ensuring consistent locking
for the l2cap_conn structure.
Reported-by: syzbot+14b6d57fb728e27ce23c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=14b6d57fb728e27ce23c
Fixes: ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del")
Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
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 | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bd6e9de10d76b..127c50ffba9b3 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1769,17 +1769,15 @@ static void l2cap_info_timeout(struct work_struct *work)
int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user)
{
- struct hci_dev *hdev = conn->hcon->hdev;
int ret;
/* We need to check whether l2cap_conn is registered. If it is not, we
- * must not register the l2cap_user. l2cap_conn_del() is unregisters
- * l2cap_conn objects, but doesn't provide its own locking. Instead, it
- * relies on the parent hci_conn object to be locked. This itself relies
- * on the hci_dev object to be locked. So we must lock the hci device
- * here, too. */
+ * must not register the l2cap_user. l2cap_conn_del() unregisters
+ * l2cap_conn objects under conn->lock, and we use the same lock here
+ * to protect access to conn->users and conn->hchan.
+ */
- hci_dev_lock(hdev);
+ mutex_lock(&conn->lock);
if (!list_empty(&user->list)) {
ret = -EINVAL;
@@ -1800,16 +1798,14 @@ int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user)
ret = 0;
out_unlock:
- hci_dev_unlock(hdev);
+ mutex_unlock(&conn->lock);
return ret;
}
EXPORT_SYMBOL(l2cap_register_user);
void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user)
{
- struct hci_dev *hdev = conn->hcon->hdev;
-
- hci_dev_lock(hdev);
+ mutex_lock(&conn->lock);
if (list_empty(&user->list))
goto out_unlock;
@@ -1818,7 +1814,7 @@ void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user)
user->remove(conn, user);
out_unlock:
- hci_dev_unlock(hdev);
+ mutex_unlock(&conn->lock);
}
EXPORT_SYMBOL(l2cap_unregister_user);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0653/1059] Bluetooth: L2CAP: hold l2cap_conn::lock in l2cap_connect_cfm()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (651 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0652/1059] Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0654/1059] net: ipv6: keep room for the mac header in dst_dev_overhead() Greg Kroah-Hartman
` (345 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pauli Virtanen,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <pav@iki.fi>
[ Upstream commit 115e6a21c88a5f708b2b025f7567ab78a782a74f ]
l2cap_new_connection() -> __l2cap_chan_add() modifies
l2cap_conn::chan_l, which is guarded by l2cap_conn::lock. The lock is
not held in l2cap_connect_cfm().
Fix by holding conn->lock in l2cap_connect_cfm() to make the locking
systematic.
Fixes: ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
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 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 127c50ffba9b3..a9cfdae8ca935 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7645,6 +7645,8 @@ static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
* we left off, because the list lock would prevent calling the
* potentially sleeping l2cap_chan_lock() function.
*/
+ mutex_lock(&conn->lock);
+
pchan = l2cap_global_fixed_chan(NULL, hcon);
while (pchan) {
struct l2cap_chan *chan, *next;
@@ -7669,6 +7671,8 @@ static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
pchan = next;
}
+ mutex_unlock(&conn->lock);
+
l2cap_conn_ready(conn);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0654/1059] net: ipv6: keep room for the mac header in dst_dev_overhead()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (652 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0653/1059] Bluetooth: L2CAP: hold l2cap_conn::lock in l2cap_connect_cfm() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0655/1059] Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del() Greg Kroah-Hartman
` (344 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Mayer, Yuya Kusakabe,
Justin Iurman, Gabriel Goller, Eric Dumazet, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
[ Upstream commit 87cd6b717e4069dca34e0866e57eaeb44d3b173e ]
The seg6, ioam6 and rpl lwtunnels size their skb_cow_head() request as
the length they are about to push plus dst_dev_overhead(), then push the
new headers and rebuild the mac header below them with
skb_mac_header_rebuild(). That rebuild needs skb->mac_len of headroom,
but dst_dev_overhead() leaves LL_RESERVED_SPACE() of the egress device,
16 bytes for plain Ethernet.
Where the mac header is longer than that, as it is on ingress through a
VLAN device with reorder_hdr off, the rebuild runs out of room:
skb_set_mac_header(skb, -skb->mac_len) computes a negative offset,
stores it unchecked in the u16 skb->mac_header, and the memmove that
follows writes skb->mac_len bytes about 64 KB past skb->head.
Forwarding plain ping6 traffic through such a device reproduces it on
all five seg6 encapsulation modes and on the rpl and ioam6 inline paths;
skb->mac_header comes back as 65534 on a 704-byte head.
Return the larger of the two. The helper already returns skb->mac_len
when it has no dst, so this only makes the other branch agree, and it
covers every caller rather than each call site in turn.
Fixes: 40475b63761a ("net: ipv6: seg6_iptunnel: mitigate 2-realloc issue")
Fixes: dce525185bc9 ("net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue")
Fixes: 985ec6f5e623 ("net: ipv6: rpl_iptunnel: mitigate 2-realloc issue")
Suggested-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
Reviewed-by: Justin Iurman <justin.iurman@gmail.com>
Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/20260922-seg6-maclen-headroom-v3-1-7b2f982ef79d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/dst.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/dst.h b/include/net/dst.h
index 96dd65a941c51..9301d36d3af93 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -441,7 +441,8 @@ static inline unsigned int dst_dev_overhead(struct dst_entry *dst,
struct sk_buff *skb)
{
if (likely(dst))
- return LL_RESERVED_SPACE(dst->dev);
+ return max_t(unsigned int, skb->mac_len,
+ LL_RESERVED_SPACE(dst->dev));
return skb->mac_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0655/1059] Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (653 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0654/1059] net: ipv6: keep room for the mac header in dst_dev_overhead() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0656/1059] btrfs: fix xattr replace when multiple xattrs are packed in the same item Greg Kroah-Hartman
` (343 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+6df45dd3d03e1a9aca96,
Krystian Kaniewski, Luiz Augusto von Dentz, Dickson Wu,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krystian Kaniewski <krystianmkaniewski@gmail.com>
commit 9b851b09b392da68bd715601f10a5adb2d8d19b8 upstream.
A NULL pointer dereference in klist_put() occurs when a child device (such
as a BNEP network device in bnep_session) is concurrently being
unregistered while hci_conn_del_sysfs() reparents child devices.
This is caused by a race condition between hci_conn_del_sysfs() and
concurrent child device unregistration (e.g. bnep_session calling
unregister_netdev()). During device unregistration, device_del() snapshots
a non-NULL parent pointer. Concurrently, hci_conn_del_sysfs() finds the
child device using device_find_any_child() and calls device_move() to
reparent it to NULL, which removes the node from its parent's klist and
clears knode_parent. Subsequently, device_del() calls
klist_del(&dev->p->knode_parent) using the stale parent snapshot, causing
klist_put() to dereference knode_klist(n)->put on an already removed node,
resulting in a NULL pointer dereference.
This race was introduced by commit 27aabf27fd01 ("Bluetooth: fix
use-after-free in device_for_each_child()"), which replaced
device_find_child(..., __match_tty) with device_find_any_child() in
hci_conn_del_sysfs(). That change was intended to avoid a use-after-free
where conn->dev outlived its parent hdev->dev when child devices held
references to conn->dev, because conn->dev only held a reference to
hdev->dev while registered in sysfs.
Fix the issue properly by taking an explicit reference to the parent device
with get_device(&hdev->dev) in hci_conn_init_sysfs() and dropping it with
put_device(parent) in bt_link_release() when the conn device is freed. This
ensures that hdev->dev remains valid for the entire lifecycle of conn->dev,
resolving the underlying use-after-free. With the parent reference held
properly, restore the __match_tty filter in hci_conn_del_sysfs() so that
device_move() is only invoked on persistent RFCOMM TTY devices as
originally intended, eliminating the race condition with unregistering
network devices.
Fixes: 27aabf27fd01 ("Bluetooth: fix use-after-free in device_for_each_child()")
Assisted-by: Gemini:gemini-3.7-flash syzbot
Reported-by: syzbot+6df45dd3d03e1a9aca96@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6df45dd3d03e1a9aca96
Link: https://syzkaller.appspot.com/ai_job?id=f1c0e740-db21-40af-a9ff-84db0fd8b8bd
Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ adapted to 6.1.y: device_find_child() match callback takes void * ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sysfs.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index b1886e517a78b..89cd9ea1ba439 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -11,7 +11,10 @@ static struct class *bt_class;
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ struct device *parent = dev->parent;
+
kfree(conn);
+ put_device(parent);
}
static const struct device_type bt_link = {
@@ -19,6 +22,16 @@ static const struct device_type bt_link = {
.release = bt_link_release,
};
+/*
+ * The rfcomm tty device will possibly retain even when conn
+ * is down, and sysfs doesn't support move zombie device,
+ * so we should move the device before conn device is destroyed.
+ */
+static int __match_tty(struct device *dev, void *data)
+{
+ return !strncmp(dev_name(dev), "rfcomm", 6);
+}
+
void hci_conn_init_sysfs(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
@@ -27,7 +40,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn)
conn->dev.type = &bt_link;
conn->dev.class = bt_class;
- conn->dev.parent = &hdev->dev;
+ conn->dev.parent = get_device(&hdev->dev);
device_initialize(&conn->dev);
}
@@ -67,7 +80,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
while (1) {
struct device *dev;
- dev = device_find_any_child(&conn->dev);
+ dev = device_find_child(&conn->dev, NULL, __match_tty);
if (!dev)
break;
device_move(dev, NULL, DPM_ORDER_DEV_LAST);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0656/1059] btrfs: fix xattr replace when multiple xattrs are packed in the same item
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (654 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0655/1059] Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0657/1059] mm: improve code consistency with zonelist_* helper functions Greg Kroah-Hartman
` (342 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Dickson Wu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
commit 858bee1c77857aabcc2327cd32dd8266332de332 upstream.
If we have a btrfs_dir_item item that packs multiple xattrs and then we
replace the value of one of them (with the setxattr(2) family of syscalls)
with another value of a different size, we end up not having a fully
initialized btrfs_dir_item, resulting in a corruption that the tree
checker will detect at extent buffer writeback time.
This is because in btrfs_setxattr() when we find a btrfs_dir_item with
multiple xattrs (due to the crc32c hash of their name being the same)
we delete one of the xattr items (btrfs_dir_item) and then insert a new
one, but the deletion and insertion results in shifting existing data in
the leaf and therefore when the new value of a xattr has a different size,
the new btrfs_dir_item is placed in a leaf section that was not
initialized and we only copy the value's data and set the value's length
in the new btrfs_dir_item, without setting the name, the name's length,
the key (which must be all zeroes for xattrs), flags (BTRFS_FT_XATTR) and
transaction ID.
The following script reproduces the issue:
$ cat test.sh
#!/bin/bash
DEV=/dev/sdi
MNT=/mnt/sdi
mkfs.btrfs -f $DEV
mount $DEV $MNT
touch $MNT/testfile
# Add two xattrs that, on btrfs, have the same hash (crc32c) for their
# name and therefore are packed into the same btrfs_dir_item.
setfattr -n user.foobar -v 123 $MNT/testfile
setfattr -n user.WvG1c1Td -v qwerty $MNT/testfile
# Verify the xattrs are present.
echo "xattrs before:"
getfattr --absolute-names --dump $MNT/testfile
# Now replace the value of the foobar xattr with a significantly larger
# value.
setfattr -n user.foobar -v abcdefghijklmnopqrstuvwxyz $MNT/testfile
# Check the xattrs have the expected values.
echo "xattrs after:"
getfattr --absolute-names --dump $MNT/testfile
umount $MNT
Running it:
$ ./test.sh
(...)
xattrs before:
# file: /mnt/sdi/testfile
user.WvG1c1Td="qwerty"
user.foobar="123"
xattrs after:
# file: /mnt/sdi/testfile
user.WvG1c1Td="qwerty"
So the "user.foobar" xattr is missing and there was a transaction abort
when unmounting the fs with the following traces in dmesg:
$ dmesg
[869800.159271] BTRFS warning (device sdi): access to eb bytenr 30474240 len 16384 out of range start 16015 len 25964
[869800.159293] ------------[ cut here ]------------
[869800.159296] WARNING: fs/btrfs/extent_io.c:4408 at report_eb_range+0x44/0x60 [btrfs], CPU#8: getfattr/2605179
[869800.168961] Modules linked in: btrfs dm_thin_pool (...)
[869800.190527] CPU: 8 UID: 0 PID: 2605179 Comm: getfattr Tainted: G W 7.3.0-rc3-btrfs-next-244+ #1 PREEMPT(full)
[869800.193726] Tainted: [W]=WARN
[869800.194502] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[869800.197576] RIP: 0010:report_eb_range+0x44/0x60 [btrfs]
[869800.198985] Code: 48 8b 7b 18 (...)
[869800.203531] RSP: 0018:ffffce4541937d58 EFLAGS: 00010246
[869800.204609] RAX: 0000000000000000 RBX: ffff8dde054b8738 RCX: 0000000000000000
[869800.206137] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffffffc04c92a0
[869800.207645] RBP: 0000000000003e8f R08: 0000000000000000 R09: 3fffffffffefffff
[869800.226175] R10: ffffce4541937a88 R11: 0000000000000003 R12: 000000000000656c
[869800.227594] R13: ffff8dde14be800f R14: 000000000000656c R15: 0000000000000069
[869800.229097] FS: 00007f59023bb780(0000) GS:ffff8de5788ed000(0000) knlGS:0000000000000000
[869800.231137] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[869800.232321] CR2: 0000558dc45e6a78 CR3: 0000000765b16004 CR4: 0000000000370ef0
[869800.233783] Call Trace:
[869800.234330] <TASK>
[869800.234791] read_extent_buffer+0x4d/0x100 [btrfs]
[869800.235898] btrfs_listxattr+0x199/0x240 [btrfs]
[869800.236912] vfs_listxattr+0x51/0xa0
[869800.237683] listxattr+0x7e/0x100
[869800.238398] path_listxattrat+0x9e/0x190
[869800.239117] do_syscall_64+0x89/0x470
[869800.239877] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[869800.240914] RIP: 0033:0x7f59024cdcb7
[869800.241686] Code: f0 ff ff 73 (...)
[869800.245353] RSP: 002b:00007ffd056dcdb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000c2
[869800.246892] RAX: ffffffffffffffda RBX: 00007ffd056df2e2 RCX: 00007f59024cdcb7
[869800.248853] RDX: 0000000000006600 RSI: 0000558dc45e0470 RDI: 00007ffd056df2e2
[869800.250514] RBP: 00007ffd056df2e2 R08: 0000000000006600 R09: 0000000000006600
[869800.252295] R10: 0000000000000004 R11: 0000000000000246 R12: 00000000ffffff9c
[869800.254105] R13: 0000558dc45e0470 R14: 0000000000006600 R15: 0000000000000000
[869800.255931] </TASK>
[869800.256529] ---[ end trace 0000000000000000 ]---
[869800.260071] page: refcount:2 mapcount:0 mapping:000000007ccfc77f index:0x1d10 pfn:0x608c69
[869800.260075] memcg:ffff8dde00344d40
[869800.260076] aops:btree_aops [btrfs] ino:1
[869800.260151] flags: 0x17fffc00000402a(uptodate|lru|private|writeback|node=0|zone=2|lastcpupid=0x1ffff)
[869800.260154] raw: 017fffc00000402a fffff4adc773d4c8 fffff4adc48f3d88 ffff8de36504ba30
[869800.260155] raw: 0000000000001d10 ffff8dde054b8738 00000002ffffffff ffff8dde00344d40
[869800.260156] page dumped because: eb page dump
[869800.260157] BTRFS critical (device sdi): corrupt leaf: root=5 block=30474240 slot=5 ino=257, invalid location key type, have 46, expect 132 or 1
[869800.260161] BTRFS info (device sdi): leaf 30474240 gen 9 total ptrs 6 free space 15629 owner 5
[869800.260163] BTRFS info (device sdi): refs 3 lock_owner 0 current 2550294
[869800.260164] item 0 key (256 INODE_ITEM 0) itemoff 16123 itemsize 160
[869800.260165] inode generation 3 transid 0 size 0 nbytes 16384
[869800.260166] block group 0 mode 40755 links 1 uid 0 gid 0
[869800.260167] rdev 0 sequence 0 flags 0x0
[869800.260168] atime 1790340637.0
[869800.260169] ctime 1790340637.0
[869800.260169] mtime 1790340637.0
[869800.260170] otime 1790340637.0
[869800.260170] item 1 key (256 INODE_REF 256) itemoff 16111 itemsize 12
[869800.260172] index 0 name_len 2
[869800.260172] item 2 key (256 DIR_ITEM 982728850) itemoff 16073 itemsize 38
[869800.260173] location key (257 1 0) type 1
[869800.260174] transid 9 data_len 0 name_len 8
[869800.260175] item 3 key (257 INODE_ITEM 0) itemoff 15913 itemsize 160
[869800.260176] inode generation 9 transid 9 size 0 nbytes 0
[869800.260177] block group 0 mode 100664 links 1 uid 0 gid 0
[869800.260177] rdev 0 sequence 0 flags 0x0
[869800.260178] atime 1790340638.38778502
[869800.260179] ctime 1790340638.38778502
[869800.260179] mtime 1790340638.38778502
[869800.260180] otime 1790340638.38778502
[869800.260180] item 4 key (257 INODE_REF 256) itemoff 15895 itemsize 18
[869800.260181] index 2 name_len 8
[869800.260182] item 5 key (257 XATTR_ITEM 751495445) itemoff 15779 itemsize 116
[869800.260183] location key (0 0 0) type 8
[869800.266052] transid 9 data_len 6 name_len 13
[869800.266053] location key (8243121639454149888 46 7229457603934778967) type 0
[869800.266055] transid 113 data_len 26 name_len 0
[869800.266056] location key (8608196880778817904 120 162425) type 9
[869800.266057] transid 8391162079612502016 data_len 26982 name_len 25964
[869800.266058] BTRFS error (device sdi): block=30474240 write time tree block corruption detected
[869800.266091] ------------[ cut here ]------------
[869800.266092] WARNING: fs/btrfs/disk-io.c:336 at btree_csum_one_bio+0x20b/0x220 [btrfs], CPU#7: kworker/u50:7/2550294
[869800.268392] Modules linked in: btrfs dm_thin_pool (...)
[869800.365851] CPU: 7 UID: 0 PID: 2550294 Comm: kworker/u50:7 Tainted: G W 7.3.0-rc3-btrfs-next-244+ #1 PREEMPT(full)
[869800.368937] Tainted: [W]=WARN
[869800.369834] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[869800.372778] Workqueue: writeback wb_workfn (flush-btrfs-3821)
[869800.374314] RIP: 0010:btree_csum_one_bio+0x20b/0x220 [btrfs]
[869800.375915] Code: 89 44 24 04 (...)
[869800.380639] RSP: 0018:ffffce4548e3f7d0 EFLAGS: 00010246
[869800.382008] RAX: 0000000000000000 RBX: ffff8dde054b8738 RCX: 0000000000000000
[869800.383850] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8de091c2ddc0
[869800.385710] RBP: ffff8dde196a2000 R08: 0000000000000000 R09: 3fffffffffefffff
[869800.387388] R10: ffffce4548e3f500 R11: 0000000000000003 R12: ffffce4548e3f7d8
[869800.388973] R13: ffff8dde196a2000 R14: ffff8de36504b750 R15: ffff8dde4c497b00
[869800.390414] FS: 0000000000000000(0000) GS:ffff8de5788ad000(0000) knlGS:0000000000000000
[869800.392002] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[869800.393160] CR2: 000055cd6e92ad5c CR3: 00000007cb264001 CR4: 0000000000370ef0
[869800.394595] Call Trace:
[869800.395113] <TASK>
[869800.395570] btrfs_submit_bbio+0x872/0x890 [btrfs]
[869800.397284] write_meta_extent_buffer+0x70/0x80 [btrfs]
[869800.398940] btree_writepages+0x141/0x4f0 [btrfs]
[869800.400426] ? get_random_u32+0x8a/0xf0
[869800.401417] ? build_slab_freelist+0x47/0x130
[869800.402574] ? preempt_count_add+0x6b/0xa0
[869800.403633] ? _raw_spin_lock_irqsave+0x23/0x50
[869800.404807] ? _raw_spin_unlock_irqrestore+0x22/0x40
[869800.406085] ? alloc_from_new_slab+0x18f/0x330
[869800.407223] do_writepages+0xc6/0x160
[869800.408191] ? refill_objects+0xd8/0x300
[869800.409211] __writeback_single_inode+0x42/0x350
[869800.410408] writeback_sb_inodes+0x231/0x560
[869800.411511] wb_writeback+0x8a/0x300
[869800.412440] wb_workfn+0xbf/0x460
[869800.413291] ? _raw_spin_unlock+0x14/0x30
[869800.414328] ? finish_task_switch.isra.0+0xb9/0x380
[869800.415105] process_one_work+0x1d1/0x3d0
[869800.416633] worker_thread+0x1c4/0x330
[869800.417467] ? __pfx_worker_thread+0x10/0x10
[869800.418452] kthread+0xfc/0x130
[869800.419257] ? __pfx_kthread+0x10/0x10
[869800.420089] ret_from_fork+0x1f7/0x2c0
[869800.420863] ? __pfx_kthread+0x10/0x10
[869800.421654] ret_from_fork_asm+0x1a/0x30
[869800.422484] </TASK>
[869800.422953] ---[ end trace 0000000000000000 ]---
[869800.424005] BTRFS error (device sdi state A): Transaction 9 aborted (-EIO)
[869800.424010] BTRFS: error (device sdi state A) in __btrfs_run_delayed_items:1162: errno=-5 IO failure
[869800.424011] BTRFS info (device sdi state EA): forced readonly
[869800.424013] BTRFS warning (device sdi state EA): Skipping commit of aborted transaction.
[869800.424014] BTRFS: error (device sdi state EA) in cleanup_transaction:2076: errno=-5 IO failure
Fix this by always setting all fields in the new btrfs_dir_item when we
replace an existing xattr.
Fixes: 5f5bc6b1e2d5 ("Btrfs: make xattr replace operations atomic")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ adapted to 6.1: use btrfs_set_dir_type() for BTRFS_FT_XATTR ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/xattr.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 5bb8d8c863119..d7eb340c818a4 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -170,6 +170,7 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
const u16 old_data_len = btrfs_dir_data_len(leaf, di);
const u32 item_size = btrfs_item_size(leaf, slot);
const u32 data_size = sizeof(*di) + name_len + size;
+ unsigned long name_ptr;
unsigned long data_ptr;
char *ptr;
@@ -198,8 +199,16 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
ptr = btrfs_item_ptr(leaf, slot, char);
ptr += btrfs_item_size(leaf, slot) - data_size;
di = (struct btrfs_dir_item *)ptr;
+ memzero_extent_buffer(leaf, (unsigned long)ptr +
+ offsetof(struct btrfs_dir_item, location),
+ sizeof(struct btrfs_disk_key));
+ btrfs_set_dir_type(leaf, di, BTRFS_FT_XATTR);
+ btrfs_set_dir_transid(leaf, di, trans->transid);
+ btrfs_set_dir_name_len(leaf, di, name_len);
btrfs_set_dir_data_len(leaf, di, size);
+ name_ptr = (unsigned long)(di + 1);
data_ptr = ((unsigned long)(di + 1)) + name_len;
+ write_extent_buffer(leaf, name, name_ptr, name_len);
write_extent_buffer(leaf, value, data_ptr, size);
btrfs_mark_buffer_dirty(leaf);
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0657/1059] mm: improve code consistency with zonelist_* helper functions
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (655 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0656/1059] btrfs: fix xattr replace when multiple xattrs are packed in the same item Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0658/1059] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone Greg Kroah-Hartman
` (341 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shivank Garg, Wei Yang,
David Hildenbrand, Mike Rapoport (IBM), Andrew Morton,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yang <richard.weiyang@gmail.com>
[ Upstream commit 29943248af0a8ac3edb808564baa417b40e35521 ]
Replace direct access to zoneref->zone, zoneref->zone_idx, or
zone_to_nid(zoneref->zone) with the corresponding zonelist_* helper
functions for consistency.
No functional change.
Link: https://lkml.kernel.org/r/20240729091717.464-1-shivankg@amd.com
Co-developed-by: Shivank Garg <shivankg@amd.com>
Signed-off-by: Shivank Garg <shivankg@amd.com>
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 6c48b3ab4ee4 ("mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/mmzone.h | 4 ++--
include/trace/events/oom.h | 4 ++--
mm/mempolicy.c | 4 ++--
mm/mmzone.c | 2 +-
mm/page_alloc.c | 22 +++++++++++-----------
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 7951de0ca970e..f0a0288bafc7b 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1524,7 +1524,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
zone = zonelist_zone(z))
#define for_next_zone_zonelist_nodemask(zone, z, highidx, nodemask) \
- for (zone = z->zone; \
+ for (zone = zonelist_zone(z); \
zone; \
z = next_zones_zonelist(++z, highidx, nodemask), \
zone = zonelist_zone(z))
@@ -1560,7 +1560,7 @@ static inline bool movable_only_nodes(nodemask_t *nodes)
nid = first_node(*nodes);
zonelist = &NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK];
z = first_zones_zonelist(zonelist, ZONE_NORMAL, nodes);
- return (!z->zone) ? true : false;
+ return (!zonelist_zone(z)) ? true : false;
}
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index b799f3bcba823..8c834a0d22817 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -55,8 +55,8 @@ TRACE_EVENT(reclaim_retry_zone,
),
TP_fast_assign(
- __entry->node = zone_to_nid(zoneref->zone);
- __entry->zone_idx = zoneref->zone_idx;
+ __entry->node = zonelist_node_idx(zoneref);
+ __entry->zone_idx = zonelist_zone_idx(zoneref);
__entry->order = order;
__entry->reclaimable = reclaimable;
__entry->available = available;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index a8e990a6aa0c0..bfc94fb823608 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1925,7 +1925,7 @@ unsigned int mempolicy_slab_node(void)
zonelist = &NODE_DATA(node)->node_zonelists[ZONELIST_FALLBACK];
z = first_zones_zonelist(zonelist, highest_zoneidx,
&policy->nodes);
- return z->zone ? zone_to_nid(z->zone) : node;
+ return zonelist_zone(z) ? zonelist_node_idx(z) : node;
}
case MPOL_LOCAL:
return node;
@@ -2617,7 +2617,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
node_zonelist(numa_node_id(), GFP_HIGHUSER),
gfp_zone(GFP_HIGHUSER),
&pol->nodes);
- polnid = zone_to_nid(z->zone);
+ polnid = zonelist_node_idx(z);
break;
default:
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 68e1511be12de..9e268ee0a34db 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -66,7 +66,7 @@ struct zoneref *__next_zones_zonelist(struct zoneref *z,
z++;
else
while (zonelist_zone_idx(z) > highest_zoneidx ||
- (z->zone && !zref_in_nodemask(z, nodes)))
+ (zonelist_zone(z) && !zref_in_nodemask(z, nodes)))
z++;
return z;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ba7f386331a65..5b5a64db3f3be 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4303,7 +4303,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
}
if (no_fallback && nr_online_nodes > 1 &&
- zone != ac->preferred_zoneref->zone) {
+ zone != zonelist_zone(ac->preferred_zoneref)) {
int local_nid;
/*
@@ -4311,7 +4311,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
* fragmenting fallbacks. Locality is more important
* than fragmentation avoidance.
*/
- local_nid = zone_to_nid(ac->preferred_zoneref->zone);
+ local_nid = zonelist_node_idx(ac->preferred_zoneref);
if (zone_to_nid(zone) != local_nid) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
goto retry;
@@ -4340,7 +4340,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
goto try_this_zone;
if (!node_reclaim_enabled() ||
- !zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
+ !zone_allows_reclaim(zonelist_zone(ac->preferred_zoneref), zone))
continue;
ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
@@ -4362,7 +4362,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
}
try_this_zone:
- page = rmqueue(ac->preferred_zoneref->zone, zone, order,
+ page = rmqueue(zonelist_zone(ac->preferred_zoneref), zone, order,
gfp_mask, alloc_flags, ac->migratetype);
if (page) {
prep_new_page(page, order, gfp_mask, alloc_flags);
@@ -5152,7 +5152,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
*/
ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
ac->highest_zoneidx, ac->nodemask);
- if (!ac->preferred_zoneref->zone)
+ if (!zonelist_zone(ac->preferred_zoneref))
goto nopage;
/*
@@ -5164,7 +5164,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
struct zoneref *z = first_zones_zonelist(ac->zonelist,
ac->highest_zoneidx,
&cpuset_current_mems_allowed);
- if (!z->zone)
+ if (!zonelist_zone(z))
goto nopage;
}
@@ -5544,8 +5544,8 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
continue;
}
- if (nr_online_nodes > 1 && zone != ac.preferred_zoneref->zone &&
- zone_to_nid(zone) != zone_to_nid(ac.preferred_zoneref->zone)) {
+ if (nr_online_nodes > 1 && zone != zonelist_zone(ac.preferred_zoneref) &&
+ zone_to_nid(zone) != zonelist_node_idx(ac.preferred_zoneref)) {
goto failed;
}
@@ -5604,7 +5604,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
pcp_trylock_finish(UP_flags);
__count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account);
- zone_statistics(ac.preferred_zoneref->zone, zone, nr_account);
+ zone_statistics(zonelist_zone(ac.preferred_zoneref), zone, nr_account);
out:
return nr_populated;
@@ -5662,7 +5662,7 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
* Forbid the first pass from falling back to types that fragment
* memory until all local zones are considered.
*/
- alloc_flags |= alloc_flags_nofragment(ac.preferred_zoneref->zone, gfp);
+ alloc_flags |= alloc_flags_nofragment(zonelist_zone(ac.preferred_zoneref), gfp);
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
@@ -6633,7 +6633,7 @@ int local_memory_node(int node)
z = first_zones_zonelist(node_zonelist(node, GFP_KERNEL),
gfp_zone(GFP_KERNEL),
NULL);
- return zone_to_nid(z->zone);
+ return zonelist_node_idx(z);
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0658/1059] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (656 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0657/1059] mm: improve code consistency with zonelist_* helper functions Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0659/1059] mm/page_alloc: snapshot the preferred zone against shrink rebuilds Greg Kroah-Hartman
` (340 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Gregory Price (Meta), Zi Yan, Vlastimil Babka (SUSE), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 6c48b3ab4ee435c41c3395d31e8ec3dbccc3478c ]
should_reclaim_retry() walks a zonelist and passes the zoneref pointer
to the reclaim_retry_zone tracepoint, which loads the zone from the
entry again to find the node.
Memory hotplug rebuilds the zonelists in place while allocations are
under way. When a zone in front of the zoneref entry has become empty,
the entries move up, and this one can be the end marker by the time the
tracepoint looks at it. zonelist_node_idx() then dereferences a NULL
zone. Short of that, the event can name another zone than the one its
numbers belong to.
Pass the zone pointer instead of the zoneref pointer.
Fixes: d379f01de095 ("oom, trace: add oom detection tracepoints")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
Acked-by: Zi Yan <ziy@nvidia.com>
Link: https://patch.msgid.link/20261101021340.2251928-4-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/trace/events/oom.h | 8 ++++----
mm/page_alloc.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index 8c834a0d22817..008c62cc078b1 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -33,7 +33,7 @@ TRACE_EVENT(oom_score_adj_update,
TRACE_EVENT(reclaim_retry_zone,
- TP_PROTO(struct zoneref *zoneref,
+ TP_PROTO(struct zone *zone,
int order,
unsigned long reclaimable,
unsigned long available,
@@ -41,7 +41,7 @@ TRACE_EVENT(reclaim_retry_zone,
int no_progress_loops,
bool wmark_check),
- TP_ARGS(zoneref, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
+ TP_ARGS(zone, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
TP_STRUCT__entry(
__field( int, node)
@@ -55,8 +55,8 @@ TRACE_EVENT(reclaim_retry_zone,
),
TP_fast_assign(
- __entry->node = zonelist_node_idx(zoneref);
- __entry->zone_idx = zonelist_zone_idx(zoneref);
+ __entry->node = zone_to_nid(zone);
+ __entry->zone_idx = zone_idx(zone);
__entry->order = order;
__entry->reclaimable = reclaimable;
__entry->available = available;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5b5a64db3f3be..1db53951ff585 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5043,7 +5043,7 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
*/
wmark = __zone_watermark_ok(zone, order, min_wmark,
ac->highest_zoneidx, alloc_flags, available);
- trace_reclaim_retry_zone(z, order, reclaimable,
+ trace_reclaim_retry_zone(zone, order, reclaimable,
available, min_wmark, *no_progress_loops, wmark);
if (wmark) {
ret = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0659/1059] mm/page_alloc: snapshot the preferred zone against shrink rebuilds
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (657 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0658/1059] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0660/1059] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
` (339 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit b3e3a760eb68449e2794ef68ab212173d9c3e8c7 ]
get_page_from_freelist() and alloc_pages_bulk_noprof() reread
ac->preferred_zoneref->zone at every use. Offlining a zone's last block
rebuilds the zonelists in place, and the shrunk list's NULL terminator
can land on the preferred slot mid-walk:
CPU 0 CPU 1
get_page_from_freelist(GFP_KERNEL | __GFP_THISNODE)
zone = NORMAL (slot 1)
offline_pages()
build_all_zonelists()
[MOVABLE, NORMAL, NULL]
-> [NORMAL, NULL]
rmqueue(zonelist_zone(slot 1), zone)
zone_statistics(NULL, zone)
BUG: kernel NULL pointer dereference, address: 0000000000000060
RIP: 0010:get_page_from_freelist+0x6a5/0x15f0
Call Trace:
__alloc_frozen_pages_noprof+0x125/0x330
Read the slot once. Zones are never freed, so a stale zone is safe, and
a NULL slot fails the same way as walking off the end.
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-7-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Kept the existing no_fallback condition because defrag_mode is absent from this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1db53951ff585..c3773efde5b60 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4253,10 +4253,19 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
{
struct zoneref *z;
struct zone *zone;
+ struct zone *preferred_zone;
struct pglist_data *last_pgdat = NULL;
bool last_pgdat_dirty_ok = false;
bool no_fallback;
+ /*
+ * A concurrent zonelist rebuild can NULL or replace this slot. Zones
+ * are never freed, so reading it once keeps a usable zone.
+ */
+ preferred_zone = zonelist_zone(ac->preferred_zoneref);
+ if (!preferred_zone)
+ return NULL;
+
retry:
/*
* Scan zonelist, looking for a zone with enough free.
@@ -4303,7 +4312,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
}
if (no_fallback && nr_online_nodes > 1 &&
- zone != zonelist_zone(ac->preferred_zoneref)) {
+ zone != preferred_zone) {
int local_nid;
/*
@@ -4311,7 +4320,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
* fragmenting fallbacks. Locality is more important
* than fragmentation avoidance.
*/
- local_nid = zonelist_node_idx(ac->preferred_zoneref);
+ local_nid = zone_to_nid(preferred_zone);
if (zone_to_nid(zone) != local_nid) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
goto retry;
@@ -4340,7 +4349,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
goto try_this_zone;
if (!node_reclaim_enabled() ||
- !zone_allows_reclaim(zonelist_zone(ac->preferred_zoneref), zone))
+ !zone_allows_reclaim(preferred_zone, zone))
continue;
ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
@@ -4362,7 +4371,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
}
try_this_zone:
- page = rmqueue(zonelist_zone(ac->preferred_zoneref), zone, order,
+ page = rmqueue(preferred_zone, zone, order,
gfp_mask, alloc_flags, ac->migratetype);
if (page) {
prep_new_page(page, order, gfp_mask, alloc_flags);
@@ -5484,6 +5493,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
struct page *page;
unsigned long __maybe_unused UP_flags;
struct zone *zone;
+ struct zone *preferred_zone;
struct zoneref *z;
struct per_cpu_pages *pcp;
struct list_head *pcp_list;
@@ -5534,6 +5544,11 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
goto out;
gfp = alloc_gfp;
+ /* Read once; see get_page_from_freelist(). */
+ preferred_zone = zonelist_zone(ac.preferred_zoneref);
+ if (!preferred_zone)
+ goto failed;
+
/* Find an allowed local zone that meets the low watermark. */
z = ac.preferred_zoneref;
for_next_zone_zonelist_nodemask(zone, z, ac.highest_zoneidx, ac.nodemask) {
@@ -5544,14 +5559,14 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
continue;
}
- if (nr_online_nodes > 1 && zone != zonelist_zone(ac.preferred_zoneref) &&
- zone_to_nid(zone) != zonelist_node_idx(ac.preferred_zoneref)) {
+ if (nr_online_nodes > 1 && zone != preferred_zone &&
+ zone_to_nid(zone) != zone_to_nid(preferred_zone)) {
goto failed;
}
mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK) + nr_pages;
if (zone_watermark_fast(zone, 0, mark,
- zonelist_zone_idx(ac.preferred_zoneref),
+ zone_idx(preferred_zone),
alloc_flags, gfp)) {
break;
}
@@ -5604,7 +5619,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
pcp_trylock_finish(UP_flags);
__count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account);
- zone_statistics(zonelist_zone(ac.preferred_zoneref), zone, nr_account);
+ zone_statistics(preferred_zone, zone, nr_account);
out:
return nr_populated;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0660/1059] mm/page_alloc: retry allocations that raced with a zonelist rebuild
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (658 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0659/1059] mm/page_alloc: snapshot the preferred zone against shrink rebuilds Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0661/1059] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
` (338 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
6.1-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>
[ sashal: Replaced the __free_frozen_pages() calls with __free_pages() and adapted the hunks to the older __alloc_pages/__alloc_pages_bulk code, which has no ALLOC_NOLOCK handling. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c3773efde5b60..eefe71662d0e0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4818,12 +4818,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 */
@@ -5419,6 +5432,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_pages(page, order);
+ page = NULL;
+ goto restart;
+ }
return page;
}
@@ -5500,6 +5519,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
struct alloc_context ac;
gfp_t alloc_gfp;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
+ unsigned int zonelist_iter_cookie;
int nr_populated = 0, nr_account = 0;
/*
@@ -5540,6 +5560,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
/* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
gfp &= gfp_allowed_mask;
alloc_gfp = gfp;
+ zonelist_iter_cookie = zonelist_iter_sample();
if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
goto out;
gfp = alloc_gfp;
@@ -5579,6 +5600,10 @@ unsigned long __alloc_pages_bulk(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_trylock_prepare(UP_flags);
pcp = pcp_spin_trylock(zone->per_cpu_pageset);
@@ -5651,6 +5676,7 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
unsigned int alloc_flags = ALLOC_WMARK_LOW;
gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
struct alloc_context ac = { };
+ unsigned int zonelist_iter_cookie;
/*
* There are several places where we assume that the order value is sane
@@ -5669,6 +5695,7 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
*/
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, &alloc_flags))
return NULL;
@@ -5681,6 +5708,10 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
+ if (likely(page) && unlikely(check_retry_zonelist(zonelist_iter_cookie))) {
+ __free_pages(page, order);
+ page = NULL;
+ }
if (likely(page))
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0661/1059] mm/hugetlb: retry the pool walk when the zonelist is rebuilt
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (659 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0660/1059] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0662/1059] mm/page_alloc: retry alloc_contig_pages() " Greg Kroah-Hartman
` (337 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
6.1-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>
[ sashal: Adapted to the older tree: folio-based dequeue code became struct page, and the zonelist seqlock helpers moved into mm/internal.h (not page_alloc.h). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/hugetlb.c | 13 ++++++++++---
mm/internal.h | 19 +++++++++++++++++++
mm/page_alloc.c | 18 +-----------------
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a0372189a23d4..fdd23db12875e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1361,19 +1361,25 @@ static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid)
static struct page *dequeue_huge_page_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;
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 page *page;
+ /* 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;
/*
@@ -1388,7 +1394,8 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
if (page)
return page;
}
- 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/internal.h b/mm/internal.h
index a94aae7f6c8df..5ac9e0cc8774b 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -11,6 +11,7 @@
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/rmap.h>
+#include <linux/seqlock.h>
#include <linux/tracepoint-defs.h>
struct folio_batch;
@@ -404,6 +405,24 @@ extern void zone_pcp_reset(struct zone *zone);
extern void zone_pcp_disable(struct zone *zone);
extern void zone_pcp_enable(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;
+}
+
extern void *memmap_alloc(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr,
int nid, bool exact_nid);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eefe71662d0e0..2bd1641d8403a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4808,15 +4808,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
@@ -4831,14 +4823,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,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0662/1059] mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (660 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0661/1059] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0663/1059] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node() Greg Kroah-Hartman
` (336 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit da0d7a895e9021dc2cffa90fb6fafd8b9379e544 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone.
alloc_contig_frozen_pages_noprof() approves a slot by the caller's gfp
and nodemask, then loads the zone from it:
CPU 0 CPU 1
alloc_contig_frozen_pages_noprof(GFP_HIGHUSER | __GFP_THISNODE)
slot 0 (NORMAL1) approved
online_pages()
build_all_zonelists()
[NORMAL1]
-> [MOVABLE1, NORMAL1]
zone = zonelist_zone(slot 0) /* MOVABLE1 */
alloc_contig_frozen_range(MOVABLE1 pfns)
A gigantic hugetlb page can then land in ZONE_MOVABLE, and a nodemask
caller can get a range from another node. Gigantic pages are kept out
of ZONE_MOVABLE since commit 79b63f12abcb ("mm, hugetlb: do not allocate
non-migrateable gigantic pages from movable zones").
Check zonelist_update_seq before using each zone, and restart the walk
if it changed, as the hugetlb pool walk does. Check again before
escalating to the pass that may migrate hugetlb pages, so a pass a
rebuild cut short is redone rather than escalated.
With kprobes holding the walk across the online, the base kernel put the
1G page in ZONE_MOVABLE in 3 of 3 runs, and this change put it in
ZONE_NORMAL in 3 of 3. Direct GFP_KERNEL calls with nodemask {1} and
{2} got a ZONE_MOVABLE range and a node 1 range on base, 3 of 3 each,
and neither with this change.
Fixes: 5e27a2df03b8 ("mm/page_alloc: add alloc_contig_pages()")
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-11-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Backported to the older alloc_contig_pages() function, since the frozen-pages variant doesn't exist here, and the retry label and check were placed at the end of the function with no hugetlb escalation path. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2bd1641d8403a..44a22f7f213da 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -9509,13 +9509,20 @@ struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask,
int nid, nodemask_t *nodemask)
{
unsigned long ret, pfn, flags;
+ unsigned int zonelist_cookie;
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
+retry:
zonelist = node_zonelist(nid, gfp_mask);
+ zonelist_cookie = zonelist_iter_begin();
for_each_zone_zonelist_nodemask(zone, z, zonelist,
gfp_zone(gfp_mask), nodemask) {
+ /* A rebuild may have shifted an ineligible zone into this slot. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry;
+
spin_lock_irqsave(&zone->lock, flags);
pfn = ALIGN(zone->zone_start_pfn, nr_pages);
@@ -9539,6 +9546,9 @@ struct page *alloc_contig_pages(unsigned long nr_pages, gfp_t gfp_mask,
}
spin_unlock_irqrestore(&zone->lock, flags);
}
+ /* Redo a pass that a rebuild cut short. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry;
return NULL;
}
#endif /* CONFIG_CONTIG_ALLOC */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0663/1059] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (661 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0662/1059] mm/page_alloc: retry alloc_contig_pages() " Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0664/1059] mm/page_alloc: dont undo another isolation in alloc_contig_range Greg Kroah-Hartman
` (335 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit 4cc1bcdf2e4ebcd319005ce2ea132489f6155139 ]
For a bind or preferred-many policy, mempolicy_slab_node() tests the
first matching slot's zone for NULL, then reads the slot again to look
up the zone's node. Offlining a zone's last block rebuilds the
zonelists in place, so the second read can return the terminator:
CPU 0 CPU 1
mempolicy_slab_node()
zonelist_zone(slot 4)
= node 2 NORMAL
offline_pages()
build_all_zonelists()
slot 4 = NULL
zonelist_node_idx(slot 4)
zone_to_nid(NULL)
Current GCC merges the two reads, but nothing requires it. With
mm/mempolicy.o built with -fno-inline -fno-ipa-sra, holding a bound
task's slab_strict_numa allocation between the reads while a movable
block earlier in the zonelist goes offline oopses every time:
BUG: kernel NULL pointer dereference, address: 0000000000000060
RIP: 0010:zone_to_nid+0x0/0x10
Call Trace:
kmem_cache_alloc_noprof+0x294/0x610
do_getname+0x34/0x230
mempolicy_slab_node() and zonelist_node_idx() are tail calls here, so
neither appears in the trace.
Read the slot once and use that zone.
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-12-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/mempolicy.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index bfc94fb823608..527cb7e798471 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1915,6 +1915,7 @@ unsigned int mempolicy_slab_node(void)
case MPOL_PREFERRED_MANY:
{
struct zoneref *z;
+ struct zone *zone;
/*
* Follow bind policy behavior and start allocation at the
@@ -1925,7 +1926,8 @@ unsigned int mempolicy_slab_node(void)
zonelist = &NODE_DATA(node)->node_zonelists[ZONELIST_FALLBACK];
z = first_zones_zonelist(zonelist, highest_zoneidx,
&policy->nodes);
- return zonelist_zone(z) ? zonelist_node_idx(z) : node;
+ zone = zonelist_zone(z);
+ return zone ? zone_to_nid(zone) : node;
}
case MPOL_LOCAL:
return node;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0664/1059] mm/page_alloc: dont undo another isolation in alloc_contig_range
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (662 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0663/1059] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0665/1059] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Greg Kroah-Hartman
` (334 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit 7d9c29ed8feec8bfbe5e5f673ba2b5926da11375 ]
An alloc_contig_range() that overlaps a block going offline can leave
the offline spinning until it gets a signal, holding the device hotplug
lock. When isolation fails, alloc_contig_frozen_range() undoes it over
the whole range, clearing the offline's MIGRATE_ISOLATE too:
CPU 1 (offline_pages) CPU 2 (alloc_contig_range)
start_isolate_page_range()
blocks are MIGRATE_ISOLATE
start_isolate_page_range()
-EBUSY on CPU 1's blocks
undo_isolate_page_range()
blocks are MIGRATE_MOVABLE
test_pages_isolated()
never succeeds again
start_isolate_page_range() fails only on a block someone else isolated,
after undoing its own, so this undo only ever clears another caller's.
Return directly, as before alloc_contig_range() went pageblock granular.
With offline_pages() parked after isolating a DIMM block and a 1G
hugetlb allocation made over it, the offline on base still loops 30s
later in 4 of 4 runs:
offline_pages+0x5b2/0x1570
memory_subsys_offline+0x17e/0x470
device_offline+0x250/0x340
state_store+0x88/0x110
With this patch the allocation still fails, and the offline completes in
3 of 3 runs.
Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261027042204.3741307-5-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Adapted the change to alloc_contig_range(), where start_isolate_page_range() takes migratetype, 0, and gfp_mask instead of mode. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 44a22f7f213da..96dbf055ae99f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -9358,9 +9358,13 @@ int alloc_contig_range(unsigned long start, unsigned long end,
* put back to page allocator so that buddy can use them.
*/
+ /*
+ * On failure this has undone its own isolation, and any other
+ * isolated blocks in the range belong to someone else, e.g. offline.
+ */
ret = start_isolate_page_range(start, end, migratetype, 0, gfp_mask);
if (ret)
- goto done;
+ return ret;
drain_all_pages(cc.zone);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0665/1059] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (663 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0664/1059] mm/page_alloc: dont undo another isolation in alloc_contig_range Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0666/1059] RDMA/mlx5: Remove pcie_relaxed_ordering_enabled() check for RO write Greg Kroah-Hartman
` (333 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Vlastimil Babka (SUSE),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ Upstream commit 2122887b04f3f2d76daa80055c2c273926032fa0 ]
Whenever the flags of a pageblock are read or written, a kernel with
CONFIG_DEBUG_VM makes sure that the pfn lies within the zone of the page.
Unlike bad_range(), that check reads zone->zone_start_pfn and
zone->spanned_pages without zone->span_seqlock.
Memory hotplug changes the two fields one after the other. If the lower
end of a zone moves, the zone seems to end before its last pages in
between. A page of that part which is freed at that moment, on another
CPU, ends in
page dumped because: VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn))
kernel BUG at mm/page_alloc.c:372!
free_unref_folios+0x55e/0xed0
folios_put_refs+0x2b5/0x530
An attempt has been made [1] to fix this with the span seqlock check.
But that can trigger all sorts of problems in restricted contexts, as
noted by sashiko [2].
Since this is just a sanity debug check and anything with BUG_ON is
frowned upon anyway, just remove it altogether.
Reported-by: Josef Bacik <josef@toxicpanda.com>
Closes: https://lore.kernel.org/all/20261027-pgalloc-ai-hotfixes-v1-9-9c7d1aca801e@kernel.org/ [1]
Link: https://lore.kernel.org/all/sashiko-outbox-188081@kernel.org/ [2]
Fixes: 86051ca5eaf5 ("mm: fix usemap initialization")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-5-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Adapted the zone_spans_pfn() check removal to its location in set_pfnblock_flags_mask(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 96dbf055ae99f..49dd1d679ccd6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -623,8 +623,6 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
word_bitidx = bitidx / BITS_PER_LONG;
bitidx &= (BITS_PER_LONG-1);
- VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
-
mask <<= bitidx;
flags <<= bitidx;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0666/1059] RDMA/mlx5: Remove pcie_relaxed_ordering_enabled() check for RO write
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (664 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0665/1059] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0667/1059] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported Greg Kroah-Hartman
` (332 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avihai Horon, Shay Drory,
Jacob Keller, Leon Romanovsky, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avihai Horon <avihaih@nvidia.com>
[ Upstream commit ed4b0661cce119870edb1994fd06c9cbc1dc05c3 ]
pcie_relaxed_ordering_enabled() check was added to avoid a syndrome when
creating a MKey with relaxed ordering (RO) enabled when the driver's
relaxed_ordering_{read,write} HCA capabilities are out of sync with FW.
While this can happen with relaxed_ordering_read, it can't happen with
relaxed_ordering_write as it's set if the device supports RO write,
regardless of RO in PCI config space, and thus can't change during
runtime.
Therefore, drop the pcie_relaxed_ordering_enabled() check for
relaxed_ordering_write while keeping it for relaxed_ordering_read.
Doing so will also allow the usage of RO write in VFs and VMs (where RO
in PCI config space is not reported/emulated properly).
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Link: https://lore.kernel.org/r/7e8f55e31572c1702d69cae015a395d3a824a38a.1681131553.git.leon@kernel.org
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Stable-dep-of: 68c183619f24 ("net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx5/mr.c | 6 +++---
drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 3 +--
drivers/net/ethernet/mellanox/mlx5/core/en_common.c | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index dacda8d63c5a6..f235028376381 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -67,11 +67,11 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr,
MLX5_SET(mkc, mkc, lw, !!(acc & IB_ACCESS_LOCAL_WRITE));
MLX5_SET(mkc, mkc, lr, 1);
- if ((acc & IB_ACCESS_RELAXED_ORDERING) &&
- pcie_relaxed_ordering_enabled(dev->mdev->pdev)) {
+ if (acc & IB_ACCESS_RELAXED_ORDERING) {
if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_write))
MLX5_SET(mkc, mkc, relaxed_ordering_write, 1);
- if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_read))
+ if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_read) &&
+ pcie_relaxed_ordering_enabled(dev->mdev->pdev))
MLX5_SET(mkc, mkc, relaxed_ordering_read, 1);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
index 542cc017e64cd..1b109a8499f2d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
@@ -868,8 +868,7 @@ static void mlx5e_build_rx_cq_param(struct mlx5_core_dev *mdev,
static u8 rq_end_pad_mode(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
{
bool lro_en = params->packet_merge.type == MLX5E_PACKET_MERGE_LRO;
- bool ro = pcie_relaxed_ordering_enabled(mdev->pdev) &&
- MLX5_CAP_GEN(mdev, relaxed_ordering_write);
+ bool ro = MLX5_CAP_GEN(mdev, relaxed_ordering_write);
return ro && lro_en ?
MLX5_WQ_END_PAD_MODE_NONE : MLX5_WQ_END_PAD_MODE_ALIGN;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
index 03a99918a8942..35eda9e8ba437 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
@@ -43,7 +43,7 @@ void mlx5e_mkey_set_relaxed_ordering(struct mlx5_core_dev *mdev, void *mkc)
bool ro_read = MLX5_CAP_GEN(mdev, relaxed_ordering_read);
MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enable && ro_read);
- MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enable && ro_write);
+ MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_write);
}
int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, u32 *mkey)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0667/1059] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (665 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0666/1059] RDMA/mlx5: Remove pcie_relaxed_ordering_enabled() check for RO write Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0668/1059] xprtrdma: serialize unmap_sync with xprt_disconnect Greg Kroah-Hartman
` (331 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dragos Tatulea, Tariq Toukan,
Jiabin Deng, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiabin Deng <dengjiabin2023@gmail.com>
[ Upstream commit 68c183619f24982a635930697bf8e148f2d78f71 ]
When SHAMPO and relaxed ordering writes are enabled, aligned RQ end
padding can corrupt received TCP data. Due to reordering, alignment
padding written at the end of one packet can overwrite data from the
next packet.
The current RQ end padding selection avoids alignment padding for LRO,
but not for SHAMPO. Extend the condition to SHAMPO to prevent this
corruption.
The issue was observed in a two-host test using a BlueField-3 NIC and
an NVIDIA H20 GPU. In the original test with MTU 1500, 354 of 400
transfers contained corrupted data before the fix. After applying this
change, all 400 transfers across eight message sizes from 32 KiB to
4 MiB, with 50 transfers per size, completed successfully, with no
incorrect bytes or corrupted intervals.
Fixes: e5ca8fb08ab2 ("net/mlx5e: Add control path for SHAMPO feature")
Closes: https://lore.kernel.org/r/CAFxp=AY2cVRQrZvB9WNnigbsobuw11NMG-cagHx0_V+ur2ToFw@mail.gmail.com
Link: https://lore.kernel.org/r/atZKOtjrb9HKSNHF@dtatulea-c5.nvidia.com
Suggested-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jiabin Deng <dengjiabin2023@gmail.com>
Link: https://patch.msgid.link/20261110035723.26587-1-dengjiabin2023@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
index 1b109a8499f2d..b8d5dd737920a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
@@ -867,10 +867,11 @@ static void mlx5e_build_rx_cq_param(struct mlx5_core_dev *mdev,
static u8 rq_end_pad_mode(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
{
- bool lro_en = params->packet_merge.type == MLX5E_PACKET_MERGE_LRO;
+ bool no_pad = params->packet_merge.type == MLX5E_PACKET_MERGE_LRO ||
+ params->packet_merge.type == MLX5E_PACKET_MERGE_SHAMPO;
bool ro = MLX5_CAP_GEN(mdev, relaxed_ordering_write);
- return ro && lro_en ?
+ return ro && no_pad ?
MLX5_WQ_END_PAD_MODE_NONE : MLX5_WQ_END_PAD_MODE_ALIGN;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0668/1059] xprtrdma: serialize unmap_sync with xprt_disconnect
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (666 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0667/1059] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0669/1059] tcp: do not coalesce segments after FIN Greg Kroah-Hartman
` (330 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever, Tim Menninger,
Anna Schumaker, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
[ Upstream commit 1fa415883c37b02ff17acdd7977ed591d3d389ee ]
frwr_unmap_sync() posts LOCAL_INV Work Requests to the QP and waits
for the matching CQE. This can race with rpcrdma_xprt_disconnect():
1. frwr_unmap_sync() samples r_xprt->rx_ep
2. rpcrdma_xprt_disconnect() drains the QP
3. frwr_unmap_sync() posts LOCAL_INV WRs after the drain
4. No CQE arrives, so wait_for_completion() blocks indefinitely
The hung task appears in the rpciod workqueue:
Workqueue: rpciod rpc_async_schedule [sunrpc]
wait_for_completion()
frwr_unmap_sync()
xprt_rdma_free()
xprt_release()
Serialize synchronous MR invalidation against QP teardown with
rx_unmap_rwsem. frwr_unmap_sync() holds the read side while it builds
and submits the LOCAL_INV chain. Disconnect holds the write side across
QP drain and resource teardown. Drop the read side before waiting so
disconnect can drain the submitted Work Requests and deliver their CQEs.
Disconnect can reset a request while frwr_unmap_sync() waits for the
read side. Recheck rl_registered after acquiring the rwsem and return
without posting if the request has already been reset.
Move the synchronous invalidation completion from the final MR to the
request, whose lifetime covers xprt_rdma_free(). This allows disconnect
to destroy MRs after draining the QP while frwr_unmap_sync() is still
waiting. On a post failure, call rpcrdma_force_disconnect() before
dropping the read side so the endpoint is not dereferenced after
disconnect can run.
frwr_unmap_async() runs inline from Receive completion processing.
rpcrdma_xprt_drain() drains the Receive Queue before the Send Queue, so
asynchronous LOCAL_INV Work Requests are submitted before Send Queue
drain. frwr_unmap_sync(), however, runs from xprt_rdma_free() after the
transport send lock has been released, so it is not ordered against
disconnect.
Tested on v7.4-rc1 under pNFS load with repeated data server restarts
to provoke rapid QP disconnect/reconnect cycling. Without the fix, a
hung task in frwr_unmap_sync() reproduced twice in six attempts. With
the fix, no hang occurred across 200 cycles.
Also observed on v6.8 and v6.18.34.
Fixes: e28ce90083f0 ("xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt")
Cc: stable@vger.kernel.org
Assisted-by: Claude:opus-4-7
Reviewed-by: Chuck Lever <cel@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>
---
net/sunrpc/xprtrdma/frwr_ops.c | 89 ++++++++++++++++++++-------------
net/sunrpc/xprtrdma/transport.c | 2 +
net/sunrpc/xprtrdma/verbs.c | 16 ++++--
net/sunrpc/xprtrdma/xprt_rdma.h | 10 +++-
4 files changed, 78 insertions(+), 39 deletions(-)
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index a0d49580dcb87..b2db79f479296 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -27,13 +27,17 @@
/* Transport recovery
*
- * frwr_map and frwr_unmap_* cannot run at the same time the transport
- * connect worker is running. The connect worker holds the transport
- * send lock, just as ->send_request does. This prevents frwr_map and
- * the connect worker from running concurrently. When a connection is
- * closed, the Receive completion queue is drained before the allowing
- * the connect worker to get control. This prevents frwr_unmap and the
- * connect worker from running concurrently.
+ * frwr_map() is serialized with the connect worker by the transport
+ * send lock.
+ *
+ * frwr_unmap_async() runs from Receive completion processing.
+ * rpcrdma_xprt_drain() drains the Receive Queue before the Send Queue,
+ * so asynchronous LOCAL_INV Work Requests are submitted before Send
+ * Queue drain.
+ *
+ * frwr_unmap_sync() runs after the transport send lock is released.
+ * rx_unmap_rwsem orders its LOCAL_INV submission before disconnect
+ * drains the QP.
*
* When the underlying transport disconnects, MRs that are in flight
* are flushed and are likely unusable. Thus all MRs are destroyed.
@@ -139,7 +143,6 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
mr->mr_ibmr = frmr;
mr->mr_device = NULL;
INIT_LIST_HEAD(&mr->mr_list);
- init_completion(&mr->mr_linv_done);
frwr_cid_init(ep, mr);
sg_init_table(sg, depth);
@@ -468,40 +471,60 @@ static void frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc)
* @cq: completion queue
* @wc: WCE for a completed LocalInv WR
*
- * Awaken anyone waiting for an MR to finish being fenced.
+ * Wake frwr_unmap_sync() after the final LOCAL_INV completion.
*/
static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc)
{
struct ib_cqe *cqe = wc->wr_cqe;
struct rpcrdma_mr *mr = container_of(cqe, struct rpcrdma_mr, mr_cqe);
+ struct rpcrdma_req *req = mr->mr_req;
/* WARNING: Only wr_cqe and status are reliable at this point */
trace_xprtrdma_wc_li_wake(wc, &mr->mr_cid);
frwr_mr_done(wc, mr);
- complete(&mr->mr_linv_done);
+ complete(&req->rl_linv_done);
rpcrdma_flush_disconnect(cq->cq_context, wc);
}
/**
- * frwr_unmap_sync - invalidate memory regions that were registered for @req
+ * frwr_unmap_sync - synchronously invalidate MRs registered for @req
* @r_xprt: controlling transport instance
- * @req: rpcrdma_req with a non-empty list of MRs to process
+ * @req: request whose registered MRs are to be invalidated
*
- * Sleeps until it is safe for the host CPU to access the previously mapped
- * memory regions. This guarantees that registered MRs are properly fenced
- * from the server before the RPC consumer accesses the data in them. It
- * also ensures proper Send flow control: waking the next RPC waits until
- * this RPC has relinquished all its Send Queue entries.
+ * If @req still owns registered MRs after synchronizing with transport
+ * disconnect, post a chain of LOCAL_INV Work Requests and wait for the
+ * final completion. On successful completion, this fences the mapped
+ * regions from remote access and preserves Send Queue flow control.
+ *
+ * A concurrent disconnect can reset @req while this function waits for
+ * the read side. In that case the MRs have already been released and no
+ * LOCAL_INV Work Requests are posted.
+ *
+ * Context: Process context. Takes and releases
+ * @r_xprt->rx_unmap_rwsem for read. May sleep.
*/
void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
{
struct ib_send_wr *first, **prev, *last;
- struct rpcrdma_ep *ep = r_xprt->rx_ep;
const struct ib_send_wr *bad_wr;
+ struct rpcrdma_ep *ep;
struct rpcrdma_mr *mr;
int rc;
+ /* serialize against rpcrdma_xprt_disconnect() */
+ down_read(&r_xprt->rx_unmap_rwsem);
+
+ /*
+ * Disconnect can reset this request while we wait for the read side.
+ * Recheck rl_registered in case rx_ep now refers to a new connection.
+ */
+ ep = r_xprt->rx_ep;
+ if (!ep || list_empty(&req->rl_registered)) {
+ up_read(&r_xprt->rx_unmap_rwsem);
+ return;
+ }
+
/* ORDER: Invalidate all of the MRs first
*
* Chain the LOCAL_INV Work Requests and post them with
@@ -528,37 +551,35 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
prev = &last->next;
} while ((mr = rpcrdma_mr_pop(&req->rl_registered)));
- mr = container_of(last, struct rpcrdma_mr, mr_invwr);
-
/* Strong send queue ordering guarantees that when the
* last WR in the chain completes, all WRs in the chain
* are complete.
*/
last->wr_cqe->done = frwr_wc_localinv_wake;
- reinit_completion(&mr->mr_linv_done);
+ reinit_completion(&req->rl_linv_done);
- /* Transport disconnect drains the receive CQ before it
- * replaces the QP. The RPC reply handler won't call us
- * unless re_id->qp is a valid pointer.
+ /*
+ * The read side prevents disconnect from draining this QP until the
+ * LOCAL_INV chain has been submitted.
*/
bad_wr = NULL;
rc = ib_post_send(ep->re_id->qp, first, &bad_wr);
+ if (rc) {
+ /* On error, the MRs get destroyed once the QP has drained. */
+ trace_xprtrdma_post_linv_err(req, rc);
+
+ /* Force a connection loss to ensure complete recovery.
+ */
+ rpcrdma_force_disconnect(ep);
+ }
+ up_read(&r_xprt->rx_unmap_rwsem);
/* The final LOCAL_INV WR in the chain is supposed to
* do the wake. If it was never posted, the wake will
* not happen, so don't wait in that case.
*/
if (bad_wr != first)
- wait_for_completion(&mr->mr_linv_done);
- if (!rc)
- return;
-
- /* On error, the MRs get destroyed once the QP has drained. */
- trace_xprtrdma_post_linv_err(req, rc);
-
- /* Force a connection loss to ensure complete recovery.
- */
- rpcrdma_force_disconnect(ep);
+ wait_for_completion(&req->rl_linv_done);
}
/**
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 6d588840cc24c..a616a6ed84bbf 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -374,6 +374,8 @@ xprt_setup_rdma(struct xprt_create *args)
INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
xprt_rdma_connect_worker);
+ init_rwsem(&new_xprt->rx_unmap_rwsem);
+
xprt->max_payload = RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT;
return xprt;
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 6a1ed28ba3d77..650798c02c1ea 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -559,20 +559,24 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
* rpcrdma_xprt_disconnect - Disconnect underlying transport
* @r_xprt: controlling transport instance
*
- * Caller serializes. Either the transport send lock is held,
- * or we're being called to destroy the transport.
+ * Context: Caller serializes. Either the transport send lock is held,
+ * or the transport is being destroyed. Takes and releases
+ * @r_xprt->rx_unmap_rwsem for write. May sleep.
*
* On return, @r_xprt is completely divested of all hardware
* resources and prepared for the next ->connect operation.
*/
void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
{
- struct rpcrdma_ep *ep = r_xprt->rx_ep;
+ struct rpcrdma_ep *ep;
struct rdma_cm_id *id;
int rc;
+ down_write(&r_xprt->rx_unmap_rwsem);
+
+ ep = r_xprt->rx_ep;
if (!ep)
- return;
+ goto out_unlock;
/* Prevent teardown-generated events from requesting another close. */
atomic_xchg(&ep->re_force_disconnect, 1);
@@ -591,6 +595,9 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
rdma_destroy_id(id);
r_xprt->rx_ep = NULL;
+
+out_unlock:
+ up_write(&r_xprt->rx_unmap_rwsem);
}
/* Fixed-size circular FIFO queue. This implementation is wait-free and
@@ -899,6 +906,7 @@ struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt,
INIT_LIST_HEAD(&req->rl_free_mrs);
INIT_LIST_HEAD(&req->rl_registered);
+ init_completion(&req->rl_linv_done);
spin_lock(&buffer->rb_lock);
list_add(&req->rl_all, &buffer->rb_allreqs);
spin_unlock(&buffer->rb_lock);
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 2cb4eea4e00c0..31d8d62ef6068 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -46,6 +46,7 @@
#include <linux/spinlock.h> /* spinlock_t, etc */
#include <linux/atomic.h> /* atomic_t, etc */
#include <linux/kref.h> /* struct kref */
+#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/workqueue.h> /* struct work_struct */
#include <linux/llist.h>
@@ -246,7 +247,6 @@ struct rpcrdma_mr {
int mr_nents;
enum dma_data_direction mr_dir;
struct ib_cqe mr_cqe;
- struct completion mr_linv_done;
union {
struct ib_reg_wr mr_regwr;
struct ib_send_wr mr_invwr;
@@ -329,6 +329,7 @@ struct rpcrdma_req {
struct list_head rl_free_mrs;
struct list_head rl_registered;
struct rpcrdma_mr_seg rl_segments[RPCRDMA_MAX_SEGS];
+ struct completion rl_linv_done;
};
static inline struct rpcrdma_req *
@@ -430,6 +431,13 @@ struct rpcrdma_xprt {
struct delayed_work rx_connect_worker;
struct rpc_timeout rx_timeout;
struct rpcrdma_stats rx_stats;
+
+ /*
+ * Orders frwr_unmap_sync()'s LOCAL_INV submission ahead of the
+ * QP drain. Disconnect holds the write side across the drain
+ * and resource teardown.
+ */
+ struct rw_semaphore rx_unmap_rwsem;
};
#define rpcx_to_rdmax(x) container_of(x, struct rpcrdma_xprt, rx_xprt)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0669/1059] tcp: do not coalesce segments after FIN
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (667 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0668/1059] xprtrdma: serialize unmap_sync with xprt_disconnect Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0670/1059] net: gro: do not undo remote checksum offload on merged packets Greg Kroah-Hartman
` (329 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyunwoo Kim, Eric Dumazet,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <imv4bel@gmail.com>
[ Upstream commit 1c46780dec48893b8c25fd5e33a3127e8dc39dd4 ]
A FIN consumes a sequence number. If another FIN segment is coalesced
into an skb that already carries FIN, end_seq advances to account for
the additional FIN, but tcp_flags still contains only one FIN bit.
When the preceding gap is filled and tcp_ofo_queue() processes the
coalesced skb, rcv_nxt advances to the skb's end_seq. When the receive
path consumes all data in the skb, copied_seq advances by the data
length and one sequence number for FIN. If three or more FIN segments
have been coalesced into one skb, tcp_inq() can still return a positive
value after the receive queue becomes empty and the SOCK_DONE adjustment
is applied.
TCP_ZEROCOPY_RECEIVE is another consumer affected by this state.
tcp_zerocopy_receive() takes its length from tcp_inq() and follows
skb->next without checking for the end of the receive queue.
Software kTLS receive is one consumer affected by this state. When
strp->copy_mode is false, tls_strp_msg_consume() calls the TCP helper
tcp_read_done() to consume the current TLS record. In the reproducer,
tcp_read_done() consumed the record data and one FIN before freeing the
receive skb.
When kTLS looked for the next record, tcp_inq() reported at least
TLS_HEADER_SIZE bytes even though the receive queue was empty.
tcp_recv_skb() returned NULL, so tls_strp_load_anchor_with_queue() hit
WARN_ON_ONCE() and returned without updating the anchor.
Since tcp_inq() had reported at least TLS_HEADER_SIZE,
tls_strp_read_sock() proceeded to tls_strp_check_queue_ok().
skb_shinfo(strp->anchor)->frag_list still pointed to the freed receive
skb. tls_strp_check_queue_ok() then read TCP_SKB_CB(first)->seq through
the stale pointer, causing a use-after-free.
The reproducer followed this call path:
tls_rx_rec_done()
tls_strp_msg_consume()
tcp_read_done() // frees the receive skb
tls_strp_check_rcv()
tls_strp_read_sock()
tls_strp_load_anchor_with_queue() // returns after WARN_ON_ONCE()
tcp_recv_skb() == NULL
tls_strp_check_queue_ok()
TCP_SKB_CB(first)->seq // reads the freed receive skb
KASAN reported:
BUG: KASAN: slab-use-after-free in tls_strp_check_queue_ok.isra.0+0x5f/0x100
Read of size 4 at addr ffff888103169ca8 by task ktls-server/71
...
Call Trace:
<TASK>
...
tls_strp_check_queue_ok.isra.0+0x5f/0x100
tls_strp_check_rcv+0x2a9/0x400
...
tls_sw_recvmsg+0x3ce/0xa10
...
sock_recvmsg+0xea/0x100
__sys_recvfrom+0x142/0x1f0
...
__x64_sys_recvfrom+0x76/0x90
do_syscall_64+0xdd/0x4a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
...
</TASK>
...
Freed by task 71:
...
napi_skb_cache_put+0x24/0xf0
skb_attempt_defer_free+0x183/0x3b0
tcp_read_done+0x2d4/0x340
tls_strp_msg_consume+0x45/0x80
tls_sw_recvmsg+0x3c4/0xa10
...
In tcp_try_coalesce(), skip coalescing when the destination skb already
carries FIN. tcp_add_backlog() calls skb_try_coalesce() directly instead
of using this helper, so add the same check there. Since both paths check
only the destination skb, a final segment carrying data and FIN can still
be coalesced into an skb without FIN when the other coalescing checks pass.
Fixes: e93a0435f809 ("tcp: allow segment with FIN in tcp_try_coalesce()")
Fixes: 4f693b55c3d2 ("tcp: implement coalescing on backlog queue")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/au3HMfqNW3_DRMqS@v4bel
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: adjusted context for older tree: CONFIG_TLS_DEVICE guard and mptcp_skb_can_collapse() instead of tcp_skb_can_collapse_rx(), and tcp_add_backlog() returns bool with a different signature. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 4 ++++
net/ipv4/tcp_ipv4.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 63fb1d5372030..cb55dddce3907 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4808,6 +4808,10 @@ static bool tcp_try_coalesce(struct sock *sk,
return false;
#endif
+ /* Nothing follows a FIN. */
+ if (unlikely(TCP_SKB_CB(to)->tcp_flags & TCPHDR_FIN))
+ return false;
+
if (!skb_try_coalesce(to, from, fragstolen, &delta))
return false;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c88228c76920d..4346e629e48a0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1832,6 +1832,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb,
#ifdef CONFIG_TLS_DEVICE
tail->decrypted != skb->decrypted ||
#endif
+ /* Nothing follows a FIN, see tcp_try_coalesce() */
+ (TCP_SKB_CB(tail)->tcp_flags & TCPHDR_FIN) ||
!mptcp_skb_can_collapse(tail, skb) ||
thtail->doff != th->doff ||
memcmp(thtail + 1, th + 1, hdrlen - sizeof(*th)))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0670/1059] net: gro: do not undo remote checksum offload on merged packets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (668 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0669/1059] tcp: do not coalesce segments after FIN Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0671/1059] net: wait for in-flight device unregistrations before netns dismantle Greg Kroah-Hartman
` (328 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit c817ec1b06875b98460fbd19591be541bc3fa924 ]
skb_gro_flush_final_remcsum() calls skb_gro_remcsum_cleanup() to undo
the checksum adjustment done by skb_gro_remcsum_process() when the
packet was not consumed by GRO.
When the inner handler merged the packet (NAPI_GRO_CB(skb)->same_flow
is set), grc->offset can no longer be trusted:
- skb_gro_receive() either gives the frags or the head of the skb
to the held packet, or uses __skb_pull(skb, offset) before adding
the skb to the frag_list of the held packet.
- skb_gro_receive_list() uses skb_pull(skb, skb_gro_offset(skb)).
grc->offset is relative to the original skb->data, so the 2-byte
read-modify-write done by skb_gro_remcsum_cleanup() can land in
the payload of a packet which now belongs to the GRO packet.
pskb_may_pull() can also be called on this frag_list member.
With fraglist GRO, this can also be a use-after-free:
pskb_may_pull(skb, skb_gro_offset(skb)) in skb_gro_receive_list()
or udp_gro_receive_segment() releases the first page fragment if it
only contains headers. NAPI_GRO_CB(skb)->frag0 and frag0_len are not
updated, so skb_gro_remcsum_cleanup() takes the fast path and writes
through frag0 into a page the skb no longer holds a reference on.
The non merged case, where frag0 is used after this pull, is handled
in the following patch.
For skbs merged by skb_gro_receive(), the cleanup can be skipped:
the skb is freed, or its headers are rebuilt from the head skb in
skb_segment().
Fraglist members keep their own inner headers, as skb_segment_list()
only copies the link-layer and tunnel headers from the head skb.
Their checksum can not be right in all cases: a packet forwarded with
its tunnel header needs the original value, while a VXLAN packet
decapsulated locally needs the adjusted one, as vxlan_remcsum() only
adjusts the head skb. Make skb_gro_receive_list() refuse packets with
skb->remcsum_offload set, so that fraglist members never carry an
adjusted checksum.
This affects VXLAN (VXLAN_F_REMCSUM_NOPARTIAL) and GUE
(FOU_F_REMCSUM_NOPARTIAL).
This was found while fixing a report from Taesoo Kim and Cen Zhang,
who used LLM assisted code analysis and provided reproducers.
Fixes: 26c4f7da3e41 ("net: Fix remcsum in GRO path to not change packet")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104151042.1157782-2-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Dropped the early pskb_may_pull() check from the context in skb_gro_receive_list(); the hunk context here is the frag_list assignment instead. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/gro.h | 8 +++++++-
net/core/gro.c | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/net/gro.h b/include/net/gro.h
index cc12df2009978..09919434b0ca8 100644
--- a/include/net/gro.h
+++ b/include/net/gro.h
@@ -334,7 +334,13 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
void *ptr;
size_t plen = grc->offset + sizeof(u16);
- if (!grc->delta)
+ /* Once merged, grc->offset can not be trusted: the frags or head
+ * of this skb now belong to the GRO packet, or skb->data was pulled
+ * past the headers before adding it to a frag_list.
+ * skb_gro_receive_list() does not merge packets with an adjusted
+ * checksum, other merged packets do not use their headers anymore.
+ */
+ if (!grc->delta || NAPI_GRO_CB(skb)->same_flow)
return;
ptr = skb_gro_header(skb, plen, grc->offset);
diff --git a/net/core/gro.c b/net/core/gro.c
index c71cb2ff960e4..c5656fe528aa2 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -307,6 +307,13 @@ int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
NAPI_GRO_CB(skb)->flush))
return -E2BIG;
+ /* Fraglist members keep their own headers. Their checksum can not
+ * be right both for a forwarded packet and for a decapsulated one,
+ * if remote checksum offload adjusted it.
+ */
+ if (unlikely(skb->remcsum_offload))
+ return -EINVAL;
+
if (NAPI_GRO_CB(p)->last == p)
skb_shinfo(p)->frag_list = skb;
else
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0671/1059] net: wait for in-flight device unregistrations before netns dismantle
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (669 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0670/1059] net: gro: do not undo remote checksum offload on merged packets Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0672/1059] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit Greg Kroah-Hartman
` (327 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+1269fe6cc2016008124e,
Henry Martin, Eric Dumazet, Naman Gulati, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit c164a431a646983275d0076ff5b0e4c326fbc10b ]
A device can be unregistered by a context other than the cleanup_net()
of its own netns, for instance a veth whose peer in another netns is
deleted. If references on it are still held, it stays in
netdev_wait_allrefs_any(), which rebroadcasts NETDEV_UNREGISTER every
second.
Meanwhile its netns can be dismantled: default_device_exit_batch()
only takes care of devices still listed in the netns, then pernet exit
handlers free their state, and finally struct net is freed while the
device still points to it.
The rebroadcasts then run notifiers against torn down pernet state, or
freed memory. Three instances were reported so far:
- netdev_genl_netdevice_event(): net->genl_sock is NULL [1]
- nh_netdev_event(): net->nexthop.devhash is NULL [2]
- nf_tables netdevice notifiers: use-after-free of the nftables
pernet storage [3]
but any notifier using dev_net(dev) is affected, as is
netdev_wait_allrefs_any() itself (__rtnl_net_lock(dev_net(dev)) with
CONFIG_DEBUG_NET_SMALL_RTNL=y).
This was prevented by rtnl_lock_unregistering() until I removed it
in commit 8a4fc54b07d7 ("net: get rid of rtnl_lock_unregistering()"),
considering only the loopback dependency, and missing the notifiers one.
Restore a per-netns counter of devices sitting in netdev_run_todo(),
and make default_device_exit_batch() wait for it to reach zero, after
it has unregistered all devices of the dying netns(es). At this point
no new unregistration can be started for these netns.
Unlike the old barrier, this only waits for devices of the netns being
dismantled and runs after their own devices are gone.
Tested on a KASAN kernel with a debug-only hack holding a reference
on a veth device for 5 seconds after its unregistration: a nexthop
on the veth in netns X, delete its peer from init_net, then delete X.
Without this patch, the nexthop_flush_dev() null-ptr-deref from [2]
triggers. With it, no splat; netns churn and dismantle of a netns
whose own device is held still work.
[1] https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/
[2] https://lore.kernel.org/netdev/20261105114707.3030737-1-bsdhenrymartin@gmail.com/
[3] https://lore.kernel.org/netdev/20261105114817.3033625-1-bsdhenrymartin@gmail.com/
Fixes: 8a4fc54b07d7 ("net: get rid of rtnl_lock_unregistering()")
Cc: stable@vger.kernel.org
Reported-by: syzbot+1269fe6cc2016008124e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/
Reported-by: Henry Martin <bsdhenrymartin@gmail.com>
Closes: https://lore.kernel.org/netdev/20261105114707.3030737-1-bsdhenrymartin@gmail.com/
Closes: https://lore.kernel.org/netdev/20261105114817.3033625-1-bsdhenrymartin@gmail.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Naman Gulati <namangulati@google.com>
Link: https://patch.msgid.link/20261105144543.1624238-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adapted to the older per-netns dev_unreg_count and existing helpers, so no new dev_unreg_pending field is added and net_unreg_done() reuses the existing counter and wakeup. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index a06af07f9d369..e41dd9c18cc2d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9729,6 +9729,13 @@ static void net_set_todo(struct net_device *dev)
atomic_inc(&dev_net(dev)->dev_unreg_count);
}
+/* Paired with net_set_todo(). @net must not be used after this call. */
+static void net_unreg_done(struct net *net)
+{
+ if (atomic_dec_and_test(&net->dev_unreg_count))
+ wake_up(&netdev_unregistering_wq);
+}
+
static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
struct net_device *upper, netdev_features_t features)
{
@@ -10579,6 +10586,7 @@ void netdev_run_todo(void)
if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
netdev_WARN(dev, "run_todo but not unregistering\n");
list_del(&dev->todo_list);
+ net_unreg_done(dev_net(dev));
continue;
}
@@ -10589,8 +10597,11 @@ void netdev_run_todo(void)
}
while (!list_empty(&list)) {
+ struct net *net;
+
dev = netdev_wait_allrefs_any(&list);
list_del(&dev->todo_list);
+ net = dev_net(dev);
/* paranoia */
BUG_ON(netdev_refcnt_read(dev) != 1);
@@ -10605,11 +10616,10 @@ void netdev_run_todo(void)
if (dev->needs_free_netdev)
free_netdev(dev);
- if (atomic_dec_and_test(&dev_net(dev)->dev_unreg_count))
- wake_up(&netdev_unregistering_wq);
-
/* Free network device */
kobject_put(&dev->dev.kobj);
+
+ net_unreg_done(net);
}
}
@@ -11574,6 +11584,17 @@ static void __net_exit default_device_exit_net(struct net *net)
}
}
+static bool __net_exit netns_dev_unreg_pending(const struct list_head *net_list)
+{
+ struct net *net;
+
+ list_for_each_entry(net, net_list, exit_list) {
+ if (atomic_read(&net->dev_unreg_count))
+ return true;
+ }
+ return false;
+}
+
static void __net_exit default_device_exit_batch(struct list_head *net_list)
{
/* At exit all network devices most be removed from a network
@@ -11601,6 +11622,16 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list)
}
unregister_netdevice_many(&dev_kill_list);
rtnl_unlock();
+
+ /* Devices of these netns unregistered from another context
+ * (e.g. a veth whose peer was deleted) can still be waiting
+ * in netdev_run_todo() for their last references, while
+ * NETDEV_UNREGISTER is rebroadcast for them. Wait for them
+ * before pernet exit handlers tear down the state used by
+ * netdevice notifiers, and before the netns is freed.
+ * No new unregistration can start: all devices are unlisted.
+ */
+ wait_event(netdev_unregistering_wq, !netns_dev_unreg_pending(net_list));
}
static struct pernet_operations __net_initdata default_device_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0672/1059] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (670 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0671/1059] net: wait for in-flight device unregistrations before netns dismantle Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0673/1059] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
` (326 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Phat Dinh, Peter Zijlstra (Intel),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phat Dinh <phatdt1116@gmail.com>
[ Upstream commit 59f1398140869432c7171b9a2a279ca315467c4e ]
perf_cgroup_switch() relies on:
/*
* cpuctx->cgrp is set when the first cgroup event enabled,
* and is cleared when the last cgroup event disabled.
*/
It computes the next task's cgroup, schedules out the CPU context and
then assigns cpuctx->cgrp unconditionally:
ctx_sched_out(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP);
/*
* must not be done before ctxswout due
* to update_cgrp_time_from_cpuctx() in
* ctx_sched_out()
*/
cpuctx->cgrp = cgrp;
However, ctx_sched_out() can disable events itself. If a cgroup event
has a pending disable from perf_event_disable_inatomic() (e.g. its
PERF_EVENT_IOC_REFRESH limit ran out) that the irq_work has not
handled yet, event_sched_out() consumes it inline:
if (event->pending_disable) {
event->pending_disable = 0;
perf_cgroup_event_disable(event, ctx);
state = PERF_EVENT_STATE_OFF;
}
If that was the last cgroup event, perf_cgroup_event_disable() clears
cpuctx->cgrp:
if (--ctx->nr_cgroups)
return;
cpuctx->cgrp = NULL;
and perf_cgroup_switch() then sets it again. cpuctx->cgrp is left
non-NULL with ctx.nr_cgroups == 0, so the NULL check in
perf_cgroup_switch() no longer catches it and the next switch trips:
WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
cpuctx->cgrp does not hold a reference on the cgroup. Once that cgroup
is removed, the next ctx_sched_in() dereferences the stale pointer:
BUG: KASAN: slab-use-after-free in ctx_sched_in+0xb1f/0xfa0
Read of size 8 at addr ffff8881008972d0 by task swapper/3/0
Tainted: [W]=WARN
Call Trace:
<IRQ>
ctx_sched_in+0xb1f/0xfa0
perf_event_sched_in+0x1a/0x70
ctx_resched+0x32b/0xac0
__perf_install_in_context+0x475/0xab0
remote_function+0x105/0x200
__flush_smp_call_function_queue+0x179/0x8d0
__sysvec_call_function_single+0x1b/0x1c0
sysvec_call_function_single+0x66/0x80
</IRQ>
<TASK>
asm_sysvec_call_function_single+0x1a/0x20
Only assign cpuctx->cgrp when cgroup events remain after the context
has been scheduled out, so that it stays NULL as the invariant
requires.
Fixes: e19cd0b6fa59 ("perf/core: Always set cpuctx cgrp when enable cgroup event")
Signed-off-by: Phat Dinh <phatdt1116@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261106101642.494674-1-phatdt1116@gmail.com
[ sashal: Adjusted context for the older scheduler call cpu_ctx_sched_out(cpuctx, EVENT_ALL) and indented the guarded cpuctx->cgrp assignment one extra level to match this tree's loop. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/events/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index ca5009e11b022..135cddab253ec 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -857,8 +857,13 @@ static void perf_cgroup_switch(struct task_struct *task)
* must not be done before ctxswout due
* to update_cgrp_time_from_cpuctx() in
* ctx_sched_out()
+ *
+ * ctx_sched_out() can consume a pending disable and drop the last cgroup
+ * event, which clear the cpuctx->cgrp. Cgroup tracking follow active cgroup
+ * event, so do not resurrect it
*/
- cpuctx->cgrp = cgrp;
+ if (cpuctx->ctx.nr_cgroups)
+ cpuctx->cgrp = cgrp;
/*
* set cgrp before ctxsw in to allow
* perf_cgroup_set_timestamp() in ctx_sched_in()
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0673/1059] Bluetooth: L2CAP: Only accept LE responses to outstanding requests
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (671 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0672/1059] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0674/1059] crypto: caam - reject overlong RSA CRT parameters Greg Kroah-Hartman
` (325 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz,
Sasha Levin
6.1-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: adapted to older code: dropped __must_hold/lockdep annotations, kept explicit chan lock/hold handling, and used a stack pdu struct with sizeof(pdu) in the ecred reconfigure request. ]
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 9ba36d4a06cb7..b6a366b1af776 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -746,6 +746,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 a9cfdae8ca935..1d5365b14ec3c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -149,23 +149,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
@@ -177,7 +166,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;
@@ -4879,7 +4868,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;
@@ -5422,9 +5411,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);
@@ -5639,23 +5629,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);
@@ -5669,25 +5660,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;
}
@@ -7527,6 +7526,7 @@ static void l2cap_ecred_reconfigure(struct l2cap_chan *chan)
pdu.scid = 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,
sizeof(pdu), &pdu);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0674/1059] crypto: caam - reject overlong RSA CRT parameters
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (672 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0673/1059] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0675/1059] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler() Greg Kroah-Hartman
` (324 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean,
Sahil Malhotra, Herbert Xu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
[ Upstream commit 828c3b265b6df877dced3dde56ea41daa2e6181e ]
caam_read_rsa_crt() right-aligns dP, dQ, and qInv in buffers sized
from the corresponding prime. rsa_parse_priv_key() only bounds these
integers against n, so a malformed key can provide, for example, a
two-byte dP with a one-byte p. dstlen - nbytes then underflows and
memcpy() writes outside the allocation during set_priv_key(). KASAN
reports a slab-out-of-bounds write in caam_read_rsa_crt().
Reject empty or overlong CRT parameters after stripping leading zeros.
qInv is consumed by CAAM as a p-sized value, so size it from p rather
than q to match the DMA mapping in set_rsa_priv_f3_pdb(). Let the
top-level key cleanup handle partial form-3 allocations and return the
specific error to the caller.
Also test nbytes before dereferencing it while stripping zeros, so an
all-zero integer does not read one byte beyond its input.
Fixes: 4a651b122adb ("crypto: caam - add support for RSA key form 3")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: adapted caam_read_rsa_crt() fix to keep GFP_DMA allocations and omit aligned_size handling, which this tree lacks. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/caam/caampkc.c | 75 ++++++++++++++---------------------
1 file changed, 30 insertions(+), 45 deletions(-)
diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c
index 677e0860aeec8..f7d5c8d6aeaf9 100644
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -875,7 +875,7 @@ static void caam_rsa_free_key(struct caam_rsa_key *key)
static void caam_rsa_drop_leading_zeros(const u8 **ptr, size_t *nbytes)
{
- while (!**ptr && *nbytes) {
+ while (*nbytes && !**ptr) {
(*ptr)++;
(*nbytes)--;
}
@@ -891,22 +891,22 @@ static void caam_rsa_drop_leading_zeros(const u8 **ptr, size_t *nbytes)
* @ptr : pointer to {dP, dQ, qInv} CRT member
* @nbytes: length in bytes of {dP, dQ, qInv} CRT member
* @dstlen: length in bytes of corresponding p or q prime factor
+ * @dst : pointer to the zero-padded output buffer
*/
-static u8 *caam_read_rsa_crt(const u8 *ptr, size_t nbytes, size_t dstlen)
+static int caam_read_rsa_crt(const u8 *ptr, size_t nbytes, size_t dstlen,
+ u8 **dst)
{
- u8 *dst;
-
caam_rsa_drop_leading_zeros(&ptr, &nbytes);
- if (!nbytes)
- return NULL;
+ if (!nbytes || nbytes > dstlen)
+ return -EINVAL;
- dst = kzalloc(dstlen, GFP_DMA | GFP_KERNEL);
- if (!dst)
- return NULL;
+ *dst = kzalloc(dstlen, GFP_DMA | GFP_KERNEL);
+ if (!*dst)
+ return -ENOMEM;
- memcpy(dst + (dstlen - nbytes), ptr, nbytes);
+ memcpy(*dst + (dstlen - nbytes), ptr, nbytes);
- return dst;
+ return 0;
}
/**
@@ -985,6 +985,7 @@ static int caam_rsa_set_priv_key_form(struct caam_rsa_ctx *ctx,
struct caam_rsa_key *rsa_key = &ctx->key;
size_t p_sz = raw_key->p_sz;
size_t q_sz = raw_key->q_sz;
+ int ret;
rsa_key->p = caam_read_raw_data(raw_key->p, &p_sz);
if (!rsa_key->p)
@@ -993,55 +994,37 @@ static int caam_rsa_set_priv_key_form(struct caam_rsa_ctx *ctx,
rsa_key->q = caam_read_raw_data(raw_key->q, &q_sz);
if (!rsa_key->q)
- goto free_p;
+ return -ENOMEM;
rsa_key->q_sz = q_sz;
rsa_key->tmp1 = kzalloc(raw_key->p_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->tmp1)
- goto free_q;
+ return -ENOMEM;
rsa_key->tmp2 = kzalloc(raw_key->q_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->tmp2)
- goto free_tmp1;
+ return -ENOMEM;
rsa_key->priv_form = FORM2;
- rsa_key->dp = caam_read_rsa_crt(raw_key->dp, raw_key->dp_sz, p_sz);
- if (!rsa_key->dp)
- goto free_tmp2;
+ ret = caam_read_rsa_crt(raw_key->dp, raw_key->dp_sz, p_sz,
+ &rsa_key->dp);
+ if (ret)
+ return ret;
- rsa_key->dq = caam_read_rsa_crt(raw_key->dq, raw_key->dq_sz, q_sz);
- if (!rsa_key->dq)
- goto free_dp;
+ ret = caam_read_rsa_crt(raw_key->dq, raw_key->dq_sz, q_sz,
+ &rsa_key->dq);
+ if (ret)
+ return ret;
- rsa_key->qinv = caam_read_rsa_crt(raw_key->qinv, raw_key->qinv_sz,
- q_sz);
- if (!rsa_key->qinv)
- goto free_dq;
+ ret = caam_read_rsa_crt(raw_key->qinv, raw_key->qinv_sz, p_sz,
+ &rsa_key->qinv);
+ if (ret)
+ return ret;
rsa_key->priv_form = FORM3;
return 0;
-
-free_dq:
- kfree_sensitive(rsa_key->dq);
- rsa_key->dq = NULL;
-free_dp:
- kfree_sensitive(rsa_key->dp);
- rsa_key->dp = NULL;
-free_tmp2:
- kfree_sensitive(rsa_key->tmp2);
- rsa_key->tmp2 = NULL;
-free_tmp1:
- kfree_sensitive(rsa_key->tmp1);
- rsa_key->tmp1 = NULL;
-free_q:
- kfree_sensitive(rsa_key->q);
- rsa_key->q = NULL;
-free_p:
- kfree_sensitive(rsa_key->p);
- rsa_key->p = NULL;
- return -ENOMEM;
}
static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
@@ -1059,6 +1042,8 @@ static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
if (ret)
return ret;
+ ret = -ENOMEM;
+
/* Copy key in DMA zone */
rsa_key->d = kmemdup(raw_key.d, raw_key.d_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->d)
@@ -1095,7 +1080,7 @@ static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
err:
caam_rsa_free_key(rsa_key);
- return -ENOMEM;
+ return ret;
}
static unsigned int caam_rsa_max_size(struct crypto_akcipher *tfm)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0675/1059] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (673 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0674/1059] crypto: caam - reject overlong RSA CRT parameters Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0676/1059] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
` (323 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Andrea Parri,
Peter Zijlstra (Intel), Ingo Molnar, Waiman Long, Kayra Cizmeci,
Juri Lelli, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
[ Upstream commit f7141257dd67d4936f906a6cfd1d0007721f6898 ]
A sched_setattr() with SCHED_FLAG_KEEP_POLICY on a SCHED_DEADLINE task
unlocks cpuset_mutex twice if the task's policy changes concurrently:
WARNING: bad unlock balance detected!
7.4.0-rc1 #1 Not tainted
-------------------------------------
repro/126 is trying to release lock (cpuset_mutex) at:
[<ffffffff9a17cacc>] __sched_setscheduler+0x9cc/0xc40
but there are no more locks to release!
...
Call Trace:
print_unlock_imbalance_bug.part.0+0xfb/0x110
lock_release+0x286/0x2e0
__mutex_unlock_slowpath+0x1a/0x400
__sched_setscheduler+0x9cc/0xc40
__x64_sys_sched_setattr+0xa3/0x1b0
do_syscall_64+0x106/0x5f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
__sched_setscheduler() samples p->policy before taking any lock, and
restarts from the recheck label if p->policy differs under the rq lock.
The restart drops cpuset_mutex but leaves cpuset_locked set, so a pass
that no longer needs the mutex still unlocks it on its way out:
CPU 1 CPU 2
__sched_setscheduler(KEEP_POLICY)
policy = p->policy /* DEADLINE */
__sched_setscheduler(SCHED_OTHER)
p->policy = SCHED_OTHER
cpuset_locked = true
cpuset_lock()
rq = task_rq_lock(p)
oldpolicy != p->policy
cpuset_unlock()
goto recheck
/* no cpuset_lock() this time */
...
if (cpuset_locked)
cpuset_unlock()
Without CONFIG_DEBUG_MUTEXES, or CONFIG_DEBUG_RT_MUTEXES on PREEMPT_RT,
nothing warns. The second unlock still clears the owner field regardless
of who holds the mutex, so another task can lose cpuset_mutex inside its
critical section. Entering SCHED_DEADLINE needs CAP_SYS_NICE, but a
racing caller that owns the task does not need it if it samples a policy
other than SCHED_DEADLINE.
Clear cpuset_locked when dropping the mutex for the restart. This should be
safe because the flag is only tested on the paths leaving the next pass,
after that pass has set it again if it took the mutex.
The following program, run as root, reproduces the splat, which no longer
appears with this applied. On PREEMPT_RT it crashes the kernel within
seconds, which this also fixes:
#define _GNU_SOURCE
#include <pthread.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
};
static volatile int stop;
static volatile pid_t target;
static void set(struct attr a)
{
a.size = sizeof(a);
syscall(SYS_sched_setattr, target, &a, 0);
}
static void *sleeper(void *arg)
{
target = syscall(SYS_gettid);
while (!stop)
usleep(1000);
return arg;
}
static void *switcher(void *arg)
{
while (!stop) {
/* SCHED_DEADLINE, 2us every 1s */
set((struct attr){ .policy = 6, .runtime = 2000,
.deadline = 1000000000,
.period = 1000000000 });
set((struct attr){ .policy = 0 }); /* SCHED_OTHER */
}
return arg;
}
static void *racer(void *arg)
{
/* KEEP_POLICY | KEEP_PARAMS */
while (!stop)
set((struct attr){ .flags = 0x18 });
return arg;
}
int main(void)
{
pthread_t t[5];
int i;
pthread_create(&t[0], NULL, sleeper, NULL);
while (!target)
usleep(100);
pthread_create(&t[1], NULL, switcher, NULL);
for (i = 2; i < 5; i++)
pthread_create(&t[i], NULL, racer, NULL);
sleep(30);
stop = 1;
for (i = 0; i < 5; i++)
pthread_join(t[i], NULL);
return 0;
}
An LLM helped find the PREEMPT_RT crash and write this patch and its test.
Fixes: 111cd11bbc54 ("sched/cpuset: Bring back cpuset_mutex")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20261016062629.2102883-1-sh_def%40163.com
Link: https://patch.msgid.link/20261102134606.242743-1-parri.andrea@gmail.com
[ sashal: adjusted the file path and function context from kernel/sched/syscalls.c to kernel/sched/core.c, where __sched_setscheduler() is static in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cf470ac63af72..9a338369262b5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7673,8 +7673,10 @@ static int __sched_setscheduler(struct task_struct *p,
if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
policy = oldpolicy = -1;
task_rq_unlock(rq, p, &rf);
- if (cpuset_locked)
+ if (cpuset_locked) {
cpuset_unlock();
+ cpuset_locked = false;
+ }
goto recheck;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0676/1059] ksmbd: pin parent dentries in SMB2 CREATE ACL path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (674 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0675/1059] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0677/1059] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
` (322 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jiwoo Kim, Namjae Jeon,
Sasha Levin
6.1-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: Replaced idmap with user_ns throughout and dropped the <kunit/visibility.h> include, since this tree's smbacl.c has no KUnit hooks and the smbacl.c context lines differ. ]
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 70150e016e6f7..cd01774de5f0c 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3188,16 +3188,32 @@ int smb2_open(struct ksmbd_work *work)
if ((daccess & FILE_DELETE_LE) ||
(req->CreateOptions & FILE_DELETE_ON_CLOSE_LE)) {
- rc = inode_permission(user_ns,
- 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(user_ns, 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;
@@ -3251,10 +3267,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(user_ns,
- &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(user_ns, &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 cb434c7539e02..e021c6bf79682 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>
@@ -1184,7 +1185,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 user_namespace *user_ns = mnt_user_ns(path->mnt);
int inherited_flags = 0, flags = 0, i, ace_cnt = 0, nt_size = 0, pdacl_size;
int rc = 0, num_aces, pntsd_type, ppntsd_size, acl_len, aces_size;
@@ -1193,8 +1194,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, user_ns,
parent, &parent_pntsd);
+ dput(parent);
if (ppntsd_size <= 0)
return -ENOENT;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0677/1059] ksmbd: refuse to read a handle that is not open for reading
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (675 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0676/1059] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0678/1059] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
` (321 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wahid Khan, Ian Bridges, Namjae Jeon,
Sasha Levin
6.1-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: Adapted the posix check to the older !work->tcon->posix_extensions condition instead of !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 892ca634d1d66..1524454ef6de9 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -394,6 +394,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] 1065+ messages in thread* [PATCH 6.1 0678/1059] comedi: comedi_bond: Fix leak of opened device references
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (676 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0677/1059] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0679/1059] dm: fix infinite loop in dm_blk_do_report_zones() Greg Kroah-Hartman
` (320 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Wentao Liang, Ian Abbott,
Sasha Levin
6.1-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 78c39fa841776..076aecae2c776 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(sizeof(*bdev), GFP_KERNEL);
- 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(d);
+ if (nope < 0)
+ return nope;
+ }
}
if (!devpriv->nchans) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0679/1059] dm: fix infinite loop in dm_blk_do_report_zones()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (677 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0678/1059] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0680/1059] wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear Greg Kroah-Hartman
` (319 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Bundschuh, Mikulas Patocka,
Damien Le Moal, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Bundschuh <mkbund@amazon.com>
[ Upstream commit 648320de920b30ae1730bbf0e8b86c0df0fb490a ]
If the device underlying a zoned target is removed, its capacity is set
to 0 and blkdev_report_zones() returns 0 without reporting any zones.
The mapped device keeps its old capacity, so args->zone_idx and
args->next_sector never advance and dm_blk_do_report_zones() loops
forever. On non-preemptible kernels this causes soft lockups and RCU
stalls.
The following sequence of commands triggers the hang:
modprobe scsi_debug zbc=managed dev_size_mb=1024 zone_size_mb=64
udevadm settle
echo '0 2097152 linear /dev/sda 0' | dmsetup create lin
echo 1 > /sys/block/sda/device/delete
blkzone report -o 0 -c 1 /dev/mapper/lin
Fix this by returning -EIO when a target reports no zones. The target
always maps args->next_sector, so a zero return means the underlying
device no longer covers that sector.
Fixes: d41003513e61 ("block: rework zone reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
[ Context differs due to commit: fdb9aed869f3 ]
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-zone.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/md/dm-zone.c b/drivers/md/dm-zone.c
index 3dafc0e8b7a9d..354987f9e3ffc 100644
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -41,6 +41,8 @@ static int dm_blk_do_report_zones(struct mapped_device *md, struct dm_table *t,
nr_zones - args.zone_idx);
if (ret < 0)
return ret;
+ if (!ret)
+ return -EIO;
} while (args.zone_idx < nr_zones &&
args.next_sector < get_capacity(disk));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0680/1059] wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (678 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0679/1059] dm: fix infinite loop in dm_blk_do_report_zones() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0681/1059] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Greg Kroah-Hartman
` (318 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Felix Fietkau, Dickson Wu,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <nbd@nbd.name>
commit 6486e11a6e2f679597af2d5bb48c3b07a2b2a7ba upstream.
mt7915_remove_interface() cleared the wcid mask bit with no lock held and
before clearing the RCU wcid pointer. The mask is a non-atomic RMW shared
with the allocators, which all run under dev->mt76.mutex; on DBDC the two
wiphys share one mt76_dev, so this raced add_interface/sta_add on the
other band and could leak or double-hand-out a wcid. Clearing the bit
before the RCU pointer also let a concurrent allocation reuse the index
and publish its wcid, which the subsequent NULL assignment then wiped.
Move the clear into the existing mutex section, after the RCU pointer is
cleared.
Fixes: f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations")
Link: https://patch.msgid.link/20260722082610.2699628-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ adapted to 6.1.y: context only, older mt7915_mcu_add_sta() and sta_poll_lock ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index dde451d818ba4..6ed4c9879b6e1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -297,7 +297,6 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,
mt7915_mcu_add_bss_info(phy, vif, false);
mt7915_mcu_add_sta(dev, vif, NULL, false);
- mt76_wcid_mask_clear(dev->mt76.wcid_mask, mvif->sta.wcid.idx);
mutex_lock(&dev->mt76.mutex);
mt76_testmode_reset(phy->mt76, true);
@@ -313,6 +312,7 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,
mutex_lock(&dev->mt76.mutex);
dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
+ mt76_wcid_mask_clear(dev->mt76.wcid_mask, mvif->sta.wcid.idx);
mutex_unlock(&dev->mt76.mutex);
spin_lock_bh(&dev->sta_poll_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0681/1059] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (679 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0680/1059] wifi: mt76: mt7915: clear wcid mask under mutex after RCU pointer clear Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0682/1059] serial: sh-sci: Check that the DMA cookie is valid Greg Kroah-Hartman
` (317 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Salman Alghamdi, Luka Gejak,
Dickson Wu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salman Alghamdi <me@cipherat.com>
commit 88e994c57a79f62d5338231d8d37ee8dd98baffe upstream.
Add guards to ensure ie_length is large enough before subtracting
fixed IE offsets to prevent unsigned integer underflow.
Fixes: 2038fe84b8bd ("staging: rtl8723bs: fix spacing around operators")
Fixes: d3fcee1b78a5 ("staging: rtl8723bs: fix camel case in struct wlan_bssid_ex")
Closes: https://lore.kernel.org/linux-staging/DI2H39EAAFBZ.3KI5NWN02AQ2S@linux.dev/
Cc: stable <stable@kernel.org>
Signed-off-by: Salman Alghamdi <me@cipherat.com>
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Link: https://patch.msgid.link/20260513203455.31792-1-me@cipherat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ adapted to 6.1.y: preserve branch WPS helper-call spacing ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index ac3a08e6727f6..8a83d1fedeacb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -658,6 +658,8 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
privacy = pnetwork->network.privacy;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
+ if (pnetwork->network.ie_length < _FIXED_IE_LENGTH_)
+ return false;
if (rtw_get_wps_ie(pnetwork->network.ies+_FIXED_IE_LENGTH_, pnetwork->network.ie_length-_FIXED_IE_LENGTH_, NULL, &wps_ielen))
return true;
else
@@ -672,11 +674,15 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
bselected = false;
if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPA2PSK) {
- p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
- if (p && ie_len > 0)
- bselected = true;
- else
+ if (pnetwork->network.ie_length < _BEACON_IE_OFFSET_) {
bselected = false;
+ } else {
+ p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
+ if (p && ie_len > 0)
+ bselected = true;
+ else
+ bselected = false;
+ }
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0682/1059] serial: sh-sci: Check that the DMA cookie is valid
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (680 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0681/1059] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0683/1059] Bluetooth: btusb: fix use-after-free in force_poll_sync Greg Kroah-Hartman
` (316 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Claudiu Beznea, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
[ Upstream commit c3ca8a0aac832fe8047608bb2ae2cca314c6d717 ]
The driver updates struct sci_port::tx_cookie to zero right before the TX
work is scheduled, or to -EINVAL when DMA is disabled.
dma_async_is_complete(), called through dma_cookie_status() (and possibly
through dmaengine_tx_status()), considers cookies valid only if they have
values greater than or equal to 1.
Passing zero or -EINVAL to dmaengine_tx_status() before any TX DMA
transfer has started leads to an incorrect TX status being reported, as the
cookie is invalid for the DMA subsystem. This may cause long wait times
when the serial device is opened for configuration before any TX activity
has occurred.
Check that the TX cookie is valid before passing it to
dmaengine_tx_status().
Fixes: 7cc0e0a43a91 ("serial: sh-sci: Check if TX data was written to device in .tx_empty()")
Cc: stable <stable@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20251217135759.402015-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/sh-sci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 3c84c0580a9ce..4800682ba9fcc 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1700,7 +1700,7 @@ static void sci_dma_check_tx_occurred(struct sci_port *s)
struct dma_tx_state state;
enum dma_status status;
- if (!s->chan_tx)
+ if (!s->chan_tx || s->cookie_tx <= 0)
return;
status = dmaengine_tx_status(s->chan_tx, s->cookie_tx, &state);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0683/1059] Bluetooth: btusb: fix use-after-free in force_poll_sync
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (681 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0682/1059] serial: sh-sci: Check that the DMA cookie is valid Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0684/1059] tools/bootconfig: Close only opened braces in compact output Greg Kroah-Hartman
` (315 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bin Yu, Cheng Wen,
Luiz Augusto von Dentz, YuanZhe Liu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
[ Upstream commit 868c886f45f7c10dc888b94c6993352702a84d04 ]
The force_poll_sync debugfs file uses the driver's struct btusb_data as
its private data. The file is created under hdev->debugfs and is removed
only when the HCI device is released, while btusb_disconnect() frees
btusb_data unconditionally. The HCI device can outlive the driver data,
for example when an HCI socket still references it, so reading or
writing the already opened file then dereferences freed memory:
BUG: KASAN: slab-use-after-free in force_poll_sync_read+0x129/0x140
Read of size 1 at addr ffff88800cfb7038
...
Freed by task ...:
kfree
btusb_disconnect
Remove the debugfs file before the private data is freed.
debugfs_remove() waits for callers that are already inside the file
operations, and any later access fails with -EIO instead of reaching the
driver, so the force_poll_sync file can no longer dereference btusb_data
after it is gone.
Fixes: 800fe5ec302e ("Bluetooth: btusb: Add support for queuing during polling interval")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btusb.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 9f91b7521a0e6..223b4477e7cdb 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -854,6 +854,8 @@ struct btusb_data {
int (*setup_on_usb)(struct hci_dev *hdev);
int oob_wake_irq; /* irq for out-of-band wake-on-bt */
+
+ struct dentry *force_poll_sync_dentry;
unsigned cmd_timeout_cnt;
};
@@ -4260,8 +4262,9 @@ static int btusb_probe(struct usb_interface *intf,
usb_set_intfdata(intf, data);
- debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, data,
- &force_poll_sync_fops);
+ data->force_poll_sync_dentry =
+ debugfs_create_file("force_poll_sync", 0644, hdev->debugfs,
+ data, &force_poll_sync_fops);
return 0;
@@ -4297,6 +4300,9 @@ static void btusb_disconnect(struct usb_interface *intf)
if (!data)
return;
+ debugfs_remove(data->force_poll_sync_dentry);
+ data->force_poll_sync_dentry = NULL;
+
hdev = data->hdev;
usb_set_intfdata(data->intf, NULL);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0684/1059] tools/bootconfig: Close only opened braces in compact output
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (682 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0683/1059] Bluetooth: btusb: fix use-after-free in force_poll_sync Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0685/1059] tcp: Do not allow buggy transitions between ehash and lhash2 Greg Kroah-Hartman
` (314 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Eduardo Mucelli Rezende Oliveira, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
commit 26fa92f351d4993428268afebf6c60c987477af5 upstream.
A key may have both a value and subkeys. When it has only one subkey,
xbc_show_compact_tree() can print that subkey using dotted notation
without opening a brace. During backtracking, however, it treats the
value node followed by a subkey as evidence that a brace was opened.
For example, a.b=v, a.b.c=w and a.z=q are printed with the brace for a
closed before z. Reading that output back changes a.z into the root key
z, silently changing the configuration.
Check the key children when deciding whether to close a brace. Skip the
value child, and account for a sole subkey that itself has both a value
and subkeys, since that combination is not compacted. This follows the
conditions used to open braces without keeping a depth-indexed array.
Extend the mixed-value/subkey sample to cover the lost sibling.
The stable test script only checks whether the good samples can
be attached. Add the compact-output comparison for the extended
mixed-value/subkey sample and add its expected output file.
Link: https://lore.kernel.org/all/6ad67e4cda05238cd173c99e820a85de2c13f5fc.1794337724.git.edumucelli@gmail.com/
Fixes: e5efaeb8a8f5 ("bootconfig: Support mixing a value and subkeys under a key")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/bootconfig/main.c | 29 ++++++++++++++-----
.../samples/exp-good-mixed-kv1.bconf | 7 +++++
tools/bootconfig/samples/good-mixed-kv1.bconf | 5 ++++
tools/bootconfig/test-bootconfig.sh | 6 ++++
4 files changed, 40 insertions(+), 7 deletions(-)
create mode 100644 tools/bootconfig/samples/exp-good-mixed-kv1.bconf
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 5429a7674b35f..c464ee6ed32ca 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -38,6 +38,23 @@ static int xbc_show_value(struct xbc_node *node, bool semicolon)
return i;
}
+/* Match the conditions under which the compact formatter opens braces. */
+static bool xbc_node_needs_braces(struct xbc_node *node)
+{
+ struct xbc_node *child = xbc_node_get_child(node);
+
+ if (child && xbc_node_is_value(child))
+ child = xbc_node_get_next(child);
+ if (!child)
+ return false;
+ if (child->next)
+ return true;
+
+ /* A single subkey with both a value and subkeys is not compacted. */
+ child = xbc_node_get_child(child);
+ return child && xbc_node_is_value(child) && child->next;
+}
+
static void xbc_show_compact_tree(void)
{
struct xbc_node *node, *cnode = NULL, *vnode;
@@ -98,14 +115,12 @@ static void xbc_show_compact_tree(void)
node = xbc_node_get_parent(node);
if (!node)
return;
- if (!xbc_node_get_child(node)->next)
+ if (!depth || !xbc_node_needs_braces(node))
continue;
- if (depth) {
- depth--;
- for (i = 0; i < depth; i++)
- printf("\t");
- printf("}\n");
- }
+ depth--;
+ for (i = 0; i < depth; i++)
+ printf("\t");
+ printf("}\n");
}
node = xbc_node_get_next(node);
}
diff --git a/tools/bootconfig/samples/exp-good-mixed-kv1.bconf b/tools/bootconfig/samples/exp-good-mixed-kv1.bconf
new file mode 100644
index 0000000000000..0b8b2f59da31e
--- /dev/null
+++ b/tools/bootconfig/samples/exp-good-mixed-kv1.bconf
@@ -0,0 +1,7 @@
+key = "value";
+key.subkey = "another-value";
+a {
+ b = "v";
+ b.c = "w";
+ z = "q";
+}
diff --git a/tools/bootconfig/samples/good-mixed-kv1.bconf b/tools/bootconfig/samples/good-mixed-kv1.bconf
index 1761547dd05ca..35442ee62b751 100644
--- a/tools/bootconfig/samples/good-mixed-kv1.bconf
+++ b/tools/bootconfig/samples/good-mixed-kv1.bconf
@@ -1,3 +1,8 @@
# value -> subkey pattern
key = value
key.subkey = another-value
+
+# A valued parent with one subkey must not close its enclosing brace.
+a.b = v
+a.b.c = w
+a.z = q
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index be8d05833704d..42bac54e74b25 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -199,6 +199,12 @@ for i in samples/good-* ; do
done
+echo "Compact output keeps siblings under their parent"
+xpass $BOOTCONF -a samples/good-mixed-kv1.bconf $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xpass cmp samples/exp-good-mixed-kv1.bconf $OUTFILE
+
+
echo
echo "=== Summary ==="
echo "# of Passed: $(expr $NO - $NG - 1)"
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0685/1059] tcp: Do not allow buggy transitions between ehash and lhash2.
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (683 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0684/1059] tools/bootconfig: Close only opened braces in compact output Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0686/1059] tcp: Set unhashed_state in inet_twsk_hashdance_schedule() Greg Kroah-Hartman
` (313 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Michal Luczaj,
Hyunwoo Kim, Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 8cc3aef0cb198049805ecc061a2cc7b79b0ae43e ]
The following state transitions have long been a playground for
syzbot, and recently AI joined in, reporting a lot more bugs.
* listen() + shutdown() + connect()
* connect() + connect(AF_UNSPEC) + listen()
All the fix attempts would add more code to the fast path, which
is not worth it.
Instead of playing whack-a-mole with these edge-case bugs,
let's disallow these transitions.
Note that unhashed_state is placed in the 4-byte hole after
icsk_pmtu_cookie.
$ pahole -C inet_connection_sock vmlinux
struct inet_connection_sock {
...
__u32 icsk_pmtu_cookie; /* 1208 4 */
unsigned char unhashed_state; /* 1212 1 */
/* XXX 3 bytes hole, try to pack */
Reported-by: Kyle Zeng <kylebot@openai.com>
Closes: https://lore.kernel.org/netdev/20260731140512.566464-1-david.lee@trailofbits.com/
Reported-by: Michal Luczaj <mhal@rbox.co>
Closes: https://lore.kernel.org/netdev/20260803-sockmap-lookup-tcp-leak-v2-0-306e025bfe66@rbox.co/
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-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Hyunwoo Kim: Check __inet_hash() for IPv4 and IPv6 on 6.1.y;
record the state after each locked unhashed check. ]
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/inet_connection_sock.h | 1 +
net/ipv4/inet_connection_sock.c | 1 +
net/ipv4/inet_hashtables.c | 11 +++++++++++
3 files changed, 13 insertions(+)
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 51be99667a23c..76ec18fdc5bbb 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -102,6 +102,7 @@ struct inet_connection_sock {
__u32 icsk_rto_min;
__u32 icsk_delack_max;
__u32 icsk_pmtu_cookie;
+ unsigned char unhashed_state;
const struct tcp_congestion_ops *icsk_ca_ops;
const struct inet_connection_sock_af_ops *icsk_af_ops;
const struct tcp_ulp_ops *icsk_ulp_ops;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 00102d364a42d..b188cfa0c04db 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1196,6 +1196,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
if (newsk) {
struct inet_connection_sock *newicsk = inet_csk(newsk);
+ newicsk->unhashed_state = 0;
inet_sk_set_state(newsk, TCP_SYN_RECV);
newicsk->icsk_bind_hash = NULL;
newicsk->icsk_bind2_hash = NULL;
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index d4fc6ad1e2d58..7510330e2dc1c 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -735,6 +735,11 @@ int __inet_hash(struct sock *sk, struct sock *osk)
return 0;
}
WARN_ON(!sk_unhashed(sk));
+
+ if (unlikely(inet_csk(sk)->unhashed_state &&
+ inet_csk(sk)->unhashed_state != TCP_LISTEN))
+ return -EINVAL;
+
ilb2 = inet_lhash2_bucket_sk(hashinfo, sk);
spin_lock(&ilb2->lock);
@@ -788,6 +793,8 @@ void inet_unhash(struct sock *sk)
return;
}
+ inet_csk(sk)->unhashed_state = sk->sk_state;
+
if (rcu_access_pointer(sk->sk_reuseport_cb))
reuseport_stop_listen_sock(sk);
@@ -802,6 +809,7 @@ void inet_unhash(struct sock *sk)
spin_unlock_bh(lock);
return;
}
+ inet_csk(sk)->unhashed_state = sk->sk_state;
__sk_nulls_del_node_init_rcu(sk);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
spin_unlock_bh(lock);
@@ -1008,6 +1016,9 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
int l3mdev;
u32 index;
+ if (unlikely(inet_csk(sk)->unhashed_state == TCP_LISTEN))
+ return -EINVAL;
+
if (port) {
local_bh_disable();
ret = check_established(death_row, sk, port, NULL);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0686/1059] tcp: Set unhashed_state in inet_twsk_hashdance_schedule().
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (684 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0685/1059] tcp: Do not allow buggy transitions between ehash and lhash2 Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0687/1059] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
` (312 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Zahka, Kuniyuki Iwashima,
Matthieu Baerts (NGI0), Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 404381b4f1053a271a85679cc76a543b10ae043e ]
inet_unhash() sets inet_csk(sk)->unhashed_state only when the
socket is hashed because tcp_set_state(sk, TCP_CLOSE) could be
called multiple times, e.g. tcp_abort() calls it directly and
tcp_done_with_error().
However, inet_twsk_hashdance_schedule() also unhashes a socket
when replacing it with twsk, allowing the socket to bypass
checks for inet_csk(sk)->unhashed_state.
Let's update inet_csk(sk)->unhashed_state there as well.
Fixes: 8cc3aef0cb19 ("tcp: Do not allow buggy transitions between ehash and lhash2.")
Reported-by: Daniel Zahka <daniel.zahka@gmail.com>
Closes: https://lore.kernel.org/netdev/DLHLRA8GVI5B.2Q1IRQG5BVJNZ@gmail.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260917191554.1600494-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Kept the ehead declaration and the old inet_twsk_hashdance() name, applying the unhashed_state assignment and the icsk const change around that context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/inet_timewait_sock.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 6356a8a47b345..3621cdb9e431c 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -117,11 +117,13 @@ static void inet_twsk_add_bind2_node(struct inet_timewait_sock *tw,
void inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
struct inet_hashinfo *hashinfo)
{
- const struct inet_sock *inet = inet_sk(sk);
- const struct inet_connection_sock *icsk = inet_csk(sk);
struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash);
spinlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
+ struct inet_connection_sock *icsk = inet_csk(sk);
struct inet_bind_hashbucket *bhead, *bhead2;
+ const struct inet_sock *inet = inet_sk(sk);
+
+ icsk->unhashed_state = sk->sk_state;
/* Step 1: Put TW into bind hash. Original socket stays there too.
Note, that any socket with inet->num != 0 MUST be bound in
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0687/1059] ipv6: Remove IPV6_ADDRFORM.
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (685 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0686/1059] tcp: Set unhashed_state in inet_twsk_hashdance_schedule() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0688/1059] iio: proximity: sx9360: fix sampling frequency write and available range Greg Kroah-Hartman
` (311 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daehyeon Ko, Hyunwoo Kim,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-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>
[ Hyunwoo Kim: Remove 6.1.y UDP-Lite conversion handling and
the now-unused unlock label with IPV6_ADDRFORM; keep the older
inet_accept() interface. ]
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock.c | 4 +-
net/ipv4/af_inet.c | 3 --
net/ipv6/af_inet6.c | 4 --
net/ipv6/ipv6_sockglue.c | 108 ---------------------------------------
4 files changed, 1 insertion(+), 118 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 71b52da060e80..90d0c50f83e26 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -764,7 +764,7 @@ bool sk_mc_loop(struct sock *sk)
sk = sk_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_sk(sk)->mc_loop;
@@ -3698,7 +3698,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);
@@ -3725,7 +3724,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 73881ce0ca561..61a3ad6259a09 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -566,7 +566,6 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr *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)
@@ -768,7 +767,6 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags,
struct sock *sk1 = sock->sk, *sk2;
int err = -EINVAL;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
sk2 = READ_ONCE(sk1->sk_prot)->accept(sk1, flags, &err, kern);
if (!sk2)
return err;
@@ -851,7 +849,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 49031e40551f7..717f92db5ede8 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -454,7 +454,6 @@ int inet6_bind(struct socket *sock, struct sockaddr *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)
@@ -592,7 +591,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;
@@ -663,7 +661,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);
@@ -682,7 +679,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);
err = INDIRECT_CALL_2(prot->recvmsg, tcp_recvmsg, udpv6_recvmsg,
sk, msg, size, flags, &addr_len);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 2924aa45adbc5..9709ba8747d0d 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -418,105 +418,7 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
rtnl_lock();
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 ||
- sk->sk_protocol == IPPROTO_UDPLITE) {
- struct udp_sock *up = udp_sk(sk);
- if (up->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);
-
- /*
- * Sock is moving from IPv6 to IPv4 (sk_prot), so
- * remove it from the refcnt debug socks count in the
- * original family...
- */
- sk_refcnt_debug_dec(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);
- sk->sk_socket->ops = &inet_stream_ops;
- sk->sk_family = PF_INET;
- tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
- } else {
- struct proto *prot = &udp_prot;
-
- if (sk->sk_protocol == IPPROTO_UDPLITE)
- prot = &udplite_prot;
-
- sock_prot_inuse_add(net, sk->sk_prot, -1);
- sock_prot_inuse_add(net, prot, 1);
-
- /* Paired with READ_ONCE(sk->sk_prot) in inet6_dgram_ops */
- WRITE_ONCE(sk->sk_prot, prot);
- sk->sk_socket->ops = &inet_dgram_ops;
- 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);
-
- /*
- * ... and add it to the refcnt debug socks count
- * in the new family. -acme
- */
- sk_refcnt_debug_inc(sk);
- module_put(THIS_MODULE);
- retv = 0;
- break;
- }
- goto e_inval;
-
case IPV6_V6ONLY:
if (optlen < sizeof(int) ||
inet_sk(sk)->inet_num)
@@ -996,7 +898,6 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
break;
}
-unlock:
sockopt_release_sock(sk);
if (needs_rtnl)
rtnl_unlock();
@@ -1147,15 +1048,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_UDPLITE &&
- 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] 1065+ messages in thread* [PATCH 6.1 0688/1059] iio: proximity: sx9360: fix sampling frequency write and available range
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (686 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0687/1059] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0689/1059] iio: common: scmi_sensors: fix truncating 64-bit divisions Greg Kroah-Hartman
` (310 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Jonathan Cameron,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit d252425c1533bfacd5940faa3371af82196bff5b upstream.
GNRL_CTRL1/2 hold the scan period in units of 8192 / FOSC, but
sx9360_set_samp_freq() computes freq * 8192 / FOSC and mis-scales val2,
which is in micro units. Any integer frequency then programs a period
of 0, and fractional parts above ~0.26 Hz overflow the int, writing
0x10 to GNRL_CTRL1 outside the SCANPERIOD field.
Compute FOSC / (freq * 8192), rounded to the closest value, and reject
frequencies outside the 1..2047 period range.
The available range doesn't match the limits in the comments next to it
either: 4 MHz / 8192 is 488.28125 Hz, not 448.28125 Hz,
4 MHz / (8192 * 2047) is 0.238535 Hz, and (max - min) / 2047 is
0.238419 Hz. Use those values.
Fixes: 1cdb4c47f7f5 ("iio:proximity:sx9360: Add sx9360 support")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sx9360_set_samp_freq() still uses mutex_lock()/mutex_unlock() here,
not guard(); keep that and add the new checks before taking the lock. ]
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/sx9360.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c
index 7fa2213d23baf..91b184b8c6baf 100644
--- a/drivers/iio/proximity/sx9360.c
+++ b/drivers/iio/proximity/sx9360.c
@@ -15,11 +15,13 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/log2.h>
+#include <linux/math64.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
+#include <linux/units.h>
#include <linux/iio/iio.h>
@@ -45,6 +47,7 @@
#define SX9360_REG_GNRL_CTRL1_SCANPERIOD_MASK GENMASK(2, 0)
#define SX9360_REG_GNRL_CTRL2 0x12
#define SX9360_REG_GNRL_CTRL2_PERIOD_102MS 0x32
+#define SX9360_REG_GNRL_SCANPERIOD_MAX GENMASK(10, 0)
#define SX9360_REG_GNRL_REG_2_PERIOD_MS(_r) \
(((_r) * 8192) / (SX9360_FOSC_HZ / 1000))
#define SX9360_REG_GNRL_FREQ_2_REG(_f) (((_f) * 8192) / SX9360_FOSC_HZ)
@@ -184,9 +187,9 @@ static const struct {
int val;
int val2;
} sx9360_samp_freq_interval[] = {
- { 0, 281250 }, /* 4MHz / (8192 * 2047) */
- { 0, 281250 },
- { 448, 281250 }, /* 4MHz / 8192 */
+ { 0, 238535 }, /* 4MHz / (8192 * 2047) */
+ { 0, 238419 },
+ { 488, 281250 }, /* 4MHz / 8192 */
};
static const struct regmap_range sx9360_writable_reg_ranges[] = {
@@ -387,11 +390,26 @@ static int sx9360_read_avail(struct iio_dev *indio_dev,
static int sx9360_set_samp_freq(struct sx_common_data *data,
int val, int val2)
{
- int ret, reg;
+ unsigned int period_ticks;
+ u64 freq_uHz;
__be16 buf;
+ int ret;
+
+ if (val < 0 || val2 < 0)
+ return -EINVAL;
+
+ freq_uHz = (u64)val * MICROHZ_PER_HZ + val2;
+ if (!freq_uHz)
+ return -EINVAL;
+
+ /* The register holds the scan period in ticks of 8192 FOSC cycles. */
+ period_ticks = DIV64_U64_ROUND_CLOSEST((u64)SX9360_FOSC_HZ * MICROHZ_PER_HZ,
+ freq_uHz * 8192);
+ if (!period_ticks || period_ticks > SX9360_REG_GNRL_SCANPERIOD_MAX)
+ return -EINVAL;
+
+ buf = cpu_to_be16(period_ticks);
- reg = val * 8192 / SX9360_FOSC_HZ + val2 * 8192 / (SX9360_FOSC_MHZ);
- buf = cpu_to_be16(reg);
mutex_lock(&data->mutex);
ret = regmap_bulk_write(data->regmap, SX9360_REG_GNRL_CTRL1, &buf,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0689/1059] iio: common: scmi_sensors: fix truncating 64-bit divisions
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (687 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0688/1059] iio: proximity: sx9360: fix sampling frequency write and available range Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0690/1059] iio: proximity: sx9500: ignore event config writes that dont change state Greg Kroah-Hartman
` (309 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Arnav Kapoor,
Andy Shevchenko, Jonathan Cameron, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit 043ececf147863fbd253687aa0b9edcac358a711 upstream.
do_div() divides a 64-bit dividend by a 32-bit divisor: the divisor is
stored in a uint32_t on all architectures. The driver passes 64-bit
divisors to it in several places, so they are silently truncated:
- scmi_iio_set_odr_val() divides by uHz, which exceeds 32 bits for
sampling frequencies above ~4294 Hz.
- convert_ns_to_freq() divides by interval_ns, which exceeds 32 bits
for update intervals of ~4.29 s and above. If its low 32 bits happen
to be zero, this is a division by zero.
- scmi_iio_get_odr_val(), scmi_iio_convert_interval_to_ns(),
scmi_iio_sensor_update_cb() and scmi_iio_get_raw_available() divide
by int_pow(10, n), which returns u64 and exceeds 32 bits for n >= 10.
The SCMI exponent fields allow values down to -16.
Truncation results in wrong sampling frequency, timestamp and
raw_available values being reported to userspace.
Use div64_u64() and div64_u64_rem(), which take a 64-bit divisor.
Fixes: f774117c96f9 ("iio/scmi: Adding support for IIO SCMI Based Sensors")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606040245.XfmRpBhA-lkp@intel.com/
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ Use NSEC_PER_SEC instead of HZ_PER_GHZ, which this tree's units.h
doesn't have (same value, and what the old code used); resolve context
conflicts (const_ilog2() timestamp scale, scnprintf()). ]
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/common/scmi_sensors/scmi_iio.c | 27 +++++++++++-----------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
index 54ccf19ab2bb1..43cef5f97f2cb 100644
--- a/drivers/iio/common/scmi_sensors/scmi_iio.c
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -14,6 +14,7 @@
#include <linux/iio/sysfs.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/scmi_protocol.h>
#include <linux/time.h>
@@ -68,8 +69,7 @@ static int scmi_iio_sensor_update_cb(struct notifier_block *nb,
tstamp_scale = sensor->sensor_info->tstamp_scale +
const_ilog2(NSEC_PER_SEC) / const_ilog2(10);
if (tstamp_scale < 0) {
- do_div(time, int_pow(10, abs(tstamp_scale)));
- time_ns = time;
+ time_ns = div64_u64(time, int_pow(10, abs(tstamp_scale)));
} else {
time_ns = time * int_pow(10, tstamp_scale);
}
@@ -160,7 +160,7 @@ static int scmi_iio_set_odr_val(struct iio_dev *iio_dev, int val, int val2)
mult = scnprintf(buf, sizeof(buf), "%llu", sf) - 1;
sec = int_pow(10, mult) * MICROHZ_PER_HZ;
- do_div(sec, uHz);
+ sec = div64_u64(sec, uHz);
if (sec == 0) {
dev_err(&iio_dev->dev,
"Trying to set invalid sensor update value for sensor %s",
@@ -234,13 +234,10 @@ static int scmi_iio_read_avail(struct iio_dev *iio_dev,
static void convert_ns_to_freq(u64 interval_ns, u64 *hz, u64 *uhz)
{
- u64 rem, freq;
+ u64 rem;
- freq = NSEC_PER_SEC;
- rem = do_div(freq, interval_ns);
- *hz = freq;
- *uhz = rem * 1000000UL;
- do_div(*uhz, interval_ns);
+ *hz = div64_u64_rem(NSEC_PER_SEC, interval_ns, &rem);
+ *uhz = div64_u64(rem * MICROHZ_PER_HZ, interval_ns);
}
static int scmi_iio_get_odr_val(struct iio_dev *iio_dev, int *val, int *val2)
@@ -266,7 +263,8 @@ static int scmi_iio_get_odr_val(struct iio_dev *iio_dev, int *val, int *val2)
mult = SCMI_SENS_CFG_GET_UPDATE_EXP(sensor_config);
if (mult < 0) {
sensor_interval_mult = int_pow(10, abs(mult));
- do_div(sensor_update_interval, sensor_interval_mult);
+ sensor_update_interval = div64_u64(sensor_update_interval,
+ sensor_interval_mult);
} else {
sensor_interval_mult = int_pow(10, mult);
sensor_update_interval =
@@ -393,9 +391,9 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev,
*/
exponent = exponent - scale;
if (exponent < 0) {
- rem = do_div(resolution,
- int_pow(10, abs(exponent))
- );
+ resolution = div64_u64_rem(resolution,
+ int_pow(10, abs(exponent)),
+ &rem);
len = scnprintf(buf, PAGE_SIZE,
"[%lld %llu.%llu %lld]\n", min_range,
resolution, rem, max_range);
@@ -500,7 +498,8 @@ static u64 scmi_iio_convert_interval_to_ns(u32 val)
mult = SCMI_SENS_INTVL_GET_EXP(val);
if (mult < 0) {
sensor_interval_mult = int_pow(10, abs(mult));
- do_div(sensor_update_interval, sensor_interval_mult);
+ sensor_update_interval = div64_u64(sensor_update_interval,
+ sensor_interval_mult);
} else {
sensor_interval_mult = int_pow(10, mult);
sensor_update_interval =
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0690/1059] iio: proximity: sx9500: ignore event config writes that dont change state
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (688 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0689/1059] iio: common: scmi_sensors: fix truncating 64-bit divisions Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0691/1059] iio: imu: inv_mpu6050: fix swapped accel and gyro startup times Greg Kroah-Hartman
` (308 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Jonathan Cameron,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit b8ed9165906597b69a46fabf39ab41690721ebe8 upstream.
sx9500_write_event_config() adjusts the channel and close/far user
counts on every write, even when the event is already in the requested
state. Writing 0 to a disabled event and then 1 leaves the counts at 0,
so the channel and its interrupts stay off while the event reads as
enabled. As channel_users[] is shared with raw reads, those can then
wait forever for a conversion. Writing 1 twice and then 0 has the
opposite effect.
Return early when the state doesn't change, as
sx_common_write_event_config() does.
Fixes: 4193c0f1d863 ("iio: driver for Semtech SX9500 proximity solution")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ Context: write_event_config() still takes int state here and tests
state == 1; the added check is unchanged. ]
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/sx9500.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index d4670864ddc7e..1eff1c96e3b46 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -551,6 +551,12 @@ static int sx9500_write_event_config(struct iio_dev *indio_dev,
mutex_lock(&data->mutex);
+ /* The user counts must only change when the state does. */
+ if (data->event_enabled[chan->channel] == state) {
+ ret = 0;
+ goto out_unlock;
+ }
+
if (state == 1) {
ret = sx9500_inc_chan_users(data, chan->channel);
if (ret < 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0691/1059] iio: imu: inv_mpu6050: fix swapped accel and gyro startup times
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (689 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0690/1059] iio: proximity: sx9500: ignore event config writes that dont change state Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0692/1059] mmc: jz4740: Remove the host before resetting the controller Greg Kroah-Hartman
` (307 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit 3a5e2ca34cadd9d5993064884aa5b9c4f6d71dff upstream.
struct inv_mpu6050_hw declares startup_time as { accel, gyro }, but
every entry of hw_info[] initializes it positionally as
{ *_GYRO_STARTUP_TIME, *_ACCEL_STARTUP_TIME }, so the two values are
swapped for all chips.
inv_mpu6050_switch_engine() waits for startup_time.gyro after enabling
the gyroscope, so it waits for the accelerometer startup time instead,
e.g. 20 ms instead of 60 ms on MPU6050 and 20 ms instead of 100 ms on
ICM20602, and the first gyroscope samples can be read before the sensor
has settled. Enabling only the accelerometer waits longer than needed.
Use designated initializers, so each value is assigned to the member it
is named after.
Fixes: e46a36d92da0 ("Add startup time for each chip using inv_mpu6050 driver")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ This tree has no ICM20600, IAM20380, IAM20680HP or IAM20680HT entries;
the 15 entries it has are converted the same way. ]
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 75 +++++++++++++++++-----
1 file changed, 60 insertions(+), 15 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index a9ea0e94dc7cd..991c6630e0f37 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -146,7 +146,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6050,
.fifo_size = 1024,
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
- .startup_time = {INV_MPU6050_GYRO_STARTUP_TIME, INV_MPU6050_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6050_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6050_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU6500_WHOAMI_VALUE,
@@ -155,7 +158,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU6515_WHOAMI_VALUE,
@@ -164,7 +170,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU6880_WHOAMI_VALUE,
@@ -173,7 +182,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 4096,
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU6000_WHOAMI_VALUE,
@@ -182,7 +194,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6050,
.fifo_size = 1024,
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
- .startup_time = {INV_MPU6050_GYRO_STARTUP_TIME, INV_MPU6050_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6050_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6050_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU9150_WHOAMI_VALUE,
@@ -191,7 +206,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6050,
.fifo_size = 1024,
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
- .startup_time = {INV_MPU6050_GYRO_STARTUP_TIME, INV_MPU6050_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6050_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6050_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU9250_WHOAMI_VALUE,
@@ -200,7 +218,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_MPU9255_WHOAMI_VALUE,
@@ -209,7 +230,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20608_WHOAMI_VALUE,
@@ -218,7 +242,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20608D_WHOAMI_VALUE,
@@ -227,7 +254,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20609_WHOAMI_VALUE,
@@ -236,7 +266,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20689_WHOAMI_VALUE,
@@ -245,7 +278,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20602_WHOAMI_VALUE,
@@ -254,7 +290,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 1008,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_ICM20602_GYRO_STARTUP_TIME, INV_ICM20602_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_ICM20602_ACCEL_STARTUP_TIME,
+ .gyro = INV_ICM20602_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_ICM20690_WHOAMI_VALUE,
@@ -263,7 +302,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 1024,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_ICM20690_GYRO_STARTUP_TIME, INV_ICM20690_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_ICM20690_ACCEL_STARTUP_TIME,
+ .gyro = INV_ICM20690_GYRO_STARTUP_TIME,
+ },
},
{
.whoami = INV_IAM20680_WHOAMI_VALUE,
@@ -272,7 +314,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6500,
.fifo_size = 512,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
- .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+ .startup_time = {
+ .accel = INV_MPU6500_ACCEL_STARTUP_TIME,
+ .gyro = INV_MPU6500_GYRO_STARTUP_TIME,
+ },
},
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0692/1059] mmc: jz4740: Remove the host before resetting the controller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (690 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0691/1059] iio: imu: inv_mpu6050: fix swapped accel and gyro startup times Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0693/1059] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Greg Kroah-Hartman
` (306 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Olivier Louvignes, Ulf Hansson,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Louvignes <olivier@mgcrea.io>
[ Upstream commit 6b8b1e8827837bf4cf1f87219038fddae9e81b0b ]
jz4740_mmc_remove() masks every interrupt and resets the controller
before mmc_remove_host(), which removes the card and lets the card's
driver send its last commands. Those commands then run on a controller
that was just reset, and can wait out the driver's 5 s request timeout.
With an SDIO card that cost 5 s on every unbind: on a HiBy R1 (Ingenic
X1600, a BCM43430A1 driven by brcmfmac), the CMD52 that
sdio_release_irq() sends from brcmfmac's remove waited 5.1 s. The
command had finished (END_CMD_RES set in MSC_STAT), but MSC_IMASK read
0xffffffff although the request had unmasked END_CMD_RES. MSC_STAT can
still show IS_RESETTING after jz4740_mmc_reset() returns, so the reset
most likely completed after that write and undid it.
Remove the host first, then quiesce the controller, as other host
drivers do. On the R1, unbinding the Wi-Fi's MSC now takes 0.65 s.
Fixes: 61bfbdb85687 ("MMC: Add support for the controller on JZ4740 SoCs.")
Cc: stable@vger.kernel.org
Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
[ sashal: Adapted to the older API: the function returns int rather than void, and timer_delete_sync() is del_timer_sync(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/host/jz4740_mmc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index eda1e2ddcaca8..a1fc48f17a9a1 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -1132,12 +1132,13 @@ static int jz4740_mmc_remove(struct platform_device *pdev)
{
struct jz4740_mmc_host *host = platform_get_drvdata(pdev);
+ /* The card's driver may still send commands as it goes */
+ mmc_remove_host(host->mmc);
+
del_timer_sync(&host->timeout_timer);
jz4740_mmc_set_irq_enabled(host, 0xff, false);
jz4740_mmc_reset(host);
- mmc_remove_host(host->mmc);
-
free_irq(host->irq, host);
if (host->use_dma)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0693/1059] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (691 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0692/1059] mmc: jz4740: Remove the host before resetting the controller Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0694/1059] tracing/eprobe: Iterate trace_eprobe directly Greg Kroah-Hartman
` (305 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrew Davison, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Davison <andy@dvsn.net>
[ Upstream commit fda103c1432f344e1cd548f346d157b1e67ee7c5 ]
parse_codec_mode() reads the vendor and subsystem IDs of a patch file's
[codec] line into an int, and skips the check when the value is zero or
negative, as documented. An ID with bit 31 set, such as SigmaTel's
0x8384xxxx or Intel's 0x8086xxxx, comes out negative, so it is taken as
a wildcard and the section is applied to every codec instead of the one
it names.
This was seen on an OpenPeak OpenFrame 2 with an IDT 92HD75B2X5
(0x111d7608). A patch file written for the STAC9202 (0x83847632) in the
related OpenFrame 1 was applied to it, swapping the headphone and
speaker pin configurations, so auto-mute never muted the speaker.
Read the IDs as long long, so real IDs are compared exactly. Values
written as negative numbers (e.g. -1) still act as wildcards, as
documented; a hex value such as 0xffffffff is now compared as written.
Tested on 6.18.60 on an OpenFrame 2, with a rebuilt snd-hda-codec and
the STAC9202 patch file: user_pin_configs stays empty for the IDT codec,
and the headphone and line-out pins are assigned as the BIOS sets them.
Not tested on a STAC9202 itself.
The bug was tracked down and this fix written with an AI coding
assistant (Claude Code, Claude Opus 5.5), which also ran the tests
above. I have reviewed the change and the tests.
Fixes: ef940b0403d4 ("ALSA: hda - Allow patching with any vendor/subsystem ids")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Davison <andy@dvsn.net>
Link: https://patch.msgid.link/20261106175518.18629-1-andy@dvsn.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/hda/hda_sysfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c
index bd3686d60555e..25fe3ac2c0389 100644
--- a/sound/pci/hda/hda_sysfs.c
+++ b/sound/pci/hda/hda_sysfs.c
@@ -522,11 +522,12 @@ static inline int strmatch(const char *a, const char *b)
static void parse_codec_mode(char *buf, struct hda_bus *bus,
struct hda_codec **codecp)
{
- int vendorid, subid, caddr;
+ long long vendorid, subid;
+ int caddr;
struct hda_codec *codec;
*codecp = NULL;
- if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
+ if (sscanf(buf, "%lli %lli %i", &vendorid, &subid, &caddr) == 3) {
list_for_each_codec(codec, bus) {
if ((vendorid <= 0 || codec->core.vendor_id == vendorid) &&
(subid <= 0 || codec->core.subsystem_id == subid) &&
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0694/1059] tracing/eprobe: Iterate trace_eprobe directly
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (692 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0693/1059] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0695/1059] tracing/eprobe: Install the trigger for every instance that enables the eprobe Greg Kroah-Hartman
` (304 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuang Wang,
Masami Hiramatsu (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuang Wang <nashuiliang@gmail.com>
[ Upstream commit f8bbf8b9901a09915d7b466ceb2bccc1fb5abea8 ]
Refer to the description in [1], we can skip "container_of()" following
"list_for_each_entry()" by using "list_for_each_entry()" with
"struct trace_eprobe" and "tp.list".
Also, this patch defines "for_each_trace_eprobe_tp" to simplify the code
of the same logic.
[1] https://lore.kernel.org/all/CAHk-=wjakjw6-rDzDDBsuMoDCqd+9ogifR_EE1F0K-jYek1CdA@mail.gmail.com/
Link: https://lore.kernel.org/all/20230822022433.262478-1-nashuiliang@gmail.com/
Signed-off-by: Chuang Wang <nashuiliang@gmail.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Stable-dep-of: be94710b1f6b ("tracing/eprobe: Install the trigger for every instance that enables the eprobe")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_eprobe.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 19116ed205da0..8d9cd7617fc75 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -41,6 +41,10 @@ struct eprobe_data {
struct trace_eprobe *ep;
};
+
+#define for_each_trace_eprobe_tp(ep, _tp) \
+ list_for_each_entry(ep, trace_probe_probe_list(_tp), tp.list)
+
static int __trace_eprobe_create(int argc, const char *argv[]);
static void trace_event_probe_cleanup(struct trace_eprobe *ep)
@@ -740,7 +744,7 @@ static int disable_eprobe(struct trace_eprobe *ep,
static int enable_trace_eprobe(struct trace_event_call *call,
struct trace_event_file *file)
{
- struct trace_probe *pos, *tp;
+ struct trace_probe *tp;
struct trace_eprobe *ep;
bool enabled;
int ret = 0;
@@ -762,8 +766,7 @@ static int enable_trace_eprobe(struct trace_event_call *call,
if (enabled)
return 0;
- list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
- ep = container_of(pos, struct trace_eprobe, tp);
+ for_each_trace_eprobe_tp(ep, tp) {
ret = enable_eprobe(ep, file);
if (ret)
break;
@@ -780,8 +783,7 @@ static int enable_trace_eprobe(struct trace_event_call *call,
*/
WARN_ON_ONCE(ret != -ENOMEM);
- list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
- ep = container_of(pos, struct trace_eprobe, tp);
+ for_each_trace_eprobe_tp(ep, tp) {
disable_eprobe(ep, file->tr);
if (!--cnt)
break;
@@ -799,7 +801,7 @@ static int enable_trace_eprobe(struct trace_event_call *call,
static int disable_trace_eprobe(struct trace_event_call *call,
struct trace_event_file *file)
{
- struct trace_probe *pos, *tp;
+ struct trace_probe *tp;
struct trace_eprobe *ep;
tp = trace_probe_primary_from_call(call);
@@ -816,10 +818,8 @@ static int disable_trace_eprobe(struct trace_event_call *call,
trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
if (!trace_probe_is_enabled(tp)) {
- list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
- ep = container_of(pos, struct trace_eprobe, tp);
+ for_each_trace_eprobe_tp(ep, tp)
disable_eprobe(ep, file->tr);
- }
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0695/1059] tracing/eprobe: Install the trigger for every instance that enables the eprobe
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (693 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0694/1059] tracing/eprobe: Iterate trace_eprobe directly Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0696/1059] kprobes: Adopt guard() and scoped_guard() Greg Kroah-Hartman
` (303 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Carlier,
Masami Hiramatsu (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <devnexen@gmail.com>
[ Upstream commit be94710b1f6ba1bea33e73129c110af80e999b2d ]
The eprobe trigger lives in the instance of the enabling file, but it is
only added when the eprobe is first enabled and only removed when the
last file goes away. A second instance then records nothing, and the
first instance's trigger is left behind once the eprobe is disabled
there, so the eprobe can be deleted while that trigger still uses it.
Add and remove the trigger for each file. The file is never NULL here,
so warn if it is and drop the dead perf paths.
Link: https://lore.kernel.org/all/20261107101233.151434-1-devnexen@gmail.com/
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_eprobe.c | 56 ++++++++++++-------------------------
1 file changed, 18 insertions(+), 38 deletions(-)
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 8d9cd7617fc75..7de2f905e5970 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -746,37 +746,32 @@ static int enable_trace_eprobe(struct trace_event_call *call,
{
struct trace_probe *tp;
struct trace_eprobe *ep;
- bool enabled;
int ret = 0;
int cnt = 0;
+ if (WARN_ON_ONCE(!file))
+ return -EINVAL;
+
tp = trace_probe_primary_from_call(call);
if (WARN_ON_ONCE(!tp))
return -ENODEV;
- enabled = trace_probe_is_enabled(tp);
/* This also changes "enabled" state */
- if (file) {
- ret = trace_probe_add_file(tp, file);
- if (ret)
- return ret;
- } else
- trace_probe_set_flag(tp, TP_FLAG_PROFILE);
-
- if (enabled)
- return 0;
+ ret = trace_probe_add_file(tp, file);
+ if (ret)
+ return ret;
+ /* The trigger lives in the instance of the file, add it for each file */
for_each_trace_eprobe_tp(ep, tp) {
ret = enable_eprobe(ep, file);
if (ret)
break;
- enabled = true;
cnt++;
}
if (ret) {
/* Failed to enable one of them. Roll back all */
- if (enabled) {
+ if (cnt) {
/*
* It's a bug if one failed for something other than memory
* not being available but another eprobe succeeded.
@@ -789,10 +784,7 @@ static int enable_trace_eprobe(struct trace_event_call *call,
break;
}
}
- if (file)
- trace_probe_remove_file(tp, file);
- else
- trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
+ trace_probe_remove_file(tp, file);
}
return ret;
@@ -804,33 +796,21 @@ static int disable_trace_eprobe(struct trace_event_call *call,
struct trace_probe *tp;
struct trace_eprobe *ep;
+ if (WARN_ON_ONCE(!file))
+ return -EINVAL;
+
tp = trace_probe_primary_from_call(call);
if (WARN_ON_ONCE(!tp))
return -ENODEV;
- if (file) {
- if (!trace_probe_get_file_link(tp, file))
- return -ENOENT;
- if (!trace_probe_has_single_file(tp))
- goto out;
- trace_probe_clear_flag(tp, TP_FLAG_TRACE);
- } else
- trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
+ if (!trace_probe_get_file_link(tp, file))
+ return -ENOENT;
- if (!trace_probe_is_enabled(tp)) {
- for_each_trace_eprobe_tp(ep, tp)
- disable_eprobe(ep, file->tr);
- }
+ for_each_trace_eprobe_tp(ep, tp)
+ disable_eprobe(ep, file->tr);
- out:
- if (file)
- /*
- * Synchronization is done in below function. For perf event,
- * file == NULL and perf_trace_event_unreg() calls
- * tracepoint_synchronize_unregister() to ensure synchronize
- * event. We don't need to care about it.
- */
- trace_probe_remove_file(tp, file);
+ /* Synchronization is done in below function. */
+ trace_probe_remove_file(tp, file);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0696/1059] kprobes: Adopt guard() and scoped_guard()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (694 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0695/1059] tracing/eprobe: Install the trigger for every instance that enables the eprobe Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0697/1059] kprobes: Fix error return and slot leak in __register_kprobe() Greg Kroah-Hartman
` (302 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 587e8e6d640bcf89a4bf29745a3c3fdfe8379ae0 ]
Use guard() or scoped_guard() for critical sections rather than
discrete lock/unlock pairs.
Link: https://lore.kernel.org/all/173289887835.73724.608223217359025939.stgit@devnote2/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Stable-dep-of: a553b499f22b ("kprobes: Validate re-registration earlier in register_kretprobe()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/kprobes.c | 205 ++++++++++++++++++++---------------------------
1 file changed, 89 insertions(+), 116 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 58c04d6d1b375..7b3fe9307fb1a 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -144,10 +144,9 @@ static int collect_garbage_slots(struct kprobe_insn_cache *c);
kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)
{
struct kprobe_insn_page *kip;
- kprobe_opcode_t *slot = NULL;
/* Since the slot array is not protected by rcu, we need a mutex */
- mutex_lock(&c->mutex);
+ guard(mutex)(&c->mutex);
retry:
rcu_read_lock();
list_for_each_entry_rcu(kip, &c->pages, list) {
@@ -158,9 +157,8 @@ kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)
if (kip->slot_used[i] == SLOT_CLEAN) {
kip->slot_used[i] = SLOT_USED;
kip->nused++;
- slot = kip->insns + (i * c->insn_size);
rcu_read_unlock();
- goto out;
+ return kip->insns + (i * c->insn_size);
}
}
/* kip->nused is broken. Fix it. */
@@ -177,12 +175,12 @@ kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)
/* All out of space. Need to allocate a new page. */
kip = kmalloc(KPROBE_INSN_PAGE_SIZE(slots_per_page(c)), GFP_KERNEL);
if (!kip)
- goto out;
+ return NULL;
kip->insns = c->alloc();
if (!kip->insns) {
kfree(kip);
- goto out;
+ return NULL;
}
INIT_LIST_HEAD(&kip->list);
memset(kip->slot_used, SLOT_CLEAN, slots_per_page(c));
@@ -191,14 +189,12 @@ kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)
kip->ngarbage = 0;
kip->cache = c;
list_add_rcu(&kip->list, &c->pages);
- slot = kip->insns;
/* Record the perf ksymbol register event after adding the page */
perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL, (unsigned long)kip->insns,
PAGE_SIZE, false, c->sym);
-out:
- mutex_unlock(&c->mutex);
- return slot;
+
+ return kip->insns;
}
/* Return true if all garbages are collected, otherwise false. */
@@ -259,7 +255,7 @@ void __free_insn_slot(struct kprobe_insn_cache *c,
struct kprobe_insn_page *kip;
long idx;
- mutex_lock(&c->mutex);
+ guard(mutex)(&c->mutex);
rcu_read_lock();
list_for_each_entry_rcu(kip, &c->pages, list) {
idx = ((long)slot - (long)kip->insns) /
@@ -285,7 +281,6 @@ void __free_insn_slot(struct kprobe_insn_cache *c,
collect_one_slot(kip, idx);
}
}
- mutex_unlock(&c->mutex);
}
/*
@@ -643,10 +638,9 @@ static void kprobe_optimizer(struct work_struct *work)
mutex_unlock(&kprobe_mutex);
}
-/* Wait for completing optimization and unoptimization */
-void wait_for_kprobe_optimizer(void)
+static void wait_for_kprobe_optimizer_locked(void)
{
- mutex_lock(&kprobe_mutex);
+ lockdep_assert_held(&kprobe_mutex);
while (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) {
mutex_unlock(&kprobe_mutex);
@@ -658,8 +652,14 @@ void wait_for_kprobe_optimizer(void)
mutex_lock(&kprobe_mutex);
}
+}
- mutex_unlock(&kprobe_mutex);
+/* Wait for completing optimization and unoptimization */
+void wait_for_kprobe_optimizer(void)
+{
+ guard(mutex)(&kprobe_mutex);
+
+ wait_for_kprobe_optimizer_locked();
}
bool optprobe_queued_unopt(struct optimized_kprobe *op)
@@ -889,10 +889,10 @@ static void optimize_all_kprobes(void)
struct kprobe *p;
unsigned int i;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* If optimization is already allowed, just return. */
if (kprobes_allow_optimization)
- goto out;
+ return;
cpus_read_lock();
kprobes_allow_optimization = true;
@@ -904,8 +904,6 @@ static void optimize_all_kprobes(void)
}
cpus_read_unlock();
pr_info("kprobe jump-optimization is enabled. All kprobes are optimized if possible.\n");
-out:
- mutex_unlock(&kprobe_mutex);
}
#ifdef CONFIG_SYSCTL
@@ -915,12 +913,10 @@ static void unoptimize_all_kprobes(void)
struct kprobe *p;
unsigned int i;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* If optimization is already prohibited, just return. */
- if (!kprobes_allow_optimization) {
- mutex_unlock(&kprobe_mutex);
+ if (!kprobes_allow_optimization)
return;
- }
cpus_read_lock();
kprobes_allow_optimization = false;
@@ -932,10 +928,8 @@ static void unoptimize_all_kprobes(void)
}
}
cpus_read_unlock();
- mutex_unlock(&kprobe_mutex);
-
/* Wait for unoptimizing completion. */
- wait_for_kprobe_optimizer();
+ wait_for_kprobe_optimizer_locked();
pr_info("kprobe jump-optimization is disabled. All kprobes are based on software breakpoint.\n");
}
@@ -947,7 +941,7 @@ static int proc_kprobes_optimization_handler(struct ctl_table *table,
{
int ret;
- mutex_lock(&kprobe_sysctl_mutex);
+ guard(mutex)(&kprobe_sysctl_mutex);
sysctl_kprobes_optimization = kprobes_allow_optimization ? 1 : 0;
ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
@@ -955,7 +949,6 @@ static int proc_kprobes_optimization_handler(struct ctl_table *table,
optimize_all_kprobes();
else
unoptimize_all_kprobes();
- mutex_unlock(&kprobe_sysctl_mutex);
return ret;
}
@@ -1031,7 +1024,8 @@ static void __disarm_kprobe(struct kprobe *p, bool reopt)
#define __arm_kprobe(p) arch_arm_kprobe(p)
#define __disarm_kprobe(p, o) arch_disarm_kprobe(p)
#define kprobe_disarmed(p) kprobe_disabled(p)
-#define wait_for_kprobe_optimizer() do {} while (0)
+#define wait_for_kprobe_optimizer_locked() \
+ lockdep_assert_held(&kprobe_mutex)
static int reuse_unused_kprobe(struct kprobe *ap)
{
@@ -1492,6 +1486,7 @@ _kprobe_addr(kprobe_opcode_t *addr, const char *symbol_name,
static kprobe_opcode_t *kprobe_addr(struct kprobe *p)
{
bool on_func_entry;
+
return _kprobe_addr(p->addr, p->symbol_name, p->offset, &on_func_entry);
}
@@ -1526,14 +1521,12 @@ static struct kprobe *__get_valid_kprobe(struct kprobe *p)
*/
static inline int warn_kprobe_rereg(struct kprobe *p)
{
- int ret = 0;
+ guard(mutex)(&kprobe_mutex);
- mutex_lock(&kprobe_mutex);
if (WARN_ON_ONCE(__get_valid_kprobe(p)))
- ret = -EINVAL;
- mutex_unlock(&kprobe_mutex);
+ return -EINVAL;
- return ret;
+ return 0;
}
static int check_ftrace_location(struct kprobe *p)
@@ -1621,44 +1614,17 @@ static int check_kprobe_address_safe(struct kprobe *p,
return ret;
}
-int register_kprobe(struct kprobe *p)
+static int __register_kprobe(struct kprobe *p)
{
int ret;
struct kprobe *old_p;
- struct module *probed_mod;
- kprobe_opcode_t *addr;
- bool on_func_entry;
-
- /* Adjust probe address from symbol */
- addr = _kprobe_addr(p->addr, p->symbol_name, p->offset, &on_func_entry);
- if (IS_ERR(addr))
- return PTR_ERR(addr);
- p->addr = addr;
-
- ret = warn_kprobe_rereg(p);
- if (ret)
- return ret;
- /* User can pass only KPROBE_FLAG_DISABLED to register_kprobe */
- p->flags &= KPROBE_FLAG_DISABLED;
- p->nmissed = 0;
- INIT_LIST_HEAD(&p->list);
-
- ret = check_kprobe_address_safe(p, &probed_mod);
- if (ret)
- return ret;
-
- mutex_lock(&kprobe_mutex);
-
- if (on_func_entry)
- p->flags |= KPROBE_FLAG_ON_FUNC_ENTRY;
+ guard(mutex)(&kprobe_mutex);
old_p = get_kprobe(p->addr);
- if (old_p) {
+ if (old_p)
/* Since this may unoptimize 'old_p', locking 'text_mutex'. */
- ret = register_aggr_kprobe(old_p, p);
- goto out;
- }
+ return register_aggr_kprobe(old_p, p);
cpus_read_lock();
/* Prevent text modification */
@@ -1667,7 +1633,7 @@ int register_kprobe(struct kprobe *p)
mutex_unlock(&text_mutex);
cpus_read_unlock();
if (ret)
- goto out;
+ return ret;
INIT_HLIST_NODE(&p->hlist);
hlist_add_head_rcu(&p->hlist,
@@ -1678,14 +1644,43 @@ int register_kprobe(struct kprobe *p)
if (ret) {
hlist_del_rcu(&p->hlist);
synchronize_rcu();
- goto out;
}
}
/* Try to optimize kprobe */
try_to_optimize_kprobe(p);
-out:
- mutex_unlock(&kprobe_mutex);
+ return 0;
+}
+
+int register_kprobe(struct kprobe *p)
+{
+ int ret;
+ struct module *probed_mod;
+ kprobe_opcode_t *addr;
+ bool on_func_entry;
+
+ /* Canonicalize probe address from symbol */
+ addr = _kprobe_addr(p->addr, p->symbol_name, p->offset, &on_func_entry);
+ if (IS_ERR(addr))
+ return PTR_ERR(addr);
+ p->addr = addr;
+
+ ret = warn_kprobe_rereg(p);
+ if (ret)
+ return ret;
+
+ /* User can pass only KPROBE_FLAG_DISABLED to register_kprobe */
+ p->flags &= KPROBE_FLAG_DISABLED;
+ if (on_func_entry)
+ p->flags |= KPROBE_FLAG_ON_FUNC_ENTRY;
+ p->nmissed = 0;
+ INIT_LIST_HEAD(&p->list);
+
+ ret = check_kprobe_address_safe(p, &probed_mod);
+ if (ret)
+ return ret;
+
+ ret = __register_kprobe(p);
if (probed_mod)
module_put(probed_mod);
@@ -1860,12 +1855,11 @@ void unregister_kprobes(struct kprobe **kps, int num)
if (num <= 0)
return;
- mutex_lock(&kprobe_mutex);
- for (i = 0; i < num; i++)
- if (__unregister_kprobe_top(kps[i]) < 0)
- kps[i]->addr = NULL;
- mutex_unlock(&kprobe_mutex);
-
+ scoped_guard(mutex, &kprobe_mutex) {
+ for (i = 0; i < num; i++)
+ if (__unregister_kprobe_top(kps[i]) < 0)
+ kps[i]->addr = NULL;
+ }
synchronize_rcu();
for (i = 0; i < num; i++)
if (kps[i]->addr)
@@ -2318,8 +2312,9 @@ void unregister_kretprobes(struct kretprobe **rps, int num)
if (num <= 0)
return;
- mutex_lock(&kprobe_mutex);
for (i = 0; i < num; i++) {
+ guard(mutex)(&kprobe_mutex);
+
if (__unregister_kprobe_top(&rps[i]->kp) < 0)
rps[i]->kp.addr = NULL;
#ifdef CONFIG_KRETPROBE_ON_RETHOOK
@@ -2328,7 +2323,6 @@ void unregister_kretprobes(struct kretprobe **rps, int num)
rcu_assign_pointer(rps[i]->rph->rp, NULL);
#endif
}
- mutex_unlock(&kprobe_mutex);
synchronize_rcu();
for (i = 0; i < num; i++) {
@@ -2409,18 +2403,14 @@ static void kill_kprobe(struct kprobe *p)
/* Disable one kprobe */
int disable_kprobe(struct kprobe *kp)
{
- int ret = 0;
struct kprobe *p;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* Disable this kprobe */
p = __disable_kprobe(kp);
- if (IS_ERR(p))
- ret = PTR_ERR(p);
- mutex_unlock(&kprobe_mutex);
- return ret;
+ return IS_ERR(p) ? PTR_ERR(p) : 0;
}
EXPORT_SYMBOL_GPL(disable_kprobe);
@@ -2430,20 +2420,16 @@ int enable_kprobe(struct kprobe *kp)
int ret = 0;
struct kprobe *p;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* Check whether specified probe is valid. */
p = __get_valid_kprobe(kp);
- if (unlikely(p == NULL)) {
- ret = -EINVAL;
- goto out;
- }
+ if (unlikely(p == NULL))
+ return -EINVAL;
- if (kprobe_gone(kp)) {
+ if (kprobe_gone(kp))
/* This kprobe has gone, we couldn't enable it. */
- ret = -EINVAL;
- goto out;
- }
+ return -EINVAL;
if (p != kp)
kp->flags &= ~KPROBE_FLAG_DISABLED;
@@ -2457,8 +2443,6 @@ int enable_kprobe(struct kprobe *kp)
kp->flags |= KPROBE_FLAG_DISABLED;
}
}
-out:
- mutex_unlock(&kprobe_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(enable_kprobe);
@@ -2645,11 +2629,11 @@ static int kprobes_module_callback(struct notifier_block *nb,
unsigned int i;
int checkcore = (val == MODULE_STATE_GOING);
- if (val == MODULE_STATE_COMING) {
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
+
+ if (val == MODULE_STATE_COMING)
add_module_kprobe_blacklist(mod);
- mutex_unlock(&kprobe_mutex);
- }
+
if (val != MODULE_STATE_GOING && val != MODULE_STATE_LIVE)
return NOTIFY_DONE;
@@ -2659,7 +2643,6 @@ static int kprobes_module_callback(struct notifier_block *nb,
* notified, only '.init.text' section would be freed. We need to
* disable kprobes which have been inserted in the sections.
*/
- mutex_lock(&kprobe_mutex);
for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
head = &kprobe_table[i];
hlist_for_each_entry(p, head, hlist)
@@ -2682,7 +2665,6 @@ static int kprobes_module_callback(struct notifier_block *nb,
}
if (val == MODULE_STATE_GOING)
remove_module_kprobe_blacklist(mod);
- mutex_unlock(&kprobe_mutex);
return NOTIFY_DONE;
}
@@ -2699,7 +2681,7 @@ void kprobe_free_init_mem(void)
struct kprobe *p;
int i;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* Kill all kprobes on initmem because the target code has been freed. */
for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
@@ -2709,8 +2691,6 @@ void kprobe_free_init_mem(void)
kill_kprobe(p);
}
}
-
- mutex_unlock(&kprobe_mutex);
}
static int __init init_kprobes(void)
@@ -2906,11 +2886,11 @@ static int arm_all_kprobes(void)
unsigned int i, total = 0, errors = 0;
int err, ret = 0;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* If kprobes are armed, just return */
if (!kprobes_all_disarmed)
- goto already_enabled;
+ return 0;
/*
* optimize_kprobe() called by arm_kprobe() checks
@@ -2940,8 +2920,6 @@ static int arm_all_kprobes(void)
else
pr_info("Kprobes globally enabled\n");
-already_enabled:
- mutex_unlock(&kprobe_mutex);
return ret;
}
@@ -2952,13 +2930,11 @@ static int disarm_all_kprobes(void)
unsigned int i, total = 0, errors = 0;
int err, ret = 0;
- mutex_lock(&kprobe_mutex);
+ guard(mutex)(&kprobe_mutex);
/* If kprobes are already disarmed, just return */
- if (kprobes_all_disarmed) {
- mutex_unlock(&kprobe_mutex);
+ if (kprobes_all_disarmed)
return 0;
- }
kprobes_all_disarmed = true;
@@ -2983,11 +2959,8 @@ static int disarm_all_kprobes(void)
else
pr_info("Kprobes globally disabled\n");
- mutex_unlock(&kprobe_mutex);
-
/* Wait for disarming all kprobes by optimizer */
- wait_for_kprobe_optimizer();
-
+ wait_for_kprobe_optimizer_locked();
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0697/1059] kprobes: Fix error return and slot leak in __register_kprobe()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (695 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0696/1059] kprobes: Adopt guard() and scoped_guard() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0698/1059] kprobes: Validate re-registration earlier in register_kretprobe() Greg Kroah-Hartman
` (301 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 6a658cc2d605e5acf35e638c62f480460d5939cd ]
When arm_kprobe() fails in __register_kprobe(), the probe is removed
from kprobe_table and synchronize_rcu() is executed, but the error code
ret was ignored and try_to_optimize_kprobe(p) was executed, returning 0.
Additionally, the instruction slot allocated by prepare_kprobe() was
leaked.
Fix this by releasing the instruction slot via arch_remove_kprobe(p)
and returning ret when arm_kprobe() fails.
Link: https://lore.kernel.org/all/179375030756.247640.10859474201266455798.stgit@devnote2/
Fixes: 587e8e6d640b ("kprobes: Adopt guard() and scoped_guard()")
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 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 7b3fe9307fb1a..1954834b79556 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1644,6 +1644,8 @@ static int __register_kprobe(struct kprobe *p)
if (ret) {
hlist_del_rcu(&p->hlist);
synchronize_rcu();
+ arch_remove_kprobe(p);
+ return ret;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0698/1059] kprobes: Validate re-registration earlier in register_kretprobe()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (696 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0697/1059] kprobes: Fix error return and slot leak in __register_kprobe() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0699/1059] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
` (300 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit a553b499f22bf054964d4fd16d136f3d4f836c23 ]
register_kretprobe() only checked for re-registration if rp->kp.addr was
specified, skipping the check when rp was registered with symbol_name
and rp->kp.addr was NULL. In that scenario, register_kretprobe()
proceeded to allocate a new rethook (or kretprobe holder), and when
register_kprobe(&rp->kp) subsequently failed due to re-registration, the
error path freed and NULL-ed rp->rh (or rp->rph) on the still-active
kretprobe, leading to NULL pointer dereferences when the active probe
was hit.
Resolve the target address via _kprobe_addr() up-front and check whether
the probe is already registered at that address via
check_kprobe_rereg_at() before allocating any resources, and drop the
WARN_ON_ONCE() in the re-registration check now that re-registration is
gracefully detected and rejected.
Link: https://lore.kernel.org/all/179375032568.247640.17429793187163536192.stgit@devnote2/
Fixes: 0188b87899ff ("kretprobe: Avoid re-registration of the same kretprobe earlier")
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 | 72 +++++++++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 32 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1954834b79556..03c7688fe2954 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1483,52 +1483,61 @@ _kprobe_addr(kprobe_opcode_t *addr, const char *symbol_name,
return addr;
}
-static kprobe_opcode_t *kprobe_addr(struct kprobe *p)
-{
- bool on_func_entry;
-
- return _kprobe_addr(p->addr, p->symbol_name, p->offset, &on_func_entry);
-}
-
/*
* Check the 'p' is valid and return the aggregator kprobe
* at the same address.
*/
-static struct kprobe *__get_valid_kprobe(struct kprobe *p)
+static struct kprobe *__get_valid_kprobe_at(struct kprobe *p, kprobe_opcode_t *addr)
{
+ struct hlist_head *head;
struct kprobe *ap, *list_p;
lockdep_assert_held(&kprobe_mutex);
- ap = get_kprobe(p->addr);
- if (unlikely(!ap))
+ if (unlikely(!addr))
return NULL;
- if (p == ap)
- return ap;
-
- list_for_each_entry(list_p, &ap->list, list)
- if (list_p == p)
- /* kprobe p is a valid probe */
+ head = &kprobe_table[hash_ptr(addr, KPROBE_HASH_BITS)];
+ hlist_for_each_entry_rcu(ap, head, hlist,
+ lockdep_is_held(&kprobe_mutex)) {
+ if (ap == p) {
+ p->addr = addr;
return ap;
+ }
+ if (ap->addr == addr && kprobe_aggrprobe(ap)) {
+ list_for_each_entry(list_p, &ap->list, list) {
+ if (list_p == p) {
+ p->addr = addr;
+ return ap;
+ }
+ }
+ }
+ }
return NULL;
}
-/*
- * Warn and return error if the kprobe is being re-registered since
- * there must be a software bug.
- */
-static inline int warn_kprobe_rereg(struct kprobe *p)
+static inline struct kprobe *__get_valid_kprobe(struct kprobe *p)
+{
+ return __get_valid_kprobe_at(p, p->addr);
+}
+
+/* Return error if the kprobe is being re-registered */
+static inline int check_kprobe_rereg_at(struct kprobe *p, kprobe_opcode_t *addr)
{
guard(mutex)(&kprobe_mutex);
- if (WARN_ON_ONCE(__get_valid_kprobe(p)))
+ if (__get_valid_kprobe_at(p, addr))
return -EINVAL;
return 0;
}
+static inline int check_kprobe_rereg(struct kprobe *p)
+{
+ return check_kprobe_rereg_at(p, p->addr);
+}
+
static int check_ftrace_location(struct kprobe *p)
{
unsigned long addr = (unsigned long)p->addr;
@@ -1667,7 +1676,7 @@ int register_kprobe(struct kprobe *p)
return PTR_ERR(addr);
p->addr = addr;
- ret = warn_kprobe_rereg(p);
+ ret = check_kprobe_rereg(p);
if (ret)
return ret;
@@ -2202,20 +2211,19 @@ int register_kretprobe(struct kretprobe *rp)
struct kretprobe_instance *inst;
int i;
void *addr;
+ bool on_func_entry;
- ret = kprobe_on_func_entry(rp->kp.addr, rp->kp.symbol_name, rp->kp.offset);
- if (ret)
- return ret;
+ addr = _kprobe_addr(rp->kp.addr, rp->kp.symbol_name, rp->kp.offset, &on_func_entry);
+ if (IS_ERR(addr))
+ return PTR_ERR(addr);
- /* If only 'rp->kp.addr' is specified, check reregistering kprobes */
- if (rp->kp.addr && warn_kprobe_rereg(&rp->kp))
+ if (!on_func_entry)
return -EINVAL;
- if (kretprobe_blacklist_size) {
- addr = kprobe_addr(&rp->kp);
- if (IS_ERR(addr))
- return PTR_ERR(addr);
+ if (check_kprobe_rereg_at(&rp->kp, addr))
+ return -EINVAL;
+ if (kretprobe_blacklist_size) {
for (i = 0; kretprobe_blacklist[i].name != NULL; i++) {
if (kretprobe_blacklist[i].addr == addr)
return -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0699/1059] kprobes: Switch ftrace ops when adding probe with post_handler
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (697 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0698/1059] kprobes: Validate re-registration earlier in register_kretprobe() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0700/1059] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP Greg Kroah-Hartman
` (299 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-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>
[ sashal: Adapted to the older code by replacing scoped_guard(cpus_read_lock) with explicit cpus_read_lock()/unlock calls and dropping the kprobe_unused(ap) check in add_new_kprobe(), with the ftrace ops switch placed after the unlock. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/kprobes.c | 53 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 9 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 03c7688fe2954..b74fb67fb0156 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1117,9 +1117,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)
@@ -1249,16 +1254,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;
}
/*
@@ -1291,6 +1292,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;
cpus_read_lock();
@@ -1340,15 +1343,45 @@ 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);
out:
mutex_unlock(&text_mutex);
jump_label_unlock();
cpus_read_unlock();
+ if (ret == 0 && 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)) {
ap->flags &= ~KPROBE_FLAG_DISABLED;
if (!kprobes_all_disarmed) {
@@ -1356,6 +1389,8 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p)
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] 1065+ messages in thread* [PATCH 6.1 0700/1059] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (698 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0699/1059] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0701/1059] KEYS: Protect pkey method checks against type removal Greg Kroah-Hartman
` (298 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mohammed EL Kadiri, Jarkko Sakkinen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohammed EL Kadiri <med08elkadiri@gmail.com>
[ Upstream commit 1b9524250996b1f2f49833a1b2ae21c34e486f85 ]
Replace two BUG() calls in keyctl_pkey_params_get_2() and
keyctl_pkey_e_d_s() default cases with -EOPNOTSUPP, matching
the error style already used in these functions.
Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Stable-dep-of: bab48a104447 ("KEYS: Protect pkey method checks against type removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyctl_pkey.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index ba150ee2d4a37..15b6bf6399b59 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -163,7 +163,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
params->out_len = info.max_sig_size;
break;
default:
- BUG();
+ return -EOPNOTSUPP;
}
params->in_len = uparams.in_len;
@@ -245,7 +245,8 @@ long keyctl_pkey_e_d_s(int op,
params.op = kernel_pkey_sign;
break;
default:
- BUG();
+ ret = -EOPNOTSUPP;
+ goto error_params;
}
in = memdup_user(_in, params.in_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0701/1059] KEYS: Protect pkey method checks against type removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (699 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0700/1059] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0702/1059] mmc: omap: synchronize clock timer before disabling fclk Greg Kroah-Hartman
` (297 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuansheng Yang, Jarkko Sakkinen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuansheng Yang <0xbeac@gmail.com>
[ Upstream commit bab48a1044475f62d6e910c6d7267ce4bae847f9 ]
keyctl_pkey_query(), keyctl_pkey_e_d_s() and keyctl_pkey_verify() check
that key->type has the ->asym_*() method they need and call it later,
without holding key->sem. A reference keeps the key alive, but does not
pin the module that provides its type.
When that module is unloaded, unregister_key_type() waits for the key GC
to process every remaining key of the type. For each such key, the GC
takes key->sem for writing, switches key->type to key_type_dead, whose
->asym_*() methods are NULL, and destroys the payload. If that happens
between the check and the call, the keyctl calls a NULL method; if it
happens while the method runs, the method returns into freed module text.
In-tree, turris-signing-key provides ->asym_query() and ->asym_eds_op()
and can be built as a module.
Take key->sem for reading around each method call, and check the method
again under it, right before the call. While the lock is held the GC
cannot switch the key to key_type_dead, so unregister_key_type() and the
module unload cannot complete until the method returns. If the type is
already gone, the check finds key_type_dead and the keyctl fails with
-EOPNOTSUPP, as it does for any key type without the method.
memdup_user() and copy_to_user() stay outside key->sem, as in
keyctl_read_key(), so no page fault is taken with key->sem held. The
in-tree ->asym_*() methods do not take key->sem themselves. Nothing else
in the kernel calls these methods, so these four call sites are the full
coverage:
- keyctl_pkey_query(): ->asym_query() for KEYCTL_PKEY_QUERY
- keyctl_pkey_params_get_2(): ->asym_query(), and the op-specific check
for KEYCTL_PKEY_ENCRYPT, _DECRYPT, _SIGN and _VERIFY
- keyctl_pkey_e_d_s(): ->asym_eds_op() for _ENCRYPT, _DECRYPT and _SIGN
- keyctl_pkey_verify(): ->asym_verify_signature() for _VERIFY
This problem was recently fixed for keyctl_read_key() by 925c84e3cc21
("keys: Protect the read method check against type removal") and for
key_update() by aef3a8a4f988 ("KEYS: Protect the update method check
against type removal").
Fixes: 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2]")
Cc: stable@vger.kernel.org
Signed-off-by: Yuansheng Yang <0xbeac@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261110030252.9979-1-0xbeac@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyctl_pkey.c | 100 +++++++++++++++++++++++++++---------
1 file changed, 76 insertions(+), 24 deletions(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index 15b6bf6399b59..e7121523b9c9a 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -129,45 +129,77 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
if (ret < 0)
return ret;
+ down_read(¶ms->key->sem);
+
+ if (!params->key->type->asym_query) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params->key->type->asym_query(params, &info);
if (ret < 0)
- return ret;
+ goto out_up_key_sem;
switch (op) {
case KEYCTL_PKEY_ENCRYPT:
if (uparams.in_len > info.max_dec_size ||
- uparams.out_len > info.max_enc_size)
- return -EINVAL;
+ uparams.out_len > info.max_enc_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_enc_size;
break;
case KEYCTL_PKEY_DECRYPT:
if (uparams.in_len > info.max_enc_size ||
- uparams.out_len > info.max_dec_size)
- return -EINVAL;
+ uparams.out_len > info.max_dec_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_dec_size;
break;
case KEYCTL_PKEY_SIGN:
if (uparams.in_len > info.max_data_size ||
- uparams.out_len > info.max_sig_size)
- return -EINVAL;
+ uparams.out_len > info.max_sig_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_sig_size;
break;
case KEYCTL_PKEY_VERIFY:
if (uparams.in_len > info.max_data_size ||
- uparams.in2_len > info.max_sig_size)
- return -EINVAL;
+ uparams.in2_len > info.max_sig_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_sig_size;
break;
default:
- return -EOPNOTSUPP;
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
}
params->in_len = uparams.in_len;
- return 0;
+
+ switch (op) {
+ case KEYCTL_PKEY_VERIFY:
+ if (!params->key->type->asym_verify_signature)
+ ret = -EOPNOTSUPP;
+ break;
+ case KEYCTL_PKEY_ENCRYPT:
+ case KEYCTL_PKEY_DECRYPT:
+ case KEYCTL_PKEY_SIGN:
+ if (!params->key->type->asym_eds_op)
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+out_up_key_sem:
+ up_read(¶ms->key->sem);
+ return ret;
}
/*
@@ -185,7 +217,16 @@ long keyctl_pkey_query(key_serial_t id,
if (ret < 0)
goto error;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_query) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_query(¶ms, &res);
+
+out_up_key_sem:
+ up_read(¶ms.key->sem);
if (ret < 0)
goto error;
@@ -230,10 +271,6 @@ long keyctl_pkey_e_d_s(int op,
if (ret < 0)
goto error_params;
- ret = -EOPNOTSUPP;
- if (!params.key->type->asym_eds_op)
- goto error_params;
-
switch (op) {
case KEYCTL_PKEY_ENCRYPT:
params.op = kernel_pkey_encrypt;
@@ -260,7 +297,16 @@ long keyctl_pkey_e_d_s(int op,
if (!out)
goto error_in;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_eds_op) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_eds_op(¶ms, in, out);
+
+out_up_key_sem:
+ up_read(¶ms.key->sem);
if (ret < 0)
goto error_out;
@@ -305,31 +351,37 @@ long keyctl_pkey_verify(const struct keyctl_pkey_params __user *_params,
ret = keyctl_pkey_params_get_2(_params, _info, KEYCTL_PKEY_VERIFY,
¶ms);
if (ret < 0)
- goto error_params;
-
- ret = -EOPNOTSUPP;
- if (!params.key->type->asym_verify_signature)
- goto error_params;
+ goto out_free_params;
in = memdup_user(_in, params.in_len);
if (IS_ERR(in)) {
ret = PTR_ERR(in);
- goto error_params;
+ goto out_free_params;
}
in2 = memdup_user(_in2, params.in2_len);
if (IS_ERR(in2)) {
ret = PTR_ERR(in2);
- goto error_in;
+ goto out_free_in;
}
params.op = kernel_pkey_verify;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_verify_signature) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_verify_signature(¶ms, in, in2);
+out_up_key_sem:
+ up_read(¶ms.key->sem);
kfree(in2);
-error_in:
+
+out_free_in:
kfree(in);
-error_params:
+
+out_free_params:
keyctl_pkey_params_free(¶ms);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0702/1059] mmc: omap: synchronize clock timer before disabling fclk
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (700 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0701/1059] KEYS: Protect pkey method checks against type removal Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0703/1059] mmc: sunxi: fix clock and runtime PM leaks on probe failure Greg Kroah-Hartman
` (296 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Runyu Xiao, Ulf Hansson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <runyu.xiao@seu.edu.cn>
[ Upstream commit c931c51681e33b24bc8d65c6df35b70e1827daa2 ]
mmc_omap_select_slot() removes clk_timer with timer_delete() before
switching slots and changing the functional clock state. timer_delete()
only removes a pending timer and does not wait for a callback that is
already running.
If mmc_omap_clk_timer() is already running, it can therefore call
mmc_omap_fclk_enable() while the request or slot-switch path changes the
same clock state. During host removal, the same window can overlap the
final clock shutdown.
Use timer_delete_sync() so the callback has completed before slot switching
or changing the functional clock state. Keep the timer restartable for
normal request handling.
Fixes: 0807a9b5739a ("MMC: OMAP: Lazy clock shutdown")
Cc: stable@vger.kernel.org
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
[ sashal: changed timer_delete()/timer_delete_sync() calls to the older del_timer()/del_timer_sync() API in mmc_omap_select_slot() and mmc_omap_release_slot() ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/host/omap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index cc2213ea324f1..6386d6a8cb87d 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -210,7 +210,7 @@ static void mmc_omap_select_slot(struct mmc_omap_slot *slot, int claimed)
host->mmc = slot->mmc;
spin_unlock_irqrestore(&host->slot_lock, flags);
no_claim:
- del_timer(&host->clk_timer);
+ del_timer_sync(&host->clk_timer);
if (host->current_slot != slot || !claimed)
mmc_omap_fclk_offdelay(host->current_slot);
@@ -264,7 +264,7 @@ static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled)
/* Keeps clock running for at least 8 cycles on valid freq */
mod_timer(&host->clk_timer, jiffies + HZ/10);
else {
- del_timer(&host->clk_timer);
+ del_timer_sync(&host->clk_timer);
mmc_omap_fclk_offdelay(slot);
mmc_omap_fclk_enable(host, 0);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0703/1059] mmc: sunxi: fix clock and runtime PM leaks on probe failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (701 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0702/1059] mmc: omap: synchronize clock timer before disabling fclk Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0704/1059] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B Greg Kroah-Hartman
` (295 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Anfernee Cao, Ulf Hansson,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anfernee Cao <anferneemelokc5@gmail.com>
[ Upstream commit e35e360bd66898a977c296ab71fe4bae17ddceb7 ]
sunxi_mmc_resource_request() enables the bus, card, output and sample
clocks before returning. Several failure paths later in
sunxi_mmc_probe() leave them running:
- If devm_request_threaded_irq() fails, the clocks enabled by
sunxi_mmc_enable() are never disabled.
- If dma_alloc_coherent(), mmc_of_parse() or sunxi_mmc_init_host()
fails, probe only frees the DMA buffer and the mmc_host.
- If mmc_add_host() fails, runtime PM has already been enabled, but
pm_runtime_disable() is never called.
Besides leaking the clocks, this leaves the clock enable counts
unbalanced, so a reprobe (for example after -EPROBE_DEFER) calls
clk_prepare_enable() on the same clocks again.
Disable the IRQ and the clocks in the probe error path, and disable
runtime PM on the mmc_add_host() failure path. Also handle a failure of
devm_request_threaded_irq() in sunxi_mmc_resource_request().
Tested with QEMU's orangepi-pc machine: with forced sunxi_mmc_init_host()
and mmc_add_host() failures the MMC clocks stay disabled in clk_summary,
and a normal probe with an emulated SD card still works.
This issue was found by manual code inspection.
Fixes: 3cbcb16095f9 ("mmc: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs")
Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")
Cc: stable@vger.kernel.org # v4.18+
Signed-off-by: Anfernee Cao <anferneemelokc5@gmail.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
[ sashal: Changed the dma_alloc_coherent() failure goto to error_disable_mmc, keeping the older dev_err()/ret = -ENOMEM code instead of upstream's dev_err_probe() form. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/host/sunxi-mmc.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index e7f3240a53d87..0105654ec6c83 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1355,8 +1355,13 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
goto error_disable_mmc;
}
- return devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
- sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);
+ ret = devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
+ sunxi_mmc_handle_manual_stop, 0,
+ "sunxi-mmc", host);
+ if (ret)
+ goto error_disable_mmc;
+
+ return 0;
error_disable_mmc:
sunxi_mmc_disable(host);
@@ -1390,7 +1395,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
if (!host->sg_cpu) {
dev_err(&pdev->dev, "Failed to allocate DMA descriptor mem\n");
ret = -ENOMEM;
- goto error_free_host;
+ goto error_disable_mmc;
}
if (host->cfg->ccu_has_timings_switch) {
@@ -1471,7 +1476,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
ret = mmc_add_host(mmc);
if (ret)
- goto error_free_dma;
+ goto error_disable_rpm;
dev_info(&pdev->dev, "initialized, max. request size: %u KB%s\n",
mmc->max_req_size >> 10,
@@ -1479,8 +1484,13 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
return 0;
+error_disable_rpm:
+ pm_runtime_disable(&pdev->dev);
error_free_dma:
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
+error_disable_mmc:
+ disable_irq(host->irq);
+ sunxi_mmc_disable(host);
error_free_host:
mmc_free_host(mmc);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0704/1059] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (702 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0703/1059] mmc: sunxi: fix clock and runtime PM leaks on probe failure Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0705/1059] errseq: eliminate special limitation for macro MAX_ERRNO Greg Kroah-Hartman
` (294 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Hunter, Ian Ray, Haibo Chen,
Ulf Hansson, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Ray <ian.ray@gehealthcare.com>
[ Upstream commit d35d93c2902592a84347a15deac4d67a323694c9 ]
Since commit 5a52c5701a67 ("mmc: core: Fix host controller programming
for fixed driver type"), the eMMC driver strength is passed directly to
mmc_set_driver_type(), which propagates the value through ios.drv_type
all the way to sdhci_set_ios(). For value 4, SDHCI correctly warns:
mmc2: invalid driver type, default to driver type B
The host driver type has no effect on this controller: esdhc_writew_le()
never programs the driver-type field of SDHCI_HOST_CONTROL2. Hook
set_ios() and force drv_type to the always-valid Type B, so that SDHCI
never sees an unsupported value.
Tested on i.MX8MP (usdhc3, eMMC in HS400) with
`fixed-emmc-driver-type = <4>`: the warning is gone and the HS_TIMING
register contains 0x43 as expected.
Fixes: 5a52c5701a67 ("mmc: core: Fix host controller programming for fixed driver type")
Link: https://lore.kernel.org/all/20260926122908.866-1-ian.ray@gehealthcare.com/
Cc: stable@vger.kernel.org
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
[ sashal: Hunks were placed by hand with different context: the new set_ios function goes before esdhc_reset_tuning() (no usdhc_init_card() here), and the probe hook goes after the usdhc execute_tuning setup. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 3c7b32c0d3f3f..39d0799c563ec 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1198,6 +1198,20 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host)
"warning! HS400 strobe DLL status REF/SLV not lock in 50us, STROBE DLL status is %x!\n", v);
}
+static void sdhci_esdhc_imx_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+{
+ /*
+ * This controller has no driver-type control: esdhc_writew_le()
+ * discards the driver-type field when writing SDHCI_HOST_CONTROL2.
+ * The programmed value is therefore irrelevant, but SDHCI rejects
+ * non-SD values such as 4 (eMMC 40 ohm, from fixed-emmc-driver-type).
+ * Force an always-valid Type B.
+ */
+ ios->drv_type = MMC_SET_DRIVER_TYPE_B;
+
+ sdhci_set_ios(mmc, ios);
+}
+
static void esdhc_reset_tuning(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1674,6 +1688,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
host->mmc_host_ops.execute_tuning = usdhc_execute_tuning;
}
+ /* No SDHCI driver type control */
+ host->mmc_host_ops.set_ios = sdhci_esdhc_imx_set_ios;
+
if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
sdhci_esdhc_ops.platform_execute_tuning =
esdhc_executing_tuning;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0705/1059] errseq: eliminate special limitation for macro MAX_ERRNO
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (703 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0704/1059] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0706/1059] errseq: dont let errseq_check_and_advance() hide later errors Greg Kroah-Hartman
` (293 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zijun Hu, Jeff Layton, Andrew Morton,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <quic_zijuhu@quicinc.com>
[ Upstream commit 3eff6a3e574c2f704f9be1f4867c3d0b3d804435 ]
Current errseq implementation depends on a very special precondition that
macro MAX_ERRNO must be (2^n - 1).
Eliminate the limitation by
- redefining macro ERRSEQ_SHIFT
- defining a new macro ERRNO_MASK instead of MAX_ERRNO for errno mask.
There is no plan to change the value of MAX_ERRNO, but this makes the
implementation more generic and eliminates the BUILD_BUG_ON().
Link: https://lkml.kernel.org/r/20250407-improve_errseq-v1-1-7b27cbeb8298@quicinc.com
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 94defd41d80f ("errseq: don't let errseq_check_and_advance() hide later errors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/errseq.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/errseq.c b/lib/errseq.c
index 93e9b94358dc6..13a2581c5a878 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -34,11 +34,14 @@
*/
/* The low bits are designated for error code (max of MAX_ERRNO) */
-#define ERRSEQ_SHIFT ilog2(MAX_ERRNO + 1)
+#define ERRSEQ_SHIFT (ilog2(MAX_ERRNO) + 1)
/* This bit is used as a flag to indicate whether the value has been seen */
#define ERRSEQ_SEEN (1 << ERRSEQ_SHIFT)
+/* Leverage macro ERRSEQ_SEEN to define errno mask macro here */
+#define ERRNO_MASK (ERRSEQ_SEEN - 1)
+
/* The lowest bit of the counter */
#define ERRSEQ_CTR_INC (1 << (ERRSEQ_SHIFT + 1))
@@ -60,8 +63,6 @@ errseq_t errseq_set(errseq_t *eseq, int err)
{
errseq_t cur, old;
- /* MAX_ERRNO must be able to serve as a mask */
- BUILD_BUG_ON_NOT_POWER_OF_2(MAX_ERRNO + 1);
/*
* Ensure the error code actually fits where we want it to go. If it
@@ -79,7 +80,7 @@ errseq_t errseq_set(errseq_t *eseq, int err)
errseq_t new;
/* Clear out error bits and set new error */
- new = (old & ~(MAX_ERRNO|ERRSEQ_SEEN)) | -err;
+ new = (old & ~(ERRNO_MASK | ERRSEQ_SEEN)) | -err;
/* Only increment if someone has looked at it */
if (old & ERRSEQ_SEEN)
@@ -148,7 +149,7 @@ int errseq_check(errseq_t *eseq, errseq_t since)
if (likely(cur == since))
return 0;
- return -(cur & MAX_ERRNO);
+ return -(cur & ERRNO_MASK);
}
EXPORT_SYMBOL(errseq_check);
@@ -200,7 +201,7 @@ int errseq_check_and_advance(errseq_t *eseq, errseq_t *since)
if (new != old)
cmpxchg(eseq, old, new);
*since = new;
- err = -(new & MAX_ERRNO);
+ err = -(new & ERRNO_MASK);
}
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0706/1059] errseq: dont let errseq_check_and_advance() hide later errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (704 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0705/1059] errseq: eliminate special limitation for macro MAX_ERRNO Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0707/1059] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore Greg Kroah-Hartman
` (292 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain, Jan Kara,
Jeff Layton, Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
[ Upstream commit 94defd41d80f10bbe883c0c8d1b28d1665b6b153 ]
errseq_check_and_advance() reads the errseq_t, sets ERRSEQ_SEEN with a
cmpxchg() and then advances *since to the value it computed, ignoring
whether the cmpxchg() succeeded. When it fails because errseq_set()
recorded a different error in the meantime, *since ends up holding a
value that was never stored in the errseq_t.
errseq_set() only bumps the counter when ERRSEQ_SEEN is set. So as long
as nobody has seen the new error, recording the original errno again
recreates exactly the old value, and once another subscriber marks it
seen, it is equal to the stale *since. The next check through that
cursor then reports nothing, although -ENOSPC was recorded after the
value that check reported, and -EIO was recorded again after it
returned:
cursor f writeback cursor g
-------- --------- --------
set(-EIO)
check_and_advance(&f)
old = [c, EIO]
set(-ENOSPC)
-> [c, ENOSPC]
cmpxchg() fails
f = [c, EIO, SEEN]
returns -EIO
set(-EIO)
-> [c, EIO]
(no bump: unseen)
check_and_advance(&g)
-> [c, EIO, SEEN]
returns -EIO
check_and_advance(&f)
[c, EIO, SEEN] == f
returns 0 <- -ENOSPC and the second -EIO are lost
For file->f_wb_err this means that fsync() on one descriptor can return
0 although writeback failed after the previous fsync() on that
descriptor returned, when writeback errors race with fsync() on another
descriptor of the same file. The same applies to syncfs() through
sb->s_wb_err, which every file on the filesystem shares, and to the
ext4 and jbd2 cursors on the block device mapping. The kernel-doc
promises "Negative errno if one has been stored, or 0 if no new error
has occurred".
Retry with the value found when the cmpxchg() fails, so that *since is
only ever advanced to a value that was actually stored with ERRSEQ_SEEN
set. Every later errseq_set() then has to bump the counter, and the
error is reported. The retry loop terminates because each iteration
needs a concurrent update, like the loop in errseq_set().
A TLA+ model of errseq_set() and errseq_check_and_advance(), checked
with the TLC model checker, finds the lost error with the current code;
with this change TLC checks that an error recorded after a check
returned is always reported by the next check (exhaustively for two
subscribers with three checks each, and one writer recording four
errors or two writers recording two each). The KUnit race test added
in the next patch misses the error in 1-6% of 2 million rounds on
4-CPU UML before this change (depending on host load), and in none
after it.
Fixes: 84cbadadc6ea ("lib: add errseq_t type and infrastructure for handling it")
Cc: stable@vger.kernel.org
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Link: https://patch.msgid.link/20260927051726.71337-2-jain.sm@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/errseq.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/lib/errseq.c b/lib/errseq.c
index 13a2581c5a878..ea4ff9cc21669 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL(errseq_check);
* points to. If it does, then just return 0.
*
* If it doesn't, then the value has changed. Set the "seen" flag, and try to
- * swap it into place as the new eseq value. Then, set that value as the new
+ * swap it into place as the new eseq value. If the swap fails because the
+ * value changed, retry with the new value. Then, set that value as the new
* "since" value, and return whatever the error portion is set to.
*
* Note that no locking is provided here for concurrent updates to the "since"
@@ -184,24 +185,30 @@ int errseq_check_and_advance(errseq_t *eseq, errseq_t *since)
* to take the lock that protects the "since" value.
*/
old = READ_ONCE(*eseq);
- if (old != *since) {
+ while (old != *since) {
/*
* Set the flag and try to swap it into place if it has
* changed.
*
- * We don't care about the outcome of the swap here. If the
- * swap doesn't occur, then it has either been updated by a
- * writer who is altering the value in some way (updating
- * counter or resetting the error), or another reader who is
- * just setting the "seen" flag. Either outcome is OK, and we
- * can advance "since" and return an error based on what we
- * have.
+ * If the swap fails, a writer or another reader changed the
+ * value under us, so retry with the new value. "since" must
+ * only ever be set to a value that was stored with the SEEN
+ * flag: errseq_set() does not bump the counter while the
+ * flag is clear, so an unstored value could come back later
+ * and hide the errors that were recorded in the meantime.
*/
new = old | ERRSEQ_SEEN;
- if (new != old)
- cmpxchg(eseq, old, new);
+ if (new != old) {
+ errseq_t cur = cmpxchg(eseq, old, new);
+
+ if (cur != old) {
+ old = cur;
+ continue;
+ }
+ }
*since = new;
err = -(new & ERRNO_MASK);
+ break;
}
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0707/1059] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (705 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0706/1059] errseq: dont let errseq_check_and_advance() hide later errors Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.1 0708/1059] tcp: free saved_syn after an RCU grace period Greg Kroah-Hartman
` (291 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jerome Mohm, Stefano Garzarella,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Mohm <jrmmhm.kernel@eldare.de>
[ Upstream commit 2a24ba1694f14299fbde3fa107e5d56629f2f8b6 ]
virtio_vsock_vqs_del() frees the virtqueues but leaves vsock->vqs[]
pointing at them. If virtio_vsock_restore() then fails, the driver
stays bound with a dangling vqs[], and the next freeze or unbind
passes a freed virtqueue to virtqueue_detach_unused_buf():
BUG: KASAN: slab-use-after-free in virtqueue_detach_unused_buf
virtio_vsock_vqs_del (net/vmw_vsock/virtio_transport.c:785)
virtio_vsock_remove
Freed by task ...:
vp_del_vqs
virtio_vsock_freeze
Clear vqs[] after del_vqs() and when virtio_find_vqs() fails. Return
early from virtio_vsock_vqs_del() when vqs[] is empty: the detach
loops would pass NULL to virtqueue_detach_unused_buf(), and a second
del_vqs() would free virtio-mmio's IRQ again, which only WARNs in
free_irq() ("Trying to free already-free IRQ").
Found with the help of Anthropic's Claude and reproduced on virtio-pci
and virtio-mmio by failing the restore with failslab, without other
kernel changes; the virtio-mmio WARN was found by the netdev Sashiko
review and reproduced with v1 of this patch. With this patch neither
report appears on virtio-pci or virtio-mmio guests, and the vsock
vmtest.sh single-VM tests pass. A find_vqs() failure after some
virtqueues were set up was not exercised.
Fixes: bd50c5dc182b ("vsock/virtio: add support for device suspend/resume")
Cc: stable@vger.kernel.org
Signed-off-by: Jerome Mohm <jrmmhm.kernel@eldare.de>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://patch.msgid.link/20261109-vsock-restore-uaf-send-v4-1-1df8dfb5d5de@eldare.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adapted the virtio_find_vqs() call context, which here takes separate callbacks and names arrays instead of a vqs_info array. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/vmw_vsock/virtio_transport.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index b4b09d0b04325..433e77db6d2be 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -559,8 +559,10 @@ static int virtio_vsock_vqs_init(struct virtio_vsock *vsock)
ret = virtio_find_vqs(vdev, VSOCK_VQ_MAX, vsock->vqs, callbacks, names,
NULL);
- if (ret < 0)
+ if (ret < 0) {
+ memset(vsock->vqs, 0, sizeof(vsock->vqs));
return ret;
+ }
virtio_vsock_update_guest_cid(vsock);
@@ -621,11 +623,19 @@ static void virtio_vsock_vqs_del(struct virtio_vsock *vsock)
vsock->event_run = false;
mutex_unlock(&vsock->event_lock);
+ virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
+
/* Flush all device writes and interrupts, device will not use any
* more buffers.
*/
virtio_reset_device(vdev);
+ /* After a failed restore no virtqueues are live, and a second
+ * del_vqs() would free virtio-mmio's IRQ again (a WARN in free_irq()).
+ */
+ if (!vsock->vqs[VSOCK_VQ_RX])
+ return;
+
mutex_lock(&vsock->rx_lock);
while ((skb = virtqueue_detach_unused_buf(vsock->vqs[VSOCK_VQ_RX])))
kfree_skb(skb);
@@ -636,10 +646,10 @@ static void virtio_vsock_vqs_del(struct virtio_vsock *vsock)
kfree_skb(skb);
mutex_unlock(&vsock->tx_lock);
- virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
-
/* Delete virtqueues and flush outstanding callbacks if any */
vdev->config->del_vqs(vdev);
+
+ memset(vsock->vqs, 0, sizeof(vsock->vqs));
}
static int virtio_vsock_probe(struct virtio_device *vdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0708/1059] tcp: free saved_syn after an RCU grace period
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (706 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0707/1059] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0709/1059] gtp: free the skb after handling an echo response Greg Kroah-Hartman
` (290 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Kuniyuki Iwashima,
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <x-professor@outlook.com>
[ Upstream commit 2b9fd1a0abf0c1c7200be7a33cfeeca1c68089b6 ]
tcp_reqsk_record_syn() allocates saved_syn separately from its request
socket. bpf_sock_ops_get_syn() can load that pointer while processing a
retransmitted SYN under RCU.
There are two ownership transfers which can let another CPU reclaim the
allocation while such a reader is still using it.
First, tcp_move_syn() transfers req->saved_syn to a newly created child
socket. The child can be closed and tcp_saved_syn_free() can reclaim the
allocation before a reader of the old request finishes.
Second, inet_reqsk_clone() shallow-copies request_sock during request
migration. After reqsk_migrate_reset() clears the old request pointer, the
migrated clone owns it. However, a reader which already loaded the pointer
from the old request can still be using it when the clone is released.
I found this through LLM-assisted concurrency fuzzing.
Mark the request-socket saved_syn pointer as RCU protected and use RCU
accessors for its reads and updates. Keep the full-socket pointer plain
because all of its accesses hold the socket lock. Embed an rcu_head in
struct saved_syn and use kfree_rcu() in both teardown paths. This lets a
request-side reader which loaded the object before an ownership transfer
finish.
This follows commit e3f33b0a1d89 ("ipv4: free inet_opt and ireq_opt
after an RCU grace period"), which fixed the same ownership-transfer
pattern for IPv4 options.
The issue was confirmed with KASAN on v7.3-16007-g36aad21d50d1 using
temporary kernel instrumentation to widen the reader and request-migration
window. KASAN reported a slab-use-after-free read in
bpf_sock_ops_get_syn(), with the allocation freed by __reqsk_free() from
reqsk_timer_handler(). The same explicit migration test completed without
a report with deferred reclamation. A patched kernel without the delay
instrumentation also completed a successful migration and seven saved-SYN
reads without a KASAN report.
Fixes: 0813a841566f ("bpf: tcp: Allow bpf prog to write and parse TCP header option")
Fixes: c905dee62232 ("tcp: Migrate TCP_NEW_SYN_RECV requests at retransmitting SYN+ACKs.")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/38fa9f2cc476502e9b1c1fef09ebba1df5dd5901.1793795528.git.x-professor@outlook.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Context adjusted: reqsk_alloc() and __reqsk_free() live in request_sock.h in this tree, so the RCU init and call_rcu free changes were applied there instead of inet_connection_sock.c. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/tcp.h | 6 +++---
include/net/request_sock.h | 7 ++++---
net/core/filter.c | 2 +-
net/ipv4/inet_connection_sock.c | 2 +-
net/ipv4/tcp_input.c | 2 +-
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 3ac0b55a6bc7b..7efca409f6544 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -518,13 +518,13 @@ static inline void fastopen_queue_tune(struct sock *sk, int backlog)
static inline void tcp_move_syn(struct tcp_sock *tp,
struct request_sock *req)
{
- tp->saved_syn = req->saved_syn;
- req->saved_syn = NULL;
+ tp->saved_syn = unrcu_pointer(req->saved_syn);
+ RCU_INIT_POINTER(req->saved_syn, NULL);
}
static inline void tcp_saved_syn_free(struct tcp_sock *tp)
{
- kfree(tp->saved_syn);
+ kfree_rcu(tp->saved_syn, rcu);
tp->saved_syn = NULL;
}
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 144c39db9898a..7ed76b942f4ce 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -42,6 +42,7 @@ struct request_sock_ops {
int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req);
struct saved_syn {
+ struct rcu_head rcu;
u32 mac_hdrlen;
u32 network_hdrlen;
u32 tcp_hdrlen;
@@ -67,7 +68,7 @@ struct request_sock {
struct timer_list rsk_timer;
const struct request_sock_ops *rsk_ops;
struct sock *sk;
- struct saved_syn *saved_syn;
+ struct saved_syn __rcu *saved_syn;
u32 secid;
u32 peer_secid;
u32 timeout;
@@ -104,7 +105,7 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener,
req_to_sk(req)->sk_prot = sk_listener->sk_prot;
sk_node_init(&req_to_sk(req)->sk_node);
sk_tx_queue_clear(req_to_sk(req));
- req->saved_syn = NULL;
+ RCU_INIT_POINTER(req->saved_syn, NULL);
req->timeout = 0;
req->num_timeout = 0;
req->num_retrans = 0;
@@ -119,7 +120,7 @@ static inline void __reqsk_free(struct request_sock *req)
req->rsk_ops->destructor(req);
if (req->rsk_listener)
sock_put(req->rsk_listener);
- kfree(req->saved_syn);
+ kfree_rcu(unrcu_pointer(req->saved_syn), rcu);
kmem_cache_free(req->rsk_ops->slab, req);
}
diff --git a/net/core/filter.c b/net/core/filter.c
index ff56fe1445d3a..e4d5ad0512f34 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5710,7 +5710,7 @@ static int bpf_sock_ops_get_syn(struct bpf_sock_ops_kern *bpf_sock,
* not be available. It has to resort to
* saved_syn (if it is saved).
*/
- saved_syn = inet_reqsk(sk)->saved_syn;
+ saved_syn = rcu_dereference(inet_reqsk(sk)->saved_syn);
else
saved_syn = tcp_sk(sk)->saved_syn;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index b188cfa0c04db..87c4d75bf1293 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -962,7 +962,7 @@ static void reqsk_queue_migrated(struct request_sock_queue *queue,
static void reqsk_migrate_reset(struct request_sock *req)
{
- req->saved_syn = NULL;
+ RCU_INIT_POINTER(req->saved_syn, NULL);
#if IS_ENABLED(CONFIG_IPV6)
inet_rsk(req)->ipv6_opt = NULL;
inet_rsk(req)->pktopts = NULL;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cb55dddce3907..1f24358528182 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -7026,7 +7026,7 @@ static void tcp_reqsk_record_syn(const struct sock *sk,
saved_syn->network_hdrlen = skb_network_header_len(skb);
saved_syn->tcp_hdrlen = tcp_hdrlen(skb);
memcpy(saved_syn->data, base, len);
- req->saved_syn = saved_syn;
+ RCU_INIT_POINTER(req->saved_syn, saved_syn);
}
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0709/1059] gtp: free the skb after handling an echo response
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (707 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.1 0708/1059] tcp: free saved_syn after an RCU grace period Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0710/1059] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Greg Kroah-Hartman
` (289 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
[ Upstream commit f17b293d155f377e4cff582b8113991d2ad346d6 ]
gtp0_handle_echo_resp() and gtp1u_handle_echo_resp() return the result
of genlmsg_multicast_netns() to gtp_encap_recv(). When the netlink
notification is delivered that result is 0, and gtp_encap_recv() treats
0 as "the skb has been consumed":
switch (ret) {
case 1:
netdev_dbg(gtp->dev, "pass up to the process\n");
break;
case 0:
break;
case -1:
netdev_dbg(gtp->dev, "GTP packet has been dropped\n");
kfree_skb(skb);
ret = 0;
break;
}
The echo response handlers only read from the skb and never free it or
pass it on, so every echo response that is reported to a listener on the
gtp multicast group leaks the skb. Echo responses are handled for any
peer when the UDP sockets were created by the kernel, so a remote host
can leak memory on the receiver by sending GTP echo responses while a
process with CAP_NET_ADMIN is subscribed to the gtp multicast group, for
example a daemon that monitors echo responses.
The error paths do not leak but have a related problem. -ENOMEM and the error from
genlmsg_multicast_netns() (-ESRCH when nobody listens) are not -1, so
they are returned unchanged to the UDP stack, which takes a negative
value from encap_rcv() as a request to resubmit the packet to the
protocol with that number.
Return -1 when the notification cannot be built, so that
gtp_encap_recv() drops the skb, and consume the skb once the
notification has been handed to netlink, whether or not anybody is
listening.
Found by LLM-assisted source review, untested.
Fixes: d33bd757d362 ("gtp: Implement GTP echo request")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Link: https://patch.msgid.link/20261110-gtp-echo-rsp-leak-v1-1-192c032f3dfa@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/gtp.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 94f4be527e539..841cd3220c2bd 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -396,16 +396,19 @@ static int gtp0_handle_echo_resp(struct gtp_dev *gtp, struct sk_buff *skb)
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!msg)
- return -ENOMEM;
+ return -1;
ret = gtp_genl_fill_echo(msg, 0, 0, 0, GTP_CMD_ECHOREQ, echo);
if (ret < 0) {
nlmsg_free(msg);
- return ret;
+ return -1;
}
- return genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
- msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
+ msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ consume_skb(skb);
+
+ return 0;
}
/* 1 means pass up to the stack, -1 means drop and 0 means decapsulated. */
@@ -560,16 +563,19 @@ static int gtp1u_handle_echo_resp(struct gtp_dev *gtp, struct sk_buff *skb)
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!msg)
- return -ENOMEM;
+ return -1;
ret = gtp_genl_fill_echo(msg, 0, 0, 0, GTP_CMD_ECHOREQ, echo);
if (ret < 0) {
nlmsg_free(msg);
- return ret;
+ return -1;
}
- return genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
- msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
+ msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ consume_skb(skb);
+
+ return 0;
}
static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0710/1059] netfilter: nf_dup: preserve guard across NFQUEUE reinjection
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (708 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0709/1059] gtp: free the skb after handling an echo response Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0711/1059] fs/splice: clamp an over-reported write_iter result Greg Kroah-Hartman
` (288 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Luxing Yin, Zihan Xi,
Pablo Neira Ayuso, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <zihanx@nebusec.ai>
[ Upstream commit 82052e5b5ec36504fe1b9c3c28a711a78fcacf37 ]
NFQUEUE can suspend traversal of a duplicated packet while the task-local
duplication guard is set. The output call then returns and clears the guard
before a later verdict resumes hook traversal.
Save the guard in the queue entry and restore it while reinjection
continues hook traversal. Preserve and restore the verdict task's prior
state, including nested synchronous reinjection.
Fixes: cd58bcd9787e ("netfilter: xt_TEE: have cloned packet travel through Xtables too")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Assisted-by: LLM
Co-developed-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ sashal: adapted to use the per-CPU nf_skb_duplicated guard instead of current->in_nf_duplicate, and moved the nf_reinject changes into nf_queue.c with its older WARN_ON_ONCE/kfree_skb code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/netfilter/nf_queue.h | 1 +
net/netfilter/nf_queue.c | 13 ++++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index 4cf158b5ea698..1aedf2967a56f 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -21,6 +21,7 @@ struct nf_queue_entry {
struct net_device *physout;
#endif
struct nf_hook_state state;
+ bool in_nf_duplicate;
bool nf_ct_is_unconfirmed;
u16 size; /* sizeof(entry) + saved route keys */
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 2579f94e37444..7f3c24dccf015 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -218,6 +218,7 @@ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state,
*entry = (struct nf_queue_entry) {
.skb = skb,
.skb_dev = skb->dev,
+ .in_nf_duplicate = this_cpu_read(nf_skb_duplicated),
.state = *state,
.hook_index = index,
.size = sizeof(*entry) + route_key_size,
@@ -315,21 +316,26 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
const struct nf_hook_entry *hook_entry;
const struct nf_hook_entries *hooks;
struct sk_buff *skb = entry->skb;
+ bool old_in_nf_duplicate;
const struct net *net;
unsigned int i;
int err;
u8 pf;
+ local_bh_disable();
+ old_in_nf_duplicate = __this_cpu_read(nf_skb_duplicated);
+
net = entry->state.net;
pf = entry->state.pf;
+ __this_cpu_write(nf_skb_duplicated, entry->in_nf_duplicate);
hooks = nf_hook_entries_head(net, pf, entry->state.hook);
i = entry->hook_index;
if (WARN_ON_ONCE(!hooks || i >= hooks->num_hook_entries)) {
kfree_skb(skb);
nf_queue_entry_free(entry);
- return;
+ goto out;
}
hook_entry = &hooks->hooks[i];
@@ -352,9 +358,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
switch (verdict & NF_VERDICT_MASK) {
case NF_ACCEPT:
case NF_STOP:
- local_bh_disable();
entry->state.okfn(entry->state.net, entry->state.sk, skb);
- local_bh_enable();
break;
case NF_QUEUE:
err = nf_queue(skb, &entry->state, i, verdict);
@@ -368,5 +372,8 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
}
nf_queue_entry_free(entry);
+out:
+ __this_cpu_write(nf_skb_duplicated, old_in_nf_duplicate);
+ local_bh_enable();
}
EXPORT_SYMBOL(nf_reinject);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0711/1059] fs/splice: clamp an over-reported write_iter result
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (709 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0710/1059] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0712/1059] cpufreq: Improve suspend-resume synchronization Greg Kroah-Hartman
` (287 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cheng Yongkang,
Christian Brauner (Amutable), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
[ Upstream commit 2d956723e82cddae8ff8e9da99a666217b02065f ]
iter_file_splice_write() builds a bvec iterator of at most
sd.total_len - left bytes and passes it to ->write_iter(). It then
subtracts the returned length from sd.total_len and walks the pipe
buffers by that length. A ->write_iter() implementation that reports
more bytes than the iterator held makes sd.total_len underflow and the
dismissal loop advance pipe->tail past pipe->head, releasing a zeroed
pipe buffer:
Splice Exceeded! ret=7 tot=1 left=0
Oops: general protection fault
RIP: 0010:iter_file_splice_write+0xb6f/0x1170
Commit a3de58b12ce0 ("netfs: Fix unbuffered write error handling")
added the warning for this condition but only reports it. Clamp the
return value to the size of the iterator that was actually handed to
->write_iter(), so the pipe accounting stays consistent even when a
producer violates the iterator contract.
Fixes: 8d0207652cbe ("->splice_write() via ->write_iter()")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314072.648427.13388575162083843840@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: adapted the splice write path to the older vfs_iter_write() call instead of the kiocb-based write_iter, so the clamp is applied after that call. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/splice.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/splice.c b/fs/splice.c
index 26824470af974..0141a847aca65 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -686,6 +686,12 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
ret = vfs_iter_write(out, &from, &sd.pos, 0);
if (ret <= 0)
break;
+ if (unlikely(ret > sd.total_len - left)) {
+ WARN_ONCE(1,
+ "Splice Exceeded! ret=%zd tot=%zu left=%zu\n",
+ ret, sd.total_len, left);
+ ret = sd.total_len - left;
+ }
sd.num_spliced += ret;
sd.total_len -= ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0712/1059] cpufreq: Improve suspend-resume synchronization
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (710 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0711/1059] fs/splice: clamp an over-reported write_iter result Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0713/1059] tpm: flush timeout work outside buffer_mutex to avoid deadlock Greg Kroah-Hartman
` (286 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki,
Zak Brighton Knight, Zhongqiu Han, Viresh Kumar, Doug Smythies,
Christian Loehle, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit eee2a44e4e2b41c0699919a550d41cc38daa4f42 ]
The suspend-resume synchronization in the cpufreq core is not perfect
because the global cpufreq_suspended variable is set at the end of
cpufreq_suspend() after stopping governors for all of the active
policies, so the governor .limits() callback may run via
cpufreq_governor_limits() after stopping the governor and before
setting cpufreq_suspended which is questionable. Likewise, the
governor .limits() callback may run between clearing cpufreq_suspended
in cpufreq_resume() and starting the governor.
Address this by adding a per-policy "suspended" flag that is always
read under the policy rwsem and is updated under it when the governor
is stopped in cpufreq_suspend() and when the governor is restarted in
cpufreq_resume().
Also make cpufreq_resume() use the cpus_read_lock guard to reflect
what is done in cpufreq_suspend() and call cpufreq_exit_governor() for
policies that were suspended during a system suspend transition and
are inactive during the subsequent system resume (to avoid leaking an
inactive policy with a stopped governor that has not exited yet).
Fixes: 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
Fixes: b1b12babe3b7 ("cpufreq: update 'cpufreq_suspended' after stopping governors")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Zak Brighton Knight <zakbrightonknight@gmail.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/4796894.LvFx2qVVIh@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Replaced guard()-based locking with explicit down_write/up_write and cpus_read_lock/unlock using goto unlock, and kept the older pr_err policy-pointer format and cpufreq_update_policy naming. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 98 +++++++++++++++++++++++++++++----------
include/linux/cpufreq.h | 3 ++
2 files changed, 76 insertions(+), 25 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 47d33821d6056..9956415aec00a 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -34,6 +34,9 @@
static LIST_HEAD(cpufreq_policy_list);
/* Macros to iterate over CPU policies */
+#define for_each_policy(__policy) \
+ list_for_each_entry(__policy, &cpufreq_policy_list, policy_list)
+
#define for_each_suitable_policy(__policy, __active) \
list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \
if ((__active) == !policy_is_inactive(__policy))
@@ -1903,6 +1906,16 @@ int cpufreq_generic_suspend(struct cpufreq_policy *policy)
}
EXPORT_SYMBOL(cpufreq_generic_suspend);
+static void cpufreq_suspend_policy(struct cpufreq_policy *policy)
+{
+ down_write(&policy->rwsem);
+
+ cpufreq_stop_governor(policy);
+ policy->suspended = true;
+
+ up_write(&policy->rwsem);
+}
+
/**
* cpufreq_suspend() - Suspend CPUFreq governors.
*
@@ -1925,11 +1938,8 @@ void cpufreq_suspend(void)
pr_debug("%s: Suspending Governors\n", __func__);
for_each_active_policy(policy) {
- if (has_target()) {
- down_write(&policy->rwsem);
- cpufreq_stop_governor(policy);
- up_write(&policy->rwsem);
- }
+ if (has_target())
+ cpufreq_suspend_policy(policy);
if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
pr_err("%s: Failed to suspend driver: %s\n", __func__,
@@ -1941,6 +1951,35 @@ void cpufreq_suspend(void)
cpus_read_unlock();
}
+static void cpufreq_resume_policy(struct cpufreq_policy *policy, bool start)
+{
+ down_write(&policy->rwsem);
+
+ if (!policy->suspended)
+ goto unlock;
+
+ policy->suspended = false;
+
+ if (policy_is_inactive(policy)) {
+ /*
+ * The policy was active when it was suspended, so its governor
+ * is still there. Let the governor go.
+ */
+ cpufreq_exit_governor(policy);
+ goto unlock;
+ }
+
+ if (!start)
+ goto unlock;
+
+ if (cpufreq_start_governor(policy))
+ pr_err("%s: Failed to start governor for policy: %p\n",
+ __func__, policy);
+
+unlock:
+ up_write(&policy->rwsem);
+}
+
/**
* cpufreq_resume() - Resume CPUFreq governors.
*
@@ -1950,35 +1989,38 @@ void cpufreq_suspend(void)
void cpufreq_resume(void)
{
struct cpufreq_policy *policy;
- int ret;
if (!cpufreq_driver)
return;
+ cpus_read_lock();
+
if (unlikely(!cpufreq_suspended))
- return;
+ goto unlock;
cpufreq_suspended = false;
if (!has_target() && !cpufreq_driver->resume)
- return;
+ goto unlock;
pr_debug("%s: Resuming Governors\n", __func__);
- for_each_active_policy(policy) {
- if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
- pr_err("%s: Failed to resume driver: %p\n", __func__,
- policy);
- } else if (has_target()) {
- down_write(&policy->rwsem);
- ret = cpufreq_start_governor(policy);
- up_write(&policy->rwsem);
+ for_each_policy(policy) {
+ int ret = 0;
+ if (cpufreq_driver->resume && !policy_is_inactive(policy)) {
+ ret = cpufreq_driver->resume(policy);
if (ret)
- pr_err("%s: Failed to start governor for policy: %p\n",
- __func__, policy);
+ pr_err("%s: Failed to resume driver: %p\n", __func__,
+ policy);
}
+
+ if (has_target())
+ cpufreq_resume_policy(policy, ret == 0);
}
+
+unlock:
+ cpus_read_unlock();
}
/**
@@ -2357,12 +2399,17 @@ __weak struct cpufreq_governor *cpufreq_fallback_governor(void)
return NULL;
}
+static bool cpufreq_is_suspended(struct cpufreq_policy *policy)
+{
+ return cpufreq_suspended || policy->suspended;
+}
+
static int cpufreq_init_governor(struct cpufreq_policy *policy)
{
int ret;
- /* Don't start any governor operations if we are entering suspend */
- if (cpufreq_suspended)
+ /* Don't start any governor operations for suspended policies. */
+ if (cpufreq_is_suspended(policy))
return 0;
/*
* Governor might not be initiated here if ACPI _PPC changed
@@ -2405,7 +2452,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
static void cpufreq_exit_governor(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2420,7 +2467,7 @@ int cpufreq_start_governor(struct cpufreq_policy *policy)
{
int ret;
- if (cpufreq_suspended)
+ if (cpufreq_is_suspended(policy))
return 0;
if (!policy->governor)
@@ -2445,7 +2492,7 @@ int cpufreq_start_governor(struct cpufreq_policy *policy)
void cpufreq_stop_governor(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2456,7 +2503,7 @@ void cpufreq_stop_governor(struct cpufreq_policy *policy)
static void cpufreq_governor_limits(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2683,7 +2730,8 @@ void cpufreq_update_policy(unsigned int cpu)
* -> ask driver for current freq and notify governors about a change
*/
if (cpufreq_driver->get && has_target() &&
- (cpufreq_suspended || WARN_ON(!cpufreq_verify_current_freq(policy, false))))
+ (cpufreq_is_suspended(policy) ||
+ WARN_ON(!cpufreq_verify_current_freq(policy, false))))
goto unlock;
refresh_frequency_limits(policy);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 89f226f1b4ec4..a6535f51f3681 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -144,6 +144,9 @@ struct cpufreq_policy {
*/
bool dvfs_possible_from_any_cpu;
+ /* The policy has been suspended. */
+ bool suspended;
+
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */
unsigned int cached_target_freq;
unsigned int cached_resolved_idx;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0713/1059] tpm: flush timeout work outside buffer_mutex to avoid deadlock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (711 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0712/1059] cpufreq: Improve suspend-resume synchronization Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0714/1059] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
` (285 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyunjung Ko, Jarkko Sakkinen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunjung Ko <hj351016@gmail.com>
[ Upstream commit c22052a012698ce56d599d75b669d55778521c7c ]
tpm_common_read() calls flush_work(&priv->timeout_work) under
priv->buffer_mutex, but tpm_timeout_work() also takes buffer_mutex, so a
running timeout work deadlocks the flush. Flush after unlocking; the timer
is deleted under the lock, so no new work can be queued.
Fixes: 9488585b21be ("tpm: add support for partial reads")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261108165812.676876-1-hj351016@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
[ sashal: Adapted the timer call to the older API, using del_timer_sync() in place of timer_delete_sync(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/char/tpm/tpm-dev-common.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c
index ff86a1fdb5cdc..ddd4434edd33e 100644
--- a/drivers/char/tpm/tpm-dev-common.c
+++ b/drivers/char/tpm/tpm-dev-common.c
@@ -129,6 +129,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf,
{
struct file_priv *priv = file->private_data;
ssize_t ret_size = 0;
+ bool flush = false;
int rc;
if (!size)
@@ -161,9 +162,18 @@ ssize_t tpm_common_read(struct file *file, char __user *buf,
if (!priv->response_length) {
*off = 0;
del_timer_sync(&priv->user_read_timer);
- flush_work(&priv->timeout_work);
+ flush = true;
}
mutex_unlock(&priv->buffer_mutex);
+
+ /*
+ * tpm_timeout_work() takes buffer_mutex, so flush it after dropping
+ * the mutex to avoid a deadlock; the timer is deleted above, so no new
+ * timeout work can be queued once the mutex is released.
+ */
+ if (flush)
+ flush_work(&priv->timeout_work);
+
return ret_size;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0714/1059] pNFS: avoid repeatedly cancelling I/O for the same lseg
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (712 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0713/1059] tpm: flush timeout work outside buffer_mutex to avoid deadlock Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0715/1059] spi: tegra210-quad: Track DMA mapping state Greg Kroah-Hartman
` (284 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tim Menninger, Anna Schumaker,
Sasha Levin
6.1-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>
[ sashal: adapted cancelled_stripes bitmap to one bit per mirror, since this tree has no per-stripe dss_count and ff_layout_cancel_io() takes no devid, and dropped __counted_by and a differing include context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 11 +++++++++++
fs/nfs/flexfilelayout/flexfilelayout.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index a9945db35ec81..d7436c98a9b32 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/sched/mm.h>
#include <linux/sunrpc/metrics.h>
@@ -267,6 +268,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);
}
}
@@ -553,6 +555,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,
+ 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__);
@@ -2201,6 +2209,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];
+ /* Do not cancel a stripe again while this lseg drains. */
+ if (test_and_set_bit(idx, flseg->cancelled_stripes))
+ continue;
mirror_ds = mirror->mirror_ds;
if (IS_ERR_OR_NULL(mirror_ds))
continue;
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index 1d4294c6a7ec4..4757aa633d1ea 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -99,6 +99,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[];
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0715/1059] spi: tegra210-quad: Track DMA mapping state
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (713 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0714/1059] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0716/1059] cpufreq: Fix updates of cached resolved frequency and index Greg Kroah-Hartman
` (283 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mark Brown, Vishwaroop A,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <va@nvidia.com>
[ Upstream commit 7b9e6f7bc13c0259b192d0a964e802d4ad53b8b8 ]
tegra_qspi_dma_unmap_xfer() assumes a streaming mapping is always
outstanding and recomputes its length from the live
tqspi->curr_dma_words. Nothing records whether tegra_qspi_dma_map_xfer()
mapped anything, so neither assumption holds.
For a multi-chunk transfer, handle_dma_based_xfer() unmaps the chunk that
just completed, recalculates the parameters for the next chunk, which
overwrites curr_dma_words, and re-arms the hardware. If
tegra_qspi_start_dma_based_transfer() then fails at its
tegra_qspi_dma_map_xfer() call, nothing is mapped. That early return also
sits above the smp_store_release() that clears tqspi->trans_status, so the
previous chunk's QSPI_RDY survives, and the re-arm's return value is never
checked, so handle_dma_based_xfer() returns IRQ_HANDLED without completing
the transfer.
The caller times out, tegra_qspi_handle_timeout() sees the stale QSPI_RDY,
concludes the transfer completed and calls handle_dma_based_xfer() again.
No DMA completion arrives, so num_errors is incremented and
tegra_qspi_dma_unmap_xfer() runs with nothing mapped. t->tx_dma then holds
either the DMA_MAPPING_ERROR sentinel or, if the RX mapping was the one
that failed, the preceding chunk's address that has already been released.
Behind an IOMMU the latter frees an IOVA that may since have been
reallocated.
Record whether a mapping is outstanding and the length that was mapped,
and return early from tegra_qspi_dma_unmap_xfer() when there is nothing to
release. is_dma_mapped is only updated under tqspi->lock, or on the timeout
path after synchronize_irq() and cancel_work_sync() have quiesced the ISR
and the bottom half.
Also skip releasing the TX mapping on the RX failure path unless a TX
mapping was created; t->tx_dma is uninitialised when t->tx_buf is NULL.
Fixes: 921fc1838fb0 ("spi: tegra210-quad: Add support for Tegra210 QSPI controller")
Suggested-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Vishwaroop A <va@nvidia.com>
Link: https://patch.msgid.link/20261026111412.3843954-3-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Adapted to older code that uses a single tqspi->dev for DMA mapping instead of separate tx_dma_dev/rx_dma_dev devices. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-tegra210-quad.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index cb1b7f251eac2..f13daca8d8d4c 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -206,6 +206,17 @@ struct tegra_qspi {
bool is_packed;
bool use_dma;
+ /*
+ * Set while a streaming mapping created by
+ * tegra_qspi_dma_map_xfer() is outstanding, together with the
+ * length that was handed to dma_map_single(). is_curr_dma_xfer
+ * only records that the last armed chunk took the DMA path,
+ * which is not the same thing: a chunk whose mapping failed
+ * leaves the DMA path flagged with nothing mapped.
+ */
+ bool is_dma_mapped;
+ unsigned int dma_map_len;
+
u32 command1_reg;
u32 dma_control_reg;
u32 def_command1_reg;
@@ -585,22 +596,32 @@ static int tegra_qspi_dma_map_xfer(struct tegra_qspi *tqspi, struct spi_transfer
if (t->rx_buf) {
t->rx_dma = dma_map_single(tqspi->dev, (void *)rx_buf, len, DMA_FROM_DEVICE);
if (dma_mapping_error(tqspi->dev, t->rx_dma)) {
- dma_unmap_single(tqspi->dev, t->tx_dma, len, DMA_TO_DEVICE);
+ if (t->tx_buf)
+ dma_unmap_single(tqspi->dev, t->tx_dma,
+ len, DMA_TO_DEVICE);
return -ENOMEM;
}
}
+ tqspi->dma_map_len = len;
+ tqspi->is_dma_mapped = true;
+
return 0;
}
static void tegra_qspi_dma_unmap_xfer(struct tegra_qspi *tqspi, struct spi_transfer *t)
{
- unsigned int len;
+ if (!tqspi->is_dma_mapped)
+ return;
- len = DIV_ROUND_UP(tqspi->curr_dma_words * tqspi->bytes_per_word, 4) * 4;
+ if (t->tx_buf)
+ dma_unmap_single(tqspi->dev, t->tx_dma,
+ tqspi->dma_map_len, DMA_TO_DEVICE);
+ if (t->rx_buf)
+ dma_unmap_single(tqspi->dev, t->rx_dma,
+ tqspi->dma_map_len, DMA_FROM_DEVICE);
- dma_unmap_single(tqspi->dev, t->tx_dma, len, DMA_TO_DEVICE);
- dma_unmap_single(tqspi->dev, t->rx_dma, len, DMA_FROM_DEVICE);
+ tqspi->is_dma_mapped = false;
}
static int tegra_qspi_start_dma_based_transfer(struct tegra_qspi *tqspi, struct spi_transfer *t)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0716/1059] cpufreq: Fix updates of cached resolved frequency and index
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (714 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0715/1059] spi: tegra210-quad: Track DMA mapping state Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0717/1059] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Greg Kroah-Hartman
` (282 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhongqiu Han, Rafael J. Wysocki,
Christian Loehle, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 75120f31aed010c326b28d7c80d22314df34d9a8 ]
The cached resolved frequency and index, cached_target_freq and
cached_resolved_idx, respectively, may be updated concurrently if
cpufreq_driver_resolve_freq() is called by the schedutil governor
while cpufreq_set_policy() is running for the same policy. Those
concurrent updates are not synchronized in any way and the values
written by cpufreq_set_policy(), if it wins the race, may confuse
drivers using those policy fields [1].
To address this, use the observation that the only place where
cached_target_freq and cached_resolved_idx need to be updated is
cpufreq_driver_resolve_freq() because the only legitimate users of
them are .fast_switch() driver callbacks. Although cached_resolved_idx
is also used in __cpufreq_driver_target(), that is in fact unnecessary
and it is better to use a local variable for storing the frequency
table index in that function.
Accordingly, rearrange __resolve_freq() and its callers so that
cached_target_freq and cached_resolved_idx are only updated in
cpufreq_driver_resolve_freq().
The cached_target_freq initialization in cpufreq_set_policy() is still
needed, but move it after stopping the old governor and before starting
the new one to avoid racing with cpufreq_driver_resolve_freq().
Fixes: f9ccdec24d91 ("cpufreq: Reuse cpufreq_driver_resolve_freq() in __cpufreq_driver_target()")
Fixes: 151717690694 ("cpufreq: Make policy min/max hard requirements")
Reported-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Closes: https://lore.kernel.org/linux-pm/20261105140357.1331894-1-zhongqiu.han@oss.qualcomm.com/ [1]
Co-developed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Cc: All applicable <stable@vger.kernel.org> # 342d3a73c5db cpufreq: Force passing target frequency to driver during resume
Cc: All applicable <stable@vger.kernel.org> # 166207cac451 cpufreq: Cache post-resolution target frequency in __resolve_freq()
Link: https://patch.msgid.link/3472677.aeNJFYEL58@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: adjusted cpufreq_set_policy() to keep the older WRITE_ONCE min/max resolution, adding only the NULL idx argument and removing the early cached_target_freq = UINT_MAX, since force_target/pressure code is absent. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9956415aec00a..931ab927316bd 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -533,7 +533,7 @@ EXPORT_SYMBOL_GPL(cpufreq_disable_fast_switch);
static unsigned int __resolve_freq(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int min, unsigned int max,
- unsigned int relation)
+ unsigned int relation, unsigned int *idx_p)
{
unsigned int idx;
@@ -543,9 +543,10 @@ static unsigned int __resolve_freq(struct cpufreq_policy *policy,
return target_freq;
idx = cpufreq_frequency_table_target(policy, target_freq, min, max, relation);
- policy->cached_resolved_idx = idx;
- policy->cached_target_freq = policy->freq_table[idx].frequency;
- return policy->cached_target_freq;
+ if (idx_p)
+ *idx_p = idx;
+
+ return policy->freq_table[idx].frequency;
}
/**
@@ -576,7 +577,10 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
if (unlikely(min > max))
min = max;
- return __resolve_freq(policy, target_freq, min, max, CPUFREQ_RELATION_LE);
+ policy->cached_target_freq = __resolve_freq(policy, target_freq, min, max,
+ CPUFREQ_RELATION_LE,
+ &policy->cached_resolved_idx);
+ return policy->cached_target_freq;
}
EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq);
@@ -2340,12 +2344,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int relation)
{
unsigned int old_target_freq = target_freq;
+ unsigned int idx = 0;
if (cpufreq_disabled())
return -ENODEV;
target_freq = __resolve_freq(policy, target_freq, policy->min,
- policy->max, relation);
+ policy->max, relation, &idx);
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
policy->cpu, target_freq, relation, old_target_freq);
@@ -2374,7 +2379,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
if (!cpufreq_driver->target_index)
return -EINVAL;
- return __target_index(policy, policy->cached_resolved_idx);
+ return __target_index(policy, idx);
}
EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
@@ -2647,15 +2652,13 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
*/
WRITE_ONCE(policy->max, __resolve_freq(policy, new_data.max,
new_data.min, new_data.max,
- CPUFREQ_RELATION_H));
+ CPUFREQ_RELATION_H, NULL));
new_data.min = __resolve_freq(policy, new_data.min, new_data.min,
- new_data.max, CPUFREQ_RELATION_L);
+ new_data.max, CPUFREQ_RELATION_L, NULL);
WRITE_ONCE(policy->min, new_data.min > policy->max ? policy->max : new_data.min);
trace_cpu_frequency_limits(policy);
- policy->cached_target_freq = UINT_MAX;
-
pr_debug("new min and max freqs are %u - %u kHz\n",
policy->min, policy->max);
@@ -2681,6 +2684,12 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
cpufreq_exit_governor(policy);
}
+ /*
+ * Initialize cached_target_freq while no governor is running to avoid
+ * racing with cpufreq_driver_resolve_freq(), which updates it.
+ */
+ policy->cached_target_freq = UINT_MAX;
+
/* start new governor */
policy->governor = new_gov;
ret = cpufreq_init_governor(policy);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0717/1059] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (715 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0716/1059] cpufreq: Fix updates of cached resolved frequency and index Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0718/1059] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Greg Kroah-Hartman
` (281 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chen Ni, Guenter Roeck,
Wim Van Sebroeck, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <nichen@iscas.ac.cn>
[ Upstream commit ad3746700ae238a96a9a4244d02a2e8eb00f157e ]
clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter.Remove unneeded NULL check for clk here.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20250313084420.2481763-1-nichen@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Stable-dep-of: 57c7cbe21acc ("watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/npcm_wdt.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index a5dd1c2301374..e62ea054bc618 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -68,8 +68,7 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- if (wdt->clk)
- clk_prepare_enable(wdt->clk);
+ clk_prepare_enable(wdt->clk);
if (wdd->timeout < 2)
val = 0x800;
@@ -105,8 +104,7 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
writel(0, wdt->reg);
- if (wdt->clk)
- clk_disable_unprepare(wdt->clk);
+ clk_disable_unprepare(wdt->clk);
return 0;
}
@@ -156,8 +154,7 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
/* For reset, we start the WDT clock and leave it running. */
- if (wdt->clk)
- clk_prepare_enable(wdt->clk);
+ clk_prepare_enable(wdt->clk);
writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
udelay(1000);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0718/1059] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (716 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0717/1059] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0719/1059] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
` (280 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Feng, Guenter Roeck,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
[ Upstream commit 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986 ]
npcm_wdt_start() unconditionally prepares and enables the watchdog
clock, and npcm_wdt_stop() is the only place that disables it.
npcm_wdt_set_timeout() calls npcm_wdt_start() again whenever the
watchdog is already active, so every WDIOC_SETTIMEOUT ioctl issued
while the watchdog is running takes one extra clock prepare/enable
reference that is never dropped.
Split the register programming out of npcm_wdt_start() into a
__npcm_wdt_start() helper that assumes the clock is already running,
and call the helper from npcm_wdt_set_timeout() instead; only the
watchdog .start callback (and the restart path, which intentionally
keeps the clock) now acquires the clock.
Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261109071004.1506-1-zhaofeng2@cmss.chinamobile.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/npcm_wdt.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index e62ea054bc618..aff1ea1e6b62d 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -63,13 +63,11 @@ static int npcm_wdt_ping(struct watchdog_device *wdd)
return 0;
}
-static int npcm_wdt_start(struct watchdog_device *wdd)
+static void __npcm_wdt_start(struct watchdog_device *wdd)
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- clk_prepare_enable(wdt->clk);
-
if (wdd->timeout < 2)
val = 0x800;
else if (wdd->timeout < 3)
@@ -94,6 +92,15 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
writel(val, wdt->reg);
+}
+
+static int npcm_wdt_start(struct watchdog_device *wdd)
+{
+ struct npcm_wdt *wdt = to_npcm_wdt(wdd);
+
+ clk_prepare_enable(wdt->clk);
+
+ __npcm_wdt_start(wdd);
return 0;
}
@@ -134,7 +141,7 @@ static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
wdd->timeout = 2750;
if (watchdog_active(wdd))
- npcm_wdt_start(wdd);
+ __npcm_wdt_start(wdd);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0719/1059] hwmon: (nct6775) Handle dual use registers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (717 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0718/1059] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0720/1059] sched/deadline: Fix spurious -EPERM for migration-disabled tasks Greg Kroah-Hartman
` (279 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anton Lundin, Guenter Roeck,
Sasha Levin
6.1-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 7e8e265cc6c18..548837c4113a4 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1151,14 +1151,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] 1065+ messages in thread* [PATCH 6.1 0720/1059] sched/deadline: Fix spurious -EPERM for migration-disabled tasks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (718 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0719/1059] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0721/1059] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
` (278 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Peter Zijlstra (Intel),
Ingo Molnar, Sebastian Andrzej Siewior, Juri Lelli, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
[ Upstream commit 6616bffa9b52da1338cf8bff9882404e02b9e361 ]
sched_setattr() can refuse to make a task SCHED_DEADLINE with -EPERM,
even though the task's affinity covers the whole root domain. A retry
can succeed, but the error blames an affinity the task does not have.
__sched_setscheduler() tests p->cpus_ptr, which is not always the task's
affinity. When a task is scheduled out inside a migrate_disable() section,
migrate_disable_switch() points p->cpus_ptr at the current CPU until
migrate_enable(). On PREEMPT_RT every spinlock_t holder is in such a
section, so ordinary kernel work opens the window. Elsewhere, seccomp
filters run in one.
Test p->cpus_mask instead, which keeps the task's affinity and is what
sched_getaffinity() reports. This should be safe because an admitted
task's cpus_mask covers the root domain, so set_cpus_allowed_dl() moves
no bandwidth when migrate_enable() restores p->cpus_ptr.
The following program, run as root, had 553679, 453720 and 424623 of its
1000000 requests refused on three boots of a 4-CPU PREEMPT_RT guest, and
236182, 217174 and 237183 without PREEMPT_RT. With this applied the count
is 0, also with lockdep, and a task pinned to one CPU is still refused:
#define _GNU_SOURCE
#include <errno.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
#define REQUESTS 1000000
#define INSNS 300
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
};
static volatile int stop;
static volatile pid_t target;
static long set(struct attr a)
{
a.size = sizeof(a);
return syscall(SYS_sched_setattr, target, &a, 0);
}
static void *worker(void *arg)
{
struct sock_filter f[INSNS + 1];
struct sock_fprog prog = { .len = INSNS + 1, .filter = f };
int i;
/* Reading the arguments keeps seccomp from caching the result */
for (i = 0; i < INSNS; i++)
f[i] = (struct sock_filter)
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
offsetof(struct seccomp_data, args));
f[INSNS] = (struct sock_filter)
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW);
syscall(SYS_seccomp, SECCOMP_SET_MODE_FILTER, 0, &prog);
target = syscall(SYS_gettid);
while (!stop)
syscall(SYS_getppid);
return arg;
}
static void *hog(void *arg)
{
while (!stop)
;
return arg;
}
int main(void)
{
pthread_t t[9];
long refused = 0;
int i;
pthread_create(&t[0], NULL, worker, NULL);
while (!target)
usleep(100);
for (i = 1; i < 9; i++)
pthread_create(&t[i], NULL, hog, NULL);
for (i = 0; i < REQUESTS; i++) {
/* SCHED_DEADLINE, 2us every 1s */
if (set((struct attr){ .policy = 6, .runtime = 2000,
.deadline = 1000000000,
.period = 1000000000 }) && errno == EPERM)
refused++;
set((struct attr){ .policy = 0 }); /* SCHED_OTHER */
}
stop = 1;
for (i = 0; i < 9; i++)
pthread_join(t[i], NULL);
printf("%ld of %d requests refused\n", refused, REQUESTS);
return 0;
}
An LLM helped find this bug and write this patch and its test.
Fixes: af449901b84c ("sched: Add migrate_disable()")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261102135420.244745-1-parri.andrea@gmail.com
[ sashal: Adapted the hunk to the older file layout, where the code lives in kernel/sched/core.c inside static int __sched_setscheduler() rather than in kernel/sched/syscalls.c. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9a338369262b5..62ffcaa96685e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7660,7 +7660,7 @@ static int __sched_setscheduler(struct task_struct *p,
* the entire root_domain to become SCHED_DEADLINE. We
* will also fail if there's no bandwidth available.
*/
- if (!cpumask_subset(span, p->cpus_ptr) ||
+ if (!cpumask_subset(span, &p->cpus_mask) ||
rq->rd->dl_bw.bw == 0) {
retval = -EPERM;
goto unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0721/1059] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (719 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0720/1059] sched/deadline: Fix spurious -EPERM for migration-disabled tasks Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0722/1059] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE Greg Kroah-Hartman
` (277 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Höppner, Stefan Haberland,
Jens Axboe, Sasha Levin
6.1-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>
[ sashal: adapted the address conversion to the old (__u8 *)((addr_t) ccw->cda) cast instead of dma32_to_virt(), and kept the old misspelled dasd_sleep_on_immediatly() name in context. ]
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 24a3169514a75..c11b0555c75d6 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1390,6 +1390,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 2179ff50fb1a2..25d6d92d5f93d 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -815,20 +815,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 = (__u8 *)((addr_t) 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;
@@ -845,33 +854,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 = (__u8 *)((addr_t) 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,
@@ -891,7 +877,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_immediatly(cqr);
return rc;
}
@@ -929,7 +914,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 7823e6c06e29c..8cb97d3ccb24e 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -176,6 +176,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;
@@ -846,6 +848,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);
+}
+
/* externals in dasd.c */
#define DASD_PROFILE_OFF 0
#define DASD_PROFILE_ON 1
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0722/1059] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (720 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0721/1059] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0723/1059] sched/core: Do not touch SMT siblings that have not joined the core yet Greg Kroah-Hartman
` (276 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Andrea Parri,
Peter Zijlstra (Intel), Ingo Molnar, Vincent Guittot, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
[ Upstream commit 8127ec8458df29bd702db602473042ccb9e619b9 ]
sched_setattr() accepts sched_util_min and sched_util_max values that do
not fit in uclamp_se::value. A single thread can do:
sched_setattr(max = 800) returns 0
sched_setattr(min = 0xfffffffe) returns 0
sched_getattr() min=2046 max=800
which leaves the minimum above both SCHED_CAPACITY_SCALE and the task's own
maximum.
The range check in uclamp_validate() relies on the + 1 wrapping -1, the
reset value, to 0:
if (util_min + 1 > SCHED_CAPACITY_SCALE + 1)
That only works for an unsigned type. util_min and util_max are int and
SCHED_CAPACITY_SCALE is a long, so every negative value passes the check,
and so does INT_MAX, whose + 1 wraps.
uclamp_se_set() then truncates what got through to the 11 bits of
uclamp_se::value, but computes the bucket from the full value. A minimum
of 0xfffff800 is stored as 0 in the top bucket, where uclamp_rq_max_value()
takes it for the highest active clamp once a higher value leaves the rq.
The rq clamp falls below what the remaining tasks requested, and emptying
their bucket trips the WARN_ON_ONCE() in uclamp_rq_dec_id(), without any
privilege:
WARNING: kernel/sched/core.c:1862 at dequeue_task+0x2a3/0x2b0, CPU#0: repro/126
Call Trace:
__schedule+0x933/0x1320
schedule+0x36/0x100
do_nanosleep+0x61/0x190
hrtimer_nanosleep+0xb5/0x1d0
Make util_min and util_max unsigned int, so that -1 is the only value that
wraps. The pair check below is unaffected, since it skips -1 explicitly and
anything else is at most SCHED_CAPACITY_SCALE by then.
Requests that were only accepted because of this now fail with -EINVAL.
The following program triggers the warning when run by any user outside
a child cpu cgroup. With this applied, its 0xfffff800 request fails with
-EINVAL and the warning no longer appears:
#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
uint32_t util_min, util_max;
};
static volatile int stop;
static void set_min(uint32_t v)
{
/* KEEP_POLICY | KEEP_PARAMS | UTIL_CLAMP_MIN */
struct attr a = { .size = sizeof(a), .flags = 0x38, .util_min = v };
syscall(SYS_sched_setattr, 0, &a, 0);
}
static void burn(long us)
{
struct timespec s, n;
clock_gettime(CLOCK_MONOTONIC, &s);
do
clock_gettime(CLOCK_MONOTONIC, &n);
while ((n.tv_sec - s.tv_sec) * 1000000 +
(n.tv_nsec - s.tv_nsec) / 1000 < us);
}
static void *bogus(void *arg)
{
set_min(0xfffff800);
while (!stop)
burn(1000);
return arg;
}
static void *worker(void *arg)
{
long v = (long)arg;
set_min(v);
while (!stop) {
burn(v == 800 ? 300 : 1500);
usleep(100);
}
return arg;
}
int main(void)
{
pthread_t t[3];
cpu_set_t c;
int i;
CPU_ZERO(&c);
CPU_SET(0, &c);
sched_setaffinity(0, sizeof(c), &c);
pthread_create(&t[0], NULL, bogus, NULL);
usleep(50000);
pthread_create(&t[1], NULL, worker, (void *)500L);
pthread_create(&t[2], NULL, worker, (void *)800L);
sleep(15);
stop = 1;
for (i = 0; i < 3; i++)
pthread_join(t[i], NULL);
return 0;
}
An LLM helped find the warning and write this patch and its tests.
Fixes: 480a6ca2dc6e ("sched/uclamp: Allow to reset a task uclamp constraint value")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20261016062629.2102883-1-sh_def%40163.com
Link: https://patch.msgid.link/20261102134831.243255-1-parri.andrea@gmail.com
[ sashal: Applied the same uclamp_validate() change to its location in kernel/sched/core.c instead of kernel/sched/syscalls.c, with context adjusted accordingly. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 62ffcaa96685e..09dc321789b33 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1856,8 +1856,8 @@ static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
static int uclamp_validate(struct task_struct *p,
const struct sched_attr *attr)
{
- int util_min = p->uclamp_req[UCLAMP_MIN].value;
- int util_max = p->uclamp_req[UCLAMP_MAX].value;
+ unsigned int util_min = p->uclamp_req[UCLAMP_MIN].value;
+ unsigned int util_max = p->uclamp_req[UCLAMP_MAX].value;
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) {
util_min = attr->sched_util_min;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0723/1059] sched/core: Do not touch SMT siblings that have not joined the core yet
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (721 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0722/1059] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0724/1059] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
` (275 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+681e729b2cf0d4860042,
Seiji Nishikawa, Peter Zijlstra (Intel), Ingo Molnar, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Nishikawa <snishika@redhat.com>
[ Upstream commit ec6f6731538e0d45872eb279fdeb477bed152d6f ]
When a CPU comes online, it is added to cpu_smt_mask() of its siblings
before sched_core_cpu_starting() sets its rq->core to the core leader.
For example, on x86, ap_starting() calls set_cpu_sibling_map() first,
and calls notify_cpu_starting() after that. This order is intended.
Before sched_core_cpu_starting() runs, rq->core of the new CPU still
points to its own rq. But rq->core_enabled of the new CPU is already
set. __sched_core_flip() sets it for all possible CPUs, also for
offline CPUs, and CPU offline does not clear it. So __rq_lockp() of the
new CPU returns its own rq->__lock. It does not return the core wide
lock.
If a sibling CPU runs pick_next_task() for SCHED_CORE at this time, it
checks all CPUs in cpu_smt_mask(). It calls update_rq_clock() and
pick_task() for the rq of the new CPU. But it holds only its own core
lock, not the lock of the new CPU. Then lockdep shows this warning in
update_rq_clock().
debug_locks && !(lock_is_held(&(__rq_lockp(rq))->dep_map) != 0)
WARNING: kernel/sched/sched.h:1666 at update_rq_clock+0x40a/0xd20 kernel/sched/core.c:875, CPU#0: syz-executor251/5712
Call Trace:
<TASK>
pick_next_task kernel/sched/core.c:6375 [inline]
__schedule+0x1c69/0x6920 kernel/sched/core.c:7199
preempt_schedule_irq+0x4e/0x90 kernel/sched/core.c:7606
The next loops in pick_next_task() also change rq_i->core_pick of this
rq, and can call resched_curr() for it, without its lock.
resched_curr() has the same lockdep_assert_rq_held() check.
__sched_core_account_forceidle() also checks all CPUs in the same mask.
CPU offline does not have this problem. remove_siblinginfo() and
sched_core_cpu_dying() both run in take_cpu_down() under stop_machine.
So no sibling CPU can be in pick_next_task() at that time.
Fix this. In these loops, skip a sibling CPU if its rq->core is
different from our rq->core. At run time, rq->core of a CPU is changed
by sched_core_cpu_starting(), sched_core_cpu_deactivate() and
sched_core_cpu_dying(). The first two hold sched_core_lock(), and
sched_core_lock() takes the rq locks of all CPUs in the SMT mask. The
last one runs under stop_machine, as written above. So while we hold
our core lock, the result of this check does not change. A CPU that is
not in the core yet will pick its own tasks. The comment in the
reschedule loop of pick_next_task() already expects this case.
I tested this with the syzbot C reproducer in QEMU. The two vCPUs were
SMT siblings (-smp 2,sockets=1,cores=1,threads=2). Without this patch,
the warning came after about 100 seconds. Just before the warning, a
debug print showed that the loop on CPU 0 saw CPU 1 with rq->core
pointing to CPU 1 itself, and cpu_online() was false for CPU 1. With
this patch, the same state still happened, but there was no warning
in more than 2 hours.
Fixes: 3c474b3239f1 ("sched: Fix Core-wide rq->lock for uninitialized CPUs")
Closes: https://syzkaller.appspot.com/bug?extid=681e729b2cf0d4860042
Reported-by: syzbot+681e729b2cf0d4860042@syzkaller.appspotmail.com
Signed-off-by: Seiji Nishikawa <snishika@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261104022004.3810619-1-snishika@redhat.com
[ sashal: Context-adapted for the older pick_next_task() (different signature, no restart: label), and the new helpers were placed before the existing cfs_prio_less declaration in sched.h. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/core.c | 8 +++-----
kernel/sched/core_sched.c | 3 +--
kernel/sched/sched.h | 19 +++++++++++++++++++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 09dc321789b33..6369234fd3a13 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5946,7 +5946,6 @@ static struct task_struct *
pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
{
struct task_struct *next, *p, *max = NULL;
- const struct cpumask *smt_mask;
bool fi_before = false;
bool core_clock_updated = (rq == rq->core);
unsigned long cookie;
@@ -5998,7 +5997,6 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
put_prev_task_balance(rq, prev, rf);
- smt_mask = cpu_smt_mask(cpu);
need_sync = !!rq->core->core_cookie;
/* reset state */
@@ -6053,7 +6051,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
*
* Tie-break prio towards the current CPU
*/
- for_each_cpu_wrap(i, smt_mask, cpu) {
+ for_each_core_cpu_wrap(i, rq) {
rq_i = cpu_rq(i);
/*
@@ -6075,7 +6073,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
* For each thread: try and find a runnable task that matches @max or
* force idle.
*/
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
p = rq_i->core_pick;
@@ -6120,7 +6118,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
* their task. This ensures there is no inter-sibling overlap between
* non-matching user state.
*/
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
/*
diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index a57fd8f27498f..681baa739fbcf 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -239,7 +239,6 @@ int sched_core_share_pid(unsigned int cmd, pid_t pid, enum pid_type type,
/* REQUIRES: rq->core's clock recently updated. */
void __sched_core_account_forceidle(struct rq *rq)
{
- const struct cpumask *smt_mask = cpu_smt_mask(cpu_of(rq));
u64 delta, now = rq_clock(rq->core);
struct rq *rq_i;
struct task_struct *p;
@@ -271,7 +270,7 @@ void __sched_core_account_forceidle(struct rq *rq)
delta = div_u64(delta, rq->core->core_forceidle_occupation);
}
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
p = rq_i->core_pick ?: rq_i->curr;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index accff24e091e4..f749104c6496a 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1241,6 +1241,25 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
return &rq->__lock;
}
+/*
+ * A CPU coming online is set in cpu_smt_mask() before
+ * sched_core_cpu_starting() links its rq->core to the core leader.
+ * Until then it does not share the core-wide lock, so it must not be
+ * touched as part of the core.
+ */
+static inline bool sched_core_sibling(struct rq *rq, struct rq *rq_i)
+{
+ return rq_i->core == rq->core;
+}
+
+#define for_each_core_cpu(i, rq) \
+ for_each_cpu(i, cpu_smt_mask(rq->cpu)) \
+ if (sched_core_sibling(rq, cpu_rq(i)))
+
+#define for_each_core_cpu_wrap(i, rq) \
+ for_each_cpu_wrap(i, cpu_smt_mask(rq->cpu), rq->cpu) \
+ if (sched_core_sibling(rq, cpu_rq(i)))
+
bool cfs_prio_less(struct task_struct *a, struct task_struct *b, bool fi);
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0724/1059] ksmbd: skip metadata-only opens in sharing checks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (722 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0723/1059] sched/core: Do not touch SMT siblings that have not joined the core yet Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0725/1059] tracing/probes: Check enabled and busy state before unlinking sibling probes Greg Kroah-Hartman
` (274 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ian Bridges, Namjae Jeon,
Sasha Levin
6.1-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>
[ sashal: Adapted to the older tree: mnt_idmap became mnt_user_ns, and the unlock call, m_lock locking and surrounding context differ, with the allocation_size_set and posix fields absent. ]
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 cd01774de5f0c..f951c6047c16a 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2533,7 +2533,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 user_namespace *user_ns = mnt_user_ns(path->mnt);
size_t xattr_stream_size;
@@ -2571,6 +2572,8 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,
rc = ksmbd_vfs_setxattr(user_ns, 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;
}
@@ -2808,6 +2811,7 @@ int smb2_open(struct ksmbd_work *work)
char *name = NULL;
char *stream_name = NULL;
bool file_present = false, created = false, already_permitted = false;
+ bool stream_created = false;
int share_ret, need_truncate = 0;
u64 time;
umode_t posix_mode = 0;
@@ -3359,7 +3363,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;
@@ -3367,10 +3372,22 @@ 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 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.
*/
write_lock(&fp->f_ci->m_lock);
list_add(&fp->node, &fp->f_ci->m_fp_list);
@@ -3385,11 +3402,8 @@ int smb2_open(struct ksmbd_work *work)
if (file_present || created)
ksmbd_vfs_kern_path_unlock(&parent_path, &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;
- }
req_op_level = req->RequestedOplockLevel;
if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
index 85e29f63813e2..a2b2b5be1803a 100644
--- a/fs/smb/server/smb_common.c
+++ b/fs/smb/server/smb_common.c
@@ -661,10 +661,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
@@ -685,6 +699,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,
@@ -711,7 +743,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 75de404a9efcc..cc886e9106456 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -153,6 +153,10 @@
#define SMB_COM_NEGOTIATE 0x72
#define SMB1_CLIENT_GUID_SIZE (16)
+/* 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 SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */
#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40)
@@ -410,6 +414,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 ffa2737e279af..51ad1be4acc0e 100644
--- a/fs/smb/server/vfs_cache.h
+++ b/fs/smb/server/vfs_cache.h
@@ -96,6 +96,8 @@ struct ksmbd_file {
bool is_nt_open;
bool attrib_only;
+ /* writes data on open, see ksmbd_sharing_daccess() */
+ bool implied_write;
char client_guid[16];
char create_guid[16];
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0725/1059] tracing/probes: Check enabled and busy state before unlinking sibling probes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (723 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0724/1059] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0726/1059] tracing/probes: Enable newly appended probe when target event is enabled Greg Kroah-Hartman
` (273 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit f1d9b7a3fe99b4228acdbab3c744c29f7ffe86ef ]
When a multiprobe event is enabled or referenced (for example, by an
eprobe, trigger, or open tracefs file) and a user attempts to delete the
event or one of its probes via dynamic_events, checking
trace_probe_has_sibling() before the enabled and busy checks allows the
first probe to be unlinked and freed while the event is still active,
only returning -EBUSY on the last sibling probe. For uprobe events,
unlinking and freeing an enabled sibling probe without unregistering its
uprobe_consumer also causes a use-after-free.
Ensure all four probe types (kprobe, fprobe, uprobe, and eprobe) verify
that the event is neither enabled nor busy before unlinking any sibling
probe.
Link: https://lore.kernel.org/all/179455848898.403392.17675270675769076596.stgit@devnote2/
Fixes: ca89bc071d5e ("tracing/kprobe: Add multi-probe per event support")
Fixes: 41af3cf587f4 ("tracing/uprobe: Add multi-probe per uprobe event support")
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ sashal: Dropped the trace_fprobe.c hunk because this tree has no fprobe trace events; the kprobe, uprobe and eprobe hunks applied unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_eprobe.c | 12 ++++++++----
kernel/trace/trace_kprobe.c | 8 ++++----
kernel/trace/trace_uprobe.c | 8 ++++++--
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 7de2f905e5970..ec92816701718 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -88,14 +88,18 @@ static int eprobe_dyn_event_show(struct seq_file *m, struct dyn_event *ev)
static int unregister_trace_eprobe(struct trace_eprobe *ep)
{
- /* If other probes are on the event, just unregister eprobe */
- if (trace_probe_has_sibling(&ep->tp))
- goto unreg;
-
/* Enabled event can not be unregistered */
if (trace_probe_is_enabled(&ep->tp))
return -EBUSY;
+ /* If there's a reference to the dynamic event */
+ if (trace_event_dyn_busy(trace_probe_event_call(&ep->tp)))
+ return -EBUSY;
+
+ /* If other probes are on the event, just unregister eprobe */
+ if (trace_probe_has_sibling(&ep->tp))
+ goto unreg;
+
/* Will fail if probe is being used by ftrace or perf */
if (trace_probe_unregister_event_call(&ep->tp))
return -EBUSY;
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 4dbc2d8bc69c8..f8ce7fe47699e 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -531,10 +531,6 @@ static void __unregister_trace_kprobe(struct trace_kprobe *tk)
/* Unregister a trace_probe and probe_event */
static int unregister_trace_kprobe(struct trace_kprobe *tk)
{
- /* If other probes are on the event, just unregister kprobe */
- if (trace_probe_has_sibling(&tk->tp))
- goto unreg;
-
/* Enabled event can not be unregistered */
if (trace_probe_is_enabled(&tk->tp))
return -EBUSY;
@@ -543,6 +539,10 @@ static int unregister_trace_kprobe(struct trace_kprobe *tk)
if (trace_event_dyn_busy(trace_probe_event_call(&tk->tp)))
return -EBUSY;
+ /* If other probes are on the event, just unregister kprobe */
+ if (trace_probe_has_sibling(&tk->tp))
+ goto unreg;
+
/* Will fail if probe is being used by ftrace or perf */
if (unregister_kprobe_event(tk))
return -EBUSY;
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index a930ef372ef42..4e50f405dc4d9 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -391,13 +391,17 @@ static int unregister_trace_uprobe(struct trace_uprobe *tu)
{
int ret;
- if (trace_probe_has_sibling(&tu->tp))
- goto unreg;
+ /* Enabled event can not be unregistered */
+ if (trace_probe_is_enabled(&tu->tp))
+ return -EBUSY;
/* If there's a reference to the dynamic event */
if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp)))
return -EBUSY;
+ if (trace_probe_has_sibling(&tu->tp))
+ goto unreg;
+
ret = unregister_uprobe_event(tu);
if (ret)
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0726/1059] tracing/probes: Enable newly appended probe when target event is enabled
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (724 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0725/1059] tracing/probes: Check enabled and busy state before unlinking sibling probes Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0727/1059] wifi: mac80211_hwsim: ignore non-generic netlink releases Greg Kroah-Hartman
` (272 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 72d3a5cb0cd7335553549aaffecc683e3ecc0c43 ]
Unlike kprobe events, fprobe and uprobe events only register their
underlying probes when the trace event is enabled. When a new probe is
appended to an existing multiprobe fprobe or uprobe event that is
already enabled, the appended probe is linked into the event's probe
list without being registered.
As a result, the newly appended probe never fires until the event is
disabled and re-enabled. Moreover, disabling an fprobe event calls
unregister_fprobe() on the unregistered fprobe, and opening or closing a
perf event on an enabled uprobe event dereferences a NULL tu->uprobe in
uprobe_apply().
Register and enable the newly appended fprobe or uprobe immediately when
the target event is already enabled.
Link: https://lore.kernel.org/all/179455849798.403392.135678786198324285.stgit@devnote2/
Fixes: 41af3cf587f4 ("tracing/uprobe: Add multi-probe per uprobe event support")
Fixes: 2db832ec9090 ("tracing: fprobe-events: Register fprobe-events only when it is enabled")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ sashal: Adapted to the older uprobe API: the filter callback keeps its ctx argument, and trace_uprobe_enable() uses tu->inode with uprobe_register()/uprobe_register_refctr() instead of struct uprobe pointers. The fprobe hunks are dropped. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_uprobe.c | 71 +++++++++++++++++++++++--------------
1 file changed, 45 insertions(+), 26 deletions(-)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 4e50f405dc4d9..e7adb8d702612 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -442,6 +442,36 @@ static bool trace_uprobe_has_same_uprobe(struct trace_uprobe *orig,
return false;
}
+typedef bool (*filter_func_t)(struct uprobe_consumer *self,
+ enum uprobe_filter_ctx ctx,
+ struct mm_struct *mm);
+
+#ifdef CONFIG_PERF_EVENTS
+static bool uprobe_perf_filter(struct uprobe_consumer *uc,
+ enum uprobe_filter_ctx ctx, struct mm_struct *mm);
+#else
+#define uprobe_perf_filter NULL
+#endif
+
+static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter)
+{
+ int ret;
+
+ tu->consumer.filter = filter;
+ tu->inode = d_real_inode(tu->path.dentry);
+
+ if (tu->ref_ctr_offset)
+ ret = uprobe_register_refctr(tu->inode, tu->offset,
+ tu->ref_ctr_offset, &tu->consumer);
+ else
+ ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
+
+ if (ret)
+ tu->inode = NULL;
+
+ return ret;
+}
+
static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to)
{
int ret;
@@ -461,10 +491,22 @@ static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to)
/* Append to existing event */
ret = trace_probe_append(&tu->tp, &to->tp);
- if (!ret)
- dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp));
+ if (ret)
+ return ret;
- return ret;
+ if (trace_probe_is_enabled(&tu->tp)) {
+ ret = trace_uprobe_enable(tu,
+ trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE) ?
+ uprobe_perf_filter : NULL);
+ if (ret) {
+ trace_probe_unlink(&tu->tp);
+ return ret;
+ }
+ }
+
+ dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp));
+
+ return 0;
}
/*
@@ -1076,29 +1118,6 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
return trace_handle_return(s);
}
-typedef bool (*filter_func_t)(struct uprobe_consumer *self,
- enum uprobe_filter_ctx ctx,
- struct mm_struct *mm);
-
-static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter)
-{
- int ret;
-
- tu->consumer.filter = filter;
- tu->inode = d_real_inode(tu->path.dentry);
-
- if (tu->ref_ctr_offset)
- ret = uprobe_register_refctr(tu->inode, tu->offset,
- tu->ref_ctr_offset, &tu->consumer);
- else
- ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
-
- if (ret)
- tu->inode = NULL;
-
- return ret;
-}
-
static void __probe_event_disable(struct trace_probe *tp)
{
struct trace_uprobe *tu;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0727/1059] wifi: mac80211_hwsim: ignore non-generic netlink releases
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (725 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0726/1059] tracing/probes: Enable newly appended probe when target event is enabled Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0728/1059] tracing/probes: Fix user-space dereference string array store type Greg Kroah-Hartman
` (271 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit 989f47c56e48d442d79497a25ed946d029c4dc53 ]
Closing an unrelated netlink socket can remove mac80211_hwsim radios or
clear the active wmediumd registration when its port ID matches a generic
netlink socket.
mac80211_hwsim_netlink_notify() handles every NETLINK_URELEASE event,
but netlink port IDs are scoped by protocol. The notifier therefore treats
a release from another protocol as a MAC80211_HWSIM socket release.
Ignore release notifications unless they come from NETLINK_GENERIC.
LLM assistance was used to find the bug and review.
Fixes: 7882513bacb1 ("mac80211_hwsim driver support userspace frame tx/rx")
Fixes: e9ed49bf4c2c ("mac80211-hwsim: Add support for HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141751.6728-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mac80211_hwsim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 8ebc76cbb0d98..7b076fab1f1d1 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -5412,7 +5412,7 @@ static int mac80211_hwsim_netlink_notify(struct notifier_block *nb,
{
struct netlink_notify *notify = _notify;
- if (state != NETLINK_URELEASE)
+ if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
return NOTIFY_DONE;
remove_user_radios(notify->portid);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0728/1059] tracing/probes: Fix user-space dereference string array store type
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (726 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0727/1059] wifi: mac80211_hwsim: ignore non-generic netlink releases Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0729/1059] wifi: mac80211: drain link readers before stopping removed links Greg Kroah-Hartman
` (270 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 2721573e6c6faaba2e31f352f2c02ec5f3ecf5e9 ]
When finalizing a string array argument (e.g. +0u(%reg):string[N]),
finalize_fetch_insn() advances the instruction pointer to a new slot
for the store operation before checking whether the preceding operation
was FETCH_OP_UDEREF. As a result, user-space dereference string arrays
with type "string" emit FETCH_OP_ST_STRING (kernel memory read) instead
of FETCH_OP_ST_USTRING.
Check for FETCH_OP_UDEREF before advancing the instruction pointer.
Link: https://lore.kernel.org/all/179455854396.403392.18073771811100192405.stgit@devnote2/
Fixes: e65f7ae7f4da ("tracing/probe: Support user-space dereference")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ sashal: Adapted to older code: the string store logic sits inline in traceprobe_parse_probe_arg_body() rather than finalize_fetch_insn(), and the context uses FETCH_OP_DATA instead of FETCH_OP_IMMSTR. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_probe.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index f5df2a2d3681d..9fdd0cbf50143 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -679,6 +679,8 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
ret = -EINVAL;
/* Store operation */
if (parg->type->is_string) {
+ bool is_uderef;
+
if (!strcmp(parg->type->name, "symstr")) {
if (code->op != FETCH_OP_REG && code->op != FETCH_OP_STACK &&
code->op != FETCH_OP_RETVAL && code->op != FETCH_OP_ARG &&
@@ -696,6 +698,8 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
goto fail;
}
}
+
+ is_uderef = (code->op == FETCH_OP_UDEREF);
if (!strcmp(parg->type->name, "symstr") ||
(code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM ||
code->op == FETCH_OP_DATA) || code->op == FETCH_OP_TP_ARG ||
@@ -715,8 +719,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
}
}
/* If op == DEREF, replace it with STRING */
- if (!strcmp(parg->type->name, "ustring") ||
- code->op == FETCH_OP_UDEREF)
+ if (!strcmp(parg->type->name, "ustring") || is_uderef)
code->op = FETCH_OP_ST_USTRING;
else if (!strcmp(parg->type->name, "symstr"))
code->op = FETCH_OP_ST_SYMSTR;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0729/1059] wifi: mac80211: drain link readers before stopping removed links
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (727 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0728/1059] tracing/probes: Fix user-space dereference string array store type Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0730/1059] tracing/probes: Reject array count on non-dereference string sources Greg Kroah-Hartman
` (269 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit 745f5d04395dfc4c311f443c7c04ccb00c436984 ]
Removing an MLO link can leave work queued on its link container after
the container is freed.
ieee80211_tear_down_links() stops each link before the RCU grace period.
A reader that fetched the link earlier can therefore queue work after
ieee80211_link_stop() has canceled it. ieee80211_request_smps() and
ieee80211_csa_finish() can both reach this window.
Record each removed link while removing its keys and debugfs state. Wait
for RCU readers, then stop the recorded links so cancellation includes
work queued by those readers. Free the detached keys after the grace
period as before.
LLM assistance was used to find the bug and review.
Fixes: efe9c2bfd1a8 ("wifi: mac80211: isolate driver from inactive links")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141708.5532-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Reordered the removed-link stop loop into two passes so the cancel runs after synchronize_rcu(); context differs because the older tree lacks ieee80211_link_debugfs_remove(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/link.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/link.c b/net/mac80211/link.c
index abca9d627cfc2..271bbb05bfde9 100644
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -80,6 +80,7 @@ struct link_container {
static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata,
struct link_container **links, u16 mask)
{
+ struct ieee80211_link_data *stop[IEEE80211_MLD_MAX_NUM_LINKS] = {};
struct ieee80211_link_data *link;
LIST_HEAD(keys);
unsigned int link_id;
@@ -93,11 +94,16 @@ static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata,
if (WARN_ON(!link))
continue;
ieee80211_remove_link_keys(link, &keys);
- ieee80211_link_stop(link);
+ stop[link_id] = link;
}
+ /* drain RCU readers before cancelling work they may queue */
synchronize_rcu();
+ for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++)
+ if (stop[link_id])
+ ieee80211_link_stop(stop[link_id]);
+
ieee80211_free_key_list(sdata->local, &keys);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0730/1059] tracing/probes: Reject array count on non-dereference string sources
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (728 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0729/1059] wifi: mac80211: drain link readers before stopping removed links Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0731/1059] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
` (268 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 0941144ebeaf3ce46c80711f00e935921eb28b21 ]
The runtime array loop (FETCH_OP_LP_ARRAY) for string types requires a
preceding memory dereference instruction so it can advance the pointer
address on each iteration. Non-dereference string sources such as $comm,
immediate strings, and eprobe event fields cannot be indexed as pointer
arrays, but finalize_fetch_insn() still accepts an array count on them
and emits an invalid FETCH_OP_LP_ARRAY sequence.
Reject string array counts when the preceding operation is not a memory
dereference.
Link: https://lore.kernel.org/all/179455855309.403392.4197028577158545202.stgit@devnote2/
Fixes: 40b53b771806 ("tracing: probeevent: Add array type support")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ sashal: Added a check rejecting string-array counts on non-dereference sources, inlined in the parser with goto fail, plus a FETCH_OP_TP_ARG case in the fail: cleanup to free the string. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_probe.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 9fdd0cbf50143..c1d12d56af124 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -712,6 +712,12 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
* For the symstr, it doesn't need to dereference, thus
* it just get the value.
*/
+ if (parg->count && (code->op != FETCH_OP_DEREF &&
+ code->op != FETCH_OP_UDEREF)) {
+ trace_probe_log_err(offset + (t ? (t - arg) : 0),
+ BAD_STRING);
+ goto fail;
+ }
code++;
if (code->op != FETCH_OP_NOP) {
trace_probe_log_err(offset, TOO_MANY_OPS);
@@ -784,7 +790,8 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
if (ret) {
for (code = tmp; code < tmp + FETCH_INSN_MAX; code++)
if (code->op == FETCH_NOP_SYMBOL ||
- code->op == FETCH_OP_DATA)
+ code->op == FETCH_OP_DATA ||
+ code->op == FETCH_OP_TP_ARG)
kfree(code->data);
}
kfree(tmp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0731/1059] gpio: mvebu: name regmaps to fix debugfs collisions
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (729 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0730/1059] tracing/probes: Reject array count on non-dereference string sources Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0732/1059] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
` (267 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Linus Walleij,
Bartosz Golaszewski, Sasha Levin
6.1-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 0abf413170324..8e893aef83d56 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -603,6 +603,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,
@@ -843,7 +858,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);
@@ -1112,7 +1127,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] 1065+ messages in thread* [PATCH 6.1 0732/1059] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (730 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0731/1059] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0733/1059] mtd: core: avoid double-free of OTP NVMEM device Greg Kroah-Hartman
` (266 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski,
Sasha Levin
6.1-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 8e893aef83d56..399eece49235e 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -607,6 +607,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 = {
@@ -614,6 +615,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] 1065+ messages in thread* [PATCH 6.1 0733/1059] mtd: core: avoid double-free of OTP NVMEM device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (731 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0732/1059] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0734/1059] Bluetooth: hci_h5: Add ability to allocate memory for private data Greg Kroah-Hartman
` (265 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Miquel Raynal,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit 26300879cd8e4612dce66bb8f6ff7cd35fcf3e59 ]
If factory OTP setup fails after the user OTP NVMEM device has been
registered, mtd_otp_nvmem_add() unregisters the user device but leaves
mtd->otp_user_nvmem set. On an error, the caller unregisters it again.
For -EOPNOTSUPP, registration continues and normal teardown unregisters
it again.
Clear mtd->otp_user_nvmem after unregistering it.
Fixes: e0489f6e221f ("mtd: core: fix error path for nvmem provider")
Fixes: fe0b8213c012 ("mtd: core: Don't fail mtd_otp_nvmem_add() if OTP is unsupported")
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[ sashal: Context differs because this tree lacks the -EOPNOTSUPP handling, so the err: block ends in a plain "return err;" and the added NULL assignment sits before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mtd/mtdcore.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 544ae46d95c25..93280c55381fa 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1004,6 +1004,7 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
err:
nvmem_unregister(mtd->otp_user_nvmem);
+ mtd->otp_user_nvmem = NULL;
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0734/1059] Bluetooth: hci_h5: Add ability to allocate memory for private data
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (732 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0733/1059] mtd: core: avoid double-free of OTP NVMEM device Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0735/1059] Bluetooth: btrtl: fix out of bounds memory access Greg Kroah-Hartman
` (264 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrey Skvortsov,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Skvortsov <andrej.skvortzov@gmail.com>
[ Upstream commit 7a6d793e9ca8bc0c1d2f0aa0a02ec380d1124c74 ]
In some cases uart-base drivers may need to use priv data. For
example, to store information needed for devcoredump.
Fixes: 044014ce85a1 ("Bluetooth: btrtl: Add Realtek devcoredump support")
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/hci_h5.c | 4 +++-
drivers/bluetooth/hci_serdev.c | 9 +++++----
drivers/bluetooth/hci_uart.h | 12 +++++++++++-
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index c93307c9595e6..6d9ccf104d95c 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -113,6 +113,7 @@ struct h5_vnd {
int (*suspend)(struct h5 *h5);
int (*resume)(struct h5 *h5);
const struct acpi_gpio_mapping *acpi_gpio_map;
+ int sizeof_priv;
};
struct h5_device_data {
@@ -861,7 +862,8 @@ static int h5_serdev_probe(struct serdev_device *serdev)
if (IS_ERR(h5->device_wake_gpio))
return PTR_ERR(h5->device_wake_gpio);
- return hci_uart_register_device(&h5->serdev_hu, &h5p);
+ return hci_uart_register_device_priv(&h5->serdev_hu, &h5p,
+ h5->vnd->sizeof_priv);
}
static void h5_serdev_remove(struct serdev_device *serdev)
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index 158b057ed3a6d..753343ca84895 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -300,8 +300,9 @@ static const struct serdev_device_ops hci_serdev_client_ops = {
.write_wakeup = hci_uart_write_wakeup,
};
-int hci_uart_register_device(struct hci_uart *hu,
- const struct hci_uart_proto *p)
+int hci_uart_register_device_priv(struct hci_uart *hu,
+ const struct hci_uart_proto *p,
+ int sizeof_priv)
{
int err;
struct hci_dev *hdev;
@@ -325,7 +326,7 @@ int hci_uart_register_device(struct hci_uart *hu,
set_bit(HCI_UART_PROTO_READY, &hu->flags);
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev_priv(sizeof_priv);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
err = -ENOMEM;
@@ -389,7 +390,7 @@ int hci_uart_register_device(struct hci_uart *hu,
percpu_free_rwsem(&hu->proto_lock);
return err;
}
-EXPORT_SYMBOL_GPL(hci_uart_register_device);
+EXPORT_SYMBOL_GPL(hci_uart_register_device_priv);
void hci_uart_unregister_device(struct hci_uart *hu)
{
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index 70449949d5276..39f39704be41f 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -97,7 +97,17 @@ struct hci_uart {
int hci_uart_register_proto(const struct hci_uart_proto *p);
int hci_uart_unregister_proto(const struct hci_uart_proto *p);
-int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p);
+
+int hci_uart_register_device_priv(struct hci_uart *hu,
+ const struct hci_uart_proto *p,
+ int sizeof_priv);
+
+static inline int hci_uart_register_device(struct hci_uart *hu,
+ const struct hci_uart_proto *p)
+{
+ return hci_uart_register_device_priv(hu, p, 0);
+}
+
void hci_uart_unregister_device(struct hci_uart *hu);
int hci_uart_tx_wakeup(struct hci_uart *hu);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0735/1059] Bluetooth: btrtl: fix out of bounds memory access
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (733 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0734/1059] Bluetooth: hci_h5: Add ability to allocate memory for private data Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0736/1059] selftests: net: reuseport_bpf_numa: include stdbool.h Greg Kroah-Hartman
` (263 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrey Skvortsov,
Luiz Augusto von Dentz, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Skvortsov <andrej.skvortzov@gmail.com>
[ Upstream commit de4e88ec58c4202efd1f02eebb4939bbf6945358 ]
The problem is detected by KASAN.
btrtl driver uses private hci data to store 'struct btrealtek_data'.
If btrtl driver is used with btusb, then memory for private hci data
is allocated in btusb. But no private data is allocated after hci_dev,
when btrtl is used with hci_h5.
This commit adds memory allocation for hci_h5 case.
==================================================================
BUG: KASAN: slab-out-of-bounds in btrtl_initialize+0x6cc/0x958 [btrtl]
Write of size 8 at addr ffff00000f5a5748 by task kworker/u9:0/76
Hardware name: Pine64 PinePhone (1.2) (DT)
Workqueue: hci0 hci_power_on [bluetooth]
Call trace:
dump_backtrace+0x9c/0x128
show_stack+0x20/0x38
dump_stack_lvl+0x48/0x60
print_report+0xf8/0x5d8
kasan_report+0x90/0xd0
__asan_store8+0x9c/0xc0
[btrtl]
h5_btrtl_setup+0xd0/0x2f8 [hci_uart]
h5_setup+0x50/0x80 [hci_uart]
hci_uart_setup+0xd4/0x260 [hci_uart]
hci_dev_open_sync+0x1cc/0xf68 [bluetooth]
hci_dev_do_open+0x34/0x90 [bluetooth]
hci_power_on+0xc4/0x3c8 [bluetooth]
process_one_work+0x328/0x6f0
worker_thread+0x410/0x778
kthread+0x168/0x178
ret_from_fork+0x10/0x20
Allocated by task 53:
kasan_save_stack+0x3c/0x68
kasan_save_track+0x20/0x40
kasan_save_alloc_info+0x68/0x78
__kasan_kmalloc+0xd4/0xd8
__kmalloc+0x1b4/0x3b0
hci_alloc_dev_priv+0x28/0xa58 [bluetooth]
hci_uart_register_device+0x118/0x4f8 [hci_uart]
h5_serdev_probe+0xf4/0x178 [hci_uart]
serdev_drv_probe+0x54/0xa0
really_probe+0x254/0x588
__driver_probe_device+0xc4/0x210
driver_probe_device+0x64/0x160
__driver_attach_async_helper+0x88/0x158
async_run_entry_fn+0xd0/0x388
process_one_work+0x328/0x6f0
worker_thread+0x410/0x778
kthread+0x168/0x178
ret_from_fork+0x10/0x20
Last potentially related work creation:
kasan_save_stack+0x3c/0x68
__kasan_record_aux_stack+0xb0/0x150
kasan_record_aux_stack_noalloc+0x14/0x20
__queue_work+0x33c/0x960
queue_work_on+0x98/0xc0
hci_recv_frame+0xc8/0x1e8 [bluetooth]
h5_complete_rx_pkt+0x2c8/0x800 [hci_uart]
h5_rx_payload+0x98/0xb8 [hci_uart]
h5_recv+0x158/0x3d8 [hci_uart]
hci_uart_receive_buf+0xa0/0xe8 [hci_uart]
ttyport_receive_buf+0xac/0x178
flush_to_ldisc+0x130/0x2c8
process_one_work+0x328/0x6f0
worker_thread+0x410/0x778
kthread+0x168/0x178
ret_from_fork+0x10/0x20
Second to last potentially related work creation:
kasan_save_stack+0x3c/0x68
__kasan_record_aux_stack+0xb0/0x150
kasan_record_aux_stack_noalloc+0x14/0x20
__queue_work+0x788/0x960
queue_work_on+0x98/0xc0
__hci_cmd_sync_sk+0x23c/0x7a0 [bluetooth]
__hci_cmd_sync+0x24/0x38 [bluetooth]
btrtl_initialize+0x760/0x958 [btrtl]
h5_btrtl_setup+0xd0/0x2f8 [hci_uart]
h5_setup+0x50/0x80 [hci_uart]
hci_uart_setup+0xd4/0x260 [hci_uart]
hci_dev_open_sync+0x1cc/0xf68 [bluetooth]
hci_dev_do_open+0x34/0x90 [bluetooth]
hci_power_on+0xc4/0x3c8 [bluetooth]
process_one_work+0x328/0x6f0
worker_thread+0x410/0x778
kthread+0x168/0x178
ret_from_fork+0x10/0x20
==================================================================
Fixes: 5b355944b190 ("Bluetooth: btrtl: Add btrealtek data struct")
Fixes: 044014ce85a1 ("Bluetooth: btrtl: Add Realtek devcoredump support")
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/hci_h5.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 6d9ccf104d95c..3d2787c6f5b2d 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -1072,6 +1072,7 @@ static struct h5_vnd rtl_vnd = {
.suspend = h5_btrtl_suspend,
.resume = h5_btrtl_resume,
.acpi_gpio_map = acpi_btrtl_gpios,
+ .sizeof_priv = sizeof(struct btrealtek_data),
};
static const struct h5_device_data h5_data_rtl8822cs = {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0736/1059] selftests: net: reuseport_bpf_numa: include stdbool.h
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (734 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0735/1059] Bluetooth: btrtl: fix out of bounds memory access Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0737/1059] smb: client: skip NULL channel in __cifs_put_smb_ses() Greg Kroah-Hartman
` (262 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
The backport of commit 88b8d85e889e ("selftests: net: reuseport_bpf_numa:
consider cpuless numa node") uses bool, and nothing this file includes
provides it in this tree, so the selftest fails to build with "unknown
type name 'bool'".
Upstream fixed this with commit f2662ec26b26 ("selftests: kselftest:
Create ksft_print_dbg_msg()"), which includes stdbool.h from kselftest.h.
That commit does not apply to this tree, so include <stdbool.h> here
instead.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/net/reuseport_bpf_numa.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index b04b511809ad2..627b56f0129c0 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -14,6 +14,7 @@
#include <linux/in.h>
#include <linux/unistd.h>
#include <sched.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0737/1059] smb: client: skip NULL channel in __cifs_put_smb_ses()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (735 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0736/1059] selftests: net: reuseport_bpf_numa: include stdbool.h Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0738/1059] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Greg Kroah-Hartman
` (261 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joseph Qi, Paulo Alcantara,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <joseph.qi@linux.alibaba.com>
[ Upstream commit 8deaf64a59a263161dfc5128f8398fb3dcba4fac ]
cifs_chan_skip_or_disable() clears a secondary channel's slot in the
session (ses->chans[chan_index].server = NULL) without lowering
chan_count when the server stops supporting multichannel. When the
session is later released, __cifs_put_smb_ses() walks every slot up to
chan_count and calls cifs_put_tcp_session() on it, which dereferences
the server pointer immediately, so a slot left NULL by the skip path
makes the release crash with a NULL pointer dereference.
Clearing a slot without lowering chan_count is older than
cifs_chan_skip_or_disable(): cifs_chan_update_iface() could already do
the same since commit b54034a73baf9 ("cifs: during reconnect, update
interface if necessary"), and the release loop has been unguarded
since then. Commit 12d1e301bdfd1 ("cifs: do not let
cifs_chan_update_iface deallocate channels") later removed that
trigger, but the crash is reachable through it on older kernels.
cifs_decrease_secondary_channels() already guards the same put with
if (server). Add the same guard to the release loop so a skipped
channel slot is left alone.
Fixes: b54034a73baf9 ("cifs: during reconnect, update interface if necessary")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
[ sashal: adapted the hunk to this tree's cifs_put_smb_ses() loop, which is nested one level deeper and uses a cached chan_count, so the NULL-check guard sits at different indentation and context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/connect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index df8634228cbad..8d2a586f9631c 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2103,7 +2103,8 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
kref_put(&ses->chans[i].iface->refcount, release_iface);
ses->chans[i].iface = NULL;
}
- cifs_put_tcp_session(ses->chans[i].server, 0);
+ if (ses->chans[i].server)
+ cifs_put_tcp_session(ses->chans[i].server, 0);
ses->chans[i].server = NULL;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0738/1059] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (736 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0737/1059] smb: client: skip NULL channel in __cifs_put_smb_ses() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0739/1059] misc: vmw_vmci: wait for callbacks in event unsubscribe Greg Kroah-Hartman
` (260 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bryan Tan, Vishnu Dasa,
Uladzislau Rezki (Sony), Paul E. McKenney,
Joel Fernandes (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uladzislau Rezki (Sony) <urezki@gmail.com>
[ Upstream commit 09b2286af617bc6f9480404b565393628f86037d ]
The kvfree_rcu() macro's single-argument form is deprecated. Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.
Cc: Bryan Tan <bryantan@vmware.com>
Cc: Vishnu Dasa <vdasa@vmware.com>
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Stable-dep-of: 824a27d391cf ("misc: vmw_vmci: wait for callbacks in event unsubscribe")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/misc/vmw_vmci/vmci_context.c | 2 +-
drivers/misc/vmw_vmci/vmci_event.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index 172696abce31b..f22b44827e929 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -687,7 +687,7 @@ int vmci_ctx_remove_notification(u32 context_id, u32 remote_cid)
spin_unlock(&context->lock);
if (notifier)
- kvfree_rcu(notifier);
+ kvfree_rcu_mightsleep(notifier);
vmci_ctx_put(context);
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index 5c35874671783..89ab9f05b88c5 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -213,7 +213,7 @@ int vmci_event_unsubscribe(u32 sub_id)
if (!s)
return VMCI_ERROR_NOT_FOUND;
- kvfree_rcu(s);
+ kvfree_rcu_mightsleep(s);
return VMCI_SUCCESS;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0739/1059] misc: vmw_vmci: wait for callbacks in event unsubscribe
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (737 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0738/1059] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0740/1059] usb: gadget: u_serial: pin ports while TTYs are installed Greg Kroah-Hartman
` (259 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Bryan Tan, Vishnu Dasa,
Broadcom internal kernel review list, Arnd Bergmann, Josef Bacik,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 824a27d391cf934d3232e8e2dabee221fc4e18ae ]
event_deliver() calls the callbacks of the subscribers inside an RCU read
side critical section. vmci_event_unsubscribe() used to call
synchronize_rcu() before it freed the subscription. This did more than
to protect the struct vmci_subscription: when the function returned, no
callback was running any more, and its callers rely on that.
vmci_transport_free_resources() unsubscribes from
VMCI_EVENT_QP_PEER_DETACH and frees the struct vmci_transport, which is
the callback data, a few lines later:
CPU0 CPU1
event_deliver()
rcu_read_lock()
vmci_transport_peer_detach_cb()
vmci_event_unsubscribe()
list_del_rcu(&s->node)
kvfree_rcu_mightsleep(s)
kfree(transport)
spin_lock_bh(&trans->lock)
The event is sent when the peer of the queue pair detaches, so the other
end of a vsock connection chooses the time. vmci_transport_exit() and
vmci_guest_remove_device() unsubscribe callbacks which are gone with
their module.
kvfree_rcu_mightsleep() only waits for a grace period if it cannot
allocate memory. Bring the synchronize_rcu() back. The cleanup work of
the vmci transport now waits for one grace period per socket again.
Fixes: 6da3f33770e0 ("misc: vmw_vmci: Switch to kvfree_rcu() API")
Cc: stable <stable@kernel.org>
Cc: Bryan Tan <bryan-bt.tan@broadcom.com>
Cc: Vishnu Dasa <vishnu.dasa@broadcom.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/2026102715-escapable-quaintly-8530@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/misc/vmw_vmci/vmci_event.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index 89ab9f05b88c5..dcfe639abcb5e 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -213,7 +213,12 @@ int vmci_event_unsubscribe(u32 sub_id)
if (!s)
return VMCI_ERROR_NOT_FOUND;
- kvfree_rcu_mightsleep(s);
+ /*
+ * Wait for event_deliver(): the caller is going to free what the
+ * callback works on.
+ */
+ synchronize_rcu();
+ kfree(s);
return VMCI_SUCCESS;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0740/1059] usb: gadget: u_serial: pin ports while TTYs are installed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (738 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0739/1059] misc: vmw_vmci: wait for callbacks in event unsubscribe Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0741/1059] smb: client: validate descriptor headers before query result allocation Greg Kroah-Hartman
` (258 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+fe63e4d633540f230624, stable,
Krystian Kaniewski, syzbot, Mehmet Fide,
syzbot+bca09f5d8b843bbf7571, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krystian Kaniewski <krystianmkaniewski@gmail.com>
[ Upstream commit 1981b53c2b52a00f0f4b9eb87183c9aedc8dac5d ]
A slab-use-after-free can occur when gserial_free_line() frees struct
gs_port while it is still reachable through an installed TTY. The
port->port.count value tracks successful opens, but it is zero before
gs_open() and again after gs_close(), before TTY cleanup has finished.
Teardown can therefore free gs_port while tty_init_dev() or release_tty()
still accesses its tty_port.
Manage gs_port lifetime with tty_port references. Take a reference in
gs_install(), drop it in gs_cleanup(), and move the final free to
gs_port_destruct(). Unregister the TTY device before dropping the owner
reference.
Keep each minor reserved until the old port is destroyed so an installed
TTY for one generation cannot overlap a replacement at the same minor.
Publish the new port before device registration so the cdev and add uevent
never expose a TTY before gs_install() can pin it. Since commit
8df07fe93573 ("tty: fix saved termios reset race"), u_serial registration
no longer frees saved termios. On registration failure, unpublish the port
before dropping its owner reference.
Check in gs_open() that the installed port is still the published
generation. Track failures after a successful install so close callbacks
issued by the TTY core do not decrement port->port.count for opens that
never incremented it.
Fixes: 19b10a8828a6 ("usb: gadget: allocate & giveback serial ports instead hard code them")
Assisted-by: Gemini:gemini-3.8-flash syzbot
Reported-by: syzbot+fe63e4d633540f230624@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=fe63e4d633540f230624
Link: https://syzkaller.appspot.com/ai_job?id=ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
Cc: stable <stable@kernel.org>
Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Tested-by: syzbot@syzkaller.appspotmail.com
Tested-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Reported-by: syzbot+bca09f5d8b843bbf7571@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=bca09f5d8b843bbf7571
Link: https://patch.msgid.link/20261022091359.1187468-1-krystianmkaniewski@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: adjusted context lines in struct gs_port and hunk headers because the older tree lacks the async_icount/icount field and gs_get_icount, with no functional changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/u_serial.c | 167 ++++++++++++++++++++-----
1 file changed, 134 insertions(+), 33 deletions(-)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 3f126381bee3f..03efc35ce4951 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -67,10 +67,28 @@
* gserial->ioport == usb_ep->driver_data ... gs_port
* gs_port->port_usb ... gserial
*
- * gs_port <---> tty_struct ... links will be null when the TTY file
- * isn't opened; managed by gs_open()/gs_close()
- * gserial->port_tty ... tty_struct
- * tty_struct->driver_data ... gserial
+ * gs_port <---> tty_struct:
+ * tty->driver_data refers to gs_port from install through cleanup,
+ * pinning the port via tty_port reference counting.
+ * gs_port->port.tty exists only while the port is open.
+ *
+ * Each entry in ports[] is guarded by ports[i].lock and models three states:
+ * - Free: !port && !reserved
+ * - Published: port && reserved
+ * - Retiring: !port && reserved
+ *
+ * A minor remains reserved until gs_port_destruct() runs upon final tty_port
+ * release, preventing minor reuse while cleanup of the installed TTY is still
+ * underway. The owner reference is retained through device unregister so the
+ * destructor releases the reservation only after device teardown is complete.
+ *
+ * open_close_failures tracks failed gs_open() calls where port->port.count
+ * was not incremented. The TTY core calls gs_close() on open failure to tear
+ * down the tty; tracking failures as aggregate credits allows gs_close() to
+ * consume a credit and exit without decrementing port->port.count. Credits
+ * are aggregate rather than paired with individual files (another gs_close()
+ * can consume a failed open's credit before that file's own close runs).
+ * It is protected by tty_lock.
*/
/* RX and TX queues can buffer QUEUE_SIZE packets before they hit the
@@ -125,14 +143,16 @@ struct gs_port {
wait_queue_head_t close_wait;
bool suspended; /* port suspended */
bool start_delayed; /* delay start when suspended */
+ unsigned int open_close_failures; /* protected by tty_lock */
/* REVISIT this state ... */
struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */
};
static struct portmaster {
- struct mutex lock; /* protect open/close */
+ struct mutex lock; /* protect open/close and port slot */
struct gs_port *port;
+ bool reserved;
} ports[MAX_U_SERIAL_PORTS];
#define GS_CLOSE_TIMEOUT 15 /* seconds */
@@ -586,22 +606,60 @@ static int gs_start_io(struct gs_port *port)
/* TTY Driver */
+static int gs_install(struct tty_driver *driver, struct tty_struct *tty)
+{
+ struct gs_port *port;
+ struct tty_port *tport;
+ int ret;
+
+ mutex_lock(&ports[tty->index].lock);
+ port = ports[tty->index].port;
+ if (!port) {
+ mutex_unlock(&ports[tty->index].lock);
+ return -ENODEV;
+ }
+
+ tport = tty_port_get(&port->port);
+ if (!tport) {
+ mutex_unlock(&ports[tty->index].lock);
+ return -ENODEV;
+ }
+
+ ret = tty_port_install(tport, driver, tty);
+ if (ret) {
+ mutex_unlock(&ports[tty->index].lock);
+ tty_port_put(tport);
+ return ret;
+ }
+
+ tty->driver_data = port;
+ mutex_unlock(&ports[tty->index].lock);
+
+ return 0;
+}
+
+static void gs_cleanup(struct tty_struct *tty)
+{
+ tty_port_put(tty->port);
+}
+
/*
- * gs_open sets up the link between a gs_port and its associated TTY.
- * That link is broken *only* by TTY close(), and all driver methods
- * know that.
+ * gs_open associates an open TTY with its gs_port.
+ *
+ * There are two TTY-to-port relationships: port->port.tty exists from the
+ * first successful open until final close, while tty->driver_data is assigned
+ * during gs_install() and remains valid through gs_cleanup().
*/
static int gs_open(struct tty_struct *tty, struct file *file)
{
int port_num = tty->index;
- struct gs_port *port;
+ struct gs_port *port = tty->driver_data;
int status = 0;
mutex_lock(&ports[port_num].lock);
- port = ports[port_num].port;
- if (!port) {
+ if (ports[port_num].port != port) {
status = -ENODEV;
- goto out;
+ goto fail_unlock;
}
spin_lock_irq(&port->port_lock);
@@ -621,7 +679,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
if (status) {
pr_debug("gs_open: ttyGS%d (%p,%p) no buffer\n",
port_num, tty, file);
- goto out;
+ goto fail_unlock;
}
spin_lock_irq(&port->port_lock);
@@ -631,7 +689,6 @@ static int gs_open(struct tty_struct *tty, struct file *file)
if (port->port.count++)
goto exit_unlock_port;
- tty->driver_data = port;
port->port.tty = tty;
/* if connected, start the I/O stream */
@@ -655,7 +712,11 @@ static int gs_open(struct tty_struct *tty, struct file *file)
exit_unlock_port:
spin_unlock_irq(&port->port_lock);
-out:
+ mutex_unlock(&ports[port_num].lock);
+ return status;
+
+fail_unlock:
+ port->open_close_failures++;
mutex_unlock(&ports[port_num].lock);
return status;
}
@@ -681,6 +742,11 @@ static void gs_close(struct tty_struct *tty, struct file *file)
if (!port)
return;
+ if (port->open_close_failures > 0) {
+ port->open_close_failures--;
+ return;
+ }
+
spin_lock_irq(&port->port_lock);
if (port->port.count != 1) {
@@ -853,8 +919,10 @@ static int gs_break_ctl(struct tty_struct *tty, int duration)
}
static const struct tty_operations gs_tty_ops = {
+ .install = gs_install,
.open = gs_open,
.close = gs_close,
+ .cleanup = gs_cleanup,
.write = gs_write,
.put_char = gs_put_char,
.flush_chars = gs_flush_chars,
@@ -1146,14 +1214,41 @@ static void gs_console_exit(struct gs_port *port)
#endif
-static int
+static void gs_port_destruct(struct tty_port *tport)
+{
+ struct gs_port *port = container_of(tport, struct gs_port, port);
+ unsigned int port_num = port->port_num;
+
+ mutex_lock(&ports[port_num].lock);
+ if (WARN_ON(ports[port_num].port))
+ ports[port_num].port = NULL;
+ WARN_ON(!ports[port_num].reserved);
+ if (gs_tty_driver)
+ gs_tty_driver->ports[port_num] = NULL;
+ ports[port_num].reserved = false;
+ mutex_unlock(&ports[port_num].lock);
+
+ kfifo_free(&port->port_write_buf);
+ kfree(port);
+}
+
+static const struct tty_port_operations gs_port_ops = {
+ .destruct = gs_port_destruct,
+};
+
+static struct gs_port *
gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding)
{
struct gs_port *port;
int ret = 0;
mutex_lock(&ports[port_num].lock);
- if (ports[port_num].port) {
+ if (WARN_ON_ONCE(ports[port_num].port && !ports[port_num].reserved)) {
+ ret = -EBUSY;
+ goto out;
+ }
+
+ if (ports[port_num].reserved) {
ret = -EBUSY;
goto out;
}
@@ -1165,6 +1260,7 @@ gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding)
}
tty_port_init(&port->port);
+ port->port.ops = &gs_port_ops;
spin_lock_init(&port->port_lock);
init_waitqueue_head(&port->drain_wait);
init_waitqueue_head(&port->close_wait);
@@ -1178,10 +1274,14 @@ gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding)
port->port_num = port_num;
port->port_line_coding = *coding;
+ ports[port_num].reserved = true;
ports[port_num].port = port;
+ mutex_unlock(&ports[port_num].lock);
+ return port;
+
out:
mutex_unlock(&ports[port_num].lock);
- return ret;
+ return ERR_PTR(ret);
}
static int gs_closed(struct gs_port *port)
@@ -1201,8 +1301,7 @@ static void gserial_free_port(struct gs_port *port)
/* wait for old opens to finish */
wait_event(port->close_wait, gs_closed(port));
WARN_ON(port->port_usb != NULL);
- tty_port_destroy(&port->port);
- kfree(port);
+ tty_port_put(&port->port);
}
void gserial_free_line(unsigned char port_num)
@@ -1219,15 +1318,15 @@ void gserial_free_line(unsigned char port_num)
ports[port_num].port = NULL;
mutex_unlock(&ports[port_num].lock);
- gserial_free_port(port);
tty_unregister_device(gs_tty_driver, port_num);
+ gserial_free_port(port);
}
EXPORT_SYMBOL_GPL(gserial_free_line);
int gserial_alloc_line_no_console(unsigned char *line_num)
{
struct usb_cdc_line_coding coding;
- struct gs_port *port;
+ struct gs_port *port = ERR_PTR(-EBUSY);
struct device *tty_dev;
int ret;
int port_num;
@@ -1238,19 +1337,20 @@ int gserial_alloc_line_no_console(unsigned char *line_num)
coding.bDataBits = USB_CDC_1_STOP_BITS;
for (port_num = 0; port_num < MAX_U_SERIAL_PORTS; port_num++) {
- ret = gs_port_alloc(port_num, &coding);
- if (ret == -EBUSY)
- continue;
- if (ret)
+ port = gs_port_alloc(port_num, &coding);
+ if (IS_ERR(port)) {
+ ret = PTR_ERR(port);
+ if (ret == -EBUSY)
+ continue;
return ret;
+ }
break;
}
- if (ret)
- return ret;
+ if (IS_ERR(port))
+ return PTR_ERR(port);
/* ... and sysfs class devices, so mdev/udev make /dev/ttyGS* */
- port = ports[port_num].port;
tty_dev = tty_port_register_device(&port->port,
gs_tty_driver, port_num, NULL);
if (IS_ERR(tty_dev)) {
@@ -1259,14 +1359,15 @@ int gserial_alloc_line_no_console(unsigned char *line_num)
ret = PTR_ERR(tty_dev);
mutex_lock(&ports[port_num].lock);
+ WARN_ON(ports[port_num].port != port);
ports[port_num].port = NULL;
mutex_unlock(&ports[port_num].lock);
- gserial_free_port(port);
- goto err;
+ tty_port_put(&port->port);
+ return ret;
}
+
*line_num = port_num;
-err:
- return ret;
+ return 0;
}
EXPORT_SYMBOL_GPL(gserial_alloc_line_no_console);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0741/1059] smb: client: validate descriptor headers before query result allocation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (739 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0740/1059] usb: gadget: u_serial: pin ports while TTYs are installed Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0742/1059] dm cache: validate the discard block size before narrowing Greg Kroah-Hartman
` (257 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, liuyong, Namjae Jeon,
Paulo Alcantara, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: liuyong <pkfxxxing@gmail.com>
[ Upstream commit ffb59029c0d52bf76fdd2678f5d6fd13e26220dd ]
query_info() uses the server's returned length instead of the caller's
minimum when a dynamic result is requested. A zero-length ACL response
can therefore return ZERO_SIZE_PTR to id_mode_to_cifs_acl(), whose
ownership-change path reads dacloffset before checking the header size.
A KASAN-enabled test shows a read at address 0x20 and a kernel Oops.
Validate the returned range and the caller's minimum before allocating
the dynamic result. Keep the reported length zero if validation fails.
Use the security descriptor header size as the minimum in SMB2_query_acl().
DACL-only and SACL-only xattr queries do not require owner and group SIDs,
so enforcing MIN_SEC_DESC_LEN would reject short descriptors that these
queries could previously return. The rewrite paths validate the required
owner/group SIDs and DACL separately before using their contents.
These issues were discovered and fixed by Qihoo 360's Tulongfeng
multi-agent system.
Fixes: 9ee2afe5207b ("cifs: prevent copying past input buffer boundaries")
Cc: stable@vger.kernel.org
Signed-off-by: liuyong <pkfxxxing@gmail.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
[ sashal: Replaced struct smb_ntsd with struct cifs_ntsd in the min-length check and macro removal, since this tree predates the rename. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsacl.h | 14 --------------
fs/smb/client/smb2pdu.c | 11 ++++++++++-
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/fs/smb/client/cifsacl.h b/fs/smb/client/cifsacl.h
index ccbfc754bd3c7..fa6bc6d2709f3 100644
--- a/fs/smb/client/cifsacl.h
+++ b/fs/smb/client/cifsacl.h
@@ -182,18 +182,4 @@ struct owner_group_sids {
struct owner_sid group;
} __packed;
-/*
- * Minimum security identifier can be one for system defined Users
- * and Groups such as NULL SID and World or Built-in accounts such
- * as Administrator and Guest and consists of
- * Revision + Num (Sub)Auths + Authority + Domain (one Subauthority)
- */
-#define MIN_SID_LEN (1 + 1 + 6 + 4) /* in bytes */
-
-/*
- * Minimum security descriptor can be one without any SACL and DACL and can
- * consist of revision, type, and two sids of minimum size for owner and group
- */
-#define MIN_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + (2 * MIN_SID_LEN))
-
#endif /* _CIFSACL_H */
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 82052c5a0ea43..521a67a21b3e0 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3769,6 +3769,14 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
ses->Suid, info_class, (__u32)info_type);
if (dlen) {
+ rc = smb2_validate_iov(le16_to_cpu(rsp->OutputBufferOffset),
+ le32_to_cpu(rsp->OutputBufferLength),
+ &rsp_iov, min_len);
+ if (rc) {
+ *dlen = 0;
+ goto qinf_exit;
+ }
+
*dlen = le32_to_cpu(rsp->OutputBufferLength);
if (!*data) {
*data = kmalloc(*dlen, GFP_KERNEL);
@@ -3837,7 +3845,8 @@ SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
return query_info(xid, tcon, persistent_fid, volatile_fid,
0, SMB2_O_INFO_SECURITY, additional_info,
- SMB2_MAX_BUFFER_SIZE, MIN_SEC_DESC_LEN, data, plen);
+ SMB2_MAX_BUFFER_SIZE, sizeof(struct cifs_ntsd),
+ data, plen);
}
int
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0742/1059] dm cache: validate the discard block size before narrowing
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (740 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0741/1059] smb: client: validate descriptor headers before query result allocation Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0743/1059] dm: fix use-after-free when dm_get_device() widens the open mode Greg Kroah-Hartman
` (256 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+c8564fc0a96e3ecbe4d4,
Kirtikumar Anandrao Ramchandani, Mikulas Patocka, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
[ Upstream commit df8daa4d916c88ef7888c738e0eb3b6f11714a6f ]
The discard block size doubles until the origin fits within the discard
bitset limit. too_many_discard_blocks() passes this sector_t size to
sector_div(), whose divisor is only 32 bits. Once the size exceeds that
range, the division uses a truncated divisor, which can become zero.
Use a 64-bit divisor when checking the block count. The selected size is
stored in a u32, so reject sizes that cannot be represented before the
assignment and before calculating the bitset size. This prevents a
truncated zero size from reaching dm_sector_div_up().
An earlier proposal checks whether the mapped length exceeds the origin
device. This fix also covers an origin device whose valid size requires a
discard block size beyond the field's range.
Reported-by: syzbot+c8564fc0a96e3ecbe4d4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c8564fc0a96e3ecbe4d4
Cc: stable@vger.kernel.org
Fixes: 08b184514f65 ("dm cache: revert 'prevent corruption caused by discard_block_size > cache_block_size'")
Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[ sashal: Adjusted the include context: added only #include <linux/math64.h> between init.h and mempool.h, since kstrtox.h isn't present in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-cache-target.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index d209b46fdb6fe..ec589230a5a33 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -14,6 +14,7 @@
#include <linux/dm-kcopyd.h>
#include <linux/jiffies.h>
#include <linux/init.h>
+#include <linux/math64.h>
#include <linux/mempool.h>
#include <linux/module.h>
#include <linux/rwsem.h>
@@ -2391,9 +2392,7 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca,
static bool too_many_discard_blocks(sector_t discard_block_size,
sector_t origin_size)
{
- (void) sector_div(origin_size, discard_block_size);
-
- return origin_size > MAX_DISCARD_BLOCKS;
+ return div64_u64(origin_size, discard_block_size) > MAX_DISCARD_BLOCKS;
}
static sector_t calculate_discard_block_size(sector_t cache_block_size,
@@ -2430,6 +2429,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
struct cache *cache;
struct dm_target *ti = ca->ti;
dm_block_t origin_blocks;
+ sector_t discard_block_size;
struct dm_cache_metadata *cmd;
bool may_format = ca->features.mode == CM_WRITE;
@@ -2529,9 +2529,15 @@ static int cache_create(struct cache_args *ca, struct cache **result)
}
clear_bitset(cache->dirty_bitset, from_cblock(cache->cache_size));
- cache->discard_block_size =
+ discard_block_size =
calculate_discard_block_size(cache->sectors_per_block,
cache->origin_sectors);
+ if (discard_block_size > U32_MAX) {
+ *error = "Discard block size exceeds 32 bits";
+ r = -EOVERFLOW;
+ goto bad;
+ }
+ cache->discard_block_size = discard_block_size;
cache->discard_nr_blocks = to_dblock(dm_sector_div_up(cache->origin_sectors,
cache->discard_block_size));
cache->discard_bitset = alloc_bitset(from_dblock(cache->discard_nr_blocks));
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0743/1059] dm: fix use-after-free when dm_get_device() widens the open mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (741 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0742/1059] dm cache: validate the discard block size before narrowing Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0744/1059] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Greg Kroah-Hartman
` (255 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ming Hung Tsai, Mikulas Patocka,
Sasha Levin, Claude Opus 5
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <mtsai@redhat.com>
[ Upstream commit c834161ded1a141a58d5f03b24f6894291222c96 ]
There's an UAF bug in dm_get_device(): when a table construction calls
dm_get_device() on the same device twice with widen access mode (e.g.,
read-only first then read-write), the second dm_get_device() calls
upgrade_mode(), which reopens the device in upgraded mode, making
previously returned dm_dev* a stale pointer.
Fixing approaches:
- Add per-mode views (dm_dev_ref) from a per-device dm_dev_internal to
multiple table_devices.
- Keep reusing the dm_dev_ref when the requested mode is included, i.e.,
a read-only reference can reuse the read-write opened device within a
table.
- Maintain a canonical block_device pointer in dm_dev_internal for
handling the DM_TABLE_DEPS ioctl.
Also tweak the way of mode sharing check in find_ref() to
"(x & mask) == mask". The result stays the same to the previous
upgrade_mode() guard "(x | mask) == x".
Pros: keep the relationship between dm_dev_internal and table_device:
one dm_dev_internal per device, regardless the mode, so the output of
DMM_TABLE_DEPS ioctl unchanged.
Cons: extra dm_dev_ref allocation.
Note that now the table_device's count not necessarily mean the number
tables referecing this <dev, mode> pair, since we're allowing multiple
references within a table.
Signed-off-by: Ming Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fixes: 86f1152b117a ("dm: allow active and inactive tables to share dm_devs")
Cc: stable@vger.kernel.org
[ sashal: Adapted to the older API by using fmode_t and kmalloc(), keeping the existing devices_lock handling, and switching dm_table_get_integrity_disk() to dd->bdev; the dm.c hunk was dropped as inapplicable. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-ioctl.c | 2 +-
drivers/md/dm-table.c | 141 +++++++++++++++++++++++-------------------
drivers/md/dm.h | 18 +++++-
3 files changed, 96 insertions(+), 65 deletions(-)
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 2153f93a26d06..225a0a8eef624 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1637,7 +1637,7 @@ static void retrieve_deps(struct dm_table *table,
deps->count = count;
count = 0;
list_for_each_entry(dd, dm_table_get_devices(table), list)
- deps->dev[count++] = huge_encode_dev(dd->dm_dev->bdev->bd_dev);
+ deps->dev[count++] = huge_encode_dev(dd->bdev->bd_dev);
param->data_size = param->data_start + needed;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 214a7af330f89..b3a407759e760 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -165,14 +165,16 @@ int dm_table_create(struct dm_table **result, fmode_t mode,
static void free_devices(struct list_head *devices, struct mapped_device *md)
{
- struct list_head *tmp, *next;
-
- list_for_each_safe(tmp, next, devices) {
- struct dm_dev_internal *dd =
- list_entry(tmp, struct dm_dev_internal, list);
- DMWARN("%s: dm_table_destroy: dm_put_device call missing for %s",
- dm_device_name(md), dd->dm_dev->name);
- dm_put_table_device(md, dd->dm_dev);
+ struct dm_dev_internal *dd, *dd_next;
+ struct dm_dev_ref *ref, *ref_next;
+
+ list_for_each_entry_safe(dd, dd_next, devices, list) {
+ list_for_each_entry_safe(ref, ref_next, &dd->refs, list) {
+ DMWARN("%s: dm_table_destroy: dm_put_device call missing for %s",
+ dm_device_name(md), ref->dm_dev->name);
+ dm_put_table_device(md, ref->dm_dev);
+ kfree(ref);
+ }
kfree(dd);
}
}
@@ -218,12 +220,27 @@ static struct dm_dev_internal *find_device(struct list_head *l, dev_t dev)
struct dm_dev_internal *dd;
list_for_each_entry(dd, l, list)
- if (dd->dm_dev->bdev->bd_dev == dev)
+ if (dd->bdev->bd_dev == dev)
return dd;
return NULL;
}
+/*
+ * See if the device is already open with a mode that covers the
+ * requested one.
+ */
+static struct dm_dev_ref *find_ref(struct dm_dev_internal *dd, fmode_t mode)
+{
+ struct dm_dev_ref *ref;
+
+ list_for_each_entry(ref, &dd->refs, list)
+ if ((ref->dm_dev->mode & mode) == mode)
+ return ref;
+
+ return NULL;
+}
+
/*
* If possible, this checks an area of a destination device is invalid.
*/
@@ -303,31 +320,6 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
return 0;
}
-/*
- * This upgrades the mode on an already open dm_dev, being
- * careful to leave things as they were if we fail to reopen the
- * device and not to touch the existing bdev field in case
- * it is accessed concurrently.
- */
-static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
- struct mapped_device *md)
-{
- int r;
- struct dm_dev *old_dev, *new_dev;
-
- old_dev = dd->dm_dev;
-
- r = dm_get_table_device(md, dd->dm_dev->bdev->bd_dev,
- dd->dm_dev->mode | new_mode, &new_dev);
- if (r)
- return r;
-
- dd->dm_dev = new_dev;
- dm_put_table_device(md, old_dev);
-
- return 0;
-}
-
/*
* Convert the path to a device
*/
@@ -343,7 +335,9 @@ EXPORT_SYMBOL_GPL(dm_get_dev_t);
/*
* Add a device to the list, or just increment the usage count if
- * it's already present.
+ * it's already present with a mode that covers the requested one.
+ * Otherwise open the device again with the requested mode, so the
+ * dm_devs returned earlier stay valid.
*/
int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
struct dm_dev **result)
@@ -353,6 +347,7 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
unsigned int major, minor;
char dummy;
struct dm_dev_internal *dd;
+ struct dm_dev_ref *ref;
struct dm_table *t = ti->table;
BUG_ON(!t);
@@ -371,33 +366,48 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
down_write(&t->devices_lock);
dd = find_device(&t->devices, dev);
- if (!dd) {
+ if (dd) {
+ ref = find_ref(dd, mode);
+ if (ref) {
+ refcount_inc(&ref->count);
+ goto out;
+ }
+ } else {
dd = kmalloc(sizeof(*dd), GFP_KERNEL);
if (!dd) {
r = -ENOMEM;
goto unlock_ret_r;
}
+ INIT_LIST_HEAD(&dd->refs);
+ }
- if ((r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev))) {
- kfree(dd);
- goto unlock_ret_r;
- }
+ ref = kmalloc(sizeof(*ref), GFP_KERNEL);
+ if (!ref) {
+ r = -ENOMEM;
+ goto bad;
+ }
- refcount_set(&dd->count, 1);
- list_add(&dd->list, &t->devices);
- goto out;
+ r = dm_get_table_device(t->md, dev, mode, &ref->dm_dev);
+ if (r) {
+ kfree(ref);
+ goto bad;
+ }
+ refcount_set(&ref->count, 1);
- } else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) {
- r = upgrade_mode(dd, mode, t->md);
- if (r)
- goto unlock_ret_r;
+ /* A device in the list always has at least one ref */
+ if (list_empty(&dd->refs)) {
+ dd->bdev = ref->dm_dev->bdev;
+ list_add(&dd->list, &t->devices);
}
- refcount_inc(&dd->count);
+ list_add_tail(&ref->list, &dd->refs);
out:
up_write(&t->devices_lock);
- *result = dd->dm_dev;
+ *result = ref->dm_dev;
return 0;
+bad:
+ if (list_empty(&dd->refs))
+ kfree(dd);
unlock_ret_r:
up_write(&t->devices_lock);
return r;
@@ -435,26 +445,31 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
*/
void dm_put_device(struct dm_target *ti, struct dm_dev *d)
{
- int found = 0;
struct dm_table *t = ti->table;
struct list_head *devices = &t->devices;
struct dm_dev_internal *dd;
+ struct dm_dev_ref *ref;
down_write(&t->devices_lock);
- list_for_each_entry(dd, devices, list) {
- if (dd->dm_dev == d) {
- found = 1;
- break;
- }
- }
- if (!found) {
- DMERR("%s: device %s not in table devices list",
- dm_device_name(t->md), d->name);
+ list_for_each_entry(dd, devices, list)
+ list_for_each_entry(ref, &dd->refs, list)
+ if (ref->dm_dev == d)
+ goto found;
+
+ DMERR("%s: device %s not in table devices list",
+ dm_device_name(t->md), d->name);
+ goto unlock_ret;
+
+found:
+ if (!refcount_dec_and_test(&ref->count))
goto unlock_ret;
- }
- if (refcount_dec_and_test(&dd->count)) {
- dm_put_table_device(t->md, d);
+
+ dm_put_table_device(t->md, d);
+ list_del(&ref->list);
+ kfree(ref);
+
+ if (list_empty(&dd->refs)) {
list_del(&dd->list);
kfree(dd);
}
@@ -1147,7 +1162,7 @@ static struct gendisk *dm_table_get_integrity_disk(struct dm_table *t)
}
list_for_each_entry(dd, devices, list) {
- template_disk = dd->dm_dev->bdev->bd_disk;
+ template_disk = dd->bdev->bd_disk;
if (!integrity_profile_exists(template_disk))
goto no_integrity;
else if (prev_disk &&
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 22eaed1889079..bbbb10e4de792 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -36,10 +36,26 @@
/*
* List of devices that a metadevice uses and should open/close.
+ * There is one dm_dev_internal per device. It holds one dm_dev_ref
+ * for each mode that the targets opened the device with.
*/
struct dm_dev_internal {
struct list_head list;
- refcount_t count;
+ struct block_device *bdev;
+ struct list_head refs;
+};
+
+/*
+ * One open of a device with one mode, shared by the targets of a table.
+ * dm_get_device() reuses a dm_dev_ref whose mode covers the requested
+ * mode, and adds a new one only when none does. So the dm_dev_refs of
+ * a device have different modes, and a table holds each table_device
+ * at most once. table_device->count is still the number of tables that
+ * use the table_device.
+ */
+struct dm_dev_ref {
+ struct list_head list;
+ refcount_t count; /* dm_get_device() calls that returned dm_dev */
struct dm_dev *dm_dev;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0744/1059] dm: fail a REQ_PREFLUSH bio with data when its preflush fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (742 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0743/1059] dm: fix use-after-free when dm_get_device() widens the open mode Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0745/1059] ovl: reject different lower idmaps on the same fs Greg Kroah-Hartman
` (254 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daejun Park, Tejun Heo,
Mikulas Patocka, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
[ Upstream commit e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 ]
For a bio with REQ_PREFLUSH and data, dm core may send an empty flush
first. If the flush fails, __dm_io_complete() still reissues the bio
without REQ_PREFLUSH and drops the error. When that write succeeds,
the XFS log keeps running and fsync() can return 0.
End the bio with the flush error instead of writing the data, as
blk-mq does.
Fixes: 6a8736d10cb4 ("dm: relax ordering of bio-based flush implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[ sashal: Adapted the condition to the older code, which tests bio_is_flush_with_data(bio) instead of the requeue_flush_with_data variable, and added the !io_error check there. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0af19f3116108..0a3375309f822 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -965,7 +965,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage)
if (requeued)
return;
- if (bio_is_flush_with_data(bio)) {
+ if (bio_is_flush_with_data(bio) && !io_error) {
/*
* Preflush done for flush with data, reissue
* without REQ_PREFLUSH.
@@ -973,7 +973,7 @@ static void __dm_io_complete(struct dm_io *io, bool first_stage)
bio->bi_opf &= ~REQ_PREFLUSH;
queue_io(md, bio);
} else {
- /* done with normal IO or empty flush */
+ /* done with normal IO, empty flush or failed preflush */
if (io_error)
bio->bi_status = io_error;
bio_endio(bio);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0745/1059] ovl: reject different lower idmaps on the same fs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (743 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0744/1059] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0746/1059] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Greg Kroah-Hartman
` (253 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Brauner,
Jérémy Jean, Amir Goldstein, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
[ Upstream commit 720f40c05b2785406121da0151543751204f2953 ]
Overayfs mounted with index=on or nfs_export=on require file handle
support from backing filesystems.
Overlay file handles identify a backing filesystem, but not the lower
mount used to decode it. If lower layers share a superblock and use
different idmaps, a handle can decode through the wrong layer.
Record the first idmap on a private lower clone for each backing
filesystem. Fail if another clone has a different idmap. Comparing
the private clones prevents mount_setattr() from changing the checked
state. Distinct idmap objects are treated as ambiguous.
Fixes: bc70682a497c ("ovl: support idmapped layers")
Suggested-by: Christian Brauner <brauner@kernel.org>
Link: Link: https://lore.kernel.org/all/20260925-server-hager-riskieren-06116eded213@brauner/
Cc: stable@vger.kernel.org
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/ovl_entry.h | 2 ++
fs/overlayfs/super.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index a479680a5ccd8..67a3b8f6c162e 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -25,6 +25,8 @@ struct ovl_config {
struct ovl_sb {
struct super_block *sb;
dev_t pseudo_dev;
+ /* Idmap of the first lower layer on this fs */
+ const struct user_namespace *lower_idmap;
/* Unusable (conflicting) uuid */
bool bad_uuid;
/* Used as a lower layer (but maybe also as upper) */
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index e8e7e1c59d95d..215ab87c4c2bf 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1769,6 +1769,28 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
goto out;
}
+ /*
+ * Lower file handles identify the lower fs, but not the layer,
+ * so with different idmaps on the same lower fs, index and
+ * nfs_export may decode a file handle through a layer with the
+ * wrong idmap. Following copy up origin without index is only
+ * used for st_ino, which does not depend on the idmap.
+ */
+ if (ofs->config.index || ofs->config.nfs_export) {
+ const struct user_namespace *idmap = mnt_user_ns(mnt);
+ struct ovl_sb *fs = &ofs->fs[fsid];
+
+ if (!fs->lower_idmap) {
+ fs->lower_idmap = idmap;
+ } else if (fs->lower_idmap != idmap) {
+ pr_err("lower layer '%pd2' conflicts with idmap of another lower layer on the same fs, mount with '-o index=off,nfs_export=off' to override.\n",
+ stack[i].dentry);
+ iput(trap);
+ kern_unmount(mnt);
+ return -EINVAL;
+ }
+ }
+
/*
* Make lower layers R/O. That way fchmod/fchown on lower file
* will fail instead of modifying lower fs.
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0746/1059] iio: temperature: hid-sensor-temperature: Use per-instance callbacks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (744 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0745/1059] ovl: reject different lower idmaps on the same fs Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0747/1059] usb: dwc3: gadget: Reinitiate stream for all host NoStream behavior Greg Kroah-Hartman
` (252 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christopher Hoover, Joshua Crofts,
Srinivas Pandruvada, Jonathan Cameron, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Hoover <ch@murgatroid.com>
[ Upstream commit 36eeb26031e90eeb81bbac3d3acad61d23fcbdf3 ]
hid-sensor-temperature keeps a single static struct
hid_sensor_hub_callbacks for all instances and overwrites its pdev in
every probe. With two temperature sensors, input reports for one are
delivered with the other's platform device; once that device is
removed, platform_get_drvdata() returns NULL and
temperature_capture_sample() dereferences it:
BUG: kernel NULL pointer dereference, address: 00000000000003a8
RIP: 0010:temperature_capture_sample+0xd/0x50 [hid_sensor_temperature]
The oops happens in sensor_hub_raw_event() with the hub's spinlock
held, so the hub's removal then hangs. It reproduces with two uhid
devices that each declare a temperature sensor, one destroyed while
the other still sends input reports.
Keep the callbacks in struct temperature_state, as the other HID
sensor drivers (accel, gyro, als, ...) do.
Fixes: 59d0f2da3569 ("iio: hid: Add temperature sensor support")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sashal: adapted to older tree: used u64 timestamp __aligned(8) in the data struct and adjusted whitespace alignment of the sensor_hub_register_callback argument context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/temperature/hid-sensor-temperature.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
index ba735d758cb44..a96d9a5e35790 100644
--- a/drivers/iio/temperature/hid-sensor-temperature.c
+++ b/drivers/iio/temperature/hid-sensor-temperature.c
@@ -16,6 +16,7 @@
struct temperature_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info temperature_attr;
+ struct hid_sensor_hub_callbacks callbacks;
struct {
s32 temperature_data;
u64 timestamp __aligned(8);
@@ -181,11 +182,6 @@ static int temperature_parse_report(struct platform_device *pdev,
return ret;
}
-static struct hid_sensor_hub_callbacks temperature_callbacks = {
- .send_event = &temperature_proc_event,
- .capture_sample = &temperature_capture_sample,
-};
-
/* Function to initialize the processing for usage id */
static int hid_temperature_probe(struct platform_device *pdev)
{
@@ -237,9 +233,13 @@ static int hid_temperature_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
- temperature_callbacks.pdev = pdev;
+ temp_st->callbacks = (struct hid_sensor_hub_callbacks) {
+ .send_event = temperature_proc_event,
+ .capture_sample = temperature_capture_sample,
+ .pdev = pdev,
+ };
ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE,
- &temperature_callbacks);
+ &temp_st->callbacks);
if (ret)
goto error_remove_trigger;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0747/1059] usb: dwc3: gadget: Reinitiate stream for all host NoStream behavior
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (745 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0746/1059] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0748/1059] usb: dwc3: clear forceRM when issuing EndTransfer Greg Kroah-Hartman
` (251 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Thinh Nguyen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
[ Upstream commit dcfe437492e27d54f3ac491aed024da760f5c43c ]
There are too many different host behaviors when it comes to NoStream
handling, and not everyone follows the USB and xHCI spec. The DWC3
driver attempts to do some guess work to interop with different hosts,
but it can't cover everything. Let's keep it simple and treat every host
the same: just retry on NoStream after a 100ms of no response delay.
Note that some hosts cannot handle frequent retries. This may affect
performance on certain defective hosts, but NoStream is a rare
occurrence and interoperability is more important.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/b92ae94c86f01f165d5f178b7767898573b6dc75.1736819308.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: e616d91e0288 ("usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/core.h | 3 +-
drivers/usb/dwc3/gadget.c | 109 ++++++++++++++++++++------------------
2 files changed, 59 insertions(+), 53 deletions(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 0119a8940c8d5..56208f7d8cf5e 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -720,6 +720,7 @@ struct dwc3_event_buffer {
*/
struct dwc3_ep {
struct usb_ep endpoint;
+ struct delayed_work nostream_work;
struct list_head cancelled_list;
struct list_head pending_list;
struct list_head started_list;
@@ -742,7 +743,7 @@ struct dwc3_ep {
#define DWC3_EP_WAIT_TRANSFER_COMPLETE BIT(7)
#define DWC3_EP_IGNORE_NEXT_NOSTREAM BIT(8)
#define DWC3_EP_FORCE_RESTART_STREAM BIT(9)
-#define DWC3_EP_FIRST_STREAM_PRIMED BIT(10)
+#define DWC3_EP_STREAM_PRIMED BIT(10)
#define DWC3_EP_PENDING_CLEAR_STALL BIT(11)
#define DWC3_EP_TXFIFO_RESIZED BIT(12)
#define DWC3_EP_DELAY_STOP BIT(13)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 9d356ff8d036c..1ed6f4fc89eb9 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -966,8 +966,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
/*
* All stream eps will reinitiate stream on NoStream
- * rejection until we can determine that the host can
- * prime after the first transfer.
+ * rejection.
*
* However, if the controller is capable of
* TXF_FLUSH_BYPASS, then IN direction endpoints will
@@ -3233,6 +3232,50 @@ static int dwc3_gadget_init_out_endpoint(struct dwc3_ep *dep)
return dwc3_alloc_trb_pool(dep);
}
+#define nostream_work_to_dep(w) (container_of(to_delayed_work(w), struct dwc3_ep, nostream_work))
+static void dwc3_nostream_work(struct work_struct *work)
+{
+ struct dwc3_ep *dep = nostream_work_to_dep(work);
+ struct dwc3 *dwc = dep->dwc;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dwc->lock, flags);
+ if (dep->flags & DWC3_EP_STREAM_PRIMED)
+ goto out;
+
+ if ((dep->flags & DWC3_EP_IGNORE_NEXT_NOSTREAM) ||
+ (!DWC3_MST_CAPABLE(&dwc->hwparams) &&
+ !(dep->flags & DWC3_EP_WAIT_TRANSFER_COMPLETE)))
+ goto out;
+ /*
+ * If the host rejects a stream due to no active stream, by the
+ * USB and xHCI spec, the endpoint will be put back to idle
+ * state. When the host is ready (buffer added/updated), it will
+ * prime the endpoint to inform the usb device controller. This
+ * triggers the device controller to issue ERDY to restart the
+ * stream. However, some hosts don't follow this and keep the
+ * endpoint in the idle state. No prime will come despite host
+ * streams are updated, and the device controller will not be
+ * triggered to generate ERDY to move the next stream data. To
+ * workaround this and maintain compatibility with various
+ * hosts, force to reinitiate the stream until the host is ready
+ * instead of waiting for the host to prime the endpoint.
+ */
+ if (DWC3_VER_IS_WITHIN(DWC32, 100A, ANY)) {
+ unsigned int cmd = DWC3_DGCMD_SET_ENDPOINT_PRIME;
+
+ dwc3_send_gadget_generic_command(dwc, cmd, dep->number);
+ } else {
+ dep->flags |= DWC3_EP_DELAY_START;
+ dwc3_stop_active_transfer(dep, true, true);
+ spin_unlock_irqrestore(&dwc->lock, flags);
+ return;
+ }
+out:
+ dep->flags &= ~DWC3_EP_IGNORE_NEXT_NOSTREAM;
+ spin_unlock_irqrestore(&dwc->lock, flags);
+}
+
static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
{
struct dwc3_ep *dep;
@@ -3278,6 +3321,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
INIT_LIST_HEAD(&dep->pending_list);
INIT_LIST_HEAD(&dep->started_list);
INIT_LIST_HEAD(&dep->cancelled_list);
+ INIT_DELAYED_WORK(&dep->nostream_work, dwc3_nostream_work);
dwc3_debugfs_create_endpoint_dir(dep);
@@ -3714,66 +3758,27 @@ static void dwc3_gadget_endpoint_command_complete(struct dwc3_ep *dep,
static void dwc3_gadget_endpoint_stream_event(struct dwc3_ep *dep,
const struct dwc3_event_depevt *event)
{
- struct dwc3 *dwc = dep->dwc;
-
if (event->status == DEPEVT_STREAMEVT_FOUND) {
- dep->flags |= DWC3_EP_FIRST_STREAM_PRIMED;
- goto out;
+ cancel_delayed_work(&dep->nostream_work);
+ dep->flags |= DWC3_EP_STREAM_PRIMED;
+ dep->flags &= ~DWC3_EP_IGNORE_NEXT_NOSTREAM;
+ return;
}
/* Note: NoStream rejection event param value is 0 and not 0xFFFF */
switch (event->parameters) {
case DEPEVT_STREAM_PRIME:
- /*
- * If the host can properly transition the endpoint state from
- * idle to prime after a NoStream rejection, there's no need to
- * force restarting the endpoint to reinitiate the stream. To
- * simplify the check, assume the host follows the USB spec if
- * it primed the endpoint more than once.
- */
- if (dep->flags & DWC3_EP_FORCE_RESTART_STREAM) {
- if (dep->flags & DWC3_EP_FIRST_STREAM_PRIMED)
- dep->flags &= ~DWC3_EP_FORCE_RESTART_STREAM;
- else
- dep->flags |= DWC3_EP_FIRST_STREAM_PRIMED;
- }
-
+ cancel_delayed_work(&dep->nostream_work);
+ dep->flags |= DWC3_EP_STREAM_PRIMED;
+ dep->flags &= ~DWC3_EP_IGNORE_NEXT_NOSTREAM;
break;
case DEPEVT_STREAM_NOSTREAM:
- if ((dep->flags & DWC3_EP_IGNORE_NEXT_NOSTREAM) ||
- !(dep->flags & DWC3_EP_FORCE_RESTART_STREAM) ||
- (!DWC3_MST_CAPABLE(&dwc->hwparams) &&
- !(dep->flags & DWC3_EP_WAIT_TRANSFER_COMPLETE)))
- break;
-
- /*
- * If the host rejects a stream due to no active stream, by the
- * USB and xHCI spec, the endpoint will be put back to idle
- * state. When the host is ready (buffer added/updated), it will
- * prime the endpoint to inform the usb device controller. This
- * triggers the device controller to issue ERDY to restart the
- * stream. However, some hosts don't follow this and keep the
- * endpoint in the idle state. No prime will come despite host
- * streams are updated, and the device controller will not be
- * triggered to generate ERDY to move the next stream data. To
- * workaround this and maintain compatibility with various
- * hosts, force to reinitiate the stream until the host is ready
- * instead of waiting for the host to prime the endpoint.
- */
- if (DWC3_VER_IS_WITHIN(DWC32, 100A, ANY)) {
- unsigned int cmd = DWC3_DGCMD_SET_ENDPOINT_PRIME;
-
- dwc3_send_gadget_generic_command(dwc, cmd, dep->number);
- } else {
- dep->flags |= DWC3_EP_DELAY_START;
- dwc3_stop_active_transfer(dep, true, true);
- return;
- }
+ dep->flags &= ~DWC3_EP_STREAM_PRIMED;
+ if (dep->flags & DWC3_EP_FORCE_RESTART_STREAM)
+ queue_delayed_work(system_wq, &dep->nostream_work,
+ msecs_to_jiffies(100));
break;
}
-
-out:
- dep->flags &= ~DWC3_EP_IGNORE_NEXT_NOSTREAM;
}
static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0748/1059] usb: dwc3: clear forceRM when issuing EndTransfer
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (746 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0747/1059] usb: dwc3: gadget: Reinitiate stream for all host NoStream behavior Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0749/1059] usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints Greg Kroah-Hartman
` (250 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Elson Serrao, Thinh Nguyen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elson Serrao <elson.serrao@oss.qualcomm.com>
[ Upstream commit b58e6200450d350314db0ecda7d6d1bde3281e80 ]
The forceRM bit of the DEPCMD register controls the behavior of the
EndTransfer command used to stop an active transfer. Older DWC3
programming guide revisions recommended setting forceRM=1 when
issuing EndTransfer. Newer programming guide revisions recommend
issuing EndTransfer with forceRM cleared.
With forceRM=1 on DWC_usb31 v2.00a and v2.10a controllers, a transfer
aborted through the ep_dequeue path was observed to remain active
after EndTransfer completion. A subsequent StartTransfer issued on the
same endpoint triggered writes associated with the aborted transfer.
This resulted in an SMMU fault because the transfer buffer had already
been unmapped during EndTransfer command-completion cleanup.
Using forceRM=0 eliminates the issue. Although older DWC3 programming
guide revisions recommended setting forceRM=1, no issues are known
from using forceRM=0. Clear forceRM when issuing EndTransfer to provide
consistent EndTransfer behavior and align with newer programming guide
recommendations.
Fixes: 1e43c86d84fb ("usb: dwc3: core: Add DWC31 version 2.00a controller")
Cc: stable <stable@kernel.org>
Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260813151456.867008-1-elson.serrao@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: e616d91e0288 ("usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/ep0.c | 2 +-
drivers/usb/dwc3/gadget.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index c4aa925bcd7cf..764360ac7e368 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -311,7 +311,7 @@ void dwc3_ep0_out_start(struct dwc3 *dwc)
dwc3_ep->flags &= ~DWC3_EP_DELAY_STOP;
if (dwc->connected)
- dwc3_stop_active_transfer(dwc3_ep, true, true);
+ dwc3_stop_active_transfer(dwc3_ep, false, true);
else
dwc3_remove_requests(dwc, dwc3_ep, -ESHUTDOWN);
}
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 1ed6f4fc89eb9..67ec3de16652c 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -962,7 +962,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
* controller to generate an ERDY to initiate the
* stream.
*/
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
/*
* All stream eps will reinitiate stream on NoStream
@@ -990,7 +990,7 @@ void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep, int status)
{
struct dwc3_request *req;
- dwc3_stop_active_transfer(dep, true, false);
+ dwc3_stop_active_transfer(dep, false, false);
/* If endxfer is delayed, avoid unmapping requests */
if (dep->flags & DWC3_EP_DELAY_STOP)
@@ -1676,7 +1676,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
if (ret == -EAGAIN)
return ret;
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
list_for_each_entry_safe(req, tmp, &dep->started_list, list)
dwc3_gadget_move_cancelled_request(req, DWC3_REQUEST_STATUS_DEQUEUED);
@@ -1715,6 +1715,11 @@ static void dwc3_schedule_err_recovery(struct dwc3 *dwc);
* the controller won't update the TRB progress on command
* completion. It also won't clear the HWO bit in the TRB.
* The command will also not complete immediately in that case.
+ *
+ * Older programming guide revisions recommended setting ForceRM to 1
+ * when ending a transfer. Newer programming guide revisions now
+ * recommend keeping ForceRM cleared, and TRBs are properly updated
+ * on command completion.
*/
static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool interrupt)
{
@@ -1843,7 +1848,7 @@ static int dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep)
* to wait for the next XferNotReady to test the command again
*/
if (cmd_status == 0) {
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
return 0;
}
}
@@ -2131,7 +2136,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
struct dwc3_request *t;
/* wait until it is processed */
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
/*
* Remove any started request if the transfer is
@@ -2208,7 +2213,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
return 0;
}
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
list_for_each_entry_safe(req, tmp, &dep->started_list, list)
dwc3_gadget_move_cancelled_request(req, DWC3_REQUEST_STATUS_STALLED);
@@ -3267,7 +3272,7 @@ static void dwc3_nostream_work(struct work_struct *work)
dwc3_send_gadget_generic_command(dwc, cmd, dep->number);
} else {
dep->flags |= DWC3_EP_DELAY_START;
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
spin_unlock_irqrestore(&dwc->lock, flags);
return;
}
@@ -3611,7 +3616,7 @@ static bool dwc3_gadget_endpoint_trbs_complete(struct dwc3_ep *dep,
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
list_empty(&dep->started_list) &&
(list_empty(&dep->pending_list) || status == -EXDEV))
- dwc3_stop_active_transfer(dep, true, true);
+ dwc3_stop_active_transfer(dep, false, true);
else if (dwc3_gadget_ep_should_continue(dep))
if (__dwc3_gadget_kick_transfer(dep) == 0)
no_started_trb = false;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0749/1059] usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (747 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0748/1059] usb: dwc3: clear forceRM when issuing EndTransfer Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0750/1059] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
` (249 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Selvarasu Ganesan,
Thinh Nguyen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
[ Upstream commit e616d91e02881983e5dadf6980c4aa08123800b3 ]
The function driver may re-enable an endpoint before the End Transfer
command issued on ep disable completes. The no-op Start Transfer issued
on ep enable then fails with "No Resource".
Only stream endpoints need the no-op Start Transfer to initiate a
stream. Other bulk and interrupt endpoints start their transfer when a
request is queued. Skip it for those endpoints, and move it to a helper
to be reused.
Fixes: a97ea994605e ("usb: dwc3: gadget: offset Start Transfer latency for bulk EPs")
Cc: stable <stable@kernel.org>
Reported-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
Closes: https://lore.kernel.org/linux-usb/20260227121236.963-1-selvarasu.g@samsung.com/
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/227e97e30d26a017c92d7008a8633c01f955d088.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/gadget.c | 97 ++++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 47 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 67ec3de16652c..01f2729bcbfb5 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -862,6 +862,54 @@ static int dwc3_gadget_resize_tx_fifos(struct dwc3_ep *dep)
return 0;
}
+static int dwc3_gadget_ep_start_noop_transfer(struct dwc3_ep *dep)
+{
+ struct dwc3_gadget_ep_cmd_params params;
+ struct dwc3 *dwc = dep->dwc;
+ struct dwc3_trb *trb;
+ dma_addr_t trb_dma;
+ u32 cmd;
+ int ret;
+
+ memset(¶ms, 0, sizeof(params));
+ trb = &dep->trb_pool[0];
+ trb_dma = dwc3_trb_dma_offset(dep, trb);
+
+ params.param0 = upper_32_bits(trb_dma);
+ params.param1 = lower_32_bits(trb_dma);
+
+ cmd = DWC3_DEPCMD_STARTTRANSFER;
+
+ ret = dwc3_send_gadget_ep_cmd(dep, cmd, ¶ms);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * For streams, at start, there maybe a race where the host primes the
+ * endpoint before the function driver queues a request to initiate a
+ * stream. In that case, the controller will not see the prime to
+ * generate the ERDY and start stream. To workaround this, issue a
+ * no-op TRB as normal, but end it immediately. As a result, when the
+ * function driver queues the request, the next START_TRANSFER command
+ * will cause the controller to generate an ERDY to initiate the
+ * stream.
+ */
+ dwc3_stop_active_transfer(dep, false, true);
+
+ /*
+ * All stream eps will reinitiate stream on NoStream rejection.
+ *
+ * However, if the controller is capable of TXF_FLUSH_BYPASS, then IN
+ * direction endpoints will automatically restart the stream without
+ * the driver initiation.
+ */
+ if (!dep->direction ||
+ !(dwc->hwparams.hwparams9 & DWC3_GHWPARAMS9_DEV_TXF_FLUSH_BYPASS))
+ dep->flags |= DWC3_EP_FORCE_RESTART_STREAM;
+
+ return 0;
+}
+
/**
* __dwc3_gadget_ep_enable - initializes a hw endpoint
* @dep: endpoint to be initialized
@@ -929,55 +977,10 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
* Issue StartTransfer here with no-op TRB so we can always rely on No
* Response Update Transfer command.
*/
- if (usb_endpoint_xfer_bulk(desc) ||
- usb_endpoint_xfer_int(desc)) {
- struct dwc3_gadget_ep_cmd_params params;
- struct dwc3_trb *trb;
- dma_addr_t trb_dma;
- u32 cmd;
-
- memset(¶ms, 0, sizeof(params));
- trb = &dep->trb_pool[0];
- trb_dma = dwc3_trb_dma_offset(dep, trb);
-
- params.param0 = upper_32_bits(trb_dma);
- params.param1 = lower_32_bits(trb_dma);
-
- cmd = DWC3_DEPCMD_STARTTRANSFER;
-
- ret = dwc3_send_gadget_ep_cmd(dep, cmd, ¶ms);
+ if (dep->stream_capable) {
+ ret = dwc3_gadget_ep_start_noop_transfer(dep);
if (ret < 0)
return ret;
-
- if (dep->stream_capable) {
- /*
- * For streams, at start, there maybe a race where the
- * host primes the endpoint before the function driver
- * queues a request to initiate a stream. In that case,
- * the controller will not see the prime to generate the
- * ERDY and start stream. To workaround this, issue a
- * no-op TRB as normal, but end it immediately. As a
- * result, when the function driver queues the request,
- * the next START_TRANSFER command will cause the
- * controller to generate an ERDY to initiate the
- * stream.
- */
- dwc3_stop_active_transfer(dep, false, true);
-
- /*
- * All stream eps will reinitiate stream on NoStream
- * rejection.
- *
- * However, if the controller is capable of
- * TXF_FLUSH_BYPASS, then IN direction endpoints will
- * automatically restart the stream without the driver
- * initiation.
- */
- if (!dep->direction ||
- !(dwc->hwparams.hwparams9 &
- DWC3_GHWPARAMS9_DEV_TXF_FLUSH_BYPASS))
- dep->flags |= DWC3_EP_FORCE_RESTART_STREAM;
- }
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0750/1059] ACPI: PM: Avoid initializing power management for absent devices
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (748 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0749/1059] usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0751/1059] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
` (248 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alan Borzeszkowski,
Rafael J. Wysocki, Mika Westerberg, Sasha Levin
6.1-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 e02622bcc7c11..dcfbc5a73f32a 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 f915a7c0e7cca..d2c1f969cef27 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] 1065+ messages in thread* [PATCH 6.1 0751/1059] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B"
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (749 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0750/1059] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0752/1059] ovl: do not read the flags of a put upper dentry in lookup Greg Kroah-Hartman
` (247 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cristian-Marian Fotache,
Takashi Iwai, Sasha Levin
6.1-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/pci/hda/patch_realtek.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index a78b23d922ea2..f233885f2eb37 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10289,7 +10289,6 @@ static const struct snd_pci_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] 1065+ messages in thread* [PATCH 6.1 0752/1059] ovl: do not read the flags of a put upper dentry in lookup
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (750 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0751/1059] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0753/1059] ovl: bump the impure dir version when linking a file with origin Greg Kroah-Hartman
` (246 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Amir Goldstein, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit 7031366be218f291592a7ad38bc34a7cd1459737 ]
ovl_lookup_layers() passes ctx->upperdentry to ovl_get_inode(), which
takes over the reference. If an overlay inode for the upper inode is
already cached, as for a second hard link, ovl_get_inode() puts the
dentry and returns the cached inode. ovl_lookup_layers() then passes
the put dentry to ovl_dentry_init_reval(), which reads its d_flags.
With a local upper fs the put dentry usually stays in the dcache, but
with a FUSE upper whose entry has timed out, dput() kills it, so this
is a use-after-free.
Fix this by taking the revalidate flags from the upper dentry of the
overlay inode, which is the one that ovl_dentry_revalidate_common()
revalidates.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-986db859-840c-479d-944c-b9c43b93377e
Fixes: bccece1ead36 ("ovl: allow remote upper")
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[ sashal: Moved the ovl_dentry_init_reval() call inside the if (upperdentry || ctr) block, taking flags from ovl_i_dentry_upper(inode) with an else branch for negative dentries, and dropped upstream's third argument since this tree's helper takes two. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/namei.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 124c437e65e6a..a255102adc624 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1123,9 +1123,16 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
goto out_free_oe;
if (upperdentry && !uppermetacopy)
ovl_set_flag(OVL_UPPERDATA, inode);
- }
- ovl_dentry_init_reval(dentry, upperdentry);
+ /*
+ * ovl_get_inode() puts upperdentry if it finds a cached
+ * inode, e.g. for another hard link, so use the upper dentry
+ * of the inode.
+ */
+ ovl_dentry_init_reval(dentry, ovl_i_dentry_upper(inode));
+ } else {
+ ovl_dentry_init_reval(dentry, NULL);
+ }
revert_creds(old_cred);
if (origin_path) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0753/1059] ovl: bump the impure dir version when linking a file with origin
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (751 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0752/1059] ovl: do not read the flags of a put upper dentry in lookup Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0754/1059] dm-verity: dont restart or panic on errors during system shutdown Greg Kroah-Hartman
` (245 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Daejun Park, Amir Goldstein,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
[ Upstream commit 86e2facd8630cc2fdec6ea80c53e370b26b441d9 ]
Linking a file with copy up origin into a non-merge impure dir does
not bump the dir version. readdir then reuses the impure dir cache
built before the link. It reports the upper inode number as d_ino of
the new link, not st_ino.
Pass whether the linked file has an origin to ovl_dir_modified(), as
rename and unlink do.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-98f207b6-3936-48e9-a40f-88f20be4db7b
Fixes: 4edb83bb1041 ("ovl: constant d_ino for non-merge dirs")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[ sashal: Adapted to older code: ovl_instantiate() gets an origin parameter instead of the dir-modified call moving out, and the create paths call ovl_create_upper/over_whiteout directly without the whiteout helper. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/dir.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index d2f7b68f8ee63..cb53cb58bdd19 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -260,14 +260,14 @@ static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)
* may not use to instantiate the new dentry.
*/
static int ovl_instantiate(struct dentry *dentry, struct inode *inode,
- struct dentry *newdentry, bool hardlink)
+ struct dentry *newdentry, bool hardlink, bool origin)
{
struct ovl_inode_params oip = {
.upperdentry = newdentry,
.newinode = inode,
};
- ovl_dir_modified(dentry->d_parent, false);
+ ovl_dir_modified(dentry->d_parent, origin);
ovl_dentry_set_upper_alias(dentry);
if (!hardlink) {
@@ -324,7 +324,7 @@ static bool ovl_type_origin(struct dentry *dentry)
}
static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *attr)
+ struct ovl_cattr *attr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
@@ -347,7 +347,8 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
ovl_set_opaque(dentry, newdentry);
}
- err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink);
+ err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink,
+ origin);
if (err)
goto out_cleanup;
out_unlock:
@@ -461,7 +462,7 @@ static int ovl_set_upper_acl(struct ovl_fs *ofs, struct dentry *upperdentry,
}
static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *cattr)
+ struct ovl_cattr *cattr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *workdir = ovl_workdir(dentry);
@@ -547,7 +548,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
if (err)
goto out_cleanup;
}
- err = ovl_instantiate(dentry, inode, newdentry, hardlink);
+ err = ovl_instantiate(dentry, inode, newdentry, hardlink, origin);
if (err) {
ovl_cleanup(ofs, udir, newdentry);
dput(newdentry);
@@ -625,9 +626,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
}
if (!ovl_dentry_is_whiteout(dentry))
- err = ovl_create_upper(dentry, inode, attr);
+ err = ovl_create_upper(dentry, inode, attr, origin);
else
- err = ovl_create_over_whiteout(dentry, inode, attr);
+ err = ovl_create_over_whiteout(dentry, inode, attr, origin);
out_revert_creds:
revert_creds(old_cred);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0754/1059] dm-verity: dont restart or panic on errors during system shutdown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (752 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0753/1059] ovl: bump the impure dir version when linking a file with origin Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0755/1059] dm snapshot: fix discard_granularity unit in snapshot_io_hints Greg Kroah-Hartman
` (244 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hongyu Jin, weijiang.zhou,
Mikulas Patocka, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weijiang Zhou <weijiang.zhou@unisoc.com>
[ Upstream commit 47930d1236d2988cdc580c10d3af21b6b02d7ece ]
Commit 252bd1256396 ("dm verity: skip verity work if I/O error when system
is shutting down") stopped I/O errors during shutdown from triggering a
restart, since devices may legitimately be gone by then. Errors that reach
verity_handle_err(), e.g. through a failed hash block read followed by a
failed FEC attempt, are not covered and still call kernel_restart() or
panic().
During a reboot that is both wrong (nothing is corrupt) and harmful: it
races with the reboot already in progress and replaces its reason with
"dm-verity device corrupted", which bootloaders such as Android's treat as
a verity failure and switch the device to EIO mode.
Apply the same shutdown check in verity_handle_err(). Corruption is still
logged, recorded in hash_failed and reported via uevent, and the I/O still
fails.
Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
Signed-off-by: weijiang.zhou <weijiang.zhou@unisoc.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 252bd1256396 ("dm verity: skip verity work if I/O error when system is shutting down")
Cc: stable@vger.kernel.org
[ sashal: adjusted the final hunk's context, since the surrounding code in this tree differs (verity_verify_io returns 0 where mainline returns r, and the removed helper is followed by a different function). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-verity-target.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 3e582c1b544fe..ce72eed21d6c5 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -215,6 +215,15 @@ static void verity_hash_at_level(struct dm_verity *v, sector_t block, int level,
*offset = idx << (v->hash_dev_block_bits - v->hash_per_block_bits);
}
+/*
+ * Skip verity work in response to I/O error when system is shutting down.
+ */
+static inline bool verity_is_system_shutting_down(void)
+{
+ return system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF
+ || system_state == SYSTEM_RESTART;
+}
+
/*
* Handle verification errors.
*/
@@ -262,6 +271,15 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
if (v->mode == DM_VERITY_MODE_LOGGING)
return 0;
+ /*
+ * Devices may already be quiesced (e.g. UFS set offline by its
+ * shutdown hook), so a failure here does not imply corruption. Fail
+ * the I/O but do not restart or panic, which would also override the
+ * reboot reason of the shutdown already in progress.
+ */
+ if (verity_is_system_shutting_down())
+ return 1;
+
if (v->mode == DM_VERITY_MODE_RESTART)
kernel_restart("dm-verity device corrupted");
@@ -656,15 +674,6 @@ static int verity_verify_io(struct dm_verity_io *io)
return 0;
}
-/*
- * Skip verity work in response to I/O error when system is shutting down.
- */
-static inline bool verity_is_system_shutting_down(void)
-{
- return system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF
- || system_state == SYSTEM_RESTART;
-}
-
/*
* End one "io" structure with a given error.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0755/1059] dm snapshot: fix discard_granularity unit in snapshot_io_hints
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (753 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0754/1059] dm-verity: dont restart or panic on errors during system shutdown Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0756/1059] usb: dwc3: gadget: Fix use-after-free in dwc3_gadget_free_endpoints due to race condition Greg Kroah-Hartman
` (243 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+1288484b13bf6af3620d,
wuyuehong, Mikulas Patocka, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: wuyuehong <wuyuehong@cmss.chinamobile.com>
[ Upstream commit d7216d7be2bbfdf3312695b6e41a4fc7c5e22902 ]
snapshot_io_hints() copies the snapshot store's chunk_size, which is
in 512-byte sectors, into queue_limits.discard_granularity, which, like
all other members of struct queue_limits, is in bytes.
For snapshots with a chunk size smaller than 512 sectors, e.g. the
16 KiB (32-sector) chunks created by the syzkaller reproducer, the
resulting granularity is smaller than a single sector. When
dm_calculate_queue_limits() then stacks the target limits into the
table limits:
blk_stack_limits(limits, &ti_limits, 0)
queue_limit_discard_alignment() truncates that granularity to zero
sectors and sector_div() divides by zero:
Oops: divide error: 0000 [#1] SMP KASAN NOPTI
RIP: 0010:queue_limit_discard_alignment block/blk-settings.c:645 [inline]
RIP: 0010:blk_stack_limits+0x1105/0x2d00 block/blk-settings.c:916
Call Trace:
dm_calculate_queue_limits+0x70c/0x1510 drivers/md/dm-table.c:1823
dm_setup_md_queue+0x199/0x4f0 drivers/md/dm.c:2618
table_load+0x4fd/0x8a0 drivers/md/dm-ioctl.c:1661
The divide fault itself only became reachable when commit e924da7d6622
("block: Drop granularity check in queue_limit_discard_alignment()")
removed the check for a sub-sector granularity in v6.13. Kernels
before that returned a zero discard alignment instead of faulting, but
they still advertised a granularity 512 times too small.
Use the same chunk_size << SECTOR_SHIFT conversion that
io_overlaps_chunk() already applies to turn chunk_size into bytes.
Fixes: 2e6023850e17 ("dm snapshot: add optional discard support features")
Reported-by: syzbot+1288484b13bf6af3620d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1288484b13bf6af3620d
Cc: stable@vger.kernel.org
Signed-off-by: wuyuehong <wuyuehong@cmss.chinamobile.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[ sashal: adjusted context: kept the old max_discard_sectors line in place of upstream's max_hw_discard_sectors, since that rename is absent here; the discard_granularity change itself is identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-snap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 1422dcde989a4..78c3dc10a826e 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -2428,7 +2428,7 @@ static void snapshot_io_hints(struct dm_target *ti, struct queue_limits *limits)
snap = snap_src;
/* All discards are split on chunk_size boundary */
- limits->discard_granularity = snap->store->chunk_size;
+ limits->discard_granularity = snap->store->chunk_size << SECTOR_SHIFT;
limits->max_discard_sectors = snap->store->chunk_size;
up_read(&_origins_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0756/1059] usb: dwc3: gadget: Fix use-after-free in dwc3_gadget_free_endpoints due to race condition
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (754 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0755/1059] dm snapshot: fix discard_granularity unit in snapshot_io_hints Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0757/1059] serial: rda: Use port lock wrappers Greg Kroah-Hartman
` (242 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thinh Nguyen, Pei Xiao,
Radhey Shyam Pandey, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <xiaopei01@kylinos.cn>
[ Upstream commit 9c855832790cd488d87de1885974f4c37cfe7358 ]
In dwc3_gadget_init_endpoint, &dep->nostream_work is bound with
dwc3_nostream_work, and dwc3_gadget_endpoint_stream_event can queue
this delayed work on system_percpu_wq when a DEPEVT_STREAM_NOSTREAM
event is received.
If we remove the gadget, dwc3_gadget_free_endpoints makes cleanup and
the memory allocated for dep with kzalloc() is released by kfree(dep),
while the delayed work mentioned above may still be pending or
running. The sequence of operations that may lead to a UAF bug is as
follows:
CPU0 CPU1
| dwc3_thread_interrupt
| dwc3_endpoint_interrupt
| dwc3_gadget_endpoint_stream_event
| queue_delayed_work(system_percpu_wq,
| &dep->nostream_work)
dwc3_gadget_free_endpoints |
dwc3_free_trb_pool(dep) |
list_del(&dep->endpoint.ep_list) |
dwc3_debugfs_remove_endpoint_dir(dep) |
kfree(dep) |
// dep is freed |
| dwc3_nostream_work
| // use dep (use-after-free)
Fix it by canceling the delayed work before kfree(dep) in
dwc3_gadget_free_endpoints.
Fixes: dcfe437492e2 ("usb: dwc3: gadget: Reinitiate stream for all host NoStream behavior")
Assisted-by: Codex:deepseek-v4-flash
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: stable@vger.kernel.org
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/331d1d5133496d2b4184e05f8848adb06930a138.1785893865.git.xiaopei01@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/gadget.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 01f2729bcbfb5..4a232280936e1 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3377,6 +3377,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
}
dwc3_debugfs_remove_endpoint_dir(dep);
+ cancel_delayed_work_sync(&dep->nostream_work);
kfree(dep);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0757/1059] serial: rda: Use port lock wrappers
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (755 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0756/1059] usb: dwc3: gadget: Fix use-after-free in dwc3_gadget_free_endpoints due to race condition Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0758/1059] serial: rda: free the interrupt on shutdown Greg Kroah-Hartman
` (241 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Gleixner, John Ogness,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <tglx@linutronix.de>
[ Upstream commit 7c572c17ca898870822bf7d3a6c32f357527f132 ]
When a serial port is used for kernel console output, then all
modifications to the UART registers which are done from other contexts,
e.g. getty, termios, are interference points for the kernel console.
So far this has been ignored and the printk output is based on the
principle of hope. The rework of the console infrastructure which aims to
support threaded and atomic consoles, requires to mark sections which
modify the UART registers as unsafe. This allows the atomic write function
to make informed decisions and eventually to restore operational state. It
also allows to prevent the regular UART code from modifying UART registers
while printk output is in progress.
All modifications of UART registers are guarded by the UART port lock,
which provides an obvious synchronization point with the console
infrastructure.
To avoid adding this functionality to all UART drivers, wrap the
spin_[un]lock*() invocations for uart_port::lock into helper functions
which just contain the spin_[un]lock*() invocations for now. In a
subsequent step these helpers will gain the console synchronization
mechanisms.
Converted with coccinelle. No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20230914183831.587273-51-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 859f7c56709b ("serial: rda: free the interrupt on shutdown")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/rda-uart.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 0e387e2144fa2..9deb1c11f743a 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -139,12 +139,12 @@ static unsigned int rda_uart_tx_empty(struct uart_port *port)
unsigned int ret;
u32 val;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
val = rda_uart_read(port, RDA_UART_STATUS);
ret = (val & RDA_UART_TX_FIFO_MASK) ? TIOCSER_TEMT : 0;
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
return ret;
}
@@ -246,7 +246,7 @@ static void rda_uart_set_termios(struct uart_port *port,
unsigned int baud;
u32 irq_mask;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
baud = uart_get_baud_rate(port, termios, old, 9600, port->uartclk / 4);
rda_uart_change_baudrate(rda_port, baud);
@@ -325,7 +325,7 @@ static void rda_uart_set_termios(struct uart_port *port,
/* update the per-port timeout */
uart_update_timeout(port, termios->c_cflag, baud);
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
}
static void rda_uart_send_chars(struct uart_port *port)
@@ -409,7 +409,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
unsigned long flags;
u32 val, irq_mask;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
/* Clear IRQ cause */
val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
@@ -426,7 +426,7 @@ static irqreturn_t rda_interrupt(int irq, void *dev_id)
rda_uart_send_chars(port);
}
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
return IRQ_HANDLED;
}
@@ -437,16 +437,16 @@ static int rda_uart_startup(struct uart_port *port)
int ret;
u32 val;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
rda_uart_write(port, 0, RDA_UART_IRQ_MASK);
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
ret = request_irq(port->irq, rda_interrupt, IRQF_NO_SUSPEND,
"rda-uart", port);
if (ret)
return ret;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
val = rda_uart_read(port, RDA_UART_CTRL);
val |= RDA_UART_ENABLE;
@@ -457,7 +457,7 @@ static int rda_uart_startup(struct uart_port *port)
val |= (RDA_UART_RX_DATA_AVAILABLE | RDA_UART_RX_TIMEOUT);
rda_uart_write(port, val, RDA_UART_IRQ_MASK);
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
return 0;
}
@@ -467,7 +467,7 @@ static void rda_uart_shutdown(struct uart_port *port)
unsigned long flags;
u32 val;
- spin_lock_irqsave(&port->lock, flags);
+ uart_port_lock_irqsave(port, &flags);
rda_uart_stop_tx(port);
rda_uart_stop_rx(port);
@@ -476,7 +476,7 @@ static void rda_uart_shutdown(struct uart_port *port)
val &= ~RDA_UART_ENABLE;
rda_uart_write(port, val, RDA_UART_CTRL);
- spin_unlock_irqrestore(&port->lock, flags);
+ uart_port_unlock_irqrestore(port, flags);
}
static const char *rda_uart_type(struct uart_port *port)
@@ -516,7 +516,7 @@ static void rda_uart_config_port(struct uart_port *port, int flags)
rda_uart_request_port(port);
}
- spin_lock_irqsave(&port->lock, irq_flags);
+ uart_port_lock_irqsave(port, &irq_flags);
/* Clear mask, so no surprise interrupts. */
rda_uart_write(port, 0, RDA_UART_IRQ_MASK);
@@ -524,7 +524,7 @@ static void rda_uart_config_port(struct uart_port *port, int flags)
/* Clear status register */
rda_uart_write(port, 0, RDA_UART_STATUS);
- spin_unlock_irqrestore(&port->lock, irq_flags);
+ uart_port_unlock_irqrestore(port, irq_flags);
}
static void rda_uart_release_port(struct uart_port *port)
@@ -598,9 +598,9 @@ static void rda_uart_port_write(struct uart_port *port, const char *s,
if (port->sysrq) {
locked = 0;
} else if (oops_in_progress) {
- locked = spin_trylock(&port->lock);
+ locked = uart_port_trylock(port);
} else {
- spin_lock(&port->lock);
+ uart_port_lock(port);
locked = 1;
}
@@ -616,7 +616,7 @@ static void rda_uart_port_write(struct uart_port *port, const char *s,
rda_uart_write(port, old_irq_mask, RDA_UART_IRQ_MASK);
if (locked)
- spin_unlock(&port->lock);
+ uart_port_unlock(port);
local_irq_restore(flags);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0758/1059] serial: rda: free the interrupt on shutdown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (756 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0757/1059] serial: rda: Use port lock wrappers Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0759/1059] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14 Greg Kroah-Hartman
` (240 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jiri Slaby, Arnd Bergmann,
Andreas Färber, Olof Johansson, Josef Bacik,
Manivannan Sadhasivam, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 859f7c56709b161a72b629b6f2f1384dcd374404 ]
rda_uart_startup() requests the interrupt, and nothing ever frees it.
It is not shared, so once the port has been closed, the next startup
fails with -EBUSY and the port cannot be opened any more.
Free it in rda_uart_shutdown().
Fixes: c10b13325ced ("tty: serial: Add RDA8810PL UART driver")
Cc: stable <stable@kernel.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20261027-tty-llm-v1-20-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/rda-uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index 9deb1c11f743a..fcbc49508d467 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -477,6 +477,8 @@ static void rda_uart_shutdown(struct uart_port *port)
rda_uart_write(port, val, RDA_UART_CTRL);
uart_port_unlock_irqrestore(port, flags);
+
+ free_irq(port->irq, port);
}
static const char *rda_uart_type(struct uart_port *port)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0759/1059] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (757 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0758/1059] serial: rda: free the interrupt on shutdown Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0760/1059] usb: dwc3: gadget: Wait for End Transfer completion on ep disable Greg Kroah-Hartman
` (239 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Francesco Orro, Ihor Urazov,
Heikki Krogerus, Huang Wei, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Urazov <z0rc3r@gmail.com>
[ Upstream commit 3ee1e1c3fca6fb5d0abbe0fc91539951ffa60aa7 ]
The HP ZBook 8 G2i 14 (board 8ED9) exposes a working UCSI ACPI PPM, but
its UCSI VERSION field reads zero until the first command completes.
ucsi_register() rejects a zero version with -ENODEV, so no Type-C ports
are registered.
The firmware's _DSM READ function (2) is a stub. The mailbox VERSION
field is written only by the EC response handler, after a command
completes, after which it reads 0x0100 (UCSI 1.0). The mailbox is
48 bytes with 16-byte MESSAGE_IN/MESSAGE_OUT fields, the UCSI 1.x
layout, and _DSM function 5 is not implemented.
Add a DMI-specific read_version for this board that substitutes the
version the firmware itself reports, UCSI 1.0, only when VERSION reads
zero. A non-zero firmware version is used as is.
The same firmware defect on the HP ZBook Fury G1i 16 was discussed in
"[RFC PATCH] usb: typec: ucsi: acpi: bootstrap PPM on HP systems with
empty _DSM func 2" [1]. The defect was reported to HP as case
5166176673.
Tested on an HP ZBook 8 G2i 14 with BIOS Y70 01.02.08, from a fresh
boot where VERSION reads zero: three connectors register, the PD
contract and alternate modes of a Thunderbolt dock are reported, and
its DisplayPort output stays up across the PPM reset in ucsi_init().
Dock unplug/replug and s2idle suspend/resume update the connector
state without errors.
Link: https://lore.kernel.org/linux-usb/f3M_fpjtt8FxDqGKcA84vqXmRbKzCBfpCrIK4-jCWvIscER51zkD8qD8FYpz75qZw51rMDRSkUyYlrBvLvdM8CGRY2l8TFVvr4MC1LdTzbc=@interstellar.eu/ [1]
Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
Cc: stable <stable@kernel.org>
Cc: Francesco Orro <ncesco@interstellar.eu>
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ihor Urazov <z0rc3r@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Huang Wei <huangwei@kylinos.cn>
Link: https://patch.msgid.link/20261026-ucsi-hp-zbook-8-g2i-v1-1-91002e9ef073@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: adapted to the older ucsi_operations API by using a read() hook that patches the VERSION read instead of read_version(), and added the missing UCSI_VERSION_1_0 define. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/ucsi/ucsi.h | 1 +
drivers/usb/typec/ucsi/ucsi_acpi.c | 33 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 16ead80d3a4e7..30cbc95adf40e 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -26,6 +26,7 @@ struct ucsi_connector;
#define UCSIv2_MESSAGE_OUT 272
/* UCSI versions */
+#define UCSI_VERSION_1_0 0x0100
#define UCSI_VERSION_1_2 0x0120
#define UCSI_VERSION_2_0 0x0200
#define UCSI_VERSION_2_1 0x0210
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index eeb457ff255e4..47630be780ebb 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -131,6 +131,32 @@ static const struct ucsi_operations ucsi_acer_ops = {
.async_write = ucsi_acpi_async_write
};
+static int ucsi_hp_read(struct ucsi *ucsi, unsigned int offset,
+ void *val, size_t val_len)
+{
+ struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
+ u16 *version = val;
+ int ret;
+
+ ret = ucsi_acpi_read(ucsi, offset, val, val_len);
+ if (ret)
+ return ret;
+
+ /* Firmware fills in VERSION (1.0) only after the first command completes */
+ if (offset == UCSI_VERSION && val_len == sizeof(*version) && !*version) {
+ dev_warn(ua->dev, "UCSI version is zero, assuming 1.0\n");
+ *version = UCSI_VERSION_1_0;
+ }
+
+ return 0;
+}
+
+static const struct ucsi_operations ucsi_hp_ops = {
+ .read = ucsi_hp_read,
+ .sync_write = ucsi_acpi_sync_write,
+ .async_write = ucsi_acpi_async_write
+};
+
static int
ucsi_zenbook_read(struct ucsi *ucsi, unsigned int offset, void *val, size_t val_len)
{
@@ -205,6 +231,13 @@ static const struct dmi_system_id ucsi_acpi_quirks[] = {
},
.driver_data = (void *)&ucsi_acer_ops,
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+ DMI_MATCH(DMI_BOARD_NAME, "8ED9"),
+ },
+ .driver_data = (void *)&ucsi_hp_ops,
+ },
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0760/1059] usb: dwc3: gadget: Wait for End Transfer completion on ep disable
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (758 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0759/1059] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14 Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0761/1059] usb: dwc3: Always deassert xilinx resets Greg Kroah-Hartman
` (238 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Selvarasu Ganesan,
Thinh Nguyen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
[ Upstream commit 1338410c21a5710b7ba88057034d35367ba0f054 ]
The End Transfer command on ep disable is issued without interrupt, and
the endpoint flags are cleared right after a fixed delay. The command
may not have completed by then. If the function driver re-enables the
endpoint and queues a request, the next Start Transfer fails with "No
Resource".
Issue the End Transfer command with interrupt on ep disable, and keep
DWC3_EP_END_TRANSFER_PENDING and DWC3_EP_TRANSFER_STARTED until the
command completes. Defer the no-op Start Transfer of a stream endpoint
re-enabled in the meantime to the command completion.
Fixes: c5353b225df9 ("usb: dwc3: gadget: don't enable interrupt when disabling endpoint")
Cc: stable <stable@kernel.org>
Reported-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
Closes: https://lore.kernel.org/linux-usb/20260227121236.963-1-selvarasu.g@samsung.com/
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/24fa8adeb0222dab415c8c2799405188440bad4b.1792542945.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/core.h | 4 +++-
drivers/usb/dwc3/ep0.c | 2 +-
drivers/usb/dwc3/gadget.c | 42 ++++++++++++++++++++++++++++++++-------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 56208f7d8cf5e..37a92474c4802 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -748,6 +748,7 @@ struct dwc3_ep {
#define DWC3_EP_TXFIFO_RESIZED BIT(12)
#define DWC3_EP_DELAY_STOP BIT(13)
#define DWC3_EP_RESOURCE_ALLOCATED BIT(14)
+#define DWC3_EP_PENDING_NOOP_START BIT(15)
/* This last one is specific to EP0 */
#define DWC3_EP0_DIR_IN BIT(31)
@@ -1613,7 +1614,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned int cmd,
u32 param);
void dwc3_gadget_clear_tx_fifos(struct dwc3 *dwc);
-void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep, int status);
+void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep, int status,
+ bool interrupt);
#else
static inline int dwc3_gadget_init(struct dwc3 *dwc)
{ return 0; }
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 764360ac7e368..700fb9f450070 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -313,7 +313,7 @@ void dwc3_ep0_out_start(struct dwc3 *dwc)
if (dwc->connected)
dwc3_stop_active_transfer(dwc3_ep, false, true);
else
- dwc3_remove_requests(dwc, dwc3_ep, -ESHUTDOWN);
+ dwc3_remove_requests(dwc, dwc3_ep, -ESHUTDOWN, false);
}
}
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4a232280936e1..bb73fdd666559 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -978,9 +978,14 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
* Response Update Transfer command.
*/
if (dep->stream_capable) {
- ret = dwc3_gadget_ep_start_noop_transfer(dep);
- if (ret < 0)
- return ret;
+ if (dep->flags & (DWC3_EP_END_TRANSFER_PENDING |
+ DWC3_EP_DELAY_STOP)) {
+ dep->flags |= DWC3_EP_PENDING_NOOP_START;
+ } else {
+ ret = dwc3_gadget_ep_start_noop_transfer(dep);
+ if (ret < 0)
+ return ret;
+ }
}
out:
@@ -989,16 +994,21 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
return 0;
}
-void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep, int status)
+void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep, int status,
+ bool interrupt)
{
struct dwc3_request *req;
- dwc3_stop_active_transfer(dep, false, false);
+ dwc3_stop_active_transfer(dep, false, interrupt);
/* If endxfer is delayed, avoid unmapping requests */
if (dep->flags & DWC3_EP_DELAY_STOP)
return;
+ /* Give the controller time to stop accessing the request buffers */
+ if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
+ mdelay(1);
+
/* - giveback all requests to gadget driver */
while (!list_empty(&dep->started_list)) {
req = next_request(&dep->started_list);
@@ -1047,7 +1057,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
dep->flags &= ~DWC3_EP_ENABLED;
- dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
+ dwc3_remove_requests(dwc, dep, -ESHUTDOWN, true);
dep->stream_capable = false;
dep->type = 0;
@@ -1059,6 +1069,15 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
*/
if (dep->flags & DWC3_EP_DELAY_STOP)
mask |= (DWC3_EP_DELAY_STOP | DWC3_EP_TRANSFER_STARTED);
+
+ /*
+ * The End Transfer command is still in progress. Do not clear the
+ * flags, so that the ep is only rearmed once the command completes.
+ */
+ if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
+ mask |= (DWC3_EP_END_TRANSFER_PENDING |
+ DWC3_EP_TRANSFER_STARTED);
+
dep->flags &= mask;
/* Clear out the ep descriptors for non-ep0 */
@@ -2438,7 +2457,7 @@ static void dwc3_stop_active_transfers(struct dwc3 *dwc)
if (!dep)
continue;
- dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
+ dwc3_remove_requests(dwc, dep, -ESHUTDOWN, false);
}
}
@@ -3757,7 +3776,16 @@ static void dwc3_gadget_endpoint_command_complete(struct dwc3_ep *dep,
dwc3_ep0_send_delayed_status(dwc);
}
+ if (dep->flags & DWC3_EP_PENDING_NOOP_START) {
+ dep->flags &= ~DWC3_EP_PENDING_NOOP_START;
+
+ if (!(dep->flags & DWC3_EP_DELAY_START) &&
+ (dep->flags & DWC3_EP_ENABLED))
+ dwc3_gadget_ep_start_noop_transfer(dep);
+ }
+
if ((dep->flags & DWC3_EP_DELAY_START) &&
+ (dep->flags & DWC3_EP_ENABLED) &&
!usb_endpoint_xfer_isoc(dep->endpoint.desc))
__dwc3_gadget_kick_transfer(dep);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0761/1059] usb: dwc3: Always deassert xilinx resets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (759 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0760/1059] usb: dwc3: gadget: Wait for End Transfer completion on ep disable Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0762/1059] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Greg Kroah-Hartman
` (237 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sean Anderson, Thinh Nguyen,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <sean.anderson@linux.dev>
[ Upstream commit ec06c8039d396a1b558cc138f5c5aba17698e175 ]
If we don't have a usb3 phy we don't need to assert the core resets.
Deassert them even if we didn't assert them to support booting when the
bootloader never released the core from reset.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260106171018.501612-1-sean.anderson@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: f33f0dd2eb01 ("usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 71 ++++++++++++++++------------------
1 file changed, 34 insertions(+), 37 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 1156e2df499f6..6afd3769be3a1 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -113,21 +113,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- /*
- * The following core resets are not required unless a USB3 PHY
- * is used, and the subsequent register settings are not required
- * unless a core reset is performed (they should be set properly
- * by the first-stage boot loader, but may be reverted by a core
- * reset). They may also break the configuration if USB3 is actually
- * in use but the usb3-phy entry is missing from the device tree.
- * Therefore, skip these operations in this case.
- */
- if (!priv_data->usb3_phy) {
- /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */
- writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
- goto skip_usb3_phy;
- }
-
crst = devm_reset_control_get_exclusive(dev, "usb_crst");
if (IS_ERR(crst)) {
ret = PTR_ERR(crst);
@@ -152,22 +137,31 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- ret = reset_control_assert(crst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert core reset\n");
- goto err;
- }
-
- ret = reset_control_assert(hibrst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert hibernation reset\n");
- goto err;
- }
-
- ret = reset_control_assert(apbrst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert APB reset\n");
- goto err;
+ /*
+ * Asserting the core resets is not required unless a USB3 PHY is used.
+ * They may also break the configuration if USB3 is actually in use but
+ * the usb3-phy entry is missing from the device tree. Therefore, skip
+ * a full reset cycle and just deassert the resets if the phy is
+ * absent.
+ */
+ if (priv_data->usb3_phy) {
+ ret = reset_control_assert(crst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert core reset\n");
+ goto err;
+ }
+
+ ret = reset_control_assert(hibrst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert hibernation reset\n");
+ goto err;
+ }
+
+ ret = reset_control_assert(apbrst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert APB reset\n");
+ goto err;
+ }
}
ret = phy_init(priv_data->usb3_phy);
@@ -180,11 +174,15 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err_phy_exit;
}
- /* Set PIPE Power Present signal in FPD Power Present Register*/
- writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
-
- /* Set the PIPE Clock Select bit in FPD PIPE Clock register */
- writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ if (priv_data->usb3_phy) {
+ /* Set PIPE Power Present signal in FPD Power Present Register*/
+ writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
+ /* Set the PIPE Clock Select bit in FPD PIPE Clock register */
+ writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ } else {
+ /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */
+ writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ }
ret = reset_control_deassert(crst);
if (ret < 0) {
@@ -202,7 +200,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
if (ret < 0)
goto err_phy_exit;
-skip_usb3_phy:
/* ulpi reset via gpio-modepin or gpio-framework driver */
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(reset_gpio)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0762/1059] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (760 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0761/1059] usb: dwc3: Always deassert xilinx resets Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0763/1059] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
` (236 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Radhey Shyam Pandey,
Thinh Nguyen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
[ Upstream commit f33f0dd2eb014bffda02ecfd182de3ddab058596 ]
If reset deassert or PHY setup fails partway through
dwc3_xlnx_init_zynqmp(), re-assert the resets that were already
released before unwinding the PHY.
Only undo the reset cycle the function actually performed. The cycle is
skipped when no usb3-phy is present, because asserting the core resets
can break a USB3 configuration that is live but missing from the device
tree, so the error path skips it for the same reason. Asserting an
already asserted reset is harmless, so one block covers however far the
deasserts progressed.
Save the ZynqMP reset handles in driver private data so later probe
teardown can re-assert released resets.
Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
Cc: stable <stable@kernel.org>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260928120015.3152461-3-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 55 ++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 6afd3769be3a1..ecae90293d1fe 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -49,6 +49,9 @@ struct dwc3_xlnx {
void __iomem *regs;
int (*pltfm_init)(struct dwc3_xlnx *data);
struct phy *usb3_phy;
+ struct reset_control *usb_crst;
+ struct reset_control *usb_hibrst;
+ struct reset_control *usb_apbrst;
};
static void dwc3_xlnx_mask_phy_rst(struct dwc3_xlnx *priv_data, bool mask)
@@ -100,7 +103,6 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)
static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
{
struct device *dev = priv_data->dev;
- struct reset_control *crst, *hibrst, *apbrst;
struct gpio_desc *reset_gpio;
int ret = 0;
u32 reg;
@@ -113,25 +115,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- crst = devm_reset_control_get_exclusive(dev, "usb_crst");
- if (IS_ERR(crst)) {
- ret = PTR_ERR(crst);
+ priv_data->usb_crst = devm_reset_control_get_exclusive(dev, "usb_crst");
+ if (IS_ERR(priv_data->usb_crst)) {
+ ret = PTR_ERR(priv_data->usb_crst);
dev_err_probe(dev, ret,
"failed to get core reset signal\n");
goto err;
}
- hibrst = devm_reset_control_get_exclusive(dev, "usb_hibrst");
- if (IS_ERR(hibrst)) {
- ret = PTR_ERR(hibrst);
+ priv_data->usb_hibrst = devm_reset_control_get_exclusive(dev, "usb_hibrst");
+ if (IS_ERR(priv_data->usb_hibrst)) {
+ ret = PTR_ERR(priv_data->usb_hibrst);
dev_err_probe(dev, ret,
"failed to get hibernation reset signal\n");
goto err;
}
- apbrst = devm_reset_control_get_exclusive(dev, "usb_apbrst");
- if (IS_ERR(apbrst)) {
- ret = PTR_ERR(apbrst);
+ priv_data->usb_apbrst = devm_reset_control_get_exclusive(dev, "usb_apbrst");
+ if (IS_ERR(priv_data->usb_apbrst)) {
+ ret = PTR_ERR(priv_data->usb_apbrst);
dev_err_probe(dev, ret,
"failed to get APB reset signal\n");
goto err;
@@ -145,19 +147,19 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
* absent.
*/
if (priv_data->usb3_phy) {
- ret = reset_control_assert(crst);
+ ret = reset_control_assert(priv_data->usb_crst);
if (ret < 0) {
dev_err(dev, "Failed to assert core reset\n");
goto err;
}
- ret = reset_control_assert(hibrst);
+ ret = reset_control_assert(priv_data->usb_hibrst);
if (ret < 0) {
dev_err(dev, "Failed to assert hibernation reset\n");
goto err;
}
- ret = reset_control_assert(apbrst);
+ ret = reset_control_assert(priv_data->usb_apbrst);
if (ret < 0) {
dev_err(dev, "Failed to assert APB reset\n");
goto err;
@@ -168,7 +170,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
if (ret < 0)
goto err;
- ret = reset_control_deassert(apbrst);
+ ret = reset_control_deassert(priv_data->usb_apbrst);
if (ret < 0) {
dev_err(dev, "Failed to release APB reset\n");
goto err_phy_exit;
@@ -184,21 +186,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
}
- ret = reset_control_deassert(crst);
+ ret = reset_control_deassert(priv_data->usb_crst);
if (ret < 0) {
dev_err(dev, "Failed to release core reset\n");
- goto err_phy_exit;
+ goto err_reset_assert;
}
- ret = reset_control_deassert(hibrst);
+ ret = reset_control_deassert(priv_data->usb_hibrst);
if (ret < 0) {
dev_err(dev, "Failed to release hibernation reset\n");
- goto err_phy_exit;
+ goto err_reset_assert;
}
ret = phy_power_on(priv_data->usb3_phy);
if (ret < 0)
- goto err_phy_exit;
+ goto err_reset_assert;
/* ulpi reset via gpio-modepin or gpio-framework driver */
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
@@ -228,6 +230,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
err_phy_power_off:
phy_power_off(priv_data->usb3_phy);
+err_reset_assert:
+ /*
+ * Undo only the reset cycle performed above. That cycle is skipped
+ * when there is no usb3-phy. The deasserts stay unconditional so a
+ * core the bootloader left in reset still comes up, but they are
+ * deliberately not paired with an assert here: resetting a USB3
+ * configuration that is live but missing from the device tree could
+ * break it. Asserting an already asserted reset is harmless, so one
+ * block covers however far the cycle's deasserts got.
+ */
+ if (priv_data->usb3_phy) {
+ reset_control_assert(priv_data->usb_hibrst);
+ reset_control_assert(priv_data->usb_crst);
+ reset_control_assert(priv_data->usb_apbrst);
+ }
err_phy_exit:
phy_exit(priv_data->usb3_phy);
err:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0763/1059] w1: w1_therm: lock the list of slaves for the bulk read
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (761 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0762/1059] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0764/1059] iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change Greg Kroah-Hartman
` (235 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski, Sasha Levin
6.1-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 739d73349d58d..b53cd284f7911 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1519,6 +1519,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);
@@ -1530,6 +1531,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
@@ -1556,11 +1558,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);
@@ -1586,10 +1590,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;
}
@@ -1954,6 +1960,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) {
@@ -1966,6 +1973,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] 1065+ messages in thread* [PATCH 6.1 0764/1059] iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (762 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0763/1059] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0765/1059] iio: humidity: hid-sensor-humidity: Use per-instance callbacks Greg Kroah-Hartman
` (234 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 4a141623442888458d147f4e61fe47411c0e4e17 ]
For getting all odr change events, we need to parse all FIFO frames
in each iio device. Fix this correctly by sending effectively all
frames to all iio devices.
Previously only batches of frames containing a matching sensor event
were sent to the corresponding iio device.
Fixes: f670d4d34773 ("iio: imu: inv_icm42600: fix odr change not caught in certain cases")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../imu/inv_icm42600/inv_icm42600_buffer.c | 24 ++++++++-----------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
index cb4520b184b01..9bb5fe639955e 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
@@ -531,22 +531,20 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
ts = iio_priv(st->indio_gyro);
inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro,
st->timestamp.gyro);
- ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
- if (ret)
- return ret;
}
+ ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
+ if (ret)
+ return ret;
+
/* handle accelerometer timestamp and FIFO data parsing */
if (st->fifo.nb.accel > 0) {
ts = iio_priv(st->indio_accel);
inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel,
st->timestamp.accel);
- ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
- if (ret)
- return ret;
}
- return 0;
+ return inv_icm42600_accel_parse_fifo(st->indio_accel);
}
int inv_icm42600_buffer_hwfifo_flush(struct inv_icm42600_state *st,
@@ -569,20 +567,18 @@ int inv_icm42600_buffer_hwfifo_flush(struct inv_icm42600_state *st,
if (st->fifo.nb.gyro > 0) {
ts = iio_priv(st->indio_gyro);
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro, gyro_ts);
- ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
- if (ret)
- return ret;
}
+ ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
+ if (ret)
+ return ret;
+
if (st->fifo.nb.accel > 0) {
ts = iio_priv(st->indio_accel);
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel, accel_ts);
- ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
- if (ret)
- return ret;
}
- return 0;
+ return inv_icm42600_accel_parse_fifo(st->indio_accel);
}
int inv_icm42600_buffer_init(struct inv_icm42600_state *st)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0765/1059] iio: humidity: hid-sensor-humidity: Use per-instance callbacks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (763 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0764/1059] iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0766/1059] iio: frequency: admv1013: fix NULL pointer dereference on str Greg Kroah-Hartman
` (233 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christopher Hoover, Joshua Crofts,
Srinivas Pandruvada, Jonathan Cameron, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Hoover <ch@murgatroid.com>
[ Upstream commit bbe4f3f668babc9443fc1f075695e43e17ca7976 ]
hid-sensor-humidity keeps a single static struct
hid_sensor_hub_callbacks for all instances and overwrites its pdev in
every probe, so with two humidity sensors, input reports for one are
delivered with the other's platform device, and a NULL dereference
follows once that device is removed. The same bug was found in
hid-sensor-temperature, which shares this code.
Keep the callbacks in struct hid_humidity_state, as the other HID
sensor drivers (accel, gyro, als, ...) do.
Fixes: d7ed89d5aadf ("iio: hid: Add humidity sensor support")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sashal: Adapted the timestamp field from aligned_s64 timestamp to u64 timestamp __aligned(8), and adjusted whitespace in the sensor_hub_register_callback() argument alignment. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/humidity/hid-sensor-humidity.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
index fa0fe404a70a2..b13b20a36ddfd 100644
--- a/drivers/iio/humidity/hid-sensor-humidity.c
+++ b/drivers/iio/humidity/hid-sensor-humidity.c
@@ -16,6 +16,7 @@
struct hid_humidity_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info humidity_attr;
+ struct hid_sensor_hub_callbacks callbacks;
struct {
s32 humidity_data;
u64 timestamp __aligned(8);
@@ -184,11 +185,6 @@ static int humidity_parse_report(struct platform_device *pdev,
return ret;
}
-static struct hid_sensor_hub_callbacks humidity_callbacks = {
- .send_event = &humidity_proc_event,
- .capture_sample = &humidity_capture_sample,
-};
-
/* Function to initialize the processing for usage id */
static int hid_humidity_probe(struct platform_device *pdev)
{
@@ -240,9 +236,13 @@ static int hid_humidity_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
- humidity_callbacks.pdev = pdev;
+ humid_st->callbacks = (struct hid_sensor_hub_callbacks) {
+ .send_event = humidity_proc_event,
+ .capture_sample = humidity_capture_sample,
+ .pdev = pdev,
+ };
ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY,
- &humidity_callbacks);
+ &humid_st->callbacks);
if (ret)
goto error_remove_trigger;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0766/1059] iio: frequency: admv1013: fix NULL pointer dereference on str
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (764 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0765/1059] iio: humidity: hid-sensor-humidity: Use per-instance callbacks Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0767/1059] drm/amdgpu/vcn4: avoid rereading IB param length Greg Kroah-Hartman
` (232 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nuno Sá, Antoniu Miclaus,
Andy Shevchenko, Stable, Jonathan Cameron, Dickson Wu,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antoniu Miclaus <antoniu.miclaus@analog.com>
commit aac0a51b16700b403a55b67ba495de021db78763 upstream.
When device_property_read_string() fails, str is left uninitialized
but the code falls through to strcmp(str, ...), dereferencing a garbage
pointer. Replace manual read/strcmp with
device_property_match_property_string() and consolidate the SE mode
enums into a single sequential enum, mapping to hardware register
values via a switch consistent with other bitfields in the driver.
Several cleanup patches have been applied to this driver recently so
this will need a manual backport.
Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013")
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
[ adapted to 6.1.y: keep strcmp() parsing, fall back on unknown values ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/frequency/admv1013.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
index 5238dfdb1de5d..a274576bc8f3f 100644
--- a/drivers/iio/frequency/admv1013.c
+++ b/drivers/iio/frequency/admv1013.c
@@ -536,26 +536,24 @@ static int admv1013_properties_parse(struct admv1013_state *st)
ret = device_property_read_string(&spi->dev, "adi,input-mode", &str);
if (ret)
st->input_mode = ADMV1013_IQ_MODE;
-
- if (!strcmp(str, "iq"))
+ else if (!strcmp(str, "iq"))
st->input_mode = ADMV1013_IQ_MODE;
else if (!strcmp(str, "if"))
st->input_mode = ADMV1013_IF_MODE;
else
- return -EINVAL;
+ st->input_mode = ADMV1013_IQ_MODE;
ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str);
if (ret)
st->quad_se_mode = ADMV1013_SE_MODE_DIFF;
-
- if (!strcmp(str, "diff"))
+ else if (!strcmp(str, "diff"))
st->quad_se_mode = ADMV1013_SE_MODE_DIFF;
else if (!strcmp(str, "se-pos"))
st->quad_se_mode = ADMV1013_SE_MODE_POS;
else if (!strcmp(str, "se-neg"))
st->quad_se_mode = ADMV1013_SE_MODE_NEG;
else
- return -EINVAL;
+ st->quad_se_mode = ADMV1013_SE_MODE_DIFF;
st->reg = devm_regulator_get(&spi->dev, "vcm");
if (IS_ERR(st->reg))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0767/1059] drm/amdgpu/vcn4: avoid rereading IB param length
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (765 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0766/1059] iio: frequency: admv1013: fix NULL pointer dereference on str Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.1 0768/1059] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
` (231 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Boyuan Zhang, David Rosca,
Alex Deucher, Dickson Wu, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boyuan Zhang <boyuan.zhang@amd.com>
commit 3b4082fabc67c9780b06eb959e59dd92fa79c0f0 upstream.
Reuse the parameter length returned by
vcn_v4_0_enc_find_ib_param() instead of rereading it from
the IB.
This avoids a potential TOCTOU issue if the IB contents
change between reads.
Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: David Rosca <david.rosca@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit dbb02b4755f8c1f3773263f2d779872c1c0c073a)
Cc: stable@vger.kernel.org
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
index 83d997f8d500a..5df81a21c5226 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
@@ -1719,14 +1719,17 @@ static int vcn_v4_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job,
#define RENCODE_IB_PARAM_SESSION_INIT 0x00000003
/* return the offset in ib if id is found, -1 otherwise */
-static int vcn_v4_0_enc_find_ib_param(struct amdgpu_ib *ib, uint32_t id, int start)
+static int vcn_v4_0_enc_find_ib_param(struct amdgpu_ib *ib, uint32_t id, int start, uint32_t *length)
{
int i;
uint32_t len;
for (i = start; (len = amdgpu_ib_get_value(ib, i)) >= 8; i += len / 4) {
- if (amdgpu_ib_get_value(ib, i + 1) == id)
+ if (amdgpu_ib_get_value(ib, i + 1) == id) {
+ if (length)
+ *length = len;
return i;
+ }
}
return -1;
}
@@ -1736,14 +1739,14 @@ static int vcn_v4_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
struct amdgpu_ib *ib)
{
struct amdgpu_ring *ring = amdgpu_job_ring(job);
- uint32_t val;
+ uint32_t val, len;
int idx = 0, sidx;
/* The first instance can decode anything */
if (!ring->me)
return 0;
- while ((idx = vcn_v4_0_enc_find_ib_param(ib, RADEON_VCN_ENGINE_INFO, idx)) >= 0) {
+ while ((idx = vcn_v4_0_enc_find_ib_param(ib, RADEON_VCN_ENGINE_INFO, idx, &len)) >= 0) {
val = amdgpu_ib_get_value(ib, idx + 2); /* RADEON_VCN_ENGINE_TYPE */
if (val == RADEON_VCN_ENGINE_TYPE_DECODE) {
uint32_t valid_buf_flag = amdgpu_ib_get_value(ib, idx + 6);
@@ -1756,12 +1759,12 @@ static int vcn_v4_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
amdgpu_ib_get_value(ib, idx + 8);
return vcn_v4_0_dec_msg(p, job, msg_buffer_addr);
} else if (val == RADEON_VCN_ENGINE_TYPE_ENCODE) {
- sidx = vcn_v4_0_enc_find_ib_param(ib, RENCODE_IB_PARAM_SESSION_INIT, idx);
+ sidx = vcn_v4_0_enc_find_ib_param(ib, RENCODE_IB_PARAM_SESSION_INIT, idx, NULL);
if (sidx >= 0 &&
amdgpu_ib_get_value(ib, sidx + 2) == RENCODE_ENCODE_STANDARD_AV1)
return vcn_v4_0_limit_sched(p, job);
}
- idx += amdgpu_ib_get_value(ib, idx) / 4;
+ idx += len / 4;
}
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0768/1059] ipvs: read flags and seqs in master atomically
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (766 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0767/1059] drm/amdgpu/vcn4: avoid rereading IB param length Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0769/1059] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
` (230 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
6.1-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 619bdec29aa6a..5a0bca1330a7e 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -540,6 +540,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;
@@ -558,6 +559,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);
@@ -605,7 +614,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++;
@@ -631,6 +640,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;
@@ -652,6 +662,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;
@@ -753,9 +770,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] 1065+ messages in thread* [PATCH 6.1 0769/1059] ipvs: honor the overload state and do not enter it forever
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (767 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.1 0768/1059] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0770/1059] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
` (229 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
6.1-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 49e0dd79592a6..20206d033392f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1484,7 +1484,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 dd6daa9e5d377..1208153ad6dd3 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -634,7 +634,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 */
@@ -727,7 +727,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 d66dc47d3d870..691f7a3b6fe26 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -864,12 +864,12 @@ ip_vs_zero_stats(struct ip_vs_stats *stats)
spin_unlock_bh(&stats->lock);
}
-/* 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;
@@ -880,10 +880,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;
}
}
@@ -891,10 +899,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);
}
@@ -966,13 +974,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);
}
@@ -1043,6 +1048,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
u64_stats_init(&ip_vs_dest_stats->syncp);
}
+ 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 ab497413ab2a3..2683abed45020 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -468,10 +468,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;
@@ -508,6 +509,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 69e961163d3ab..9ce0d95cf6572 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -631,10 +631,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;
@@ -659,9 +660,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 +
@@ -677,6 +675,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] 1065+ messages in thread* [PATCH 6.1 0770/1059] Revert "wifi: ath10k: Stop unanswered temperature reads"
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (768 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0769/1059] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0771/1059] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
` (228 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jeff Johnson
6.1-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
@@ -2926,7 +2926,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
@@ -74,12 +74,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) {
@@ -95,8 +89,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] 1065+ messages in thread* [PATCH 6.1 0771/1059] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (769 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0770/1059] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0772/1059] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
` (227 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Zyngier, Julian Braha,
Sudeep Holla, Sasha Levin
6.1-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 2d1d02eac500c..0b101007880c3 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -202,6 +202,7 @@ enum arm_smccc_conduit {
SMCCC_CONDUIT_HVC,
};
+#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
/**
* arm_smccc_1_1_get_conduit()
*
@@ -241,6 +242,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 */
/**
* struct arm_smccc_res - Result from SMC/HVC call
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0772/1059] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (770 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0771/1059] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0773/1059] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
` (226 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Torokhov, Tzung-Bi Shih,
Sean OBrien, Shashikirana H K, Benjamin Tissoires, Sasha Levin
6.1-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 7fb986615768f..1ae2b55166dcf 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] 1065+ messages in thread* [PATCH 6.1 0773/1059] HID: vivaldi: avoid redundant feature report reads per usage
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (771 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0772/1059] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0774/1059] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
` (225 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhengping Jiang, Benjamin Tissoires,
Sasha Levin
6.1-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 1ae2b55166dcf..93ff9cf77db8f 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] 1065+ messages in thread* [PATCH 6.1 0774/1059] firmware: arm_scmi: Unregister notifier on enable failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (772 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0773/1059] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0775/1059] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
` (224 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
6.1-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 1bc715fe3968c..297651cbcef05 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -1363,8 +1363,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] 1065+ messages in thread* [PATCH 6.1 0775/1059] soundwire: qcom: disable the interrupt before gating the clock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (773 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0774/1059] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0776/1059] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
` (223 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Keri, Dmitry Baryshkov,
Vinod Koul, Sasha Levin
6.1-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 5d2ccccd61722..f2c42730aa5f4 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1512,6 +1512,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);
@@ -1576,6 +1577,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] 1065+ messages in thread* [PATCH 6.1 0776/1059] memory: tegra: Shut down Tegra210 EMC timers before teardown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (774 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0775/1059] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0777/1059] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
` (222 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Sashiko,
Krzysztof Kozlowski, Sasha Levin
6.1-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 cbe1a77235145..ee37d9e590df1 100644
--- a/drivers/memory/tegra/tegra210-emc-core.c
+++ b/drivers/memory/tegra/tegra210-emc-core.c
@@ -1959,12 +1959,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);
@@ -1976,6 +1970,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_cooling_device_register(emc->dev, np, "emc", emc,
@@ -1991,6 +1991,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);
@@ -2003,6 +2005,8 @@ static int 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] 1065+ messages in thread* [PATCH 6.1 0777/1059] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (775 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0776/1059] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0778/1059] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
` (221 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
6.1-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 a6277dea4c7a7..4baa0e3dd59ca 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -148,10 +148,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;
}
@@ -193,10 +197,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;
}
@@ -217,6 +225,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;
}
}
@@ -226,6 +236,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] 1065+ messages in thread* [PATCH 6.1 0778/1059] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (776 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0777/1059] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0779/1059] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
` (220 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
6.1-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 4baa0e3dd59ca..9124c4340b51d 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -160,6 +160,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;
@@ -191,11 +193,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);
@@ -217,8 +222,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] 1065+ messages in thread* [PATCH 6.1 0779/1059] reset: scmi: Set the device for the reset controller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (777 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0778/1059] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0780/1059] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
` (219 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kunihiko Hayashi, Sudeep Holla,
Philipp Zabel, Sasha Levin
6.1-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] 1065+ messages in thread* [PATCH 6.1 0780/1059] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (778 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0779/1059] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0781/1059] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
` (218 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Colton Lewis, Marc Zyngier,
Sasha Levin
6.1-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 9124c4340b51d..165ed685a17e3 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -164,6 +164,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",
@@ -191,6 +193,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] 1065+ messages in thread* [PATCH 6.1 0781/1059] selftests: drivers/s390x: Select uvdevice tests using the target architecture
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (779 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0780/1059] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0782/1059] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
` (217 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sasha Levin, Steffen Eiden,
Christian Borntraeger
6.1-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] 1065+ messages in thread* [PATCH 6.1 0782/1059] phy: ingenic: fix unbalanced regulator disable in exit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (780 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0781/1059] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0783/1059] phy: ti-pipe3: Fix ignored clock enable return value in init Greg Kroah-Hartman
` (216 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 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
6.1-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 28c28d8164849..7b7588f0e0d41 100644
--- a/drivers/phy/ingenic/phy-ingenic-usb.c
+++ b/drivers/phy/ingenic/phy-ingenic-usb.c
@@ -123,7 +123,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] 1065+ messages in thread* [PATCH 6.1 0783/1059] phy: ti-pipe3: Fix ignored clock enable return value in init
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (781 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0782/1059] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0784/1059] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
` (215 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manivannan Sadhasivam, Hongling Zeng,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit 64207b5bc6be7db5e75ba9b7eb271dbda30834e5 ]
ti_pipe3_init() ignores the return value of ti_pipe3_enable_clocks(),
which can lead to:
1. Unclocked hardware access if clock enable fails
2. Unbalanced clock disables in error paths
ti_pipe3_enable_clocks() returns an error code when clock enable fails
and rolls back any partially enabled clocks. If we ignore this error
and continue, we access hardware without proper clocking, which can
cause bus errors.
Additionally, if we reach error paths later in the function and call
ti_pipe3_disable_clocks(), we'll be disabling already-disabled clocks,
causing unbalanced disable warnings.
Fix this by checking the return value of ti_pipe3_enable_clocks()
and returning early if it fails.
Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function")
Reported-by: Sashiko AI <sashiko@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Link: https://patch.msgid.link/20260909122630.1313205-2-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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 57e5bcfb6910f..e02030e8f8b9e 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -498,9 +498,12 @@ static int ti_pipe3_init(struct phy *x)
{
struct ti_pipe3 *phy = phy_get_drvdata(x);
u32 val;
- int ret = 0;
+ int ret;
+
+ ret = ti_pipe3_enable_clocks(phy);
+ if (ret)
+ return ret;
- ti_pipe3_enable_clocks(phy);
/*
* Set pcie_pcs register to 0x96 for proper functioning of phy
* as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0784/1059] phy: ti: pipe3: Fix clock resource leak on probe errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (782 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0783/1059] phy: ti-pipe3: Fix ignored clock enable return value in init Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0785/1059] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
` (214 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hongling Zeng, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
6.1-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 e02030e8f8b9e..8f47981fb2109 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 int ti_pipe3_remove(struct platform_device *pdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0785/1059] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (783 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0784/1059] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0786/1059] phy: ti-pipe3: Fix clock leaks in init/exit error paths Greg Kroah-Hartman
` (213 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manivannan Sadhasivam, Hongling Zeng,
Vinod Koul, Sasha Levin
6.1-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 8f47981fb2109..690615ff5c804 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] 1065+ messages in thread* [PATCH 6.1 0786/1059] phy: ti-pipe3: Fix clock leaks in init/exit error paths
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (784 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0785/1059] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0787/1059] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
` (212 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hongling Zeng, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit 2be6a65608a5e32b2be6f5da843b1f29f1091098 ]
Two paths return without disabling the clocks that ti_pipe3_init()
has just enabled, leaking clock enable references:
1. In ti_pipe3_init(), when regmap_update_bits() fails for PCIe mode,
the function returns the error without calling
ti_pipe3_disable_clocks(). The clocks stay permanently enabled
since the PHY framework won't invoke the .exit callback on init
failure.
2. In ti_pipe3_exit(), when the PHY is in SATA mode without
dpll_reset_syscon, the function returns 0 early to avoid powering
down the SATA DPLL (Errata i783), which also skips the
ti_pipe3_disable_clocks() at the end of the function. Every
init/exit cycle therefore leaks the clock enable reference taken
in ti_pipe3_init().
Fix both by adding the missing ti_pipe3_disable_clocks() calls,
consistent with how the DPLL program error path handles cleanup.
Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function")
Fixes: 0a0830feb2ad ("phy: ti-pipe3: fix suspend")
Reported-by: Sashiko AI <sashiko@kernel.org>
Closes: https://lore.kernel.org/all/20260518023657.41852C2BCB0@smtp.kernel.org/
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909122630.1313205-5-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 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 690615ff5c804..d4dad818cdd51 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -518,6 +518,8 @@ static int ti_pipe3_init(struct phy *x)
val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
ret = regmap_update_bits(phy->pcs_syscon, phy->pcie_pcs_reg,
PCIE_PCS_MASK, val);
+ if (ret)
+ ti_pipe3_disable_clocks(phy);
return ret;
}
@@ -555,8 +557,10 @@ static int ti_pipe3_exit(struct phy *x)
/* If dpll_reset_syscon is not present we wont power down SATA DPLL
* due to Errata i783
*/
- if (phy->mode == PIPE3_MODE_SATA && !phy->dpll_reset_syscon)
+ if (phy->mode == PIPE3_MODE_SATA && !phy->dpll_reset_syscon) {
+ ti_pipe3_disable_clocks(phy);
return 0;
+ }
/* PCIe doesn't have internal DPLL */
if (phy->mode != PIPE3_MODE_PCIE) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0787/1059] ksmbd: sign the last response of a compound that ends early
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (785 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0786/1059] phy: ti-pipe3: Fix clock leaks in init/exit error paths Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0788/1059] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
` (211 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michail Andreas Michalopoulos,
Ian Bridges, Namjae Jeon, Sasha Levin
6.1-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 f951c6047c16a..8501df4b0db54 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -468,22 +468,27 @@ 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;
}
if ((u64)get_rfc1002_len(work->response_buf) + MAX_CIFS_SMALL_BUFFER_SIZE >
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] 1065+ messages in thread* [PATCH 6.1 0788/1059] phy: rockchip: snps-pcie3: Raise the SRAM init timeout
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (786 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0787/1059] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0789/1059] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
` (210 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sebastian Reichel,
Manivannan Sadhasivam, Shawn Lin, Vinod Koul, Sasha Levin
6.1-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 c6aa6bc69e900..8c1da05de647e 100644
--- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
+++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
@@ -17,6 +17,9 @@
#include <linux/phy/phy.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
@@ -119,7 +122,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);
@@ -166,11 +169,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] 1065+ messages in thread* [PATCH 6.1 0789/1059] Bluetooth: mgmt: Fix read_index_list() buffer overflow
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (787 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0788/1059] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0790/1059] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
` (209 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 8bc08445b57ce..cc6d76b073abf 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -446,10 +446,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] 1065+ messages in thread* [PATCH 6.1 0790/1059] Bluetooth: hci_core: Take req_sync lock in hci_power_on()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (788 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0789/1059] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0791/1059] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
` (208 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 ff31509ea4728..0e5ab33d553a9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -945,7 +945,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] 1065+ messages in thread* [PATCH 6.1 0791/1059] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (789 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0790/1059] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0792/1059] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
` (207 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 7d7122c5bb43a..ec53e5f4f4bba 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1252,16 +1252,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;
}
@@ -1274,7 +1284,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] 1065+ messages in thread* [PATCH 6.1 0792/1059] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (790 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0791/1059] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0793/1059] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
` (206 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 ec53e5f4f4bba..5834be9c0ce46 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2161,9 +2161,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
@@ -2193,6 +2197,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
msecs_to_jiffies(timeout * 1000));
}
+ 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] 1065+ messages in thread* [PATCH 6.1 0793/1059] Bluetooth: SMP: Check smp_data before using SMP_DEV()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (791 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0792/1059] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0794/1059] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
` (205 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 d5c183855ae50..46a9d187fc6e1 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1770,7 +1770,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 */
@@ -1956,7 +1957,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] 1065+ messages in thread* [PATCH 6.1 0794/1059] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (792 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0793/1059] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0795/1059] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
` (204 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 5834be9c0ce46..d596adedded96 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3705,7 +3705,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 46a9d187fc6e1..4650be11c4e47 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3381,20 +3381,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] 1065+ messages in thread* [PATCH 6.1 0795/1059] Bluetooth: mgmt: Reject zero multi advertising rotation duration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (793 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0794/1059] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0796/1059] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
` (203 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 6ef701c27da48..3b1593f35f25f 100644
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -206,6 +206,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] 1065+ messages in thread* [PATCH 6.1 0796/1059] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (794 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0795/1059] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0797/1059] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
` (202 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 1d5365b14ec3c..cb85493110039 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3721,6 +3721,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);
@@ -3776,6 +3777,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)
@@ -3814,7 +3816,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] 1065+ messages in thread* [PATCH 6.1 0797/1059] Bluetooth: mgmt: Fix mesh transmission locking and lifetime
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (795 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0796/1059] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0798/1059] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
` (201 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 9e7d7ad97be9e..1bac0d11cf9e4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2090,6 +2090,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 d596adedded96..c80466d49114d 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5426,6 +5426,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 cc6d76b073abf..6a113b659fc82 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1051,6 +1051,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)
{
@@ -1063,37 +1064,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)
@@ -1107,6 +1166,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))
@@ -2206,38 +2292,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);
@@ -2275,6 +2394,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);
@@ -2318,37 +2439,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;
}
@@ -2399,7 +2563,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) ||
@@ -2421,6 +2584,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;
@@ -2432,27 +2604,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);
}
@@ -9625,7 +9797,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)
@@ -9652,6 +9825,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 4ba500c377a4c..9fdfbd6df51a8 100644
--- a/net/bluetooth/mgmt_util.c
+++ b/net/bluetooth/mgmt_util.c
@@ -366,16 +366,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(sizeof(*mesh_tx), GFP_KERNEL);
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] 1065+ messages in thread* [PATCH 6.1 0798/1059] Bluetooth: MSFT: Protect the event prefix with hdev->lock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (796 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0797/1059] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0799/1059] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
` (200 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 e79775cee65e3..18c3d3a741369 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -174,11 +174,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;
@@ -187,6 +192,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;
@@ -655,10 +662,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);
@@ -1082,12 +1091,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.
@@ -1095,23 +1107,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:
@@ -1125,6 +1135,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] 1065+ messages in thread* [PATCH 6.1 0799/1059] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (797 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0798/1059] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0800/1059] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
` (199 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 0e5ab33d553a9..d4d271db1eacd 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1993,7 +1993,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;
}
@@ -2001,7 +2004,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;
@@ -2017,7 +2024,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] 1065+ messages in thread* [PATCH 6.1 0800/1059] Bluetooth: MSFT: Free the response of the monitor commands
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (798 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0799/1059] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0801/1059] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
` (198 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 18c3d3a741369..a89d77845ddde 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -301,6 +301,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);
@@ -442,15 +446,19 @@ 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);
@@ -460,8 +468,11 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
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 */
@@ -526,7 +537,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);
@@ -578,19 +588,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] 1065+ messages in thread* [PATCH 6.1 0801/1059] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (799 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0800/1059] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0802/1059] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
` (197 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.1-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 d4d271db1eacd..0e7b06c9045fa 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1998,7 +1998,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] 1065+ messages in thread* [PATCH 6.1 0802/1059] HID: sensor-hub: Synchronize callback removal with raw events
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (800 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0801/1059] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0803/1059] HID: sensor: custom: Set owner for misc device Greg Kroah-Hartman
` (196 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.1-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 8874d368cd85f..764e0d16cec52 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] 1065+ messages in thread* [PATCH 6.1 0803/1059] HID: sensor: custom: Set owner for misc device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (801 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0802/1059] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0804/1059] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
` (195 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 452a24b2c2ed95aa246fcb3fcaf74a97a95c02a4 ]
Set .owner in the misc-device file operations so open file descriptors
keep the module loaded until their release callbacks have completed.
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 6202a1ac20a2b..23f99a76077eb 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -719,6 +719,7 @@ static __poll_t hid_sensor_custom_poll(struct file *file,
}
static const struct file_operations hid_sensor_custom_fops = {
+ .owner = THIS_MODULE,
.open = hid_sensor_custom_open,
.read = hid_sensor_custom_read,
.release = hid_sensor_custom_release,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0804/1059] HID: sensor: custom: Disable sensor before hub close on removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (802 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0803/1059] HID: sensor: custom: Set owner for misc device Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0805/1059] cxgb4: allocate the full ethtool filter location array Greg Kroah-Hartman
` (194 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.1-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 23f99a76077eb..5042a70649907 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -958,6 +958,13 @@ static int 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] 1065+ messages in thread* [PATCH 6.1 0805/1059] cxgb4: allocate the full ethtool filter location array
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (803 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0804/1059] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0806/1059] ixgbe: use new queue try_stop/try_wake macros Greg Kroah-Hartman
` (193 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Artemii Mashanov,
Potnuri Bharat Teja, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artemii Mashanov <ralerrdirsardx@gmail.com>
[ Upstream commit ad2c7240a3981fd5f0142b61ca913b02ab476ede ]
The ethtool filter location array stores nentries u32 values, but
cxgb4_init_ethtool_filters() passes nentries to kvzalloc() as a byte
count. The insertion and lookup paths allow indices below nentries,
which can address memory beyond the requested allocation.
Allocate nentries elements with kvcalloc() and the element size.
The array remains compatible with the existing kvfree() calls.
The size mismatch was found by reviewing the allocation, the array
declaration and the indexed accesses in the filter handlers.
Fixes: d915c299f1da ("cxgb4: add skeleton for ethtool n-tuple filters")
Signed-off-by: Artemii Mashanov <ralerrdirsardx@gmail.com>
Reviewed-by: Potnuri Bharat Teja <bharat@chelsio.com>
Link: https://patch.msgid.link/20261117090608.33178-1-ralerrdirsardx@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index b77897aa06c4f..64441342f01a8 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -2264,7 +2264,9 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
eth_filter->nentries = nentries;
for (i = 0; i < adap->params.nports; i++) {
- eth_filter->port[i].loc_array = kvzalloc(nentries, GFP_KERNEL);
+ eth_filter->port[i].loc_array =
+ kvcalloc(nentries, sizeof(*eth_filter->port[i].loc_array),
+ GFP_KERNEL);
if (!eth_filter->port[i].loc_array) {
ret = -ENOMEM;
goto free_eth_finfo;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0806/1059] ixgbe: use new queue try_stop/try_wake macros
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (804 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0805/1059] cxgb4: allocate the full ethtool filter location array Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0807/1059] bnxt: " Greg Kroah-Hartman
` (192 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 9ded5bc77fe5f396a58da95627695a89a427c962 ]
Convert ixgbe to use the new macros, I think a lot of people
copy the ixgbe code. The only functional change is that the
unlikely() in ixgbe_clean_tx_irq() turns into a likely()
inside the new macro and no longer includes
total_packets && netif_carrier_ok(tx_ring->netdev)
which is probably for the best, anyway.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 4f8b1a7cf754 ("net: bcm4908_enet: fix the TX ring wrap")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 38 +++++--------------
1 file changed, 10 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index acff872984d8e..694317bf48141 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -36,6 +36,7 @@
#include <net/tc_act/tc_mirred.h>
#include <net/vxlan.h>
#include <net/mpls.h>
+#include <net/netdev_queues.h>
#include <net/xdp_sock_drv.h>
#include <net/xfrm.h>
@@ -1119,6 +1120,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
unsigned int total_bytes = 0, total_packets = 0, total_ipsec = 0;
unsigned int budget = q_vector->tx.work_limit;
unsigned int i = tx_ring->next_to_clean;
+ struct netdev_queue *txq;
if (test_bit(__IXGBE_DOWN, &adapter->state))
return true;
@@ -1253,20 +1255,12 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
total_packets, total_bytes);
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
- if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) &&
- (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) {
- /* Make sure that anybody stopping the queue after this
- * sees the new next_to_clean.
- */
- smp_mb();
- if (__netif_subqueue_stopped(tx_ring->netdev,
- tx_ring->queue_index)
- && !test_bit(__IXGBE_DOWN, &adapter->state)) {
- netif_wake_subqueue(tx_ring->netdev,
- tx_ring->queue_index);
- ++tx_ring->tx_stats.restart_queue;
- }
- }
+ txq = netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
+ if (total_packets && netif_carrier_ok(tx_ring->netdev) &&
+ !__netif_txq_maybe_wake(txq, ixgbe_desc_unused(tx_ring),
+ TX_WAKE_THRESHOLD,
+ test_bit(__IXGBE_DOWN, &adapter->state)))
+ ++tx_ring->tx_stats.restart_queue;
return !!budget;
}
@@ -8271,22 +8265,10 @@ static void ixgbe_tx_olinfo_status(union ixgbe_adv_tx_desc *tx_desc,
static int __ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)
{
- netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
-
- /* Herbert's original patch had:
- * smp_mb__after_netif_stop_queue();
- * but since that doesn't exist yet, just open code it.
- */
- smp_mb();
-
- /* We need to check again in a case another CPU has just
- * made room available.
- */
- if (likely(ixgbe_desc_unused(tx_ring) < size))
+ if (!netif_subqueue_try_stop(tx_ring->netdev, tx_ring->queue_index,
+ ixgbe_desc_unused(tx_ring), size))
return -EBUSY;
- /* A reprieve! - use start_queue because it doesn't call schedule */
- netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index);
++tx_ring->tx_stats.restart_queue;
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0807/1059] bnxt: use new queue try_stop/try_wake macros
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (805 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0806/1059] ixgbe: use new queue try_stop/try_wake macros Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0808/1059] net: piggy back on the memory barrier in bql when waking queues Greg Kroah-Hartman
` (191 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael Chan, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 08a096780d9239e69909c48f4b1fcd99c860b2ef ]
Convert bnxt to use new macros rather than open code the logic.
Two differences:
(1) bnxt_tx_int() will now only issue a memory barrier if it sees
enough space on the ring to wake the queue. This should be fine,
the mb() is between the writes to the ring pointers and checking
queue state.
(2) we'll start the queue instead of waking on race, this should
be safe inside the xmit handler.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 4f8b1a7cf754 ("net: bcm4908_enet: fix the TX ring wrap")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 40 ++++-------------------
1 file changed, 7 insertions(+), 33 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 0ea54713c1d7f..7d7c2b7fccc59 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -57,6 +57,7 @@
#include <linux/hwmon-sysfs.h>
#include <net/page_pool.h>
#include <linux/align.h>
+#include <net/netdev_queues.h>
#include "bnxt_hsi.h"
#include "bnxt.h"
@@ -364,26 +365,6 @@ static void bnxt_txr_db_kick(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
txr->kick_pending = 0;
}
-static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp,
- struct bnxt_tx_ring_info *txr,
- struct netdev_queue *txq)
-{
- netif_tx_stop_queue(txq);
-
- /* netif_tx_stop_queue() must be done before checking
- * tx index in bnxt_tx_avail() below, because in
- * bnxt_tx_int(), we update tx index before checking for
- * netif_tx_queue_stopped().
- */
- smp_mb();
- if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) {
- netif_tx_wake_queue(txq);
- return false;
- }
-
- return true;
-}
-
static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct bnxt *bp = netdev_priv(dev);
@@ -425,7 +406,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (net_ratelimit() && txr->kick_pending)
netif_warn(bp, tx_err, dev,
"bnxt: ring busy w/ flush pending!\n");
- if (bnxt_txr_netif_try_stop_queue(bp, txr, txq))
+ if (!netif_txq_try_stop(txq, bnxt_tx_avail(bp, txr),
+ bp->tx_wake_thresh))
return NETDEV_TX_BUSY;
}
@@ -641,7 +623,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (netdev_xmit_more() && !tx_buf->is_push)
bnxt_txr_db_kick(bp, txr, prod);
- bnxt_txr_netif_try_stop_queue(bp, txr, txq);
+ netif_txq_try_stop(txq, bnxt_tx_avail(bp, txr),
+ bp->tx_wake_thresh);
}
return NETDEV_TX_OK;
@@ -734,17 +717,8 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
netdev_tx_completed_queue(txq, nr_pkts, tx_bytes);
txr->tx_cons = cons;
- /* Need to make the tx_cons update visible to bnxt_start_xmit()
- * before checking for netif_tx_queue_stopped(). Without the
- * memory barrier, there is a small possibility that bnxt_start_xmit()
- * will miss it and cause the queue to be stopped forever.
- */
- smp_mb();
-
- if (unlikely(netif_tx_queue_stopped(txq)) &&
- bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh &&
- READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)
- netif_tx_wake_queue(txq);
+ __netif_txq_maybe_wake(txq, bnxt_tx_avail(bp, txr), bp->tx_wake_thresh,
+ READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING);
}
static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0808/1059] net: piggy back on the memory barrier in bql when waking queues
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (806 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0807/1059] bnxt: " Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0809/1059] net: bcm4908_enet: fix the TX ring wrap Greg Kroah-Hartman
` (190 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 301f227fc860624d37ba5dae9da57dcf371268db ]
Drivers call netdev_tx_completed_queue() right before
netif_txq_maybe_wake(). If BQL is enabled netdev_tx_completed_queue()
should issue a memory barrier, so we can depend on that separating
the stop check from the consumer index update, instead of adding
another barrier in netif_txq_maybe_wake().
This matters more than the barriers on the xmit path, because
the wake condition is almost always true. So we issue the
consumer side barrier often.
Wrap netdev_tx_completed_queue() in a local helper to issue
the barrier even if BQL is disabled. Keep the same semantics
as netdev_tx_completed_queue() (barrier only if bytes != 0)
to make it clear that the barrier is conditional.
Plus since macro gets pkt/byte counts as arguments now -
we can skip waking if there were no packets completed.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 4f8b1a7cf754 ("net: bcm4908_enet: fix the TX ring wrap")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +--
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 12 +++---
include/linux/netdevice.h | 2 +-
include/net/netdev_queues.h | 39 ++++++++++++++-----
4 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7d7c2b7fccc59..fb9accf22dd4a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -714,11 +714,11 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
dev_kfree_skb_any(skb);
}
- netdev_tx_completed_queue(txq, nr_pkts, tx_bytes);
txr->tx_cons = cons;
- __netif_txq_maybe_wake(txq, bnxt_tx_avail(bp, txr), bp->tx_wake_thresh,
- READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING);
+ __netif_txq_completed_wake(txq, nr_pkts, tx_bytes,
+ bnxt_tx_avail(bp, txr), bp->tx_wake_thresh,
+ READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING);
}
static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 694317bf48141..cf579bb6f6b03 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1251,15 +1251,13 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
if (ring_is_xdp(tx_ring))
return !!budget;
- netdev_tx_completed_queue(txring_txq(tx_ring),
- total_packets, total_bytes);
-
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
txq = netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
- if (total_packets && netif_carrier_ok(tx_ring->netdev) &&
- !__netif_txq_maybe_wake(txq, ixgbe_desc_unused(tx_ring),
- TX_WAKE_THRESHOLD,
- test_bit(__IXGBE_DOWN, &adapter->state)))
+ if (!__netif_txq_completed_wake(txq, total_packets, total_bytes,
+ ixgbe_desc_unused(tx_ring),
+ TX_WAKE_THRESHOLD,
+ netif_carrier_ok(tx_ring->netdev) &&
+ test_bit(__IXGBE_DOWN, &adapter->state)))
++tx_ring->tx_stats.restart_queue;
return !!budget;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d563eb164d295..5ef240eec4458 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3522,7 +3522,7 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
* netdev_tx_sent_queue will miss the update and cause the queue to
* be stopped forever
*/
- smp_mb();
+ smp_mb(); /* NOTE: netdev_txq_completed_mb() assumes this exists */
if (unlikely(dql_avail(&dev_queue->dql) < 0))
return;
diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
index 5236d78bbdebb..b26fdb441e394 100644
--- a/include/net/netdev_queues.h
+++ b/include/net/netdev_queues.h
@@ -38,7 +38,7 @@
netif_tx_stop_queue(txq); \
/* Producer index and stop bit must be visible \
* to consumer before we recheck. \
- * Pairs with a barrier in __netif_txq_maybe_wake(). \
+ * Pairs with a barrier in __netif_txq_completed_wake(). \
*/ \
smp_mb__after_atomic(); \
\
@@ -82,10 +82,24 @@
_res; \
}) \
+/* Variant of netdev_tx_completed_queue() which guarantees smp_mb() if
+ * @bytes != 0, regardless of kernel config.
+ */
+static inline void
+netdev_txq_completed_mb(struct netdev_queue *dev_queue,
+ unsigned int pkts, unsigned int bytes)
+{
+ if (IS_ENABLED(CONFIG_BQL))
+ netdev_tx_completed_queue(dev_queue, pkts, bytes);
+ else if (bytes)
+ smp_mb();
+}
/**
- * __netif_txq_maybe_wake() - locklessly wake a Tx queue, if needed
+ * __netif_txq_completed_wake() - locklessly wake a Tx queue, if needed
* @txq: struct netdev_queue to stop/start
+ * @pkts: number of packets completed
+ * @bytes: number of bytes completed
* @get_desc: get current number of free descriptors (see requirements below!)
* @start_thrs: minimal number of descriptors to re-enable the queue
* @down_cond: down condition, predicate indicating that the queue should
@@ -94,22 +108,27 @@
* All arguments may be evaluated multiple times.
* @get_desc must be a formula or a function call, it must always
* return up-to-date information when evaluated!
+ * Reports completed pkts/bytes to BQL.
*
* Returns:
* 0 if the queue was woken up
* 1 if the queue was already enabled (or disabled but @down_cond is true)
* -1 if the queue was left unchanged (@start_thrs not reached)
*/
-#define __netif_txq_maybe_wake(txq, get_desc, start_thrs, down_cond) \
+#define __netif_txq_completed_wake(txq, pkts, bytes, \
+ get_desc, start_thrs, down_cond) \
({ \
int _res; \
\
+ /* Report to BQL and piggy back on its barrier. \
+ * Barrier makes sure that anybody stopping the queue \
+ * after this point sees the new consumer index. \
+ * Pairs with barrier in netif_txq_try_stop(). \
+ */ \
+ netdev_txq_completed_mb(txq, pkts, bytes); \
+ \
_res = -1; \
- if (likely(get_desc > start_thrs)) { \
- /* Make sure that anybody stopping the queue after \
- * this sees the new next_to_clean. \
- */ \
- smp_mb(); \
+ if (pkts && likely(get_desc > start_thrs)) { \
_res = 1; \
if (unlikely(netif_tx_queue_stopped(txq)) && \
!(down_cond)) { \
@@ -120,8 +139,8 @@
_res; \
})
-#define netif_txq_maybe_wake(txq, get_desc, start_thrs) \
- __netif_txq_maybe_wake(txq, get_desc, start_thrs, false)
+#define netif_txq_completed_wake(txq, pkts, bytes, get_desc, start_thrs) \
+ __netif_txq_completed_wake(txq, pkts, bytes, get_desc, start_thrs, false)
/* subqueue variants follow */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0809/1059] net: bcm4908_enet: fix the TX ring wrap
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (807 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0808/1059] net: piggy back on the memory barrier in bql when waking queues Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0810/1059] net: bcm4908_enet: drop a TX frame whose DMA mapping failed Greg Kroah-Hartman
` (189 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 4f8b1a7cf7548ebefae959486c3acc33799d1116 ]
start_xmit() wraps write_idx at length - 1 and sets WRAP on the
descriptor at length - 2, while poll_tx() wraps read_idx at length,
and the free descriptor count is taken from length. With read_idx at 0
and write_idx at length - 2 the count comes out as 2, the frame is
queued and write_idx wraps to 0 == read_idx: a full ring looks empty.
The following frames overwrite slots whose skbs were never unmapped
or freed, their bytes stay in BQL, and the queue stops for good with
nothing left to wake it.
On a TP-Link Archer AX6000 this stopped everything the CPU sent to the
switch under sustained TX load (about 1.3 Gbit/s through the switch's
CPU port): tx_packets froze, nothing was logged, and BQL showed about
185 KB in flight against a limit of about 10 KB.
The same mismatch also lets poll_tx() step onto slot length - 1, which
start_xmit() never fills: once per lap it completes that slot,
unmapping address 0 with length 0 and counting a packet that was never
sent. That one is from reading the code.
Use every descriptor, with WRAP on the last one, wrap both indexes at
length and keep one descriptor free, so that read_idx == write_idx can
only mean an empty ring. Stop and wake the queue with the
netdev_queues.h helpers: start_xmit() stops it when the ring is full,
also when it finds the ring full on entry, and poll_tx() wakes it once
there is room again.
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-2-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 | 56 ++++++++++++--------
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index a737b1913cf95..0ac8f866a061f 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -13,6 +13,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <net/netdev_queues.h>
#include "bcm4908_enet.h"
#include "unimac.h"
@@ -507,30 +508,34 @@ static int bcm4908_enet_stop(struct net_device *netdev)
return 0;
}
+/* One descriptor always stays unused, so read_idx == write_idx can only
+ * mean an empty ring
+ */
+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;
+
+ return free < 0 ? free + ring->length : free;
+}
+
static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
{
+ struct netdev_queue *txq = netdev_get_tx_queue(netdev, 0);
struct bcm4908_enet *enet = netdev_priv(netdev);
struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
struct bcm4908_enet_dma_ring_bd *buf_desc;
- int free_buf_descs;
u32 tmp;
/* Free transmitted skbs */
if (enet->irq_tx < 0 &&
- !(le32_to_cpu(ring->buf_desc[ring->read_idx].ctl) & DMA_CTL_STATUS_OWN))
+ !(le32_to_cpu(ring->buf_desc[READ_ONCE(ring->read_idx)].ctl) &
+ DMA_CTL_STATUS_OWN))
napi_schedule(&enet->tx_ring.napi);
- /* Don't use the last empty buf descriptor */
- if (ring->read_idx <= ring->write_idx)
- free_buf_descs = ring->read_idx - ring->write_idx + ring->length;
- else
- free_buf_descs = ring->read_idx - ring->write_idx;
- if (free_buf_descs < 2) {
- netif_stop_queue(netdev);
+ if (!netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1))
return NETDEV_TX_BUSY;
- }
/* Hardware removes OWN bit after sending data */
buf_desc = &ring->buf_desc[ring->write_idx];
@@ -551,7 +556,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
tmp |= DMA_CTL_STATUS_SOP;
tmp |= DMA_CTL_STATUS_EOP;
tmp |= DMA_CTL_STATUS_APPEND_CRC;
- if (ring->write_idx + 1 == ring->length - 1)
+ if (ring->write_idx == ring->length - 1)
tmp |= DMA_CTL_STATUS_WRAP;
buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
@@ -559,8 +564,13 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
- if (++ring->write_idx == ring->length - 1)
- ring->write_idx = 0;
+ if (ring->write_idx == ring->length - 1)
+ WRITE_ONCE(ring->write_idx, 0);
+ else
+ WRITE_ONCE(ring->write_idx, ring->write_idx + 1);
+
+ /* poll_tx() wakes the queue once there is room again */
+ netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1);
return NETDEV_TX_OK;
}
@@ -630,17 +640,19 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
{
struct bcm4908_enet_dma_ring *tx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi);
struct bcm4908_enet *enet = container_of(tx_ring, struct bcm4908_enet, tx_ring);
+ struct netdev_queue *txq = netdev_get_tx_queue(enet->netdev, 0);
struct bcm4908_enet_dma_ring_bd *buf_desc;
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
+ int read_idx = tx_ring->read_idx;
unsigned int bytes = 0;
int handled = 0;
- while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) {
- buf_desc = &tx_ring->buf_desc[tx_ring->read_idx];
+ while (handled < weight && read_idx != READ_ONCE(tx_ring->write_idx)) {
+ buf_desc = &tx_ring->buf_desc[read_idx];
if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
break;
- slot = &tx_ring->slots[tx_ring->read_idx];
+ slot = &tx_ring->slots[read_idx];
dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
dev_kfree_skb(slot->skb);
@@ -648,21 +660,23 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
handled++;
bytes += slot->len;
- if (++tx_ring->read_idx == tx_ring->length)
- tx_ring->read_idx = 0;
+ if (++read_idx == tx_ring->length)
+ read_idx = 0;
}
+ WRITE_ONCE(tx_ring->read_idx, read_idx);
enet->netdev->stats.tx_packets += handled;
enet->netdev->stats.tx_bytes += bytes;
+ /* Reports to BQL, and wakes the queue if start_xmit() stopped it */
+ netif_txq_completed_wake(txq, handled, bytes,
+ bcm4908_enet_tx_free_descs(tx_ring), 1);
+
if (handled < weight) {
napi_complete_done(napi, handled);
bcm4908_enet_dma_ring_intrs_on(enet, tx_ring);
}
- if (netif_queue_stopped(enet->netdev))
- netif_wake_queue(enet->netdev);
-
return handled;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0810/1059] net: bcm4908_enet: drop a TX frame whose DMA mapping failed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (808 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0809/1059] net: bcm4908_enet: fix the TX ring wrap Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0811/1059] net: bcm4908_enet: release the TX ring on stop Greg Kroah-Hartman
` (188 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit e1d4683fb4cb9d7f45a17c43a56ba2d26ab91ec6 ]
When dma_map_single() fails, start_xmit() returns NETDEV_TX_BUSY with
the queue still running, after it has already stored the skb in the
slot. Documentation/networking/driver.rst treats NETDEV_TX_BUSY under
normal circumstances as a hard error, and a driver that returns it must
not keep any reference to the skb. Here the stack requeues the frame
and retries it while the slot still points at it. Drop the frame
instead: free the skb, count it as dropped and return NETDEV_TX_OK.
Map the buffer before the slot is touched.
Found by reading the code.
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-3-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 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 0ac8f866a061f..04e5c919b1e84 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -526,6 +526,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
struct bcm4908_enet_dma_ring_bd *buf_desc;
+ dma_addr_t dma_addr;
u32 tmp;
/* Free transmitted skbs */
@@ -544,12 +545,17 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
return NETDEV_TX_BUSY;
}
+ dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
+ if (unlikely(dma_mapping_error(dev, dma_addr))) {
+ dev_kfree_skb_any(skb);
+ netdev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
+
slot = &ring->slots[ring->write_idx];
slot->skb = skb;
slot->len = skb->len;
- slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
- if (unlikely(dma_mapping_error(dev, slot->dma_addr)))
- return NETDEV_TX_BUSY;
+ slot->dma_addr = dma_addr;
tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
tmp |= DMA_CTL_STATUS_OWN;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0811/1059] net: bcm4908_enet: release the TX ring on stop
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (809 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0810/1059] net: bcm4908_enet: drop a TX frame whose DMA mapping failed Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0812/1059] net: broadcom: bcm4908_enet: use build_skb() Greg Kroah-Hartman
` (187 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kordian Chmielewski, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit e2785f0ff0a210158933221e86ea5bd066992870 ]
bcm4908_enet_stop() disables the TX DMA but leaves the ring as it is:
the skbs that poll_tx() has not freed yet stay mapped and are never
freed, and the descriptors the DMA has not sent yet keep
DMA_CTL_STATUS_OWN. The skbs, the socket memory they hold and their
mappings leak. The next open starts the indexes from 0 again over
those descriptors, so the DMA may send stale frames from before the
stop, and if the first descriptor still has OWN, start_xmit() stops
the queue before it enables the DMA, with nothing left to wake it.
Wait for the TX DMA channel to stop, as is already done for RX, then
unmap and free the skbs between read_idx and write_idx and leave the
ring empty, so that nothing can free them a second time. If the
channel does not stop in time, leave the skbs alone rather than free
them while the DMA may still read them. Clear the TX descriptors when
the ring is initialised. A descriptor that start_xmit() is about to
use then never carries OWN, so drop the check that stopped the queue
on one. The RX helper's timeout warning said TX; make it say RX.
Found by reading the code; I have not seen these on the hardware.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-4-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 | 55 ++++++++++++++++----
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 04e5c919b1e84..875af79bf2a0d 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -7,6 +7,7 @@
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/interrupt.h>
+#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_net.h>
@@ -303,6 +304,11 @@ static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,
enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR,
(uint32_t)ring->dma_addr);
+ /* A descriptor the stopped DMA never completed still carries OWN */
+ if (ring->is_tx)
+ memset(ring->buf_desc, 0,
+ ring->length * sizeof(*ring->buf_desc));
+
ring->read_idx = 0;
ring->write_idx = 0;
}
@@ -352,10 +358,22 @@ static void bcm4908_enet_dma_tx_ring_enable(struct bcm4908_enet *enet,
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
}
-static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
- struct bcm4908_enet_dma_ring *ring)
+static int bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
+ struct bcm4908_enet_dma_ring *ring)
{
+ u32 tmp;
+ int err;
+
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
+
+ /* Wait for the channel to stop, as for RX, before freeing buffers */
+ err = read_poll_timeout(enet_read, tmp, !(tmp & ENET_DMA_CH_CFG_ENABLE),
+ 10, 2000, false, enet,
+ ring->cfg_block + ENET_DMA_CH_CFG);
+ if (err)
+ dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n");
+
+ return err;
}
static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet,
@@ -381,7 +399,7 @@ static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet,
usleep_range(10, 30);
} while (!time_after_eq(jiffies, deadline));
- dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n");
+ dev_warn(enet->dev, "Timeout waiting for DMA RX stop\n");
}
/***
@@ -486,6 +504,25 @@ static int bcm4908_enet_open(struct net_device *netdev)
return 0;
}
+static void bcm4908_enet_tx_ring_clean(struct bcm4908_enet *enet)
+{
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
+ struct device *dev = enet->dev;
+ int i;
+
+ for (i = tx_ring->read_idx; i != tx_ring->write_idx;
+ i = i == tx_ring->length - 1 ? 0 : i + 1) {
+ struct bcm4908_enet_dma_ring_slot *slot = &tx_ring->slots[i];
+
+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
+ dev_kfree_skb_any(slot->skb);
+ }
+
+ /* Leave the ring empty, so that nothing frees these skbs again */
+ tx_ring->read_idx = 0;
+ tx_ring->write_idx = 0;
+}
+
static int bcm4908_enet_stop(struct net_device *netdev)
{
struct bcm4908_enet *enet = netdev_priv(netdev);
@@ -498,8 +535,10 @@ static int bcm4908_enet_stop(struct net_device *netdev)
napi_disable(&tx_ring->napi);
bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
- bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);
+ /* Leave the TX buffers alone if the channel may still read them */
+ if (!bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring))
+ bcm4908_enet_tx_ring_clean(enet);
bcm4908_enet_dma_uninit(enet);
free_irq(enet->irq_tx, enet);
@@ -538,13 +577,6 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
if (!netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1))
return NETDEV_TX_BUSY;
- /* Hardware removes OWN bit after sending data */
- buf_desc = &ring->buf_desc[ring->write_idx];
- if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) {
- netif_stop_queue(netdev);
- return NETDEV_TX_BUSY;
- }
-
dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_kfree_skb_any(skb);
@@ -552,6 +584,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
return NETDEV_TX_OK;
}
+ buf_desc = &ring->buf_desc[ring->write_idx];
slot = &ring->slots[ring->write_idx];
slot->skb = skb;
slot->len = skb->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0812/1059] net: broadcom: bcm4908_enet: use build_skb()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (810 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0811/1059] net: bcm4908_enet: release the TX ring on stop Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0813/1059] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
` (186 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafał Miłecki, Paolo Abeni,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <rafal@milecki.pl>
[ Upstream commit 3a1cc23a75abcd9cea585eb84846507363d58397 ]
RX code can be more efficient with the build_skb(). Allocating actual
SKB around eth packet buffer - right before passing it up - results in
a better cache usage.
Without RPS (echo 0 > rps_cpus) BCM4908 NAT masq performance "jumps"
between two speeds: ~900 Mbps and 940 Mbps (it's a 4 CPUs SoC). This
change bumps the lower speed from 905 Mb/s to 918 Mb/s (tested using
single stream iperf 2.0.5 traffic).
There are more optimizations to consider. One obvious to try is GRO
however as BCM4908 doesn't do hw csum is may actually lower performance.
Sometimes. Some early testing:
┌─────────────────────────────────┬─────────────────────┬────────────────────┐
│ │ netif_receive_skb() │ napi_gro_receive() │
├─────────────────────────────────┼─────────────────────┼────────────────────┤
│ netdev_alloc_skb() │ 905 Mb/s │ 892 Mb/s │
│ napi_alloc_frag() + build_skb() │ 918 Mb/s │ 917 Mb/s │
└─────────────────────────────────┴─────────────────────┴────────────────────┘
Another ideas:
1. napi_build_skb()
2. skb_copy_from_linear_data() for small packets
Those need proper testing first though. That can be done later.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Link: https://lore.kernel.org/r/20221025132245.22871-1-zajec5@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 1b48d619448c ("net: bcm4908_enet: unmap the buffer of a dropped RX frame")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 53 +++++++++++++-------
1 file changed, 36 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 875af79bf2a0d..4ac9a0c6e0e29 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -38,13 +38,24 @@
#define ENET_MAX_ETH_OVERHEAD (ETH_HLEN + BRCM_MAX_TAG_LEN + VLAN_HLEN + \
ETH_FCS_LEN + 4) /* 32 */
+#define ENET_RX_SKB_BUF_SIZE (NET_SKB_PAD + NET_IP_ALIGN + \
+ ETH_HLEN + BRCM_MAX_TAG_LEN + VLAN_HLEN + \
+ ENET_MTU_MAX + ETH_FCS_LEN + 4)
+#define ENET_RX_SKB_BUF_ALLOC_SIZE (SKB_DATA_ALIGN(ENET_RX_SKB_BUF_SIZE) + \
+ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
+#define ENET_RX_BUF_DMA_OFFSET (NET_SKB_PAD + NET_IP_ALIGN)
+#define ENET_RX_BUF_DMA_SIZE (ENET_RX_SKB_BUF_SIZE - ENET_RX_BUF_DMA_OFFSET)
+
struct bcm4908_enet_dma_ring_bd {
__le32 ctl;
__le32 addr;
} __packed;
struct bcm4908_enet_dma_ring_slot {
- struct sk_buff *skb;
+ union {
+ void *buf; /* RX */
+ struct sk_buff *skb; /* TX */
+ };
unsigned int len;
dma_addr_t dma_addr;
};
@@ -262,22 +273,21 @@ static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int
u32 tmp;
int err;
- slot->len = ENET_MTU_MAX + ENET_MAX_ETH_OVERHEAD;
-
- slot->skb = netdev_alloc_skb(enet->netdev, slot->len);
- if (!slot->skb)
+ slot->buf = napi_alloc_frag(ENET_RX_SKB_BUF_ALLOC_SIZE);
+ if (!slot->buf)
return -ENOMEM;
- slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE);
+ slot->dma_addr = dma_map_single(dev, slot->buf + ENET_RX_BUF_DMA_OFFSET,
+ ENET_RX_BUF_DMA_SIZE, DMA_FROM_DEVICE);
err = dma_mapping_error(dev, slot->dma_addr);
if (err) {
dev_err(dev, "Failed to map DMA buffer: %d\n", err);
- kfree_skb(slot->skb);
- slot->skb = NULL;
+ skb_free_frag(slot->buf);
+ slot->buf = NULL;
return err;
}
- tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
+ tmp = ENET_RX_BUF_DMA_SIZE << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
tmp |= DMA_CTL_STATUS_OWN;
if (idx == enet->rx_ring.length - 1)
tmp |= DMA_CTL_STATUS_WRAP;
@@ -322,11 +332,11 @@ static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
for (i = rx_ring->length - 1; i >= 0; i--) {
slot = &rx_ring->slots[i];
- if (!slot->skb)
+ if (!slot->buf)
continue;
dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE);
- kfree_skb(slot->skb);
- slot->skb = NULL;
+ skb_free_frag(slot->buf);
+ slot->buf = NULL;
}
}
@@ -624,6 +634,7 @@ static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight)
while (handled < weight) {
struct bcm4908_enet_dma_ring_bd *buf_desc;
struct bcm4908_enet_dma_ring_slot slot;
+ struct sk_buff *skb;
u32 ctl;
int len;
int err;
@@ -647,16 +658,24 @@ 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)) {
- kfree_skb(slot.skb);
+ skb_free_frag(slot.buf);
enet->netdev->stats.rx_dropped++;
break;
}
- 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 = build_skb(slot.buf, ENET_RX_SKB_BUF_ALLOC_SIZE);
+ if (unlikely(!skb)) {
+ skb_free_frag(slot.buf);
+ enet->netdev->stats.rx_dropped++;
+ break;
+ }
+ skb_reserve(skb, ENET_RX_BUF_DMA_OFFSET);
+ skb_put(skb, len - ETH_FCS_LEN);
+ skb->protocol = eth_type_trans(skb, enet->netdev);
- skb_put(slot.skb, len - ETH_FCS_LEN);
- slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev);
- netif_receive_skb(slot.skb);
+ netif_receive_skb(skb);
enet->netdev->stats.rx_packets++;
enet->netdev->stats.rx_bytes += len;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0813/1059] net: bcm4908_enet: unmap the buffer of a dropped RX frame
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (811 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0812/1059] net: broadcom: bcm4908_enet: use build_skb() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0814/1059] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
` (185 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.1-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 4ac9a0c6e0e29..f5824e72f66a0 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -658,6 +658,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] 1065+ messages in thread* [PATCH 6.1 0814/1059] net: bcm4908_enet: unmap RX buffers on stop with their mapped size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (812 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0813/1059] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0815/1059] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
` (184 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.1-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 f5824e72f66a0..f18954e63d58e 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] 1065+ messages in thread* [PATCH 6.1 0815/1059] net: bcm4908_enet: publish the buffer address before OWN
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (813 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0814/1059] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0816/1059] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
` (183 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.1-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 f18954e63d58e..610fac1244e3a 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;
}
@@ -610,6 +612,8 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
tmp |= DMA_CTL_STATUS_WRAP;
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);
@@ -644,6 +648,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] 1065+ messages in thread* [PATCH 6.1 0816/1059] net: bcm4908_enet: order the TX ring index accesses
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (814 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0815/1059] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0817/1059] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
` (182 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kordian Chmielewski, Jakub Kicinski,
Sasha Levin
6.1-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 610fac1244e3a..6675aed11319c 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -565,7 +565,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;
}
@@ -616,12 +618,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);
@@ -715,7 +719,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;
@@ -730,7 +737,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] 1065+ messages in thread* [PATCH 6.1 0817/1059] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (815 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0816/1059] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0818/1059] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
` (181 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiangwu Lai, Frank Li,
Amelie Delaunay, Vinod Koul, Sasha Levin
6.1-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-mdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
index 405c1fe2d6a3e..cd0aadd45f7ba 100644
--- a/drivers/dma/stm32-mdma.c
+++ b/drivers/dma/stm32-mdma.c
@@ -1789,6 +1789,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] 1065+ messages in thread* [PATCH 6.1 0818/1059] dmaengine: idxd: Free the minor number when cdev setup fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (816 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0817/1059] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0819/1059] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
` (180 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, SeungUk Nam, Frank Li, Vinod Koul,
Sasha Levin
6.1-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 622cc47c6a182..92f8a2d179847 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -399,6 +399,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] 1065+ messages in thread* [PATCH 6.1 0819/1059] dmaengine: rcar-dmac: Fix PM usage counter imbalance
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (817 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0818/1059] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0820/1059] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
` (179 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhang Shurong, Geert Uytterhoeven,
Frank Li, Laurent Pinchart, Wolfram Sang, Vinod Koul, Sasha Levin
6.1-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 641d689d17ff1..046920ed514e4 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] 1065+ messages in thread* [PATCH 6.1 0820/1059] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (818 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0819/1059] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0821/1059] HID: hid-sensor-custom: Convert to platform remove callback returning void Greg Kroah-Hartman
` (178 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Koichiro Den, Wolfram Sang, Frank Li,
Vinod Koul, Sasha Levin
6.1-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 046920ed514e4..84cecbb3efe53 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] 1065+ messages in thread* [PATCH 6.1 0821/1059] HID: hid-sensor-custom: Convert to platform remove callback returning void
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (819 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0820/1059] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0822/1059] HID: hid-sensor-custom: Convert comma to semicolon Greg Kroah-Hartman
` (177 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Uwe Kleine-König,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[ Upstream commit afbc301cc04f986cc54e678981bee1ca41707cf6 ]
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Stable-dep-of: ac6c19392c79 ("HID: sensor: custom: Fix state lifetime during removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 5042a70649907..63720d51f3bfa 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -944,14 +944,14 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
return ret;
}
-static int hid_sensor_custom_remove(struct platform_device *pdev)
+static void hid_sensor_custom_remove(struct platform_device *pdev)
{
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
if (sensor_inst->custom_pdev) {
platform_device_unregister(sensor_inst->custom_pdev);
- return 0;
+ return;
}
hid_sensor_custom_dev_if_remove(sensor_inst);
@@ -967,8 +967,6 @@ static int 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);
-
- return 0;
}
static const struct platform_device_id hid_sensor_custom_ids[] = {
@@ -988,7 +986,7 @@ static struct platform_driver hid_sensor_custom_platform_driver = {
.name = KBUILD_MODNAME,
},
.probe = hid_sensor_custom_probe,
- .remove = hid_sensor_custom_remove,
+ .remove_new = hid_sensor_custom_remove,
};
module_platform_driver(hid_sensor_custom_platform_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0822/1059] HID: hid-sensor-custom: Convert comma to semicolon
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (820 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0821/1059] HID: hid-sensor-custom: Convert to platform remove callback returning void Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0823/1059] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
` (176 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Chen Ni, Jiri Kosina, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <nichen@iscas.ac.cn>
[ Upstream commit d11cfda966c18d8bf4f0e3f6d82a09c0771c955a ]
Replace a comma between expression statements by a semicolon.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Stable-dep-of: ac6c19392c79 ("HID: sensor: custom: Fix state lifetime during removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 63720d51f3bfa..ec8948f5d4144 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -740,7 +740,7 @@ 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,
+ sensor_inst->custom_dev.fops = &hid_sensor_custom_fops;
ret = misc_register(&sensor_inst->custom_dev);
if (ret) {
kfifo_free(&sensor_inst->data_fifo);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0823/1059] HID: sensor: custom: Fix state lifetime during removal
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (821 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0822/1059] HID: hid-sensor-custom: Convert comma to semicolon Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0824/1059] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
` (175 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.1-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 ec8948f5d4144..4c6d890cd7a0f 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -10,6 +10,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>
@@ -36,6 +37,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);
-
}
/* luid defined in FW (e.g. ISH). Maybe used to identify sensor. */
@@ -883,8 +909,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
int ret;
int index;
- sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
- GFP_KERNEL);
+ sensor_inst = kzalloc(sizeof(*sensor_inst), GFP_KERNEL);
if (!sensor_inst)
return -ENOMEM;
@@ -894,6 +919,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);
index = get_known_custom_sensor_index(hsdev);
@@ -905,7 +931,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;
@@ -915,7 +941,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);
@@ -940,6 +966,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;
}
@@ -951,9 +979,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,
@@ -966,7 +995,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] 1065+ messages in thread* [PATCH 6.1 0824/1059] HID: sensor: custom: Serialize misc device reads
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (822 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0823/1059] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0825/1059] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
` (174 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.1-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 4c6d890cd7a0f..018ab0293d33e 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -37,6 +37,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;
@@ -919,6 +934,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] 1065+ messages in thread* [PATCH 6.1 0825/1059] HID: sensor: custom: Register enable attribute after misc device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (823 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0824/1059] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0826/1059] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
` (173 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.1-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 018ab0293d33e..791f7f42bf9f8 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -964,20 +964,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] 1065+ messages in thread* [PATCH 6.1 0826/1059] HID: sensor-hub: Remove clients before stopping hardware
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (824 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0825/1059] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0827/1059] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
` (172 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.1-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 764e0d16cec52..20ac9df3a1250 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] 1065+ messages in thread* [PATCH 6.1 0827/1059] HID: letsketch: skip string descriptors the firmware does not implement
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (825 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0826/1059] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.1 0828/1059] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
` (171 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eren Çakar, Hans de Goede,
Jiri Kosina, Sasha Levin
6.1-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 07af65ba04bdc..3691f91ffeba4 100644
--- a/drivers/hid/hid-letsketch.c
+++ b/drivers/hid/hid-letsketch.c
@@ -212,6 +212,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)
{
@@ -224,9 +230,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)
@@ -255,6 +266,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;
@@ -263,16 +276,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] 1065+ messages in thread* [PATCH 6.1 0828/1059] usb: cdns3: report endpoint reset timeout
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (826 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0827/1059] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0829/1059] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
` (170 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Peter Chen, Sasha Levin
6.1-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 c8872be1edf21..1e812bbe56e8a 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -2527,9 +2527,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] 1065+ messages in thread* [PATCH 6.1 0829/1059] Bluetooth: MSFT: Only enable the advertisement filter with monitors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (827 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.1 0828/1059] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0830/1059] ALSA: pcm: Use automatic cleanup of kfree() Greg Kroah-Hartman
` (169 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas de Gruijter,
Luiz Augusto von Dentz, Sasha Levin
6.1-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 a89d77845ddde..050c515636dcf 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -475,6 +475,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)
{
@@ -500,6 +524,8 @@ int msft_suspend_sync(struct hci_dev *hdev)
/* All monitors have been removed */
msft->suspending = false;
+ msft_update_filter_enable(hdev);
+
return 0;
}
@@ -640,6 +666,7 @@ int msft_resume_sync(struct hci_dev *hdev)
hci_dev_unlock(hdev);
reregister_monitor(hdev);
+ msft_update_filter_enable(hdev);
return 0;
}
@@ -677,11 +704,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);
}
}
@@ -713,6 +740,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);
@@ -1182,6 +1214,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;
@@ -1189,13 +1222,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;
@@ -1203,7 +1240,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;
}
void msft_req_add_set_filter_enable(struct hci_request *req, bool enable)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0830/1059] ALSA: pcm: Use automatic cleanup of kfree()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (828 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0829/1059] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0831/1059] ALSA: pcm: Use CLASS() for fdget()/fdput() Greg Kroah-Hartman
` (168 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit ae921398486419c6284d70bd8332eb7edbdb4f70 ]
There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).
A caveat is that some allocations are memdup_user() and they return an
error pointer instead of NULL. Those need special cares and the value
has to be cleared with no_free_ptr() at the allocation error path.
Other than that, the conversions are straightforward.
No functional changes, only code refactoring.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-2-tiwai@suse.de
Stable-dep-of: bedefcbb8a08 ("ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/pcm.c | 4 +-
sound/core/pcm_compat.c | 29 +++++-------
sound/core/pcm_native.c | 99 ++++++++++++++++-------------------------
3 files changed, 49 insertions(+), 83 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index adf1e80d3cd90..54f6609ba1fa7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -333,7 +333,7 @@ static const char *snd_pcm_oss_format_name(int format)
static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
struct snd_info_buffer *buffer)
{
- struct snd_pcm_info *info;
+ struct snd_pcm_info *info __free(kfree) = NULL;
int err;
if (! substream)
@@ -346,7 +346,6 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
err = snd_pcm_info(substream, info);
if (err < 0) {
snd_iprintf(buffer, "error %d\n", err);
- kfree(info);
return;
}
snd_iprintf(buffer, "card: %d\n", info->card);
@@ -360,7 +359,6 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
snd_iprintf(buffer, "subclass: %d\n", info->dev_subclass);
snd_iprintf(buffer, "subdevices_count: %d\n", info->subdevices_count);
snd_iprintf(buffer, "subdevices_avail: %d\n", info->subdevices_avail);
- kfree(info);
}
static void snd_pcm_stream_proc_info_read(struct snd_info_entry *entry,
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index dcf07ab6d3b7e..540dcab1bdc5e 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -235,7 +235,7 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
int refine,
struct snd_pcm_hw_params32 __user *data32)
{
- struct snd_pcm_hw_params *data;
+ struct snd_pcm_hw_params *data __free(kfree) = NULL;
struct snd_pcm_runtime *runtime;
int err;
@@ -248,34 +248,28 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
return -ENOMEM;
/* only fifo_size (RO from userspace) is different, so just copy all */
- if (copy_from_user(data, data32, sizeof(*data32))) {
- err = -EFAULT;
- goto error;
- }
+ if (copy_from_user(data, data32, sizeof(*data32)))
+ return -EFAULT;
if (refine) {
err = snd_pcm_hw_refine(substream, data);
if (err < 0)
- goto error;
+ return err;
err = fixup_unreferenced_params(substream, data);
} else {
err = snd_pcm_hw_params(substream, data);
}
if (err < 0)
- goto error;
+ return err;
if (copy_to_user(data32, data, sizeof(*data32)) ||
- put_user(data->fifo_size, &data32->fifo_size)) {
- err = -EFAULT;
- goto error;
- }
+ put_user(data->fifo_size, &data32->fifo_size))
+ return -EFAULT;
if (! refine) {
unsigned int new_boundary = recalculate_boundary(runtime);
if (new_boundary)
runtime->boundary = new_boundary;
}
- error:
- kfree(data);
return err;
}
@@ -338,7 +332,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
compat_caddr_t buf;
compat_caddr_t __user *bufptr;
u32 frames;
- void __user **bufs;
+ void __user **bufs __free(kfree) = NULL;
int err, ch, i;
if (! substream->runtime)
@@ -360,10 +354,8 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
return -ENOMEM;
for (i = 0; i < ch; i++) {
u32 ptr;
- if (get_user(ptr, bufptr)) {
- kfree(bufs);
+ if (get_user(ptr, bufptr))
return -EFAULT;
- }
bufs[i] = compat_ptr(ptr);
bufptr++;
}
@@ -373,9 +365,8 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
err = snd_pcm_lib_readv(substream, bufs, frames);
if (err >= 0) {
if (put_user(err, &data32->result))
- err = -EFAULT;
+ return -EFAULT;
}
- kfree(bufs);
return err;
}
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index dc81e422da026..39a5e720c768f 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -237,7 +237,7 @@ int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info)
int snd_pcm_info_user(struct snd_pcm_substream *substream,
struct snd_pcm_info __user * _info)
{
- struct snd_pcm_info *info;
+ struct snd_pcm_info *info __free(kfree) = NULL;
int err;
info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -248,7 +248,6 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
if (copy_to_user(_info, info, sizeof(*info)))
err = -EFAULT;
}
- kfree(info);
return err;
}
@@ -360,7 +359,7 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
struct snd_pcm_hw_constraints *constrs =
&substream->runtime->hw_constraints;
unsigned int k;
- unsigned int *rstamps;
+ unsigned int *rstamps __free(kfree) = NULL;
unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1];
unsigned int stamp;
struct snd_pcm_hw_rule *r;
@@ -436,10 +435,8 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
}
changed = r->func(params, r);
- if (changed < 0) {
- err = changed;
- goto out;
- }
+ if (changed < 0)
+ return changed;
/*
* When the parameter is changed, notify it to the caller
@@ -470,8 +467,6 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
if (again)
goto retry;
- out:
- kfree(rstamps);
return err;
}
@@ -555,26 +550,24 @@ EXPORT_SYMBOL(snd_pcm_hw_refine);
static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params __user * _params)
{
- struct snd_pcm_hw_params *params;
+ struct snd_pcm_hw_params *params __free(kfree) = NULL;
int err;
params = memdup_user(_params, sizeof(*params));
if (IS_ERR(params))
- return PTR_ERR(params);
+ return PTR_ERR(no_free_ptr(params));
err = snd_pcm_hw_refine(substream, params);
if (err < 0)
- goto end;
+ return err;
err = fixup_unreferenced_params(substream, params);
if (err < 0)
- goto end;
+ return err;
if (copy_to_user(_params, params, sizeof(*params)))
- err = -EFAULT;
-end:
- kfree(params);
- return err;
+ return -EFAULT;
+ return 0;
}
static int period_to_usecs(struct snd_pcm_runtime *runtime)
@@ -873,21 +866,19 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params __user * _params)
{
- struct snd_pcm_hw_params *params;
+ struct snd_pcm_hw_params *params __free(kfree) = NULL;
int err;
params = memdup_user(_params, sizeof(*params));
if (IS_ERR(params))
- return PTR_ERR(params);
+ return PTR_ERR(no_free_ptr(params));
err = snd_pcm_hw_params(substream, params);
if (err < 0)
- goto end;
+ return err;
if (copy_to_user(_params, params, sizeof(*params)))
- err = -EFAULT;
-end:
- kfree(params);
+ return -EFAULT;
return err;
}
@@ -2282,7 +2273,8 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
int res = 0;
struct snd_pcm_file *pcm_file;
struct snd_pcm_substream *substream1;
- struct snd_pcm_group *group, *target_group;
+ struct snd_pcm_group *group __free(kfree) = NULL;
+ struct snd_pcm_group *target_group;
bool nonatomic = substream->pcm->nonatomic;
struct fd f = fdget(fd);
@@ -2292,6 +2284,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
res = -EBADFD;
goto _badf;
}
+
pcm_file = f.file->private_data;
substream1 = pcm_file->substream;
@@ -2303,8 +2296,9 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
group = kzalloc(sizeof(*group), GFP_KERNEL);
if (!group) {
res = -ENOMEM;
- goto _nolock;
+ goto _badf;
}
+
snd_pcm_group_init(group);
down_write(&snd_pcm_link_rwsem);
@@ -2335,8 +2329,6 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
snd_pcm_group_unlock_irq(target_group, nonatomic);
_end:
up_write(&snd_pcm_link_rwsem);
- _nolock:
- kfree(group);
_badf:
fdput(f);
return res;
@@ -3267,7 +3259,7 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
{
struct snd_xfern xfern;
struct snd_pcm_runtime *runtime = substream->runtime;
- void *bufs;
+ void *bufs __free(kfree) = NULL;
snd_pcm_sframes_t result;
if (runtime->state == SNDRV_PCM_STATE_OPEN)
@@ -3281,12 +3273,11 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
- return PTR_ERR(bufs);
+ return PTR_ERR(no_free_ptr(bufs));
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
else
result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
- kfree(bufs);
if (put_user(result, &_xfern->result))
return -EFAULT;
return result < 0 ? result : 0;
@@ -3554,7 +3545,7 @@ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)
struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result;
unsigned long i;
- void __user **bufs;
+ void __user **bufs __free(kfree) = NULL;
snd_pcm_uframes_t frames;
pcm_file = iocb->ki_filp->private_data;
@@ -3580,7 +3571,6 @@ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)
result = snd_pcm_lib_readv(substream, bufs, frames);
if (result > 0)
result = frames_to_bytes(runtime, result);
- kfree(bufs);
return result;
}
@@ -3591,7 +3581,7 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)
struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result;
unsigned long i;
- void __user **bufs;
+ void __user **bufs __free(kfree) = NULL;
snd_pcm_uframes_t frames;
pcm_file = iocb->ki_filp->private_data;
@@ -3616,7 +3606,6 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)
result = snd_pcm_lib_writev(substream, bufs, frames);
if (result > 0)
result = frames_to_bytes(runtime, result);
- kfree(bufs);
return result;
}
@@ -4074,8 +4063,8 @@ static void snd_pcm_hw_convert_to_old_params(struct snd_pcm_hw_params_old *opara
static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params_old __user * _oparams)
{
- struct snd_pcm_hw_params *params;
- struct snd_pcm_hw_params_old *oparams = NULL;
+ struct snd_pcm_hw_params *params __free(kfree) = NULL;
+ struct snd_pcm_hw_params_old *oparams __free(kfree) = NULL;
int err;
params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -4083,34 +4072,28 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
return -ENOMEM;
oparams = memdup_user(_oparams, sizeof(*oparams));
- if (IS_ERR(oparams)) {
- err = PTR_ERR(oparams);
- goto out;
- }
+ if (IS_ERR(oparams))
+ return PTR_ERR(no_free_ptr(oparams));
snd_pcm_hw_convert_from_old_params(params, oparams);
err = snd_pcm_hw_refine(substream, params);
if (err < 0)
- goto out_old;
+ return err;
err = fixup_unreferenced_params(substream, params);
if (err < 0)
- goto out_old;
+ return err;
snd_pcm_hw_convert_to_old_params(oparams, params);
if (copy_to_user(_oparams, oparams, sizeof(*oparams)))
- err = -EFAULT;
-out_old:
- kfree(oparams);
-out:
- kfree(params);
- return err;
+ return -EFAULT;
+ return 0;
}
static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params_old __user * _oparams)
{
- struct snd_pcm_hw_params *params;
- struct snd_pcm_hw_params_old *oparams = NULL;
+ struct snd_pcm_hw_params *params __free(kfree) = NULL;
+ struct snd_pcm_hw_params_old *oparams __free(kfree) = NULL;
int err;
params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -4118,24 +4101,18 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
return -ENOMEM;
oparams = memdup_user(_oparams, sizeof(*oparams));
- if (IS_ERR(oparams)) {
- err = PTR_ERR(oparams);
- goto out;
- }
+ if (IS_ERR(oparams))
+ return PTR_ERR(no_free_ptr(oparams));
snd_pcm_hw_convert_from_old_params(params, oparams);
err = snd_pcm_hw_params(substream, params);
if (err < 0)
- goto out_old;
+ return err;
snd_pcm_hw_convert_to_old_params(oparams, params);
if (copy_to_user(_oparams, oparams, sizeof(*oparams)))
- err = -EFAULT;
-out_old:
- kfree(oparams);
-out:
- kfree(params);
- return err;
+ return -EFAULT;
+ return 0;
}
#endif /* CONFIG_SND_SUPPORT_OLD_API */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0831/1059] ALSA: pcm: Use CLASS() for fdget()/fdput()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (829 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0830/1059] ALSA: pcm: Use automatic cleanup of kfree() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0832/1059] ALSA: pcm: Use guard() for locking Greg Kroah-Hartman
` (167 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit d90950c6a2658ed8cffb4255a5ddba9c831389fe ]
Now we have a nice definition of CLASS(fd) that can be applied as a
clean up for the fdget/fdput pairs in snd_pcm_link().
No functional changes, only code refactoring.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240223084241.3361-2-tiwai@suse.de
Stable-dep-of: bedefcbb8a08 ("ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/pcm_native.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 39a5e720c768f..e12f910c6e519 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2276,28 +2276,22 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
struct snd_pcm_group *group __free(kfree) = NULL;
struct snd_pcm_group *target_group;
bool nonatomic = substream->pcm->nonatomic;
- struct fd f = fdget(fd);
+ CLASS(fd, f)(fd);
if (!f.file)
return -EBADFD;
- if (!is_pcm_file(f.file)) {
- res = -EBADFD;
- goto _badf;
- }
+ if (!is_pcm_file(f.file))
+ return -EBADFD;
pcm_file = f.file->private_data;
substream1 = pcm_file->substream;
- if (substream == substream1) {
- res = -EINVAL;
- goto _badf;
- }
+ if (substream == substream1)
+ return -EINVAL;
group = kzalloc(sizeof(*group), GFP_KERNEL);
- if (!group) {
- res = -ENOMEM;
- goto _badf;
- }
+ if (!group)
+ return -ENOMEM;
snd_pcm_group_init(group);
@@ -2329,8 +2323,6 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
snd_pcm_group_unlock_irq(target_group, nonatomic);
_end:
up_write(&snd_pcm_link_rwsem);
- _badf:
- fdput(f);
return res;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0832/1059] ALSA: pcm: Use guard() for locking
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (830 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0831/1059] ALSA: pcm: Use CLASS() for fdget()/fdput() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0833/1059] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic() Greg Kroah-Hartman
` (166 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit dd0da75b9a2768710366a599c9bd70058e67e2ea ]
We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.
Only the code refactoring, and no functional changes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-22-tiwai@suse.de
Stable-dep-of: bedefcbb8a08 ("ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/pcm.c | 90 ++++++++++++++---------------------------
sound/core/pcm_memory.c | 30 ++++++--------
sound/core/pcm_native.c | 48 ++++++++--------------
3 files changed, 59 insertions(+), 109 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 54f6609ba1fa7..b9b08901c3fe8 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -91,9 +91,8 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
if (get_user(device, (int __user *)arg))
return -EFAULT;
- mutex_lock(®ister_mutex);
- device = snd_pcm_next(card, device);
- mutex_unlock(®ister_mutex);
+ scoped_guard(mutex, ®ister_mutex)
+ device = snd_pcm_next(card, device);
if (put_user(device, (int __user *)arg))
return -EFAULT;
return 0;
@@ -106,7 +105,6 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
struct snd_pcm *pcm;
struct snd_pcm_str *pstr;
struct snd_pcm_substream *substream;
- int err;
info = (struct snd_pcm_info __user *)arg;
if (get_user(device, &info->device))
@@ -118,35 +116,23 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
stream = array_index_nospec(stream, 2);
if (get_user(subdevice, &info->subdevice))
return -EFAULT;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
pcm = snd_pcm_get(card, device);
- if (pcm == NULL) {
- err = -ENXIO;
- goto _error;
- }
+ if (pcm == NULL)
+ return -ENXIO;
pstr = &pcm->streams[stream];
- if (pstr->substream_count == 0) {
- err = -ENOENT;
- goto _error;
- }
- if (subdevice >= pstr->substream_count) {
- err = -ENXIO;
- goto _error;
- }
+ if (pstr->substream_count == 0)
+ return -ENOENT;
+ if (subdevice >= pstr->substream_count)
+ return -ENXIO;
for (substream = pstr->substream; substream;
substream = substream->next)
if (substream->number == (int)subdevice)
break;
- if (substream == NULL) {
- err = -ENXIO;
- goto _error;
- }
- mutex_lock(&pcm->open_mutex);
- err = snd_pcm_info_user(substream, info);
- mutex_unlock(&pcm->open_mutex);
- _error:
- mutex_unlock(®ister_mutex);
- return err;
+ if (substream == NULL)
+ return -ENXIO;
+ guard(mutex)(&pcm->open_mutex);
+ return snd_pcm_info_user(substream, info);
}
case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE:
{
@@ -380,15 +366,15 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
struct snd_pcm_substream *substream = entry->private_data;
struct snd_pcm_runtime *runtime;
- mutex_lock(&substream->pcm->open_mutex);
+ guard(mutex)(&substream->pcm->open_mutex);
runtime = substream->runtime;
if (!runtime) {
snd_iprintf(buffer, "closed\n");
- goto unlock;
+ return;
}
if (runtime->state == SNDRV_PCM_STATE_OPEN) {
snd_iprintf(buffer, "no setup\n");
- goto unlock;
+ return;
}
snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access));
snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format));
@@ -407,8 +393,6 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames);
}
#endif
- unlock:
- mutex_unlock(&substream->pcm->open_mutex);
}
static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
@@ -417,15 +401,15 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
struct snd_pcm_substream *substream = entry->private_data;
struct snd_pcm_runtime *runtime;
- mutex_lock(&substream->pcm->open_mutex);
+ guard(mutex)(&substream->pcm->open_mutex);
runtime = substream->runtime;
if (!runtime) {
snd_iprintf(buffer, "closed\n");
- goto unlock;
+ return;
}
if (runtime->state == SNDRV_PCM_STATE_OPEN) {
snd_iprintf(buffer, "no setup\n");
- goto unlock;
+ return;
}
snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode));
snd_iprintf(buffer, "period_step: %u\n", runtime->period_step);
@@ -435,8 +419,6 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold);
snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size);
snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary);
- unlock:
- mutex_unlock(&substream->pcm->open_mutex);
}
static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
@@ -447,17 +429,17 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
struct snd_pcm_status64 status;
int err;
- mutex_lock(&substream->pcm->open_mutex);
+ guard(mutex)(&substream->pcm->open_mutex);
runtime = substream->runtime;
if (!runtime) {
snd_iprintf(buffer, "closed\n");
- goto unlock;
+ return;
}
memset(&status, 0, sizeof(status));
err = snd_pcm_status64(substream, &status);
if (err < 0) {
snd_iprintf(buffer, "error %d\n", err);
- goto unlock;
+ return;
}
snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state));
snd_iprintf(buffer, "owner_pid : %d\n", pid_vnr(substream->pid));
@@ -471,8 +453,6 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "-----\n");
snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr);
snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
- unlock:
- mutex_unlock(&substream->pcm->open_mutex);
}
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
@@ -1004,9 +984,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
kfree(runtime->hw_constraints.rules);
/* Avoid concurrent access to runtime via PCM timer interface */
if (substream->timer) {
- spin_lock_irq(&substream->timer->lock);
- substream->runtime = NULL;
- spin_unlock_irq(&substream->timer->lock);
+ scoped_guard(spinlock_irq, &substream->timer->lock)
+ substream->runtime = NULL;
} else {
substream->runtime = NULL;
}
@@ -1063,10 +1042,10 @@ static int snd_pcm_dev_register(struct snd_device *device)
return -ENXIO;
pcm = device->device_data;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
err = snd_pcm_add(pcm);
if (err)
- goto unlock;
+ return err;
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
if (pcm->streams[cidx].substream == NULL)
@@ -1085,7 +1064,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
&pcm->streams[cidx].dev);
if (err < 0) {
list_del_init(&pcm->list);
- goto unlock;
+ return err;
}
for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
@@ -1093,9 +1072,6 @@ static int snd_pcm_dev_register(struct snd_device *device)
}
pcm_call_notify(pcm, n_register);
-
- unlock:
- mutex_unlock(®ister_mutex);
return err;
}
@@ -1105,8 +1081,8 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
struct snd_pcm_substream *substream;
int cidx;
- mutex_lock(®ister_mutex);
- mutex_lock(&pcm->open_mutex);
+ guard(mutex)(®ister_mutex);
+ guard(mutex)(&pcm->open_mutex);
wake_up(&pcm->open_wait);
list_del_init(&pcm->list);
@@ -1132,8 +1108,6 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
snd_unregister_device(&pcm->streams[cidx].dev);
free_chmap(&pcm->streams[cidx]);
}
- mutex_unlock(&pcm->open_mutex);
- mutex_unlock(®ister_mutex);
return 0;
}
@@ -1158,7 +1132,7 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
!notify->n_unregister ||
!notify->n_disconnect))
return -EINVAL;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
if (nfree) {
list_del(¬ify->list);
list_for_each_entry(pcm, &snd_pcm_devices, list)
@@ -1168,7 +1142,6 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
list_for_each_entry(pcm, &snd_pcm_devices, list)
notify->n_register(pcm);
}
- mutex_unlock(®ister_mutex);
return 0;
}
EXPORT_SYMBOL(snd_pcm_notify);
@@ -1184,7 +1157,7 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry,
{
struct snd_pcm *pcm;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
list_for_each_entry(pcm, &snd_pcm_devices, list) {
snd_iprintf(buffer, "%02i-%02i: %s : %s",
pcm->card->number, pcm->device, pcm->id, pcm->name);
@@ -1196,7 +1169,6 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry,
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
snd_iprintf(buffer, "\n");
}
- mutex_unlock(®ister_mutex);
}
static struct snd_info_entry *snd_pcm_proc_entry;
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index a0b9514716995..506386959f084 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -38,17 +38,15 @@ static void __update_allocated_size(struct snd_card *card, ssize_t bytes)
static void update_allocated_size(struct snd_card *card, ssize_t bytes)
{
- mutex_lock(&card->memory_mutex);
+ guard(mutex)(&card->memory_mutex);
__update_allocated_size(card, bytes);
- mutex_unlock(&card->memory_mutex);
}
static void decrease_allocated_size(struct snd_card *card, size_t bytes)
{
- mutex_lock(&card->memory_mutex);
+ guard(mutex)(&card->memory_mutex);
WARN_ON(card->total_pcm_alloc_bytes < bytes);
__update_allocated_size(card, -(ssize_t)bytes);
- mutex_unlock(&card->memory_mutex);
}
static int do_alloc_pages(struct snd_card *card, int type, struct device *dev,
@@ -58,14 +56,12 @@ static int do_alloc_pages(struct snd_card *card, int type, struct device *dev,
int err;
/* check and reserve the requested size */
- mutex_lock(&card->memory_mutex);
- if (max_alloc_per_card &&
- card->total_pcm_alloc_bytes + size > max_alloc_per_card) {
- mutex_unlock(&card->memory_mutex);
- return -ENOMEM;
+ scoped_guard(mutex, &card->memory_mutex) {
+ if (max_alloc_per_card &&
+ card->total_pcm_alloc_bytes + size > max_alloc_per_card)
+ return -ENOMEM;
+ __update_allocated_size(card, size);
}
- __update_allocated_size(card, size);
- mutex_unlock(&card->memory_mutex);
if (str == SNDRV_PCM_STREAM_PLAYBACK)
dir = DMA_TO_DEVICE;
@@ -191,20 +187,20 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
size_t size;
struct snd_dma_buffer new_dmab;
- mutex_lock(&substream->pcm->open_mutex);
+ guard(mutex)(&substream->pcm->open_mutex);
if (substream->runtime) {
buffer->error = -EBUSY;
- goto unlock;
+ return;
}
if (!snd_info_get_line(buffer, line, sizeof(line))) {
snd_info_get_str(str, line, sizeof(str));
size = simple_strtoul(str, NULL, 10) * 1024;
if ((size != 0 && size < 8192) || size > substream->dma_max) {
buffer->error = -EINVAL;
- goto unlock;
+ return;
}
if (substream->dma_buffer.bytes == size)
- goto unlock;
+ return;
memset(&new_dmab, 0, sizeof(new_dmab));
new_dmab.dev = substream->dma_buffer.dev;
if (size > 0) {
@@ -218,7 +214,7 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
substream->pcm->card->number, substream->pcm->device,
substream->stream ? 'c' : 'p', substream->number,
substream->pcm->name, size);
- goto unlock;
+ return;
}
substream->buffer_bytes_max = size;
} else {
@@ -230,8 +226,6 @@ static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
} else {
buffer->error = -EINVAL;
}
- unlock:
- mutex_unlock(&substream->pcm->open_mutex);
}
static inline void preallocate_info_init(struct snd_pcm_substream *substream)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index e12f910c6e519..31a6f2940454a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1407,17 +1407,15 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops,
int res;
/* Guarantee the group members won't change during non-atomic action */
- down_read(&snd_pcm_link_rwsem);
+ guard(rwsem_read)(&snd_pcm_link_rwsem);
res = snd_pcm_buffer_access_lock(substream->runtime);
if (res < 0)
- goto unlock;
+ return res;
if (snd_pcm_stream_linked(substream))
res = snd_pcm_action_group(ops, substream, state, false);
else
res = snd_pcm_action_single(ops, substream, state);
snd_pcm_buffer_access_unlock(substream->runtime);
- unlock:
- up_read(&snd_pcm_link_rwsem);
return res;
}
@@ -2270,7 +2268,6 @@ static bool is_pcm_file(struct file *file)
*/
static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
{
- int res = 0;
struct snd_pcm_file *pcm_file;
struct snd_pcm_substream *substream1;
struct snd_pcm_group *group __free(kfree) = NULL;
@@ -2292,20 +2289,15 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
group = kzalloc(sizeof(*group), GFP_KERNEL);
if (!group)
return -ENOMEM;
-
snd_pcm_group_init(group);
- down_write(&snd_pcm_link_rwsem);
+ guard(rwsem_write)(&snd_pcm_link_rwsem);
if (substream->runtime->state == SNDRV_PCM_STATE_OPEN ||
substream->runtime->state != substream1->runtime->state ||
- substream->pcm->nonatomic != substream1->pcm->nonatomic) {
- res = -EBADFD;
- goto _end;
- }
- if (snd_pcm_stream_linked(substream1)) {
- res = -EALREADY;
- goto _end;
- }
+ substream->pcm->nonatomic != substream1->pcm->nonatomic)
+ return -EBADFD;
+ if (snd_pcm_stream_linked(substream1))
+ return -EALREADY;
snd_pcm_stream_lock_irq(substream);
if (!snd_pcm_stream_linked(substream)) {
@@ -2321,9 +2313,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
refcount_inc(&target_group->refs);
snd_pcm_stream_unlock(substream1);
snd_pcm_group_unlock_irq(target_group, nonatomic);
- _end:
- up_write(&snd_pcm_link_rwsem);
- return res;
+ return 0;
}
static void relink_to_local(struct snd_pcm_substream *substream)
@@ -2339,14 +2329,11 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream)
struct snd_pcm_group *group;
bool nonatomic = substream->pcm->nonatomic;
bool do_free = false;
- int res = 0;
- down_write(&snd_pcm_link_rwsem);
+ guard(rwsem_write)(&snd_pcm_link_rwsem);
- if (!snd_pcm_stream_linked(substream)) {
- res = -EALREADY;
- goto _end;
- }
+ if (!snd_pcm_stream_linked(substream))
+ return -EALREADY;
group = substream->group;
snd_pcm_group_lock_irq(group, nonatomic);
@@ -2371,10 +2358,7 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream)
snd_pcm_group_unlock_irq(group, nonatomic);
if (do_free)
kfree(group);
-
- _end:
- up_write(&snd_pcm_link_rwsem);
- return res;
+ return 0;
}
/*
@@ -2907,10 +2891,10 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
/* block until the device gets woken up as it may touch the hardware */
snd_power_wait(pcm->card);
- mutex_lock(&pcm->open_mutex);
- snd_pcm_release_substream(substream);
- kfree(pcm_file);
- mutex_unlock(&pcm->open_mutex);
+ scoped_guard(mutex, &pcm->open_mutex) {
+ snd_pcm_release_substream(substream);
+ kfree(pcm_file);
+ }
wake_up(&pcm->open_wait);
module_put(pcm->card->module);
snd_card_file_remove(pcm->card, file);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0833/1059] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (831 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0832/1059] ALSA: pcm: Use guard() for locking Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0834/1059] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check Greg Kroah-Hartman
` (165 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, sashiko-bot, Takashi Iwai,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit bedefcbb8a0827e2758d6fc4a0601756eba7c248 ]
snd_pcm_action_nonatomic() is called for PCM PREPARE and other
operations, and the function takes snd_pcm_buffer_access_lock() of the
given substream (that takes runtime->buffer_mutex internally) at
first, followed by the call of snd_pcm_action_group() that takes
buffer_mutex of other substreams in the same link group again.
Recently Sashiko suggested it may lead to an ABBA deadlock when two
different substreams in the same PCM link call it concurrently:
CPU0 CPU1
---- ----
lock(&A->runtime->buffer_mutex)
lock(&B->runtime->buffer_mutex)
lock(&B->runtime->buffer_mutex)
lock(&A->runtime->buffer_mutex)
This patch tries to address the potential deadlock. Instead of taking
the buffer_mutex of the target substream at first and processing the
rest in the loop, take the whole buffer_mutex for each in the loop.
This assures the order of the nested mutexes -- the linked list itself
is kept intact by the read_rwsem() around snd_pcm_action_nonatomic().
Also, this changes the action in the snd_pcm_action_group() loop from
the direct call of mutex_lock(buffer_mutex) to
snd_pcm_buffer_access_lock(). This prevents the unexpected state
transition or the buffer access during the action, too.
Since the target substream is no longer locked before the loop, the
lockdep subclass for buffer_mutex in the loop now starts from 0, so
that a link group of N substreams uses the subclasses 0..N-1 as
before. The subclass for the stream lock case still starts from 1,
as the caller holds the target stream lock at subclass 0.
Note that this change might have a slight side-effect, though: when
some concurrent operations happen during the PREPARE or RESET, now it
may return -EBUSY. But this can be seen rather as an expected
behavior that was overlooked before the fix.
Fixes: 3c3201f8c7bb ("ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/sashiko-outbox-221145@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261119122356.2134523-2-tiwai@suse.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/pcm_native.c | 63 +++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 22 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 31a6f2940454a..cc4b564f89a76 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -682,14 +682,20 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise
* block the further r/w operations
*/
-static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
+static int __snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime,
+ int depth)
{
if (!atomic_dec_unless_positive(&runtime->buffer_accessing))
return -EBUSY;
- mutex_lock(&runtime->buffer_mutex);
+ mutex_lock_nested(&runtime->buffer_mutex, depth);
return 0; /* keep buffer_mutex, unlocked by below */
}
+static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
+{
+ return __snd_pcm_buffer_access_lock(runtime, 0);
+}
+
/* release buffer_mutex and clear r/w access flag */
static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime)
{
@@ -1225,26 +1231,38 @@ struct action_ops {
* this functions is core for handling of linked stream
* Note: the stream state might be changed also on failure
* Note2: call with calling stream lock + link lock
+ *
+ * Locking:
+ * When @stream_lock is false, it takes buffer-access lock for all substreams.
+ * OTOH, when @stream_lock is true, takes substream lock except for the
+ * target substream (that should have taken its lock before calling this).
*/
static int snd_pcm_action_group(const struct action_ops *ops,
struct snd_pcm_substream *substream,
snd_pcm_state_t state,
bool stream_lock)
{
- struct snd_pcm_substream *s = NULL;
- struct snd_pcm_substream *s1;
- int res = 0, depth = 1;
+ struct snd_pcm_substream *s, *s1, *last;
+ int res = 0, depth;
+ /* the caller already holds the target stream lock at depth 0 */
+ depth = stream_lock ? 1 : 0;
+
+ last = NULL;
snd_pcm_group_for_each_entry(s, substream) {
- if (s != substream) {
- if (!stream_lock)
- mutex_lock_nested(&s->runtime->buffer_mutex, depth);
- else if (s->pcm->nonatomic)
+ if (!stream_lock) {
+ res = __snd_pcm_buffer_access_lock(s->runtime, depth);
+ if (res < 0)
+ goto _unlock;
+ depth++;
+ } else if (s != substream) {
+ if (s->pcm->nonatomic)
mutex_lock_nested(&s->self_group.mutex, depth);
else
spin_lock_nested(&s->self_group.lock, depth);
depth++;
}
+ last = s;
res = ops->pre_action(s, state);
if (res < 0)
goto _unlock;
@@ -1259,7 +1277,6 @@ static int snd_pcm_action_group(const struct action_ops *ops,
ops->undo_action(s1, state);
}
}
- s = NULL; /* unlock all */
goto _unlock;
}
}
@@ -1267,17 +1284,19 @@ static int snd_pcm_action_group(const struct action_ops *ops,
ops->post_action(s, state);
}
_unlock:
+ if (!last)
+ return res;
/* unlock streams */
- snd_pcm_group_for_each_entry(s1, substream) {
- if (s1 != substream) {
- if (!stream_lock)
- mutex_unlock(&s1->runtime->buffer_mutex);
- else if (s1->pcm->nonatomic)
- mutex_unlock(&s1->self_group.mutex);
+ snd_pcm_group_for_each_entry(s, substream) {
+ if (!stream_lock) {
+ snd_pcm_buffer_access_unlock(s->runtime);
+ } else if (s != substream) {
+ if (s->pcm->nonatomic)
+ mutex_unlock(&s->self_group.mutex);
else
- spin_unlock(&s1->self_group.lock);
+ spin_unlock(&s->self_group.lock);
}
- if (s1 == s) /* end */
+ if (s == last) /* end */
break;
}
return res;
@@ -1408,13 +1427,13 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops,
/* Guarantee the group members won't change during non-atomic action */
guard(rwsem_read)(&snd_pcm_link_rwsem);
+ if (snd_pcm_stream_linked(substream))
+ return snd_pcm_action_group(ops, substream, state, false);
+
res = snd_pcm_buffer_access_lock(substream->runtime);
if (res < 0)
return res;
- if (snd_pcm_stream_linked(substream))
- res = snd_pcm_action_group(ops, substream, state, false);
- else
- res = snd_pcm_action_single(ops, substream, state);
+ res = snd_pcm_action_single(ops, substream, state);
snd_pcm_buffer_access_unlock(substream->runtime);
return res;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0834/1059] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (832 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0833/1059] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0835/1059] net: sfp: add support for setting signalling rate Greg Kroah-Hartman
` (164 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Paul Moore,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit 18a7abf1a0b168ea6a50f08562de2f286d6f5a86 ]
Issue found by sashiko when reviewing my data-races patch [1]. This is
not a plain READ_ONCE() annotation like the rest of that series but a
real fix, so it is sent separately.
calipso_cache_add() reads calipso_cache_bucketsize twice: the "<= 0"
guard on entry, then the "size < bucketsize" test after taking the
bucket lock. A writer can flip it to 0 in between:
CPU0 CPU1
calipso_cache_add()
calipso_cache_bucketsize == 10 (> 0)
proc_dointvec()
calipso_cache_bucketsize = 0
spin_lock_bh(&bucket.lock)
size(0) < calipso_cache_bucketsize(0) -> false
-> else branch, but the bucket is empty
On an empty bucket the else branch takes list.prev (the list head
itself), list_del()s it and then list_add()s through the now poisoned
head:
Oops: general protection fault, probably for non-canonical address
0xdead000000000108
RIP: 0010:calipso_cache_add+0x2f0/0x380
Call Trace:
<IRQ>
calipso_cache_add+0x4c/0x70
netlbl_cache_add+0x4a/0xa0
selinux_netlbl_skbuff_getsid+0x1ac/0x280
selinux_skb_peerlbl_sid+0x7d/0x100
selinux_socket_sock_rcv_skb+0x2d3/0x460
security_sock_rcv_skb+0x86/0x150
sk_filter_trim_cap+0x56/0x730
sock_queue_rcv_skb_reason+0x1e/0x80
rawv6_rcv+0x679/0xb20
raw6_local_deliver+0x1f0/0x5b0
ip6_protocol_deliver_rcu+0x215/0x9a0
ip6_input_finish+0xb0/0x1b0
ip6_input+0xa8/0x250
ipv6_rcv+0x14b/0x1c0
__netif_receive_skb_one_core+0x8f/0xe0
__netif_receive_skb+0x23/0xb0
process_backlog+0x27a/0x950
__napi_poll.constprop.0+0x61/0x2c0
net_rx_action+0x372/0x800
handle_softirqs+0x109/0x570
__do_softirq+0x10/0x18
do_softirq.part.0+0x47/0xd0
</IRQ>
<TASK>
__local_bh_enable_ip+0xf0/0x120
__dev_queue_xmit+0x578/0x23f0
neigh_resolve_output+0x278/0x3c0
ip6_finish_output2+0x4b1/0xcb0
ip6_finish_output+0x2b6/0x6b0
ip6_output+0x122/0x400
ip6_local_out+0x61/0xb0
ip6_send_skb+0xa0/0x260
ip6_push_pending_frames+0x2b/0x40
rawv6_sendmsg+0x1b7a/0x2750
inet_sendmsg+0xa1/0xb0
__sys_sendto+0x2fe/0x350
__x64_sys_sendto+0x7f/0xb0
do_syscall_64+0xe1/0x450
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Snapshot the sysctl into a local once and use it for both tests, like
cipso_v4_cache_add() has since commit dd44f04b9214 ("cipso: Fix
data-races around sysctl.").
[1] https://lore.kernel.org/netdev/179428999963.994134.16904544500890053668@kernel.org/
Fixes: 4fee5242bf41 ("calipso: Add a label cache.")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/20261115144508.71543-1-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/calipso.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index e7e85c2c1293e..ada606410d221 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -264,13 +264,14 @@ static int calipso_cache_check(const unsigned char *key,
static int calipso_cache_add(const unsigned char *calipso_ptr,
const struct netlbl_lsm_secattr *secattr)
{
+ int bkt_size = READ_ONCE(calipso_cache_bucketsize);
int ret_val = -EPERM;
u32 bkt;
struct calipso_map_cache_entry *entry = NULL;
struct calipso_map_cache_entry *old_entry = NULL;
u32 calipso_ptr_len;
- if (!calipso_cache_enabled || calipso_cache_bucketsize <= 0)
+ if (!calipso_cache_enabled || bkt_size <= 0)
return 0;
calipso_ptr_len = calipso_ptr[1];
@@ -290,7 +291,7 @@ static int calipso_cache_add(const unsigned char *calipso_ptr,
bkt = entry->hash & (CALIPSO_CACHE_BUCKETS - 1);
spin_lock_bh(&calipso_cache[bkt].lock);
- if (calipso_cache[bkt].size < calipso_cache_bucketsize) {
+ if (calipso_cache[bkt].size < bkt_size) {
list_add(&entry->list, &calipso_cache[bkt].list);
calipso_cache[bkt].size += 1;
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0835/1059] net: sfp: add support for setting signalling rate
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (833 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0834/1059] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0836/1059] net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up() Greg Kroah-Hartman
` (163 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Simon Horman, Russell King (Oracle),
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[ Upstream commit dc18582211b34bce8250ddf3cac2a2230e192120 ]
Add support to the SFP layer to allow phylink to set the signalling
rate for a SFP module. The rate given will be in units of kilo-baud
(1000 baud).
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: fdb6fcabdbb8 ("net: marvell: prestera: disable port before changing its MAC mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/phylink.c | 24 ++++++++++++++++++++++++
drivers/net/phy/sfp-bus.c | 20 ++++++++++++++++++++
drivers/net/phy/sfp.c | 5 +++++
drivers/net/phy/sfp.h | 1 +
include/linux/sfp.h | 6 ++++++
5 files changed, 56 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 8109a049a74e4..d1463f9cbd711 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -156,6 +156,23 @@ static const char *phylink_an_mode_str(unsigned int mode)
return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
}
+static unsigned int phylink_interface_signal_rate(phy_interface_t interface)
+{
+ switch (interface) {
+ case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_1000BASEX: /* 1.25Mbd */
+ return 1250;
+ case PHY_INTERFACE_MODE_2500BASEX: /* 3.125Mbd */
+ return 3125;
+ case PHY_INTERFACE_MODE_5GBASER: /* 5.15625Mbd */
+ return 5156;
+ case PHY_INTERFACE_MODE_10GBASER: /* 10.3125Mbd */
+ return 10313;
+ default:
+ return 0;
+ }
+}
+
/**
* phylink_interface_max_speed() - get the maximum speed of a phy interface
* @interface: phy interface mode defined by &typedef phy_interface_t
@@ -992,6 +1009,7 @@ static void phylink_major_config(struct phylink *pl, bool restart,
{
struct phylink_pcs *pcs = NULL;
bool pcs_changed = false;
+ unsigned int rate_kbd;
int err;
phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
@@ -1051,6 +1069,12 @@ static void phylink_major_config(struct phylink *pl, bool restart,
ERR_PTR(err));
}
+ if (pl->sfp_bus) {
+ rate_kbd = phylink_interface_signal_rate(state->interface);
+ if (rate_kbd)
+ sfp_upstream_set_signal_rate(pl->sfp_bus, rate_kbd);
+ }
+
phylink_pcs_poll_start(pl);
}
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index 1865e3dbdfad0..c4363500e0971 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -585,6 +585,26 @@ static void sfp_upstream_clear(struct sfp_bus *bus)
bus->upstream = NULL;
}
+/**
+ * sfp_upstream_set_signal_rate() - set data signalling rate
+ * @bus: a pointer to the &struct sfp_bus structure for the sfp module
+ * @rate_kbd: signalling rate in units of 1000 baud
+ *
+ * Configure the rate select settings on the SFP module for the signalling
+ * rate (not the same as the data rate).
+ *
+ * Locks that may be held:
+ * Phylink's state_mutex
+ * rtnl lock
+ * SFP's sm_mutex
+ */
+void sfp_upstream_set_signal_rate(struct sfp_bus *bus, unsigned int rate_kbd)
+{
+ if (bus->registered)
+ bus->socket_ops->set_signal_rate(bus->sfp, rate_kbd);
+}
+EXPORT_SYMBOL_GPL(sfp_upstream_set_signal_rate);
+
/**
* sfp_bus_find_fwnode() - parse and locate the SFP bus from fwnode
* @fwnode: firmware node for the parent device (MAC or PHY)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 907d4005a1cf5..7f1d751b87b35 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2472,6 +2472,10 @@ static void sfp_stop(struct sfp *sfp)
sfp_sm_event(sfp, SFP_E_DEV_DOWN);
}
+static void sfp_set_signal_rate(struct sfp *sfp, unsigned int rate_kbd)
+{
+}
+
static int sfp_module_info(struct sfp *sfp, struct ethtool_modinfo *modinfo)
{
/* locking... and check module is present */
@@ -2550,6 +2554,7 @@ static const struct sfp_socket_ops sfp_module_ops = {
.detach = sfp_detach,
.start = sfp_start,
.stop = sfp_stop,
+ .set_signal_rate = sfp_set_signal_rate,
.module_info = sfp_module_info,
.module_eeprom = sfp_module_eeprom,
.module_eeprom_by_page = sfp_module_eeprom_by_page,
diff --git a/drivers/net/phy/sfp.h b/drivers/net/phy/sfp.h
index 6cf1643214d3e..c7cb50d100999 100644
--- a/drivers/net/phy/sfp.h
+++ b/drivers/net/phy/sfp.h
@@ -19,6 +19,7 @@ struct sfp_socket_ops {
void (*detach)(struct sfp *sfp);
void (*start)(struct sfp *sfp);
void (*stop)(struct sfp *sfp);
+ void (*set_signal_rate)(struct sfp *sfp, unsigned int rate_kbd);
int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo);
int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee,
u8 *data);
diff --git a/include/linux/sfp.h b/include/linux/sfp.h
index d1f343853b6c7..a5179be7f7df5 100644
--- a/include/linux/sfp.h
+++ b/include/linux/sfp.h
@@ -547,6 +547,7 @@ int sfp_get_module_eeprom_by_page(struct sfp_bus *bus,
struct netlink_ext_ack *extack);
void sfp_upstream_start(struct sfp_bus *bus);
void sfp_upstream_stop(struct sfp_bus *bus);
+void sfp_upstream_set_signal_rate(struct sfp_bus *bus, unsigned int rate_kbd);
void sfp_bus_put(struct sfp_bus *bus);
struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode);
int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream,
@@ -606,6 +607,11 @@ static inline void sfp_upstream_stop(struct sfp_bus *bus)
{
}
+static inline void sfp_upstream_set_signal_rate(struct sfp_bus *bus,
+ unsigned int rate_kbd)
+{
+}
+
static inline void sfp_bus_put(struct sfp_bus *bus)
{
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0836/1059] net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (834 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0835/1059] net: sfp: add support for setting signalling rate Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0837/1059] net: phylink: add PCS negotiation mode Greg Kroah-Hartman
` (162 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Russell King (Oracle),
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[ Upstream commit ae4899bb486f73e6d3d55a82b40482b2c5529a98 ]
Add two helper functions for calling PCS methods. phylink_pcs_config()
allows us to handle PCS configuration specifics in one location, rather
than the two call sites. phylink_pcs_link_up() gives us consistency.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1q1TzK-007Exd-Rs@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: fdb6fcabdbb8 ("net: marvell: prestera: disable port before changing its MAC mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/phylink.c | 53 ++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 20 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index d1463f9cbd711..58ba9ee0d8448 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -964,6 +964,25 @@ static void phylink_resolve_flow(struct phylink_link_state *state)
}
}
+static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
+ const struct phylink_link_state *state,
+ bool permit_pause_to_mac)
+{
+ if (!pcs)
+ return 0;
+
+ return pcs->ops->pcs_config(pcs, mode, state->interface,
+ state->advertising, permit_pause_to_mac);
+}
+
+static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+ phy_interface_t interface, int speed,
+ int duplex)
+{
+ if (pcs && pcs->ops->pcs_link_up)
+ pcs->ops->pcs_link_up(pcs, mode, interface, speed, duplex);
+}
+
static void phylink_pcs_poll_stop(struct phylink *pl)
{
if (pl->cfg_link_an_mode == MLO_AN_INBAND)
@@ -1046,18 +1065,15 @@ static void phylink_major_config(struct phylink *pl, bool restart,
phylink_mac_config(pl, state);
- if (pl->pcs) {
- err = pl->pcs->ops->pcs_config(pl->pcs, pl->cur_link_an_mode,
- state->interface,
- state->advertising,
- !!(pl->link_config.pause &
- MLO_PAUSE_AN));
- if (err < 0)
- phylink_err(pl, "pcs_config failed: %pe\n",
- ERR_PTR(err));
- if (err > 0)
- restart = true;
- }
+ err = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode, state,
+ !!(pl->link_config.pause &
+ MLO_PAUSE_AN));
+ if (err < 0)
+ phylink_err(pl, "pcs_config failed: %pe\n",
+ ERR_PTR(err));
+ else if (err > 0)
+ restart = true;
+
if (restart)
phylink_mac_pcs_an_restart(pl);
@@ -1108,11 +1124,9 @@ static int phylink_change_inband_advert(struct phylink *pl)
* restart negotiation if the pcs_config() helper indicates that
* the programmed advertisement has changed.
*/
- ret = pl->pcs->ops->pcs_config(pl->pcs, pl->cur_link_an_mode,
- pl->link_config.interface,
- pl->link_config.advertising,
- !!(pl->link_config.pause &
- MLO_PAUSE_AN));
+ ret = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode,
+ &pl->link_config,
+ !!(pl->link_config.pause & MLO_PAUSE_AN));
if (ret < 0)
return ret;
@@ -1243,9 +1257,8 @@ static void phylink_link_up(struct phylink *pl,
pl->cur_interface = link_state.interface;
- if (pl->pcs && pl->pcs->ops->pcs_link_up)
- pl->pcs->ops->pcs_link_up(pl->pcs, pl->cur_link_an_mode,
- pl->cur_interface, speed, duplex);
+ phylink_pcs_link_up(pl->pcs, pl->cur_link_an_mode, pl->cur_interface,
+ speed, duplex);
pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode,
pl->cur_interface, speed, duplex,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0837/1059] net: phylink: add PCS negotiation mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (835 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0836/1059] net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0838/1059] net: prestera: update PCS driver to use neg_mode Greg Kroah-Hartman
` (161 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Russell King (Oracle),
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[ Upstream commit f99d471afa03f770149f1cc60a288b9a08285903 ]
PCS have to work out whether they should enable PCS negotiation by
looking at the "mode" and "interface" arguments, and the Autoneg bit
in the advertising mask.
This leads to some complex logic, so lets pull that out into phylink
and instead pass a "neg_mode" argument to the PCS configuration and
link up methods, instead of the "mode" argument.
In order to transition drivers, add a "neg_mode" flag to the phylink
PCS structure to PCS can indicate whether they want to be passed the
neg_mode or the old mode argument.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1qA8De-00EaFA-Ht@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: fdb6fcabdbb8 ("net: marvell: prestera: disable port before changing its MAC mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/phylink.c | 45 +++++++++++++----
include/linux/phylink.h | 104 +++++++++++++++++++++++++++++++++++---
2 files changed, 132 insertions(+), 17 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 58ba9ee0d8448..6ff68ddd1b9e3 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -71,6 +71,7 @@ struct phylink {
struct mutex state_mutex;
struct phylink_link_state phy_state;
struct work_struct resolve;
+ unsigned int pcs_neg_mode;
bool mac_link_dropped;
bool using_mac_select_pcs;
@@ -964,23 +965,23 @@ static void phylink_resolve_flow(struct phylink_link_state *state)
}
}
-static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
+static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
const struct phylink_link_state *state,
bool permit_pause_to_mac)
{
if (!pcs)
return 0;
- return pcs->ops->pcs_config(pcs, mode, state->interface,
+ return pcs->ops->pcs_config(pcs, neg_mode, state->interface,
state->advertising, permit_pause_to_mac);
}
-static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface, int speed,
int duplex)
{
if (pcs && pcs->ops->pcs_link_up)
- pcs->ops->pcs_link_up(pcs, mode, interface, speed, duplex);
+ pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex);
}
static void phylink_pcs_poll_stop(struct phylink *pl)
@@ -1029,10 +1030,15 @@ static void phylink_major_config(struct phylink *pl, bool restart,
struct phylink_pcs *pcs = NULL;
bool pcs_changed = false;
unsigned int rate_kbd;
+ unsigned int neg_mode;
int err;
phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
+ pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode,
+ state->interface,
+ state->advertising);
+
if (pl->using_mac_select_pcs) {
pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
if (IS_ERR(pcs)) {
@@ -1065,9 +1071,12 @@ static void phylink_major_config(struct phylink *pl, bool restart,
phylink_mac_config(pl, state);
- err = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode, state,
- !!(pl->link_config.pause &
- MLO_PAUSE_AN));
+ neg_mode = pl->cur_link_an_mode;
+ if (pl->pcs && pl->pcs->neg_mode)
+ neg_mode = pl->pcs_neg_mode;
+
+ err = phylink_pcs_config(pl->pcs, neg_mode, state,
+ !!(pl->link_config.pause & MLO_PAUSE_AN));
if (err < 0)
phylink_err(pl, "pcs_config failed: %pe\n",
ERR_PTR(err));
@@ -1102,6 +1111,7 @@ static void phylink_major_config(struct phylink *pl, bool restart,
*/
static int phylink_change_inband_advert(struct phylink *pl)
{
+ unsigned int neg_mode;
int ret;
if (test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state))
@@ -1120,12 +1130,20 @@ static int phylink_change_inband_advert(struct phylink *pl)
__ETHTOOL_LINK_MODE_MASK_NBITS, pl->link_config.advertising,
pl->link_config.pause);
+ /* Recompute the PCS neg mode */
+ pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode,
+ pl->link_config.interface,
+ pl->link_config.advertising);
+
+ neg_mode = pl->cur_link_an_mode;
+ if (pl->pcs->neg_mode)
+ neg_mode = pl->pcs_neg_mode;
+
/* Modern PCS-based method; update the advert at the PCS, and
* restart negotiation if the pcs_config() helper indicates that
* the programmed advertisement has changed.
*/
- ret = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode,
- &pl->link_config,
+ ret = phylink_pcs_config(pl->pcs, neg_mode, &pl->link_config,
!!(pl->link_config.pause & MLO_PAUSE_AN));
if (ret < 0)
return ret;
@@ -1227,6 +1245,7 @@ static void phylink_link_up(struct phylink *pl,
struct phylink_link_state link_state)
{
struct net_device *ndev = pl->netdev;
+ unsigned int neg_mode;
int speed, duplex;
bool rx_pause;
@@ -1257,8 +1276,12 @@ static void phylink_link_up(struct phylink *pl,
pl->cur_interface = link_state.interface;
- phylink_pcs_link_up(pl->pcs, pl->cur_link_an_mode, pl->cur_interface,
- speed, duplex);
+ neg_mode = pl->cur_link_an_mode;
+ if (pl->pcs && pl->pcs->neg_mode)
+ neg_mode = pl->pcs_neg_mode;
+
+ phylink_pcs_link_up(pl->pcs, neg_mode, pl->cur_interface, speed,
+ duplex);
pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode,
pl->cur_interface, speed, duplex,
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 6d62c9ea2e040..033ac86fcd46c 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -21,6 +21,24 @@ enum {
MLO_AN_FIXED, /* Fixed-link mode */
MLO_AN_INBAND, /* In-band protocol */
+ /* PCS "negotiation" mode.
+ * PHYLINK_PCS_NEG_NONE - protocol has no inband capability
+ * PHYLINK_PCS_NEG_OUTBAND - some out of band or fixed link setting
+ * PHYLINK_PCS_NEG_INBAND_DISABLED - inband mode disabled, e.g.
+ * 1000base-X with autoneg off
+ * PHYLINK_PCS_NEG_INBAND_ENABLED - inband mode enabled
+ * Additionally, this can be tested using bitmasks:
+ * PHYLINK_PCS_NEG_INBAND - inband mode selected
+ * PHYLINK_PCS_NEG_ENABLED - negotiation mode enabled
+ */
+ PHYLINK_PCS_NEG_NONE = 0,
+ PHYLINK_PCS_NEG_ENABLED = BIT(4),
+ PHYLINK_PCS_NEG_OUTBAND = BIT(5),
+ PHYLINK_PCS_NEG_INBAND = BIT(6),
+ PHYLINK_PCS_NEG_INBAND_DISABLED = PHYLINK_PCS_NEG_INBAND,
+ PHYLINK_PCS_NEG_INBAND_ENABLED = PHYLINK_PCS_NEG_INBAND |
+ PHYLINK_PCS_NEG_ENABLED,
+
/* MAC_SYM_PAUSE and MAC_ASYM_PAUSE are used when configuring our
* autonegotiation advertisement. They correspond to the PAUSE and
* ASM_DIR bits defined by 802.3, respectively.
@@ -79,6 +97,70 @@ static inline bool phylink_autoneg_inband(unsigned int mode)
return mode == MLO_AN_INBAND;
}
+/**
+ * phylink_pcs_neg_mode() - helper to determine PCS inband mode
+ * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
+ * @interface: interface mode to be used
+ * @advertising: adertisement ethtool link mode mask
+ *
+ * Determines the negotiation mode to be used by the PCS, and returns
+ * one of:
+ * %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
+ * %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
+ * will be used.
+ * %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg disabled
+ * %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
+ *
+ * Note: this is for cases where the PCS itself is involved in negotiation
+ * (e.g. Clause 37, SGMII and similar) not Clause 73.
+ */
+static inline unsigned int phylink_pcs_neg_mode(unsigned int mode,
+ phy_interface_t interface,
+ const unsigned long *advertising)
+{
+ unsigned int neg_mode;
+
+ switch (interface) {
+ case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_QSGMII:
+ case PHY_INTERFACE_MODE_QUSGMII:
+ case PHY_INTERFACE_MODE_USXGMII:
+ /* These protocols are designed for use with a PHY which
+ * communicates its negotiation result back to the MAC via
+ * inband communication. Note: there exist PHYs that run
+ * with SGMII but do not send the inband data.
+ */
+ if (!phylink_autoneg_inband(mode))
+ neg_mode = PHYLINK_PCS_NEG_OUTBAND;
+ else
+ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
+ break;
+
+ case PHY_INTERFACE_MODE_1000BASEX:
+ case PHY_INTERFACE_MODE_2500BASEX:
+ /* 1000base-X is designed for use media-side for Fibre
+ * connections, and thus the Autoneg bit needs to be
+ * taken into account. We also do this for 2500base-X
+ * as well, but drivers may not support this, so may
+ * need to override this.
+ */
+ if (!phylink_autoneg_inband(mode))
+ neg_mode = PHYLINK_PCS_NEG_OUTBAND;
+ else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+ advertising))
+ neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
+ else
+ neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
+ break;
+
+ default:
+ neg_mode = PHYLINK_PCS_NEG_NONE;
+ break;
+ }
+
+ return neg_mode;
+}
+
/**
* struct phylink_link_state - link state structure
* @advertising: ethtool bitmask containing advertised link modes
@@ -433,6 +515,7 @@ struct phylink_pcs_ops;
/**
* struct phylink_pcs - PHYLINK PCS instance
* @ops: a pointer to the &struct phylink_pcs_ops structure
+ * @neg_mode: provide PCS neg mode via "mode" argument
* @poll: poll the PCS for link changes
*
* This structure is designed to be embedded within the PCS private data,
@@ -440,6 +523,7 @@ struct phylink_pcs_ops;
*/
struct phylink_pcs {
const struct phylink_pcs_ops *ops;
+ bool neg_mode;
bool poll;
};
@@ -457,12 +541,12 @@ struct phylink_pcs_ops {
const struct phylink_link_state *state);
void (*pcs_get_state)(struct phylink_pcs *pcs,
struct phylink_link_state *state);
- int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode,
+ int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
const unsigned long *advertising,
bool permit_pause_to_mac);
void (*pcs_an_restart)(struct phylink_pcs *pcs);
- void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int mode,
+ void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface, int speed, int duplex);
};
@@ -505,7 +589,7 @@ void pcs_get_state(struct phylink_pcs *pcs,
/**
* pcs_config() - Configure the PCS mode and advertisement
* @pcs: a pointer to a &struct phylink_pcs.
- * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
+ * @neg_mode: link negotiation mode (see below)
* @interface: interface mode to be used
* @advertising: adertisement ethtool link mode mask
* @permit_pause_to_mac: permit forwarding pause resolution to MAC
@@ -523,8 +607,12 @@ void pcs_get_state(struct phylink_pcs *pcs,
* For 1000BASE-X, the advertisement should be programmed into the PCS.
*
* For most 10GBASE-R, there is no advertisement.
+ *
+ * The %neg_mode argument should be tested via the phylink_mode_*() family of
+ * functions, or for PCS that set pcs->neg_mode true, should be tested
+ * against the %PHYLINK_PCS_NEG_* definitions.
*/
-int pcs_config(struct phylink_pcs *pcs, unsigned int mode,
+int pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface, const unsigned long *advertising,
bool permit_pause_to_mac);
@@ -540,7 +628,7 @@ void pcs_an_restart(struct phylink_pcs *pcs);
/**
* pcs_link_up() - program the PCS for the resolved link configuration
* @pcs: a pointer to a &struct phylink_pcs.
- * @mode: link autonegotiation mode
+ * @neg_mode: link negotiation mode (see below)
* @interface: link &typedef phy_interface_t mode
* @speed: link speed
* @duplex: link duplex
@@ -549,8 +637,12 @@ void pcs_an_restart(struct phylink_pcs *pcs);
* the resolved link parameters. For example, a PCS operating in SGMII
* mode without in-band AN needs to be manually configured for the link
* and duplex setting. Otherwise, this should be a no-op.
+ *
+ * The %mode argument should be tested via the phylink_mode_*() family of
+ * functions, or for PCS that set pcs->neg_mode true, should be tested
+ * against the %PHYLINK_PCS_NEG_* definitions.
*/
-void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface, int speed, int duplex);
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0838/1059] net: prestera: update PCS driver to use neg_mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (836 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0837/1059] net: phylink: add PCS negotiation mode Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0839/1059] net: marvell: prestera: disable port before changing its MAC mode Greg Kroah-Hartman
` (160 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Elad Nachman, Russell King (Oracle),
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
[ Upstream commit d5a05299306227d73b0febba9cecedf88931c507 ]
Update prestera's embedded PCS driver to use neg_mode rather than the
mode argument. As there is no pcs_link_up() method, this only affects
the pcs_config() method.
Acked-by: Elad Nachman <enachman@marvell.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1qA8EO-00EaG3-TR@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: fdb6fcabdbb8 ("net: marvell: prestera: disable port before changing its MAC mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/marvell/prestera/prestera_main.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index b7dc6241ba3e5..d6624729ec04b 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -300,8 +300,7 @@ static void prestera_pcs_get_state(struct phylink_pcs *pcs,
}
}
-static int prestera_pcs_config(struct phylink_pcs *pcs,
- unsigned int mode,
+static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
const unsigned long *advertising,
bool permit_pause_to_mac)
@@ -316,30 +315,25 @@ static int prestera_pcs_config(struct phylink_pcs *pcs,
cfg_mac.admin = true;
cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
+ cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
switch (interface) {
case PHY_INTERFACE_MODE_10GBASER:
cfg_mac.speed = SPEED_10000;
- cfg_mac.inband = 0;
cfg_mac.mode = PRESTERA_MAC_MODE_SR_LR;
break;
case PHY_INTERFACE_MODE_2500BASEX:
cfg_mac.speed = SPEED_2500;
cfg_mac.duplex = DUPLEX_FULL;
- cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
- advertising);
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_SGMII:
- cfg_mac.inband = 1;
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_1000BASEX:
default:
cfg_mac.speed = SPEED_1000;
cfg_mac.duplex = DUPLEX_FULL;
- cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
- advertising);
cfg_mac.mode = PRESTERA_MAC_MODE_1000BASE_X;
break;
}
@@ -402,6 +396,7 @@ static int prestera_port_sfp_bind(struct prestera_port *port)
continue;
port->phylink_pcs.ops = &prestera_pcs_ops;
+ port->phylink_pcs.neg_mode = true;
port->phy_config.dev = &port->dev->dev;
port->phy_config.type = PHYLINK_NETDEV;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0839/1059] net: marvell: prestera: disable port before changing its MAC mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (837 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0838/1059] net: prestera: update PCS driver to use neg_mode Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0840/1059] net/mlx5e: Release FIB event work flows before dropping RTNL Greg Kroah-Hartman
` (159 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Imre Kaloz, Elad Nachman,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <kaloz@kernel.org>
[ Upstream commit fdb6fcabdbb8247f1647d54fb1b9dc3575d7fcc8 ]
prestera_pcs_config() writes a new mode, speed or inband setting to an
enabled port. The firmware can then report link down until the port is
disabled and enabled again.
Disable the port before such a write. 2500BASE-X and SGMII share one MAC
mode, so SGMII sets its own speed and the speed is compared as well.
Exercising this needs a link partner, so no in-tree test covers it.
Before this patch, the SFP+ ports (S-RJ01 module in sfp-52) on
a Delta TN48M (98DX3265) with firmware 4.1.0 come up in 21 of 30
attempts. 30 out of 30 with the patch.
Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
Reviewed-by: Elad Nachman <enachman@marvell.com>
Link: https://patch.msgid.link/20261115230812.29644-1-kaloz@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/marvell/prestera/prestera_main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index d6624729ec04b..4129af6bc82a0 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -306,13 +306,14 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
bool permit_pause_to_mac)
{
struct prestera_port *port = prestera_pcs_to_port(pcs);
- struct prestera_port_mac_config cfg_mac;
+ struct prestera_port_mac_config cfg_mac, old;
int err;
err = prestera_port_cfg_mac_read(port, &cfg_mac);
if (err)
return err;
+ old = cfg_mac;
cfg_mac.admin = true;
cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
@@ -328,6 +329,7 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_SGMII:
+ cfg_mac.speed = SPEED_1000;
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_1000BASEX:
@@ -338,6 +340,19 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
break;
}
+ /* Firmware may not report link up after the mode, speed or inband
+ * setting of an enabled port changes until the port is disabled and
+ * re-enabled.
+ */
+ if (old.admin && (old.mode != cfg_mac.mode ||
+ old.speed != cfg_mac.speed ||
+ old.inband != cfg_mac.inband)) {
+ old.admin = false;
+ err = prestera_port_cfg_mac_write(port, &old);
+ if (err)
+ return err;
+ }
+
err = prestera_port_cfg_mac_write(port, &cfg_mac);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0840/1059] net/mlx5e: Release FIB event work flows before dropping RTNL
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (838 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0839/1059] net: marvell: prestera: disable port before changing its MAC mode Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0841/1059] scsi: ufs: ufs-mediatek: Remove unneeded code Greg Kroah-Hartman
` (158 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gal Pressman, Jianbo Liu,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <gal@nvidia.com>
[ Upstream commit bfccb4e44e4725270ccef366078d7b6063920ff3 ]
The FIB event work, neigh update work and the neigh stats work all use
flow->tmp_list to hold the encap flows they work on, while RTNL is what
keeps them from using it at the same time.
mlx5e_tc_fib_event_work() drops RTNL before it is done with its list.
A neigh work can then take the same flows while the FIB work is still
walking them, and the two overwrite each other's list.
Release the flow list before dropping RTNL.
The issue was hit once in our regression testing (OVS connection
tracking with the VXLAN endpoint on a VF, KASAN build):
BUG: KASAN: stack-out-of-bounds in mlx5e_flow_put+0x23/0x80 [mlx5_core]
Write of size 4 at addr ffff8881226d7b20 by task kworker/u40:1/20171
Workqueue: mlx5e mlx5e_tc_fib_event_work [mlx5_core]
Call Trace:
mlx5e_flow_put+0x23/0x80 [mlx5_core]
mlx5e_put_flow_list+0x82/0xe0 [mlx5_core]
mlx5e_tc_fib_event_work+0x704/0x1fb0 [mlx5_core]
process_one_work+0x8df/0x1660
The race was also reproduced with an msleep() inserted between
rtnl_unlock() and mlx5e_put_flow_list() to widen the window, a VXLAN
encap rule whose endpoint IP is on a VF, and route churn on the endpoint
address.
Fixes: 8914add2c9e5 ("net/mlx5e: Handle FIB events to update tunnel endpoint device")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118143653.1915247-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
index 407556334495d..393b28f25e398 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
@@ -1605,9 +1605,9 @@ static void mlx5e_tc_fib_event_work(struct work_struct *work)
r->flags |= MLX5E_ROUTE_ENTRY_VALID;
out:
mutex_unlock(&esw->offloads.encap_tbl_lock);
+ mlx5e_put_flow_list(priv, &flow_list);
rtnl_unlock();
- mlx5e_put_flow_list(priv, &flow_list);
mlx5e_route_put(priv, event_data->r);
dev_put(event_data->ul_dev);
kfree(event_data);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0841/1059] scsi: ufs: ufs-mediatek: Remove unneeded code
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (839 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0840/1059] net/mlx5e: Release FIB event work flows before dropping RTNL Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0842/1059] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails Greg Kroah-Hartman
` (157 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, ChanWoo Lee, Stanley Chu,
AngeloGioacchino Del Regno, Martin K. Petersen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChanWoo Lee <cw9316.lee@samsung.com>
[ Upstream commit 541555285339313e831f8e446c03a7994c604d65 ]
Remove unnecessary if/goto code.
Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
Link: https://lore.kernel.org/r/20221118044136.921-1-cw9316.lee@samsung.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stable-dep-of: 71b5da0b45fb ("scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ufs/host/ufs-mediatek.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 3dbcb30e610fc..e4fc86ed537ec 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -441,8 +441,6 @@ static int ufs_mtk_mphy_power_on(struct ufs_hba *hba, bool on)
if (ufs_mtk_is_va09_supported(hba)) {
ufs_mtk_va09_pwr_ctrl(res, 0);
ret = regulator_disable(host->reg_va09);
- if (ret < 0)
- goto out;
}
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0842/1059] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (840 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0841/1059] scsi: ufs: ufs-mediatek: Remove unneeded code Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0843/1059] net: qrtr: ns: Ignore ENODEV failures in ns Greg Kroah-Hartman
` (156 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Wang, Xiangwu Lai,
Martin K. Petersen (Oracle), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
[ Upstream commit 71b5da0b45fb83b590f1ec3df5361c7754b0e113 ]
In ufs_mtk_mphy_power_on(), the power-off path tears the M-PHY down in two
steps before regulator_disable() is called: phy_power_off() puts the PHY
PLL and its clocks down, and ufs_mtk_va09_pwr_ctrl() asks the firmware to
drop the VA09 supply. If regulator_disable() then fails, the M-PHY stays
physically off while host->mphy_powered_on is left set, so the next
power-on attempt bails out through the !(on ^ host->mphy_powered_on) check
and never powers the M-PHY back up, leaving the UFS host with an unpowered
PHY (I/O timeouts, controller lockups).
Simply forcing mphy_powered_on to false would trade this for two more
problems. First, the regulator core drops the consumer enable count only
after a successful disable, so the count stays at 1, the next power-on
raises it to 2 and it never returns to zero: va09 is then never physically
disabled and the devm-acquired regulator would hit WARN_ON(enable_count)
again on release. Second, when the power-off fails during
ufs_mtk_suspend(), the error recovery in __ufshcd_wl_suspend() runs
ufshcd_host_reset_and_restore() without powering the M-PHY back on, which
would run against an unpowered PHY. (Both points were raised by the
Sashiko AI review of v2.)
Since the va09 regulator stays enabled when its disable fails, restore the
M-PHY power state instead: power the PHY back on through
ufs_mtk_va09_pwr_ctrl() and phy_power_on() and leave mphy_powered_on set.
The next power-off attempt then retries the full sequence and the enable
count stays balanced.
Found by code inspection while reviewing the va09 error paths of the
driver; the failure has not been observed on real hardware.
Suggested-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/sashiko-outbox-220026@kernel.org
Fixes: cf137b3ea49a ("scsi: ufs-mediatek: Support VA09 regulator operations")
Signed-off-by: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Link: https://patch.msgid.link/20261119071611.117-3-laixiangwu@cmss.chinamobile.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ufs/host/ufs-mediatek.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index e4fc86ed537ec..9a02a42342f93 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -441,6 +441,16 @@ static int ufs_mtk_mphy_power_on(struct ufs_hba *hba, bool on)
if (ufs_mtk_is_va09_supported(hba)) {
ufs_mtk_va09_pwr_ctrl(res, 0);
ret = regulator_disable(host->reg_va09);
+ if (ret) {
+ /*
+ * The va09 regulator stays enabled, so
+ * bring the M-PHY back up to keep the
+ * software state in sync with the
+ * hardware.
+ */
+ ufs_mtk_va09_pwr_ctrl(res, 1);
+ phy_power_on(mphy);
+ }
}
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0843/1059] net: qrtr: ns: Ignore ENODEV failures in ns
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (841 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0842/1059] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0844/1059] net: qrtr: ns: keep notifying local servers after a failed send Greg Kroah-Hartman
` (155 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Lew, Sarannya Sasikumar,
Simon Horman, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lew <quic_clew@quicinc.com>
[ Upstream commit 404dbd26322f50c8123bf5bff9a409356889035f ]
Ignore the ENODEV failures returned by kernel_sendmsg(). These errors
indicate that either the local port has been closed or the remote has
gone down. Neither of these scenarios are fatal and will eventually be
handled through packets that are later queued on the control port.
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Signed-off-by: Sarannya Sasikumar <quic_sarannya@quicinc.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240612063156.1377210-1-quic_sarannya@quicinc.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: d5b89d55a322 ("net: qrtr: ns: keep notifying local servers after a failed send")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/qrtr/ns.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 4df5f0a9b7419..60d2f6da24010 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -151,8 +151,8 @@ static int service_announce_new(struct sockaddr_qrtr *dest,
return kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
}
-static int service_announce_del(struct sockaddr_qrtr *dest,
- struct qrtr_server *srv)
+static void service_announce_del(struct sockaddr_qrtr *dest,
+ struct qrtr_server *srv)
{
struct qrtr_ctrl_pkt pkt;
struct msghdr msg = { };
@@ -176,10 +176,10 @@ static int service_announce_del(struct sockaddr_qrtr *dest,
msg.msg_namelen = sizeof(*dest);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0)
+ if (ret < 0 && ret != -ENODEV)
pr_err("failed to announce del service\n");
- return ret;
+ return;
}
static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv,
@@ -207,7 +207,7 @@ static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv,
msg.msg_namelen = sizeof(*to);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0)
+ if (ret < 0 && ret != -ENODEV)
pr_err("failed to send lookup notification\n");
}
@@ -226,6 +226,9 @@ static int announce_servers(struct sockaddr_qrtr *sq)
xa_for_each(&node->servers, index, srv) {
ret = service_announce_new(sq, srv);
if (ret < 0) {
+ if (ret == -ENODEV)
+ continue;
+
pr_err("failed to announce new service\n");
return ret;
}
@@ -400,7 +403,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
msg.msg_namelen = sizeof(sq);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0) {
+ if (ret < 0 && ret != -ENODEV) {
pr_err("failed to send bye cmd\n");
goto delete_node;
}
@@ -484,7 +487,7 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
msg.msg_namelen = sizeof(sq);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0) {
+ if (ret < 0 && ret != -ENODEV) {
pr_err("failed to send del client cmd\n");
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0844/1059] net: qrtr: ns: keep notifying local servers after a failed send
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (842 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0843/1059] net: qrtr: ns: Ignore ENODEV failures in ns Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0845/1059] riscv: efi: Map runtime MMIO with device attributes Greg Kroah-Hartman
` (154 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Opaniuk, Jakub Kicinski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
[ Upstream commit d5b89d55a322b632e2b465b392a4c1d9d338db9c ]
ctrl_cmd_bye() and ctrl_cmd_del_client() forward the event to every
local server, but stop at the first failed send. Each send goes to a
different socket, so a single server with a full receive queue
(-ENOSPC) hides the event from all servers after it.
Log the failure and carry on. Likewise, keep notifying local lookups
when the NEW_SERVER broadcast fails, which can only happen on -ENOMEM.
Tested on the Arduino UNO Q (QRB2210).
Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Link: https://patch.msgid.link/20261114-upstream-qrtr-hello-gate-fix_b4-v2-1-2fb62c2853bb@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/qrtr/ns.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 60d2f6da24010..11b067f376fa2 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -402,11 +402,11 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
msg.msg_name = (struct sockaddr *)&sq;
msg.msg_namelen = sizeof(sq);
+ /* A server that cannot take it must not hide it from the rest */
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0 && ret != -ENODEV) {
- pr_err("failed to send bye cmd\n");
- goto delete_node;
- }
+ if (ret < 0 && ret != -ENODEV)
+ pr_err_ratelimited("failed to send bye cmd to %u:%u: %d\n",
+ srv->node, srv->port, ret);
}
/* Ignore -ENODEV */
@@ -486,11 +486,11 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
msg.msg_name = (struct sockaddr *)&sq;
msg.msg_namelen = sizeof(sq);
+ /* A server that cannot take it must not hide it from the rest */
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0 && ret != -ENODEV) {
- pr_err("failed to send del client cmd\n");
- return ret;
- }
+ if (ret < 0 && ret != -ENODEV)
+ pr_err_ratelimited("failed to send del client cmd to %u:%u: %d\n",
+ srv->node, srv->port, ret);
}
return 0;
}
@@ -515,11 +515,10 @@ static int ctrl_cmd_new_server(struct sockaddr_qrtr *from,
return -EINVAL;
if (srv->node == qrtr_ns.local_node) {
+ /* The lookups below still need to hear about the server */
ret = service_announce_new(&qrtr_ns.bcast_sq, srv);
- if (ret < 0) {
+ if (ret < 0)
pr_err("failed to announce new service\n");
- return ret;
- }
}
/* Notify any potential lookups about the new server */
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0845/1059] riscv: efi: Map runtime MMIO with device attributes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (843 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0844/1059] net: qrtr: ns: keep notifying local servers after a failed send Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0846/1059] net/mlx5: E-Switch, skip vport change work for disabled vports Greg Kroah-Hartman
` (153 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Han Gao, Ard Biesheuvel, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Han Gao <gaohan@iscas.ac.cn>
[ Upstream commit 7d49d6e0898680925ea410cbb9d1a6a0e6441462 ]
EFI_MEMORY_MAPPED_IO regions are mapped with PAGE_KERNEL, so device
registers end up mapped as normal memory.
On Milk-V Pioneer, GetTime() reads the clock controller registers and
faults:
Oops - load access fault [#1]
Workqueue: efi_runtime efi_call_rts
status: 0000000200000120 badaddr: 0000007030012000 cause: 0000000000000005
Use PAGE_KERNEL_IO for these regions.
Fixes: b91540d52a08 ("RISC-V: Add EFI runtime services")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/riscv/kernel/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
index 1aa540350abd3..15f203a225d59 100644
--- a/arch/riscv/kernel/efi.c
+++ b/arch/riscv/kernel/efi.c
@@ -22,7 +22,7 @@ static __init pgprot_t efimem_to_pgprot_map(efi_memory_desc_t *md)
u32 type = md->type;
if (type == EFI_MEMORY_MAPPED_IO)
- return PAGE_KERNEL;
+ return PAGE_KERNEL_IO;
/* R-- */
if ((attr & (EFI_MEMORY_XP | EFI_MEMORY_RO)) ==
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0846/1059] net/mlx5: E-Switch, skip vport change work for disabled vports
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (844 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0845/1059] riscv: efi: Map runtime MMIO with device attributes Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0847/1059] ALSA: hda: intel: Release i915 power also when delayed probe fails Greg Kroah-Hartman
` (152 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Uri Dar, Shay Drory, Mark Bloch,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uri Dar <udar@nvidia.com>
[ Upstream commit 890f23ba87a7ca1aba97c8320770a686e3b689fb ]
A vport change work can still be pending when its vport is disabled.
For an SF, the vport is then freed in FW and the work's query fails
with syndrome 0x29d722. A disabled vport has nothing to sync, so skip
the work.
Fixes: d970812b91d0 ("net/mlx5: E-switch, Add eswitch helpers for SF vport")
Signed-off-by: Uri Dar <udar@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118165155.1946097-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 67cdf8cb48866..a2fa02ca6ceab 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -738,7 +738,8 @@ static void esw_vport_change_handler(struct work_struct *work)
struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
mutex_lock(&esw->state_lock);
- esw_vport_change_handle_locked(vport);
+ if (vport->enabled)
+ esw_vport_change_handle_locked(vport);
mutex_unlock(&esw->state_lock);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0847/1059] ALSA: hda: intel: Release i915 power also when delayed probe fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (845 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0846/1059] net/mlx5: E-Switch, skip vport change work for disabled vports Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0848/1059] tools/bootconfig: Use the registered global tracing parameter names Greg Kroah-Hartman
` (151 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michal Grzelak, Kai Vehmanen,
Takashi Iwai, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
[ Upstream commit 0a5550dd94e61852941fb37142f4664ecddef312 ]
Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
work") stopped freeing the card from azx_probe_work() when the delayed
probe fails, and only disconnects it, leaving the free to azx_remove().
This avoids the double free, but the resources that were released by
the card free via azx_free() are now kept until the PCI device is
unbound. In particular the display power reference stay held, blocking
runtime suspend for i915/xe.
Release the display power in the azx_probe_continue() work in all cases.
This power reference is only taken for the purpose of the display codec
probe. If the display codec probe was successful, it will have taken its
own reference. In case of systems with the HDA controller on GPU side
(hda->need_i915_power), functionality is same as before - we have to
keep power.
Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
Reported-by: Michal Grzelak <michal.grzelak@intel.com>
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20261120150937.2187228-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/hda/hda_intel.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 09cf67a6a93c4..f3c3909b4a9cb 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2415,6 +2415,9 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
}
out_free:
+ if (!hda->need_i915_power)
+ display_power(chip, false);
+
if (err < 0) {
if (hda->vga_switcheroo_registered)
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
@@ -2425,8 +2428,6 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
return err;
}
- if (!hda->need_i915_power)
- display_power(chip, false);
complete_all(&hda->probe_wait);
to_hda_bus(bus)->bus_probing = 0;
hda->probe_retry = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0848/1059] tools/bootconfig: Use the registered global tracing parameter names
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (846 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0847/1059] ALSA: hda: intel: Release i915 power also when delayed probe fails Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0849/1059] tools: gpio-hammer: Accept the maximum number of line offsets Greg Kroah-Hartman
` (150 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eduardo Mucelli Rezende Oliveira,
Masami Hiramatsu (Google), Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
[ Upstream commit 51934668ca98f1b23c51ce4edea3c61018da342c ]
The boot-time tracing guide lists four kernel.* keys that do not match
the parameters registered by the tracing code. For example,
ftrace2bconf.sh emits kernel.fgraph_max_depth, which bootconfig passes
as fgraph_max_depth on the kernel command line. The function-graph
tracer registers ftrace_graph_max_depth.
Use the registered names in the guide and the exporter. Teach
bconf2ftrace.sh to read those names, with the previous script keys as
fallbacks so existing replay configurations still work.
Link: https://lore.kernel.org/all/fecf6e33d4f7e2ddf031526e7a1abef27e28f754.1795307698.git.edumucelli@gmail.com/
Fixes: 47781947947a ("Documentation: tracing: Add boot-time tracing document")
Fixes: 7e66ef0046cc ("tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig")
Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/trace/boottime-trace.rst | 8 ++++----
tools/bootconfig/scripts/bconf2ftrace.sh | 21 ++++++++++++++++-----
tools/bootconfig/scripts/ftrace2bconf.sh | 5 +++--
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst
index d594597201fdd..ac3aad42d73c5 100644
--- a/Documentation/trace/boottime-trace.rst
+++ b/Documentation/trace/boottime-trace.rst
@@ -36,20 +36,20 @@ these options are passed as a part of kernel legacy command line.
kernel.tp_printk
Output trace-event data on printk buffer too.
-kernel.dump_on_oops [= MODE]
+kernel.ftrace_dump_on_oops [= MODE]
Dump ftrace on Oops. If MODE = 1 or omitted, dump trace buffer
on all CPUs. If MODE = 2, dump a buffer on a CPU which kicks Oops.
kernel.traceoff_on_warning
Stop tracing if WARN_ON() occurs.
-kernel.fgraph_max_depth = MAX_DEPTH
+kernel.ftrace_graph_max_depth = MAX_DEPTH
Set MAX_DEPTH to maximum depth of fgraph tracer.
-kernel.fgraph_filters = FILTER[, FILTER2...]
+kernel.ftrace_graph_filter = FILTER[, FILTER2...]
Add fgraph tracing function filters.
-kernel.fgraph_notraces = FILTER[, FILTER2...]
+kernel.ftrace_graph_notrace = FILTER[, FILTER2...]
Add fgraph non-tracing function filters.
diff --git a/tools/bootconfig/scripts/bconf2ftrace.sh b/tools/bootconfig/scripts/bconf2ftrace.sh
index 850c2073433e1..ba29f7411f62a 100755
--- a/tools/bootconfig/scripts/bconf2ftrace.sh
+++ b/tools/bootconfig/scripts/bconf2ftrace.sh
@@ -275,15 +275,26 @@ setup_instance() { # [instance]
}
# ftrace global configs (kernel.*)
-if xbc_has_key "kernel.dump_on_oops"; then
- dump_mode=`xbc_get_val "kernel.dump_on_oops" 1`
+# Prefer the kernel parameter names and accept the old script keys as fallbacks.
+dump_key=kernel.ftrace_dump_on_oops
+xbc_has_key "$dump_key" || dump_key=kernel.dump_on_oops
+if xbc_has_key "$dump_key"; then
+ dump_mode=`xbc_get_val "$dump_key" 1`
[ "$dump_mode" ] && dump_mode=`eval echo $dump_mode` || dump_mode=1
run_cmd "echo \"$dump_mode\" > /proc/sys/kernel/ftrace_dump_on_oops"
fi
-set_value_of kernel.fgraph_max_depth $TRACEFS/max_graph_depth
-set_array_of kernel.fgraph_filters $TRACEFS/set_graph_function
-set_array_of kernel.fgraph_notraces $TRACEFS/set_graph_notrace
+graph_depth_key=kernel.ftrace_graph_max_depth
+xbc_has_key "$graph_depth_key" || graph_depth_key=kernel.fgraph_max_depth
+set_value_of "$graph_depth_key" $TRACEFS/max_graph_depth
+
+graph_filter_key=kernel.ftrace_graph_filter
+xbc_has_key "$graph_filter_key" || graph_filter_key=kernel.fgraph_filters
+set_array_of "$graph_filter_key" $TRACEFS/set_graph_function
+
+graph_notrace_key=kernel.ftrace_graph_notrace
+xbc_has_key "$graph_notrace_key" || graph_notrace_key=kernel.fgraph_notraces
+set_array_of "$graph_notrace_key" $TRACEFS/set_graph_notrace
# Per-instance/per-event configs
if ! xbc_has_branch "ftrace" ; then
diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 1603801cf1264..564a3085525f3 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -46,10 +46,11 @@ emit_kv() { # key =|+= value
global_options() {
val=`cat $TRACEFS/max_graph_depth`
- [ $val != 0 ] && emit_kv kernel.fgraph_max_depth = $val
+ [ $val != 0 ] && emit_kv kernel.ftrace_graph_max_depth = $val
if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
cat 1>&2 << EOF
-# WARN: kernel.fgraph_filters and kernel.fgraph_notrace are not supported, since the wild card expression was expanded and lost from memory.
+# WARN: Cannot export kernel.ftrace_graph_filter and kernel.ftrace_graph_notrace.
+# Only the expanded function list is available.
EOF
fi
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0849/1059] tools: gpio-hammer: Accept the maximum number of line offsets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (847 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0848/1059] tools/bootconfig: Use the registered global tracing parameter names Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0850/1059] tools: gpio: Preserve device listing errors in lsgpio Greg Kroah-Hartman
` (149 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 0b3f1876d6db7fad0391ce714b315269b0dd5758 ]
The offset count is incremented for every -o option, but the final
check rejects the maximum itself and reports one extra offset. Only
reject counts above the maximum and report the actual count.
Fixes: d1ee7e1f5c91 ("tools: gpio-hammer: Avoid potential overflow in main")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120061827.98066-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/gpio-hammer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/gpio/gpio-hammer.c b/tools/gpio/gpio-hammer.c
index 54fdf59dd320d..62d346b67d46e 100644
--- a/tools/gpio/gpio-hammer.c
+++ b/tools/gpio/gpio-hammer.c
@@ -159,10 +159,10 @@ int main(int argc, char **argv)
}
}
- if (i >= GPIOHANDLES_MAX) {
+ if (i > GPIOHANDLES_MAX) {
fprintf(stderr,
"Only %d occurrences of '-o' are allowed, %d were found\n",
- GPIOHANDLES_MAX, i + 1);
+ GPIOHANDLES_MAX, i);
return -1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0850/1059] tools: gpio: Preserve device listing errors in lsgpio
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (848 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0849/1059] tools: gpio-hammer: Accept the maximum number of line offsets Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0851/1059] tools: gpio: Return success after monitoring requested events Greg Kroah-Hartman
` (148 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 809117fc28453aafa7164ad45ea853f900974d08 ]
When no chip is selected, lsgpio breaks out of the directory scan on a
list_device() failure, then unconditionally resets ret to zero. A chip
that cannot be opened or queried is therefore reported as success.
Initialize ret to zero before scanning instead, so an empty scan still
succeeds and errors from list_device() reach the caller.
Fixes: 6d591c46bce0 ("tools/gpio: create GPIO tools")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120062053.98356-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/lsgpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
index 52a0be45410c9..de2eccc134796 100644
--- a/tools/gpio/lsgpio.c
+++ b/tools/gpio/lsgpio.c
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
goto error_out;
}
- ret = -ENOENT;
+ ret = 0;
while (ent = readdir(dp), ent) {
if (check_prefix(ent->d_name, "gpiochip")) {
ret = list_device(ent->d_name);
@@ -214,7 +214,6 @@ int main(int argc, char **argv)
}
}
- ret = 0;
if (closedir(dp) == -1) {
perror("scanning devices: Failed to close directory");
ret = -errno;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0851/1059] tools: gpio: Return success after monitoring requested events
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (849 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0850/1059] tools: gpio: Preserve device listing errors in lsgpio Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0852/1059] chardev: GPIO common access methods: repair non-kernel-doc comment Greg Kroah-Hartman
` (147 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 1eaf27d99938dd30ea7855174b65e37a2503a349 ]
After reading the requested number of events, monitor_device() returns
the positive byte count left in ret by read(). main() passes this value
through as the exit status, so a successful invocation with -c reports
failure.
Clear ret when the event limit is reached, keeping read failures on their
existing error paths.
Fixes: 97f69747d8b1 ("tools/gpio: add the gpio-event-mon tool")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120062107.98391-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/gpio-event-mon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
index 5dee2b98ab604..77807be4fc39b 100644
--- a/tools/gpio/gpio-event-mon.c
+++ b/tools/gpio/gpio-event-mon.c
@@ -124,8 +124,10 @@ int monitor_device(const char *device_name,
fprintf(stdout, "\n");
i++;
- if (i == loops)
+ if (i == loops) {
+ ret = 0;
break;
+ }
}
exit_line_close:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0852/1059] chardev: GPIO common access methods: repair non-kernel-doc comment
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (850 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0851/1059] tools: gpio: Return success after monitoring requested events Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0853/1059] tun: flush uc and mc addresses in TUNSETLINK Greg Kroah-Hartman
` (146 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Randy Dunlap, Jim Cromie,
Linus Walleij, Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <rdunlap@infradead.org>
[ Upstream commit d4dc896fa2bdfd7d1a78911598a0fa3e3c831d92 ]
Change a "/**" non-kernel-doc comment to a plain C comment "/*"
to avoid 21 warnings like these:
Warning: ./include/linux/nsc_gpio.h:2 Cannot find identifier on line:
nsc_gpio.c
Warning: ./include/linux/nsc_gpio.h:4 Cannot find identifier on line:
National Semiconductor GPIO common access methods.
Warning: ./include/linux/nsc_gpio.h:6 Cannot find identifier on line:
struct nsc_gpio_ops abstracts the low-level access
Fixes: fe3a168a2ce1 ("[PATCH] chardev: GPIO for SCx200 & PC-8736x: add gpio-ops vtable")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261123004501.1771603-1-rdunlap@infradead.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/nsc_gpio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h
index d7a04a6e3783a..342ce97975e8a 100644
--- a/include/linux/nsc_gpio.h
+++ b/include/linux/nsc_gpio.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-/**
+/*
nsc_gpio.c
National Semiconductor GPIO common access methods.
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0853/1059] tun: flush uc and mc addresses in TUNSETLINK
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (851 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0852/1059] chardev: GPIO common access methods: repair non-kernel-doc comment Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0854/1059] btrfs: send: fix invalid access to inline extents in clone_range() Greg Kroah-Hartman
` (145 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Willem de Bruijn,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 5677cf0e039b3cabf79d5aa10facbdb54aea93c6 ]
TUNSETLINK changes dev->type and dev->addr_len, but leaves
dev->uc and dev->mc untouched.
Entries added with the old addr_len stay in lists and rb-trees
that are now searched and dumped with the new addr_len.
When addr_len grows (eg ARPHRD_NONE -> ARPHRD_IP6GRE), dumps like
/proc/net/dev_mcast and RTM_GETMULTICAST expose bytes of
netdev_hw_addr that were never initialized.
bonding and team already call dev_uc_flush() and dev_mc_flush()
between NETDEV_PRE_TYPE_CHANGE and the type change. Do the same
in tun, but only when addr_len changes: if it does not, existing
entries are still valid and there is no reason to drop them.
Fixes: cca8ea3b05c9 ("net: tun: set tun->dev->addr_len during TUNSETLINK processing")
Link: https://lore.kernel.org/netdev/20261116024056.1274402-1-bsdhenrymartin@gmail.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261118125443.1137177-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index b03628642c2c2..bf6703191b295 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3255,6 +3255,8 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
(unsigned short)arg == ARPHRD_6LOWPAN) {
ret = -EINVAL;
} else {
+ unsigned char addr_len = tun_get_addr_len(arg);
+
ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
tun->dev);
ret = notifier_to_errno(ret);
@@ -3263,8 +3265,13 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
"Refused to change device type\n");
break;
}
+ /* Addresses were added with the old dev->addr_len. */
+ if (addr_len != tun->dev->addr_len) {
+ dev_uc_flush(tun->dev);
+ dev_mc_flush(tun->dev);
+ }
tun->dev->type = (int) arg;
- tun->dev->addr_len = tun_get_addr_len(tun->dev->type);
+ tun->dev->addr_len = addr_len;
netif_info(tun, drv, tun->dev, "linktype set to %d\n",
tun->dev->type);
call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0854/1059] btrfs: send: fix invalid access to inline extents in clone_range()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (852 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0853/1059] tun: flush uc and mc addresses in TUNSETLINK Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0855/1059] btrfs: wait for a grace period before freeing a new device Greg Kroah-Hartman
` (144 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit beed53bd3cb5f0b0a0aad453aa6f0b49060ff2dc ]
We can't access the disk_bytenr and offset fields of a file extent item
that represents an inline extent, since the extent's data starts at the
offset of the disk_bytenr field and the offset field is after that, so
both fields point either to inline data or beyond the file extent item
in case the data is too small.
Fix this by not reading the disk_bytenr and offset fields if we are
dealing with an inline extent.
Link: https://sashiko.dev/#/bug/linux-b662b951-0491-465b-a262-f01a108d8146
Fixes: 040ee6120cb6 ("Btrfs: send, improve clone range")
Fixes: d906d49fc5f4 ("Btrfs: send, fix file corruption due to incorrect cloning operations")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/send.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index afab6a4e6a3c6..2ef340cad3085 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5755,7 +5755,7 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,
u8 type;
u64 ext_len;
u64 clone_len;
- u64 clone_data_offset;
+ u64 clone_data_offset = 0;
bool crossed_src_i_size = false;
if (slot >= btrfs_header_nritems(leaf)) {
@@ -5819,23 +5819,26 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,
crossed_src_i_size = true;
}
- clone_data_offset = btrfs_file_extent_offset(leaf, ei);
- if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte) {
- clone_root->offset = key.offset;
- if (clone_data_offset < data_offset &&
- clone_data_offset + ext_len > data_offset) {
- u64 extent_offset;
-
- extent_offset = data_offset - clone_data_offset;
- ext_len -= extent_offset;
- clone_data_offset += extent_offset;
- clone_root->offset += extent_offset;
+ if (type != BTRFS_FILE_EXTENT_INLINE) {
+ clone_data_offset = btrfs_file_extent_offset(leaf, ei);
+ if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte) {
+ clone_root->offset = key.offset;
+ if (clone_data_offset < data_offset &&
+ clone_data_offset + ext_len > data_offset) {
+ u64 extent_offset;
+
+ extent_offset = data_offset - clone_data_offset;
+ ext_len -= extent_offset;
+ clone_data_offset += extent_offset;
+ clone_root->offset += extent_offset;
+ }
}
}
clone_len = min_t(u64, ext_len, len);
- if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte &&
+ if (type != BTRFS_FILE_EXTENT_INLINE &&
+ btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte &&
clone_data_offset == data_offset) {
const u64 src_end = clone_root->offset + clone_len;
const u64 sectorsize = SZ_64K;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0855/1059] btrfs: wait for a grace period before freeing a new device
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (853 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0854/1059] btrfs: send: fix invalid access to inline extents in clone_range() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0856/1059] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params Greg Kroah-Hartman
` (143 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Binbin Deng,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit 38c94b99f8743a5b9aab864a12ecf9a06d36aeb4 ]
KASAN reports a slab-use-after-free in btrfs_statfs() walking
fs_devices->devices. btrfs_init_new_device() publishes the new device
with list_add_rcu() and can fail afterwards, for example with -ENOSPC
in init_first_rw_device() when a user with CAP_SYS_ADMIN adds a device
that is too small to a seeding filesystem mounted read-only. The error
path removes the entry with list_del_rcu() and frees the object in
btrfs_free_device() without waiting for a grace period, while
btrfs_calc_avail_data_space() and btrfs_ioctl_fs_info() keep reading
the device list under rcu_read_lock().
BUG: KASAN: slab-use-after-free in btrfs_statfs+0x11af/0x14a0
Read of size 8 at addr ffff8880096be858 by task poc/252
Call Trace:
<TASK>
dump_stack_lvl+0x53/0x70
print_report+0xd0/0x630
? __pfx__raw_spin_lock_irqsave+0x10/0x10
? filename_lookup+0x1a9/0x540
? btrfs_statfs+0x11af/0x14a0
kasan_report+0xce/0x100
? btrfs_statfs+0x11af/0x14a0
btrfs_statfs+0x11af/0x14a0
statfs_by_dentry+0x117/0x1e0
user_statfs+0xac/0x130
? __pfx_user_statfs+0x10/0x10
__do_sys_statfs+0x80/0xe0
? __pfx___do_sys_statfs+0x10/0x10
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Allocated by task 256:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0x8f/0xa0
__kmalloc_cache_noprof+0x158/0x370
btrfs_alloc_device+0xad/0x3e0
btrfs_init_new_device+0x3e8/0x36e0
btrfs_ioctl+0x150d/0x6c20
__x64_sys_ioctl+0x134/0x1c0
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 256:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x43/0x70
kfree+0x121/0x380
btrfs_init_new_device+0x4a0/0x36e0
btrfs_ioctl+0x150d/0x6c20
__x64_sys_ioctl+0x134/0x1c0
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Fix by waiting for an RCU grace period after the device is removed
from the list and before it is freed.Place the synchronize_rcu() after
dropping the mutexes and before the `error_trans` label.
Fixes: 1f78160ce1b1 ("Btrfs: using rcu lock in the reader side of devices list")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Binbin Deng <18983559317@163.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/volumes.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 4223defd9ca74..2ce649351e769 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3071,6 +3071,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
btrfs_rollback_sprout(fs_info, seed_devices);
mutex_unlock(&fs_info->chunk_mutex);
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
+ synchronize_rcu();
error_trans:
if (trans)
btrfs_end_transaction(trans);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0856/1059] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (854 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0855/1059] btrfs: wait for a grace period before freeing a new device Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0857/1059] ASoC: fsl_easrc: fix context ownership on repeated hw_params Greg Kroah-Hartman
` (142 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit fbeac9352de6584bd5eb7c23d2f224339772c992 ]
hw_params() can be called again without hw_free() in between, and
hw_free() is also called after a failed hw_params().
fsl_asrc_request_pair() always takes a new pair, so a second hw_params()
leaves the stream in two asrc->pair[] entries. Only one is released, and
after close the other points to freed memory, which is dereferenced by
fsl_asrc_isr() and fsl_asrc_m2m_suspend(). After a failed hw_params(),
fsl_asrc_release_pair() releases a stale index that may belong to
another running stream.
Keep the owned pair and only update its channels when it is requested
again, and ignore a pair the stream does not own on release.
Fixes: 3117bb3109dc ("ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-3-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_asrc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 4a1229c29b2e2..c906c6c2e4d69 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -210,6 +210,8 @@ static void fsl_asrc_sel_proc(int inrate, int outrate,
* It assigns pair by the order of A->C->B because allocation of pair B,
* within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A
* while pair A and pair C are comparatively independent.
+ *
+ * If @pair already owns a pair, it is kept and only its channels are updated.
*/
static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
{
@@ -221,6 +223,19 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
spin_lock_irqsave(&asrc->lock, lock_flags);
+ if (asrc->pair[pair->index] == pair) {
+ if (asrc->channel_avail + pair->channels < channels) {
+ dev_err(dev, "can't afford required channels: %d\n", channels);
+ return -EINVAL;
+ }
+
+ asrc->channel_avail += pair->channels;
+ asrc->channel_avail -= channels;
+ pair->channels = channels;
+
+ return 0;
+ }
+
for (i = ASRC_PAIR_A; i < ASRC_PAIR_MAX_NUM; i++) {
if (asrc->pair[i] != NULL)
continue;
@@ -254,6 +269,7 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
* @pair: pair to release
*
* It clears the resource from asrc and releases the occupied channels.
+ * Nothing is done if @pair does not own a pair.
*/
static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
{
@@ -261,6 +277,12 @@ static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
enum asrc_pair_index index = pair->index;
unsigned long lock_flags;
+ /* Only the owner clears its entry, so it cannot change after this check */
+ scoped_guard(spinlock_irqsave, &asrc->lock) {
+ if (asrc->pair[index] != pair)
+ return;
+ }
+
/* Make sure the pair is disabled */
regmap_update_bits(asrc->regmap, REG_ASRCTR,
ASRCTR_ASRCEi_MASK(index), 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0857/1059] ASoC: fsl_easrc: fix context ownership on repeated hw_params
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (855 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0856/1059] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0858/1059] ASoC: SOF: Add helper macro to be used to get an IPC ops Greg Kroah-Hartman
` (141 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit f50dfefe6d4dd8cf5e826353de21228b9f073e68 ]
hw_params() can be called again without hw_free() in between.
fsl_easrc_hw_params() then requests a second context while the stream
still owns the first one, which is never released. After close, that
easrc->pair[] entry points to freed memory and is dereferenced by
fsl_easrc_runtime_resume() on the next open.
The EASRC slots depend on the number of channels, so release the owned
context before requesting a new one, and make
fsl_easrc_release_context() ignore a context it does not own.
Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-5-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_easrc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 4c3b462512461..afdf0a5e65a98 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1353,6 +1353,10 @@ static void fsl_easrc_release_context(struct fsl_asrc_pair *ctx)
spin_lock_irqsave(&easrc->lock, lock_flags);
+ /* Nothing to release if the context is not owned by @ctx */
+ if (easrc->pair[ctx->index] != ctx)
+ return;
+
fsl_easrc_release_slot(easrc, ctx->index);
easrc->channel_avail += ctx->channels;
@@ -1508,6 +1512,12 @@ static int fsl_easrc_hw_params(struct snd_pcm_substream *substream,
snd_pcm_format_t format = params_format(params);
int ret;
+ /* hw_params() may be called again without hw_free() in between */
+ if (ctx_priv->ctx_streams & BIT(substream->stream)) {
+ ctx_priv->ctx_streams &= ~BIT(substream->stream);
+ fsl_easrc_release_context(ctx);
+ }
+
ret = fsl_easrc_request_context(channels, ctx);
if (ret) {
dev_err(dev, "failed to request context\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0858/1059] ASoC: SOF: Add helper macro to be used to get an IPC ops
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (856 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0857/1059] ASoC: fsl_easrc: fix context ownership on repeated hw_params Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0859/1059] ASoC: SOF: control: Extend the optionality of IPC ops to IPC as well Greg Kroah-Hartman
` (140 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Ujfalusi, Pierre-Louis Bossart,
Ranjani Sridharan, Bard Liao, Rander Wang, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
[ Upstream commit caf0f4662e07fcc721d1c85af82aa8a7d57621f3 ]
In preparation to a case when the DSP is not used.
In this case the IPC communication itself has no meaning and we might
not even have sdev->ipc allocated at all.
The sof_ipc_get_ops() macro can be used to get a named IPC ops struct or
return NULL if the sdev->ipc is not allocated.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221221102328.9635-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 3092b9e481fe ("ASoC: SOF: control: reject out-of-range enum values")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sof/sof-priv.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 77c9741fc1480..cf82c6cc40c86 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -495,6 +495,10 @@ struct snd_sof_ipc {
const struct sof_ipc_ops *ops;
};
+/* Helper to retrieve the IPC ops */
+#define sof_ipc_get_ops(sdev, ops_name) \
+ (((sdev)->ipc && (sdev)->ipc->ops) ? (sdev)->ipc->ops->ops_name : NULL)
+
/*
* SOF Device Level.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0859/1059] ASoC: SOF: control: Extend the optionality of IPC ops to IPC as well
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (857 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0858/1059] ASoC: SOF: Add helper macro to be used to get an IPC ops Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0860/1059] ASoC: SOF: control: reject out-of-range enum values Greg Kroah-Hartman
` (139 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Ujfalusi, Pierre-Louis Bossart,
Ranjani Sridharan, Bard Liao, Rander Wang, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
[ Upstream commit cfa12c3679b49d8758b94c778afa6a71abf19989 ]
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.
Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[tplg] == NULL
sdev->ipc->ops->[tplg]->control == NULL
sdev->ipc->ops->[tplg]->control->ops == NULL (treated optional currently)
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20221221102328.9635-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 3092b9e481fe ("ASoC: SOF: control: reject out-of-range enum values")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sof/control.c | 44 ++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index e0e9efd25d34e..75e13f4fd1eb8 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -22,9 +22,9 @@ int snd_sof_volume_get(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = sm->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->volume_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->volume_get)
return tplg_ops->control->volume_get(scontrol, ucontrol);
return 0;
@@ -37,9 +37,9 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = sm->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->volume_put)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->volume_put)
return tplg_ops->control->volume_put(scontrol, ucontrol);
return false;
@@ -74,9 +74,9 @@ int snd_sof_switch_get(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = sm->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->switch_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->switch_get)
return tplg_ops->control->switch_get(scontrol, ucontrol);
return 0;
@@ -89,9 +89,9 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = sm->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->switch_put)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->switch_put)
return tplg_ops->control->switch_put(scontrol, ucontrol);
return false;
@@ -104,9 +104,9 @@ int snd_sof_enum_get(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = se->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->enum_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->enum_get)
return tplg_ops->control->enum_get(scontrol, ucontrol);
return 0;
@@ -119,9 +119,9 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = se->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->enum_put)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->enum_put)
return tplg_ops->control->enum_put(scontrol, ucontrol);
return false;
@@ -134,9 +134,9 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = be->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->bytes_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->bytes_get)
return tplg_ops->control->bytes_get(scontrol, ucontrol);
return 0;
@@ -149,9 +149,9 @@ int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = be->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->bytes_put)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->bytes_put)
return tplg_ops->control->bytes_put(scontrol, ucontrol);
return 0;
@@ -165,13 +165,13 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = be->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
/* make sure we have at least a header */
if (size < sizeof(struct snd_ctl_tlv))
return -EINVAL;
- if (tplg_ops->control->bytes_ext_put)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->bytes_ext_put)
return tplg_ops->control->bytes_ext_put(scontrol, binary_data, size);
return 0;
@@ -184,7 +184,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _
struct snd_sof_control *scontrol = be->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
int ret, err;
ret = pm_runtime_resume_and_get(scomp->dev);
@@ -193,7 +193,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _
return ret;
}
- if (tplg_ops->control->bytes_ext_volatile_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->bytes_ext_volatile_get)
ret = tplg_ops->control->bytes_ext_volatile_get(scontrol, binary_data, size);
pm_runtime_mark_last_busy(scomp->dev);
@@ -212,9 +212,9 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
struct snd_sof_control *scontrol = be->dobj.private;
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
- if (tplg_ops->control->bytes_ext_get)
+ if (tplg_ops && tplg_ops->control && tplg_ops->control->bytes_ext_get)
return tplg_ops->control->bytes_ext_get(scontrol, binary_data, size);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0860/1059] ASoC: SOF: control: reject out-of-range enum values
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (858 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0859/1059] ASoC: SOF: control: Extend the optionality of IPC ops to IPC as well Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0861/1059] btrfs: handle btrfs_del_item errors in __btrfs_update_delayed_inode Greg Kroah-Hartman
` (138 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Mark Brown,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
[ Upstream commit 3092b9e481fedc413bf7acda9edc04b0bd8cb28a ]
snd_sof_enum_put() passes the item indexes from user space to the IPC
enum_put() op unchecked, and the IPC3 and IPC4 ops store them as they
are and send them to the DSP. With the IPC4 sof-hda-generic-2ch.tplg on
a Tiger Lake laptop, "Dmic0 Capture TDFB angle set enum" has 13 items
but accepts 13 and 0xffffffff, and reads them back. The ALSA mixer-test
selftest reports this as a write_invalid failure.
Reject indexes past the last item, as snd_soc_put_enum_double() does.
Fixes: c3078f539704 ("ASoC: SOF: Add Sound Open Firmware KControl support")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Link: https://patch.msgid.link/20261118103129.113970-1-kapoorarnav43@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sof/control.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index 75e13f4fd1eb8..8494f860c62dd 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -120,6 +120,11 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
+ unsigned int i;
+
+ for (i = 0; i < scontrol->num_channels; i++)
+ if (ucontrol->value.enumerated.item[i] >= se->items)
+ return -EINVAL;
if (tplg_ops && tplg_ops->control && tplg_ops->control->enum_put)
return tplg_ops->control->enum_put(scontrol, ucontrol);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0861/1059] btrfs: handle btrfs_del_item errors in __btrfs_update_delayed_inode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (859 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0860/1059] ASoC: SOF: control: reject out-of-range enum values Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0862/1059] btrfs: do not utilize goto to implement delayed inode ref deletion Greg Kroah-Hartman
` (137 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, void0red, David Sterba,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: void0red <void0red@gmail.com>
[ Upstream commit c06016a02a6e316d861f7dddd4b70419a47ded2f ]
Even if the slot is already read out, we may still need to re-balance
the tree, thus it can cause error in that btrfs_del_item() call and we
need to handle it properly.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: void0red <void0red@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 3100f46985fd ("btrfs: fix delayed inode count leak after failure to delete inode ref")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/delayed-inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 214168868ac08..05a138e96e77a 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1046,7 +1046,7 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
* so there is only one iref. The case that several irefs are
* in the same item doesn't exist.
*/
- btrfs_del_item(trans, root, path);
+ ret = btrfs_del_item(trans, root, path);
out:
btrfs_release_delayed_iref(node);
btrfs_release_path(path);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0862/1059] btrfs: do not utilize goto to implement delayed inode ref deletion
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (860 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0861/1059] btrfs: handle btrfs_del_item errors in __btrfs_update_delayed_inode Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0863/1059] btrfs: unfold transaction abort at __btrfs_update_delayed_inode() Greg Kroah-Hartman
` (136 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Filipe Manana, Qu Wenruo,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <wqu@suse.com>
[ Upstream commit 9ba7c686feb04f16088ca4523c204ed49b07fc0a ]
[PROBLEM]
The function __btrfs_update_delayed_inode() is doing something not
meeting the code standard of today:
path->slots[0]++
if (path->slots[0] >= btrfs_header_nritems(leaf))
goto search;
again:
if (!is_the_target_inode_ref())
goto out;
ret = btrfs_delete_item();
/* Some cleanup. */
return ret;
search:
ret = search_for_the_last_inode_ref();
goto again;
With the tag named "again", it's pretty common to think it's a loop, but
the truth is, we only need to do the search once, to locate the last
(also the first, since there should only be one INODE_REF or
INODE_EXTREF now) ref of the inode.
[FIX]
Instead of the weird jumps, just do them in a stream-lined fashion.
This removes those weird labels, and add extra comments on why we can do
the different searches.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 3100f46985fd ("btrfs: fix delayed inode count leak after failure to delete inode ref")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/delayed-inode.c | 45 +++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 05a138e96e77a..c8bf2f9c84471 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1029,14 +1029,33 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
if (!test_bit(BTRFS_DELAYED_NODE_DEL_IREF, &node->flags))
goto out;
- path->slots[0]++;
- if (path->slots[0] >= btrfs_header_nritems(leaf))
- goto search;
-again:
+ /*
+ * Now we're going to delete the INODE_REF/EXTREF, which should be the
+ * only one ref left. Check if the next item is an INODE_REF/EXTREF.
+ *
+ * But if we're the last item already, release and search for the last
+ * INODE_REF/EXTREF.
+ */
+ if (path->slots[0] + 1 >= btrfs_header_nritems(leaf)) {
+ key.objectid = node->inode_id;
+ key.type = BTRFS_INODE_EXTREF_KEY;
+ key.offset = (u64)-1;
+
+ btrfs_release_path(path);
+ ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
+ if (ret < 0)
+ goto err_out;
+ ASSERT(ret > 0);
+ ASSERT(path->slots[0] > 0);
+ ret = 0;
+ path->slots[0]--;
+ leaf = path->nodes[0];
+ } else {
+ path->slots[0]++;
+ }
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
if (key.objectid != node->inode_id)
goto out;
-
if (key.type != BTRFS_INODE_REF_KEY &&
key.type != BTRFS_INODE_EXTREF_KEY)
goto out;
@@ -1063,22 +1082,6 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
btrfs_abort_transaction(trans, ret);
return ret;
-
-search:
- btrfs_release_path(path);
-
- key.type = BTRFS_INODE_EXTREF_KEY;
- key.offset = -1;
-
- ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
- if (ret < 0)
- goto err_out;
- ASSERT(ret);
-
- ret = 0;
- leaf = path->nodes[0];
- path->slots[0]--;
- goto again;
}
static inline int btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0863/1059] btrfs: unfold transaction abort at __btrfs_update_delayed_inode()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (861 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0862/1059] btrfs: do not utilize goto to implement delayed inode ref deletion Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0864/1059] btrfs: fix delayed inode count leak after failure to delete inode ref Greg Kroah-Hartman
` (135 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 35bb03e57aa7d1ed8203b802d306089d64664d52 ]
We have a common error path where we abort the transaction, but like this
in case we get a transaction abort stack trace we don't know exactly which
previous function call failed. Instead abort the transaction after any
function call that returns an error, so that we can easily identify which
function failed.
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 3100f46985fd ("btrfs: fix delayed inode count leak after failure to delete inode ref")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/delayed-inode.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index c8bf2f9c84471..269326633d1a9 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1016,8 +1016,16 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
ret = btrfs_lookup_inode(trans, root, path, &key, mod);
if (ret > 0)
ret = -ENOENT;
- if (ret < 0)
+ if (ret < 0) {
+ /*
+ * If we fail to update the delayed inode we need to abort the
+ * transaction, because we could leave the inode with the
+ * improper counts behind.
+ */
+ if (ret != -ENOENT)
+ btrfs_abort_transaction(trans, ret);
goto out;
+ }
leaf = path->nodes[0];
inode_item = btrfs_item_ptr(leaf, path->slots[0],
@@ -1043,8 +1051,10 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
- if (ret < 0)
+ if (ret < 0) {
+ btrfs_abort_transaction(trans, ret);
goto err_out;
+ }
ASSERT(ret > 0);
ASSERT(path->slots[0] > 0);
ret = 0;
@@ -1066,21 +1076,14 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
* in the same item doesn't exist.
*/
ret = btrfs_del_item(trans, root, path);
+ if (ret < 0)
+ btrfs_abort_transaction(trans, ret);
out:
btrfs_release_delayed_iref(node);
btrfs_release_path(path);
err_out:
btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0));
btrfs_release_delayed_inode(node);
-
- /*
- * If we fail to update the delayed inode we need to abort the
- * transaction, because we could leave the inode with the improper
- * counts behind.
- */
- if (ret && ret != -ENOENT)
- btrfs_abort_transaction(trans, ret);
-
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0864/1059] btrfs: fix delayed inode count leak after failure to delete inode ref
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (862 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0863/1059] btrfs: unfold transaction abort at __btrfs_update_delayed_inode() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0865/1059] jbd2: set JBD2_LOADED under j_state_lock Greg Kroah-Hartman
` (134 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 3100f46985fd14148e79a0e79912180934ef7231 ]
When updating a delayed inode, if we have an inode ref to delete (the flag
BTRFS_DELAYED_NODE_DEL_IREF is set) and we fail the deletion of the inode
ref item (if it's in another leaf), we abort the transaction and then
never release the delayed count for the inode ref deletion (by calling
btrfs_release_delayed_iref()), resulting in a permanent leak of the
delayed inode.
Fix this by jumping to the 'out' label instead and removing the now no
longer necessary 'err_out' label.
Fixes: 67de11769bd5 ("Btrfs: introduce the delayed inode ref deletion for the single link inode")
Link: https://sashiko.dev/#/bug/linux-3520c6eb-7928-477d-b369-9caff2b98d10
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/delayed-inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 269326633d1a9..ca623074008e1 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1053,7 +1053,7 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
- goto err_out;
+ goto out;
}
ASSERT(ret > 0);
ASSERT(path->slots[0] > 0);
@@ -1081,7 +1081,6 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
out:
btrfs_release_delayed_iref(node);
btrfs_release_path(path);
-err_out:
btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0));
btrfs_release_delayed_inode(node);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0865/1059] jbd2: set JBD2_LOADED under j_state_lock
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (863 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0864/1059] btrfs: fix delayed inode count leak after failure to delete inode ref Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0866/1059] net: sock_reuseport: Check program type on the migration path Greg Kroah-Hartman
` (133 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Göttsche, Jan Kara,
Theodore Tso, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Göttsche <cgzones@googlemail.com>
[ Upstream commit 40e53dad45a92e932156de23a69c991f3e2512c9 ]
j_flags is protected by j_state_lock, with only quick racy checks done
without it. jbd2_journal_load() however sets JBD2_LOADED with a plain
read-modify-write after journal_reset() has already started kjournald2,
which tests and may update j_flags under the lock. KCSAN reports this
while mounting the root file system:
BUG: KCSAN: data-race in jbd2_journal_load / kjournald2
write to 0xffff9c6b012c6000 of 8 bytes by task 1 on cpu 3:
jbd2_journal_load+0x279/0x3c0
ext4_fill_super+0x34dc/0x5740
get_tree_bdev_flags+0x21d/0x340
...
read to 0xffff9c6b012c6000 of 8 bytes by task 77 on cpu 0:
kjournald2+0xc8/0x3e0
kthread+0x1bd/0x200
...
value changed: 0x00000000000000a8 -> 0x00000000000000b8
A concurrent update of another flag, e.g. JBD2_ABORT, could be lost.
Take j_state_lock when setting JBD2_LOADED, like the other writers of
j_flags do.
Fixes: 470decc613ab ("[PATCH] jbd2: initial copy of files from jbd")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260928202159.2463182-1-cgoettsche@seltendoof.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/jbd2/journal.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 4d26457f2e906..36c940001249e 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2117,7 +2117,10 @@ int jbd2_journal_load(journal_t *journal)
if (journal_reset(journal))
goto recovery_error;
+ /* kjournald2 is already running, see journal_reset(). */
+ write_lock(&journal->j_state_lock);
journal->j_flags |= JBD2_LOADED;
+ write_unlock(&journal->j_state_lock);
return 0;
recovery_error:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0866/1059] net: sock_reuseport: Check program type on the migration path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (864 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0865/1059] jbd2: set JBD2_LOADED under j_state_lock Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0867/1059] ftrace: Fix lost recursion records in ftrace_record_recursion() Greg Kroah-Hartman
` (132 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shihuang Liu, Alexei Starovoitov,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shihuang Liu <shlomojune6@gmail.com>
[ Upstream commit cbaaeff649b7aa09170cb31db001e5468c2726c0 ]
A BPF_PROG_TYPE_SOCKET_FILTER program can be loaded with
expected_attach_type set to BPF_SK_REUSEPORT_SELECT_OR_MIGRATE and
attached to a SO_REUSEPORT TCP group. Closing a listener that still
has queued children then runs it with a struct sk_reuseport_kern
context even though it was verified against struct sk_buff, which
KASAN reports as a stack-out-of-bounds in ___bpf_prog_run().
Reaching this without CAP_BPF requires
kernel.unprivileged_bpf_disabled=0; with
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y, the Kconfig default, the sysctl
starts at 2.
reuseport_migrate_sock() decides from prog->expected_attach_type
alone, a field user space sets that does not identify the program
type. Require BPF_PROG_TYPE_SK_REUSEPORT there and in
reuseport_stop_listen_sock(); socket filters still work as
selectors, so the selection path is unchanged.
Fixes: d5e4ddaeb6ab ("bpf: Support socket migration by eBPF.")
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20261118153541.172499-1-shlomojune6@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock_reuseport.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
index e7685956b09d7..fe6cec288fb11 100644
--- a/net/core/sock_reuseport.c
+++ b/net/core/sock_reuseport.c
@@ -461,6 +461,18 @@ void reuseport_detach_sock(struct sock *sk)
}
EXPORT_SYMBOL(reuseport_detach_sock);
+/*
+ * Only a BPF_PROG_TYPE_SK_REUSEPORT program is verified against
+ * struct sk_reuseport_kern, which is the context bpf_run_sk_reuseport()
+ * passes to it. expected_attach_type is set by user space and does not
+ * identify the program type.
+ */
+static bool reuseport_is_migration_prog(const struct bpf_prog *prog)
+{
+ return prog && prog->type == BPF_PROG_TYPE_SK_REUSEPORT &&
+ prog->expected_attach_type == BPF_SK_REUSEPORT_SELECT_OR_MIGRATE;
+}
+
void reuseport_stop_listen_sock(struct sock *sk)
{
if (sk->sk_protocol == IPPROTO_TCP) {
@@ -475,7 +487,7 @@ void reuseport_stop_listen_sock(struct sock *sk)
lockdep_is_held(&reuseport_lock));
if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_migrate_req) ||
- (prog && prog->expected_attach_type == BPF_SK_REUSEPORT_SELECT_OR_MIGRATE)) {
+ reuseport_is_migration_prog(prog)) {
/* Migration capable, move sk from the listening section
* to the closed section.
*/
@@ -645,7 +657,7 @@ struct sock *reuseport_migrate_sock(struct sock *sk,
hash = migrating_sk->sk_hash;
prog = rcu_dereference(reuse->prog);
- if (!prog || prog->expected_attach_type != BPF_SK_REUSEPORT_SELECT_OR_MIGRATE) {
+ if (!reuseport_is_migration_prog(prog)) {
if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_migrate_req))
goto select_by_hash;
goto failure;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0867/1059] ftrace: Fix lost recursion records in ftrace_record_recursion()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (865 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0866/1059] net: sock_reuseport: Check program type on the migration path Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0868/1059] net: dsa: b53: initialize the jumbo frame size register offset Greg Kroah-Hartman
` (131 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Steven Rostedt,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
[ Upstream commit 7792e21d0a6e2fa819209949e8ba957504bedcd4 ]
cached_function is set to the current ip before the cmpxchg() that
claims a slot in recursed_functions[]. When that cmpxchg() loses a
race for the same slot, the code bumps index and retries via "goto
again", but the retry immediately matches its own cached_function
write and returns without ever reaching the bumped-index cmpxchg().
Concretely, for two writers racing on the same index:
CPU 0 (ip = A) CPU 1 (ip = B)
-------------- --------------
cmpxchg(&recursed_functions[index].ip,
0, B); // succeeds
cached_function = A;
cmpxchg(&recursed_functions[index].ip,
0, A);
// fails, old == B
index++;
goto again;
if (A == cached_function) // true: matches A's own store
return; // A is dropped, not retried
Once dropped this way, cached_function stays set to A, so every later
recursion of A also hits the fast path and returns before reaching the
retry, until some unrelated ip overwrites the cache.
Set cached_function only after the cmpxchg() has claimed the slot. The
retry path then leaves the cache untouched and no longer matches its
own store. When the cmpxchg() finds ip already present, the writer
that installed it sets the cache.
The bug was found with the help of an LLM.
Link: https://patch.msgid.link/20261026182553.221141-1-parri.andrea@gmail.com
Fixes: 773c16705058e ("ftrace: Add recording of functions that caused recursion")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_recursion_record.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
index a520b11afb0dd..800569b647178 100644
--- a/kernel/trace/trace_recursion_record.c
+++ b/kernel/trace/trace_recursion_record.c
@@ -17,8 +17,8 @@ static struct recursed_functions recursed_functions[CONFIG_FTRACE_RECORD_RECURSI
static atomic_t nr_records;
/*
- * Cache the last found function. Yes, updates to this is racey, but
- * so is memory cache ;-)
+ * Cache the last function found in or added to recursed_functions[].
+ * Updates to this are racy, but this is only a best-effort cache.
*/
static unsigned long cached_function;
@@ -67,24 +67,25 @@ void ftrace_record_recursion(unsigned long ip, unsigned long parent_ip)
}
}
- cached_function = ip;
-
/*
* We only want to add a function if it hasn't been added before.
- * Add to the current location before incrementing the count.
- * If it fails to add, then increment the index (save in i)
- * and try again.
+ * Claim the current slot before incrementing the count. If the slot
+ * is occupied by another function, advance to the next slot and retry.
+ *
+ * Do not update cached_function until ip is known to be present;
+ * otherwise the retry would match its own cache update.
*/
old = cmpxchg(&recursed_functions[index].ip, 0, ip);
if (old != 0) {
/* Did something else already added this for us? */
if (old == ip)
return;
- /* Try the next location (use i for the next index) */
+ /* Try the next location */
index++;
goto again;
}
+ cached_function = ip;
recursed_functions[index].parent_ip = parent_ip;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0868/1059] net: dsa: b53: initialize the jumbo frame size register offset
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (866 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0867/1059] ftrace: Fix lost recursion records in ftrace_record_recursion() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0869/1059] net: dsa: b53: fix the SRAB grant timeout check Greg Kroah-Hartman
` (130 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 5d30a02245c375a9c5e557b1b7476710c4a94a2d ]
The chip data specifies both the jumbo port mask and frame size register
offsets, but b53_switch_init() only copies the former into the device.
Since the device is zero-initialized, b53_set_jumbo() writes the frame
size to offset zero instead of the chip-specific size register at 0x05
or 0x08.
Copy jumbo_size_reg from the chip data along with jumbo_pm_reg so frame
size updates reach the intended register.
Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 5c7c75eb5a815..06d01f1de4164 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2717,6 +2717,7 @@ static int b53_switch_init(struct b53_device *dev)
dev->vta_regs[1] = chip->vta_regs[1];
dev->vta_regs[2] = chip->vta_regs[2];
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
+ dev->jumbo_size_reg = chip->jumbo_size_reg;
dev->imp_port = chip->imp_port;
dev->num_vlans = chip->vlans;
dev->num_arl_bins = chip->arl_bins;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0869/1059] net: dsa: b53: fix the SRAB grant timeout check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (867 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0868/1059] net: dsa: b53: initialize the jumbo frame size register offset Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0870/1059] net: dsa: b53: use the correct override register 2 Gbps bit Greg Kroah-Hartman
` (129 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Daniel Machon,
Florian Fainelli, Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit bd7fc60896b3de8ce677142142c96277377e5167 ]
b53_srab_request_grant() polls for a grant up to 20 times, but checks for
an iteration count of five to detect a timeout. This rejects a grant
received on the sixth poll and reports success when all 20 polls finish
without a grant. The latter allows a register access to proceed without
ownership of the switch resources.
Check for exhaustion of all 20 iterations instead.
Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_srab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c
index bcb44034404d3..e306a7bb746a9 100644
--- a/drivers/net/dsa/b53/b53_srab.c
+++ b/drivers/net/dsa/b53/b53_srab.c
@@ -105,7 +105,7 @@ static int b53_srab_request_grant(struct b53_device *dev)
break;
usleep_range(10, 100);
}
- if (WARN_ON(i == 5))
+ if (WARN_ON(i == 20))
return -EIO;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0870/1059] net: dsa: b53: use the correct override register 2 Gbps bit
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (868 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0869/1059] net: dsa: b53: fix the SRAB grant timeout check Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0871/1059] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Greg Kroah-Hartman
` (128 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit fd2752aac6c2193507af2e96cfc1406b28cade6f ]
The IMP and per-port GMII override registers swap the override-enable and 2
Gbps speed bits. Using the IMP speed bit on a GMII port clears its override
enable and leaves any previous 2 Gbps selection intact. Select the speed
bit alongside the register and enable bit so lower speeds clear the correct
bit and 2 Gbps sets it.
Fixes: b6a8a5477fe9 ("net: dsa: b53: fix resetting speed and pause on forced link")
Fixes: 41af38324341 ("net: dsa: b53: restore the NSP IMP port 2 Gbps mode")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 06d01f1de4164..d8a9c02c279e8 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1252,17 +1252,19 @@ static void b53_force_port_config(struct b53_device *dev, int port,
int speed, int duplex,
bool tx_pause, bool rx_pause)
{
- u8 reg, val, off;
+ u8 reg, val, off, speed2000;
/* Override the port settings */
if (port == dev->imp_port) {
off = B53_PORT_OVERRIDE_CTRL;
val = PORT_OVERRIDE_EN;
+ speed2000 = PORT_OVERRIDE_SPEED_2000M;
} else if (is5325(dev)) {
return;
} else {
off = B53_GMII_PORT_OVERRIDE_CTRL(port);
val = GMII_PO_EN;
+ speed2000 = GMII_PO_SPEED_2000M;
}
b53_read8(dev, B53_CTRL_PAGE, off, ®);
@@ -1274,11 +1276,12 @@ static void b53_force_port_config(struct b53_device *dev, int port,
reg &= ~(0x3 << GMII_PO_SPEED_S);
if (is5301x(dev) || is58xx(dev))
- reg &= ~PORT_OVERRIDE_SPEED_2000M;
+ reg &= ~speed2000;
switch (speed) {
case 2000:
- reg |= PORT_OVERRIDE_SPEED_2000M;
+ if (is5301x(dev) || is58xx(dev))
+ reg |= speed2000;
fallthrough;
case SPEED_1000:
reg |= PORT_OVERRIDE_SPEED_1000M;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0871/1059] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (869 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0870/1059] net: dsa: b53: use the correct override register 2 Gbps bit Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0872/1059] linux/dim: move useful macros to .h file Greg Kroah-Hartman
` (127 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Willem de Bruijn,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 000d468855945953c491810f97fb0bd4166b0b07 ]
BCM5325 and BCM5365 use an 11-bit bitmap for the mirror capture port,
whereas newer switches use a four-bit port ID. Programming the port
number directly can select no destination or the wrong destination, and
can select multiple destinations. For example, port 2 requires BIT(2),
but writing 2 selects port 1 instead.
Use the bitmap encoding on BCM5325 and BCM5365, including translating
logical CPU port 5 to hardware bit 8. Apply the corresponding field mask
when checking for a conflicting destination, replacing the destination,
and clearing it after the last mirror source is removed. Keep the port ID
encoding for newer switches.
The ingress and egress mirror source masks use the same layout on these
switches, with the CPU port at bit 8 and bits 5-7 reserved, so apply the
same translation when setting and clearing a source port bit.
Fixes: ed3af5fd08eb ("net: dsa: b53: Add support for port mirroring")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 35 +++++++++++++++++++++++++++-----
drivers/net/dsa/b53/b53_regs.h | 1 +
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index d8a9c02c279e8..af2cd7e50a3b1 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2223,6 +2223,31 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
}
EXPORT_SYMBOL(b53_get_tag_protocol);
+static u16 b53_mirror_capture_port_mask(struct b53_device *dev)
+{
+ if (is5325(dev) || is5365(dev))
+ return CAP_PORT_MASK_25;
+
+ return CAP_PORT_MASK;
+}
+
+static u16 b53_mirror_port_mask(struct b53_device *dev, int port)
+{
+ /* These switches use a bitmap with the CPU port at bit 8. */
+ if ((is5325(dev) || is5365(dev)) && port == B53_CPU_PORT_25)
+ port = B53_CPU_PORT;
+
+ return BIT(port);
+}
+
+static u16 b53_mirror_capture_port(struct b53_device *dev, int port)
+{
+ if (is5325(dev) || is5365(dev))
+ return b53_mirror_port_mask(dev, port);
+
+ return port;
+}
+
int b53_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
struct netlink_ext_ack *extack)
@@ -2236,12 +2261,12 @@ int b53_mirror_add(struct dsa_switch *ds, int port,
loc = B53_EG_MIR_CTL;
b53_read16(dev, B53_MGMT_PAGE, loc, ®);
- reg |= BIT(port);
+ reg |= b53_mirror_port_mask(dev, port);
b53_write16(dev, B53_MGMT_PAGE, loc, reg);
b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
- reg &= ~CAP_PORT_MASK;
- reg |= mirror->to_local_port;
+ reg &= ~b53_mirror_capture_port_mask(dev);
+ reg |= b53_mirror_capture_port(dev, mirror->to_local_port);
reg |= MIRROR_EN;
b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
@@ -2263,7 +2288,7 @@ void b53_mirror_del(struct dsa_switch *ds, int port,
/* Update the desired ingress/egress register */
b53_read16(dev, B53_MGMT_PAGE, loc, ®);
- reg &= ~BIT(port);
+ reg &= ~b53_mirror_port_mask(dev, port);
if (!(reg & MIRROR_MASK))
loc_disable = true;
b53_write16(dev, B53_MGMT_PAGE, loc, reg);
@@ -2282,7 +2307,7 @@ void b53_mirror_del(struct dsa_switch *ds, int port,
/* Both no longer have ports, let's disable mirroring */
if (loc_disable && other_loc_disable) {
reg &= ~MIRROR_EN;
- reg &= ~mirror->to_local_port;
+ reg &= ~b53_mirror_capture_port_mask(dev);
}
b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
}
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index 0b4343fcfcfd8..7b025662c75d1 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -220,6 +220,7 @@
/* Mirror capture control register (16 bit) */
#define B53_MIR_CAP_CTL 0x10
#define CAP_PORT_MASK 0xf
+#define CAP_PORT_MASK_25 0x7ff
#define BLK_NOT_MIR BIT(14)
#define MIRROR_EN BIT(15)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0872/1059] linux/dim: move useful macros to .h file
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (870 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0871/1059] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0873/1059] net: bcmgenet: use napi_complete_done return value Greg Kroah-Hartman
` (126 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heng Qi, Simon Horman,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heng Qi <hengqi@linux.alibaba.com>
[ Upstream commit 0e942053e4dc42a760f48c1981f3239825430f15 ]
Useful macros will be used effectively elsewhere.
These will be utilized in subsequent patches.
Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240621101353.107425-2-hengqi@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: aa5a537ec43c ("net: bcmgenet: keep DIM from getting stuck after close or suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/dim.h | 7 +++++++
lib/dim/net_dim.c | 6 ------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/linux/dim.h b/include/linux/dim.h
index f343bc9aa2ec9..43398f5eade2a 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -10,6 +10,13 @@
#include <linux/types.h>
#include <linux/workqueue.h>
+/* Number of DIM profiles and period mode. */
+#define NET_DIM_PARAMS_NUM_PROFILES 5
+#define NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE 256
+#define NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE 128
+#define NET_DIM_DEF_PROFILE_CQE 1
+#define NET_DIM_DEF_PROFILE_EQE 1
+
/*
* Number of events between DIM iterations.
* Causes a moderation of the algorithm run.
diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
index 4e32f7aaac86c..67d5beb34dc31 100644
--- a/lib/dim/net_dim.c
+++ b/lib/dim/net_dim.c
@@ -11,12 +11,6 @@
* There are different set of profiles for RX/TX CQs.
* Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES
*/
-#define NET_DIM_PARAMS_NUM_PROFILES 5
-#define NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE 256
-#define NET_DIM_DEFAULT_TX_CQ_PKTS_FROM_EQE 128
-#define NET_DIM_DEF_PROFILE_CQE 1
-#define NET_DIM_DEF_PROFILE_EQE 1
-
#define NET_DIM_RX_EQE_PROFILES { \
{.usec = 1, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \
{.usec = 8, .pkts = NET_DIM_DEFAULT_RX_CQ_PKTS_FROM_EQE,}, \
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0873/1059] net: bcmgenet: use napi_complete_done return value
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (871 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0872/1059] linux/dim: move useful macros to .h file Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0874/1059] net: bcmgenet: keep DIM from getting stuck after close or suspend Greg Kroah-Hartman
` (125 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zak Kemble, Florian Fainelli,
Jakub Kicinski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zak Kemble <zakkemble@gmail.com>
[ Upstream commit 28ed9bed5fb24e4235b8d6cffb5a5c68de710a25 ]
Make use of the return value from napi_complete_done(). This allows users to
use the gro_flush_timeout and napi_defer_hard_irqs sysfs attributes for
configuring software interrupt coalescing.
Signed-off-by: Zak Kemble <zakkemble@gmail.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20250610220403.935-2-zakkemble@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: aa5a537ec43c ("net: bcmgenet: keep DIM from getting stuck after close or suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 45bdfbad89fc8..f067a84d3dc70 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2431,10 +2431,8 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget)
work_done = bcmgenet_desc_rx(ring, budget);
- if (work_done < budget) {
- napi_complete_done(napi, work_done);
+ if (work_done < budget && napi_complete_done(napi, work_done))
bcmgenet_rx_ring_int_enable(ring);
- }
if (ring->dim.use_dim) {
dim_update_sample(ring->dim.event_ctr, ring->dim.packets,
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0874/1059] net: bcmgenet: keep DIM from getting stuck after close or suspend
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (872 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0873/1059] net: bcmgenet: use napi_complete_done return value Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0875/1059] net: bcmgenet: accumulate the DIM packet and byte counters Greg Kroah-Hartman
` (124 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit aa5a537ec43c13e4d2850468b0d88f97cce45dd3 ]
A close or WoL suspend cancels the pending profile work and can leave
DIM in DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive
coalescing then stays stuck after the next open or resume, and the
profile index no longer matches the hardware. The poll also calls
net_dim() after napi_complete_done(), so it can queue new work after
napi_disable() has returned.
Run net_dim() before completing NAPI and flush the work instead of
cancelling it, so the pending profile gets applied. Also reset the DIM
state on ring init and start from the default profile, which is what
bcmgenet_init_rx_coalesce() programs.
Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index f067a84d3dc70..d3a363de4ded7 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2431,15 +2431,16 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget)
work_done = bcmgenet_desc_rx(ring, budget);
- if (work_done < budget && napi_complete_done(napi, work_done))
- bcmgenet_rx_ring_int_enable(ring);
-
+ /* net_dim() can queue work, so run it while NAPI is still owned */
if (ring->dim.use_dim) {
dim_update_sample(ring->dim.event_ctr, ring->dim.packets,
ring->dim.bytes, &dim_sample);
net_dim(&ring->dim.dim, dim_sample);
}
+ if (work_done < budget && napi_complete_done(napi, work_done))
+ bcmgenet_rx_ring_int_enable(ring);
+
return work_done;
}
@@ -2633,8 +2634,11 @@ static void bcmgenet_init_dim(struct bcmgenet_rx_ring *ring,
{
struct bcmgenet_net_dim *dim = &ring->dim;
+ memset(&dim->dim, 0, sizeof(dim->dim));
INIT_WORK(&dim->dim.work, cb);
dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ /* Match the profile bcmgenet_init_rx_coalesce() programs */
+ dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
dim->event_ctr = 0;
dim->packets = 0;
dim->bytes = 0;
@@ -2876,7 +2880,8 @@ static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)
for (i = 0; i <= priv->hw_params->rx_queues; ++i) {
ring = &priv->rx_rings[i];
napi_disable(&ring->napi);
- cancel_work_sync(&ring->dim.dim.work);
+ /* Cancelling would leave DIM stuck in DIM_APPLY_NEW_PROFILE */
+ flush_work(&ring->dim.dim.work);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0875/1059] net: bcmgenet: accumulate the DIM packet and byte counters
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (873 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0874/1059] net: bcmgenet: keep DIM from getting stuck after close or suspend Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0876/1059] net: bcmgenet: reset the Rx discard count with the ring Greg Kroah-Hartman
` (123 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit a15079369636f4324d2985cede7ce7fbefddf4b3 ]
net_dim() computes rates from the difference between two samples and
needs running totals, but bcmgenet_desc_rx() passes the counts of the
last poll. Adaptive coalescing then picks profiles from wrong rates.
On a CM4 at a steady 300 Mbit/s UDP, DIM changed profile about 1000
times in 20 s. With the fix it settles, and Rx interrupts drop from about
4500/s to 2240/s.
Accumulate the counters instead.
Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index d3a363de4ded7..34ec41d900577 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2415,8 +2415,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
bcmgenet_rdma_ring_writel(priv, ring->index, ring->c_index, RDMA_CONS_INDEX);
}
- ring->dim.bytes = bytes_processed;
- ring->dim.packets = rxpktprocessed;
+ ring->dim.bytes += bytes_processed;
+ ring->dim.packets += rxpktprocessed;
return rxpktprocessed;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0876/1059] net: bcmgenet: reset the Rx discard count with the ring
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (874 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0875/1059] net: bcmgenet: accumulate the DIM packet and byte counters Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0877/1059] net: systemport: restart DIM from the default profile on start Greg Kroah-Hartman
` (122 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit e99faa3a16209ea5d0b83cc58b64785efd2d9045 ]
Ring init clears the hardware discard counter but not
ring->old_discards. Discards after an ifdown and ifup or a resume are
then missing from rx_missed. On a CM4, after an ifdown and ifup, 3666
discards showed up as 0 in rx_missed.
Reset old_discards together with the ring.
Fixes: d26ea6cc48da ("net: bcmgenet: collect Rx discarded packet count")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 34ec41d900577..86ce09a0880d7 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2731,6 +2731,8 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv,
ring->read_ptr = start_ptr;
ring->cb_ptr = start_ptr;
ring->end_ptr = end_ptr - 1;
+ /* Zeroing RDMA_PROD_INDEX below also clears the discard counter */
+ ring->old_discards = 0;
ret = bcmgenet_alloc_rx_buffers(priv, ring);
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0877/1059] net: systemport: restart DIM from the default profile on start
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (875 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0876/1059] net: bcmgenet: reset the Rx discard count with the ring Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0878/1059] net: systemport: accumulate the DIM packet and byte counters Greg Kroah-Hartman
` (121 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Willem de Bruijn,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit 8e428e263fa4fd3a752db8d9e1e584307f446aae ]
A close or suspend can cancel the pending profile work and leave DIM in
DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive coalescing
then stays stuck after the next open or resume. The poll also calls
net_dim() after napi_complete_done(), so it can queue new work after
napi_disable() has returned.
Run net_dim() before completing NAPI. Reset the DIM state on start and
begin from the default profile, which is what
bcm_sysport_init_rx_coalesce() programs.
Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c9e6a3583f2aa..790050a93662e 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1035,18 +1035,19 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
else
rdma_writel(priv, priv->rx_c_index << 16, RDMA_CONS_INDEX);
- if (work_done < budget) {
- napi_complete_done(napi, work_done);
- /* re-enable RX interrupts */
- intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
- }
-
+ /* net_dim() can queue work, so run it while NAPI is still owned */
if (priv->dim.use_dim) {
dim_update_sample(priv->dim.event_ctr, priv->dim.packets,
priv->dim.bytes, &dim_sample);
net_dim(&priv->dim.dim, dim_sample);
}
+ if (work_done < budget) {
+ napi_complete_done(napi, work_done);
+ /* re-enable RX interrupts */
+ intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
+ }
+
return work_done;
}
@@ -1475,8 +1476,11 @@ static void bcm_sysport_init_dim(struct bcm_sysport_priv *priv,
{
struct bcm_sysport_net_dim *dim = &priv->dim;
+ memset(&dim->dim, 0, sizeof(dim->dim));
INIT_WORK(&dim->dim.work, cb);
dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ /* Match the profile bcm_sysport_init_rx_coalesce() programs */
+ dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
dim->event_ctr = 0;
dim->packets = 0;
dim->bytes = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0878/1059] net: systemport: accumulate the DIM packet and byte counters
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (876 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0877/1059] net: systemport: restart DIM from the default profile on start Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0879/1059] tcp: Dont clear saddr before ->put_port() Greg Kroah-Hartman
` (120 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit 3e7e20beef4ec04f7601e92e78608333f2ab3904 ]
net_dim() computes rates from the difference between two samples and
needs running totals, but bcm_sysport_desc_rx() passes the counts of the
last poll. Adaptive coalescing then picks profiles from wrong rates.
Accumulate the counters instead.
Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalescing")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 790050a93662e..20f31893ae4b2 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -867,8 +867,8 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
priv->rx_read_ptr = 0;
}
- priv->dim.packets = processed;
- priv->dim.bytes = processed_bytes;
+ priv->dim.packets += processed;
+ priv->dim.bytes += processed_bytes;
return processed;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0879/1059] tcp: Dont clear saddr before ->put_port().
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (877 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0878/1059] net: systemport: accumulate the DIM packet and byte counters Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0880/1059] bpf: Do not allow bpf_d_path() by an id of another BTF Greg Kroah-Hartman
` (119 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Eric Dumazet,
Willem de Bruijn, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 1ab3fb564f20b78615a6d88b8c90da292f29e227 ]
When CGROUP_INET4_POST_BIND or CGROUP_INET6_POST_BIND prog fails,
__inet_bind() / __inet6_bind() calls sk->sk_prot->put_port().
For TCP, __inet_put_port() calls inet_bhashfn_portaddr() to get
the corresponding bhash2 bucket.
inet_bhashfn_portaddr() requires saddr, but it is cleared before
__inet_put_port(), leading to bhash2 lock mismatch.
This triggers list corruption or use-after-free by a conccurent
thread touching the same bhash2 bucket, e.g. tcp_diag_dump()
with TCPF_BOUND_INACTIVE. [0]
Let's clear saddr after calling sk->sk_prot->put_port().
[0]:
BUG: KASAN: slab-use-after-free in tcp_diag_dump (net/ipv4/tcp_diag.c:415)
Read of size 8 at addr ffff88810ae0e7a0 by task a/1007
CPU: 10 UID: 0 PID: 1007 Comm: a Not tainted 7.4.0-rc3-00456-gd5b89d55a322 #295 PREEMPT(lazy)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl (lib/dump_stack.c:120)
print_address_description (mm/kasan/report.c:378)
print_report (mm/kasan/report.c:482)
kasan_report (mm/kasan/report.c:595)
sock_recvmsg (net/socket.c:1154)
__sys_recvfrom (net/socket.c:2333)
__x64_sys_recvfrom (net/socket.c:2348 net/socket.c:2344 net/socket.c:2344)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
RIP: 0033:0x7f2f268f8e92
Code: 08 0f 85 91 41 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 55 bf 01 00
RSP: 002b:00007f2f26874d28 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: ffffffffffffffda RBX: 00007f2f26879ce4 RCX: 00007f2f268f8e92
RDX: 0000000000004000 RSI: 00007f2f26874db0 RDI: 00000000000007d7
RBP: 00007f2f26874d50 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000021
R13: 00007ffcbb216e70 R14: 0000000000000000 R15: 00007ffcbb216f77
</TASK>
Allocated by task 1009:
kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:79)
__kasan_slab_alloc (mm/kasan/common.c:354 mm/kasan/common.c:380)
kmem_cache_alloc_noprof (./include/linux/kasan.h:257 mm/slub.c:4720 mm/slub.c:5033 mm/slub.c:5047)
inet_bind2_bucket_create (net/ipv4/inet_hashtables.c:162)
inet_csk_get_port (net/ipv4/inet_connection_sock.c:573)
__inet_bind (net/ipv4/af_inet.c:544)
inet_bind_sk (net/ipv4/af_inet.c:470)
__sys_bind (net/socket.c:1947 net/socket.c:1978)
__x64_sys_bind (net/socket.c:1983 net/socket.c:1981 net/socket.c:1981)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
Freed by task 1009:
kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:79)
kasan_save_free_info (mm/kasan/generic.c:599)
__kasan_slab_free (mm/kasan/common.c:267 mm/kasan/common.c:299)
kmem_cache_free (./include/linux/kasan.h:239 mm/slub.c:2780 mm/slub.c:6637 mm/slub.c:6764)
inet_put_port (net/ipv4/inet_hashtables.c:178)
__inet_bind (net/ipv4/af_inet.c:554)
inet_bind_sk (net/ipv4/af_inet.c:470)
__sys_bind (net/socket.c:1947 net/socket.c:1978)
__x64_sys_bind (net/socket.c:1983 net/socket.c:1981 net/socket.c:1981)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The buggy address belongs to the object at ffff88810ae0e780
which belongs to the cache tcp_bind2_bucket of size 80
Fixes: 28044fc1d495 ("net: Add a bhash2 table hashed by port and address")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261121203537.341320-1-kuniyu@google.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/af_inet.c | 2 +-
net/ipv6/af_inet6.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 61a3ad6259a09..f2f9aec6057b9 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -532,9 +532,9 @@ int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
if (!(flags & BIND_FROM_BPF)) {
err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk);
if (err) {
- inet->inet_saddr = inet->inet_rcv_saddr = 0;
if (sk->sk_prot->put_port)
sk->sk_prot->put_port(sk);
+ inet->inet_saddr = inet->inet_rcv_saddr = 0;
goto out_release_sock;
}
}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 717f92db5ede8..9096576d6d055 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -421,10 +421,10 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
if (!(flags & BIND_FROM_BPF)) {
err = BPF_CGROUP_RUN_PROG_INET6_POST_BIND(sk);
if (err) {
- sk->sk_ipv6only = saved_ipv6only;
- inet_reset_saddr(sk);
if (sk->sk_prot->put_port)
sk->sk_prot->put_port(sk);
+ sk->sk_ipv6only = saved_ipv6only;
+ inet_reset_saddr(sk);
goto out;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0880/1059] bpf: Do not allow bpf_d_path() by an id of another BTF
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (878 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0879/1059] tcp: Dont clear saddr before ->put_port() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0881/1059] bpf: Add the symbol of a prog before its id Greg Kroah-Hartman
` (118 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 1139c7d8ffcd941d4860a75ef37eb1ffd15b4f87 ]
For a program that is attached to a program attach_btf_id is an id in
the BTF of the target. bpf_d_path_allowed() looks for it in a list of
kernel functions, it can match by chance. Do not look at the list when
there is a target program.
Fixes: 6e22ab9da793 ("bpf: Add d_path helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-5-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/bpf_trace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 5521556fedf25..2e0769b7f2fb2 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -957,6 +957,10 @@ BTF_SET_END(btf_allowlist_d_path)
static bool bpf_d_path_allowed(const struct bpf_prog *prog)
{
+ /* attach_btf_id is a function of the target program */
+ if (prog->aux->dst_prog)
+ return false;
+
if (prog->type == BPF_PROG_TYPE_TRACING &&
prog->expected_attach_type == BPF_TRACE_ITER)
return true;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0881/1059] bpf: Add the symbol of a prog before its id
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (879 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0880/1059] bpf: Do not allow bpf_d_path() by an id of another BTF Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0882/1059] bpf: Fix reads past an enum in prints of BTF data Greg Kroah-Hartman
` (117 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit f7a40c2de8d4abdea6d1e21122b447b593e28bd9 ]
A prog can be taken by its id and run before bpf_prog_kallsyms_add().
bpf_throw() does not find the main prog and oopses:
KASAN: null-ptr-deref in range [0x0000000000000568-0x000000000000056f]
RIP: 0010:bpf_throw+0x129/0x220
The exception table is found by the same symbol.
Add the symbol first. bpf_prog_free() removes it when there is no id.
Fixes: 3dec541b2e63 ("bpf: Add support for BTF pointers to x86 JIT")
Fixes: f18b03fabaa9 ("bpf: Implement BPF exceptions")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-15-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 2aa15b0aa0c0e..4d1a3523105ef 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2657,6 +2657,9 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr)
if (err < 0)
goto free_used_maps;
+ /* bpf_throw() and faults look for the symbol. The prog can run once it has the id. */
+ bpf_prog_kallsyms_add(prog);
+
err = bpf_prog_alloc_id(prog);
if (err)
goto free_used_maps;
@@ -2675,7 +2678,6 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr)
* Also, any failure handling from this point onwards must
* be using bpf_prog_put() given the program is exposed.
*/
- bpf_prog_kallsyms_add(prog);
perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_LOAD, 0);
bpf_audit_prog(prog, BPF_AUDIT_LOAD);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0882/1059] bpf: Fix reads past an enum in prints of BTF data
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (880 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0881/1059] bpf: Add the symbol of a prog before its id Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0883/1059] bpf: dont skip other information if xlated_prog_insns is skipped Greg Kroah-Hartman
` (116 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 6c8d5a113c2341a9fc12a6550c0645d5cda0d56d ]
An enum has 1, 2, 4 or 8 bytes. It's read as int, enum64 as u64,
whatever the size is. The file of a map in bpffs shows what is behind
a key or a value that ends with a short enum.
Read as many bytes as the type has. The check of a member of a struct
with bitfields takes any enum for 4 bytes, so an enum of 8 bytes can
stick out of it. Use the size there too.
Short enums are printed by their names. BTF with an enum that sticks
out of its struct is refused, compilers don't make it.
Fixes: 9eea98497951 ("bpf: fix BTF verification of enums")
Fixes: 6089fb325cf7 ("bpf: Add btf enum64 support")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-24-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/btf.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index d3934136af85a..44e23eb07d962 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -3688,7 +3688,7 @@ static int btf_enum_check_kflag_member(struct btf_verifier_env *env,
return -EINVAL;
}
- nr_bits = int_bitsize;
+ nr_bits = member_type->size * BITS_PER_BYTE;
} else if (nr_bits > int_bitsize) {
btf_verifier_log_member(env, struct_type, member,
"Invalid member bitfield_size");
@@ -3771,12 +3771,30 @@ static void btf_enum_log(struct btf_verifier_env *env,
btf_verifier_log(env, "size=%u vlen=%u", t->size, btf_type_vlen(t));
}
+static s64 btf_enum_read(const struct btf_type *t, const void *data)
+{
+ bool sign = btf_type_kflag(t);
+
+ switch (t->size) {
+ case 1:
+ return sign ? *(s8 *)data : *(u8 *)data;
+ case 2:
+ return sign ? *(s16 *)data : *(u16 *)data;
+ case 4:
+ return sign ? (s64)*(s32 *)data : *(u32 *)data;
+ default:
+ return *(s64 *)data;
+ }
+}
+
static void btf_enum_show(const struct btf *btf, const struct btf_type *t,
u32 type_id, void *data, u8 bits_offset,
struct btf_show *show)
{
const struct btf_enum *enums = btf_type_enum(t);
u32 i, nr_enums = btf_type_vlen(t);
+ /* Old compilers don't set the flag for negative values */
+ u32 mask = t->size < 4 ? BIT(t->size * BITS_PER_BYTE) - 1 : U32_MAX;
void *safe_data;
int v;
@@ -3784,10 +3802,10 @@ static void btf_enum_show(const struct btf *btf, const struct btf_type *t,
if (!safe_data)
return;
- v = *(int *)safe_data;
+ v = btf_enum_read(t, safe_data);
for (i = 0; i < nr_enums; i++) {
- if (v != enums[i].val)
+ if ((v ^ enums[i].val) & mask)
continue;
btf_show_type_value(show, "%s",
@@ -3887,7 +3905,7 @@ static void btf_enum64_show(const struct btf *btf, const struct btf_type *t,
if (!safe_data)
return;
- v = *(u64 *)safe_data;
+ v = btf_enum_read(t, safe_data);
for (i = 0; i < nr_enums; i++) {
if (v != btf_enum64_value(enums + i))
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0883/1059] bpf: dont skip other information if xlated_prog_insns is skipped
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (881 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0882/1059] bpf: Fix reads past an enum in prints of BTF data Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0884/1059] bpf: Require CAP_PERFMON for dumps of xlated insns Greg Kroah-Hartman
` (115 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Max Altgelt, Alexei Starovoitov,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Altgelt, Max (Nextron) <max.altgelt@nextron-systems.com>
[ Upstream commit 4722981cca373a338bbcf3a93ecf7144a892b03b ]
If xlated_prog_insns should not be exposed, other information
(such as func_info) still can and should be filled in.
Therefore, instead of directly terminating in this case,
continue with the normal flow.
Signed-off-by: Max Altgelt <max.altgelt@nextron-systems.com>
Link: https://lore.kernel.org/r/efd00fcec5e3e247af551632726e2a90c105fbd8.camel@nextron-systems.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: b8aa487429d4 ("bpf: Require CAP_PERFMON for dumps of xlated insns")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 4d1a3523105ef..87fc358fc8775 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -4103,19 +4103,19 @@ static int bpf_prog_get_info_by_fd(struct file *file,
struct bpf_insn *insns_sanitized;
bool fault;
- if (prog->blinded && !bpf_dump_raw_ok(file->f_cred)) {
+ if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) {
+ insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
+ if (!insns_sanitized)
+ return -ENOMEM;
+ uinsns = u64_to_user_ptr(info.xlated_prog_insns);
+ ulen = min_t(u32, info.xlated_prog_len, ulen);
+ fault = copy_to_user(uinsns, insns_sanitized, ulen);
+ kfree(insns_sanitized);
+ if (fault)
+ return -EFAULT;
+ } else {
info.xlated_prog_insns = 0;
- goto done;
}
- insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
- if (!insns_sanitized)
- return -ENOMEM;
- uinsns = u64_to_user_ptr(info.xlated_prog_insns);
- ulen = min_t(u32, info.xlated_prog_len, ulen);
- fault = copy_to_user(uinsns, insns_sanitized, ulen);
- kfree(insns_sanitized);
- if (fault)
- return -EFAULT;
}
if (bpf_prog_is_dev_bound(prog->aux)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0884/1059] bpf: Require CAP_PERFMON for dumps of xlated insns
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (882 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0883/1059] bpf: dont skip other information if xlated_prog_insns is skipped Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0885/1059] bpf: Clear the data that bpf_msg_push_data() adds Greg Kroah-Hartman
` (114 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit b8aa487429d46a72881933c026a6ca2a8e72d6d2 ]
The verifier puts addresses of the kernel to insns: for ksyms, inlined
helpers and hidden arguments. The dump of xlated insns hides the ones of
maps and calls only, the others look like constants by then. Give no
dump, as for a blinded program, to who has no CAP_PERFMON and can't read
kallsyms.
Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-30-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 87fc358fc8775..05b7f13e57e5b 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -4103,7 +4103,8 @@ static int bpf_prog_get_info_by_fd(struct file *file,
struct bpf_insn *insns_sanitized;
bool fault;
- if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) {
+ /* The verifier puts addresses to ld_imm64 and mov insns */
+ if (bpf_dump_raw_ok(file->f_cred) || (!prog->blinded && perfmon_capable())) {
insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
if (!insns_sanitized)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0885/1059] bpf: Clear the data that bpf_msg_push_data() adds
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (883 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0884/1059] bpf: Require CAP_PERFMON for dumps of xlated insns Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0886/1059] bpf: Fail loads from a network header that was not set Greg Kroah-Hartman
` (113 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 401fce9f48b1d684b92dbc08389d7c20bd036280 ]
The helper puts a new page into the message as the allocator gave it.
Bytes that the program does not write can be read by it, and are sent
to the peer. Allocate zeroed memory.
Fixes: 6fff607e2f14 ("bpf: sk_msg program helper bpf_msg_push_data")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-39-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index e4d5ad0512f34..b176ab515d737 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2825,7 +2825,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
if (unlikely(copy + len < copy))
return -EINVAL;
- page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP,
+ page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP | __GFP_ZERO,
get_order(copy + len));
if (unlikely(!page))
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0886/1059] bpf: Fail loads from a network header that was not set
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (884 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0885/1059] bpf: Clear the data that bpf_msg_push_data() adds Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0887/1059] bpf: Keep the MAC header in bpf_skb_change_tail() Greg Kroah-Hartman
` (112 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 766907cdaeefb57faddc5d09a49bdd4ce20a6272 ]
skb->network_header is 0 until something sets it. Loads at SKF_NET_OFF
and bpf_skb_load_bytes_relative() start at skb->head then, and read
headroom that nobody has written. qrtr and AF_XDP in copy mode make such
skbs.
Fail the load, like for the MAC header. A network header at skb->head
counts as set when skb->data or the MAC header is there too. CAN and
6LoWPAN make such skbs.
Fixes: 2e07fa9cd3ba ("[SK_BUFF]: Use offsets for skb->{mac,network,transport}_header on 64bit architectures")
Fixes: 0f5d82f187e1 ("net/filter: Permit reading NET in load_bytes_relative when MAC not set")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-40-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/filter.h | 9 +++++++++
kernel/bpf/core.c | 2 ++
net/core/filter.c | 5 ++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 673aef4e1465a..ce6237f5d1db9 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -722,6 +722,15 @@ static inline void bpf_restore_data_end(
cb->data_end = saved_data_end;
}
+/*
+ * If nothing has set the header, it points to headroom that was not written.
+ * The packet starts at skb->head when skb->data or the MAC header is there.
+ */
+static inline bool bpf_skb_has_network_header(const struct sk_buff *skb)
+{
+ return skb->network_header || !skb->mac_header || !skb_headroom(skb);
+}
+
static inline u8 *bpf_skb_cb(const struct sk_buff *skb)
{
/* eBPF programs may read/write skb->cb[] area to transfer meta
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index b73a6df03016b..3470ec89042eb 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -71,6 +71,8 @@ void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, uns
u8 *ptr = NULL;
if (k >= SKF_NET_OFF) {
+ if (unlikely(!bpf_skb_has_network_header(skb)))
+ return NULL;
ptr = skb_network_header(skb) + k - SKF_NET_OFF;
} else if (k >= SKF_LL_OFF) {
if (unlikely(!skb_mac_header_was_set(skb)))
diff --git a/net/core/filter.c b/net/core/filter.c
index b176ab515d737..d4a3da83d33d2 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -218,7 +218,8 @@ static int bpf_skb_load_helper_convert_offset(const struct sk_buff *skb, int off
return offset;
if (offset >= SKF_NET_OFF)
- return offset - SKF_NET_OFF + skb_network_offset(skb);
+ return bpf_skb_has_network_header(skb) ?
+ offset - SKF_NET_OFF + skb_network_offset(skb) : INT_MIN;
if (offset >= SKF_LL_OFF && skb_mac_header_was_set(skb))
return offset - SKF_LL_OFF + skb_mac_offset(skb);
@@ -1826,6 +1827,8 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb,
start = skb_mac_header(skb);
break;
case BPF_HDR_START_NET:
+ if (unlikely(!bpf_skb_has_network_header(skb)))
+ goto err_clear;
start = skb_network_header(skb);
break;
default:
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0887/1059] bpf: Keep the MAC header in bpf_skb_change_tail()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (885 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0886/1059] bpf: Fail loads from a network header that was not set Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:06 ` [PATCH 6.1 0888/1059] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Greg Kroah-Hartman
` (111 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 28ffeb9cb9722f39854f11e5f0511a4a8c12d9fb ]
The least length of the skb is the offset of the transport header when
it's set, also when that is below the offset of the network header.
Callers of tc programs count on a skb that is not shorter than mac_len.
Take the bigger one of the two offsets.
Fixes: 5293efe62df8 ("bpf: add bpf_skb_change_tail helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-44-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index d4a3da83d33d2..22a94e1c76970 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3827,7 +3827,7 @@ static u32 __bpf_skb_min_len(const struct sk_buff *skb)
if (skb_transport_header_was_set(skb)) {
offset = skb_transport_offset(skb);
if (offset > 0)
- min_len = offset;
+ min_len = max_t(u32, min_len, offset);
}
return min_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0888/1059] bpf, sockmap: Hold the psock of the work in sk_psock_backlog()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (886 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0887/1059] bpf: Keep the MAC header in bpf_skb_change_tail() Greg Kroah-Hartman
@ 2026-12-04 10:06 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0889/1059] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Greg Kroah-Hartman
` (110 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:06 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 9abfa0ad4f7606619586187152a0479efd306b13 ]
The socket can leave its map and come back after the test of
SK_PSOCK_TX_ENABLED. sk_psock_get() takes a reference to the new psock
then, and the work puts the old one that has none left. The new one and
its socket are never freed.
Take the reference that is put.
Fixes: 8259eb0e06d8 ("bpf, sockmap: Avoid using sk_socket after free when sending")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-46-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skmsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 02d3f2ddd25d0..62b4ff8603326 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -688,7 +688,7 @@ static void sk_psock_backlog(struct work_struct *work)
* before sk_socket freed. If refcnt increment fails, it indicates
* sock_map_close() completed with sk_socket potentially already freed.
*/
- if (!sk_psock_get(psock->sk))
+ if (!refcount_inc_not_zero(&psock->refcnt))
return;
mutex_lock(&psock->work_mutex);
while ((skb = skb_peek(&psock->ingress_skb))) {
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0889/1059] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (887 preceding siblings ...)
2026-12-04 10:06 ` [PATCH 6.1 0888/1059] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0890/1059] tg3: Skip management FW version when APE firmware is not ready Greg Kroah-Hartman
` (109 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rui Salvaterra, Pavan Chebbi,
Simon Horman, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavan Chebbi <pavan.chebbi@broadcom.com>
[ Upstream commit 686b8dbcedf8773dc505f9f315a0551c0bca70a3 ]
Commit 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for
BCM57766 chipsets") lowered the coherent DMA mask to 31 bits as a
workaround for a spurious address overflow error in the hardware.
The result of dma_set_coherent_mask() is fatal to probe, so on
platforms that cannot satisfy such a mask the device fails to probe:
tg3 0000:01:00.0: Unable to obtain 64 bit DMA for consistent allocations
tg3 0000:01:00.0: probe with driver tg3 failed with error -5
This was reported on a Mac mini (Macmini6,2, BCM57766) running a
kernel built without CONFIG_ZONE_DMA and with IOMMU passthrough as
the default. Without CONFIG_ZONE_DMA, dma_direct_supported() only
accepts a mask narrower than 32 bits if it covers the highest
physical memory address, so with direct mapping a 31-bit coherent
mask is rejected whenever memory extends above 2GB.
Treat the 31-bit mask as best effort. If it is refused, warn and fall
back to the mask used before 614f4d166eee, so that the device still
probes. Platforms that accept the mask are unaffected. Where it is
refused, 614f4d166eee never protected the device, it only stopped it
from probing, so this restores the behaviour of kernels before that
commit. Warn when a status block lands at an address matching the
pattern described in 614f4d166eee, so that a resulting TX timeout can
be identified.
Fixes: 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Link: https://lore.kernel.org/netdev/CALjTZvYKHWrD5m+RXimjxODvpFPw7Cq_EOEuzRi1PZT9_JxF+g@mail.gmail.com/
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-2-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index e983e1bca561a..81e241296ad33 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -8774,6 +8774,13 @@ static int tg3_alloc_consistent(struct tg3 *tp)
if (!tnapi->hw_status)
goto err_out;
+ if (tg3_asic_rev(tp) == ASIC_REV_57766 &&
+ (lower_32_bits(tnapi->status_mapping) & 0xffff0000) ==
+ 0xffff0000)
+ dev_warn(&tp->pdev->dev,
+ "Status block at DMA address %pad may cause TX timeouts on this device\n",
+ &tnapi->status_mapping);
+
sblk = tnapi->hw_status;
if (tg3_flag(tp, ENABLE_RSS)) {
@@ -17607,6 +17614,7 @@ static int tg3_init_one(struct pci_dev *pdev,
u64 dma_mask, persist_dma_mask;
netdev_features_t features = 0;
u8 addr[ETH_ALEN] __aligned(2);
+ u64 test_dma_mask = 0;
err = pci_enable_device(pdev);
if (err) {
@@ -17746,15 +17754,22 @@ static int tg3_init_one(struct pci_dev *pdev,
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
if (tg3_asic_rev(tp) == ASIC_REV_57766)
- persist_dma_mask = DMA_BIT_MASK(31);
+ test_dma_mask = DMA_BIT_MASK(31);
/* Configure DMA attributes. */
if (dma_mask > DMA_BIT_MASK(32)) {
err = dma_set_mask(&pdev->dev, dma_mask);
if (!err) {
features |= NETIF_F_HIGHDMA;
- err = dma_set_coherent_mask(&pdev->dev,
- persist_dma_mask);
+ if (!test_dma_mask ||
+ dma_set_coherent_mask(&pdev->dev,
+ test_dma_mask)) {
+ if (test_dma_mask)
+ dev_warn(&pdev->dev,
+ "Unable to set 31 bit coherent DMA mask, workaround not applied\n");
+ err = dma_set_coherent_mask(&pdev->dev,
+ persist_dma_mask);
+ }
if (err < 0) {
dev_err(&pdev->dev, "Unable to obtain 64 bit "
"DMA for consistent allocations\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0890/1059] tg3: Skip management FW version when APE firmware is not ready
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (888 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0889/1059] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0891/1059] tg3: Fix heap overflow in unbuffered NVRAM write path Greg Kroah-Hartman
` (108 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pavan Chebbi, Simon Horman,
Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavan Chebbi <pavan.chebbi@broadcom.com>
[ Upstream commit 70e57e1255e06fd7a22d45dd2bf854200fcbd575 ]
When the APE firmware is not present or not ready, for example when
the NCSI component is missing in the NVRAM, tg3_read_fw_ver() still
calls tg3_read_dash_ver() after tg3_probe_ncsi(). The signature and
ready checks that tg3_read_dash_ver() used to make were moved into
tg3_probe_ncsi(), which only sets the NCSI flag and does not stop the
caller. The driver then reads the APE firmware version register, which
holds no valid data in this state, and ethtool -i shows an invalid
"DASH" string with a garbage version.
Make tg3_probe_ncsi() return whether valid, ready APE firmware was
found, and read the version only in that case. Otherwise just report
the bootcode version.
This was seen by a user on BCM5719/BCM5720 with no NCSI component in
the NVRAM. With this change, ethtool -i displays only the bootcode
version.
Fixes: 165f4d1cb3d7 ("tg3: Fix the setting of the APE_HAS_NCSI flag")
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-3-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 81e241296ad33..64338c55c751c 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -15918,20 +15918,26 @@ static void tg3_read_mgmtfw_ver(struct tg3 *tp)
}
}
-static void tg3_probe_ncsi(struct tg3 *tp)
+/* Returns true if valid, ready APE firmware is present, regardless of
+ * whether it advertises NCSI (it may be DASH or SMASH). Sets APE_HAS_NCSI
+ * if the NCSI feature is advertised.
+ */
+static bool tg3_probe_ncsi(struct tg3 *tp)
{
u32 apedata;
apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG);
if (apedata != APE_SEG_SIG_MAGIC)
- return;
+ return false;
apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS);
if (!(apedata & APE_FW_STATUS_READY))
- return;
+ return false;
if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI)
tg3_flag_set(tp, APE_HAS_NCSI);
+
+ return true;
}
static void tg3_read_dash_ver(struct tg3 *tp)
@@ -16010,8 +16016,7 @@ static void tg3_read_fw_ver(struct tg3 *tp)
if (tg3_flag(tp, ENABLE_ASF)) {
if (tg3_flag(tp, ENABLE_APE)) {
- tg3_probe_ncsi(tp);
- if (!vpd_vers)
+ if (tg3_probe_ncsi(tp) && !vpd_vers)
tg3_read_dash_ver(tp);
} else if (!vpd_vers) {
tg3_read_mgmtfw_ver(tp);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0891/1059] tg3: Fix heap overflow in unbuffered NVRAM write path
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (889 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0890/1059] tg3: Skip management FW version when APE firmware is not ready Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0892/1059] gpio: davinci: use controller-specific MMIO for BINTEN Greg Kroah-Hartman
` (107 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shravya KN, Pavan Chebbi,
Simon Horman, Paolo Abeni, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shravya KN <shravya.k-n@broadcom.com>
[ Upstream commit 0323a427052447e2c41c650fc98a6c04bf417e5d ]
tg3_nvram_write_block_unbuffered() reads a whole NVRAM page into a
buffer of pagesize bytes, copies the caller's data into it at page_off,
and writes the page back. The copy size was clamped to pagesize rather
than to the room left in the page, pagesize - page_off, so a write at an
offset that is not page aligned, as ETHTOOL_SEEPROM allows, copies past
the end of the buffer and corrupts the kernel heap.
Clamp size to pagesize - page_off. Also advance buf by size on each
iteration. Without this, a write that spans more than one page
programmed every page after the first with the data of the first page,
and a write that did not start on a page boundary lost the tail of the
data without reporting an error.
Reject an nvram_pagesize that is smaller than 4 or not a power of two.
The page mask is pagesize - 1, which is only a valid mask for a power
of two. A page size of 0, which tg3_get_nvram_info() leaves unset for
an unhandled flash vendor, also made the loop issue erase commands at
address 0 forever with the rtnl and NVRAM locks held. ethtool -E now
fails with -EINVAL in these cases.
This was found by an AI code review scan. It has not been observed on
hardware, but it can be reached with ethtool -E on devices with
unbuffered flash.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-4-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 64338c55c751c..0c7d614aa0a54 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -56,6 +56,7 @@
#include <linux/hwmon-sysfs.h>
#include <linux/crc32poly.h>
#include <linux/dmi.h>
+#include <linux/log2.h>
#include <net/checksum.h>
#include <net/ip.h>
@@ -3379,6 +3380,9 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
u32 nvram_cmd;
u8 *tmp;
+ if (pagesize < 4 || !is_power_of_2(pagesize))
+ return -EINVAL;
+
tmp = kmalloc(pagesize, GFP_KERNEL);
if (tmp == NULL)
return -ENOMEM;
@@ -3399,13 +3403,14 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
break;
page_off = offset & pagemask;
- size = pagesize;
+ size = pagesize - page_off;
if (len < size)
size = len;
len -= size;
memcpy(tmp + page_off, buf, size);
+ buf += size;
offset = offset + (pagesize - page_off);
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0892/1059] gpio: davinci: use controller-specific MMIO for BINTEN
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (890 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0891/1059] tg3: Fix heap overflow in unbuffered NVRAM write path Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0893/1059] gpio: mvebu: validate ngpios before use Greg Kroah-Hartman
` (106 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Sahaj Chaudhari,
Bartosz Golaszewski, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
[ Upstream commit a142f1c5de4b9c03910cc304a26fbbdef69ca422 ]
The file-global gpio_base can be overwritten when probes for multiple
DaVinci GPIO controllers overlap. The later IRQ setup can then write the
BINTEN register of a different controller.
Derive the BINTEN address from the current controller's mapped bank
instead of shared global state.
Fixes: 118150f22d6b ("gpio: davinci: move to platform device")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com>
Link: https://patch.msgid.link/20261124121500.2cd5cbf30f89-2-sahaj123.sc@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-davinci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 1e55f4eb0d992..8154371d67ef4 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -46,7 +46,6 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
-static void __iomem *gpio_base;
static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
struct davinci_gpio_irq_data {
@@ -197,6 +196,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
struct davinci_gpio_controller *chips;
struct davinci_gpio_platform_data *pdata;
struct device *dev = &pdev->dev;
+ void __iomem *gpio_base;
pdata = davinci_gpio_get_pdata(pdev);
if (!pdata) {
@@ -625,7 +625,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
* BINTEN -- per-bank interrupt enable. genirq would also let these
* bits be set/cleared dynamically.
*/
- writel_relaxed(binten, gpio_base + BINTEN);
+ writel_relaxed(binten, chips->regs[0] - offset_array[0] + BINTEN);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0893/1059] gpio: mvebu: validate ngpios before use
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (891 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0892/1059] gpio: davinci: use controller-specific MMIO for BINTEN Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0894/1059] bpf, sockmap: Clear the redirect target after the stream parser runs Greg Kroah-Hartman
` (105 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Bartosz Golaszewski,
Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 62a41997c1553b723a7a333c0246d0646ebd2c95 ]
If ngpios is read as 0 from device tree, it is passed via
irq_alloc_domain_generic_chips() as irqs_per_chip, which leads to a
division by zero in DIV_ROUND_UP(d->revmap_size, irqs_per_chip).
Reject ngpios == 0 early.
Also reject higher than 32, which is the limit.
Fixes: fefe7b0923459 ("gpio: introduce gpio-mvebu driver for Marvell SoCs")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261126002650.603321-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 399eece49235e..f691702affffc 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1195,6 +1195,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}
+ if (ngpios == 0 || ngpios > MVEBU_MAX_GPIO_PER_BANK)
+ return dev_err_probe(&pdev->dev, -EINVAL, "ngpios must be between 1 and 32\n");
+
id = of_alias_get_id(pdev->dev.of_node, "gpio");
if (id < 0) {
dev_err(&pdev->dev, "Couldn't get OF id\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0894/1059] bpf, sockmap: Clear the redirect target after the stream parser runs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (892 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0893/1059] gpio: mvebu: validate ngpios before use Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0895/1059] drm/gud: avoid divide error in gud_stats_debugfs Greg Kroah-Hartman
` (104 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sechang Lim, Alexei Starovoitov,
Jiayuan Chen, Sasha Levin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sechang Lim <rhkrqnwk98@gmail.com>
[ Upstream commit 14f6b10422d640695803c621687f790f6f3d2401 ]
A stream parser can call bpf_sk_redirect_{map,hash}(), which store the
target socket in skb->_sk_redir. sk_psock_strp_parse() never clears it,
and it shares storage with skb->_skb_refdst, so skb_dst_drop() later
passes the socket to dst_release():
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f]
RIP: 0010:percpu_counter_add_batch+0x24/0x220
Call Trace:
dst_release.part.0+0xc9/0x180
skb_release_head_state+0x1cc/0x2f0
sk_skb_reason_drop+0xbc/0x420
strp_done+0xcf/0x150
sk_psock_destroy+0x85e/0xb10
Drop the dst before the parser runs, as the verdict paths do, and clear
the redirect after it. The parser's redirect was never used.
Fixes: e3526bb92a20 ("skmsg: Move sk_redir from TCP_SKB_CB to skb")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261126101950.1682160-1-rhkrqnwk98@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skmsg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 62b4ff8603326..0f109fb720118 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1151,7 +1151,9 @@ static int sk_psock_strp_parse(struct strparser *strp, struct sk_buff *skb)
prog = READ_ONCE(psock->progs.stream_parser);
if (likely(prog)) {
skb->sk = psock->sk;
+ skb_dst_drop(skb);
ret = bpf_prog_run_pin_on_cpu(prog, skb);
+ skb_bpf_redirect_clear(skb);
skb->sk = NULL;
}
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 1065+ messages in thread* [PATCH 6.1 0895/1059] drm/gud: avoid divide error in gud_stats_debugfs
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (893 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0894/1059] bpf, sockmap: Clear the redirect target after the stream parser runs Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0896/1059] drm/radeon: Bound GPIO I2C table entry count from VBIOS Greg Kroah-Hartman
` (103 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bin Yu, Cheng Wen, YuanZhe Liu,
Ruben Wauters
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit 431c2dffd2b7c1240a6e579f0c74104cd2e17329 upstream.
gud_stats_debugfs() computes the compression ratio by dividing the
accumulated uncompressed length by stats_actual_length. That counter is
zero until the first framebuffer flush has completed, so reading the
stats debugfs file on a display which negotiates LZ4 compression raises
a divide error before any frame has been sent. The wrap-around reset in
gud_flush_rect() also clears the counter for a moment, which a
concurrent read can observe.
Copy the counter into a local variable and skip the ratio computation
when it is zero.
Fixes: 40e1a70b4aed ("drm: Add GUD USB Display driver")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Acked-by: Ruben Wauters <rubenru09@aol.com>
Link: https://patch.msgid.link/20261029073311.14556-1-25031212351@stu.xidian.edu.cn
Signed-off-by: Ruben Wauters <rubenru09@aol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/gud/gud_drv.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -341,10 +341,17 @@ static int gud_stats_debugfs(struct seq_
seq_puts(m, "\n");
if (gdrm->compression) {
+ u64 actual_length = gdrm->stats_actual_length;
u64 remainder;
- u64 ratio = div64_u64_rem(gdrm->stats_length, gdrm->stats_actual_length,
- &remainder);
- u64 ratio_frac = div64_u64(remainder * 10, gdrm->stats_actual_length);
+ u64 ratio, ratio_frac;
+
+ if (!actual_length) {
+ seq_puts(m, "Compression ratio: n/a\n");
+ return 0;
+ }
+
+ ratio = div64_u64_rem(gdrm->stats_length, actual_length, &remainder);
+ ratio_frac = div64_u64(remainder * 10, actual_length);
seq_printf(m, "Compression ratio: %llu.%llu\n", ratio, ratio_frac);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0896/1059] drm/radeon: Bound GPIO I2C table entry count from VBIOS
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (894 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0895/1059] drm/gud: avoid divide error in gud_stats_debugfs Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0897/1059] drm/radeon: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
` (102 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Andrey Misiurov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <amisiurov@cloudlinux.com>
commit 7345797c8652c976d18dc4be4bae632557c3bc38 upstream.
radeon_atombios_i2c_init() derives the number of GPIO I2C entries from
the size field of the VBIOS GPIO_I2C_Info table and stores a bus for
every valid entry in rdev->i2c_bus[i], which has RADEON_MAX_I2C_BUS
(16) slots. A table that claims more than 16 entries makes it write
past the end of the array into the rest of struct radeon_device. A
size smaller than the common header wraps the subtraction and the loop
walks far past the table. radeon_lookup_i2c_gpio() uses the same
calculation.
Reject undersized tables and cap the entry count at
RADEON_MAX_I2C_BUS.
Fixes: f376b94fbc0a ("drm/radeon/kms: unify i2c handling")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ad5ddb2f77ff5e80b3c793f062dc1cad9907a2b9)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/radeon/radeon_atombios.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -124,6 +124,22 @@ static struct radeon_i2c_bus_rec radeon_
return i2c;
}
+/*
+ * The VBIOS table size is not checked against the image; cap the
+ * entry count to RADEON_MAX_I2C_BUS, the size of rdev->i2c_bus[].
+ */
+static int radeon_atombios_gpio_i2c_num_entries(uint16_t size)
+{
+ u32 bytes;
+
+ if (size < sizeof(ATOM_COMMON_TABLE_HEADER))
+ return 0;
+
+ bytes = size - sizeof(ATOM_COMMON_TABLE_HEADER);
+ return min_t(u32, bytes / sizeof(ATOM_GPIO_I2C_ASSIGMENT),
+ RADEON_MAX_I2C_BUS);
+}
+
static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev,
uint8_t id)
{
@@ -141,8 +157,7 @@ static struct radeon_i2c_bus_rec radeon_
if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+ num_indices = radeon_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
@@ -175,8 +190,7 @@ void radeon_atombios_i2c_init(struct rad
if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+ num_indices = radeon_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0897/1059] drm/radeon: only unregister the ATPX handler if we registered it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (895 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0896/1059] drm/radeon: Bound GPIO I2C table entry count from VBIOS Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0898/1059] drm/amd/pm: send smu8 sclk level indices, not the level mask Greg Kroah-Hartman
` (101 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Jiaming Fan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaming Fan <fan.jiaming@hotmail.com>
commit 83876755d089321e426a58f365a31b27b2c77f3b upstream.
radeon_register_atpx_handler() registers the ATPX handler with
vga_switcheroo only when ATPX is detected, and ignores the result:
vga_switcheroo has a single handler slot and refuses a second handler
with -EINVAL. radeon_unregister_atpx_handler() calls
vga_switcheroo_unregister_handler() in either case, and that clears the
slot no matter who set it.
So unloading radeon removes a handler registered by another driver, such
as apple-gmux. No Radeon GPU is needed for this; loading and unloading
radeon is enough. amdgpu is another such driver: when radeon and amdgpu
are both loaded and both detect ATPX, only the first one gets the slot,
and unloading the other one clears it. Afterwards vga_switcheroo can no
longer switch outputs, and a client that uses the vga_switcheroo runtime
PM domain, such as nouveau on a non-Optimus machine with a v1 DSM, can
dereference the now NULL handler during runtime suspend.
Record whether the registration succeeded and unregister only in that
case. amdgpu has the same problem and gets the same fix.
Fixes: 6a9ee8af344e ("vga_switcheroo: initial implementation (v15)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiaming Fan <fan.jiaming@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f90ef5de500fa47d8e2371d429700f0275e0b88d)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/radeon/radeon_atpx_handler.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -34,6 +34,7 @@ struct radeon_atpx {
static struct radeon_atpx_priv {
bool atpx_detected;
bool bridge_pm_usable;
+ bool handler_registered;
/* handle for device - and atpx */
acpi_handle dhandle;
struct radeon_atpx atpx;
@@ -601,7 +602,8 @@ void radeon_register_atpx_handler(void)
if (!r)
return;
- vga_switcheroo_register_handler(&radeon_atpx_handler, handler_flags);
+ if (!vga_switcheroo_register_handler(&radeon_atpx_handler, handler_flags))
+ radeon_atpx_priv.handler_registered = true;
}
/**
@@ -611,5 +613,14 @@ void radeon_register_atpx_handler(void)
*/
void radeon_unregister_atpx_handler(void)
{
+ /*
+ * vga_switcheroo has a single handler slot and unregistering clears it
+ * no matter who set it, so leave a handler registered by another
+ * driver, such as amdgpu or apple-gmux, in place.
+ */
+ if (!radeon_atpx_priv.handler_registered)
+ return;
+
vga_switcheroo_unregister_handler();
+ radeon_atpx_priv.handler_registered = false;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0898/1059] drm/amd/pm: send smu8 sclk level indices, not the level mask
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (896 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0897/1059] drm/radeon: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0899/1059] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F Greg Kroah-Hartman
` (100 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Joshua Horne
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Horne <hornejd@etsu.edu>
commit 535f6852652e3239c8688491ccd0ed4b6e09d14f upstream.
smu8_force_clock_level() passes the pp_dpm_sclk level mask straight to
PPSMC_MSG_SetSclkSoftMin and PPSMC_MSG_SetSclkSoftMax, which take a
level index, as the other smu8 callers do through smu8_get_sclk_level().
In manual mode, "echo 0 > pp_dpm_sclk" thus selects level 1, "echo 2"
selects level 4, and masks above the highest level index are out of
range for the SMU, so e.g. "echo 3", "echo 7" or "echo 0 1 2 3 4 5 6 7"
do not select the requested levels. The original single level version
sent 1 << level and had the same problem.
Send the lowest and highest level in the mask, as smu10 does, and reject
levels above those the SMU has enabled, as smu10 and vega20 do.
Fixes: d7341ef66870 ("drm/amd/powerplay: add some hwmgr functions for sysfs interface on Carrizo")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Joshua Horne <hornejd@etsu.edu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8ff6b368360adb24ccf145047b0261dfae77f28a)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
@@ -1546,15 +1546,25 @@ static int smu8_get_dal_power_level(stru
static int smu8_force_clock_level(struct pp_hwmgr *hwmgr,
enum pp_clock_type type, uint32_t mask)
{
+ struct phm_clock_voltage_dependency_table *table =
+ hwmgr->dyn_state.vddc_dependency_on_sclk;
+ uint32_t low, high;
+
switch (type) {
case PP_SCLK:
+ /* the SMU takes level indices, not a mask of levels */
+ low = mask ? (ffs(mask) - 1) : 0;
+ high = mask ? (fls(mask) - 1) : 0;
+ if (high >= min(table->count, smu8_get_max_sclk_level(hwmgr)))
+ return -EINVAL;
+
smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetSclkSoftMin,
- mask,
+ low,
NULL);
smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetSclkSoftMax,
- mask,
+ high,
NULL);
break;
default:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0899/1059] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (897 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0898/1059] drm/amd/pm: send smu8 sclk level indices, not the level mask Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0900/1059] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2 Greg Kroah-Hartman
` (99 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Wang Jiang
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Jiang <jiangwang@kylinos.cn>
commit 24916f2c98f86c90db617d0e828d930d7a35577e upstream.
GFXOFF causes gfx ring timeout and desktop freeze on Lenovo 90NYA05DCD
(Ryzen 5 3400G, Picasso). Add a quirk entry with ANY_REV marker to
disable gfxoff for subsystem 17aa:318f regardless of chip revision.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Wang Jiang <jiangwang@kylinos.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 32a647c3218d8bb5bf03f68784fbc405c1e5fbd3)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1164,6 +1164,9 @@ struct amdgpu_gfxoff_quirk {
u8 revision;
};
+/* Match any chip revision in amdgpu_gfxoff_quirk.revision */
+#define AMDGPU_GFXOFF_QUIRK_ANY_REV 0xff
+
static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
/* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
@@ -1173,6 +1176,7 @@ static const struct amdgpu_gfxoff_quirk
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
/* Apple MacBook Pro (15-inch, 2019) Radeon Pro Vega 20 4 GB */
{ 0x1002, 0x69af, 0x106b, 0x019a, 0xc0 },
+ { 0x1002, 0x15d8, 0x17aa, 0x318f, AMDGPU_GFXOFF_QUIRK_ANY_REV },
/* https://bbs.openkylin.top/t/topic/171497 */
{ 0x1002, 0x15d8, 0x19e5, 0x3e14, 0xc2 },
/* HP 705G4 DM with R5 2400G */
@@ -1189,7 +1193,8 @@ static bool gfx_v9_0_should_disable_gfxo
pdev->device == p->chip_device &&
pdev->subsystem_vendor == p->subsys_vendor &&
pdev->subsystem_device == p->subsys_device &&
- pdev->revision == p->revision) {
+ (p->revision == AMDGPU_GFXOFF_QUIRK_ANY_REV ||
+ pdev->revision == p->revision)) {
return true;
}
++p;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0900/1059] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (898 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0899/1059] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0901/1059] drm/amdgpu: Fix VCE buffer size check for DPB and input surface Greg Kroah-Hartman
` (98 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrei Krautsou, Kenneth Feng,
Alex Deucher
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Krautsou <an9949an@gmail.com>
commit 491aa2b083e18ef11d34f776bcb0e396a84f47e4 upstream.
GC 11.0.2 (Navi33) never got the GFX MGCG, FGCG and PERF_CLK clock
gating flags. GC 11.0.0, 11.0.1 and 11.0.4 have all three, GC 11.0.3
has MGCG. The gfx_v11_0 code behind these flags is shared by all
GC 11 parts. Enable them for GC 11.0.2, same as for GC 11.0.0.
Without the flags the driver does not clear the override bits in
RLC_CGTT_MGCG_OVERRIDE (0x000605e7 under load), so this gating stays
off. On RX 7600S the GFX clock is limited by the GFX TDC limit
(68 A), in Linux and in Windows. With the gating off each MHz costs
more GFX current, so PMFW stops at a lower clock than in Windows.
vkpeak fp32-scalar for 300 s, median after the first 60 s, GFX
current is about 68 A (TDC limit) in all cases:
gfxclk VDDGFX GFLOPS
current flags 2030 MHz 800 mV 8915
+ MGCG 2261 MHz 873 mV 9921
+ MGCG, FGCG, PERF_CLK 2314 MHz 894 mV 10104
Windows 11, AMD driver 910 mV 10157-10186
GFLOPS per MHz is the same, only the current per clock goes down.
Windows shows other clock sensors, so there I compare GFLOPS only.
With all three flags vkpeak is within 1% of Windows. MGCG gives most
of the gain, FGCG and PERF_CLK add about 2% more.
Tested on one laptop, ASUS TUF A16 FA617NS (RX 7600S, PMFW 82.97.0),
Fedora kernel 7.2.11, Mesa 26.2.5, with the same flags set by a local
debug patch. One 300 s vkpeak run for each setting and some gaming,
no amdgpu errors in dmesg. Suspend/resume and long runs are not
tested yet.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/6082
Signed-off-by: Andrei Krautsou <an9949an@gmail.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Andrei Krautsou <an9949an@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 85e5015b7879c04f7b9aabc865cdf7bcdf3d7470)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/soc21.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/gpu/drm/amd/amdgpu/soc21.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc21.c
@@ -637,7 +637,10 @@ static int soc21_common_early_init(void
adev->cg_flags =
AMD_CG_SUPPORT_GFX_CGCG |
AMD_CG_SUPPORT_GFX_CGLS |
+ AMD_CG_SUPPORT_GFX_MGCG |
AMD_CG_SUPPORT_REPEATER_FGCG |
+ AMD_CG_SUPPORT_GFX_FGCG |
+ AMD_CG_SUPPORT_GFX_PERF_CLK |
AMD_CG_SUPPORT_VCN_MGCG |
AMD_CG_SUPPORT_JPEG_MGCG |
AMD_CG_SUPPORT_ATHUB_MGCG |
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0901/1059] drm/amdgpu: Fix VCE buffer size check for DPB and input surface
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (899 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0900/1059] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2 Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0902/1059] drm/amdgpu: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
` (97 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leo Liu, Ruijing Dong, David Rosca,
Alex Deucher
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rosca <david.rosca@amd.com>
commit 87a841d8c0b711519fb76e2412bb293743f602bd upstream.
In create command we get pitch and height for DPB, input surface
pitch and height is in encode command.
Fix the calculation to also consider different luma and chroma pitch.
Acked-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Signed-off-by: David Rosca <david.rosca@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 24c0be8ac3ef2eaa20f614b540e41382b5e97afc)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 35 +++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -751,6 +751,7 @@ int amdgpu_vce_ring_parse_cs(struct amdg
uint32_t allocated = 0;
uint32_t tmp, handle = 0;
uint32_t dummy = 0xffffffff;
+ uint32_t luma_pitch, chroma_pitch, height;
uint32_t *size = &dummy;
unsigned int idx;
int i, r = 0;
@@ -857,19 +858,19 @@ int amdgpu_vce_ring_parse_cs(struct amdg
goto out;
}
- uint32_t width, height;
- width = amdgpu_ib_get_value(ib, idx + 8);
- height = amdgpu_ib_get_value(ib, idx + 10);
-
- if (width == 0 || height == 0 ||
- width > 4096 || height > 2304) {
- DRM_ERROR("invalid VCE image size: %ux%u\n",
- width, height);
+ luma_pitch = amdgpu_ib_get_value(ib, idx + 8);
+ chroma_pitch = amdgpu_ib_get_value(ib, idx + 9);
+ height = amdgpu_ib_get_value(ib, idx + 10); /* encRefYHeightInQw */
+
+ if (luma_pitch == 0 || chroma_pitch == 0 || height == 0 ||
+ luma_pitch > 4096 || chroma_pitch > 4096 || height > 2304 / 8) {
+ DRM_ERROR("invalid VCE ref image size: (%u %u)x%u\n",
+ luma_pitch, chroma_pitch, height * 8);
r = -EINVAL;
goto out;
}
- *size = width * height * 8 * 3 / 2;
+ *size = luma_pitch * height * 8 + chroma_pitch * height * 8 / 2;
break;
@@ -898,13 +899,25 @@ int amdgpu_vce_ring_parse_cs(struct amdg
break;
case 0x03000001: /* encode */
+ height = amdgpu_ib_get_value(ib, idx + 13);
+ luma_pitch = amdgpu_ib_get_value(ib, idx + 14);
+ chroma_pitch = amdgpu_ib_get_value(ib, idx + 15);
+
+ if (luma_pitch == 0 || chroma_pitch == 0 || height == 0 ||
+ luma_pitch > 4096 || chroma_pitch > 4096 || height > 2304) {
+ DRM_ERROR("invalid VCE image size: (%u %u)x%u\n",
+ luma_pitch, chroma_pitch, height);
+ r = -EINVAL;
+ goto out;
+ }
+
r = amdgpu_vce_cs_reloc(p, ib, idx + 10, idx + 9,
- *size, 0);
+ luma_pitch * height, 0);
if (r)
goto out;
r = amdgpu_vce_cs_reloc(p, ib, idx + 12, idx + 11,
- *size / 3, 0);
+ chroma_pitch * height / 2, 0);
if (r)
goto out;
break;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0902/1059] drm/amdgpu: only unregister the ATPX handler if we registered it
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (900 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0901/1059] drm/amdgpu: Fix VCE buffer size check for DPB and input surface Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0903/1059] drm/amdkfd: check CRIU SVM priv data bounds before allocating Greg Kroah-Hartman
` (96 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Jiaming Fan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaming Fan <fan.jiaming@hotmail.com>
commit 53fc1be11892a8e695937fdbc24db2699d23dabf upstream.
amdgpu_register_atpx_handler() registers the ATPX handler with
vga_switcheroo only when ATPX is detected, and ignores the result:
vga_switcheroo has a single handler slot and refuses a second handler
with -EINVAL. amdgpu_unregister_atpx_handler() calls
vga_switcheroo_unregister_handler() in either case, and that clears the
slot no matter who set it.
So unloading amdgpu removes a handler registered by another driver, such
as apple-gmux. No AMD GPU is needed for this; loading and unloading
amdgpu is enough. Afterwards vga_switcheroo can no longer switch outputs,
and a client that uses the vga_switcheroo runtime PM domain, such as
nouveau on a non-Optimus machine with a v1 DSM, can dereference the now
NULL handler during runtime suspend.
Record whether the registration succeeded and unregister only in that
case.
Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiaming Fan <fan.jiaming@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fbb6ebeff9d5327e8d06a83a3f7daa88422c9127)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -45,6 +45,7 @@ struct amdgpu_atpx {
static struct amdgpu_atpx_priv {
bool atpx_detected;
bool bridge_pm_usable;
+ bool handler_registered;
unsigned int quirks;
/* handle for device - and atpx */
acpi_handle dhandle;
@@ -661,7 +662,8 @@ void amdgpu_register_atpx_handler(void)
if (!r)
return;
- vga_switcheroo_register_handler(&amdgpu_atpx_handler, handler_flags);
+ if (!vga_switcheroo_register_handler(&amdgpu_atpx_handler, handler_flags))
+ amdgpu_atpx_priv.handler_registered = true;
}
/**
@@ -671,5 +673,14 @@ void amdgpu_register_atpx_handler(void)
*/
void amdgpu_unregister_atpx_handler(void)
{
+ /*
+ * vga_switcheroo has a single handler slot and unregistering clears it
+ * no matter who set it, so leave a handler registered by another
+ * driver, such as apple-gmux, in place.
+ */
+ if (!amdgpu_atpx_priv.handler_registered)
+ return;
+
vga_switcheroo_unregister_handler();
+ amdgpu_atpx_priv.handler_registered = false;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0903/1059] drm/amdkfd: check CRIU SVM priv data bounds before allocating
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (901 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0902/1059] drm/amdgpu: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0904/1059] drm/vc4: Check for a validated shader before reading its thread mode Greg Kroah-Hartman
` (95 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Perry Yuan, Yifan Zhang,
Alex Deucher
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Perry Yuan <perry.yuan@amd.com>
commit 732239b002678d8c534503f52a16afc310095523 upstream.
kfd_criu_restore_svm() allocated the per-range metadata before checking
that the range fits in the user supplied private data buffer, so an out
of range offset cost a pointless kzalloc()/kfree() round trip. Do the
bounds check first and return -EINVAL directly.
v2:
- split the original patch into two, one change per patch (Yifan)
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 0c3caec1161e458092364cb448e5bd165a26dcdb)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -3814,15 +3814,14 @@ int kfd_criu_restore_svm(struct kfd_proc
svm_priv_data_size = sizeof(struct kfd_criu_svm_range_priv_data) +
svm_attrs_size;
+ if (*priv_data_offset + svm_priv_data_size > max_priv_data_size)
+ return -EINVAL;
+
criu_svm_md = kzalloc(svm_object_md_size, GFP_KERNEL);
if (!criu_svm_md) {
pr_err("failed to allocate memory to store svm metadata\n");
return -ENOMEM;
}
- if (*priv_data_offset + svm_priv_data_size > max_priv_data_size) {
- ret = -EINVAL;
- goto exit;
- }
ret = copy_from_user(&criu_svm_md->data, user_priv_ptr + *priv_data_offset,
svm_priv_data_size);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0904/1059] drm/vc4: Check for a validated shader before reading its thread mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (902 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0903/1059] drm/amdkfd: check CRIU SVM priv data bounds before allocating Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0905/1059] drm/vc4: Clear the slice caches before resetting a stalled GPU Greg Kroah-Hartman
` (94 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 15da41dff1f66a389d238db60a1c19fa83582d07 upstream.
validate_gl_shader_rec() reads the thread mode from the validated_shader
of the FS, VS and CS BOs before checking it for NULL. A shader record
pointing at a BO not created by DRM_IOCTL_VC4_CREATE_SHADER_BO has no
validated_shader, so userspace can trigger a NULL pointer dereference.
Check that every shader BO has a validated shader before using it.
Cc: stable@vger.kernel.org
Fixes: c778cc5df944 ("drm/vc4: Add fragment shader threading support")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-2-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_validate.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -830,6 +830,9 @@ validate_gl_shader_rec(struct drm_device
bo[i] = exec->bo[src_handles[i]];
if (!bo[i])
return -EINVAL;
+
+ if (!to_vc4_bo(&bo[i]->base)->validated_shader)
+ return -EINVAL;
}
for (i = shader_reloc_count; i < nr_relocs; i++) {
bo[i] = vc4_use_bo(exec, src_handles[i]);
@@ -850,7 +853,8 @@ validate_gl_shader_rec(struct drm_device
}
for (i = 0; i < shader_reloc_count; i++) {
- struct vc4_validated_shader_info *validated_shader;
+ struct vc4_validated_shader_info *validated_shader =
+ to_vc4_bo(&bo[i]->base)->validated_shader;
uint32_t o = shader_reloc_offsets[i];
uint32_t src_offset = *(uint32_t *)(pkt_u + o);
uint32_t *texture_handles_u;
@@ -865,10 +869,6 @@ validate_gl_shader_rec(struct drm_device
return -EINVAL;
}
- validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader;
- if (!validated_shader)
- return -EINVAL;
-
if (validated_shader->uniforms_src_size >
exec->uniforms_size) {
DRM_DEBUG("Uniforms src buffer overflow\n");
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0905/1059] drm/vc4: Clear the slice caches before resetting a stalled GPU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (903 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0904/1059] drm/vc4: Check for a validated shader before reading its thread mode Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0906/1059] drm/vc4: Fix off-by-one in the shader record BO handle check Greg Kroah-Hartman
` (93 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit af1cf92e8617a7f7aa24b415596cbf64b76a12e7 upstream.
Starting shader code at varying offsets makes the GFXH-16 icache livelock
unlikely, but not impossible. When the livelock happens, the QPUs make no
progress and the hangcheck resets the GPU, losing the job.
When the hangcheck finds no progress, clear the slice instruction and
uniforms caches and check again before resetting. If the stall is a
livelock, clearing the caches can break it and let the job continue.
Drop round_jiffies_up() from the hangcheck timer, so checks run every
100 ms instead of at the next whole second. This shortens the screen
freeze before the caches are cleared. Long jobs are unaffected: while the
control lists advance, the hangcheck won't clear the caches or reset the
GPU.
Cc: stable@vger.kernel.org
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-4-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_drv.h | 5 +++++
drivers/gpu/drm/vc4/vc4_gem.c | 20 ++++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -214,6 +214,11 @@ struct vc4_dev {
struct {
struct timer_list timer;
struct work_struct reset_work;
+
+ /* The instruction and uniforms caches were cleared at the
+ * last check that found no progress.
+ */
+ bool caches_cleared;
} hangcheck;
struct drm_modeset_lock ctm_state_lock;
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -41,8 +41,7 @@ vc4_queue_hangcheck(struct drm_device *d
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
- mod_timer(&vc4->hangcheck.timer,
- round_jiffies_up(jiffies + msecs_to_jiffies(100)));
+ mod_timer(&vc4->hangcheck.timer, jiffies + msecs_to_jiffies(100));
}
struct vc4_hang_state {
@@ -341,6 +340,7 @@ vc4_hangcheck_elapsed(struct timer_list
/* If idle, we can stop watching for hangs. */
if (!bin_exec && !render_exec) {
+ vc4->hangcheck.caches_cleared = false;
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
return;
}
@@ -357,11 +357,27 @@ vc4_hangcheck_elapsed(struct timer_list
bin_exec->last_ct0ca = ct0ca;
if (render_exec)
render_exec->last_ct1ca = ct1ca;
+
+ vc4->hangcheck.caches_cleared = false;
+
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
vc4_queue_hangcheck(dev);
return;
}
+ /* Clear the slice caches to workaround GFXH-16 */
+ if (!vc4->hangcheck.caches_cleared) {
+ V3D_WRITE(V3D_SLCACTL, VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC) |
+ VC4_SET_FIELD(0xf, V3D_SLCACTL_UCC));
+
+ vc4->hangcheck.caches_cleared = true;
+ spin_unlock_irqrestore(&vc4->job_lock, irqflags);
+ vc4_queue_hangcheck(dev);
+ return;
+ }
+
+ vc4->hangcheck.caches_cleared = false;
+
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
/* We've gone too long with no progress, reset. This has to
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0906/1059] drm/vc4: Fix off-by-one in the shader record BO handle check
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (904 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0905/1059] drm/vc4: Clear the slice caches before resetting a stalled GPU Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0907/1059] drm/vc4: Start shader code at varying offsets in its BO Greg Kroah-Hartman
` (92 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 1fbbd14add401c70c178f0fa13016a3a53ef0de5 upstream.
validate_gl_shader_rec() accepts a shader BO handle equal to
exec->bo_count, reading one entry past the end of exec->bo[] and
using it as a GEM object.
Reject handles that aren't below exec->bo_count.
Cc: stable@vger.kernel.org
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-1-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_validate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -822,7 +822,7 @@ validate_gl_shader_rec(struct drm_device
exec->shader_rec_size -= packet_size;
for (i = 0; i < shader_reloc_count; i++) {
- if (src_handles[i] > exec->bo_count) {
+ if (src_handles[i] >= exec->bo_count) {
DRM_DEBUG("Shader handle %d too big\n", src_handles[i]);
return -EINVAL;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0907/1059] drm/vc4: Start shader code at varying offsets in its BO
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (905 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0906/1059] drm/vc4: Fix off-by-one in the shader record BO handle check Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0908/1059] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Greg Kroah-Hartman
` (91 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit c0e1ed41ad86cf5230d64dc5f2c6d2e3aeb59937 upstream.
VC4 is affected by the HW erratum GFXH-16: the QPUs can get stuck in a
loop where instruction cache loads are evicted before they are used.
The QPUs of a slice share one instruction cache. Shader BOs are page
aligned and the code always starts at offset 0, so instructions at the
same position in different shaders end up mapping to the same cache sets.
When the four QPUs of a slice run four different shaders, their fills
evict each other, no instruction executes and the hangcheck resets the
GPU.
Place each shader's code at one of four offsets, 256 bytes apart, inside
its BO, and add the offset when relocating the shader record. Shader code
is position independent, as the validator only accepts relative branches.
The offsets are tracked per client, so shaders a given client creates in
sequence (which tend to run together) start in different sets.
Notice that this approach makes the livelock unlikely, but not impossible.
The next commit will address the remaining cases.
On a Raspberry Pi 3 running the issue's reproducer, GPU resets went from
dozens in an hour to none.
Cc: stable@vger.kernel.org
Fixes: 463873d57014 ("drm/vc4: Add an API for creating GPU shaders in GEM BOs.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-3-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_bo.c | 43 ++++++++++++++++++++++-------
drivers/gpu/drm/vc4/vc4_drv.h | 10 ++++++
drivers/gpu/drm/vc4/vc4_validate.c | 3 +-
drivers/gpu/drm/vc4/vc4_validate_shaders.c | 7 ++--
4 files changed, 48 insertions(+), 15 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -17,6 +17,7 @@
*/
#include <linux/dma-buf.h>
+#include <linux/overflow.h>
#include <drm/drm_fourcc.h>
@@ -836,6 +837,19 @@ int vc4_mmap_bo_ioctl(struct drm_device
return 0;
}
+/*
+ * QPUs sharing a slice's instruction cache can livelock evicting each
+ * other's fills. Considering that shader BOs are page aligned, any code
+ * at offset 0 maps every shader to the same cache sets. This makes a
+ * livelock more likely to happen due to GFXH-16.
+ *
+ * Start each shader at one of four offsets, cycled per client, to spread
+ * them across sets. The use of four different offsets is motivated by the
+ * number of QPUs per slice (4 QPUs).
+ */
+#define VC4_SHADER_OFFSET_STEP 256
+#define VC4_SHADER_OFFSET_NUM 4
+
int
vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
@@ -844,6 +858,7 @@ vc4_create_shader_bo_ioctl(struct drm_de
struct vc4_file *vc4file = file_priv->driver_priv;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_bo *bo = NULL;
+ u32 offset, size;
int ret;
if (WARN_ON_ONCE(vc4->is_vc5))
@@ -865,29 +880,37 @@ vc4_create_shader_bo_ioctl(struct drm_de
return -EINVAL;
}
+ offset = ((u32)atomic_inc_return(&vc4file->shader_offset_idx) %
+ VC4_SHADER_OFFSET_NUM) * VC4_SHADER_OFFSET_STEP;
+
+ if (check_add_overflow(offset, args->size, &size))
+ return -EINVAL;
+
ret = vc4_grab_bin_bo(vc4, vc4file);
if (ret)
return ret;
- bo = vc4_bo_create(dev, args->size, true, VC4_BO_TYPE_V3D_SHADER);
+ bo = vc4_bo_create(dev, size, true, VC4_BO_TYPE_V3D_SHADER);
if (IS_ERR(bo))
return PTR_ERR(bo);
bo->madv = VC4_MADV_WILLNEED;
+ bo->shader_offset = offset;
- if (copy_from_user(bo->base.vaddr,
- (void __user *)(uintptr_t)args->data,
- args->size)) {
+ /* Clear the memory around the code, which may come from the BO
+ * cache.
+ */
+ memset(bo->base.vaddr, 0, offset);
+ if (copy_from_user(bo->base.vaddr + offset,
+ (void __user *)(uintptr_t)args->data,
+ args->size)) {
ret = -EFAULT;
goto fail;
}
- /* Clear the rest of the memory from allocating from the BO
- * cache.
- */
- memset(bo->base.vaddr + args->size, 0,
- bo->base.base.size - args->size);
+ memset(bo->base.vaddr + offset + args->size, 0,
+ bo->base.base.size - offset - args->size);
- bo->validated_shader = vc4_validate_shader(&bo->base);
+ bo->validated_shader = vc4_validate_shader(&bo->base, offset);
if (!bo->validated_shader) {
ret = -EINVAL;
goto fail;
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -274,6 +274,9 @@ struct vc4_bo {
*/
struct vc4_validated_shader_info *validated_shader;
+ /* Byte offset of the shader code in the BO. */
+ u32 shader_offset;
+
/* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i
* for user-allocated labels.
*/
@@ -718,6 +721,11 @@ struct vc4_file {
} perfmon;
bool bin_bo_used;
+
+ /* Counter picking the start offset of the next shader BO's code,
+ * see vc4_create_shader_bo_ioctl().
+ */
+ atomic_t shader_offset_idx;
};
static inline struct vc4_exec_info *
@@ -1007,7 +1015,7 @@ bool vc4_check_tex_size(struct vc4_exec_
/* vc4_validate_shader.c */
struct vc4_validated_shader_info *
-vc4_validate_shader(struct drm_gem_dma_object *shader_obj);
+vc4_validate_shader(struct drm_gem_dma_object *shader_obj, u32 offset);
/* vc4_perfmon.c */
void vc4_perfmon_get(struct vc4_perfmon *perfmon);
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -861,7 +861,8 @@ validate_gl_shader_rec(struct drm_device
void *uniform_data_u;
uint32_t tex, uni;
- *(uint32_t *)(pkt_v + o) = bo[i]->dma_addr + src_offset;
+ *(uint32_t *)(pkt_v + o) = bo[i]->dma_addr + src_offset +
+ to_vc4_bo(&bo[i]->base)->shader_offset;
if (src_offset != 0) {
DRM_DEBUG("Shaders must be at offset 0 of "
--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c
+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
@@ -777,7 +777,7 @@ vc4_handle_branch_target(struct vc4_shad
}
struct vc4_validated_shader_info *
-vc4_validate_shader(struct drm_gem_dma_object *shader_obj)
+vc4_validate_shader(struct drm_gem_dma_object *shader_obj, u32 offset)
{
struct vc4_dev *vc4 = to_vc4_dev(shader_obj->base.dev);
bool found_shader_end = false;
@@ -791,8 +791,9 @@ vc4_validate_shader(struct drm_gem_dma_o
return NULL;
memset(&validation_state, 0, sizeof(validation_state));
- validation_state.shader = shader_obj->vaddr;
- validation_state.max_ip = shader_obj->base.size / sizeof(uint64_t);
+ validation_state.shader = shader_obj->vaddr + offset;
+ validation_state.max_ip = (shader_obj->base.size - offset) /
+ sizeof(uint64_t);
reset_validation_state(&validation_state);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0908/1059] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (906 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0907/1059] drm/vc4: Start shader code at varying offsets in its BO Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0909/1059] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core Greg Kroah-Hartman
` (90 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 05ee42f3dd5484415fac587d0efb8fe846b74c2c upstream.
vmw_host_get_guestinfo subtracts the two-byte reply prefix using
max(reply_len - 2, (size_t)0). Since reply_len is unsigned, a one-byte
reply wraps to SIZE_MAX instead of being clamped to zero. The subsequent
copy can read past the host reply allocation.
Theoretically malformed host reply can reach this path when the driver
queries the GuestInfo parameter used to enable VKMS.
Check the reply length before subtracting the prefix so short replies
produce an empty payload and cannot cause an out-of-bounds read.
Sashiko reported this while reviewing the i386 hypercall changes.
Fixes: 89da76fde68d ("drm/vmwgfx: Add VMWare host messaging capability")
Cc: stable@vger.kernel.org
Closes: https://sashiko.dev/#/patchset/4ab10678a8f50053934b62b56af81f881c1d3798.1788414669.git.zack.rusin%40broadcom.com
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215738.3010276-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -457,7 +457,7 @@ int vmw_host_get_guestinfo(const char *g
/* Remove reply code, which are the first 2 characters of
* the reply
*/
- reply_len = max(reply_len - 2, (size_t) 0);
+ reply_len = reply_len > 2 ? reply_len - 2 : 0;
reply_len = min(reply_len, *length);
if (reply_len > 0)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0909/1059] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (907 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0908/1059] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0910/1059] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Greg Kroah-Hartman
` (89 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Aldo Ariel Panzardo, Zack Rusin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
commit 030e6d11d3e5eb7328f7a3e8177737a4b1c30654 upstream.
vmw_gem_object_get_sg_table() returns vmw_tt->vsgt.sgt when the buffer
object has already been DMA mapped. vmw_ttm_map_dma() sets that field
to &vmw_tt->sgt, which is a member embedded inside the struct
vmw_ttm_tt allocation and not a table of its own.
The core owns whatever .get_sg_table returns. drm_gem_map_dma_buf()
takes the table and drm_gem_unmap_dma_buf() destroys it in full:
dma_unmap_sgtable(attach->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
sg_free_table(sgt);
kfree(sgt);
Both are ops of drm_gem_prime_dmabuf_ops, so the core ends up calling
kfree() on &vmw_tt->sgt, which is not the start of an allocation. The
preceding sg_free_table() also destroys a scatterlist that vmwgfx still
considers its own and frees again from vmw_ttm_unmap_dma().
drm_gem_unmap_dma_buf() runs from dma_buf_detach(), including the
importer's error path, so a failed import is enough to reach it:
exporting a bound buffer with DRM_IOCTL_PRIME_HANDLE_TO_FD and
importing it on a second DRM device with DRM_IOCTL_PRIME_FD_TO_HANDLE
is sufficient. Both ioctls are DRM_RENDER_ALLOW.
Observed on 6.12.101 with KASAN, as uid 65534:
BUG: KASAN: invalid-free in drm_gem_unmap_dma_buf+0xb3/0xf0
Free of addr ffff888008290450 by task poc_mm04_sgtabl/321
CPU: 1 UID: 65534 PID: 321 Comm: poc_mm04_sgtabl Not tainted 6.12.101 #4
kasan_report_invalid_free+0x94/0xc0
check_slab_allocation+0x116/0x120
kfree+0x103/0x360
drm_gem_unmap_dma_buf+0xb3/0xf0
dma_buf_detach+0x165/0x510
drm_gem_prime_import_dev+0x33e/0x430
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 80 bytes inside of
144-byte region [ffff888008290400, ffff888008290490)
80 is offsetof(struct vmw_ttm_tt, sgt) and 144 is sizeof(struct
vmw_ttm_tt), which identifies the freed pointer as the embedded member.
Always return a table the core can own, as the other drivers do.
Reusing the cached representation would require copying it into a
freshly allocated sg_table, never returning the alias.
Fixes: 8afa13a0583f ("drm/vmwgfx: Implement DRIVER_GEM")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260923122601.438892-1-qwe.aldo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
@@ -97,10 +97,13 @@ static struct sg_table *vmw_gem_object_g
struct vmw_ttm_tt *vmw_tt =
container_of(bo->ttm, struct vmw_ttm_tt, dma_ttm);
- if (vmw_tt->vsgt.sgt)
- return vmw_tt->vsgt.sgt;
-
- return drm_prime_pages_to_sg(obj->dev, vmw_tt->dma_ttm.pages, vmw_tt->dma_ttm.num_pages);
+ /*
+ * Do not return &vmw_tt->sgt: the core owns what this returns and
+ * drm_gem_unmap_dma_buf() sg_free_table()s and kfree()s it, but that
+ * sg_table is embedded in the vmw_ttm_tt allocation.
+ */
+ return drm_prime_pages_to_sg(obj->dev, vmw_tt->dma_ttm.pages,
+ vmw_tt->dma_ttm.num_pages);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0910/1059] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (908 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0909/1059] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0911/1059] drm/vmwgfx: log missing primary planes only once Greg Kroah-Hartman
` (88 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vladimir Popov, Zack Rusin
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Popov <popov.nkv@gmail.com>
commit 06f8a6708a98dff199ef7ea553b092efc38b4eab upstream.
If vmw_execbuf_fence_commands() call fails in
vmw_kms_helper_validation_finish(), it sets *p_fence = NULL. If
ctx->bo_list is not empty, the caller, vmw_kms_helper_validation_finish(),
passes the fence through a chain of functions to dma_fence_is_array(),
which causes a NULL pointer dereference in dma_fence_is_array():
vmw_kms_helper_validation_finish() // pass NULL fence
vmw_validation_done()
vmw_validation_bo_fence()
ttm_eu_fence_buffer_objects() // pass NULL fence
dma_resv_add_fence()
dma_fence_is_container()
dma_fence_is_array() // NULL deref
Fix this by adding a NULL check in vmw_validation_bo_fence(): if the fence
is NULL, fall back to ttm_eu_backoff_reservation()to safely release
the buffer object reservations without attempting to add a NULL fence to
dma_resv. This is safe because when fence is NULL, vmw_fallback_wait()
has already been called inside vmw_execbuf_fence_commands() to synchronize
the GPU.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 038ecc503236 ("drm/vmwgfx: Add a validation module v2")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Popov <popov.nkv@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260414105529.9883-1-popov.nkv@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
@@ -134,16 +134,23 @@ vmw_validation_bo_reserve(struct vmw_val
* vmw_validation_bo_fence - Unreserve and fence buffer objects registered
* with a validation context
* @ctx: The validation context
+ * @fence: Fence with which to fence all buffer objects taking part in the
+ * command submission.
*
* This function unreserves the buffer objects previously reserved using
- * vmw_validation_bo_reserve, and fences them with a fence object.
+ * vmw_validation_bo_reserve, and fences them with a fence object if the
+ * given fence object is not NULL.
*/
static inline void
vmw_validation_bo_fence(struct vmw_validation_context *ctx,
struct vmw_fence_obj *fence)
{
- ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list,
- (void *) fence);
+ /* fence is able to be NULL if vmw_execbuf_fence_commands() fails */
+ if (fence)
+ ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list,
+ (void *)fence);
+ else
+ ttm_eu_backoff_reservation(&ctx->ticket, &ctx->bo_list);
}
/**
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0911/1059] drm/vmwgfx: log missing primary planes only once
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (909 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0910/1059] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0912/1059] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Greg Kroah-Hartman
` (87 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit f01848d84577e5860a187eea64f5321acaf1f893 upstream.
Stop filling kernel logs due to something that's not even a bug. Some
igt tests, e.g. kms_flip trigger this message ~17000 times which makes
all the other diagnostics almost impossible to find.
Just inform the user about this condition once and let it through
afterward.
Fixes: a60ccade88f9 ("drm/vmwgfx: Fix crtc's atomic check conditional")
Cc: stable@vger.kernel.org
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215540.3008997-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -821,9 +821,8 @@ int vmw_du_crtc_atomic_check(struct drm_
* some actual rendering so give a clue as why it's blank.
*/
if (new_state->enable && !has_primary)
- drm_dbg_driver(&vmw->drm,
- "CRTC without a primary plane will be blank.\n");
-
+ drm_info_once(&vmw->drm,
+ "CRTC without a primary plane will be blank.\n");
if (new_state->connector_mask != connector_mask &&
new_state->connector_mask != 0) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0912/1059] drm/vmwgfx: return an error when a shared GB surface has no backup buffer
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (910 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0911/1059] drm/vmwgfx: log missing primary planes only once Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0913/1059] drm/vmwgfx: validate command body sizes before parsing Greg Kroah-Hartman
` (86 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Aldo Ariel Panzardo
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
commit 3a2f97af36754b64083d463a4cee0af26826bec8 upstream.
vmw_gb_surface_reference_internal() rejects a surface that has no backup
buffer by logging an error and jumping to out_bad_resource, but it never
sets ret on that path. ret is still 0 from the earlier successful
vmw_surface_handle_reference(), so the ioctl returns success while
leaving the reply structure unfilled — user space is handed a
"successful" reply that was never produced. DRM_VMW_GB_SURFACE_REF is
DRM_RENDER_ALLOW, so an unprivileged local user can reach it.
Set ret to -EINVAL and, on the error paths, drop the reference that
vmw_surface_handle_reference() took; once the ioctl fails user space no
longer releases it via DRM_VMW_UNREF_SURFACE. The unref is guarded by
ret so the shared success fall-through keeps the reference the caller
still owns, and it also plugs the same leak on the drm_gem_handle_create()
failure path.
Fixes: 14b1c33e8429 ("drm/vmwgfx: Add new ioctl for GB surface create and reference")
Cc: stable@vger.kernel.org
Suggested-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
[zack: aligned a continuation line with the open parenthesis]
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20261007212051.2574235-2-qwe.aldo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1612,6 +1612,7 @@ vmw_gb_surface_reference_internal(struct
srf = &user_srf->srf;
if (!srf->res.backup) {
DRM_ERROR("Shared GB surface is missing a backup buffer.\n");
+ ret = -EINVAL;
goto out_bad_resource;
}
metadata = &srf->metadata;
@@ -1650,6 +1651,9 @@ vmw_gb_surface_reference_internal(struct
rep->creq.must_be_zero = 0;
out_bad_resource:
+ if (ret)
+ ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+ base->handle);
ttm_base_object_unref(&base);
return ret;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0913/1059] drm/vmwgfx: validate command body sizes before parsing
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (911 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0912/1059] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0914/1059] ALSA: pcm: oss: Restore params flag after failed reconfiguration Greg Kroah-Hartman
` (85 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 06069d6d650dbef746eb933e2f4fbfc686b6d330 upstream.
vmw_cmd_check verifies that a command's declared size fits in the
submitted buffer, but handlers can access fields beyond the declared
body. A truncated body can therefore cause relocations to target the
next command. Applying those relocations after validation can change
an already validated command ID and bypass command restrictions.
Legacy query conversion can also overwrite the next command, while
texture-state parsing can access fields beyond a truncated final record.
Check each handler's minimum body size before accessing command fields.
Use the common prefix for shared handlers to preserve shorter command
variants, and reject texture-state arrays containing incomplete records.
Fixes: fb1d9738ca05 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU")
Cc: stable@vger.kernel.org
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261111193836.3161904-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 200 ++++++++++++++++++++++++++++++++
1 file changed, 200 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -578,6 +578,29 @@ static int vmw_cmd_ok(struct vmw_private
}
/**
+ * vmw_cmd_body_fits - Check that a command body covers what a handler reads
+ *
+ * @header: Pointer to the command header in the command stream.
+ * @size: Number of body bytes that the command handler interprets.
+ *
+ * vmw_cmd_check() only verifies that @header->size fits into the submitted
+ * command buffer. A handler that reads past the declared body reads the next
+ * command, which is verified separately. A relocation recorded there would
+ * rewrite the already verified command after verification has finished.
+ *
+ * Return: true if the body is at least @size bytes, false otherwise.
+ */
+static bool vmw_cmd_body_fits(const SVGA3dCmdHeader *header, size_t size)
+{
+ if (likely(header->size >= size))
+ return true;
+
+ VMW_DEBUG_USER("SVGA3D command %u: body size %u is smaller than %zu.\n",
+ header->id, header->size, size);
+ return false;
+}
+
+/**
* vmw_resources_reserve - Reserve all resources on the sw_context's resource
* list.
*
@@ -823,6 +846,9 @@ static int vmw_cmd_cid_check(struct vmw_
VMW_DECLARE_CMD_VAR(*cmd, uint32_t) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
&cmd->body, NULL);
@@ -866,6 +892,8 @@ static int vmw_cmd_set_render_target_che
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (cmd->body.type >= SVGA3D_RT_MAX) {
VMW_DEBUG_USER("Illegal render target type %u.\n",
@@ -911,6 +939,8 @@ static int vmw_cmd_surface_copy_check(st
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
@@ -931,6 +961,9 @@ static int vmw_cmd_buffer_copy_check(str
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.src, NULL);
@@ -950,6 +983,9 @@ static int vmw_cmd_pred_copy_check(struc
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcSid, NULL);
@@ -969,6 +1005,9 @@ static int vmw_cmd_stretch_blt_check(str
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.src.sid, NULL);
@@ -987,6 +1026,9 @@ static int vmw_cmd_blt_surf_screen_check
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBlitSurfaceToScreen) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcImage.sid, NULL);
@@ -999,6 +1041,9 @@ static int vmw_cmd_present_check(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdPresent) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1253,6 +1298,8 @@ static int vmw_cmd_dx_define_query(struc
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (cmd->body.type < SVGA3D_QUERYTYPE_MIN ||
cmd->body.type >= SVGA3D_QUERYTYPE_MAX)
@@ -1290,6 +1337,8 @@ static int vmw_cmd_dx_bind_query(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
/*
* Look up the buffer pointed to by q.mobid, put it on the relocation
@@ -1320,6 +1369,9 @@ static int vmw_cmd_begin_gb_query(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBeginGBQuery) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
&cmd->body.cid, NULL);
@@ -1339,6 +1391,9 @@ static int vmw_cmd_begin_query(struct vm
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBeginQuery) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (unlikely(dev_priv->has_mob)) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdBeginGBQuery);
@@ -1374,6 +1429,9 @@ static int vmw_cmd_end_gb_query(struct v
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
if (unlikely(ret != 0))
return ret;
@@ -1404,6 +1462,9 @@ static int vmw_cmd_end_query(struct vmw_
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (dev_priv->has_mob) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdEndGBQuery);
@@ -1450,6 +1511,9 @@ static int vmw_cmd_wait_gb_query(struct
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
if (unlikely(ret != 0))
return ret;
@@ -1478,6 +1542,9 @@ static int vmw_cmd_wait_query(struct vmw
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (dev_priv->has_mob) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdWaitForGBQuery);
@@ -1647,6 +1714,15 @@ static int vmw_cmd_tex_state(struct vmw_
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
+ /* The loop below must not read a truncated trailing state. */
+ if ((header->size - sizeof(cmd->body)) % sizeof(*cur_state)) {
+ VMW_DEBUG_USER("Invalid texture state size %u.\n",
+ header->size);
+ return -EINVAL;
+ }
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -1792,6 +1868,9 @@ static int vmw_cmd_bind_gb_surface(struc
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBindGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface,
user_surface_converter, &cmd->body.sid,
&cmd->body.mobid, 0);
@@ -1811,6 +1890,9 @@ static int vmw_cmd_update_gb_image(struc
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdUpdateGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1830,6 +1912,9 @@ static int vmw_cmd_update_gb_surface(str
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdUpdateGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1849,6 +1934,9 @@ static int vmw_cmd_readback_gb_image(str
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdReadbackGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1869,6 +1957,9 @@ static int vmw_cmd_readback_gb_surface(s
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdReadbackGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1889,6 +1980,9 @@ static int vmw_cmd_invalidate_gb_image(s
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdInvalidateGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1909,6 +2003,9 @@ static int vmw_cmd_invalidate_gb_surface
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdInvalidateGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1931,6 +2028,8 @@ static int vmw_cmd_shader_define(struct
struct vmw_resource *ctx;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -1970,6 +2069,8 @@ static int vmw_cmd_shader_destroy(struct
struct vmw_resource *ctx;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -2009,6 +2110,8 @@ static int vmw_cmd_set_shader(struct vmw
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (!vmw_shadertype_is_valid(VMW_SM_LEGACY, cmd->body.type)) {
VMW_DEBUG_USER("Illegal shader type %u.\n",
@@ -2087,6 +2190,8 @@ static int vmw_cmd_set_shader_const(stru
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -2114,6 +2219,9 @@ static int vmw_cmd_bind_gb_shader(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBindGBShader) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader,
user_shader_converter, &cmd->body.shid,
&cmd->body.mobid, cmd->body.offsetInBytes);
@@ -2143,6 +2251,9 @@ vmw_cmd_dx_set_single_constant_buffer(st
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, &res);
@@ -2196,6 +2307,9 @@ vmw_cmd_dx_set_constant_buffer_offset(st
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (cmd->body.slot >= SVGA3D_DX_MAX_CONSTBUFFERS) {
VMW_DEBUG_USER("Illegal const buffer slot %u.\n",
(unsigned int) cmd->body.slot);
@@ -2227,6 +2341,9 @@ static int vmw_cmd_dx_set_shader_res(str
u32 num_sr_view = (cmd->header.size - sizeof(cmd->body)) /
sizeof(SVGA3dShaderResourceViewId);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if ((u64) cmd->body.startView + (u64) num_sr_view >
(u64) SVGA3D_DX_MAX_SRVIEWS ||
!vmw_shadertype_is_valid(dev_priv->sm_type, cmd->body.type)) {
@@ -2262,6 +2379,8 @@ static int vmw_cmd_dx_set_shader(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (!vmw_shadertype_is_valid(dev_priv->sm_type, cmd->body.type)) {
VMW_DEBUG_USER("Illegal shader type %u.\n",
@@ -2319,6 +2438,9 @@ static int vmw_cmd_dx_set_vertex_buffers
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
num = (cmd->header.size - sizeof(cmd->body)) /
sizeof(SVGA3dVertexBuffer);
if ((u64)num + (u64)cmd->body.startBuffer >
@@ -2370,6 +2492,9 @@ static int vmw_cmd_dx_set_index_buffer(s
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, &res);
@@ -2405,6 +2530,9 @@ static int vmw_cmd_dx_set_rendertargets(
sizeof(SVGA3dRenderTargetViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (num_rt_view > SVGA3D_DX_MAX_RENDER_TARGETS) {
VMW_DEBUG_USER("Invalid DX Rendertarget binding.\n");
return -EINVAL;
@@ -2436,6 +2564,9 @@ static int vmw_cmd_dx_clear_rendertarget
container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_view_id_val_add(sw_context, vmw_view_rt,
cmd->body.renderTargetViewId);
@@ -2458,6 +2589,9 @@ static int vmw_cmd_dx_clear_depthstencil
container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_view_id_val_add(sw_context, vmw_view_ds,
cmd->body.depthStencilViewId);
@@ -2491,6 +2625,9 @@ static int vmw_cmd_dx_view_define(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(*cmd) - sizeof(*header)))
+ return -EINVAL;
+
if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) {
VMW_DEBUG_USER("Invalid surface id.\n");
return -EINVAL;
@@ -2539,6 +2676,9 @@ static int vmw_cmd_dx_set_so_targets(str
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
num = (cmd->header.size - sizeof(cmd->body)) / sizeof(SVGA3dSoTarget);
if (num > SVGA3D_DX_MAX_SOTARGETS) {
@@ -2592,6 +2732,9 @@ static int vmw_cmd_dx_so_define(struct v
if (IS_ERR_OR_NULL(res))
return res ? PTR_ERR(res) : -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(*cmd) - sizeof(*header)))
+ return -EINVAL;
+
ret = vmw_cotable_notify(res, cmd->defined_id);
return ret;
@@ -2627,6 +2770,9 @@ static int vmw_cmd_dx_check_subresource(
offsetof(typeof(*cmd), sid));
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->sid)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->sid, NULL);
@@ -2668,6 +2814,9 @@ static int vmw_cmd_dx_view_remove(struct
struct vmw_resource *view;
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2705,6 +2854,9 @@ static int vmw_cmd_dx_define_shader(stru
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2736,6 +2888,9 @@ static int vmw_cmd_dx_destroy_shader(str
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2762,6 +2917,9 @@ static int vmw_cmd_dx_bind_shader(struct
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (cmd->body.cid != SVGA3D_INVALID_ID) {
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET,
@@ -2813,6 +2971,9 @@ static int vmw_cmd_dx_genmips(struct vmw
struct vmw_resource *view;
struct vmw_res_cache_entry *rcache;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
view = vmw_view_id_val_add(sw_context, vmw_view_sr,
cmd->body.shaderResourceViewId);
if (IS_ERR(view))
@@ -2846,6 +3007,9 @@ static int vmw_cmd_dx_transfer_from_buff
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcSid, NULL);
@@ -2871,6 +3035,9 @@ static int vmw_cmd_intra_surface_copy(st
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdIntraSurfaceCopy) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!(dev_priv->capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY))
return -EINVAL;
@@ -2919,6 +3086,9 @@ static int vmw_cmd_clear_uav_uint(struct
} *cmd = container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2938,6 +3108,9 @@ static int vmw_cmd_clear_uav_float(struc
} *cmd = container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2959,6 +3132,9 @@ static int vmw_cmd_set_uav(struct vmw_pr
sizeof(SVGA3dUAViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2991,6 +3167,9 @@ static int vmw_cmd_set_cs_uav(struct vmw
sizeof(SVGA3dUAViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3023,6 +3202,9 @@ static int vmw_cmd_dx_define_streamoutpu
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3054,6 +3236,9 @@ static int vmw_cmd_dx_destroy_streamoutp
SVGA3dCmdDXDestroyStreamOutput body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node) {
DRM_ERROR("DX Context not set.\n");
return -EINVAL;
@@ -3091,6 +3276,9 @@ static int vmw_cmd_dx_bind_streamoutput(
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3133,6 +3321,9 @@ static int vmw_cmd_dx_set_streamoutput(s
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node) {
DRM_ERROR("DX Context not set.\n");
return -EINVAL;
@@ -3185,6 +3376,9 @@ static int vmw_cmd_indexed_instanced_ind
SVGA3dCmdDXDrawIndexedInstancedIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3202,6 +3396,9 @@ static int vmw_cmd_instanced_indirect(st
SVGA3dCmdDXDrawInstancedIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3219,6 +3416,9 @@ static int vmw_cmd_dispatch_indirect(str
SVGA3dCmdDXDispatchIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0914/1059] ALSA: pcm: oss: Restore params flag after failed reconfiguration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (912 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0913/1059] drm/vmwgfx: validate command body sizes before parsing Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0915/1059] ARC: io: work around GCC PR127718 in __raw_write{w,l}() Greg Kroah-Hartman
` (84 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ye Weihua, Takashi Iwai
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Weihua <yeweihua4@huawei.com>
commit bc3d6817c5325e76578cdd75e9c08bdadc5f73c4 upstream.
snd_pcm_runtime_buffer_set_silence() may fail with -EBUSY when a
concurrent PCM transfer is accessing the buffer. The error path
releases runtime->oss.buffer and clears the plugins, but leaves
runtime->oss.params cleared as well. A subsequent small read/write
then skips the reconfiguration and dereferences the released buffer:
Unable to handle kernel NULL pointer dereference at virtual address
0000000000000000
pc : __arch_copy_from_user+0x78/0x23c
lr : snd_pcm_oss_write+0x10c/0x340 [snd_pcm_oss]
Restore runtime->oss.params on the error path so that the next OSS
operation reconfigures and reallocates the buffer.
Fixes: 47c27c9c9c72 ("ALSA: pcm: Improve the fix for race of buffer access at PCM OSS layer")
Cc: stable@vger.kernel.org
Signed-off-by: Ye Weihua <yeweihua4@huawei.com>
Link: https://patch.msgid.link/20261116064850.3540576-1-yeweihua4@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/core/oss/pcm_oss.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1093,8 +1093,10 @@ static int snd_pcm_oss_change_params_loc
err = 0;
failure:
- if (err)
+ if (err) {
+ runtime->oss.params = 1;
snd_pcm_oss_release_buffers(substream);
+ }
kfree(sw_params);
kfree(params);
kfree(sparams);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0915/1059] ARC: io: work around GCC PR127718 in __raw_write{w,l}()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (913 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0914/1059] ALSA: pcm: oss: Restore params flag after failed reconfiguration Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0916/1059] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer Greg Kroah-Hartman
` (83 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vineet Gupta
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <vgupta@kernel.org>
commit 603b4fd69b4e77770761ea03451e2164186f8590 upstream.
The __raw_write{w,l}() accessors use inline asm with an "m" operand for
the store destination. GCC's ARC backend lets "m" match any legitimate
address, including the register-indexed [b,c] forms that only loads
support: stores only have [reg], [reg,s9] and [limm] addressing. With
newer GCC (late-combine in GCC 15, combine in GCC 16), a writew() with a
scaled, non-constant offset gets
stw.as r2,[r0,r1]
which the assembler rejects:
Error: inappropriate arguments for opcode 'stw'
With GCC 16 this breaks even hsdk_defconfig (drivers/net/pcs/
pcs-xpcs-plat.c) and axs101_defconfig. allyesconfig additionally trips
in drivers/pinctrl/renesas/pinctrl-rza2.c and drivers/video/fbdev/
s3c-fb.c.
Work around it by passing the address in a register and using a fixed
[%1] address in the asm template, so the compiler can't pick an
addressing mode that stores don't support. This is the minimal fix.
The next patch drops the inline asm altogether.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127718
Cc: stable@vger.kernel.org
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arc/include/asm/io.h | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -137,10 +137,14 @@ static inline void __raw_writeb(u8 b, vo
#define __raw_writew __raw_writew
static inline void __raw_writew(u16 s, volatile void __iomem *addr)
{
+ /*
+ * Not an "m" operand: GCC can pick a register-indexed address for it,
+ * which ST doesn't support (GCC PR target/127718).
+ */
__asm__ __volatile__(
- " stw%U1 %0, %1 \n"
+ " stw %0, [%1] \n"
:
- : "r" (s), "m" (*(volatile u16 __force *)addr)
+ : "r" (s), "r" (addr)
: "memory");
}
@@ -148,10 +152,11 @@ static inline void __raw_writew(u16 s, v
#define __raw_writel __raw_writel
static inline void __raw_writel(u32 w, volatile void __iomem *addr)
{
+ /* See __raw_writew() above for why this doesn't use an "m" operand. */
__asm__ __volatile__(
- " st%U1 %0, %1 \n"
+ " st %0, [%1] \n"
:
- : "r" (w), "m" (*(volatile u32 __force *)addr)
+ : "r" (w), "r" (addr)
: "memory");
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0916/1059] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (914 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0915/1059] ARC: io: work around GCC PR127718 in __raw_write{w,l}() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0917/1059] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks Greg Kroah-Hartman
` (82 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Julius Bairaktaris, Mark Brown
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Bairaktaris <julius@bairaktaris.de>
commit 4c15e549b7ad03183d10826da91e9ddc207a02cd upstream.
q6asm_dai_compr_open() allocates a fixed 8 MiB DMA buffer, but
q6asm_dai_compr_set_params() takes the ring size from the fragment size
and count that userspace passes to SNDRV_COMPRESS_SET_PARAMS without
checking it against that buffer. The compress core checks the geometry
against the runtime buffer only for drivers without a copy callback.
q6asm_compr_copy() places each write() at the stream position modulo the
ring size, so a ring larger than the DMA buffer lets write() copy user
data past its end, and after SNDRV_COMPRESS_NEXT_TRACK the copy starts at
the next multiple of the fragment size.
Reject a ring larger than the DMA buffer.
Fixes: a08cd56a4524 ("ASoC: q6asm-dai: add support to copy callback")
Cc: stable@vger.kernel.org
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://patch.msgid.link/20261111080624.244291-3-julius@bairaktaris.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/q6asm-dai.c | 3 +++
1 file changed, 3 insertions(+)
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -895,6 +895,9 @@ static int q6asm_dai_compr_set_params(st
return -EINVAL;
}
+ if (runtime->buffer_size > prtd->dma_buffer.bytes)
+ return -EINVAL;
+
prtd->periods = runtime->fragments;
prtd->pcm_count = runtime->fragment_size;
prtd->pcm_size = runtime->fragments * runtime->fragment_size;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0917/1059] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (915 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0916/1059] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0918/1059] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Greg Kroah-Hartman
` (81 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, yzddMr6, Srinivas Kandagatla,
Mark Brown
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: yzddMr6 <yzddmr6@gmail.com>
commit bd6e011c8121c909daf51c78b56bb3bf7f467889 upstream.
The clk ops of the q6dsp clock controller look up struct q6dsp_cc with
dev_get_drvdata(), but q6dsp_clock_dev_probe() sets the driver data only
after it has registered the clocks and added the OF clock provider. A
consumer that gets and prepares one of the clocks in between
dereferences a NULL pointer.
fw_devlink does not keep consumers out of that window. The q6prm and
q6afe clock controllers are described below the ADSP remoteproc node,
and their devices are only created once the ADSP has booted and its
GPR/APR services have come up, long after the remoteproc device has
bound. fw_devlink therefore makes the remoteproc device the supplier of
their consumers. A consumer such as the LPASS LPI pinctrl then just
defers until of_clk_get() succeeds, and its retry from the deferred
probe worker can run while the clock controller is still in its probe.
That happened once on a Xiaomi Pad 8 Pro (SM8750). While the LPI pinctrl
probe registered its GPIO chip, gpiolib read a GPIO direction, which
runtime resumed the device and prepared its q6prm vote clocks through
pm_clk. The prepare op then faulted with a NULL pointer dereference at
virtual address 0x350 (trimmed):
pc : clk_vote_q6dsp_block+0x24/0x58 [snd_q6dsp_common]
lr : clk_core_prepare+0x7c/0x298
Call trace:
clk_vote_q6dsp_block+0x24/0x58 [snd_q6dsp_common] (P)
clk_core_prepare+0x7c/0x298
clk_prepare+0x28/0x44
pm_clk_resume+0x10c/0x188
pm_generic_runtime_resume+0x2c/0x44
...
__pm_runtime_resume+0x50/0x94
...
lpi_gpio_get_direction+0x4c/0x8c [pinctrl_lpass_lpi]
gpiochip_add_data_with_key+0x7b0/0x10dc
devm_gpiochip_add_data_with_key+0x38/0x8c
lpi_pinctrl_probe+0x2b8/0x320 [pinctrl_lpass_lpi]
...
deferred_probe_work_func+0x88/0xc0
0x350 is the offset of desc in struct q6dsp_cc; the driver data pointer
it was loaded from was NULL. The oops left the clk prepare_lock held,
which blocks every later clk_prepare(), and the system did not finish
booting.
On mainline the window is short, but it includes a wait for prepare_lock
in clk_core_reparent_orphans(), which of_clk_add_hw_provider() calls
right after listing the provider. The kernel that hit this had
out-of-tree changes to drivers/clk/clk.c that do more work at that
point, which makes the window wider.
Both q6afe-clocks and q6prm-clocks use q6dsp_clock_dev_probe(). Set the
driver data before the first clock is registered.
The oops was analysed and the fix written with the help of an AI coding
assistant.
Fixes: 9ab71ac37240 ("ASoC: qdsp6: q6afe-clocks: move audio-clocks to common file")
Cc: stable@vger.kernel.org
Signed-off-by: yzddMr6 <yzddmr6@gmail.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20261115-upstream-q6dsp-clk-drvdata-v1-1-4d7dbea52e52@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
@@ -147,6 +147,12 @@ int q6dsp_clock_dev_probe(struct platfor
cc->dev = dev;
q6dsp_clks = desc->clks;
+ /*
+ * The clk ops look up cc through the driver data, so set it before
+ * any of the clocks can be prepared.
+ */
+ dev_set_drvdata(dev, cc);
+
for (i = 0; i < desc->num_clks; i++) {
unsigned int id = q6dsp_clks[i].clk_id;
struct clk_init_data init = {
@@ -175,12 +181,6 @@ int q6dsp_clock_dev_probe(struct platfor
return ret;
}
- ret = devm_of_clk_add_hw_provider(dev, q6dsp_of_clk_hw_get, cc);
- if (ret)
- return ret;
-
- dev_set_drvdata(dev, cc);
-
- return 0;
+ return devm_of_clk_add_hw_provider(dev, q6dsp_of_clk_hw_get, cc);
}
EXPORT_SYMBOL_GPL(q6dsp_clock_dev_probe);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0918/1059] ASoC: wm8962: Fix broken headset button caused by wrong guard constant
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (916 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0917/1059] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0919/1059] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT Greg Kroah-Hartman
` (80 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chen Yuxi, Charles Keepax,
Sebastian Krzyszkowiak, Mark Brown
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yuxi <chenyuxi19@huawei.com>
commit fd3b0fc97ea72d027359e7603a1224703cec1864 upstream.
Commit e59075211902 ("ASoC: wm8962: Don't report a microphone if
it's shorted to ground on plug") guards the mic short report by
testing wm8962->mic_status against WM8962_MICDET_STS. But mic_status
stores the reported jack status, composed of SND_JACK_MICROPHONE and
SND_JACK_BTN_0, which never has WM8962_MICDET_STS set. The guard is
therefore always true, so every mic short event reports nothing.
Pressing the button on a TRRS headset shorts the mic pin to ground,
which used to be reported as SND_JACK_BTN_0. After that commit the
button press is silently dropped, breaking the headset button on all
wm8962 boards using the mic detect path.
Test mic_status against SND_JACK_MICROPHONE instead, restoring the
intended behaviour: suppress the report only when no microphone was
previously detected, i.e. a TRS plug in a TRRS socket.
Fixes: e59075211902 ("ASoC: wm8962: Don't report a microphone if it's shorted to ground on plug")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Yuxi <chenyuxi19@huawei.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Link: https://patch.msgid.link/20261117070516.3861828-1-chenyuxi19@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/codecs/wm8962.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3079,7 +3079,7 @@ static void wm8962_mic_work(struct work_
/* Don't report a microphone if it's shorted right after
* plugging in, as this may be a TRS plug in a TRRS socket.
*/
- if (!(wm8962->mic_status & WM8962_MICDET_STS))
+ if (!(wm8962->mic_status & SND_JACK_MICROPHONE))
status = 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0919/1059] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (917 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0918/1059] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0920/1059] blk-iocost: Fix overflow in donation weight calculation Greg Kroah-Hartman
` (79 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
commit e2954988bb987c1432806379f602573d2388df93 upstream.
ata_scsi_security_inout_xlat() tests the INC_512 bit with cdb[4] & 7.
INC_512 is bit 7 of byte 4 of the SECURITY PROTOCOL IN and SECURITY
PROTOCOL OUT CDBs (SPC-6, tables 280 and 282), and bits 6:0 of that
byte are reserved.
Test bit 7 instead.
Fixes: 818831c8b22f ("libata: implement SECURITY PROTOCOL IN/OUT")
Cc: stable@vger.kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261116191008.2954277-2-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/ata/libata-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4035,7 +4035,7 @@ static unsigned int ata_scsi_security_in
return 1;
}
- if (cdb[4] & 7) { /* INC_512 */
+ if (cdb[4] & 0x80) { /* INC_512 */
if (len > 0xffff) {
ata_scsi_set_invalid_field(qc->dev, scmd, 6, 0);
return 1;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0920/1059] blk-iocost: Fix overflow in donation weight calculation
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (918 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0919/1059] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0921/1059] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Greg Kroah-Hartman
` (78 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Kazinsky, Tejun Heo, Jens Axboe
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Kazinsky <a.kazinsky@ideco.ru>
commit a56d5a485be4a9d52f0d7b3ed0dc3521367cb986 upstream.
hweight_after_donation() receives usage as u32, clamped to the range
[1, WEIGHT_ONE]. Since WEIGHT_ONE is 1 << 16, multiplying it by usage
equal to WEIGHT_ONE wraps the 32-bit unsigned result to zero before
it is passed to div64_s64().
This makes new_hwi zero, which is then clamped to 1, incorrectly
reducing the cgroup's in-use weight to the minimum.
Cast WEIGHT_ONE to s64 before multiplication to preserve the full
product.
Found by Linux Verification Center (linuxtesting.org) with SVACE static
analysis tool.
Fixes: f1de2439ec43 ("blk-iocost: revamp donation amount determination")
Cc: stable@vger.kernel.org
Signed-off-by: Alex Kazinsky <a.kazinsky@ideco.ru>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261113110842.4189035-1-a.kazinsky@ideco.ru
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
block/blk-iocost.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -1841,7 +1841,8 @@ static u32 hweight_after_donation(struct
delta = div64_s64(WEIGHT_ONE * (now->vnow - vtime),
now->vnow - ioc->period_at_vtime);
target = WEIGHT_ONE * MARGIN_TARGET_PCT / 100;
- new_hwi = div64_s64(WEIGHT_ONE * usage, WEIGHT_ONE - target + delta);
+ new_hwi = div64_s64((s64)WEIGHT_ONE * usage,
+ WEIGHT_ONE - target + delta);
return clamp_t(s64, new_hwi, 1, hwm);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0921/1059] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (919 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0920/1059] blk-iocost: Fix overflow in donation weight calculation Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0922/1059] Bluetooth: MGMT: Fix runtime config status opcode Greg Kroah-Hartman
` (77 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Luiz Augusto von Dentz
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit 45a25a1bfd267d9e420119a48e5291d7882395df upstream.
qca_controller_memdump() frees qca_memdump when a memdump packet with a
non-zero sequence number arrives while QCA_MEMDUMP_COLLECTION is not
set, but leaves qca->qca_memdump pointing at the freed object.
The next run of the work reads the stale pointer into its local
variable, skips the allocation and uses the freed memory. Another
packet with a non-zero sequence number frees it a second time, and a
packet with sequence number 0 writes ram_dump_size, current_seq_no and
received_dump into it.
The original code cleared the pointer here; the assignment was dropped
when the condition was changed to test QCA_MEMDUMP_COLLECTION. All
other places that free the structure clear the pointer.
A controller that sends two memdump events without a leading sequence
number 0 can trigger a use-after-free or double free of a kmalloc
object.
Found by LLM-assisted source review.
Fixes: 06d3fdfcdf5c ("Bluetooth: hci_qca: Add qcom devcoredump support")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/bluetooth/hci_qca.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1081,6 +1081,7 @@ static void qca_controller_memdump(struc
if (!memdump_buf) {
bt_dev_err(hu->hdev, "QCA: Discarding other packets");
kfree(qca_memdump);
+ qca->qca_memdump = NULL;
kfree_skb(skb);
qca->qca_memdump = NULL;
mutex_unlock(&qca->hci_memdump_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0922/1059] Bluetooth: MGMT: Fix runtime config status opcode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (920 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0921/1059] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0923/1059] cpufreq: CPPC: Set CPPC Enable register in cpu_init() Greg Kroah-Hartman
` (76 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Xu Rao, Luiz Augusto von Dentz
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <raoxu@uniontech.com>
commit 4728474344793dd67956e03a2cb244b71383ef7c upstream.
The Set Default Runtime Configuration command uses opcode 0x004e,
but set_def_runtime_config() reports its invalid-parameter status with
the Set Default System Configuration opcode, 0x004c.
A management client that matches Command Status events to its pending
request by opcode therefore cannot associate the response with the
request it sent. Runtime configuration parameters are not implemented,
so the command still returns MGMT_STATUS_INVALID_PARAMS.
Use MGMT_OP_SET_DEF_RUNTIME_CONFIG for the status event so the response
identifies the command that was actually handled.
Fixes: aececa645dc7 ("Bluetooth: mgmt: Add commands for runtime configuration")
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Cc: stable@vger.kernel.org
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bluetooth/mgmt_config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -349,6 +349,6 @@ int set_def_runtime_config(struct sock *
{
bt_dev_dbg(hdev, "sock %p", sk);
- return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEF_SYSTEM_CONFIG,
+ return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEF_RUNTIME_CONFIG,
MGMT_STATUS_INVALID_PARAMS);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0923/1059] cpufreq: CPPC: Set CPPC Enable register in cpu_init()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (921 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0922/1059] Bluetooth: MGMT: Fix runtime config status opcode Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0924/1059] dma-coherent: serialize reserved memory pool initialization Greg Kroah-Hartman
` (75 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sumit Gupta, Christian Loehle,
Rafael J. Wysocki
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Gupta <sumitg@nvidia.com>
commit 7cca01c39cc89f6ef39079484d26b6d99287a610 upstream.
As per ACPI 6.x s8.4.6.1.4 (CPPC Enable Register):
"If supported by the platform, OSPM writes a one to this register
to enable CPPC on this processor. If not implemented, OSPM assumes
the platform always has CPPC enabled."
The driver never writes this register. CPPC therefore stays disabled
on platforms such as NVIDIA GB10 that wait for OSPM to enable it.
Call cppc_set_enable() in cppc_cpufreq_cpu_init(). Fail init if
enabling CPPC fails. If init fails after CPPC is enabled, disable it
again. The register is optional, so -EOPNOTSUPP is not an error.
Fixes: 5477fb3bd1e8 ("ACPI / CPPC: Add a CPUFreq driver for use with CPPC")
Cc: All applicable <stable@vger.kernel.org> # ab482f1bac6b "ACPI: CPPC: Refactor register value get and set ABIs"
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
[ rjw: Subject tweak ]
Link: https://patch.msgid.link/20261110101246.3665797-1-sumitg@nvidia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/cppc_cpufreq.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -669,7 +669,17 @@ static int cppc_cpufreq_cpu_init(struct
pr_debug("Unsupported CPU co-ord type: %d\n",
policy->shared_type);
ret = -EFAULT;
- goto out;
+ goto out_put;
+ }
+
+ /*
+ * Enable CPPC. The Enable register is optional - some platforms
+ * may not support it.
+ */
+ ret = cppc_set_enable(cpu, true);
+ if (ret && ret != -EOPNOTSUPP) {
+ pr_err("Failed to enable CPPC for CPU%u (%d)\n", cpu, ret);
+ goto out_put;
}
policy->fast_switch_possible = cppc_allow_fast_switch();
@@ -697,6 +707,8 @@ static int cppc_cpufreq_cpu_init(struct
return 0;
out:
+ cppc_set_enable(cpu, false);
+out_put:
cppc_cpufreq_put_cpu_data(policy);
return ret;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0924/1059] dma-coherent: serialize reserved memory pool initialization
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (922 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0923/1059] cpufreq: CPPC: Set CPPC Enable register in cpu_init() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0925/1059] dma: swiotlb: Serialize restricted DMA " Greg Kroah-Hartman
` (74 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Marek Szyprowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <m.szyprowski@samsung.com>
commit 494f40ffabcdc8d9fa4012b2c972690f25a0a40f upstream.
Multiple devices can share the same "shared-dma-pool" reserved memory
region, in which case the dma_coherent_mem structure is created by the
first device attached to it and stored in rmem->priv. To avoid the
potential race, serialize the check and initialization of rmem->priv
with a mutex.
Fixes: 7bfa5ab6fa1b ("drivers: dma-coherent: add initialization from device tree")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20261026095423.966856-2-m.szyprowski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/dma/coherent.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/kernel/dma/coherent.c
+++ b/kernel/dma/coherent.c
@@ -7,6 +7,7 @@
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/dma-direct.h>
#include <linux/dma-map-ops.h>
@@ -333,10 +334,18 @@ int dma_init_global_coherent(phys_addr_t
static struct reserved_mem *dma_reserved_default_memory __initdata;
#endif
+static DEFINE_MUTEX(rmem_dma_mutex);
+
static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev)
{
- struct dma_coherent_mem *mem = rmem->priv;
+ struct dma_coherent_mem *mem;
+ /*
+ * Multiple devices can share the same pool and may be probed
+ * concurrently, so serialize the initialization of rmem->priv.
+ */
+ guard(mutex)(&rmem_dma_mutex);
+ mem = rmem->priv;
if (!mem) {
mem = dma_init_coherent_memory(rmem->base, rmem->base,
rmem->size, true);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0925/1059] dma: swiotlb: Serialize restricted DMA pool initialization
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (923 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0924/1059] dma-coherent: serialize reserved memory pool initialization Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0926/1059] EDAC/i5000: Fix slot number passed to determine_mtr() Greg Kroah-Hartman
` (73 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Marek Szyprowski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <m.szyprowski@samsung.com>
commit 7ad92b81b415de806957b19828fc4777a9cf2216 upstream.
Multiple devices can share the same restricted DMA pool, in which case
the io_tlb_mem structure is allocated and initialized by the first
device attached to it and stored in rmem->priv. To avoid the potential
race, serialize the check and initialization of rmem->priv with a mutex.
Fixes: 0b84e4f8b793 ("swiotlb: Add restricted DMA pool initialization")
Closes: https://sashiko.dev/#/bug/linux-6fda7589-591d-4a68-b6e1-b1561f867319
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20261026095423.966856-3-m.szyprowski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/dma/swiotlb.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/memblock.h>
#include <linux/mm.h>
+#include <linux/mutex.h>
#include <linux/pfn.h>
#include <linux/scatterlist.h>
#include <linux/set_memory.h>
@@ -1044,10 +1045,12 @@ bool swiotlb_free(struct device *dev, st
return true;
}
+static DEFINE_MUTEX(rmem_swiotlb_mutex);
+
static int rmem_swiotlb_device_init(struct reserved_mem *rmem,
struct device *dev)
{
- struct io_tlb_mem *mem = rmem->priv;
+ struct io_tlb_mem *mem;
unsigned long nslabs = rmem->size >> IO_TLB_SHIFT;
/* Set Per-device io tlb area to one */
@@ -1061,8 +1064,10 @@ static int rmem_swiotlb_device_init(stru
/*
* Since multiple devices can share the same pool, the private data,
* io_tlb_mem struct, will be initialized by the first device attached
- * to it.
+ * to it. Serialize this, as devices may be probed concurrently.
*/
+ guard(mutex)(&rmem_swiotlb_mutex);
+ mem = rmem->priv;
if (!mem) {
mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0926/1059] EDAC/i5000: Fix slot number passed to determine_mtr()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (924 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0925/1059] dma: swiotlb: Serialize restricted DMA " Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0927/1059] fbdev: fm2fb: Fix iomem access Greg Kroah-Hartman
` (72 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aristeu Rozanski, Andrew Luebke,
Borislav Petkov (AMD)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aristeu Rozanski <aris@redhat.com>
commit a088b092a8962db62327690ae2d0d68827e81229 upstream.
When the logic mapping branch/slot/channel was reworked back in
64e1fdaf55d6 ("i5000_edac: Fix the logic that retrieves memory information")
i5000_init_csrows() was not updated and kept passing twice the number
of slots to determine_mtr(), which leads to accessing past the end of
i5000_pvt.b1_mtr[]. This was found by KASAN.
Fixes: 64e1fdaf55d6 ("i5000_edac: Fix the logic that retrieves memory information")
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Andrew Luebke <andrew.luebke@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Andrew Luebke <andrew.luebke@gmail.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20220921181009.oxytvicy6sry6it7@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/edac/i5000_edac.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1250,14 +1250,12 @@ static int i5000_init_csrows(struct mem_
struct i5000_pvt *pvt;
struct dimm_info *dimm;
int empty;
- int max_csrows;
int mtr;
int csrow_megs;
int channel;
int slot;
pvt = mci->pvt_info;
- max_csrows = pvt->maxdimmperch * 2;
empty = 1; /* Assume NO memory */
@@ -1268,7 +1266,7 @@ static int i5000_init_csrows(struct mem_
* to map the dimms. A good cleanup would be to remove this array,
* and do a loop here with branch, channel, slot
*/
- for (slot = 0; slot < max_csrows; slot++) {
+ for (slot = 0; slot < pvt->maxdimmperch; slot++) {
for (channel = 0; channel < pvt->maxch; channel++) {
mtr = determine_mtr(pvt, slot, channel);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0927/1059] fbdev: fm2fb: Fix iomem access
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (925 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0926/1059] EDAC/i5000: Fix slot number passed to determine_mtr() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0928/1059] fbdev: macmodes: compare the pixel clock of each candidate mode Greg Kroah-Hartman
` (71 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Steffen A. Mork, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen A. Mork <linux-dev@morknet.de>
commit 7d4a8a804cd1a3bcaa1a9a38e87517ead3130ca1 upstream.
This driver has not been tested for at least twenty years. In the meantime,
the frame buffer API has been updated. This patch addresses this issue and
makes the driver functional again.
Signed-off-by: Steffen A. Mork <linux-dev@morknet.de>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/fm2fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/video/fbdev/fm2fb.c
+++ b/drivers/video/fbdev/fm2fb.c
@@ -259,7 +259,7 @@ static int fm2fb_probe(struct zorro_dev
strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
/* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
+ ptr = (unsigned long *)info->screen_base;
for (y = 0; y < 576; y++) {
for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0928/1059] fbdev: macmodes: compare the pixel clock of each candidate mode
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (926 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0927/1059] fbdev: fm2fb: Fix iomem access Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0929/1059] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Greg Kroah-Hartman
` (70 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Douglas, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Douglas <me@timdoug.com>
commit 3e973ab62c86d620b2db9e90eb8fc3b065929e6e upstream.
In the second pass through the mode table in mac_var_to_vmode(),
the requested pixel clock period was compared with the first mode's
period at every step. The last mode at that resolution was therefore
returned even when its period was too short. Compare against the
current candidate's period.
Tested on a Performa 6200CD using a kernel with local platform
support. With video=valkyriefb:vmode:10 (800x600 at 60 Hz), the
measured refresh rate was about 72 Hz before the fix and 60 Hz
afterward. At 640x480, 67 Hz was also selected for a 60 Hz request
before the fix.
AI assistance was used to investigate the mode-table walk and draft
the fix.
Signed-off-by: Tim Douglas <me@timdoug.com>
Fixes: d876c11a0fd4 ("fbdev: mac_var_to_mode() fix")
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/macmodes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/video/fbdev/macmodes.c
+++ b/drivers/video/fbdev/macmodes.c
@@ -341,7 +341,7 @@ int mac_var_to_vmode(const struct fb_var
if (mode->xres != clk_mode->xres || mode->yres != clk_mode->yres)
break;
- if (var->pixclock > mode->pixclock)
+ if (var->pixclock > clk_mode->pixclock)
break;
if (mode->vmode != clk_mode->vmode)
continue;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0929/1059] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (927 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0928/1059] fbdev: macmodes: compare the pixel clock of each candidate mode Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0930/1059] fbdev: smscufx: allocate the size advertised in smem_len Greg Kroah-Hartman
` (69 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jianqiang Zou, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianqiang Zou <jq.zou@outlook.com>
commit b3f1631d362539cfe14571ccfd7db919ffbc08c7 upstream.
radeonfb_set_par() derives the dot clock from the user supplied
struct fb_var_screeninfo:
dotClock = 1000000000 / pixClock;
where pixClock is copied from mode->pixclock. A zero pixclock
bypasses the existing validation and makes the kernel divide by zero
in radeonfb_set_par().
The driver does have a check for this: fb_validate_mode() returns
-EINVAL when pixclock is 0, but radeon_match_mode() only calls it when
the output has no scaler and an EDID-derived mode database is
available:
if (has_rmx == 0 && rinfo->mon1_modedb)
if (fb_validate_mode(...))
return -EINVAL;
mon1_modedb is only filled in when an EDID is read, so when no
EDID-derived mode database is available the validation is skipped and
the invalid mode reaches radeonfb_set_par().
Reject a zero pixclock in radeonfb_check_var() before matching the
mode. fb_set_var() calls it on the FBIOPUT_VSCREENINFO path before
->fb_set_par(), so the invalid value is rejected before the mode is
applied. This is the same check other fbdev drivers use (i740fb,
arkfb, s3fb).
Reproduced on Linux 7.3.0 using a custom QEMU PCI stub device with
vendor/device ID 1002:5955; no physical Radeon hardware was used. A
single FBIOPUT_VSCREENINFO with pixclock = 0 is enough to trigger the
divide error.
Signed-off-by: Jianqiang Zou <jq.zou@outlook.com>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/aty/radeon_base.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -836,6 +836,9 @@ static int radeonfb_check_var (struct fb
int nom, den;
unsigned int pitch;
+ if (!var->pixclock)
+ return -EINVAL;
+
if (radeon_match_mode(rinfo, &v, var))
return -EINVAL;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0930/1059] fbdev: smscufx: allocate the size advertised in smem_len
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (928 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0929/1059] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0931/1059] fbdev: smscufx: dont free registered framebuffer on probe error Greg Kroah-Hartman
` (68 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, YuanZhe Liu, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit ae14fe6f367a9779e108449b4af41791bd6aaa47 upstream.
ufx_realloc_framebuffer() allocates line_length * yres bytes but records
PAGE_ALIGN(line_length * yres) in info->fix.smem_len. ufx_ops_set_par()
clears the framebuffer by writing smem_len bytes, so the write runs past
the end of the vmalloc() allocation whenever the mode size is not page
aligned:
BUG: KASAN: vmalloc-out-of-bounds in ufx_ops_set_par
Write of size 2 at addr ffffc90005518600
Call Trace:
ufx_ops_set_par
ufx_usb_probe
usb_probe_interface
This runs from the probe path, before any client can open the device: with
the fallback mode of 800x600 at 16 bpp the framebuffer is 960000 bytes and
PAGE_ALIGN() adds 2560 bytes that were never allocated.
Allocate the page aligned size that is published in smem_len instead, so
the buffer covers every byte the driver and the framebuffer core can reach
through smem_start and smem_len.
Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/smscufx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -1319,9 +1319,10 @@ static int ufx_realloc_framebuffer(struc
if (PAGE_ALIGN(new_len) > old_len) {
/*
- * Alloc system memory for virtual framebuffer
+ * Alloc system memory for virtual framebuffer. smem_len is
+ * rounded up to a page, so allocate that much as well.
*/
- new_fb = vmalloc(new_len);
+ new_fb = vmalloc(PAGE_ALIGN(new_len));
if (!new_fb)
return -ENOMEM;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0931/1059] fbdev: smscufx: dont free registered framebuffer on probe error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (929 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0930/1059] fbdev: smscufx: allocate the size advertised in smem_len Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0932/1059] fbdev: smscufx: keep the usb_device alive while ufx_data is in use Greg Kroah-Hartman
` (67 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, YuanZhe Liu, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit ed52e47133f72195f246a9f70c98e47431bb566d upstream.
register_framebuffer() can return an error after the framebuffer has
already been installed: do_register_framebuffer() bumps info->count,
creates /dev/fbN and stores the fb_info in registered_fb[] before it
returns the result of the console takeover, and that takeover may fail.
ufx_usb_probe() treats any error as "nothing was registered" and unwinds
through reset_active, which releases the fb_info and drops both
references to struct ufx_data, freeing @dev.
The framebuffer stays registered and can still be opened, so the next
open() of /dev/fbN reaches ufx_ops_open() with info->par pointing at
freed memory:
refcount_t: addition on 0; use-after-free.
WARNING: lib/refcount.c:25 at refcount_warn_saturate
Call Trace:
kref_get
ufx_ops_open drivers/video/fbdev/smscufx.c:1033
fb_open drivers/video/fbdev/core/fb_chrdev.c:351
chrdev_open
...
refcount_t: underflow; use-after-free.
WARNING: lib/refcount.c:28 at refcount_warn_saturate
Call Trace:
ufx_ops_release drivers/video/fbdev/smscufx.c:1135
fb_release drivers/video/fbdev/core/fb_chrdev.c:378
__fput
Reuse the "has this fb_info been registered" test that ufx_setup_modes()
already uses: take the error path only when refcount_read(&info->count)
says the core did not register the framebuffer. A failed console
takeover is not fatal for the driver, so report it and keep the
framebuffer registered; the disconnect callback will unregister it
normally.
Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/smscufx.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -1740,8 +1740,16 @@ static int ufx_usb_probe(struct usb_inte
dev_dbg(dev->gdev, "registering framebuffer");
retval = register_framebuffer(info);
if (retval < 0) {
- dev_err(dev->gdev, "error %d register_framebuffer", retval);
- goto reset_active;
+ /*
+ * info is installed before the takeover can fail; freeing @dev
+ * here would leave registered_fb[] and /dev/fbN pointing at
+ * freed memory.
+ */
+ if (!refcount_read(&info->count)) { /* not registered */
+ dev_err(dev->gdev, "error %d register_framebuffer", retval);
+ goto reset_active;
+ }
+ dev_warn(dev->gdev, "console takeover failed: %d\n", retval);
}
dev_info(dev->gdev, "SMSC UDX USB device /dev/fb%d attached. %dx%d resolution."
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0932/1059] fbdev: smscufx: keep the usb_device alive while ufx_data is in use
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (930 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0931/1059] fbdev: smscufx: dont free registered framebuffer on probe error Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0933/1059] fbdev: sstfb: Error out if pixclock equals zero Greg Kroah-Hartman
` (66 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, YuanZhe Liu, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit e8645fe7419828fd95a90171149c565c1bb72911 upstream.
ufx_usb_probe() stores the usb_device pointer in dev->udev without
taking a reference, and ufx_usb_disconnect() does not wait for in-flight
control transfers. A mode set or blank request that runs while the
device is being unplugged - through ufx_ops_set_par() or ufx_ops_blank()
on an open /dev/fbN file - keeps issuing synchronous control messages for
the whole ufx_set_vid_mode() sequence, including two msleep(1) delays in
ufx_config_pix_clk(). Once the disconnect callback returns, the USB core
may release the usb_device, and the next ufx_reg_write()/ufx_reg_read()
dereferences dev->udev through __create_pipe():
general protection fault, probably for non-canonical address
0xdffffc0000000006: 0000 [#1] SMP
KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
RIP: __create_pipe include/linux/usb.h:2031
Call Trace:
ufx_set_vid_mode
ufx_ops_set_par
fb_set_var
fb_set_var_from_user
store_rotate
Take a reference to the usb_device in ufx_usb_probe() and drop it in
ufx_free(), so dev->udev and dev->gdev stay valid until the last
ufx_data user is gone. The control transfers then fail with -ENODEV
instead of dereferencing freed memory.
Also return early from ufx_set_vid_mode() while the device is inactive,
matching the other transmit paths. That check alone is not enough,
because it is not serialized against ufx_usb_disconnect() and the
transfer sequence continues after it; it only avoids a long series of
failing transfers.
Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/smscufx.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -661,8 +661,12 @@ static int ufx_set_vid_mode(struct ufx_d
u32 temp;
u16 h_total, h_active, h_blank_start, h_blank_end, h_sync_start, h_sync_end;
u16 v_total, v_active, v_blank_start, v_blank_end, v_sync_start, v_sync_end;
+ int status;
- int status = ufx_reg_write(dev, 0x8028, 0);
+ if (!atomic_read(&dev->usb_active))
+ return -ENODEV;
+
+ status = ufx_reg_write(dev, 0x8028, 0);
check_warn_return(status, "ufx_set_vid_mode error disabling RGB pad");
status = ufx_reg_write(dev, 0x8024, 0);
@@ -1123,6 +1127,7 @@ static void ufx_free(struct kref *kref)
{
struct ufx_data *dev = container_of(kref, struct ufx_data, kref);
+ usb_put_dev(dev->udev);
kfree(dev);
}
@@ -1649,6 +1654,8 @@ static int ufx_usb_probe(struct usb_inte
dev->udev = usbdev;
dev->gdev = &usbdev->dev; /* our generic struct device * */
+ /* keep the device alive until the last ufx_data user is gone */
+ usb_get_dev(usbdev);
usb_set_intfdata(interface, dev);
dev_dbg(dev->gdev, "%s %s - serial #%s\n",
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0933/1059] fbdev: sstfb: Error out if pixclock equals zero
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (931 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0932/1059] fbdev: smscufx: keep the usb_device alive while ufx_data is in use Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0934/1059] fbdev: valkyriefb: keep the framebuffer mapping size fixed Greg Kroah-Hartman
` (65 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Xue Haolin, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xue Haolin <xuehaolin@uniontech.com>
commit f37d206e145d25607c6a8e920d7bb643d203a1f7 upstream.
The userspace program could pass any values to the driver through
ioctl() interface. If the driver doesn't check the value of pixclock,
it may cause divide-by-zero error.
sstfb_check_var() calls PICOS2KHZ(var->pixclock) which expands to
1000000000UL / var->pixclock. If var->pixclock is zero, this causes
a divide-by-zero exception.
Fix this by checking whether pixclock is zero at the beginning of
sstfb_check_var(), before it is used as a divisor.
This is similar to CVE-2022-3061 in i740fb which was fixed by
commit 15cf0b82271b ("video: fbdev: i740fb: Error out if
'pixclock' equals zero"), and the fix in savagefb by
commit 04e5eac8f3ab ("fbdev: savage: Error out if pixclock equals zero").
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Xue Haolin <xuehaolin@uniontech.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/sstfb.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/video/fbdev/sstfb.c
+++ b/drivers/video/fbdev/sstfb.c
@@ -359,6 +359,9 @@ static int sstfb_check_var(struct fb_var
int tiles_in_X, real_length;
unsigned int freq;
+ if (!var->pixclock)
+ return -EINVAL;
+
if (sst_calc_pll(PICOS2KHZ(var->pixclock), &freq, &par->pll)) {
printk(KERN_ERR "sstfb: Pixclock at %ld KHZ out of range\n",
PICOS2KHZ(var->pixclock));
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0934/1059] fbdev: valkyriefb: keep the framebuffer mapping size fixed
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (932 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0933/1059] fbdev: sstfb: Error out if pixclock equals zero Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0935/1059] fbdev: vfb: Validate framebuffer geometry and memory size Greg Kroah-Hartman
` (64 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Douglas, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Douglas <me@timdoug.com>
commit fa9bebccf45571bd710b0591359b28d5354e7e7a upstream.
When /dev/fb0 is mapped before a depth change, as with Xorg's fbdev
driver, the mapping may be too short for the new mode. At 640x480,
a full frame at 16 bpp is 600 KiB, so drawing it through the
original 300 KiB mapping from 8 bpp can fault.
Set smem_len to the usable video RAM by subtracting the 4 KiB offset
already applied to smem_start, then keep that size across mode
changes.
On a Performa 6200CD using a kernel with local platform support,
a write past the mapping caused a fault during an Xorg test at
16 bpp. With the corrected mapping size in the test kernel, twm
and xterm were displayed successfully in Xorg at 640x480 and 16 bpp.
In a test on a Quadra 630 in MAME with Linux v7.4-rc3, /dev/fb0 was
mapped at 8 bpp and the depth was changed to 16 bpp with the original
mapping still in place. A SIGSEGV was reported during the 16 bpp draw
before the fix, and all 480 lines were drawn afterward.
AI assistance was used to investigate the mapping size and draft
the fix.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Tim Douglas <me@timdoug.com>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/valkyriefb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -512,7 +512,7 @@ static void valkyrie_init_fix(struct fb_
fix->mmio_len = sizeof(struct valkyrie_regs);
fix->type = FB_TYPE_PACKED_PIXELS;
fix->smem_start = p->frame_buffer_phys + 0x1000;
- fix->smem_len = p->total_vram;
+ fix->smem_len = p->total_vram - 0x1000;
fix->type_aux = 0;
fix->ywrapstep = 0;
@@ -525,7 +525,6 @@ static void valkyrie_init_fix(struct fb_
static void valkyrie_par_to_fix(struct fb_par_valkyrie *par,
struct fb_fix_screeninfo *fix)
{
- fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode);
fix->visual = (par->cmode == CMODE_8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
fix->line_length = par->vxres << par->cmode;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0935/1059] fbdev: vfb: Validate framebuffer geometry and memory size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (933 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0934/1059] fbdev: valkyriefb: keep the framebuffer mapping size fixed Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0936/1059] fuse: limit name size in listxattr Greg Kroah-Hartman
` (63 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, co+b0df61d49532b2ee, Helge Deller,
Weiming Shi
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <bestswngs@gmail.com>
commit b438bb88f65a8b464ad08057873db9605cdae945 upstream.
FBIOPUT_VSCREENINFO can supply a virtual width large enough to
overflow get_line_length()'s int multiplication and bypass the
video-memory limit, allowing fbcon to write past the framebuffer. The
offset additions can also wrap, while an excessive videomemorysize
module parameter can be truncated when PAGE_ALIGN() is assigned to
unsigned int.
Limit virtual geometry and offsets to 8192 x 8192 and cap video
memory at 512 MiB, keeping the stride, framebuffer-size, and generic
fbdev drawing calculations within their destination types.
KASAN reports:
BUG: KASAN: vmalloc-out-of-bounds in sys_fillrect
drivers/video/fbdev/core/sysfillrect.c:24
Write of size 8 at addr ffa0000001671000 by task poc/198
sys_fillrect
drivers/video/fbdev/core/sysfillrect.c:24
bit_clear_margins
drivers/video/fbdev/core/bitblit.c:247
fbcon_clear_margins.constprop.0
drivers/video/fbdev/core/fbcon.c:1410
fbcon_switch
drivers/video/fbdev/core/fbcon.c:2261
redraw_screen
drivers/tty/vt/vt.c:994
fbcon_modechanged
drivers/video/fbdev/core/fbcon.c:2693
fbcon_update_vcs
drivers/video/fbdev/core/fbcon.c:2732
Cc: stable@vger.kernel.org
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: co+b0df61d49532b2ee@bugs.sh
Suggested-by: Helge Deller <deller@gmx.de>
Assisted-by: LLM
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/vfb.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
--- a/drivers/video/fbdev/vfb.c
+++ b/drivers/video/fbdev/vfb.c
@@ -30,7 +30,10 @@
* The default can be overridden if the driver is compiled as a module
*/
-#define VIDEOMEMSIZE (1*1024*1024) /* 1 MB */
+#define MAX_XRES 8192
+#define MAX_YRES 8192
+#define VIDEOMEMSIZE (1 * 1024 * 1024) /* 1 MB */
+#define MAX_VIDEOMEMSIZE (8192 * 8192 * sizeof(u32))
static void *videomemory;
static u_long videomemorysize = VIDEOMEMSIZE;
@@ -161,6 +164,14 @@ static int vfb_check_var(struct fb_var_s
else
return -EINVAL;
+ if (var->xres_virtual > MAX_XRES ||
+ var->yres_virtual > MAX_YRES)
+ return -EINVAL;
+
+ if (var->xoffset > MAX_XRES - var->xres ||
+ var->yoffset > MAX_YRES - var->yres)
+ return -EINVAL;
+
if (var->xres_virtual < var->xoffset + var->xres)
var->xres_virtual = var->xoffset + var->xres;
if (var->yres_virtual < var->yoffset + var->yres)
@@ -434,9 +445,12 @@ static int __init vfb_setup(char *option
static int vfb_probe(struct platform_device *dev)
{
struct fb_info *info;
- unsigned int size = PAGE_ALIGN(videomemorysize);
+ unsigned int size;
int retval = -ENOMEM;
+ videomemorysize = min(videomemorysize, MAX_VIDEOMEMSIZE);
+ size = PAGE_ALIGN(videomemorysize);
+
/*
* For real video cards we use ioremap.
*/
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0936/1059] fuse: limit name size in listxattr
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (934 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0935/1059] fbdev: vfb: Validate framebuffer geometry and memory size Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0937/1059] fuse: skip dcache instantiation for readdirplus names with embedded NUL Greg Kroah-Hartman
` (62 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Miklos Szeredi
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <mszeredi@redhat.com>
commit 7f7b822d09c5590defcc61a37ffbd5a3533ed518 upstream.
Limit the size of names to XATTR_NAME_MAX. Return -EIO to the listxattr()
caller if the server exceeds this limit.
Fixes: 92a8780e1136 ("[PATCH] FUSE - extended attribute operations")
Cc: stable@vger.kernel.org
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/fuse/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
@@ -96,7 +96,7 @@ static int fuse_verify_xattr_list(char *
while (size) {
size_t thislen = strnlen(list, size);
- if (!thislen || thislen == size)
+ if (!thislen || thislen == size || thislen > XATTR_NAME_MAX)
return -EIO;
size -= thislen + 1;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0937/1059] fuse: skip dcache instantiation for readdirplus names with embedded NUL
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (935 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0936/1059] fuse: limit name size in listxattr Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0938/1059] gpio: virtio: bound the line names block by its configured size Greg Kroah-Hartman
` (61 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gwanhyun Lee, Junyoung Jang,
Amir Goldstein, Miklos Szeredi
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junyoung Jang <graypanda.inzag@gmail.com>
commit ae932b1f5727004f585d603e0cbab7e0725c04cf upstream.
FUSE READDIRPLUS can pass a length-bearing qstr with an embedded NUL to
d_splice_alias(). Unlike verify_dirent_name() in fs/readdir.c, this
path can create a dentry whose d_name.len extends past the NUL.
For such a name, strscpy() in inotify_handle_inode_event() and the
fanotify name-copy helpers stop early. The kmalloc() and kvmalloc()
event-name buffers retain uninitialized bytes within the recorded name
length, which copy_event_to_user() and copy_fid_info_to_user() can expose.
Some FUSE servers include a terminating NUL in namelen. Follow
nfs_prime_dcache() in commit 78d04af4995a1 ("NFS: nfs_prime_dcache must
validate the filename") by skipping dcache instantiation without
failing getdents(). Return -EIO from fuse_direntplus_link() so
parse_dirplusfile() sends FUSE_FORGET for the unused lookup reference
and continues readdir.
Fixes: 0b05b18381ee ("fuse: implement NFS-like readdirplus support")
Cc: stable@vger.kernel.org
Co-developed-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
Signed-off-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/fuse/readdir.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/fuse/readdir.c
+++ b/fs/fuse/readdir.c
@@ -192,6 +192,8 @@ static int fuse_direntplus_link(struct f
return -EIO;
if (fuse_invalid_attr(&o->attr))
return -EIO;
+ if (memchr(name.name, '\0', name.len))
+ return -EIO;
fc = get_fuse_conn(dir);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0938/1059] gpio: virtio: bound the line names block by its configured size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (936 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0937/1059] fuse: skip dcache instantiation for readdirplus names with embedded NUL Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0939/1059] gpio: virtio: compute the line names size in a size_t Greg Kroah-Hartman
` (60 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lianjie Wang, Viresh Kumar,
Bartosz Golaszewski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
commit 74aee8e06277df39ec10ed043bae0ed5b7a83864 upstream.
virtio_gpio_get_names() walks the line names that the device returns in
a block of gpio_names_size bytes, which the driver ends with a NUL, and
checks each name only after stepping past it. If the block holds fewer
than ngpio names, the walk reaches the end of the block after the last
name, and the next iteration starts strlen() at the byte after the
allocation. With a block that holds one name for four lines, KASAN
reports:
BUG: KASAN: slab-out-of-bounds in strlen+0x57/0x70
Read of size 1 at addr ffff8880026687c0 by task swapper/0/1
Call Trace:
strlen+0x57/0x70
virtio_gpio_probe+0xcb4/0xfc0
virtio_dev_probe+0xa7a/0xc50
Allocated by task 1:
devm_kmalloc+0x6e/0x280
virtio_gpio_probe+0xc06/0xfc0
The buggy address is located 0 bytes to the right of
allocated 64-byte region [ffff888002668780, ffff8880026687c0)
Check that a name starts inside the block before reading it.
Fixes: 3a29355a22c0 ("gpio: Add virtio-gpio driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20261104195632.1702765-1-lian@is.s.u-tokyo.ac.jp
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-virtio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/gpio/gpio-virtio.c
+++ b/drivers/gpio/gpio-virtio.c
@@ -525,13 +525,13 @@ static const char **virtio_gpio_get_name
gpio_names[gpio_names_size - 1] = '\0';
for (i = 0, str = gpio_names; i < ngpio; i++) {
- names[i] = str;
- str += strlen(str) + 1; /* zero-length strings are allowed */
-
- if (str > gpio_names + gpio_names_size) {
+ if (str >= gpio_names + gpio_names_size) {
dev_err(dev, "gpio_names block is too short (%d)\n", i);
return NULL;
}
+
+ names[i] = str;
+ str += strlen(str) + 1; /* zero-length strings are allowed */
}
return names;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0939/1059] gpio: virtio: compute the line names size in a size_t
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (937 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0938/1059] gpio: virtio: bound the line names block by its configured size Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0940/1059] ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR Greg Kroah-Hartman
` (59 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lianjie Wang, Viresh Kumar,
Bartosz Golaszewski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
commit 9e3032dc4d92e6214ae687b4c474de9270ce74a2 upstream.
virtio_gpio_get_names() computes the size of the GET_LINE_NAMES response
as sizeof(*res) + gpio_names_size in an int, where gpio_names_size is a
u32 from the config space. A gpio_names_size of 0xffffffff makes the
size 0, devm_kzalloc() returns ZERO_SIZE_PTR, and reading the status
byte of the response through it oopses:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
RIP: 0010:_virtio_gpio_req+0x2b8/0x550
Call Trace:
virtio_gpio_probe+0xc2a/0xfc0
virtio_dev_probe+0xa7a/0xc50
Compute the size with struct_size() into a size_t.
Fixes: 3a29355a22c0 ("gpio: Add virtio-gpio driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20261104195632.1702765-2-lian@is.s.u-tokyo.ac.jp
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-virtio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/gpio/gpio-virtio.c
+++ b/drivers/gpio/gpio-virtio.c
@@ -499,12 +499,13 @@ static const char **virtio_gpio_get_name
struct device *dev = &vgpio->vdev->dev;
u8 *gpio_names, *str;
const char **names;
- int i, ret, len;
+ size_t len;
+ int i, ret;
if (!gpio_names_size)
return NULL;
- len = sizeof(*res) + gpio_names_size;
+ len = struct_size(res, value, gpio_names_size);
res = devm_kzalloc(dev, len, GFP_KERNEL);
if (!res)
return NULL;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0940/1059] ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (938 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0939/1059] gpio: virtio: compute the line names size in a size_t Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0941/1059] iavf: fix ASQ command buffer leak on init failure Greg Kroah-Hartman
` (58 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sung Byeongchan, Miquel Raynal,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sung Byeongchan <tjdqudcks0424@naver.com>
commit a0abc1e4c9d5b8b846abe4293b7bca578736da8a upstream.
PF_IEEE802154 DGRAM sockets are available to ordinary init-net processes.
Their family-specific SIOCSIFADDR path calls the netdev ioctl directly and
does not pass through the generic network-device setter capability check.
An unprivileged process can therefore change the PAN ID and short address
of a separately administrator-owned down WPAN interface.
In a local fakelb fixture, uid 1000 changed both identifiers and the values
remained active through a later administrator interface open in three of
three fresh KASAN boots.
Require CAP_NET_ADMIN in the socket network namespace before processing
SIOCSIFADDR. Keep SIOCGIFADDR and all existing state and value checks
unchanged.
The fixed kernel rejected the same unprivileged request with -EPERM and
preserved the administrator identity in three of three matched boots.
Administrator SET, running-device, invalid-value, wrong-device, cleanup,
later-open and recovery controls passed in all baseline and fixed runs.
The demonstrated impact is local cross-principal WPAN identity and policy
modification after privileged device setup. Memory corruption, disclosure,
RCE and LPE were not demonstrated.
Fixes: 9ec767160357 ("net: add IEEE 802.15.4 socket family implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Sung Byeongchan <tjdqudcks0424@naver.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20261107093601.619363-1-tjdqudcks0424@naver.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ieee802154/socket.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -128,6 +128,10 @@ static int ieee802154_dev_ioctl(struct s
int ret = -ENOIOCTLCMD;
struct net_device *dev;
+ if (cmd == SIOCSIFADDR &&
+ !ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))
+ return -EPERM;
+
if (get_user_ifreq(&ifr, NULL, arg))
return -EFAULT;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0941/1059] iavf: fix ASQ command buffer leak on init failure
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (939 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0940/1059] ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0942/1059] hwmon: (ads7871) Add error handle from spi_setup() Greg Kroah-Hartman
` (57 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xuanqiang Luo, Jedrzej Jagielski,
Aleksandr Loktionov, Tony Nguyen, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
commit 2a1f106379a90ce7ac63f96a57c241a4cf20a983 upstream.
iavf_alloc_adminq_asq_ring() allocates cmd_buf before the remaining ASQ
resources. If iavf_alloc_asq_bufs() or iavf_config_asq_regs() fails, the
unwind path elides cmd_buf while freeing the other allocations.
The ASQ count is not set until initialization succeeds, so the shutdown
path cannot reclaim the buffer. Free cmd_buf in the common unwind path.
Fixes: d358aa9a7a2d ("i40evf: init code and hardware support")
Cc: stable@vger.kernel.org
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20261113004602.129864-6-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/intel/iavf/iavf_adminq.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/net/ethernet/intel/iavf/iavf_adminq.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.c
@@ -81,6 +81,7 @@ static enum iavf_status iavf_alloc_admin
**/
static void iavf_free_adminq_asq(struct iavf_hw *hw)
{
+ iavf_free_virt_mem(hw, &hw->aq.asq.cmd_buf);
iavf_free_dma_mem(hw, &hw->aq.asq.desc_buf);
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0942/1059] hwmon: (ads7871) Add error handle from spi_setup()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (940 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0941/1059] iavf: fix ASQ command buffer leak on init failure Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0943/1059] hwmon: (dell-smm) Reject out-of-range pwm values Greg Kroah-Hartman
` (56 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vítor Hugo Silva, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vítor Hugo Silva <vitorhg20080@gmail.com>
commit 449cdc5e29c63aa66b41ce8c2783f6b0d84c62b0 upstream.
The ads7871 probe() ignores the spi_setup() error return value
and it attempts to write to registers even if spi_setup() fails.
Return the setup error before accessing any registers.
AI was used for peer-review the patch.
Fixes: e0c70b8078629 ("hwmon: add TI ads7871 a/d converter driver")
Cc: stable@vger.kernel.org
Signed-off-by: Vítor Hugo Silva <vitorhg20080@gmail.com>
Link: https://patch.msgid.link/20261118092928.163553-1-vitorhg20080@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/ads7871.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -164,7 +164,9 @@ static int ads7871_probe(struct spi_devi
/* Configure the SPI bus */
spi->mode = (SPI_MODE_0);
spi->bits_per_word = 8;
- spi_setup(spi);
+ ret = spi_setup(spi);
+ if (ret)
+ return ret;
ads7871_write_reg8(spi, REG_SER_CONTROL, 0);
ads7871_write_reg8(spi, REG_AD_CONTROL, 0);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0943/1059] hwmon: (dell-smm) Reject out-of-range pwm values
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (941 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0942/1059] hwmon: (ads7871) Add error handle from spi_setup() Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0944/1059] hwmon: (nct6775) Fix incorrect struct cast in beep callbacks Greg Kroah-Hartman
` (55 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rosen Penev, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
commit 7494b0c50c9fcd9f9f5235777bb506dd45676557 upstream.
dell_smm_write() scales the value written to pwmN with
DIV_ROUND_CLOSEST(val, data->i8k_pwm_mult)
before clamping the result to the valid fan states. The rounding adds
i8k_pwm_mult / 2 to val first, which overflows for values near
LONG_MAX and wraps to a large negative number. That is then clamped to
0, so writing a huge value turns the fan off instead of running it at
the highest speed. With the default fan_max of 2, writing any value
from LONG_MAX - 63 up to LONG_MAX selects fan state 0.
The pwm range is well defined, so return -EINVAL for values outside
0 to 255, as is the convention for pwm attributes.
Fixes: e7f5f275c62a ("i8k: Implement hwmon based fan speed control")
Cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261118040417.19049-1-rosenp@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/dell-smm-hwmon.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -874,6 +874,9 @@ static int dell_smm_write(struct device
case hwmon_pwm:
switch (attr) {
case hwmon_pwm_input:
+ if (val < 0 || val > 255)
+ return -EINVAL;
+
pwm = clamp_val(DIV_ROUND_CLOSEST(val, data->i8k_pwm_mult), 0,
data->i8k_fan_max);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0944/1059] hwmon: (nct6775) Fix incorrect struct cast in beep callbacks
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (942 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0943/1059] hwmon: (dell-smm) Reject out-of-range pwm values Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0945/1059] hwmon: (nct6775) Fix swapped temperature tolerance register writes Greg Kroah-Hartman
` (54 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ziheng Wei, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziheng Wei <zihengw03@163.com>
commit 07571b42cf41d0e42fb890713340a8f0a3c03d56 upstream.
On big-endian architectures, writing the in[1-*]_beep, fan[1-*]_beep
and temp[1-*]_beep sysfs attributes in the nct6775 hardware monitoring
driver always changes channel 0 due to an incorrect struct downcast in
the beep store callbacks.
The driver defines these sysfs attributes using SENSOR_TEMPLATE(),
which initializes them as struct sensor_device_attribute (where the
index is a 32-bit int). However, the sysfs store callbacks
nct6775_store_beep() and store_temp_beep() incorrectly downcast the
attribute to a struct sensor_device_attribute_2 (where the index is
an 8-bit u8).
Because both structs start with struct device_attribute,
container_of() resolves to the same base address. On big-endian
architectures, reading the 8-bit index field from the memory layout
of a 32-bit int fetches the most significant byte (which is 0),
rather than the intended channel number.
This type mismatch causes all beep writes to change the beep setting
of channel 0, regardless of which channel the user targeted.
Fix the type casts in the two store callbacks.
Not runtime-tested: the only big-endian machine available to me (s390x
under QEMU) cannot build the platform driver (no HAS_IOPORT).
Fixes: 30846993047b ("hwmon: (nct6775) Add support for beep attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
Link: https://patch.msgid.link/20261115080203.910033-2-zihengw03@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/nct6775-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1818,7 +1818,7 @@ EXPORT_SYMBOL_GPL(nct6775_show_beep);
ssize_t
nct6775_store_beep(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
- struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
+ struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
struct nct6775_data *data = dev_get_drvdata(dev);
int nr = data->BEEP_BITS[sattr->index];
int regindex = nr >> 3;
@@ -1872,7 +1872,7 @@ static ssize_t
store_temp_beep(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
+ struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
struct nct6775_data *data = dev_get_drvdata(dev);
int nr, bit, regindex;
unsigned long val;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0945/1059] hwmon: (nct6775) Fix swapped temperature tolerance register writes
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (943 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0944/1059] hwmon: (nct6775) Fix incorrect struct cast in beep callbacks Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0946/1059] hwmon: (nct6775) Fix tolerance bitmask when reading REG_FAN_MODE Greg Kroah-Hartman
` (53 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Anton Lundin, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <linux@roeck-us.net>
commit 3cc60eb1b9aa07da81593f8f027efefb67185144 upstream.
sensor_dev_template_pwm_temp_tolerance uses index 0 (backed by
REG_FAN_MODE via pwm_update_registers()) while
sensor_dev_template_pwm_crit_temp_tolerance uses index 1 (backed by
REG_CRITICAL_TEMP_TOLERANCE). However, store_temp_tolerance() checks
if (index) with inverted branches.
As a result, writing to pwm*_temp_tolerance writes the new tolerance to
REG_CRITICAL_TEMP_TOLERANCE instead of REG_FAN_MODE, while writing to
pwm*_crit_temp_tolerance updates REG_FAN_MODE with temp_tolerance[0] and
leaves REG_CRITICAL_TEMP_TOLERANCE unchanged.
Invert the index check in store_temp_tolerance() so index 0 updates fan
mode registers via pwm_update_registers() and index 1 writes to
REG_CRITICAL_TEMP_TOLERANCE.
Fixes: cdcaeceb74ff ("hwmon: (nct6775) Add support for automatic fan control")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Cc: Anton Lundin <glance@ac2.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/nct6775-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -2957,7 +2957,7 @@ store_temp_tolerance(struct device *dev,
mutex_lock(&data->update_lock);
data->temp_tolerance[index][nr] = val;
- if (index)
+ if (!index)
err = pwm_update_registers(data, nr);
else
err = nct6775_write_value(data, data->REG_CRITICAL_TEMP_TOLERANCE[nr], val);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0946/1059] hwmon: (nct6775) Fix tolerance bitmask when reading REG_FAN_MODE
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (944 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0945/1059] hwmon: (nct6775) Fix swapped temperature tolerance register writes Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0947/1059] hwmon: (sht3x) Fix overflow when writing alert limits Greg Kroah-Hartman
` (52 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Anton Lundin, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <linux@roeck-us.net>
commit 39cd14ca605d1aa55a0ad26767014a88b5c39f20 upstream.
On NCT6775, bits 0..3 of REG_FAN_MODE hold the temperature or fan speed
tolerance (tolerance_mask is 0x0f), whereas on NCT5525, NCT6106,
NCT6116, NCT6126, and NCT6776+, only bits 0..2 hold the temperature
tolerance or low 3 bits of speed tolerance (tolerance_mask is 0x07).
However, nct6775_update_pwm() masks fanmodecfg with a hardcoded 0x0f.
When bit 3 of REG_FAN_MODE is set on chips where tolerance_mask is 0x07,
nct6775_update_pwm() includes bit 3 in temp_tolerance[0] and
target_speed_tolerance, corrupting reported tolerance values and causing
pwm_update_registers() to OR bit 3 back into REG_FAN_MODE.
Mask fanmodecfg with data->tolerance_mask instead of 0x0f in
nct6775_update_pwm().
Fixes: cdcaeceb74ff ("hwmon: (nct6775) Add support for automatic fan control")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Cc: Anton Lundin <glance@ac2.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/nct6775-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1417,10 +1417,10 @@ static int nct6775_update_pwm(struct dev
if (!data->temp_tolerance[0][i] ||
data->pwm_enable[i] != speed_cruise)
- data->temp_tolerance[0][i] = fanmodecfg & 0x0f;
+ data->temp_tolerance[0][i] = fanmodecfg & data->tolerance_mask;
if (!data->target_speed_tolerance[i] ||
data->pwm_enable[i] == speed_cruise) {
- u8 t = fanmodecfg & 0x0f;
+ u8 t = fanmodecfg & data->tolerance_mask;
if (data->REG_TOLERANCE_H) {
err = nct6775_read_value(data, data->REG_TOLERANCE_H[i], ®);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0947/1059] hwmon: (sht3x) Fix overflow when writing alert limits
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (945 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0946/1059] hwmon: (nct6775) Fix tolerance bitmask when reading REG_FAN_MODE Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:07 ` [PATCH 6.1 0948/1059] hwmon: (w83791d) Fix incorrect struct cast in show_temp1() and store_temp1() Greg Kroah-Hartman
` (51 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Wayne Ho, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Ho <wayneho219@gmail.com>
commit e6872defbb2eb1dc61b3ea168ca13e1362efbd86 upstream.
limit_write() encodes the limits with 32-bit arithmetic, which overflows
for the largest accepted values:
(130000 + 45000) * 24543 = 4295025000 > U32_MAX
100000 * 42950 = 4295000000 > U32_MAX
Writing 130000 to temp1_max therefore programs -45 degrees C, and
writing 100000 to humidity1_max programs 0 %RH, so a limit set to its
maximum makes the alert fire instead of never firing. Reading the
attributes back returns the cached values, so this is not visible from
sysfs.
Use 64-bit arithmetic and clamp each result to its field width. Even
with 64-bit arithmetic, 130000 encodes to 0x200, which overflows the
9-bit temperature field, and 100000 encodes to 0x10000, which is still 0
after masking.
Prepared with the help of an AI coding assistant (Claude); I reproduced
the bug and tested the fix on hardware.
Fixes: 7c84f7f80d6f ("hwmon: add support for Sensirion SHT3x sensors")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-hwmon/20260725222229.EA69B1F000E9@smtp.kernel.org/
Signed-off-by: Wayne Ho <wayneho219@gmail.com>
Link: https://patch.msgid.link/20261113054857.97048-1-wayneho219@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/sht3x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -362,8 +362,8 @@ static size_t limit_store(struct device
* adapted for fixed point arithmetic and packed the same as
* in limit_show()
*/
- raw = ((u32)(temperature + 45000) * 24543) >> (16 + 7);
- raw |= ((humidity * 42950) >> 16) & 0xfe00;
+ raw = min(((u64)(temperature + 45000) * 24543) >> (16 + 7), 0x1ff);
+ raw |= min(((u64)humidity * 42950) >> 16, 0xffff) & 0xfe00;
put_unaligned_be16(raw, position);
position += SHT3X_WORD_LEN;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0948/1059] hwmon: (w83791d) Fix incorrect struct cast in show_temp1() and store_temp1()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (946 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0947/1059] hwmon: (sht3x) Fix overflow when writing alert limits Greg Kroah-Hartman
@ 2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0949/1059] hwmon: (w83792d) " Greg Kroah-Hartman
` (50 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:07 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ziheng Wei, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziheng Wei <zihengw03@163.com>
commit fb47eb0528d275362b01423ceb956e3ce1f9d715 upstream.
On big-endian architectures, accessing the temp1_max and temp1_max_hyst
sysfs attributes in the w83791d hardware monitoring driver uses a huge
out-of-bounds index, because show_temp1() and store_temp1() downcast the
attribute to the wrong struct.
The driver defines the temp1_* attributes with SENSOR_ATTR_2(), which
initializes them as struct sensor_device_attribute_2 (where the index is
an 8-bit u8). The temp1_input attribute has index 0, temp1_max has
index 1 and temp1_max_hyst has index 2. However, show_temp1() and
store_temp1() downcast the attribute to struct sensor_device_attribute
(where the index is a 32-bit int) and use it to index data->temp1[].
Because both structs start with struct device_attribute, container_of()
resolves to the same base address, but the field widths differ. On
big-endian architectures, reading the 32-bit int from the memory layout
of the two u8 fields yields index << 24: 0x01000000 for temp1_max and
0x02000000 for temp1_max_hyst, instead of 1 and 2. data->temp1[] has
only 3 elements, so the access runs off the end of the array by up to
32 MiB.
Fix the type casts in show_temp1() and store_temp1().
Confirmed on a big-endian s390x QEMU guest with the driver bound to an
emulated chip: temp1_max and temp1_max_hyst read 0 instead of the
register values. Not tested on real hardware.
Fixes: 9873964d6eb2 ("[PATCH] HWMON: w83791d: New hardware monitoring driver for the Winbond W83791D")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
Link: https://patch.msgid.link/20261115080203.910033-3-zihengw03@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/w83791d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -924,7 +924,7 @@ static struct sensor_device_attribute sd
static ssize_t show_temp1(struct device *dev, struct device_attribute *devattr,
char *buf)
{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+ struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
struct w83791d_data *data = w83791d_update_device(dev);
return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->temp1[attr->index]));
}
@@ -932,7 +932,7 @@ static ssize_t show_temp1(struct device
static ssize_t store_temp1(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+ struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct w83791d_data *data = i2c_get_clientdata(client);
int nr = attr->index;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0949/1059] hwmon: (w83792d) Fix incorrect struct cast in show_temp1() and store_temp1()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (947 preceding siblings ...)
2026-12-04 10:07 ` [PATCH 6.1 0948/1059] hwmon: (w83791d) Fix incorrect struct cast in show_temp1() and store_temp1() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0950/1059] Input: cyapa - fix runtime PM leak in cyapa_update_rt_suspend_scanrate() Greg Kroah-Hartman
` (49 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ziheng Wei, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziheng Wei <zihengw03@163.com>
commit d4f7d626cc1a966dca930a5ba07e8c4739adceb0 upstream.
On big-endian architectures, accessing the temp1_max and temp1_max_hyst
sysfs attributes in the w83792d hardware monitoring driver uses a huge
out-of-bounds index, because show_temp1() and store_temp1() downcast the
attribute to the wrong struct.
The driver defines the temp1_* attributes with SENSOR_DEVICE_ATTR_2(),
which initializes them as struct sensor_device_attribute_2 (where the
index is an 8-bit u8). The temp1_input attribute has index 0, temp1_max
has index 1 and temp1_max_hyst has index 2. However, show_temp1() and
store_temp1() downcast the attribute to struct sensor_device_attribute
(where the index is a 32-bit int) and use it to index data->temp1[].
Because both structs start with struct device_attribute, container_of()
resolves to the same base address, but the field widths differ. On
big-endian architectures, reading the 32-bit int from the memory layout
of the two u8 fields yields index << 24: 0x01000000 for temp1_max and
0x02000000 for temp1_max_hyst, instead of 1 and 2. data->temp1[] has
only 3 elements, so the access runs off the end of the array by up to
32 MiB.
Fix the type casts in show_temp1() and store_temp1().
Confirmed on a big-endian s390x QEMU guest with the driver bound to an
emulated chip: temp1_max and temp1_max_hyst read 0 instead of the
register values. Not tested on real hardware.
Fixes: 1f8dae31fe8d ("[PATCH] hwmon: w83792d use arrays of attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
Link: https://patch.msgid.link/20261115080203.910033-4-zihengw03@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/w83792d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -487,7 +487,7 @@ store_fan_div(struct device *dev, struct
static ssize_t show_temp1(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
+ struct sensor_device_attribute_2 *sensor_attr = to_sensor_dev_attr_2(attr);
int nr = sensor_attr->index;
struct w83792d_data *data = w83792d_update_device(dev);
return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->temp1[nr]));
@@ -496,7 +496,7 @@ static ssize_t show_temp1(struct device
static ssize_t store_temp1(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
+ struct sensor_device_attribute_2 *sensor_attr = to_sensor_dev_attr_2(attr);
int nr = sensor_attr->index;
struct i2c_client *client = to_i2c_client(dev);
struct w83792d_data *data = i2c_get_clientdata(client);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0950/1059] Input: cyapa - fix runtime PM leak in cyapa_update_rt_suspend_scanrate()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (948 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0949/1059] hwmon: (w83792d) " Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0951/1059] Input: da7280 - do not advertise FF_GAIN Greg Kroah-Hartman
` (48 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wentao Liang, Dmitry Torokhov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <vulab@iscas.ac.cn>
commit f5f8cc539f8b2bd5324c03dfce8cca57284653e6 upstream.
pm_runtime_get_sync() unconditionally increments the runtime PM usage
counter. If mutex_lock_interruptible() is interrupted, the function
returns without dropping that reference, so the usage count stays
elevated for as long as the driver is bound and the device can no longer
be autosuspended. Drop the reference on the error path.
Use pm_runtime_put_autosuspend() rather than the synchronous variant
there: nothing has been done to the device on this path, so there is
nothing to wait for, and with the 2 s autosuspend delay the driver
configures the put only arms the autosuspend timer instead of suspending
the device.
Fixes: 672865080a8f ("Input: cyapa - add runtime power management support")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/1794120347.2701234.vulab@iscas.ac.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/input/mouse/cyapa.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -904,8 +904,10 @@ static ssize_t cyapa_update_rt_suspend_s
pm_runtime_get_sync(dev);
error = mutex_lock_interruptible(&cyapa->state_sync_lock);
- if (error)
+ if (error) {
+ pm_runtime_put_autosuspend(dev);
return error;
+ }
cyapa->runtime_suspend_sleep_time = min_t(u16, time, 1000);
cyapa->runtime_suspend_power_mode =
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0951/1059] Input: da7280 - do not advertise FF_GAIN
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (949 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0950/1059] Input: cyapa - fix runtime PM leak in cyapa_update_rt_suspend_scanrate() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0952/1059] Input: goodix - reject a bak_ref length that cannot hold the checksum Greg Kroah-Hartman
` (47 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ivan Verbovoy, Dmitry Torokhov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Verbovoy <ivanverbovoy@gmail.com>
commit c1f4db7e869ce7dafd1811a75b392740985e1199 upstream.
The driver sets FF_GAIN in the device's force feedback capabilities but
provides no set_gain() callback. input_ff_event() checks the capability
bit, not the callback, before calling ff->set_gain(), so an EV_FF/FF_GAIN
event written to the event node by any process with write access to it
calls through a NULL pointer.
The driver has no global gain to set: a constant effect carries its own
level, and a periodic effect plays a pattern from the device's waveform
memory. Drop FF_GAIN from the capabilities, so that input_ff_event()
ignores such an event.
Fixes: cd3f609823a5 ("Input: new da7280 haptic driver")
Cc: stable@vger.kernel.org
Signed-off-by: Ivan Verbovoy <ivanverbovoy@gmail.com>
Link: https://patch.msgid.link/20261109-da7280-fixes-v1-1-09cc3650261c@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/input/misc/da7280.c | 1 -
1 file changed, 1 deletion(-)
--- a/drivers/input/misc/da7280.c
+++ b/drivers/input/misc/da7280.c
@@ -1229,7 +1229,6 @@ static int da7280_probe(struct i2c_clien
input_set_capability(haptics->input_dev, EV_FF, FF_PERIODIC);
input_set_capability(haptics->input_dev, EV_FF, FF_CUSTOM);
input_set_capability(haptics->input_dev, EV_FF, FF_CONSTANT);
- input_set_capability(haptics->input_dev, EV_FF, FF_GAIN);
error = input_ff_create(haptics->input_dev,
DA7280_FF_EFFECT_COUNT_MAX);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0952/1059] Input: goodix - reject a bak_ref length that cannot hold the checksum
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (950 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0951/1059] Input: da7280 - do not advertise FF_GAIN Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0953/1059] Input: trackpoint - add new TP JYT_NDT device variant id 7 Greg Kroah-Hartman
` (46 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Liu Chao, Dmitry Torokhov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Chao <liuc63@xiaopeng.com>
commit b3249e446d47c65dc09611705ad4d0a7587405ac upstream.
driver_num and sensor_num are taken from the touchscreen config. A
config with driver_num 1 and sensor_num 0 yields a bak_ref length of
0, for which devm_kzalloc() returns ZERO_SIZE_PTR. That pointer
passes the !ts->bak_ref check and the subsequent
ts->bak_ref[ts->bak_ref_len - 1] = 1 writes before the allocation.
Reject a length that leaves no room for the trailing checksum before
allocating, and skip saving a bak_ref that was never allocated.
Without the second check a rejected length leaves bak_ref NULL while
bak_ref_len still holds the bogus value, and goodix_save_bak_ref()
then writes through the same index on suspend.
Fixes: 09182ed20c04 ("Input: goodix - add support for controllers without flash")
Cc: stable@vger.kernel.org
Signed-off-by: Liu Chao <liuc63@xiaopeng.com>
Link: https://patch.msgid.link/20261106075129.3106093-1-liuc63@xiaopeng.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/input/touchscreen/goodix_fwupload.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/input/touchscreen/goodix_fwupload.c
+++ b/drivers/input/touchscreen/goodix_fwupload.c
@@ -280,6 +280,8 @@ static int goodix_prepare_bak_ref(struct
driver_num, sensor_num, have_key);
ts->bak_ref_len = (driver_num * (sensor_num - 2) + 2) * 2;
+ if (ts->bak_ref_len < 2)
+ return -EINVAL;
ts->bak_ref = devm_kzalloc(&ts->client->dev,
ts->bak_ref_len, GFP_KERNEL);
@@ -408,7 +410,7 @@ void goodix_save_bak_ref(struct goodix_t
int error;
u8 val;
- if (!ts->firmware_name)
+ if (!ts->firmware_name || !ts->bak_ref)
return;
error = goodix_i2c_read(ts->client, GOODIX_REG_STATUS, &val, 1);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0953/1059] Input: trackpoint - add new TP JYT_NDT device variant id 7
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (951 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0952/1059] Input: goodix - reject a bak_ref length that cannot hold the checksum Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0954/1059] Input: xpad - add support to Hori Real Arcade Pro 4 Greg Kroah-Hartman
` (45 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yuan Yao, Dmitry Torokhov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Yao <yaoyuan0329os@gmail.com>
commit ce8010f11f3ea62f8675e9bc921ee485aef82019 upstream.
The new trackpoint variant id 7 is found on Lenovo Thinkpad X14
Gen1 laptop(Product Name: 21XMA006CD), it belongs to JYT_NDT with
confirmation from Vishnu Sankar in Lenovo. now it's incorrectly
probed as Generic or Logitech PS/2 mouse.
Add the variant id 7 to match the TP_READ_ID command return
value, probe the device as trackpoint correctly.
BEFORE:
input: PS/2 Generic Mouse as /devices/platform/i8042/serio1/input/input63
AFTER:
psmouse serio1: trackpoint: JYT_NDT TrackPoint firmware: 0xa1, buttons: 3/3
input: TPPS/2 JYT_NDT TrackPoint as /devices/platform/i8042/serio1/input/input8
Signed-off-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Link: https://patch.msgid.link/20261113112202.10304-2-yaoyuan@linux.alibaba.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/input/mouse/trackpoint.c | 2 ++
drivers/input/mouse/trackpoint.h | 1 +
2 files changed, 3 insertions(+)
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -23,6 +23,7 @@ static const char * const trackpoint_var
[TP_VARIANT_NXP] = "NXP",
[TP_VARIANT_JYT_SYNAPTICS] = "JYT_Synaptics",
[TP_VARIANT_SYNAPTICS] = "Synaptics",
+ [TP_VARIANT_JYT_NDT] = "JYT_NDT"
};
/*
@@ -283,6 +284,7 @@ static int trackpoint_start_protocol(str
case TP_VARIANT_ELAN:
case TP_VARIANT_NXP:
case TP_VARIANT_JYT_SYNAPTICS:
+ case TP_VARIANT_JYT_NDT:
case TP_VARIANT_SYNAPTICS:
if (variant_id)
*variant_id = param[0];
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -30,6 +30,7 @@
#define TP_VARIANT_NXP 0x04
#define TP_VARIANT_JYT_SYNAPTICS 0x05
#define TP_VARIANT_SYNAPTICS 0x06
+#define TP_VARIANT_JYT_NDT 0x07
/*
* Commands
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0954/1059] Input: xpad - add support to Hori Real Arcade Pro 4
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (952 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0953/1059] Input: trackpoint - add new TP JYT_NDT device variant id 7 Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0955/1059] ip6mr: prevent info-leak in ip6mr_cache_report() Greg Kroah-Hartman
` (44 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Juan Parrado, Dmitry Torokhov
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juan Parrado <jparrado.1817@gmail.com>
commit 9cfed185db8f1c12bf2629fb37c77d85bf93b193 upstream.
The HORI Real Arcade Pro 4 in PC mode is currently recognized by xpad.c as
a 'Generic X-Box pad' and works out of the box. However, this generic name
does not match the actual device name, making it difficult for users to
distinguish this controller when multiple devices are connected.
Tested on physical hardware. The proposed change works perfectly as is.
The MAP_TRIGGERS_TO_BUTTONS parameter does not work here. Other arcade
sticks use an identical configuration, such as the 'Street Fighter IV
FightPad' and the 'Hori Real Arcade Pro.EX Premium VLX'.
Signed-off-by: Juan Parrado <jparrado.1817@gmail.com>
Link: https://patch.msgid.link/20261109194118.18127-1-jparrado1817@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/input/joystick/xpad.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -268,6 +268,7 @@ static const struct xpad_device {
{ 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
+ { 0x0f0d, 0x008c, "Real Arcade Pro 4", 0, XTYPE_XBOX360 },
{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0955/1059] ip6mr: prevent info-leak in ip6mr_cache_report()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (953 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0954/1059] Input: xpad - add support to Hori Real Arcade Pro 4 Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0956/1059] mac802154: llsec: reject secured frames with security level 0 Greg Kroah-Hartman
` (43 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Henry Martin, Ido Schimmel,
Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <bsdhenrymartin@gmail.com>
commit ea538b5790eed4f042ea787ea761cb1a695f8138 upstream.
The non-WHOLEPKT branch copies the IPv6 header at offset 0 and then
appends 40 bytes with skb_put(), but the mrt6msg is written at offset 0
after skb_reset_transport_header(), so the appended 40 bytes are never
initialized. They hold stale heap contents.
The report is queued to the mroute6 socket and copied into the
IP6MRA_CREPORT_PKT netlink attribute, disclosing the stale bytes to
user space. The stale bytes can contain kernel heap and image
pointers, and the report is reachable from an unprivileged user
namespace (MRT6_INIT in a new netns, plus the non-root
RTNLGRP_IPV6_MROUTE_R group).
Use skb_put_zero() instead, as the IPv4 code does since
commit 4f34002e2e376 ("ipmr: prevent info-leak in pmr_cache_report()").
This issue was discovered by Tencent CodeBuddy Security.
Fixes: 7bc570c8b4f75 ("[IPV6] MROUTE: Support multicast forwarding.")
Cc: stable@vger.kernel.org
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261112042415.617221-1-bsdhenrymartin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/ip6mr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1124,7 +1124,7 @@ static int ip6mr_cache_report(const stru
/*
* Add our header
*/
- skb_put(skb, sizeof(*msg));
+ skb_put_zero(skb, sizeof(*msg));
skb_reset_transport_header(skb);
msg = (struct mrt6msg *)skb_transport_header(skb);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0956/1059] mac802154: llsec: reject secured frames with security level 0
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (954 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0955/1059] ip6mr: prevent info-leak in ip6mr_cache_report() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0957/1059] net/tls: serialize context removal in tls_device_down() Greg Kroah-Hartman
` (42 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Miquel Raynal, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit 3e8c853c959e9637ed66ae1e55e0d3bb97372cc5 upstream.
mac802154_llsec_decrypt() handles every received frame that has the
Security Enabled bit set. The security level is taken from the
auxiliary security header of the frame and is not required to be
non-zero. The only check that looks at level 0 rejects the frame only
if level 0 is not allowed by the matching seclevel entry, the entry has
device_override set and the device is not seclevel_exempt:
if (!(seclevel.sec_levels & BIT(hdr.sec.level)) &&
(hdr.sec.level == 0 && seclevel.device_override &&
!dev->dev.seclevel_exempt)) {
Otherwise the frame reaches llsec_do_decrypt(), which sends every level
other than IEEE802154_SCF_SECLEVEL_ENC to llsec_do_decrypt_auth().
There ieee802154_sechdr_authtag_len() returns 0 for level 0 and
req = aead_request_alloc(llsec_tfm_by_len(key, authlen), GFP_ATOMIC);
looks for a transform with an authentication tag size of 0. The key
only has transforms for tag sizes 4, 8 and 16, so llsec_tfm_by_len()
runs into its BUG().
The frame is not authenticated at that point. A station in radio range
can crash a node that has llsec enabled if it sends a frame that matches
a configured key entry and a device table entry (source address, key id
mode and key id are sent in the clear and can be observed), uses a frame
type that has a seclevel entry and carries a frame counter that is not
lower than the stored one. No key material is needed. The frame
counter of that device is also updated before the BUG() is reached.
A frame with the Security Enabled bit set and security level 0 carries
no protection and cannot be processed by the incoming security
procedure. Reject it before any key or device state is looked up. The
transmit side already leaves such frames alone in
mac802154_llsec_encrypt().
Found by LLM-assisted source review.
Fixes: 4c14a2fb5d14 ("mac802154: add llsec decryption method")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20261110-llsec-seclevel-none-v1-1-06ef143e467f@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac802154/llsec.c | 2 ++
1 file changed, 2 insertions(+)
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -1016,6 +1016,8 @@ int mac802154_llsec_decrypt(struct mac80
return 0;
if (hdr.fc.version == 0)
return -EINVAL;
+ if (hdr.sec.level == IEEE802154_SCF_SECLEVEL_NONE)
+ return -EINVAL;
read_lock_bh(&sec->lock);
if (!sec->params.enabled) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0957/1059] net/tls: serialize context removal in tls_device_down()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (955 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0956/1059] mac802154: llsec: reject secured frames with security level 0 Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0958/1059] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Greg Kroah-Hartman
` (41 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jaeyeong Lee, Paolo Abeni
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaeyeong Lee <lee@jaeyeong.cc>
commit 81c8333141b9aa465d98bb4c035284556e699701 upstream.
tls_device_down() moves each context to tls_device_down_list while
holding tls_device_lock. It then drops its reference and removes the
context after releasing the lock.
tls_device_queue_ctx_destruction() removes contexts from the same list
under tls_device_lock. If it removes an adjacent context while
tls_device_down() is deleting its node, the two list updates can
interleave. One update can then target a context freed by the other path,
causing a use-after-free write.
Drop the reference and remove the context in the existing
tls_device_lock critical section. Keep tls_device_free_ctx() after
releasing the lock.
This issue was found with a static analysis tool.
Fixes: f6336724a4d4 ("net/tls: Remove the context from the list in tls_device_down")
Cc: stable@vger.kernel.org
Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
Link: https://patch.msgid.link/20261112043209.102404-1-lee@jaeyeong.cc
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/tls/tls_device.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1396,6 +1396,8 @@ static int tls_device_down(struct net_de
spin_unlock_irqrestore(&tls_device_lock, flags);
list_for_each_entry_safe(ctx, tmp, &list, list) {
+ bool free_ctx;
+
/* Stop offloaded TX and switch to the fallback.
* tls_is_sk_tx_device_offloaded will return false.
*/
@@ -1433,17 +1435,19 @@ static int tls_device_down(struct net_de
*/
spin_lock_irqsave(&tls_device_lock, flags);
list_move_tail(&ctx->list, &tls_device_down_list);
+ /* Serialize the final removal with sk_destruct. */
+ free_ctx = refcount_dec_and_test(&ctx->refcount);
+ if (free_ctx)
+ list_del(&ctx->list);
spin_unlock_irqrestore(&tls_device_lock, flags);
/* Device contexts for RX and TX will be freed in on sk_destruct
* by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW.
- * Now release the ref taken above.
*/
- if (refcount_dec_and_test(&ctx->refcount)) {
+ if (free_ctx) {
/* sk_destruct ran after tls_device_down took a ref, and
* it returned early. Complete the destruction here.
*/
- list_del(&ctx->list);
tls_device_free_ctx(ctx);
}
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0958/1059] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (956 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0957/1059] net/tls: serialize context removal in tls_device_down() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0959/1059] ipvs: reject FTP control ports as data ports Greg Kroah-Hartman
` (40 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Theodor Arsenij Larionov Trichkine,
Julian Anastasov, Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
commit 4656934d460da68382cf91766a1ff2d0610554ae upstream.
A CT target hooked after conntrack attaches its template to a packet
that conntrack left without an entry. On an IPVS FTP PASV/EPSV reply,
ip_vs_ftp_out() then mangles with the template and creates an
expectation with the template as master. Deleting the CT rule frees
the template and leaves the expectation, so a later expectation flush
reads freed memory:
BUG: KASAN: slab-use-after-free in nf_ct_unlink_expect_report
Reachable with CAP_NET_ADMIN in a user namespace.
Skip templates, as nft_ct and nfnetlink_queue do.
Fixes: f4bc17cdd205 ("ipvs: netfilter connection tracking changes")
Cc: stable@vger.kernel.org
Signed-off-by: Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_ftp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -369,7 +369,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap
buf_len = strlen(buf);
ct = nf_ct_get(skb, &ctinfo);
- if (ct) {
+ if (ct && !nf_ct_is_template(ct)) {
bool mangled;
/* If mangling fails this function will return 0
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0959/1059] ipvs: reject FTP control ports as data ports
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (957 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0958/1059] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0960/1059] ipvs: validate cport in received sync records Greg Kroah-Hartman
` (39 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Luxing Yin, Zihan Xi,
Julian Anastasov, Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <zihanx@nebusec.ai>
commit a107e150e105836bb5349cdee14541d4995009ea upstream.
The FTP helper must not treat a configured control port as a data port.
Accepting such a port can leave IPVS connections in a state that leads
to recursive expiration and kernel stack exhaustion.
Reject zero and configured control ports before creating passive data
connections. For active mode, reject a zero client port and a derived
data port that is itself a configured control port.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Co-developed-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_ftp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -63,6 +63,17 @@ static unsigned short ports[IP_VS_APP_MA
module_param_array(ports, ushort, &ports_count, 0444);
MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
+static bool is_control_port(u16 port)
+{
+ unsigned int i;
+
+ for (i = 0; i < ports_count; i++) {
+ if (ports[i] == port)
+ return true;
+ }
+ return false;
+}
+
static char *ip_vs_ftp_data_ptr(struct sk_buff *skb, struct ip_vs_iphdr *ipvsh)
{
@@ -320,6 +331,10 @@ static int ip_vs_ftp_out(struct ip_vs_ap
return 1;
}
+ /* Do not redirect data to control ports */
+ if (!port || is_control_port(ntohs(port)))
+ return 0;
+
/* Now update or create a connection entry for it */
{
struct ip_vs_conn_param p;
@@ -530,6 +545,9 @@ static int ip_vs_ftp_in(struct ip_vs_app
return 1;
}
+ if (!port || is_control_port(ntohs(cp->vport) - 1))
+ return 0;
+
/* Passive mode off */
cp->app_data = (void *) IP_VS_FTP_ACTIVE;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0960/1059] ipvs: validate cport in received sync records
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (958 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0959/1059] ipvs: reject FTP control ports as data ports Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0961/1059] KVM: PPC: Book3S HV: Disable preemption around host-side HPT lock users Greg Kroah-Hartman
` (38 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Axel Mierczuk,
Pablo Neira Ayuso
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Mierczuk <axel.mierczuk@1password.com>
commit 1d1e8bc81f790a48cd643b1b1762de43334d4f14 upstream.
Local templates have cport 0 and IP_VS_CONN_F_NO_CPORT clear, so
ip_vs_conn_in_get() cannot match them. A template received over the
unauthenticated sync protocol with a nonzero cport can reach the
protocol state machine. Before template state validation, this
could cause out-of-bounds reads, crashes and kernel data leaks.
Ordinary records with cport 0 and IP_VS_CONN_F_NO_CPORT clear, or
with a nonzero cport and IP_VS_CONN_F_NO_CPORT set, create connections
that incoming lookups cannot match. The latter also keeps the
cport-zero fallback in ip_vs_conn_in_get() enabled.
Reject all three cases. Continue accepting ordinary connections with
cport 0 and IP_VS_CONN_F_NO_CPORT. The companion commit f96e91748f63
("ipvs: filter some flags received in the backup server") rejects
template records carrying IP_VS_CONN_F_NO_CPORT.
Fixes: 87375ab47cd0 ("[IPVS]: ip_vs_ftp breaks connections using persistence")
Cc: stable@vger.kernel.org
Suggested-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Axel Mierczuk <axel.mierczuk@1password.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_sync.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -871,6 +871,25 @@ static void ip_vs_proc_conn(struct netns
struct ip_vs_dest *dest;
struct ip_vs_conn *cp;
+ /* Templates require cport 0. Ordinary connections require
+ * NO_CPORT exactly when cport is 0.
+ */
+ if (flags & IP_VS_CONN_F_TEMPLATE) {
+ if (param->cport) {
+ IP_VS_DBG(2, "BACKUP, template with cport dropped\n");
+ kfree(param->pe_data);
+ return;
+ }
+ } else if (!param->cport && !(flags & IP_VS_CONN_F_NO_CPORT)) {
+ IP_VS_DBG(2, "BACKUP, conn without cport dropped\n");
+ kfree(param->pe_data);
+ return;
+ } else if (param->cport && (flags & IP_VS_CONN_F_NO_CPORT)) {
+ IP_VS_DBG(2, "BACKUP, conn with cport and NO_CPORT dropped\n");
+ kfree(param->pe_data);
+ return;
+ }
+
if (!(flags & IP_VS_CONN_F_TEMPLATE)) {
cp = ip_vs_conn_in_get(param);
if (cp && ((cp->dport != dport) ||
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0961/1059] KVM: PPC: Book3S HV: Disable preemption around host-side HPT lock users
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (959 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0960/1059] ipvs: validate cport in received sync records Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0962/1059] KVM: PPC: Book3S HV: Ensure that calls to idr_alloc are synchronized Greg Kroah-Hartman
` (37 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Amit Machhiwal, Ritesh Harjani (IBM),
Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Machhiwal <amachhiw@linux.ibm.com>
commit 4e6e66ecf62185828f731914000a6b0baff355db upstream.
A previous change ("KVM: PPC: Book3S HV: Add preempt_disable() around
virtual-mode HPTE bit-lock users") at [1] added preempt_disable() around
guest vCPU HPT hcalls and page fault handlers executed in virtual mode.
This ensures vCPU threads cannot be preempted while holding
HPTE_V_HVLOCK or the reverse-map lock.
However, several host-side virtual-mode paths in book3s_64_mmu_hv.c also
acquire HPTE_V_HVLOCK and lock_rmap() in process context with preemption
enabled. Specifically, kvm_unmap_rmapp() and kvm_age_rmapp() take both
locks during MMU notifier callbacks and memslot flushes, while
resize_hpt_rehash_hpte() acquires HPTE_V_HVLOCK during HPT resizing. If
a host thread is preempted while holding either bit-lock, any guest vCPU
thread scheduled on the same CPU spinning for the same lock with
preemption disabled will never yield, resulting in a permanent CPU hang.
Fix this by disabling preemption across these host-side critical
sections.
For kvm_unmap_rmapp() and kvm_age_rmapp(), place preempt_disable()
before lock_rmap() so that both the rmap chain lock and the subsequent
HPTE_V_HVLOCK bit-lock are held under a single non-preemptible window.
To preserve the ABBA lock ordering between the two locks, re-enable
preemption after dropping the rmap lock on any retry or early-exit path
before spinning on cpu_relax(), allowing the lock holder to be
scheduled.
For kvm_htab_write(), the HPT migration restore path, replace the direct
calls to kvmppc_do_h_remove() with kvmppc_virtmode_do_h_remove(), a thin
wrapper that brackets kvmppc_do_h_remove() with preempt_disable() and
preempt_enable(), mirroring the existing kvmppc_virtmode_do_h_enter()
helper.
For resize_hpt_rehash_hpte(), place preempt_disable() before the
try_lock_hpte() spin loop and preempt_enable() after unlock_hpte() at
the function exit.
[1] https://git.kernel.org/powerpc/c/abbbe5ff83e7c9ed3a4d61b73011f1df7bf87907
Fixes: 6165d5dd99db ("KVM: PPC: Book3S HV: add virtual mode handlers for HPT hcalls and page faults")
Cc: stable@vger.kernel.org # v5.14+
Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261014185215.71832-1-amachhiw@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kvm/book3s_64_mmu_hv.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -46,6 +46,9 @@
static long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags,
long pte_index, unsigned long pteh,
unsigned long ptel, unsigned long *pte_idx_ret);
+static void kvmppc_virtmode_do_h_remove(struct kvm *kvm, unsigned long flags,
+ unsigned long pte_index, unsigned long avpn,
+ unsigned long *hpret);
struct kvm_resize_hpt {
/* These fields read-only after init */
@@ -307,6 +310,22 @@ static long kvmppc_virtmode_do_h_enter(s
}
+/*
+ * Virtual-mode H_REMOVE. kvmppc_do_h_remove() is also called from real mode,
+ * where preempt_disable() is not usable, so the guard stays here. The function
+ * spins on HPTE_V_HVLOCK and then lock_rmap() (via remove_revmap_chain());
+ * preemption must be disabled across both bit-locks so that spinning callers
+ * holding preempt_disable() can make forward progress.
+ */
+static void kvmppc_virtmode_do_h_remove(struct kvm *kvm, unsigned long flags,
+ unsigned long pte_index, unsigned long avpn,
+ unsigned long *hpret)
+{
+ preempt_disable();
+ kvmppc_do_h_remove(kvm, flags, pte_index, avpn, hpret);
+ preempt_enable();
+}
+
static struct kvmppc_slb *kvmppc_mmu_book3s_hv_find_slbe(struct kvm_vcpu *vcpu,
gva_t eaddr)
{
@@ -812,9 +831,11 @@ static void kvm_unmap_rmapp(struct kvm *
rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
for (;;) {
+ preempt_disable();
lock_rmap(rmapp);
if (!(*rmapp & KVMPPC_RMAP_PRESENT)) {
unlock_rmap(rmapp);
+ preempt_enable();
break;
}
@@ -828,6 +849,7 @@ static void kvm_unmap_rmapp(struct kvm *
if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
/* unlock rmap before spinning on the HPTE lock */
unlock_rmap(rmapp);
+ preempt_enable();
while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
cpu_relax();
continue;
@@ -836,6 +858,7 @@ static void kvm_unmap_rmapp(struct kvm *
kvmppc_unmap_hpte(kvm, i, memslot, rmapp, gfn);
unlock_rmap(rmapp);
__unlock_hpte(hptep, be64_to_cpu(hptep[0]));
+ preempt_enable();
}
}
@@ -892,6 +915,7 @@ static bool kvm_age_rmapp(struct kvm *kv
rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
retry:
+ preempt_disable();
lock_rmap(rmapp);
if (*rmapp & KVMPPC_RMAP_REFERENCED) {
*rmapp &= ~KVMPPC_RMAP_REFERENCED;
@@ -899,6 +923,7 @@ static bool kvm_age_rmapp(struct kvm *kv
}
if (!(*rmapp & KVMPPC_RMAP_PRESENT)) {
unlock_rmap(rmapp);
+ preempt_enable();
return ret;
}
@@ -914,6 +939,7 @@ static bool kvm_age_rmapp(struct kvm *kv
if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
/* unlock rmap before spinning on the HPTE lock */
unlock_rmap(rmapp);
+ preempt_enable();
while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
cpu_relax();
goto retry;
@@ -933,6 +959,7 @@ static bool kvm_age_rmapp(struct kvm *kv
} while ((i = j) != head);
unlock_rmap(rmapp);
+ preempt_enable();
return ret;
}
@@ -1233,6 +1260,7 @@ static unsigned long resize_hpt_rehash_h
if (!(vpte & HPTE_V_VALID) && !(vpte & HPTE_V_ABSENT))
return 0; /* nothing to do */
+ preempt_disable();
while (!try_lock_hpte(hptep, HPTE_V_HVLOCK))
cpu_relax();
@@ -1360,6 +1388,7 @@ static unsigned long resize_hpt_rehash_h
out:
unlock_hpte(hptep, vpte);
+ preempt_enable();
return ret;
}
@@ -1882,7 +1911,7 @@ static ssize_t kvm_htab_write(struct fil
nb += HPTE_SIZE;
if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
- kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
+ kvmppc_virtmode_do_h_remove(kvm, 0, i, 0, tmp);
err = -EIO;
ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, i, v, r,
tmp);
@@ -1912,7 +1941,7 @@ static ssize_t kvm_htab_write(struct fil
for (j = 0; j < hdr.n_invalid; ++j) {
if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
- kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
+ kvmppc_virtmode_do_h_remove(kvm, 0, i, 0, tmp);
++i;
hptp += 2;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0962/1059] KVM: PPC: Book3S HV: Ensure that calls to idr_alloc are synchronized
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (960 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0961/1059] KVM: PPC: Book3S HV: Disable preemption around host-side HPT lock users Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0963/1059] KVM: PPC: Book3S HV: Take SRCU read lock around kvmppc_h_page_init() call Greg Kroah-Hartman
` (36 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ritesh Harjani (IBM),
Gautam Menghani, Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <gautam@linux.ibm.com>
commit d8c6ab0aeeca7cc2adfcf0ce1f796c6a86314ec0 upstream.
Calls to idr_alloc() in __prealloc_nested() are not currently synchronized.
According to the documentation [1], the caller should provide their own
locking to prevent concurrent modifications to the idr to prevent bugs.
__prealloc_nested() calls idr_alloc() with GFP_KERNEL which can
sleep and mmu_lock is a spinlock. So idr_alloc() cannot be moved under
mmu_lock. In such cases the idr Documentation says:
If you need to take a lock while allocating a new ID from the IDR,
you may need to pass a restrictive set of GFP flags, which can lead
to the IDR being unable to allocate memory. To work around this,
you can call idr_preload() before taking the lock, and then
idr_preload_end() after the allocation.
Hence preload the idr memory with idr_preload() before taking mmu_lock,
which allows us to use idr_alloc(..., GFP_NOWAIT) under the spinlock.
This also allows to kill __prealloc_nested() and __add_nested(), as they
are not needed anymore with idr_preload().
[1]: lib/idr.c
Fixes: c0f00a18e2a8 ("KVM: PPC: Book3S HV Nested: Change nested guest lookup to use idr")
Cc: stable@vger.kernel.org # 5.19+
Co-developed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261012082922.218799-2-gautam@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kvm/book3s_hv_nested.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -670,20 +670,6 @@ static struct kvm_nested_guest *__find_n
return idr_find(&kvm->arch.kvm_nested_guest_idr, lpid);
}
-static bool __prealloc_nested(struct kvm *kvm, int lpid)
-{
- if (idr_alloc(&kvm->arch.kvm_nested_guest_idr,
- NULL, lpid, lpid + 1, GFP_KERNEL) != lpid)
- return false;
- return true;
-}
-
-static void __add_nested(struct kvm *kvm, int lpid, struct kvm_nested_guest *gp)
-{
- if (idr_replace(&kvm->arch.kvm_nested_guest_idr, gp, lpid))
- WARN_ON(1);
-}
-
static void __remove_nested(struct kvm *kvm, int lpid)
{
idr_remove(&kvm->arch.kvm_nested_guest_idr, lpid);
@@ -830,21 +816,21 @@ struct kvm_nested_guest *kvmhv_get_neste
if (!newgp)
return NULL;
- if (!__prealloc_nested(kvm, l1_lpid)) {
- kvmhv_release_nested(newgp);
- return NULL;
- }
-
+ idr_preload(GFP_KERNEL);
spin_lock(&kvm->mmu_lock);
gp = __find_nested(kvm, l1_lpid);
if (!gp) {
- __add_nested(kvm, l1_lpid, newgp);
- ++newgp->refcnt;
- gp = newgp;
- newgp = NULL;
+ if (idr_alloc(&kvm->arch.kvm_nested_guest_idr, newgp,
+ l1_lpid, l1_lpid + 1, GFP_NOWAIT) >= 0) {
+ ++newgp->refcnt;
+ gp = newgp;
+ newgp = NULL;
+ }
}
- ++gp->refcnt;
+ if (gp)
+ ++gp->refcnt;
spin_unlock(&kvm->mmu_lock);
+ idr_preload_end();
if (newgp)
kvmhv_release_nested(newgp);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0963/1059] KVM: PPC: Book3S HV: Take SRCU read lock around kvmppc_h_page_init() call
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (961 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0962/1059] KVM: PPC: Book3S HV: Ensure that calls to idr_alloc are synchronized Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0964/1059] KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu() Greg Kroah-Hartman
` (35 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gautam Menghani,
Ritesh Harjani (IBM), Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <gautam@linux.ibm.com>
commit b04be22bf6ea06b92bff7850328a8057b8d964ae upstream.
Since there is no srcu read lock around kvmppc_h_page_init(), a
"suspicious rcu_dereference_check() usage" can be triggered by running
host linux with CONFIG_PROVE_RCU=y and the following code in the guest:
plpar_hcall_norets(H_PAGE_INIT, H_ZERO_PAGE, phys_addr, 0);
=============================
WARNING: suspicious RCU usage
7.0.0-dirty #227 Not tainted
-----------------------------
./include/linux/kvm_host.h:1074 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by qemu-system-ppc/2093:
#0: c000000354197ab0 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x10c/0xaf0
stack backtrace:
CPU: 30 UID: 0 PID: 2093 Comm: qemu-system-ppc Not tainted 7.0.0-dirty #227 PREEMPT(full)
Hardware name: IBM,9080-HEX POWER10 (architected) 0x800200 0xf000006 of:IBM,FW1060.60 (NH1060_158) hv:phyp pSeries
Call Trace:
[c00000033e1bf430] [c000000001b3dbd4] dump_stack_lvl+0xc8/0x130 (unreliable)
[c00000033e1bf470] [c0000000003da964] lockdep_rcu_suspicious+0x1f4/0x290
[c00000033e1bf520] [c000000000231424] gfn_to_memslot+0x1b4/0x1c0
[c00000033e1bf560] [c00000000023637c] kvm_clear_guest+0x9c/0x110
[c00000033e1bf5c0] [c0000000002714a4] kvmppc_h_page_init+0x160/0x1a0
[c00000033e1bf610] [c00000000026c040] kvmppc_pseries_do_hcall+0x1930/0x1940
[c00000033e1bf6d0] [c00000000026fb18] kvmppc_vcpu_run_hv+0x268/0x800
[c00000033e1bf7a0] [c000000000246b30] kvmppc_vcpu_run+0x30/0x50
[c00000033e1bf7c0] [c000000000241ed4] kvm_arch_vcpu_ioctl_run+0x364/0x530
[c00000033e1bf860] [c00000000022b870] kvm_vcpu_ioctl+0x1b0/0xaf0
[c00000033e1bfa50] [c0000000009b4514] sys_ioctl+0x144/0x190
[c00000033e1bfab0] [c000000000034330] system_call_exception+0x170/0x370
[c00000033e1bfe50] [c00000000000d05c] system_call_vectored_common+0x15c/0x2ec
Fix this by taking a srcu read lock around kvmppc_h_page_init().
Fixes: 2d34d1c3bbfd ("KVM: PPC: Book3S HV: Implement virtual mode H_PAGE_INIT handler")
Cc: stable@vger.kernel.org # 5.2+
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261012082922.218799-5-gautam@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kvm/book3s_hv.c | 2 ++
1 file changed, 2 insertions(+)
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1310,9 +1310,11 @@ int kvmppc_pseries_do_hcall(struct kvm_v
ret = kvmhv_copy_tofrom_guest_nested(vcpu);
break;
case H_PAGE_INIT:
+ idx = srcu_read_lock(&kvm->srcu);
ret = kvmppc_h_page_init(vcpu, kvmppc_get_gpr(vcpu, 4),
kvmppc_get_gpr(vcpu, 5),
kvmppc_get_gpr(vcpu, 6));
+ srcu_read_unlock(&kvm->srcu, idx);
break;
case H_SVM_PAGE_IN:
ret = H_UNSUPPORTED;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0964/1059] KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (962 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0963/1059] KVM: PPC: Book3S HV: Take SRCU read lock around kvmppc_h_page_init() call Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0965/1059] KVM: PPC: Book3S HV: XICS: Update irq_type for cleanup to work Greg Kroah-Hartman
` (34 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gautam Menghani,
Ritesh Harjani (IBM), Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <gautam@linux.ibm.com>
commit 7279692d70f3e399b3dd2d07ffa365e9f533761f upstream.
In kvmppc_xive_connect_vcpu() if there is a failure before
xc->vp_ipi_data is setup, it can result in a NULL pointer dereference in
kvmppc_xive_cleanup_vcpu() when accessing the MMIO page in
xive_vm_esb_load(). Fix this by adding a check before masking
the VP IPI before accessing the MMIO pages.
Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Cc: stable@vger.kernel.org # 4.12+
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261012082922.218799-4-gautam@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kvm/book3s_xive.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -1821,7 +1821,8 @@ void kvmppc_xive_cleanup_vcpu(struct kvm
kvmppc_xive_disable_vcpu_interrupts(vcpu);
/* Mask the VP IPI */
- xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01);
+ if (xc->vp_ipi_data.eoi_mmio)
+ xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01);
/* Free escalations */
for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0965/1059] KVM: PPC: Book3S HV: XICS: Update irq_type for cleanup to work
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (963 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0964/1059] KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0966/1059] mm/damon/core: reset watermark wait state on each iteration Greg Kroah-Hartman
` (33 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gautam Menghani,
Ritesh Harjani (IBM), Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautam Menghani <gautam@linux.ibm.com>
commit b9d9a8741752c5b42c65b1c8dffba867889b74e5 upstream.
In kvmppc_xive_connect_vcpu(), if any failures are encountered, the
control flow jumps to the 'bail' label where kvmppc_xive_cleanup_vcpu()
is called. This cleanup function exits prematurely since
vcpu->arch.irq_type is set to KVMPPC_IRQ_DEFAULT at this point. This ends
up resulting in wasted memory.
Fix this by setting irq_type to KVMPPC_IRQ_XICS before vcpu configuration
starts. This makes XICS initialization symmetrical to XIVE
initialization done in kvmppc_xive_native_connect_vcpu().
Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Cc: stable@vger.kernel.org # 4.12+
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261012082922.218799-3-gautam@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kvm/book3s_xive.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -1942,6 +1942,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_
xc->vp_id = vp_id;
xc->mfrr = 0xff;
xc->valid = true;
+ vcpu->arch.irq_type = KVMPPC_IRQ_XICS;
r = xive_native_get_vp_info(xc->vp_id, &xc->vp_cam, &xc->vp_chip_id);
if (r)
@@ -2030,7 +2031,6 @@ bail:
return r;
}
- vcpu->arch.irq_type = KVMPPC_IRQ_XICS;
return 0;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0966/1059] mm/damon/core: reset watermark wait state on each iteration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (964 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0965/1059] KVM: PPC: Book3S HV: XICS: Update irq_type for cleanup to work Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0967/1059] mm/filemap: stop fault-around when the walk steps back Greg Kroah-Hartman
` (32 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aveline Noir, SJ Park, Andrew Morton,
Wang Xiaolei
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aveline Noir <jm5905938@gmail.com>
commit 5fe092741502770107a0be7b3885ce55f7761f01 upstream.
Patch series "mm/damon: fix watermark state, kunit pid leak and selftest
fake pass".
Three hotfixes for core, kunit and selftest. Fix kdamond deactivation
from missed watermark reset with patch 1. Fix pid leak in kunit test
with patch 2. Fix a selftest wrongly passing when it should skip, with
patch 3.
Note for reviewers. This series is a collection of fixes that were
initially developed by different people. Changelog is in each patch.
This patch (of 3):
Found while reviewing the DAMON source code that if an online commit
removes all schemes while kdamond is waiting for watermark activation,
the scheme loop becomes empty but min_wait_time keeps the previous
positive value. kdamond then keeps sleeping instead of resuming
monitoring without schemes.
The way to wake up the kdamond again without DAMON is bit complicated.
Install a scheme having watermarks that can activate the kdamond again,
and remove the scheme again. Doable but cumbersome and complicated.
Initialize min_wait_time and init_wait_time on each loop iteration so
the wait is calculated from the current schemes and an empty scheme
list resumes monitoring.
Link: https://lore.kernel.org/20261102144627.88843-1-sj@kernel.org
Link: https://lore.kernel.org/20261102144627.88843-2-sj@kernel.org
Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update")
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Wang Xiaolei <xiaoleiwangxiaolei@gmail.com>
Cc: <stable@vger.kernel.org> # 5.19.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/damon/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1220,10 +1220,11 @@ static int kdamond_wait_activation(struc
{
struct damos *s;
unsigned long wait_time;
- unsigned long min_wait_time = 0;
- bool init_wait_time = false;
while (!kdamond_need_stop(ctx)) {
+ unsigned long min_wait_time = 0;
+ bool init_wait_time = false;
+
damon_for_each_scheme(s, ctx) {
wait_time = damos_wmark_wait_us(s);
if (!init_wait_time || wait_time < min_wait_time) {
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0967/1059] mm/filemap: stop fault-around when the walk steps back
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (965 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0966/1059] mm/damon/core: reset watermark wait state on each iteration Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0968/1059] PPC32: Fix hard_irq_disable to follow tracing and lockdep state Greg Kroah-Hartman
` (31 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jose Fernandez (Anthropic),
Andrew Morton, Jan Kara, Matthew Wilcox (Oracle),
David Hildenbrand, Krystian Kaniewski, Pedro Falcato
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
commit cf5518aa1832d82b391ac2492863ae6a7315827c upstream.
filemap_map_pages() can dereference a PTE pointer outside the page table
it locked. KASAN has reported this as a use-after-free read [1]. The
same path can also write out of bounds. When the stray entry reads as
none, the fault-around loop maps a page there with set_pte_range().
Its fault-around loop walks the page cache and moves vmf->pte by the
change in index. A lower index moves it back. xas_find() can step back
to a lower index when a multi-index entry is split during the walk.
[1] fixes xas_find(), but the loop still relies on the walk never stepping
back. Stop the fault-around when the walk steps back. ->fault() maps the
faulting page if the loop did not.
Link: https://lore.kernel.org/20261031-jf-mm-filemap-map-pages-lower-bound-v2-1-21029744e589@linux.dev
Link: https://lore.kernel.org/20260904121301.200049-1-krystianmkaniewski@gmail.com [1]
Fixes: 6b24ca4a1a8d ("mm: Use multi-index entries in the page cache")
Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/filemap.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3508,6 +3508,13 @@ again:
if (mmap_miss > 0)
mmap_miss--;
+ /* A lower index could move vmf->pte out of its page table. */
+ if (unlikely(xas.xa_index < last_pgoff)) {
+ folio_unlock(folio);
+ folio_put(folio);
+ break;
+ }
+
addr += (xas.xa_index - last_pgoff) << PAGE_SHIFT;
vmf->pte += xas.xa_index - last_pgoff;
last_pgoff = xas.xa_index;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0968/1059] PPC32: Fix hard_irq_disable to follow tracing and lockdep state
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (966 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0967/1059] mm/filemap: stop fault-around when the walk steps back Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0969/1059] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout() Greg Kroah-Hartman
` (30 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ritesh Harjani (IBM),
Shrikanth Hegde, Mukesh Kumar Chaurasiya (IBM),
Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <sshegde@linux.ibm.com>
commit 2672bdcc7857073722c4772831a24b14832ee88a upstream.
On PPC32, the code for hard_irq_disable has diverged and it doesn't
do lockdep/tracing anymore, leading to use of both local_irq_disable
and hard_irq_disable on PPC32 to overcome those.
That is un-necessary, instead simply calling local_irq_disable is
enough. It disables EE bit and does lockdep tracking.
Subsequent patch uses this API in KVM code to avoid the warnings.
Wider use of it is possible, but it will be taken subsequently.
Cc: stable@vger.kernel.org # v7.2+
Suggested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261118051419.783878-2-sshegde@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/include/asm/hw_irq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -464,7 +464,7 @@ static inline bool arch_irqs_disabled(vo
return arch_irqs_disabled_flags(arch_local_save_flags());
}
-#define hard_irq_disable() arch_local_irq_disable()
+#define hard_irq_disable() local_irq_disable()
static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
{
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0969/1059] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (967 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0968/1059] PPC32: Fix hard_irq_disable to follow tracing and lockdep state Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0970/1059] RDMA/mlx5: Fix DevX umem page size truncation for pages >= 4G Greg Kroah-Hartman
` (29 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nathan Chancellor, Stefan Wahren,
Nick Desaulniers, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <nathan@kernel.org>
commit 695d0824cb6b27ff1a1cdeabb2d5138f00b15251 upstream.
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in
qcaspi_netdev_tx_timeout(), which can break the build with
CONFIG_WERROR=y / W=e:
drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
805 | jiffies, jiffies - dev_trans_start(dev));
| ~~~~~~~ ^
Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.
Printing jiffies on its own is not that useful for debugging transmit
timeouts, so get rid of it to clear up the warning.
Cc: stable@vger.kernel.org
Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2197
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://patch.msgid.link/20261115-qca_spi-wunsequenced-v2-1-8cf32f12d546@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -812,8 +812,8 @@ qcaspi_netdev_tx_timeout(struct net_devi
{
struct qcaspi *qca = netdev_priv(dev);
- netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n",
- jiffies, jiffies - dev_trans_start(dev));
+ netdev_info(qca->net_dev, "Transmit timeout, latency %ld\n",
+ jiffies - dev_trans_start(dev));
qca->net_dev->stats.tx_errors++;
/* Trigger tx queue flush and QCA7000 reset */
qca->sync = QCASPI_SYNC_UNKNOWN;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0970/1059] RDMA/mlx5: Fix DevX umem page size truncation for pages >= 4G
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (968 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0969/1059] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0971/1059] RDMA/siw: Fix use-after-free in siw_mem_id2obj() Greg Kroah-Hartman
` (28 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dezhen Lu, Jason Gunthorpe,
Leon Romanovsky
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
commit b5c11bf9759834731440806708143c40638dc2ff upstream.
devx_umem_find_best_pgsize() computes the page size in an unsigned long
but returns it as unsigned int, and devx_umem_reg_cmd_alloc() stores it
in an unsigned int. When the DMA mapping of the umem is contiguous and
aligned to 4 GiB or more, and the umem length is a multiple of that
size, ib_umem_find_best_pgoff() selects a page size >= 2^32. Since the
value is a power of two, the truncation turns it into 0 and the
registration fails with -EINVAL.
The umem log_page_size field is 5 bits wide on top of
MLX5_ADAPTER_PAGE_SHIFT, so the command can encode these page sizes.
Seen on two GH200 nodes (ConnectX-7, firmware 32.38.3056 and
32.43.1014) with a dma-buf exported from cudaMalloc memory: registering
4 GiB or 8 GiB umems at 4 GiB-aligned offsets of the dma-buf fails with
EINVAL every time, while 2 GiB umems at the same offsets and
ibv_reg_dmabuf_mr() of the same ranges succeed. Restricting the user
pgsz_bitmap to <= 2 GiB makes all of them succeed.
Other large physically contiguous buffers, such as a 16 GiB hugetlb
page on an arm64 kernel with 64K base pages, should hit the same path.
Use unsigned long for the page size, as commit f0c2427412b4
("RDMA/mlx5: Fix page_size variable overflow") already did for the MR
paths.
The bug was found by an AI coding assistant (Claude Opus 5.5, Anthropic)
during an audit of 32-bit truncations of page sizes and offsets in
drivers/infiniband/core and drivers/infiniband/hw/mlx5. The assistant
also wrote the reproducer and this patch. The reproducer was run on the
GH200 nodes described above.
Fixes: 7610ab57de56 ("RDMA/mlx5: Allow larger pages in DevX umem")
Cc: stable@vger.kernel.org
Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
Link: https://patch.msgid.link/20261103142804.67210-1-dezhen.lu@student.uni-tuebingen.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/hw/mlx5/devx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -2234,8 +2234,8 @@ static int devx_umem_get(struct mlx5_ib_
return 0;
}
-static unsigned int devx_umem_find_best_pgsize(struct ib_umem *umem,
- unsigned long pgsz_bitmap)
+static unsigned long devx_umem_find_best_pgsize(struct ib_umem *umem,
+ unsigned long pgsz_bitmap)
{
unsigned long page_size;
@@ -2273,7 +2273,7 @@ static int devx_umem_reg_cmd_alloc(struc
int access)
{
unsigned long pgsz_bitmap;
- unsigned int page_size;
+ unsigned long page_size;
__be64 *mtt;
void *umem;
int ret;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0971/1059] RDMA/siw: Fix use-after-free in siw_mem_id2obj()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (969 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0970/1059] RDMA/mlx5: Fix DevX umem page size truncation for pages >= 4G Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0972/1059] RDMA/srpt: bound the indirect descriptor table to the IU Greg Kroah-Hartman
` (27 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Deep Shah, Leon Romanovsky
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deep Shah <deepshah146@gmail.com>
commit a70672b9b3ac7d8945f67cd199c1bb680d5d5f64 upstream.
siw_mem_id2obj() finds a siw_mem with xa_load() under rcu_read_lock()
and then takes a reference with kref_get_unless_zero(). This is only
safe if the object stays allocated until RCU readers are done with it.
siw_free_mem() frees it with kfree() as soon as the last reference is
dropped, so a lookup that races with the final put reads freed memory.
This happens when an MR is deregistered while an incoming RDMA WRITE
looks up its STag:
BUG: KASAN: slab-use-after-free in siw_mem_id2obj+0xe5/0x310
Read of size 4 at addr ff110001042aed88 by task repro-rcu2/90
Call Trace:
<IRQ>
siw_mem_id2obj+0xe5/0x310
siw_proc_write+0x282/0x430
siw_tcp_rx_data+0x12e/0xbf0
__tcp_read_sock+0x12c/0x440
siw_qp_llp_data_ready+0x147/0x260
Allocated by task 89:
siw_mr_add_mem+0xb2/0x2a0
siw_reg_user_mr+0x19f/0x380
ib_uverbs_reg_mr+0x2a7/0x4c0
Freed by task 89:
kfree+0x301/0x530
siw_dereg_mr+0x31/0x50
ib_dereg_mr_user+0xb9/0x200
Free siw_mem with kfree_rcu(). A lookup that loses the race then sees
a zero refcount and fails. The umem or PBL is still released at the
last put, since a failed lookup never touches it.
Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
Cc: stable@vger.kernel.org
Signed-off-by: Deep Shah <deepshah146@gmail.com>
Link: https://patch.msgid.link/20261102064437.23976-1-deepshah146@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/sw/siw/siw.h | 1 +
drivers/infiniband/sw/siw/siw_mem.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/infiniband/sw/siw/siw.h
+++ b/drivers/infiniband/sw/siw/siw.h
@@ -160,6 +160,7 @@ struct siw_mem {
void *mem_obj;
};
struct ib_pd *pd;
+ struct rcu_head rcu;
};
struct siw_mr {
--- a/drivers/infiniband/sw/siw/siw_mem.c
+++ b/drivers/infiniband/sw/siw/siw_mem.c
@@ -149,7 +149,7 @@ void siw_free_mem(struct kref *ref)
else
kfree(mem->pbl);
}
- kfree(mem);
+ kfree_rcu(mem, rcu);
}
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0972/1059] RDMA/srpt: bound the indirect descriptor table to the IU
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (970 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0971/1059] RDMA/siw: Fix use-after-free in siw_mem_id2obj() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0973/1059] RDMA/srpt: reject zero-length buffer descriptors Greg Kroah-Hartman
` (26 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yehyeong Lee, Bart Van Assche,
Leon Romanovsky
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 82d46dedf750addfad5480f79165cacb81c89650 upstream.
srpt_get_desc_tbl() takes the number of INDIRECT descriptors from
idb->table_desc.len, which the initiator controls, and checks it only
against data_out_desc_cnt + data_in_desc_cnt, two more initiator fields.
Both are u8, so the pair admits up to 510 descriptors, and nothing
compares the table against the receive IU it has to live in.
srpt_alloc_rw_ctxs() then walks idb->desc_list for that many entries.
With the default srp_max_req_size of 8276 the table fits as long as the
additional CDB is short, but ADDITIONAL CDB LENGTH is an initiator field
too, and at its maximum of 252 bytes 510 descriptors end at
48 + 252 + 20 + 510 * 16 = 8480, which is past the end of the object.
BUG: KASAN: slab-out-of-bounds in srpt_alloc_rw_ctxs+0x631/0x870
Read of size 4 at addr ffff888002d6a05c by task kunit_try_catch/43
CPU: 0 UID: 0 PID: 43 Comm: kunit_try_catch Tainted: G N 7.3.0-12378-g6fba331225f5-dirty #1 PREEMPT(lazy)
Tainted: [N]=TEST
Call Trace:
<TASK>
dump_stack_lvl+0x3f/0x50
print_report+0xcd/0x620
? alloc_pages_node_noprof+0xa2/0x140
? srpt_alloc_rw_ctxs+0x631/0x870
kasan_report+0xde/0x110
? srpt_alloc_rw_ctxs+0x631/0x870
srpt_alloc_rw_ctxs+0x631/0x870
srpt_test_parse+0x114/0x580
? __pfx_srpt_test_ctx_common.constprop.0+0x10/0x10
? __pfx_srpt_test_parse+0x10/0x10
? srpt_test_ctx_init.constprop.0+0x4cb/0x6c0
srpt_test_run.constprop.0+0xc1/0xa60
? pick_task_fair+0x126/0x1950
? __pfx_srpt_test_run.constprop.0+0x10/0x10
? update_curr.constprop.0+0x4a/0x390
? __set_cpus_allowed_ptr+0x181/0x240
? __pfx_read_tsc+0x10/0x10
? ktime_get_ts64+0x192/0x250
kunit_try_run_case+0x1ca/0x4b0
? __pfx_kunit_try_run_case+0x10/0x10
? kthread_affine_node+0x24b/0x370
? __pfx_kthread_affine_node+0x10/0x10
? __pfx_kunit_try_run_case+0x10/0x10
? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
kunit_generic_run_threadfn_adapter+0x7b/0xe0
kthread+0x36e/0x500
? __pfx_kthread+0x10/0x10
ret_from_fork+0x34d/0x620
? __pfx_ret_from_fork+0x10/0x10
? __switch_to+0x22/0xdd0
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x19/0x30
</TASK>
Allocated by task 43:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_slab_alloc+0x6e/0x70
kmem_cache_alloc_noprof+0xfc/0x2b0
srpt_test_ctx_common.constprop.0+0x46f/0x9b0
srpt_test_ctx_init.constprop.0+0x30/0x6c0
srpt_test_run.constprop.0+0xb6/0xa60
kunit_try_run_case+0x1ca/0x4b0
kunit_generic_run_threadfn_adapter+0x7b/0xe0
kthread+0x36e/0x500
ret_from_fork+0x34d/0x620
ret_from_fork_asm+0x19/0x30
The buggy address belongs to the object at ffff888002d68000
which belongs to the cache srpt-kunit-iu of size 8276
The buggy address is located 8 bytes to the right of
allocated 8276-byte region [ffff888002d68000, ffff888002d6a054)
The KUnit harness that forces this is not part of this patch.
A table_desc.len below one descriptor is the other way in. It gives nbufs
zero, which the count check admits and a span check cannot catch either,
since an empty table fits in any IU. srpt_alloc_rw_ctxs() then returns
success with n_rw_ctx zero, no scatterlist is chained, and
srpt_write_pending() reaches ib_post_send() with an empty work request
list. rvt_post_send() evaluates !wr->next before the loop that tests wr
against NULL, so an rdmavt device faults there whenever its send queue is
idle.
Reject a table that does not fit by comparing the span it occupies
against byte_len, and reject an empty one. The span is the table offset
plus struct_size(idb, desc_list, nbufs), and nbufs is at most 510 once
the existing count check has passed, so it cannot saturate.
The header always lies inside the allocated buffer, since the largest
offset srpt_get_desc_buf() can return is 48 + 252 and the header is 20
bytes, so it ends at 320 while srp_max_req_size is at least
MIN_MAX_REQ_SIZE, which is 996. It does not always lie inside the bytes
the initiator actually sent, which is why the span starts at the table
offset and covers the header as well.
Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
Cc: stable@vger.kernel.org
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Link: https://patch.msgid.link/20261025013748.3755639-2-yhlee@isslab.korea.ac.kr
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1118,6 +1118,7 @@ static int srpt_get_desc_tbl(struct srpt
struct srp_indirect_buf *idb = srpt_get_desc_buf(srp_cmd);
int nbufs = be32_to_cpu(idb->table_desc.len) /
sizeof(struct srp_direct_buf);
+ size_t desc_off = (uintptr_t)idb - (uintptr_t)srp_cmd;
if (nbufs >
(srp_cmd->data_out_desc_cnt + srp_cmd->data_in_desc_cnt)) {
@@ -1129,6 +1130,18 @@ static int srpt_get_desc_tbl(struct srpt
return -EINVAL;
}
+ if (nbufs == 0) {
+ pr_err("received SRP_CMD with an empty indirect descriptor table\n");
+ return -EINVAL;
+ }
+
+ if (desc_off + struct_size(idb, desc_list, nbufs) >
+ recv_ioctx->byte_len) {
+ pr_err("received SRP_CMD indirect table (%d descriptors) that does not fit the %d-byte IU\n",
+ nbufs, recv_ioctx->byte_len);
+ return -EINVAL;
+ }
+
*data_len = be32_to_cpu(idb->len);
return srpt_alloc_rw_ctxs(ioctx, idb->desc_list, nbufs,
sg, sg_cnt);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0973/1059] RDMA/srpt: reject zero-length buffer descriptors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (971 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0972/1059] RDMA/srpt: bound the indirect descriptor table to the IU Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0974/1059] RDMA/srpt: widen the indirect RDMA context counters Greg Kroah-Hartman
` (25 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yehyeong Lee, Bart Van Assche,
Leon Romanovsky
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 252fc17ff4fbc2c6ead5e2f9404c9d0c490f0965 upstream.
srpt_alloc_rw_ctxs() takes each buffer descriptor length straight from the
wire and hands it to target_alloc_sgl(), which has no length check of its
own.
For the single descriptor of a DIRECT request, and for the last descriptor
of an INDIRECT table, chainable is false, so a zero length makes
sgl_alloc_order() compute nalloc zero. kmalloc_objs() answers that with
ZERO_SIZE_PTR, which is not NULL, so the allocation looks like it
succeeded and sg_init_table(sgl, 0) runs. That reaches sg_init_marker(),
which does sg_mark_end(&sgl[nents - 1]) with nents unsigned, so the index
is 4294967295 rather than minus one and the read modify write of page_link
lands far outside any allocation.
Oops: general protection fault, probably for non-canonical address 0xdffffc03fffffffe: 0000 [#1] KASAN PTI
KASAN: probably user-memory-access in range [0x0000001ffffffff0-0x0000001ffffffff7]
CPU: 0 UID: 0 PID: 43 Comm: kunit_try_catch Tainted: G N 7.3.0-12378-g6fba331225f5-dirty #1 PREEMPT(lazy)
Tainted: [N]=TEST
RIP: 0010:sgl_alloc_order+0xb6/0x370
Code: ef 01 4c 89 e2 49 89 c4 31 f6 49 c1 e7 05 48 89 c7 e8 ae e0 cb ff 4d 01 e7 48 b8 00 00 00 00 00 fc ff df 4c 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 6b 02 00 00 49 bc 00 00 00 00 00 fc ff df 49 8b
RSP: 0000:ffff888002d4fa38 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000001000 RCX: 0000000000000000
RDX: 00000003fffffffe RSI: 0000000000000000 RDI: 0000000000000010
RBP: 0000000000000000 R08: ffff888002b158a0 R09: 0000000000000000
R10: 0000000000000010 R11: 0000000000000037 R12: 0000000000000010
R13: ffff888002d6803c R14: 0000000000000000 R15: 0000001ffffffff0
FS: 0000000000000000(0000) GS:0000000000000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88802f1c8000 CR3: 000000002e458000 CR4: 00000000000006f0
Call Trace:
<TASK>
target_alloc_sgl+0x2b/0x70
srpt_alloc_rw_ctxs+0x2ef/0x870
srpt_test_parse+0x114/0x580
? __pfx_srpt_test_parse+0x10/0x10
? srpt_test_ctx_init_direct+0x17d/0x280
srpt_direct_len0_test+0xa4/0x280
? __pfx_srpt_direct_len0_test+0x10/0x10
? __set_cpus_allowed_ptr+0x181/0x240
? __pfx_read_tsc+0x10/0x10
? ktime_get_ts64+0x192/0x250
kunit_try_run_case+0x1ca/0x4b0
? __pfx_kunit_try_run_case+0x10/0x10
? kthread_affine_node+0x24b/0x370
? __pfx_kthread_affine_node+0x10/0x10
? __pfx_kunit_try_run_case+0x10/0x10
? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
kunit_generic_run_threadfn_adapter+0x7b/0xe0
kthread+0x36e/0x500
? __pfx_kthread+0x10/0x10
ret_from_fork+0x34d/0x620
? __pfx_ret_from_fork+0x10/0x10
? __switch_to+0x22/0xdd0
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x19/0x30
</TASK>
The KUnit harness that forces this is not part of this patch.
A zero length descriptor elsewhere in a table is chainable, so one entry
is allocated and that write does not happen, but the entry count comes
back zero and the mapping in rdma_rw_ctx_init() then refuses it.
The target core never hands the same allocator a zero length. Its own call
in transport_generic_new_cmd() sits behind a cmd->data_length test.
Reject a descriptor whose length is zero. The existing unwind label covers
the first iteration, where its loop body does not run because nothing has
been allocated yet.
Fixes: b99f8e4d7bcd ("IB/srpt: convert to the generic RDMA READ/WRITE API")
Cc: stable@vger.kernel.org
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Link: https://patch.msgid.link/20261025013748.3755639-3-yhlee@isslab.korea.ac.kr
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -980,6 +980,12 @@ static int srpt_alloc_rw_ctxs(struct srp
u32 size = be32_to_cpu(db->len);
u32 rkey = be32_to_cpu(db->key);
+ if (size == 0) {
+ pr_err("received SRP_CMD buffer descriptor with zero length\n");
+ ret = -EINVAL;
+ goto unwind;
+ }
+
ret = target_alloc_sgl(&ctx->sg, &ctx->nents, size, false,
i < nbufs - 1);
if (ret)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0974/1059] RDMA/srpt: widen the indirect RDMA context counters
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (972 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0973/1059] RDMA/srpt: reject zero-length buffer descriptors Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0975/1059] powerpc/eeh: NUL-terminate force recovery input Greg Kroah-Hartman
` (24 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bart Van Assche, Yehyeong Lee,
Leon Romanovsky
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 013eb66a8ef25ef531bf41d79815948ab4938571 upstream.
srpt_send_ioctx::n_rdma and ::n_rw_ctx are u8, and neither of the values
stored in them is bounded by 255.
n_rw_ctx counts the INDIRECT descriptors a command carries, and the count
guard in srpt_get_desc_tbl() admits data_out_desc_cnt plus
data_in_desc_cnt, so up to 510. At 256 descriptors n_rw_ctx wraps to
zero, and srpt_release_cmd() frees the contexts only when it is non-zero,
so every scatterlist and RDMA context the command allocated leaks.
n_rdma is not a descriptor count at all. It is the sum of the
rdma_rw_ctx_init() return values, which is the number of work requests
each context needs, accumulated by ioctx->n_rdma += ret. A handful of
descriptors for large transfers can pass 255 on their own, with no
unusual descriptor count involved. A wrapped n_rdma is then handed to
atomic_sub_return(ioctx->n_rdma, &ch->sq_wr_avail) and tested by
WARN_ON(ioctx->n_rdma <= 0), so the send queue work request accounting
drifts too.
Make both counters int, the type the values they accumulate already have.
Fixes: b99f8e4d7bcd ("IB/srpt: convert to the generic RDMA READ/WRITE API")
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Link: https://patch.msgid.link/20261025013748.3755639-4-yhlee@isslab.korea.ac.kr
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +-
drivers/infiniband/ulp/srpt/ib_srpt.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -959,7 +959,7 @@ static int srpt_alloc_rw_ctxs(struct srp
struct srpt_rdma_ch *ch = ioctx->ch;
struct scatterlist *prev = NULL;
unsigned prev_nents;
- u8 n_rdma, n_rw_ctx;
+ int n_rdma, n_rw_ctx;
int ret, i;
if (nbufs == 1) {
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -223,8 +223,8 @@ struct srpt_send_ioctx {
struct ib_cqe rdma_cqe;
enum srpt_command_state state;
struct se_cmd cmd;
- u8 n_rdma;
- u8 n_rw_ctx;
+ int n_rdma;
+ int n_rw_ctx;
bool queue_status_only;
u8 sense_data[TRANSPORT_SENSE_BUFFER];
};
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0975/1059] powerpc/eeh: NUL-terminate force recovery input
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (973 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0974/1059] RDMA/srpt: widen the indirect RDMA context counters Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0976/1059] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Greg Kroah-Hartman
` (23 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiale Yao, Ritesh Harjani (IBM),
Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
commit f294ebd827e7a2b831b1eef4aaf437f07b2c235e upstream.
eeh_force_recover_write() can fill its entire stack buffer from userspace
and then pass the unterminated data to strncmp() and sscanf(). This can
make the string helpers read beyond the buffer.
Reserve the last byte and initialize the buffer so every accepted input is
NUL-terminated. Propagate copy errors before parsing as well.
Fixes: 954bd99435b8 ("powerpc/eeh: Add eeh_force_recover to debugfs")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261029052948.2525048-1-yaojiale02@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/eeh.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1647,10 +1647,12 @@ static ssize_t eeh_force_recover_write(s
struct pci_controller *hose;
uint32_t phbid, pe_no;
struct eeh_pe *pe;
- char buf[20];
+ char buf[20] = {};
int ret;
- ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
+ if (ret < 0)
+ return ret;
if (!ret)
return -EFAULT;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0976/1059] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (974 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0975/1059] powerpc/eeh: NUL-terminate force recovery input Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0977/1059] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Greg Kroah-Hartman
` (22 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nathan Chancellor,
Ritesh Harjani (IBM), Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <nathan@kernel.org>
commit 9ea01307e6c824eb0b8934d95d52bbacae17887d upstream.
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in show_task(), which can
break the build with CONFIG_PPC_WERROR=y / CONFIG_WERROR=y / W=e:
arch/powerpc/xmon/xmon.c:3262:3: error: unsequenced accesses to volatile qualified 'tsk' [-Werror,-Wunsequenced]
3261 | printf("%16px %16lx %16px %6d %6d %c %2d %s\n", tsk,
| ~~~
3262 | tsk->thread.ksp, tsk->thread.regs,
| ^
Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.
tsk was made volatile in commit a2305e3de819 ("powerpc: mark local
variables around longjmp as volatile") to ensure its value in
show_tasks() was properly restored after returning from a potential
longjmp(). Aside from that, the value is not being modified through
other means, so rename the volatile parameter and add a local variable
named tsk to hold its value throughout show_task(), clearing up the
warning.
Cc: stable@vger.kernel.org
Fixes: a2305e3de819 ("powerpc: mark local variables around longjmp as volatile")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2199
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20261115-xmon-wunsequenced-v1-1-42ae3fe45bf4@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/xmon/xmon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3261,8 +3261,9 @@ memzcan(void)
printf("%.8lx\n", a - mskip);
}
-static void show_task(struct task_struct *volatile tsk)
+static void show_task(struct task_struct *volatile vol_tsk)
{
+ struct task_struct *tsk = vol_tsk;
unsigned int p_state = READ_ONCE(tsk->__state);
char state;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0977/1059] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (975 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0976/1059] powerpc/xmon: Avoid unsequenced accesses to tsk in show_task() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0978/1059] s390/appldata: Fix error handling in appldata_generic_handler() Greg Kroah-Hartman
` (21 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bradley Morgan,
Christophe Leroy (CS GROUP), Madhavan Srinivasan
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bradley Morgan <brads@mainlining.org>
commit dc6eb6f08be536223e8289c7a8b1f515b1355721 upstream.
Commit 7dfbfb87c243 ("powerpc/ftrace: Activate
HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32") made count_relocs()
undercount the PLT entries the loader
consumes: module_finalize_ftrace() now creates two trampolines
(mod->arch.tramp for ftrace_caller() and mod->arch.tramp_regs for
ftrace_regs_caller()), while count_relocs() reserves only one entry
for ftrace.
So the core .plt ends up one ppc_plt_entry (16 bytes) short. The
walk in do_plt_call() scans for a free slot with
"while (entry->jump[0])" and has no bound check, so once the last
reserved slot is used up, the walk steps past the end of the section
and patch_instruction() writes the 4-instruction trampoline into
whatever module memory follows the .plt.
Count the second entry, mirroring what module_64.c does for the same
pair of stubs.
Signed-off-by: Bradley Morgan <brads@mainlining.org>
Fixes: 7dfbfb87c243 ("powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32")
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260923175631.235276-1-brads@mainlining.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/module_32.c | 3 +++
1 file changed, 3 insertions(+)
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -41,6 +41,9 @@ static unsigned int count_relocs(const E
#ifdef CONFIG_DYNAMIC_FTRACE
_count_relocs++; /* add one for ftrace_caller */
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
+ _count_relocs++; /* add one for ftrace_regs_caller */
+#endif
#endif
return _count_relocs;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0978/1059] s390/appldata: Fix error handling in appldata_generic_handler()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (976 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0977/1059] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0979/1059] s390/dcssblk: Initialize device semaphore before sysfs registration Greg Kroah-Hartman
` (20 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gerald Schaefer, Heiko Carstens,
Alexander Gordeev
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
commit 0f01f3156f260a5fbce3b4017e1f1ff93cb29465 upstream.
appldata_generic_handler() always returns 0 after starting or stopping
monitor recording.
So "echo {0,1} > /proc/sys/appldata/{os,mem,net_sum}" returns success even
when DIAG 0xDC failed. A failed start would keep ops->active as 0, so
reading the sysctl later would correctly reflect this.
A failed stop would falsely set ops->active to 0 and decrement module
refcount. This would allow the data gathering module to be removed, and
the data buffer to be freed, while z/VM monitor service is still collecting
data from that buffer.
Fix this by returning -EIO when appldata_diag() failed, and only set
ops->active to 0 and decrement module refcount when it succeeded on stop
path.
Cc: stable@vger.kernel.org
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/s390/appldata/appldata_base.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -330,21 +330,25 @@ appldata_generic_handler(struct ctl_tabl
pr_err("Starting the data collection for %s "
"failed with rc=%d\n", ops->name, rc);
module_put(ops->owner);
+ rc = -EIO;
} else
ops->active = 1;
} else if (!active && (ops->active == 1)) {
- ops->active = 0;
rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC,
(unsigned long) ops->data, ops->size,
ops->mod_lvl);
- if (rc != 0)
+ if (rc != 0) {
pr_err("Stopping the data collection for %s "
"failed with rc=%d\n", ops->name, rc);
- module_put(ops->owner);
+ rc = -EIO;
+ } else {
+ ops->active = 0;
+ module_put(ops->owner);
+ }
}
mutex_unlock(&appldata_ops_mutex);
module_put(ops->owner);
- return 0;
+ return rc;
}
/*************************** /proc stuff <END> *******************************/
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0979/1059] s390/dcssblk: Initialize device semaphore before sysfs registration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (977 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0978/1059] s390/appldata: Fix error handling in appldata_generic_handler() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0980/1059] scsi: mpi3mr: Validate reply frame size bounds Greg Kroah-Hartman
` (19 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Jiale Yao,
Heiko Carstens
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
commit 64ee7f863655e67f26947420516daba4e232675d upstream.
device_create_file() makes the add and remove attributes writable before
the device list semaphore is initialized. A sysfs write racing module
initialization can therefore acquire an uninitialized rwsem.
Initialize the semaphore before registering the root device and its
attributes.
[hca@linux.ibm.com: Use DECLARE_RWSEM() instead of moving init_rwsem()]
Cc: stable@vger.kernel.org
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/s390/block/dcssblk.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -100,7 +100,7 @@ static DEVICE_ATTR(remove, S_IWUSR, NULL
static struct device *dcssblk_root_dev;
static LIST_HEAD(dcssblk_devices);
-static struct rw_semaphore dcssblk_devices_sem;
+static DECLARE_RWSEM(dcssblk_devices_sem);
/*
* release function for segment device.
@@ -1012,7 +1012,6 @@ dcssblk_init(void)
if (rc < 0)
goto out_root;
dcssblk_major = rc;
- init_rwsem(&dcssblk_devices_sem);
dcssblk_check_params();
return 0;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0980/1059] scsi: mpi3mr: Validate reply frame size bounds
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (978 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0979/1059] s390/dcssblk: Initialize device semaphore before sysfs registration Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0981/1059] scsi: rdac: Keep the error status when controller lookup fails Greg Kroah-Hartman
` (18 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Milan P. Gandhi,
Martin K. Petersen (Oracle)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milan P. Gandhi <mgandhi@redhat.com>
commit e550f2b2b4aab4c5f12db89d04d8978ce4ed7b4e upstream.
Firmware provides reply_frame_size in dwords, which the driver multiplies
by 4 to compute facts.reply_sz (u16). If the reported size exceeds U16_MAX
/ 4, the multiplication overflows u16 before assignment, causing
under-allocated DMA reply buffers.
Furthermore, several paths assume a minimal reply frame size:
- logdata_entry_sz calculations underflow or hit zero when reply_sz <= 20
bytes, leading to zero-size allocations and divide-by-zero crashes.
- Unsolicited status descriptors and fixed replies (such as struct
mpi3_iounit_control_reply, 64 bytes) require at least 16 dwords.
Validate reply_frame_size in mpi3mr_issue_iocfacts() to ensure it is within
[16, U16_MAX / 4] dwords before processing facts data.
Fixes: 824a156633df ("scsi: mpi3mr: Base driver code")
Cc: stable@vger.kernel.org
Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Link: https://patch.msgid.link/20261105122401.266559-1-mgandhi@redhat.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/mpi3mr/mpi3mr.h | 1 +
drivers/scsi/mpi3mr/mpi3mr_fw.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -82,6 +82,7 @@ extern atomic64_t event_counter;
#define MPI3MR_ADMIN_REPLY_Q_SIZE (4 * MPI3MR_PAGE_SIZE_4K)
#define MPI3MR_ADMIN_REQ_FRAME_SZ 128
#define MPI3MR_ADMIN_REPLY_FRAME_SZ 16
+#define MPI3MR_MIN_REPLY_FRAME_SZ_DWORDS 16 /* 64 bytes */
/* Operational queue management definitions */
#define MPI3MR_OP_REQ_Q_QD 512
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -2730,6 +2730,7 @@ static int mpi3mr_issue_iocfacts(struct
struct mpi3_ioc_facts_data *facts_data)
{
struct mpi3_ioc_facts_request iocfacts_req;
+ u16 reply_frame_size;
void *data = NULL;
dma_addr_t data_dma;
u32 data_len = sizeof(*facts_data);
@@ -2787,6 +2788,23 @@ static int mpi3mr_issue_iocfacts(struct
goto out_unlock;
}
memcpy(facts_data, (u8 *)data, data_len);
+
+ reply_frame_size = le16_to_cpu(facts_data->reply_frame_size);
+ /*
+ * Validate reply_frame_size:
+ * - Must be at least 16 dwords (64 bytes) to accommodate fixed reply
+ * structures and avoid underflow/divide-by-zero in logdata sizing.
+ * - Must not exceed U16_MAX / 4 to prevent integer overflow.
+ */
+ if (reply_frame_size < MPI3MR_MIN_REPLY_FRAME_SZ_DWORDS ||
+ reply_frame_size > (U16_MAX / 4)) {
+ ioc_err(mrioc, "Invalid reply_frame_size %u (must be %u..%u dwords)\n",
+ reply_frame_size, MPI3MR_MIN_REPLY_FRAME_SZ_DWORDS,
+ (unsigned int)(U16_MAX / 4));
+ retval = -EINVAL;
+ goto out_unlock;
+ }
+
mpi3mr_process_factsdata(mrioc, facts_data);
out_unlock:
mrioc->init_cmds.state = MPI3MR_CMD_NOTUSED;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0981/1059] scsi: rdac: Keep the error status when controller lookup fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (979 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0980/1059] scsi: mpi3mr: Validate reply frame size bounds Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0982/1059] scsi: sd_zbc: Cap zone report count by buffer size Greg Kroah-Hartman
` (17 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shao Mingyin,
Martin K. Petersen (Oracle)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shao Mingyin <shao.mingyin@zte.com.cn>
commit 46846939d5f33c9333612662c52475f92e753407 upstream.
initialize_controller() records SCSI_DH_RES_TEMP_UNAVAIL when
get_controller() fails, but then overwrites it with SCSI_DH_OK
unconditionally. It therefore reports success with h->ctlr == NULL and
rdac_bus_attach() continues with check_ownership(), which dereferences
h->ctlr:
BUG: kernel NULL pointer dereference, address: 0000000000000000
...
check_ownership
rdac_bus_attach
get_controller() only fails when its GFP_ATOMIC allocation fails, so the
crash happens exactly when memory is already scarce.
Only report success after the controller was found and the device was added
to its list.
Fixes: 327825574132 ("scsi_dh_rdac: switch to scsi_execute_req_flags()")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261026195409354OWEI2b6HO7swSphvv1FOc@zte.com.cn
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/device_handler/scsi_dh_rdac.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -450,14 +450,14 @@ static int initialize_controller(struct
spin_lock(&list_lock);
h->ctlr = get_controller(index, array_name, array_id, sdev);
- if (!h->ctlr)
+ if (!h->ctlr) {
err = SCSI_DH_RES_TEMP_UNAVAIL;
- else {
+ } else {
h->sdev = sdev;
list_add_rcu(&h->node, &h->ctlr->dh_list);
+ err = SCSI_DH_OK;
}
spin_unlock(&list_lock);
- err = SCSI_DH_OK;
}
return err;
}
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0982/1059] scsi: sd_zbc: Cap zone report count by buffer size
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (980 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0981/1059] scsi: rdac: Keep the error status when controller lookup fails Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0983/1059] parisc: Fix register corruption in 32-bit dynamic ftrace Greg Kroah-Hartman
` (16 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, co+4a4f9998e2b4b490, Boyan Liu,
Martin K. Petersen (Oracle)
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boyan Liu <yymhvert@gmail.com>
commit 612293fb469c81408829e6325bae25725968986f upstream.
sd_zbc_report_zones() limits descriptor parsing to the requested zone
count and the device-reported ZONE LIST LENGTH, but not to the number of
descriptors that fit in the allocated report buffer. A malicious or
malfunctioning device can report an oversized length and cause
out-of-bounds reads while the descriptors are parsed:
BUG: KASAN: slab-out-of-bounds in sd_zbc_report_zones (drivers/scsi/sd_zbc.c:256)
Read of size 8 at addr ffff88802c8d2610 by task kworker/u8:2/37
Call Trace:
sd_zbc_report_zones (drivers/scsi/sd_zbc.c:256)
blk_revalidate_disk_zones (block/blk-zoned.c:2354)
sd_zbc_revalidate_zones (drivers/scsi/sd_zbc.c:566)
sd_revalidate_disk (drivers/scsi/sd.c:3898)
sd_probe (drivers/scsi/sd.c:4101)
Cap the descriptor count with min3() over the remaining requested zones,
the device-reported count, and max_in_buf derived from buflen. This
matches nvme_ns_report_zones() and preserves iteration over reports that
require multiple commands. Use shared constants for the REPORT ZONES
header and zone descriptor sizes.
[mkp: define constants]
Fixes: d41003513e61 ("block: rework zone reporting")
Cc: stable@vger.kernel.org
Reported-by: co+4a4f9998e2b4b490@bugs.sh
Signed-off-by: Boyan Liu <yymhvert@gmail.com>
Link: https://patch.msgid.link/20261028061651.110435-1-yymhvert@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/scsi/sd_zbc.c | 9 +++++++--
include/scsi/scsi_proto.h | 3 +++
2 files changed, 10 insertions(+), 2 deletions(-)
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -256,7 +256,7 @@ int sd_zbc_report_zones(struct gendisk *
{
struct scsi_disk *sdkp = scsi_disk(disk);
sector_t lba = sectors_to_logical(sdkp->device, sector);
- unsigned int nr, i;
+ unsigned int nr, i, max_in_buf;
unsigned char *buf;
u64 zone_length, start_lba;
size_t offset, buflen = 0;
@@ -275,13 +275,18 @@ int sd_zbc_report_zones(struct gendisk *
if (!buf)
return -ENOMEM;
+ max_in_buf = (buflen - ZBC_REPORT_ZONES_HEADER_SIZE) /
+ ZBC_ZONE_DESCRIPTOR_SIZE;
+
while (zone_idx < nr_zones && lba < sdkp->capacity) {
ret = sd_zbc_do_report_zones(sdkp, buf, buflen, lba, true);
if (ret)
goto out;
offset = 0;
- nr = min(nr_zones, get_unaligned_be32(&buf[0]) / 64);
+ nr = min3(nr_zones - zone_idx,
+ get_unaligned_be32(&buf[0]) / ZBC_ZONE_DESCRIPTOR_SIZE,
+ max_in_buf);
if (!nr)
break;
--- a/include/scsi/scsi_proto.h
+++ b/include/scsi/scsi_proto.h
@@ -302,6 +302,9 @@ enum zbc_zone_reporting_options {
#define ZBC_REPORT_ZONE_PARTIAL 0x80
+#define ZBC_REPORT_ZONES_HEADER_SIZE 64
+#define ZBC_ZONE_DESCRIPTOR_SIZE 64
+
/* Zone types of REPORT ZONES zone descriptors */
enum zbc_zone_type {
ZBC_ZONE_TYPE_CONV = 0x1,
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0983/1059] parisc: Fix register corruption in 32-bit dynamic ftrace
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (981 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0982/1059] scsi: sd_zbc: Cap zone report count by buffer size Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0984/1059] parisc: irq: Trace hardirq state in do_cpu_irq_mask() Greg Kroah-Hartman
` (15 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
commit e9c14351f84f2ddf4aae2914979c0378bc14460a upstream.
The 32-bit dynamic ftrace trampoline allocates a 64-byte frame.
ftrace_caller() saves %r26 at offset 20, which overlaps the third
argument's spill slot for ftrace_function_trampoline().
In the failing build, GCC spills org_sp_gr3 into that slot, overwriting
saved %r26 with the original stack pointer. Tracing preempt_count_add()
then passes that pointer as val and corrupts the preempt count.
Allocate two frames on 32-bit, as 64-bit already does, and update the
generated trampoline instruction to match.
Fixes: 6ca6366220ed ("parisc: add dynamic ftrace")
Cc: stable@vger.kernel.org
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/parisc/kernel/entry.S | 4 ----
arch/parisc/kernel/ftrace.c | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -1927,11 +1927,7 @@ ENDPROC_CFI(mcount)
#ifdef CONFIG_DYNAMIC_FTRACE
-#ifdef CONFIG_64BIT
#define FTRACE_FRAME_SIZE (2*FRAME_SIZE)
-#else
-#define FTRACE_FRAME_SIZE FRAME_SIZE
-#endif
ENTRY_CFI(ftrace_caller, caller,frame=FTRACE_FRAME_SIZE,CALLS,SAVE_RP,SAVE_SP)
ftrace_caller:
.global ftrace_caller
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -146,7 +146,7 @@ int ftrace_make_call(struct dyn_ftrace *
#else
u32 ftrace_trampoline[] = {
(u32)addr,
- 0x6fc10080, /* stw,ma r1,40(sp) */
+ 0x6fc10100, /* stw,ma r1,80(sp) */
0x48213fd1, /* ldw -18(r1),r1 */
0xe820c002, /* bv,n r0(r1) */
0xe83f1fdf, /* b,l,n .-c,r1 */
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0984/1059] parisc: irq: Trace hardirq state in do_cpu_irq_mask()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (982 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0983/1059] parisc: Fix register corruption in 32-bit dynamic ftrace Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0985/1059] ocfs2/dlmfs: keep the superblock alive during lock work Greg Kroah-Hartman
` (14 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
commit a739c9192173c0437ed3c76f87f5a39532ef9fe1 upstream.
intr_extint calls do_cpu_irq_mask() with PSW[I] already clear. Since
commit 044d0d6de9f5 ("lockdep: Only trace IRQ edges"), its
local_irq_disable() then skips trace_hardirqs_off(), and lockdep
assertions fail in the timer tick:
WARNING: kernel/rcu/tree.c:2739 at rcu_sched_clock_irq+0x618/0x1f84
The return to a context with PSW[I] set has not been annotated since
TRACE_IRQFLAGS_SUPPORT was enabled. Annotate both transitions.
Fixes: 366dd4ea9d5f ("parisc: Fix ftrace function tracer")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Cc: stable@vger.kernel.org # v5.9+
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/parisc/kernel/irq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -500,7 +500,7 @@ void do_cpu_irq_mask(struct pt_regs *reg
#endif
old_regs = set_irq_regs(regs);
- local_irq_disable();
+ trace_hardirqs_off();
irq_enter_rcu();
eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
@@ -538,6 +538,8 @@ void do_cpu_irq_mask(struct pt_regs *reg
out:
irq_exit_rcu();
set_irq_regs(old_regs);
+ if (!irqs_disabled_flags(regs->gr[0]))
+ trace_hardirqs_on();
return;
set_out:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0985/1059] ocfs2/dlmfs: keep the superblock alive during lock work
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (983 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0984/1059] parisc: irq: Trace hardirq state in do_cpu_irq_mask() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0986/1059] ocfs2: advance locking_state through the live cursor Greg Kroah-Hartman
` (13 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Andrew Morton, Joseph Qi,
Mark Fasheh, Joel Becker, Heming Zhao, Jia-Ju Bai, jjzuming
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
commit e9e66aa5ef1a76ec92fe41c5eb16fda7a39db279 upstream.
Queued dlmfs lock work holds an inode reference, but no active reference
to its superblock. The workqueue is drained on module exit rather than on
each dlmfs unmount, and an inode reference does not stop superblock
shutdown: generic_shutdown_super() reports the busy inode and goes on.
DLM callback / worker Unmount
--------------------- -------
queue lock work; igrab(inode)
worker delayed
drop last active superblock ref
kill_anon_super()
report the busy inode
free the superblock
finish lock work
iput(inode)
access the inode's freed superblock
Flushing the workqueue from a dlmfs kill_sb would not be enough: a
blocking AST can queue new work for an inode that is still alive after the
flush and before eviction, and that work again holds only an inode
reference.
Take an active superblock reference before acquiring the queued inode
reference, with the atomic_inc_not_zero() on s_active that grab_super()
and the NFS and procfs superblock walkers use. Decline to queue if the
superblock is already shutting down; the inode is then being evicted and
user_dlm_destroy_lock() tears the lock down. The existing l_lock and
USER_LOCK_QUEUED flag serialize this with other queue attempts. Each
execution drops its inode reference before releasing the active superblock
reference, outside l_lock. If that releases the last active reference,
the unmount completes on the worker; it only waits for DLM replies and
never for this workqueue.
Only the relevant frames of the report are kept:
Oops: general protection fault, probably for non-canonical address 0xfbd59c0000000026: 0000 [#1] SMP KASAN NOPTI
KASAN: maybe wild-memory-access in range [0xdead000000000130-0xdead000000000137]
Workqueue: user_dlm user_dlm_unblock_lock
RIP: 0010:iput+0x246/0xc10
Call Trace:
<TASK>
user_dlm_unblock_lock+0x503/0xa50
process_one_work+0x9a8/0x1b40
worker_thread+0x65c/0xe40
</TASK>
Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0054-v6-c3887cceae3b039e591e@gmail.com
Fixes: 8df08c89c668 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <jjzuming@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/dlmfs/userdlm.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
fs/ocfs2/dlmfs/userdlm.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--- a/fs/ocfs2/dlmfs/userdlm.c
+++ b/fs/ocfs2/dlmfs/userdlm.c
@@ -162,7 +162,13 @@ static void user_dlm_unblock_lock(struct
static void __user_dlm_queue_lockres(struct user_lock_res *lockres)
{
+ struct inode *inode = user_dlm_inode_from_user_lockres(lockres);
+
if (!(lockres->l_flags & USER_LOCK_QUEUED)) {
+ /* Pin the superblock through the worker's iput(). */
+ if (!atomic_inc_not_zero(&inode->i_sb->s_active))
+ return;
+
user_dlm_grab_inode_ref(lockres);
INIT_WORK(&lockres->l_work, user_dlm_unblock_lock);
@@ -275,9 +281,11 @@ static struct ocfs2_locking_protocol use
static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres)
{
- struct inode *inode;
- inode = user_dlm_inode_from_user_lockres(lockres);
+ struct inode *inode = user_dlm_inode_from_user_lockres(lockres);
+ struct super_block *sb = inode->i_sb;
+
iput(inode);
+ deactivate_super(sb);
}
static void user_dlm_unblock_lock(struct work_struct *work)
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0986/1059] ocfs2: advance locking_state through the live cursor
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (984 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0985/1059] ocfs2/dlmfs: keep the superblock alive during lock work Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0987/1059] ocfs2: serialize inode journal access with shutdown Greg Kroah-Hartman
` (12 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Andrew Morton, Joseph Qi,
Mark Fasheh, Joel Becker, Heming Zhao, Jia-Ju Bai, jjzuming
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
commit fffc86cbe3ebfd7fea3937f8698e4322b3137984 upstream.
locking_state copies each lock resource under ocfs2_dlm_tracking_lock so
its containing inode or quota object can be freed during the dump. The
copied l_debug_list pointers do not have that lifetime protection. Yet
ocfs2_dlm_seq_next() follows them to find the next record.
Remounting read-only can free a quota-info object while a debugfs read is
between the snapshot and the next iterator callback:
locking_state reader Quota suspension
-------------------- ----------------
snapshot current lock resource
copy l_debug_list.next
remove next resource from live list
free quota-info object
seq_next(): follow copied link
read freed lock resource
Advance through the live dummy cursor instead. List removal updates its
links under the tracking lock. Position it after the resource being
copied before releasing the lock, and never walk the snapshot's links.
Reuse the per-open snapshot for a nonzero seq_start() position, including
read continuation and buffer retries. Rewind the live cursor only when
seq_file starts at index zero; seq_lseek() traverses from there through
seq_next(). Clear the snapshot's l_ops marker at end of list so later
reads remain at EOF. This avoids replaying the list prefix under the
tracking lock on each read, without adding a new cursor or position field.
KASAN report as below:
BUG: KASAN: slab-use-after-free in ocfs2_dlm_next_res.isra.0+0x1b1/0x1d0
Read of size 8 at addr ffff888117ea9838 by task python3/489
CPU: 3 UID: 0 PID: 489 Comm: python3 Not tainted 7.3.0-rc4-next-20260921-pmb-bt-functional-v1+ #1 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? ocfs2_dlm_next_res.isra.0+0x1b1/0x1d0
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20e/0x420
? ocfs2_dlm_next_res.isra.0+0x1b1/0x1d0
kasan_report+0xe0/0x110
? ocfs2_dlm_next_res.isra.0+0x1b1/0x1d0
ocfs2_dlm_next_res.isra.0+0x1b1/0x1d0
? __pfx_ocfs2_dlm_next_res.isra.0+0x10/0x10
? __pfx_do_raw_spin_lock+0x10/0x10
ocfs2_dlm_seq_next+0xb8/0x4c0
? srso_alias_return_thunk+0x5/0xfbef5
seq_read_iter+0x92f/0x1110
? srso_alias_return_thunk+0x5/0xfbef5
seq_read+0x362/0x5a0
? __pfx_seq_read+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? selinux_file_permission+0x11d/0x540
full_proxy_read+0x11f/0x180
? __pfx_full_proxy_read+0x10/0x10
vfs_read+0x1a0/0xc20
? srso_alias_return_thunk+0x5/0xfbef5
? kmem_cache_free+0x242/0x580
? __pfx_vfs_read+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? putname+0x93/0xe0
? srso_alias_return_thunk+0x5/0xfbef5
? do_sys_openat2+0x12a/0x1b0
? __pfx_do_sys_openat2+0x10/0x10
ksys_read+0x111/0x200
? __pfx_ksys_read+0x10/0x10
? irqentry_exit+0xbe/0x820
? srso_alias_return_thunk+0x5/0xfbef5
? trace_hardirqs_on_prepare+0x11d/0x150
do_syscall_64+0x114/0x620
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f0266dbb687
Code: 48 89 fa 4c 89 df e8 58 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007ffccf76fc40 EFLAGS: 00000202 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f0266d27780 RCX: 00007f0266dbb687
RDX: 0000000000000001 RSI: 00007f0266a53200 RDI: 0000000000000004
RBP: 00007f0266d27700 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
R13: 00007f0266a53200 R14: 0000000000000004 R15: 00007f0266b651e0
</TASK>
Allocated by task 547:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x28d/0x610
ocfs2_local_read_info+0x181/0x1580
dquot_load_quota_sb+0x68b/0x1000
dquot_load_quota_inode+0x227/0x3e0
ocfs2_enable_quotas+0x27c/0x520
ocfs2_fill_super+0x21f9/0x38f0
get_tree_bdev_flags+0x35d/0x5f0
vfs_get_tree+0x93/0x320
fc_mount+0x1d/0x200
path_mount+0x592/0x1e00
__x64_sys_mount+0x24b/0x2d0
do_syscall_64+0x114/0x620
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 577:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x308/0x580
ocfs2_local_free_info+0x47b/0x800
dquot_disable+0x5d9/0x17a0
ocfs2_susp_quotas.isra.0+0x22c/0x2b0
ocfs2_reconfigure+0x284/0xd00
reconfigure_super+0x3ca/0xa70
path_mount+0x16ae/0x1e00
__x64_sys_mount+0x24b/0x2d0
do_syscall_64+0x114/0x620
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888117ea9800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 56 bytes inside of
freed 1024-byte region [ffff888117ea9800, ffff888117ea9c00)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117ea8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x200000000000040(head|node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000040 ffff888100042dc0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 0200000000000040 ffff888100042dc0 dead000000000100 dead000000000122
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 0200000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888117ea9700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888117ea9780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888117ea9800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888117ea9880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888117ea9900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0053-v7-ec41d4bbd38bb4d795a8@gmail.com
Fixes: ccd979bdbce9 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <jjzuming@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/dlmglue.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
---
fs/ocfs2/dlmglue.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -3093,9 +3093,17 @@ static void *ocfs2_dlm_seq_start(struct
{
struct ocfs2_dlm_seq_priv *priv = m->private;
struct ocfs2_lock_res *iter;
+ struct ocfs2_lock_res *dummy = &priv->p_iter_res;
+
+ /* Continue or retry the snapshot left by ->next(). */
+ if (*pos)
+ return priv->p_tmp_res.l_ops ? &priv->p_tmp_res : NULL;
+ /* Reads from zero and seek traversal start at the list head. */
spin_lock(&ocfs2_dlm_tracking_lock);
- iter = ocfs2_dlm_next_res(&priv->p_iter_res, priv);
+ list_move(&dummy->l_debug_list,
+ &priv->p_dlm_debug->d_lockres_tracking);
+ iter = ocfs2_dlm_next_res(dummy, priv);
if (iter) {
/* Since lockres' have the lifetime of their container
* (which can be inodes, ocfs2_supers, etc) we want to
@@ -3104,8 +3112,11 @@ static void *ocfs2_dlm_seq_start(struct
* trust any pointers on the copy returned, but that's
* ok as the information we want isn't typically held
* in them. */
+ list_move(&dummy->l_debug_list, &iter->l_debug_list);
priv->p_tmp_res = *iter;
iter = &priv->p_tmp_res;
+ } else {
+ priv->p_tmp_res.l_ops = NULL;
}
spin_unlock(&ocfs2_dlm_tracking_lock);
@@ -3119,17 +3130,19 @@ static void ocfs2_dlm_seq_stop(struct se
static void *ocfs2_dlm_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
struct ocfs2_dlm_seq_priv *priv = m->private;
- struct ocfs2_lock_res *iter = v;
+ struct ocfs2_lock_res *iter;
struct ocfs2_lock_res *dummy = &priv->p_iter_res;
(*pos)++;
spin_lock(&ocfs2_dlm_tracking_lock);
- iter = ocfs2_dlm_next_res(iter, priv);
+ iter = ocfs2_dlm_next_res(dummy, priv);
list_del_init(&dummy->l_debug_list);
if (iter) {
list_add(&dummy->l_debug_list, &iter->l_debug_list);
priv->p_tmp_res = *iter;
iter = &priv->p_tmp_res;
+ } else {
+ priv->p_tmp_res.l_ops = NULL;
}
spin_unlock(&ocfs2_dlm_tracking_lock);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0987/1059] ocfs2: serialize inode journal access with shutdown
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (985 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0986/1059] ocfs2: advance locking_state through the live cursor Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0988/1059] sctp: do not free a new asoc peeled off while sendmsg slept Greg Kroah-Hartman
` (11 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Andrew Morton, Joseph Qi,
Mark Fasheh, Joel Becker, Heming Zhao, Jia-Ju Bai, jjzuming
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
commit f277230d002d03ed98b814b735f9d3d01b42020a upstream.
The downconvert thread can run inode cleanup until ocfs2_dlm_shutdown()
stops it, but unmount shuts down the journal earlier. A final dentry
post-unlock put can therefore enter ocfs2_clear_inode() while the journal
is being destroyed.
ocfs2_ci_fully_checkpointed() loads osb->journal before taking
trans_inc_lock. Journal shutdown neither takes that lock for removal
nor waits for the downconvert thread before freeing the journal:
Downconvert thread Unmount
------------------ -------
dentry post-unlock; final iput()
ocfs2_checkpoint_inode()
load osb->journal
ocfs2_journal_shutdown()
free journal; clear pointer
read the transaction ID
The checkpoint wait queue is embedded in that journal, and the final
jbd2_journal_release_jbd_inode() also needs its JBD2 journal to remain
alive for the whole call. Protecting only the pointer load would leave
those longer uses unprotected.
Read and clear osb->journal under trans_inc_lock when checking checkpoint
progress. Treat a removed journal as checkpointed. Move checkpoint
waiters to the existing mount-owned checkpoint_event and wake it after
checkpoint progress and journal removal, so the queue outlives the
journal. The commit thread also waits there and rechecks its condition
when woken.
Serialize the final JBD2 inode release against JBD2 destruction and the
journal free with a mount-owned rw_semaphore. Take the write side only
after stopping the commit thread, and drop it before the journal inode's
final iput(), whose cleanup can take the read side. Inode cleanup holds
the read side only around the JBD2 release, outside checkpoint waits and
DLM lock teardown.
KASAN report as below:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000e: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077]
CPU: 0 UID: 0 PID: 587 Comm: ocfs2dc-33CAF04 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ocfs2_clear_inode+0x8ae/0x1630
Code: fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 27 0c 00 00 49 8d 7d 70 48 8b 43 c8 48 ba 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 f0 0b 00 00 49 3b 45 70 0f 88 62 03 00 00 e8 49
RSP: 0018:ffff888118d3f878 EFLAGS: 00010212
RAX: 0000000000000001 RBX: ffff88811a5edc60 RCX: 000000000000000e
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000070
RBP: ffff888116134000 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff8965765f R11: 0000000000000001 R12: ffff88811a5ed400
R13: 0000000000000000 R14: ffff88811a5edbf8 R15: ffff88811a5ed408
FS: 0000000000000000(0000) GS:ffff8881fd4dc000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff35b66f2c0 CR3: 00000001092ae005 CR4: 0000000000770ef0
PKRU: 55555554
Call Trace:
<TASK>
? __pfx_ocfs2_clear_inode+0x10/0x10
? __pfx_ocfs2_inode_is_valid_to_delete+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __lock_acquire+0x5a3/0x2140
ocfs2_evict_inode+0x1ed/0x11e0
? inode_wait_for_writeback+0x14c/0x330
? __pfx_ocfs2_evict_inode+0x10/0x10
? lock_acquire+0x190/0x300
? srso_alias_return_thunk+0x5/0xfbef5
? find_held_lock+0x2b/0x80
? evict+0x347/0x9f0
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x290
? _raw_spin_unlock+0x23/0x40
? __pfx_ocfs2_evict_inode+0x10/0x10
evict+0x38b/0x9f0
? __pfx_evict+0x10/0x10
? lock_acquire+0x190/0x300
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x290
? __pfx_inode_just_drop+0x10/0x10
iput+0x680/0xb80
ocfs2_dentry_lock_put+0xc2/0x110
? __pfx_ocfs2_dentry_post_unlock+0x10/0x10
ocfs2_process_blocked_lock+0x1fb/0x420
? __pfx_ocfs2_process_blocked_lock+0x10/0x10
? __pfx_pmbd_probe_hit_cookie+0x10/0x10
? lock_release+0xc8/0x290
? srso_alias_return_thunk+0x5/0xfbef5
? lockdep_hardirqs_on_prepare+0xeb/0x1a0
? srso_alias_return_thunk+0x5/0xfbef5
ocfs2_downconvert_thread+0x32b/0x780
? do_raw_spin_lock+0x130/0x270
? __pfx_ocfs2_downconvert_thread+0x10/0x10
? __kthread_parkme+0xc1/0x220
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x290
? __pfx_autoremove_wake_function+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? __kthread_parkme+0x177/0x220
? __pfx_ocfs2_downconvert_thread+0x10/0x10
kthread+0x351/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf70
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0004-v8-dbcb8f80b8df476084d6@gmail.com
Fixes: da5e7c87827e ("ocfs2: cleanup journal init and shutdown")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <jjzuming@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/inode.c | 17 +++++++++--------
fs/ocfs2/journal.c | 30 ++++++++++++++++++++++--------
fs/ocfs2/journal.h | 17 +++++++++--------
fs/ocfs2/ocfs2.h | 1 +
fs/ocfs2/super.c | 1 +
5 files changed, 42 insertions(+), 24 deletions(-)
---
fs/ocfs2/inode.c | 17 +++++++++--------
fs/ocfs2/journal.c | 30 ++++++++++++++++++++++--------
fs/ocfs2/journal.h | 17 +++++++++--------
fs/ocfs2/ocfs2.h | 1 +
fs/ocfs2/super.c | 1 +
5 files changed, 42 insertions(+), 24 deletions(-)
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1255,15 +1255,16 @@ static void ocfs2_clear_inode(struct ino
oi->ip_blkno = 0ULL;
/*
- * ip_jinode is used to track txns against this inode. We ensure that
- * the journal is flushed before journal shutdown. Thus it is safe to
- * have inodes get cleaned up after journal shutdown.
+ * ip_jinode is used to track txns against this inode. The journal is
+ * flushed before it is shut down, so an inode cleaned up after that
+ * has nothing left to release. Hold the shutdown lock so a journal
+ * found here stays allocated until the release has finished.
*/
- if (!osb->journal)
- return;
-
- jbd2_journal_release_jbd_inode(osb->journal->j_journal,
- &oi->ip_jinode);
+ down_read(&osb->journal_shutdown_sem);
+ if (osb->journal)
+ jbd2_journal_release_jbd_inode(osb->journal->j_journal,
+ &oi->ip_jinode);
+ up_read(&osb->journal_shutdown_sem);
}
void ocfs2_evict_inode(struct inode *inode)
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -357,7 +357,7 @@ static int ocfs2_commit_cache(struct ocf
trace_ocfs2_commit_cache_end(journal->j_trans_id, flushed);
ocfs2_wake_downconvert_thread(osb);
- wake_up(&journal->j_checkpointed);
+ wake_up(&osb->checkpoint_event);
finally:
return status;
}
@@ -883,7 +883,6 @@ int ocfs2_journal_alloc(struct ocfs2_sup
atomic_set(&journal->j_num_trans, 0);
init_rwsem(&journal->j_trans_barrier);
- init_waitqueue_head(&journal->j_checkpointed);
spin_lock_init(&journal->j_lock);
journal->j_trans_id = 1UL;
INIT_LIST_HEAD(&journal->j_la_cleanups);
@@ -1044,12 +1043,14 @@ void ocfs2_journal_shutdown(struct ocfs2
journal = osb->journal;
if (!journal)
- goto done;
+ return;
inode = journal->j_inode;
- if (journal->j_state != OCFS2_JOURNAL_LOADED)
- goto done;
+ if (journal->j_state != OCFS2_JOURNAL_LOADED) {
+ down_write(&osb->journal_shutdown_sem);
+ goto free;
+ }
/* need to inc inode use count - jbd2_journal_destroy will iput. */
if (!igrab(inode))
@@ -1085,6 +1086,12 @@ void ocfs2_journal_shutdown(struct ocfs2
mlog_errno(status);
}
+ /*
+ * Exclude the final JBD2 inode cleanup in ocfs2_clear_inode() while
+ * the journal is destroyed and freed.
+ */
+ down_write(&osb->journal_shutdown_sem);
+
/* Shutdown the kernel journal system */
if (!jbd2_journal_destroy(journal->j_journal) && !status) {
/*
@@ -1107,10 +1114,17 @@ void ocfs2_journal_shutdown(struct ocfs2
journal->j_state = OCFS2_JOURNAL_FREE;
-done:
- iput(inode);
- kfree(journal);
+free:
+ /* Serialize the removal with ocfs2_ci_fully_checkpointed(). */
+ spin_lock(&trans_inc_lock);
osb->journal = NULL;
+ spin_unlock(&trans_inc_lock);
+ wake_up(&osb->checkpoint_event);
+ kfree(journal);
+ up_write(&osb->journal_shutdown_sem);
+
+ /* The journal inode's own cleanup takes the read side. */
+ iput(inode);
}
static void ocfs2_clear_journal_error(struct super_block *sb,
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -54,7 +54,6 @@ struct ocfs2_journal {
spinlock_t j_lock;
unsigned long j_trans_id;
struct rw_semaphore j_trans_barrier;
- wait_queue_head_t j_checkpointed;
/* both fields protected by j_lock*/
struct list_head j_la_cleanups;
@@ -91,11 +90,15 @@ static inline void ocfs2_set_ci_lock_tra
static inline int ocfs2_ci_fully_checkpointed(struct ocfs2_caching_info *ci)
{
int ret;
- struct ocfs2_journal *journal =
- OCFS2_SB(ocfs2_metadata_cache_get_super(ci))->journal;
+ struct ocfs2_super *osb =
+ OCFS2_SB(ocfs2_metadata_cache_get_super(ci));
+ struct ocfs2_journal *journal;
spin_lock(&trans_inc_lock);
- ret = time_after(journal->j_trans_id, ci->ci_last_trans);
+ journal = osb->journal;
+ /* A NULL journal has already completed checkpointing. */
+ ret = !journal ||
+ time_after(journal->j_trans_id, ci->ci_last_trans);
spin_unlock(&trans_inc_lock);
return ret;
}
@@ -196,9 +199,6 @@ static inline void ocfs2_checkpoint_inod
if (ocfs2_mount_local(osb))
return;
- if (!osb->journal)
- return;
-
if (!ocfs2_ci_fully_checkpointed(INODE_CACHE(inode))) {
/* WARNING: This only kicks off a single
* checkpoint. If someone races you and adds more
@@ -208,7 +208,8 @@ static inline void ocfs2_checkpoint_inod
* OK. */
ocfs2_start_checkpoint(osb);
- wait_event(osb->journal->j_checkpointed,
+ /* The wait queue must outlive journal shutdown. */
+ wait_event(osb->checkpoint_event,
ocfs2_ci_fully_checkpointed(INODE_CACHE(inode)));
}
}
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -364,6 +364,7 @@ struct ocfs2_super
enum ocfs2_recovery_state recovery_state;
wait_queue_head_t checkpoint_event;
struct ocfs2_journal *journal;
+ struct rw_semaphore journal_shutdown_sem;
unsigned long osb_commit_interval;
struct delayed_work la_enable_wq;
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2096,6 +2096,7 @@ static int ocfs2_initialize_super(struct
}
init_waitqueue_head(&osb->checkpoint_event);
+ init_rwsem(&osb->journal_shutdown_sem);
osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0988/1059] sctp: do not free a new asoc peeled off while sendmsg slept
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (986 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0987/1059] ocfs2: serialize inode journal access with shutdown Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0989/1059] spi: Fix runtime PM imbalance on pump transfer message error Greg Kroah-Hartman
` (10 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yves Bieri, Xin Long, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yves Bieri <yves.bieri@theori.io>
commit f2540da93a113d3f0a70fd0961e00eb849ce8342 upstream.
When sctp_sendmsg() creates a new association and sending on it fails
with anything but -ESRCH, it frees the association. The send can
sleep in sctp_wait_for_sndbuf(), which releases the socket lock, and
meanwhile another thread can peel the new association off to a new
socket. The wait then returns -EPIPE, and sctp_sendmsg() frees an
association that now belongs to the peeled-off socket, without holding
that socket's lock.
If the peeled-off socket frees the association first, e.g. on close(),
sctp_sendmsg() frees it a second time. Otherwise a syscall running
concurrently on the peeled-off socket can use it after sctp_sendmsg()
freed it. Both are reachable by an unprivileged user. The double free
on net with KASAN:
BUG: KASAN: double-free in sctp_tsnmap_free+0x5c/0x80
sctp_association_free+0x1eb/0x750
sctp_sendmsg+0x15ff/0x2020
Freed by task 836:
sctp_association_free+0x1eb/0x750
sctp_primitive_ABORT+0x85/0xe0
sctp_close+0x22a/0x8d0
Commit dfcb9f4f99f1 ("sctp: deny peeloff operation on asocs with threads
sleeping on it") fixed this double free by denying the peeloff.
Commit cea0cc80a677 ("sctp: use the right sk after waking up from
wait_buf sleep") replaced that check, and commit a0ff660058b8 ("sctp:
return error if the asoc has been peeled off in sctp_wait_for_sndbuf")
reverted it to return -EPIPE, without restoring the check.
Fix this by holding a reference on the new association while sending
on it, and by freeing it on error only if this socket still owns it.
asoc->base.sk only changes in sctp_sock_migrate(), which runs with this
socket locked, so the ownership check is stable. The reference keeps
the check safe if the new owner frees the association meanwhile.
Userspace still gets -EPIPE, and the association stays with the socket
it was peeled off to.
This was found by Xint Code, an AI code review agent, and reproduced as
an unprivileged user on net with KASAN (trace above), without modifying
the kernel or using error injection. With this patch the sender gets
-EPIPE and the association keeps working on the peeled-off socket.
Without a peeloff, a failed send that created the association (EAGAIN,
EINTR) still frees it, and a peer ABORT while the sender sleeps still
frees it exactly once. The SCTP selftest sctp_vrf.sh passes. The
reproducer is available on request.
Fixes: a0ff660058b8 ("sctp: return error if the asoc has been peeled off in sctp_wait_for_sndbuf")
Cc: stable@vger.kernel.org
Signed-off-by: Yves Bieri <yves.bieri@theori.io>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261112172149.27355-1-yves.bieri@theori.io
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/socket.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2061,6 +2061,11 @@ static int sctp_sendmsg(struct sock *sk,
asoc = transport->asoc;
new = true;
+ /* sctp_sendmsg_to_asoc() may release the socket lock,
+ * and the new asoc can be peeled off meanwhile. Hold
+ * it, and free it on error only if sk still owns it.
+ */
+ sctp_association_hold(asoc);
}
if (!sctp_style(sk, TCP) && !(sflags & SCTP_ADDR_OVER))
@@ -2082,8 +2087,11 @@ static int sctp_sendmsg(struct sock *sk,
/* Send msg to the asoc */
err = sctp_sendmsg_to_asoc(asoc, msg, msg_len, transport, sinfo);
- if (err < 0 && err != -ESRCH && new)
- sctp_association_free(asoc);
+ if (new) {
+ if (err < 0 && err != -ESRCH && asoc->base.sk == sk)
+ sctp_association_free(asoc);
+ sctp_association_put(asoc);
+ }
out_unlock:
release_sock(sk);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0989/1059] spi: Fix runtime PM imbalance on pump transfer message error
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (987 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0988/1059] sctp: do not free a new asoc peeled off while sendmsg slept Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0990/1059] tcp: Fix the SO_REUSEPORT bind cache admitting a conflicting socket Greg Kroah-Hartman
` (9 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sebastian Reichel, Alexander Shiyan,
Mark Brown
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Reichel <sebastian.reichel@collabora.com>
commit bb5caf7a2e0b2dae8e8905d32fc376703eabcfc4 upstream.
The current SPI message pumping code may drop the runtime PM twice when
an SPI message cannot be sent:
spi_master spi2: noqueue transfer failed
rockchip-spi feb20000.spi: Runtime PM usage count underflow!
Fix the problem by always keeping the runtime PM count increased when
exiting __spi_pump_transfer_message(), as the caller handles decreasing
it.
Note, that the function already keeps the RPM usage counter increased
for the error paths following after the prepare_transfer_hardware step.
Cc: stable@vger.kernel.org
Fixes: bef4a48f4ef7 ("spi: Fix null dereference on suspend")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://patch.msgid.link/20261110-spi-runtime-pm-fix-v1-1-8601ebb2f6a8@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/spi/spi.c | 4 ----
1 file changed, 4 deletions(-)
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1653,7 +1653,6 @@ static int __spi_pump_transfer_message(s
if (!was_busy && ctlr->auto_runtime_pm) {
ret = pm_runtime_get_sync(ctlr->dev.parent);
if (ret < 0) {
- pm_runtime_put_noidle(ctlr->dev.parent);
dev_err(&ctlr->dev, "Failed to power device: %d\n",
ret);
@@ -1674,9 +1673,6 @@ static int __spi_pump_transfer_message(s
"failed to prepare transfer hardware: %d\n",
ret);
- if (ctlr->auto_runtime_pm)
- pm_runtime_put(ctlr->dev.parent);
-
msg->status = ret;
spi_finalize_current_message(ctlr);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0990/1059] tcp: Fix the SO_REUSEPORT bind cache admitting a conflicting socket
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (988 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0989/1059] spi: Fix runtime PM imbalance on pump transfer message error Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0991/1059] vgacon: Fall back to the dummy console if mapping VGA memory fails Greg Kroah-Hartman
` (8 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Juan Agustin Niccolini,
Kuniyuki Iwashima, Eric Dumazet, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juan Agustin Niccolini <juanagusnicco@gmail.com>
commit f675070191f202010b010160b509a543dd232ae6 upstream.
When the port is in the FASTREUSEPORT_STRICT state, inet_csk_get_port()
skips the bind conflict check if sk_reuseport_match() finds the new
socket's address covered by the socket cached in tb->fast_*.
This is only safe if both sockets match on everything
inet_bind_conflict() reads. The cache misses some of it:
- It does not record sk_bound_dev_if or sk_reuse.
- It records the family and IPV6_V6ONLY but never compares them with
the new socket, so a cached v6only [::] (or 0.0.0.0) socket covers
a dual-stack [::] socket.
As a result, an unprivileged user can bind and listen on a port that
another user is listening on, for example a dual-stack [::] socket on
top of a 0.0.0.0 listener:
victim: bind(0.0.0.0:P), listen()
attacker: SO_REUSEPORT + IPV6_V6ONLY, bind([::]:P) /* fills cache */
attacker: SO_REUSEPORT, bind([::]:P), listen() /* should fail */
Only take the fast path when the new socket matches the cached one in
family, IPV6_V6ONLY, bound device and SO_REUSEADDR. Identical
SO_REUSEPORT listeners, the workload this cache was added for, still
skip the scan (binding 16384 of them: 9.80 ms before, 9.86 ms after,
5874 ms with the full check every time).
Fixes: 637bc8bbe6c0 ("inet: reset tb->fastreuseport when adding a reuseport sk")
Cc: stable@vger.kernel.org
Signed-off-by: Juan Agustin Niccolini <juanagusnicco@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261111174704.24312-2-juanagusnicco@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/inet_hashtables.h | 2 ++
net/ipv4/inet_connection_sock.c | 15 ++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -87,6 +87,8 @@ struct inet_bind_bucket {
__be32 fast_rcv_saddr;
unsigned short fast_sk_family;
bool fast_ipv6_only;
+ unsigned char fast_sk_reuse;
+ int fast_bound_dev_if;
struct hlist_node node;
struct hlist_head owners;
};
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -425,13 +425,18 @@ static inline int sk_reuseport_match(str
return 0;
if (!uid_eq(tb->fastuid, uid))
return 0;
- /* We only need to check the rcv_saddr if this tb was once marked
+ /* We only need to check the fast_* fields if this tb was once marked
* without fastreuseport and then was reset, as we can only know that
- * the fast_*rcv_saddr doesn't have any conflicts with the socks on the
- * owners list.
+ * the socket they describe doesn't have any conflicts with the socks
+ * on the owners list.
*/
if (tb->fastreuseport == FASTREUSEPORT_ANY)
return 1;
+ if (tb->fast_sk_family != sk->sk_family ||
+ tb->fast_ipv6_only != ipv6_only_sock(sk) ||
+ tb->fast_bound_dev_if != sk->sk_bound_dev_if ||
+ tb->fast_sk_reuse != sk->sk_reuse)
+ return 0;
#if IS_ENABLED(CONFIG_IPV6)
if (tb->fast_sk_family == AF_INET6)
return ipv6_rcv_saddr_equal(&tb->fast_v6_rcv_saddr,
@@ -459,6 +464,8 @@ void inet_csk_update_fastreuse(struct in
tb->fast_rcv_saddr = sk->sk_rcv_saddr;
tb->fast_ipv6_only = ipv6_only_sock(sk);
tb->fast_sk_family = sk->sk_family;
+ tb->fast_sk_reuse = sk->sk_reuse;
+ tb->fast_bound_dev_if = sk->sk_bound_dev_if;
#if IS_ENABLED(CONFIG_IPV6)
tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
#endif
@@ -486,6 +493,8 @@ void inet_csk_update_fastreuse(struct in
tb->fast_rcv_saddr = sk->sk_rcv_saddr;
tb->fast_ipv6_only = ipv6_only_sock(sk);
tb->fast_sk_family = sk->sk_family;
+ tb->fast_sk_reuse = sk->sk_reuse;
+ tb->fast_bound_dev_if = sk->sk_bound_dev_if;
#if IS_ENABLED(CONFIG_IPV6)
tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
#endif
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0991/1059] vgacon: Fall back to the dummy console if mapping VGA memory fails
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (989 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0990/1059] tcp: Fix the SO_REUSEPORT bind cache admitting a conflicting socket Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0992/1059] watchdog: npcm: fix sleeping clock call in restart handler Greg Kroah-Hartman
` (7 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matt Turner, Magnus Lindholm,
Helge Deller
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Turner <mattst88@gmail.com>
commit e3512c7628621f7048a9615d21fd7cf63173c518 upstream.
On Alpha, setup_arch() registers vgacon whenever CONFIG_VGA_CONSOLE is
enabled. On Marvel (EV7) systems whose SRM console is serial, no VGA
hose is set, so marvel_ioremap() finds no hose for 0xb8000 and returns
NULL. vgacon_startup() then probes video memory through that NULL
pointer and oopses in console_init():
Unable to handle kernel paging request at virtual address 0000000000000000
pc is at vgacon_startup+0x174/0x910
VGA_MAP_MEM() is ioremap() on Alpha and powerpc and can fail. Treat
failure like a failed probe and fall back to the dummy console. If a
VGA card is present, locate_and_init_vga() still switches to vgacon
once PCI is up.
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/console/vgacon.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -289,6 +289,8 @@ static const char *vgacon_startup(void)
}
vga_vram_base = VGA_MAP_MEM(vga_vram_base, vga_vram_size);
+ if (!vga_vram_base)
+ goto no_vga;
vga_vram_end = vga_vram_base + vga_vram_size;
/*
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0992/1059] watchdog: npcm: fix sleeping clock call in restart handler
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (990 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0991/1059] vgacon: Fall back to the dummy console if mapping VGA memory fails Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0993/1059] x86/apic/msi: Fix MSI interrupt affinity configuration Greg Kroah-Hartman
` (6 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Feng, Guenter Roeck
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
commit 4e83ea5b22193fd0db8bcee5682935f1d528705e upstream.
The watchdog .restart callback runs in atomic context: it is invoked
from the restart handler chain via atomic_notifier_call_chain(), under
an RCU read-side critical section, on every reboot or restart. Since
commit af084fdccfaf ("watchdog: npcm: Enable clock if provided"),
npcm_wdt_restart() calls clk_prepare_enable(), and clk_prepare()
takes a mutex unconditionally, so kernels built with
CONFIG_DEBUG_ATOMIC_SLEEP=y report
BUG: sleeping function called from invalid context
on every reboot. Worse, a panic-time restart can block on
prepare_lock and never issue the reset at all.
Get the clock with devm_clk_get_optional_prepared() at probe time and
keep it prepared for the lifetime of the driver, so the restart
handler only needs clk_enable(), which is safe in atomic context.
With the clock permanently prepared, npcm_wdt_start() and
npcm_wdt_stop() are simplified to clk_enable()/clk_disable() as well.
Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111083236.248-1-zhaofeng2@cmss.chinamobile.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/watchdog/npcm_wdt.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -98,7 +98,7 @@ static int npcm_wdt_start(struct watchdo
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
- clk_prepare_enable(wdt->clk);
+ clk_enable(wdt->clk);
__npcm_wdt_start(wdd);
@@ -111,7 +111,7 @@ static int npcm_wdt_stop(struct watchdog
writel(0, wdt->reg);
- clk_disable_unprepare(wdt->clk);
+ clk_disable(wdt->clk);
return 0;
}
@@ -160,8 +160,12 @@ static int npcm_wdt_restart(struct watch
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
- /* For reset, we start the WDT clock and leave it running. */
- clk_prepare_enable(wdt->clk);
+ /*
+ * For reset, we start the WDT clock and leave it running.
+ * The clock was prepared at probe time; only clk_enable() is
+ * safe in this atomic (restart notifier) context.
+ */
+ clk_enable(wdt->clk);
writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
udelay(1000);
@@ -207,7 +211,12 @@ static int npcm_wdt_probe(struct platfor
if (IS_ERR(wdt->reg))
return PTR_ERR(wdt->reg);
- wdt->clk = devm_clk_get_optional(&pdev->dev, NULL);
+ /*
+ * Keep the clock prepared for the lifetime of the driver:
+ * npcm_wdt_restart() runs in atomic context and may only call
+ * clk_enable().
+ */
+ wdt->clk = devm_clk_get_optional_prepared(&pdev->dev, NULL);
if (IS_ERR(wdt->clk))
return PTR_ERR(wdt->clk);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0993/1059] x86/apic/msi: Fix MSI interrupt affinity configuration
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (991 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0992/1059] watchdog: npcm: fix sleeping clock call in restart handler Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0994/1059] x86/mce: Do not treat cache hierarchy errors as memory errors Greg Kroah-Hartman
` (5 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Weitao Wang, Borislav Petkov (AMD),
Koichiro Den, Thomas Gleixner
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: WeitaoWang-oc <WeitaoWang-oc@zhaoxin.com>
commit 068d82afd070beb8ea32c8ee64d685af7d3f36e2 upstream.
The two step update sequence in msi_set_affinity() is required for MSI
interrupts which cannot be migrated atomically, i.e. devices which do not
provide MSI masking.
The MSI message update writes address and data registers separately, so such
a device can raise an interrupt in between, which results in a message built
from half updated state: a stray interrupt on a stale vector and a possibly
lost device interrupt.
The update sequence is selected by a per interrupt quirk flag, which is set
for interrupts which cannot use reservation mode. Reservation mode is only
enabled for maskable interrupts, i.e. devices which provide MSI-X or
mask support, so the quirk flag is the inverse of the reservation mode
bit.
The removal of the quirk flag replaced the flag check with a reservation mode
check, but dropped the negation of the removed condition:
- if (!irqd_msi_nomask_quirk(irqd) || ...)
+ if (!irqd_can_reserve(irqd) || ...)
As the quirk flag is the inverse of the reservation mode bit, the replacement
inverted the condition and selects the wrong update path for every interrupt:
non-maskable interrupts take the direct update path again, which reopens the
race, while maskable interrupts needlessly go through the two step update.
Restore the original condition so that the direct update path is selected when
reservation mode is enabled, which also matches the comment above the check:
direct update is possible when the MSI is maskable, which is the case when the
reservation mode bit is set.
[ bp: Massage commit message. ]
Fixes: b56ebe7c896d ("x86/apic/msi: Fix misconfigured non-maskable MSI quirk")
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Koichiro Den <den@valinux.co.jp>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org # v6.1+
Link: https://patch.msgid.link/20261016181016.3850-1-WeitaoWang-oc@zhaoxin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/apic/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -62,7 +62,7 @@ msi_set_affinity(struct irq_data *irqd,
* - The interrupt is not yet started up
* - The new destination CPU is the same as the old destination CPU
*/
- if (!irqd_can_reserve(irqd) ||
+ if (irqd_can_reserve(irqd) ||
cfg->vector == old_cfg.vector ||
old_cfg.vector == MANAGED_IRQ_SHUTDOWN_VECTOR ||
!irqd_is_started(irqd) ||
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0994/1059] x86/mce: Do not treat cache hierarchy errors as memory errors
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (992 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0993/1059] x86/apic/msi: Fix MSI interrupt affinity configuration Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0995/1059] xarray: fix index jumping backwards in xas_find() Greg Kroah-Hartman
` (4 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Schlegel,
Borislav Petkov (AMD), Qiuxu Zhuo, Tony Luck, Yazen Ghannam,
Sohil Mehta, stable
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Schlegel <me@adrianschlegel.com>
commit 29b74cf57f432d60da2b79c827f1379125409611 upstream.
On Intel and Zhaoxin, mce_is_memory_error() also returns true for cache
hierarchy errors. All callers expect it to report memory errors only.
The CEC uses it to count corrected DRAM errors. A corrected cache error only
names the cache line that was affected, not a faulty DRAM page. With a faulty
CPU core, the CEC therefore soft-offlines healthy pages. On an i9-9900K this
caused about 500 soft-offline attempts per hour.
Report only memory controller errors on Intel and Zhaoxin, as is already done
for AMD.
Fixes: fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA and Deferred error in machine_check_poll")
Signed-off-by: Adrian Schlegel <me@adrianschlegel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Qiuxu Zhuo <qzhuo@nvidia.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Cc: <stable@kernel.org>
Link: https://patch.msgid.link/20261012193305.38931-1-me@adrianschlegel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/cpu/mce/core.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -514,21 +514,13 @@ bool mce_is_memory_error(struct mce *m)
case X86_VENDOR_INTEL:
case X86_VENDOR_ZHAOXIN:
/*
- * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
+ * Intel SDM Volume 3B "Compound Error Codes".
*
- * Bit 7 of the MCACOD field of IA32_MCi_STATUS is used for
- * indicating a memory error. Bit 8 is used for indicating a
- * cache hierarchy error. The combination of bit 2 and bit 3
- * is used for indicating a `generic' cache hierarchy error
- * But we can't just blindly check the above bits, because if
- * bit 11 is set, then it is a bus/interconnect error - and
- * either way the above bits just gives more detail on what
- * bus/interconnect error happened. Note that bit 12 can be
- * ignored, as it's the "filter" bit.
+ * Memory controller errors have an MCACOD of 000F 0000 1MMM CCCC:
+ * bit 7 set, bits 8-11 and 13-15 clear. Bit 12 is the "filter"
+ * bit and is ignored.
*/
- return (m->status & 0xef80) == BIT(7) ||
- (m->status & 0xef00) == BIT(8) ||
- (m->status & 0xeffc) == 0xc;
+ return (m->status & 0xef80) == BIT(7);
default:
return false;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0995/1059] xarray: fix index jumping backwards in xas_find()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (993 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0994/1059] x86/mce: Do not treat cache hierarchy errors as memory errors Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0996/1059] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits() Greg Kroah-Hartman
` (3 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+b72767277f29b6407083,
Krystian Kaniewski, Andrew Morton, Jose Fernandez (Anthropic),
Matthew Wilcox (Oracle), Mike Rapoport
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krystian Kaniewski <krystianmkaniewski@gmail.com>
commit a4e667346a8d91e629a2ca9affc70dc28978f4a1 upstream.
A bug in the XArray iterator xas_find() causes the iterator's index
(xas->xa_index) to jump backwards when iterating over a multi-index entry
(like a THP) that resides in a non-leaf node and is concurrently split.
When iterating over a multi-index entry in a non-leaf node, xas_load()
sets xas->xa_offset to the base offset of the entry, but leaves
xas->xa_index at the requested index. When the caller subsequently wants
to advance to the next entry, xas_find() is called. xas_find() attempts
to synchronize xas->xa_offset with xas->xa_index before advancing.
However, the fixup logic was incorrectly restricted to leaf nodes
(!xas->xa_node->shift). Because the THP resides in a non-leaf node, the
fixup is skipped.
As a result, xas_find() simply increments xas->xa_offset and recalculates
xas->xa_index based on this new offset. This causes xas->xa_index to jump
backwards. If the THP was concurrently split, the entry at the new offset
is a node pointer, so xas_find() descends into it and returns the folio at
the backwards index. The caller (filemap_map_pages()) then calculates the
PTE pointer based on this backwards index, resulting in an invalid memory
access such as an out-of-bounds read or use-after-free on a page-table
page freed via tlb_remove_table_rcu().
A userspace access that faults in a file-backed mapping can trigger this
path. When the index moves backwards, filemap_map_pages() can calculate a
PTE outside the page locked for fault-around and dereference a freed
page-table page, resulting in a KASAN-detected use-after-free read.
To fix this, check if xas->xa_offset matches get_offset(xas->xa_index,
xas->xa_node). If it does not and the node is a non-leaf node, set
xas->xa_offset to get_offset(xas->xa_index, xas->xa_node) before
advancing. Also add test cases in test_xarray to verify xas_find()
behavior when iterating over and splitting multi-index entries.
Link: https://lore.kernel.org/20260904121301.200049-1-krystianmkaniewski@gmail.com
Fixes: b803b42823d0 ("xarray: Add XArray iterators")
Reported-by: syzbot+b72767277f29b6407083@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b72767277f29b6407083
Closes: https://syzkaller.appspot.com/ai_job?id=a01c56bd-74d0-411c-afb4-ee6f0cb6cb61
Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Link: https://lore.kernel.org/20261104-jf-filemap-v2-pedro-reply-r2-74c87c6fbcf@linux.dev
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/test_xarray.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/xarray.c | 8 +++---
2 files changed, 75 insertions(+), 3 deletions(-)
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1001,6 +1001,75 @@ static noinline void check_multi_find_3(
}
}
+static noinline void check_multi_find_4(struct xarray *xa)
+{
+#ifdef CONFIG_XARRAY_MULTI
+ unsigned int order = XA_CHUNK_SHIFT + 1;
+ unsigned long next = 1UL << order;
+ unsigned long start = next - 1;
+ XA_STATE(xas, xa, start);
+ XA_STATE_ORDER(split, xa, 0, 0);
+ void *entry;
+ unsigned long i;
+
+ /* Multi-index entry in two slots of a non-leaf node. */
+ xa_store_order(xa, 0, order, xa_mk_index(0), GFP_KERNEL);
+ XA_BUG_ON(xa, xa_store_index(xa, next, GFP_KERNEL) != NULL);
+
+ rcu_read_lock();
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != xa_mk_index(0));
+ XA_BUG_ON(xa, xas.xa_index != start);
+
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != xa_mk_index(next));
+ XA_BUG_ON(xa, xas.xa_index != next);
+
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != NULL);
+ rcu_read_unlock();
+
+ xa_erase_index(xa, next);
+ xa_erase_index(xa, 0);
+ XA_BUG_ON(xa, !xa_empty(xa));
+
+ /* Split the multi-index entry after a lookup begins inside it. */
+ xa_store_order(xa, 0, order, xa_mk_index(0), GFP_KERNEL);
+ XA_BUG_ON(xa, xa_store_index(xa, next, GFP_KERNEL) != NULL);
+
+ xas_set(&xas, start);
+ rcu_read_lock();
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != xa_mk_index(0));
+ XA_BUG_ON(xa, xas.xa_index != start);
+ rcu_read_unlock();
+
+ xas_split_alloc(&split, xa_mk_index(0), order, GFP_KERNEL);
+ if (xas_error(&split)) {
+ XA_BUG_ON(xa, true);
+ goto out;
+ }
+ xas_lock(&split);
+ xas_split(&split, xa_mk_index(0), order);
+ for (i = 0; i < next; i++)
+ __xa_store(xa, i, xa_mk_index(i), 0);
+ xas_unlock(&split);
+
+ rcu_read_lock();
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != xa_mk_index(next));
+ XA_BUG_ON(xa, xas.xa_index != next);
+
+ entry = xas_find(&xas, ULONG_MAX);
+ XA_BUG_ON(xa, entry != NULL);
+ rcu_read_unlock();
+
+out:
+ xa_destroy(xa);
+ XA_BUG_ON(xa, !xa_empty(xa));
+#endif
+}
+
static noinline void check_find_1(struct xarray *xa)
{
unsigned long i, j, k;
@@ -1124,6 +1193,7 @@ static noinline void check_find(struct x
check_multi_find_1(xa, i);
check_multi_find_2(xa);
check_multi_find_3(xa);
+ check_multi_find_4(xa);
}
/* See find_swap_entry() in mm/shmem.c */
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1255,9 +1255,11 @@ void *xas_find(struct xa_state *xas, uns
entry = xas_load(xas);
if (entry || xas_not_node(xas->xa_node))
return entry;
- } else if (!xas->xa_node->shift &&
- xas->xa_offset != (xas->xa_index & XA_CHUNK_MASK)) {
- xas->xa_offset = ((xas->xa_index - 1) & XA_CHUNK_MASK) + 1;
+ } else if (xas->xa_offset != get_offset(xas->xa_index, xas->xa_node)) {
+ if (!xas->xa_node->shift)
+ xas->xa_offset = ((xas->xa_index - 1) & XA_CHUNK_MASK) + 1;
+ else
+ xas->xa_offset = get_offset(xas->xa_index, xas->xa_node);
}
xas_next_offset(xas);
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0996/1059] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits()
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (994 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0995/1059] xarray: fix index jumping backwards in xas_find() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0997/1059] xfs: break layouts before swapping extents Greg Kroah-Hartman
` (2 subsequent siblings)
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ding Feng, Damien Le Moal
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ding Feng <dingf3ng@gmail.com>
commit fb5289b697c965581104bafdd875b969a1db3e79 upstream.
zonefs_write_check_limits() follows generic_write_check_limits() and
has the same problem: it stores rlimit(RLIMIT_FSIZE), an unsigned long,
in a loff_t, so a soft limit between 2^63 and RLIM_INFINITY is negative
and every write fails with -EFBIG and raises SIGXFSZ.
Keep the limit unsigned and apply it only when it is at most LLONG_MAX,
as the generic helper now does.
Fixes: ebfd68cd0c1e ("zonefs: Fix O_APPEND async write handling")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5-5 Frama-C
Signed-off-by: Ding Feng <dingf3ng@gmail.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/zonefs/file.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- a/fs/zonefs/file.c
+++ b/fs/zonefs/file.c
@@ -474,15 +474,16 @@ static loff_t zonefs_write_check_limits(
{
struct inode *inode = file_inode(file);
struct zonefs_zone *z = zonefs_inode_zone(inode);
- loff_t limit = rlimit(RLIMIT_FSIZE);
+ u64 limit = rlimit(RLIMIT_FSIZE);
loff_t max_size = z->z_capacity;
- if (limit != RLIM_INFINITY) {
- if (pos >= limit) {
+ /* No file position reaches a limit above LLONG_MAX. */
+ if (limit != RLIM_INFINITY && limit <= LLONG_MAX) {
+ if (pos >= (loff_t)limit) {
send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
- count = min(count, limit - pos);
+ count = min(count, (loff_t)limit - pos);
}
if (!(file->f_flags & O_LARGEFILE))
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0997/1059] xfs: break layouts before swapping extents
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (995 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0996/1059] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits() Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0998/1059] xfs: wait for direct I/O " Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0999/1059] net: bridge: fix skb leak of reinjected link-local frames Greg Kroah-Hartman
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daejun Park, Christoph Hellwig,
Carlos Maiolino
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
commit 0d8026c7ac0c79a8ebe2942a3c3114c06aced734 upstream.
XFS_IOC_SWAPEXT does not break pNFS layouts. A client can keep writing
to blocks that the swap moved to the temporary file. xfs_fsr frees
those blocks when it closes that file. The writes then land in whatever
reuses them.
Lock with xfs_ilock2_io_mmap(), as the exchange-range ioctls do.
Fixes: 781355c6e5ae ("xfs: recall pNFS layouts on conflicting access")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/xfs/xfs_bmap_util.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1672,9 +1672,9 @@ xfs_swap_extents(
* page cache safely. Once we have done this we can take the ilocks and
* do the rest of the checks.
*/
- lock_two_nondirectories(VFS_I(ip), VFS_I(tip));
- filemap_invalidate_lock_two(VFS_I(ip)->i_mapping,
- VFS_I(tip)->i_mapping);
+ error = xfs_ilock2_io_mmap(ip, tip);
+ if (error)
+ return error;
/* Verify that both files have the same format */
if ((VFS_I(ip)->i_mode & S_IFMT) != (VFS_I(tip)->i_mode & S_IFMT)) {
@@ -1868,9 +1868,7 @@ out_unlock_ilock:
xfs_iunlock(ip, XFS_ILOCK_EXCL);
xfs_iunlock(tip, XFS_ILOCK_EXCL);
out_unlock:
- filemap_invalidate_unlock_two(VFS_I(ip)->i_mapping,
- VFS_I(tip)->i_mapping);
- unlock_two_nondirectories(VFS_I(ip), VFS_I(tip));
+ xfs_iunlock2_io_mmap(ip, tip);
return error;
out_trans_cancel:
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0998/1059] xfs: wait for direct I/O before swapping extents
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (996 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0997/1059] xfs: break layouts before swapping extents Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
2026-12-04 10:08 ` [PATCH 6.1 0999/1059] net: bridge: fix skb leak of reinjected link-local frames Greg Kroah-Hartman
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daejun Park, Christoph Hellwig,
Carlos Maiolino
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
commit 844bc1167f1b2d19d9495a556599af24dc4468bd upstream.
An AIO direct write drops the iolock before its bios complete.
XFS_IOC_SWAPEXT does not wait for it. The write can land in blocks that
the swap moved to the temporary file. Once xfs_fsr frees them, the
write corrupts whatever reuses them.
Wait for direct I/O first, as exchange-range does.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/xfs/xfs_bmap_util.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1369,6 +1369,7 @@ xfs_swap_extent_flush(
{
int error;
+ inode_dio_wait(VFS_I(ip));
error = filemap_write_and_wait(VFS_I(ip)->i_mapping);
if (error)
return error;
^ permalink raw reply [flat|nested] 1065+ messages in thread* [PATCH 6.1 0999/1059] net: bridge: fix skb leak of reinjected link-local frames
2026-12-04 9:52 [PATCH 6.1 0000/1059] 6.1.194-rc1 review Greg Kroah-Hartman
` (997 preceding siblings ...)
2026-12-04 10:08 ` [PATCH 6.1 0998/1059] xfs: wait for direct I/O " Greg Kroah-Hartman
@ 2026-12-04 10:08 ` Greg Kroah-Hartman
998 siblings, 0 replies; 1065+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:08 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Wade, Xia Yan,
Nikolay Aleksandrov, Jakub Kicinski
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wade <danjwade95@gmail.com>
commit 98382d41f92f048cf3cbb7af415f48a722b19ebc upstream.
br_handle_frame() passes the link-local frames it neither forwards nor
delivers (01:80:c2:00:00:02 to 0d and 0f, unless set in the group
forward mask) through NF_HOOK() at NF_BR_LOCAL_IN. Since commit
3b2e2904deb3 ("net: bridge: fix per-port af_packet sockets") the okfn
only learns the source and returns 1, which becomes RX_HANDLER_PASS.
That commit sent the nf_queue case to RX_HANDLER_CONSUMED, which is
right for the synchronous return, but the frame comes back: on
reinjection nf_reinject() calls the okfn and ignores its return value,
because every other okfn consumes the skb. This one no longer does, so
nothing frees the frame. NFQA_CFG_F_FAIL_OPEN leaks it the same way
with no verdict at all, when the queue or the listener's socket is full.
Each frame leaks an skb, and one sent from a local socket keeps that
socket charged, so neither it nor the network namespace holding it is
freed. Bridge, rule and queue need only CAP_NET_ADMIN in a netns, so
with user namespaces an unprivileged user can exhaust kernel memory.
nf_reinject() cannot free the skb on a 1 from the okfn, because other
okfns return NET_RX_DROP, which is 1, after freeing it.
Call nf_hook() instead of NF_HOOK() and do the learning and the
RX_HANDLER_PASS return in br_handle_frame() on 1, as the 0x00 and 0x0e
cases already do and as vrf_rcv_nfhook() does. The okfn then runs only
for a reinjected frame, which br_handle_frame() has already reported
consumed and cannot pass on the port, so it learns from the frame and
frees it. These frames were not delivered before this change either.
Also set *pskb before the new RX_HANDLER_PASS, as the other such
returns do; skb_share_check() may have replaced the skb, and the commit
above added that return without the assignment.
Discovered by an AI code review agent and reproduced on unmodified
mainline under KASAN: an unprivileged user in a new user and network
namespace bridged a veth, queued link-local frames to an NFQUEUE
listener that accepted every one, and leaked an skb per frame. With
this patch the reinjected frames are freed and nothing leaks.
Fixes: 3b2e2904deb3 ("net: bridge: fix per-port af_packet sockets")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Wade <danjwade95@gmail.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20261115130211.7724-1-danjwade95@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bridge/br_input.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -224,13 +224,18 @@ static void __br_handle_local_finish(str
br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, 0);
}
-/* note: already called with rcu_read_lock */
+/* okfn of the link-local NF_BR_LOCAL_IN hook in br_handle_frame(). It is
+ * only called when a queued frame is reinjected, after br_handle_frame()
+ * returned RX_HANDLER_CONSUMED for it, so the frame can no longer be
+ * passed up on the port and has to be freed here.
+ * note: already called with rcu_read_lock
+ */
static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
__br_handle_local_finish(skb);
+ kfree_skb(skb);
- /* return 1 to signal the okfn() was called so it's ok to use the skb */
- return 1;
+ return 0;
}
static int nf_hook_bridge_pre(struct sk_buff *skb, struct sk_buff **pskb)
@@ -386,11 +391,14 @@ static rx_handler_result_t br_handle_fra
/* The else clause should be hit when nf_hook():
* - returns < 0 (drop/error)
* - returns = 0 (stolen/nf_queue)
- * Thus return 1 from the okfn() to signal the skb is ok to pass
+ * On 1 the frame is passed on here. The okfn() only runs if a
+ * queued frame is reinjected later, and must consume it then.
*/
- if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN,
+ if (nf_hook(NFPROTO_BRIDGE, NF_BR_LOCAL_IN,
dev_net(skb->dev), NULL, skb, skb->dev, NULL,
br_handle_local_finish) == 1) {
+ *pskb = skb;
+ __br_handle_local_finish(skb);
return RX_HANDLER_PASS;
} else {
return RX_HANDLER_CONSUMED;
^ permalink raw reply [flat|nested] 1065+ messages in thread