6.15.10-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 144/480 drm/rockchip: vop2: Fix the update of LAYER/PORT select registers when there are multi display output on rk3588/rk3568
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Yan <[email protected]>
[ Upstream commit 3e89a8c6835476aa782da80585dee9ddae651eea ]
The all video ports of rk3568/rk3588 share the same OVL_LAYER_SEL and OVL_PORT_SEL registers, and the configuration of these two registers can be set to take effect when the vsync signal arrives at a certain Video Port.
If two threads for two display output choose to update these two registers simultaneously to meet their own plane adjustment requirements(change plane zpos or switch plane from one crtc to another), then no matter which Video Port'svsync signal we choose to follow for these two registers, the display output of the other Video Port will be abnormal.
This is because the configuration of this Video Port does not take effect at the right time (its configuration should take effect when its VSYNC signal arrives).
In order to solve this problem, when performing plane migration or change the zpos of planes, there are two things to be observed and followed:
1. When a plane is migrated from one VP to another, the configuration of the layer can only take effect after the Port mux configuration is enabled.
2. When change the zpos of planes, we must ensure that the change for the previous VP takes effect before we proceed to change the next VP. Otherwise, the new configuration might overwrite the previous one for the previous VP, or it could lead to the configuration of the previous VP being take effect along with the VSYNC of the new VP.
This issue only occurs in scenarios where multi-display output is enabled.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 25 ++---- drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 33 ++++++++ drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 89 ++++++++++++++++++-- 3 files changed, 122 insertions(+), 25 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +6 -19
@@ -146,25 +146,6 @@ static void vop2_unlock(struct vop2 *vop2)mutex_unlock (&vop2->vop2_lock); } -/* -* Note: -* The write mask function is documented but missing on rk3566/8, writes -* to these bits have no effect. For newer soc(rk3588 and following) the -* write mask is needed for register writes. -* -* GLB_CFG_DONE_EN has no write mask bit. -* -*/ -static void vop2_cfg_done (struct vop2_video_port *vp) -{ -struct vop2 *vop2 = vp->vop2; -u32 val =RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN ; - - val |=BIT (vp->id) | (BIT (vp->id) <<16 ); - -regmap_set_bits (vop2->map,RK3568_REG_CFG_DONE , val); -} -static void vop2_win_disable (struct vop2_win *win) {vop2_win_write (win,VOP2_WIN_ENABLE ,0 );
@@ -854,6 +835,11 @@ static void vop2_enable(struct vop2 *vop2)if (vop2->version ==VOP_VERSION_RK3588 )rk3588_vop2_power_domain_enable_all (vop2); +if (vop2->version <=VOP_VERSION_RK3588 ) { + vop2->old_layer_sel =vop2_readl (vop2,RK3568_OVL_LAYER_SEL ); + vop2->old_port_sel =vop2_readl (vop2,RK3568_OVL_PORT_SEL ); + } +vop2_writel (vop2,RK3568_REG_CFG_DONE ,RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN );/*
@@ -2728,6 +2714,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)return dev_err_probe (drm->dev, vop2->irq,"cannot find irq for vop2\n" );mutex_init (&vop2->vop2_lock); +mutex_init (&vop2->ovl_lock); ret =devm_request_irq (dev, vop2->irq, vop2_isr,IRQF_SHARED ,dev_name (dev), vop2);if (ret)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +33 -0
@@ -334,6 +334,19 @@ struct vop2 {/* optional internal rgb encoder */ struct rockchip_rgb *rgb; +/* +* Used to record layer selection configuration on rk356x/rk3588 +* as register RK3568_OVL_LAYER_SEL and RK3568_OVL_PORT_SEL are +* shared for all the Video Ports. +*/ +u32 old_layer_sel; +u32 old_port_sel; +/* +* Ensure that the updates to these two registers(RKK3568_OVL_LAYER_SEL/RK3568_OVL_PORT_SEL) +* take effect in sequence. +*/ +struct mutex ovl_lock; +/* must be put at the end of the struct */ struct vop2_win win[]; };
@@ -727,6 +740,7 @@ enum dst_factor_mode {#define RK3588_OVL_PORT_SEL__CLUSTER2 GENMASK(21, 20)#define RK3568_OVL_PORT_SEL__CLUSTER1 GENMASK(19, 18)#define RK3568_OVL_PORT_SEL__CLUSTER0 GENMASK(17, 16) +#define RK3588_OVL_PORT_SET__PORT3_MUX GENMASK(15, 12)#define RK3568_OVL_PORT_SET__PORT2_MUX GENMASK(11, 8)#define RK3568_OVL_PORT_SET__PORT1_MUX GENMASK(7, 4)#define RK3568_OVL_PORT_SET__PORT0_MUX GENMASK(3, 0)
@@ -831,4 +845,23 @@ static inline struct vop2_win *to_vop2_win(struct drm_plane *p) return container_of(p, struct vop2_win, base); } +/* +* Note: +* The write mask function is documented but missing on rk3566/8, writes +* to these bits have no effect. For newer soc(rk3588 and following) the +* write mask is needed for register writes. +* +* GLB_CFG_DONE_EN has no write mask bit. +* +*/ +static inline void vop2_cfg_done (struct vop2_video_port *vp) +{ +struct vop2 *vop2 = vp->vop2; +u32 val =RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN ; + + val |=BIT (vp->id) | (BIT (vp->id) <<16 ); + +regmap_set_bits (vop2->map,RK3568_REG_CFG_DONE , val); +} +#endif /* _ROCKCHIP_DRM_VOP2_H */
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +83 -6
129 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/480 sched/psi: Optimize psi_group_change() cpu_clock() usage
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 570c8efd5eb79c3725ba439ce105ed1bedc5acd9 ]
Dietmar reported that commit 3840cbe24cf0 ("sched: psi: fix bogus pressure spikes from aggregation race") caused a regression for him on a high context switch rate benchmark (schbench) due to the now repeating cpu_clock() calls.
In particular the problem is that get_recent_times() will extrapolate the current state to 'now'. But if an update uses a timestamp from before the start of the update, it is possible to get two reads with inconsistent results. It is effectively back-dating an update.
(note that this all hard-relies on the clock being synchronized across CPUs -- if this is not the case, all bets are off).
Combine this problem with the fact that there are per-group-per-cpu seqcounts, the commit in question pushed the clock read into the group iteration, causing tree-depth cpu_clock() calls. On architectures where cpu_clock() has appreciable overhead, this hurts.
Instead move to a per-cpu seqcount, which allows us to have a single clock read for all group updates, increasing internal consistency and lowering update overhead. This comes at the cost of a longer update side (proportional to the tree depth) which can cause the read side to retry more often.
--- include/linux/psi_types.h | 6 +- kernel/sched/psi.c | 121 +++++++++++++++++++++----------------- 2 files changed, 68 insertions(+), 59 deletions(-)
include/linux/psi_types.h +2 -4
@@ -84,11 +84,9 @@ enum psi_aggregators {struct psi_group_cpu {/* 1st cacheline updated by the scheduler */ -/* Aggregator needs to know of concurrent changes */ -seqcount_t seq____cacheline_aligned_in_smp ; -/* States of the tasks belonging to this group */ -unsigned int tasks[NR_PSI_TASK_COUNTS ]; +unsigned int tasks[NR_PSI_TASK_COUNTS ] +____cacheline_aligned_in_smp ;/* Aggregate pressure state derived from the tasks */ u32 state_mask;
kernel/sched/psi.c +66 -55
255 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/480 sched/deadline: Less agressive dl_server handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit cccb45d7c4295bbfeba616582d0249f2d21e6df5 ]
Chris reported that commit 5f6bd380c7bd ("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disabling dl_server cured things.
His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the dl_server when there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
--- include/linux/sched.h | 1 + kernel/sched/deadline.c | 25 ++++++++++++++++++++++--- kernel/sched/fair.c | 9 --------- 3 files changed, 23 insertions(+), 12 deletions(-)
include/linux/sched.h +1 -0
@@ -702,6 +702,7 @@ struct sched_dl_entity { unsigned int dl_defer : 1; unsigned int dl_defer_armed : 1; unsigned int dl_defer_running : 1; + unsigned int dl_server_idle : 1;/* * Bandwidth enforcement timer. Each -deadline task has its
kernel/sched/deadline.c +22 -3
@@ -1215,6 +1215,8 @@ static void __push_dl_task(struct rq *rq, struct rq_flags *rf)/* a defer timer will not be reset if the runtime consumed was < dl_server_min_res */ static const u64 dl_server_min_res =1 *NSEC_PER_MSEC ; +static bool dl_server_stopped (struct sched_dl_entity *dl_se); +static enum hrtimer_restart dl_server_timer (struct hrtimer *timer,struct sched_dl_entity *dl_se) {struct rq *rq =rq_of_dl_se (dl_se);
@@ -1234,6 +1236,7 @@ static enum hrtimer_restart dl_server_timer(struct hrtimer *timer, struct sched_if (!dl_se->server_has_tasks (dl_se)) {replenish_dl_entity (dl_se); +dl_server_stopped (dl_se);return HRTIMER_NORESTART ; }
@@ -1639,8 +1642,10 @@ void dl_server_update_idle_time(struct rq *rq, struct task_struct *p)void dl_server_update (struct sched_dl_entity *dl_se,s64 delta_exec) {/* 0 runtime = fair server disabled */ -if (dl_se->dl_runtime) +if (dl_se->dl_runtime) { + dl_se->dl_server_idle =0 ;update_curr_dl_se (dl_se->rq, dl_se, delta_exec); + } }void dl_server_start (struct sched_dl_entity *dl_se)
@@ -1663,7 +1668,7 @@ void dl_server_start(struct sched_dl_entity *dl_se)setup_new_dl_entity (dl_se); } -if (!dl_se->dl_runtime) +if (!dl_se->dl_runtime || dl_se->dl_server_active)return ; dl_se->dl_server_active =1 ;
@@ -1684,6 +1689,20 @@ void dl_server_stop(struct sched_dl_entity *dl_se) dl_se->dl_server_active =0 ; } +static bool dl_server_stopped (struct sched_dl_entity *dl_se) +{ +if (!dl_se->dl_server_active) +return false; + +if (dl_se->dl_server_idle) { +dl_server_stop (dl_se); +return true; + } + + dl_se->dl_server_idle =1 ; +return false; +} +void dl_server_init (struct sched_dl_entity *dl_se,struct rq *rq,dl_server_has_tasks_f has_tasks,dl_server_pick_f pick_task)
@@ -2435,7 +2454,7 @@ static struct task_struct *__pick_task_dl(struct rq *rq)if (dl_server (dl_se)) { p = dl_se->server_pick_task (dl_se);if (!p) { -if (dl_server_active (dl_se)) { +if (!dl_server_stopped (dl_se)) { dl_se->dl_yielded =1 ;update_curr_dl_se (rq, dl_se,0 ); }
kernel/sched/fair.c +0 -9
@@ -5886,7 +5886,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)struct cfs_bandwidth *cfs_b =tg_cfs_bandwidth (cfs_rq->tg);struct sched_entity *se;long queued_delta, runnable_delta, idle_delta, dequeue =1 ; -long rq_h_nr_queued = rq->cfs.h_nr_queued;raw_spin_lock (&cfs_b->lock);/* This will start the period timer if necessary */
@@ -5970,10 +5969,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)/* At this point se is NULL and we are at root level*/ sub_nr_running (rq, queued_delta); - -/* Stop the fair server if throttling resulted in no runnable tasks */ -if (rq_h_nr_queued && !rq->cfs.h_nr_queued) -dl_server_stop (&rq->fair_server); done:/* * Note: distribution will already see us throttled via the
@@ -7067,7 +7062,6 @@ static void set_next_buddy(struct sched_entity *se);static int dequeue_entities (struct rq *rq,struct sched_entity *se,int flags) {bool was_sched_idle =sched_idle_rq (rq); -int rq_h_nr_queued = rq->cfs.h_nr_queued;bool task_sleep = flags &DEQUEUE_SLEEP ;bool task_delayed = flags &DEQUEUE_DELAYED ;struct task_struct *p =NULL ;
@@ -7151,9 +7145,6 @@ static int dequeue_entities(struct rq *rq, struct sched_entity *se, int flags)sub_nr_running (rq, h_nr_queued); -if (rq_h_nr_queued && !rq->cfs.h_nr_queued) -dl_server_stop (&rq->fair_server); -/* balance early to pull high priority tasks */ if (unlikely (!was_sched_idle &&sched_idle_rq (rq))) rq->next_balance = jiffies;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/480 fbcon: Fix outdated registered_fb reference in comment
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shixiong Ou <[email protected]>
[ Upstream commit 0f168e7be696a17487e83d1d47e5a408a181080f ]
The variable was renamed to fbcon_registered_fb, but this comment was not updated along with the change. Correct it to avoid confusion.
--- drivers/video/fbdev/core/fbcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +2 -2
@@ -952,13 +952,13 @@ static const char *fbcon_startup(void)int rows, cols;/* -* If num_registered_fb is zero, this is a call for the dummy part. +* If fbcon_num_registered_fb is zero, this is a call for the dummy part. * The frame buffer devices weren't initialized yet. */ if (!fbcon_num_registered_fb || info_idx ==-1 )return display_desc;/* -* Instead of blindly using registered_fb[0], we use info_idx, set by +* Instead of blindly using fbcon_registered_fb[0], we use info_idx, set by * fbcon_fb_registered(); */ info = fbcon_registered_fb[info_idx];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/480 netfilter: nf_tables: Drop dead code from fill_*_info routines
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit 8080357a8c6cf4905bbd8969412c19d34be3395e ]
This practically reverts commit 28339b21a365 ("netfilter: nf_tables: do not send complete notification of deletions"): The feature was never effective, due to prior modification of 'event' variable the conditional early return never happened.
User space also relies upon the current behaviour, so better reintroduce the shortened deletion notifications once it is fixed.
--- net/netfilter/nf_tables_api.c | 25 ------------------------- 1 file changed, 25 deletions(-)
net/netfilter/nf_tables_api.c +0 -25
@@ -1130,11 +1130,6 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, NFTA_TABLE_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELTABLE ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_TABLE_FLAGS ,htonl (table->flags &NFT_TABLE_F_MASK ))) goto nla_put_failure;
@@ -1993,11 +1988,6 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, NFTA_CHAIN_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELCHAIN && !hook_list) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nft_is_base_chain (chain)) {const struct nft_base_chain *basechain =nft_base_chain (chain);struct nft_stats __percpu *stats;
@@ -4788,11 +4778,6 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, NFTA_SET_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELSET ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (set->flags !=0 )if (nla_put_be32 (skb,NFTA_SET_FLAGS ,htonl (set->flags))) goto nla_put_failure;
@@ -8276,11 +8261,6 @@ static int nf_tables_fill_obj_info(struct sk_buff *skb, struct net *net, NFTA_OBJ_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELOBJ ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_OBJ_TYPE ,htonl (obj->ops->type->type)) ||nla_put_be32 (skb,NFTA_OBJ_USE ,htonl (obj->use)) ||nft_object_dump (skb,NFTA_OBJ_DATA , obj, reset))
@@ -9298,11 +9278,6 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net, NFTA_FLOWTABLE_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELFLOWTABLE && !hook_list) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_FLOWTABLE_USE ,htonl (flowtable->use)) ||nla_put_be32 (skb,NFTA_FLOWTABLE_FLAGS ,htonl (flowtable->data.flags))) goto nla_put_failure;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/480 netfilter: nf_tables: adjust lockdep assertions handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 8df1b40de76979bb8e975201d07b71103d5de820 ]
It's needed to check the return value of lockdep_commit_lock_is_held(), otherwise there's no point in this assertion as it doesn't print any debug information on itself.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +2 -2
@@ -3981,7 +3981,7 @@ void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule)/* can only be used if rule is no longer visible to dumps */ static void nf_tables_rule_release (const struct nft_ctx *ctx,struct nft_rule *rule) { -lockdep_commit_lock_is_held (ctx->net); +WARN_ON_ONCE (!lockdep_commit_lock_is_held (ctx->net));nft_rule_expr_deactivate (ctx, rule,NFT_TRANS_RELEASE );nf_tables_rule_destroy (ctx, rule);
@@ -5770,7 +5770,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,struct nft_set_binding *binding, enum nft_trans_phase phase) { - lockdep_commit_lock_is_held(ctx->net); + WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net));switch (phase) {case NFT_TRANS_PREPARE_ERROR :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/480 arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Korsnes <[email protected]>
[ Upstream commit 75cd37c5f28b85979fd5a65174013010f6b78f27 ]
This option was removed from the Kconfig in commit 8c710f75256b ("net/sched: Retire tcindex classifier") but it was not removed from the defconfigs.
--- arch/powerpc/configs/ppc6xx_defconfig | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/configs/ppc6xx_defconfig +0 -1
@@ -253,7 +253,6 @@ CONFIG_NET_SCH_DSMARK=m CONFIG_NET_SCH_NETEM=m CONFIG_NET_SCH_INGRESS=m CONFIG_NET_CLS_BASIC=m -CONFIG_NET_CLS_TCINDEX=m CONFIG_NET_CLS_ROUTE4=m CONFIG_NET_CLS_FW=m CONFIG_NET_CLS_U32=m
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/480 um: rtc: Avoid shadowing err in uml_rtc_start()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 4c916e3b224a02019b3cc3983a15f32bfd9a22df ]
Remove the declaration of 'err' inside the 'if (timetravel)' block, as it would otherwise be unavailable outside that block, potentially leading to uml_rtc_start() returning an uninitialized value.
--- arch/um/drivers/rtc_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/rtc_user.c +1 -1
@@ -28,7 +28,7 @@ int uml_rtc_start(bool timetravel)int err;if (timetravel) { -int err =os_pipe (uml_rtc_irq_fds,1 ,1 ); + err =os_pipe (uml_rtc_irq_fds,1 ,1 );if (err) goto fail; }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/480 iommu/amd: Enable PASID and ATS capabilities in the correct order
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Easwar Hariharan <[email protected]>
[ Upstream commit c694bc8b612ddd0dd70e122a00f39cb1e2e6927f ]
Per the PCIe spec, behavior of the PASID capability is undefined if the value of the PASID Enable bit changes while the Enable bit of the function's ATS control register is Set. Unfortunately, pdev_enable_caps() does exactly that by ordering enabling ATS for the device before enabling PASID.
--- drivers/iommu/amd/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/iommu.c +1 -1
@@ -634,8 +634,8 @@ static inline void pdev_disable_cap_pasid(struct pci_dev *pdev)static void pdev_enable_caps (struct pci_dev *pdev) { -pdev_enable_cap_ats (pdev);pdev_enable_cap_pasid (pdev); +pdev_enable_cap_ats (pdev);pdev_enable_cap_pri (pdev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/480 net/sched: Restrict conditions for adding duplicating netems to qdisc tree
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Liu <[email protected]>
[ Upstream commit ec8e0e3d7adef940cdf9475e2352c0680189d14e ]
netem_enqueue's duplication prevention logic breaks when a netem resides in a qdisc tree with other netems - this can lead to a soft lockup and OOM loop in netem_dequeue, as seen in [1]. Ensure that a duplicating netem cannot exist in a tree with other netems.
Previous approaches suggested in discussions in chronological order:
1) Track duplication status or ttl in the sk_buff struct. Considered too specific a use case to extend such a struct, though this would be a resilient fix and address other previous and potential future DOS bugs like the one described in loopy fun [2].
2) Restrict netem_enqueue recursion depth like in act_mirred with a per cpu variable. However, netem_dequeue can call enqueue on its child, and the depth restriction could be bypassed if the child is a netem.
3) Use the same approach as in 2, but add metadata in netem_skb_cb to handle the netem_dequeue case and track a packet's involvement in duplication. This is an overly complex approach, and Jamal notes that the skb cb can be overwritten to circumvent this safeguard.
4) Prevent the addition of a netem to a qdisc tree if its ancestral path contains a netem. However, filters and actions can cause a packet to change paths when re-enqueued to the root from netem duplication, leading us to the current solution: prevent a duplicating netem from inhabiting the same tree as other netems.
[1] https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/
[2] https://lwn.net/Articles/719297/
--- net/sched/sch_netem.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
net/sched/sch_netem.c +40 -0
@@ -973,6 +973,41 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,return 0 ; } +static const struct Qdisc_class_ops netem_class_ops; + +static int check_netem_in_tree (struct Qdisc *sch,bool duplicates, +struct netlink_ext_ack *extack) +{ +struct Qdisc *root, *q; +unsigned int i; + + root =qdisc_root_sleeping (sch); + +if (sch != root && root->ops->cl_ops == &netem_class_ops) { +if (duplicates || + ((struct netem_sched_data *)qdisc_priv (root))->duplicate) + goto err; + } + +if (!qdisc_dev (root)) +return 0 ; + +hash_for_each (qdisc_dev (root)->qdisc_hash, i, q, hash) { +if (sch != q && q->ops->cl_ops == &netem_class_ops) { +if (duplicates || + ((struct netem_sched_data *)qdisc_priv (q))->duplicate) + goto err; + } + } + +return 0 ; + +err: +NL_SET_ERR_MSG (extack, +"netem: cannot mix duplicating netems with other netems in tree" ); +return -EINVAL ; +} +/* Parse netlink message to set options */ static int netem_change (struct Qdisc *sch,struct nlattr *opt,struct netlink_ext_ack *extack)
@@ -1031,6 +1066,11 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, q->gap = qopt->gap; q->counter =0 ; q->loss = qopt->loss; + + ret =check_netem_in_tree (sch, qopt->duplicate, extack); +if (ret) + goto unlock; + q->duplicate = qopt->duplicate;/* for compatibility with earlier versions.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/480 net_sched: act_ctinfo: use atomic64_t for three counters
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d300335b4e18672913dd792ff9f49e6cccf41d26 ]
Commit 21c167aa0ba9 ("net/sched: act_ctinfo: use percpu stats") missed that stats_dscp_set, stats_dscp_error and stats_cpmark_set might be written (and read) locklessly.
Use atomic64_t for these three fields, I doubt act_ctinfo is used heavily on big SMP hosts anyway.
--- include/net/tc_act/tc_ctinfo.h | 6 +++--- net/sched/act_ctinfo.c | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-)
include/net/tc_act/tc_ctinfo.h +3 -3
@@ -18,9 +18,9 @@ struct tcf_ctinfo_params {struct tcf_ctinfo {struct tc_action common;struct tcf_ctinfo_params __rcu *params; -u64 stats_dscp_set; -u64 stats_dscp_error; -u64 stats_cpmark_set; +atomic64_t stats_dscp_set; +atomic64_t stats_dscp_error; +atomic64_t stats_cpmark_set; };enum {
net/sched/act_ctinfo.c +11 -8
@@ -44,9 +44,9 @@ static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca,ipv4_change_dsfield (ip_hdr (skb),INET_ECN_MASK , newdscp); - ca->stats_dscp_set++; +atomic64_inc (&ca->stats_dscp_set); }else { - ca->stats_dscp_error++; +atomic64_inc (&ca->stats_dscp_error); } }break ;
@@ -57,9 +57,9 @@ static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca,ipv6_change_dsfield (ipv6_hdr (skb),INET_ECN_MASK , newdscp); - ca->stats_dscp_set++; +atomic64_inc (&ca->stats_dscp_set); }else { - ca->stats_dscp_error++; +atomic64_inc (&ca->stats_dscp_error); } }break ;
@@ -72,7 +72,7 @@ static void tcf_ctinfo_cpmark_set(struct nf_conn *ct, struct tcf_ctinfo *ca,struct tcf_ctinfo_params *cp, struct sk_buff *skb) { - ca->stats_cpmark_set++; + atomic64_inc(&ca->stats_cpmark_set); skb->mark =READ_ONCE (ct->mark) & cp->cpmarkmask; }
@@ -323,15 +323,18 @@ static int tcf_ctinfo_dump(struct sk_buff *skb, struct tc_action *a, }if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_DSCP_SET , - ci->stats_dscp_set,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_dscp_set), +TCA_CTINFO_PAD )) goto nla_put_failure;if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_DSCP_ERROR , - ci->stats_dscp_error,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_dscp_error), +TCA_CTINFO_PAD )) goto nla_put_failure;if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_CPMARK_SET , - ci->stats_cpmark_set,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_cpmark_set), +TCA_CTINFO_PAD )) goto nla_put_failure;spin_unlock_bh (&ci->tcf_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/480 RDMA/mlx5: Fix UMR modifying of mkey page size
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Srouji <[email protected]>
[ Upstream commit c4f96972c3c206ac8f6770b5ecd5320b561d0058 ]
When changing the page size on an mkey, the driver needs to set the appropriate bits in the mkey mask to indicate which fields are being modified.
The 6th bit of a page size in mlx5 driver is considered an extension, and this bit has a dedicated capability and mask bits.
Previously, the driver was not setting this mask in the mkey mask when performing page size changes, regardless of its hardware support, potentially leading to an incorrect page size updates.
This fixes the issue by setting the relevant bit in the mkey mask when performing page size changes on an mkey and the 6th bit of this field is supported by the hardware.
--- drivers/infiniband/hw/mlx5/umr.c | 6 ++++-- include/linux/mlx5/device.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/umr.c +4 -2
@@ -32,13 +32,15 @@ static __be64 get_umr_disable_mr_mask(void)return cpu_to_be64 (result); } -static __be64 get_umr_update_translation_mask (void ) +static __be64 get_umr_update_translation_mask (struct mlx5_ib_dev *dev) {u64 result; result =MLX5_MKEY_MASK_LEN |MLX5_MKEY_MASK_PAGE_SIZE |MLX5_MKEY_MASK_START_ADDR ; +if (MLX5_CAP_GEN_2 (dev->mdev, umr_log_entity_size_5)) + result |=MLX5_MKEY_MASK_PAGE_SIZE_5 ;return cpu_to_be64 (result); }
@@ -654,7 +656,7 @@ static void mlx5r_umr_final_update_xlt(struct mlx5_ib_dev *dev, flags &MLX5_IB_UPD_XLT_ENABLE || flags &MLX5_IB_UPD_XLT_ADDR ;if (update_translation) { - wqe->ctrl_seg.mkey_mask |=get_umr_update_translation_mask (); + wqe->ctrl_seg.mkey_mask |=get_umr_update_translation_mask (dev);if (!mr->ibmr.length)MLX5_SET (mkc, &wqe->mkey_seg, length64,1 ); }
include/linux/mlx5/device.h +1 -0
@@ -280,6 +280,7 @@ enum {MLX5_MKEY_MASK_SMALL_FENCE =1ull <<23 ,MLX5_MKEY_MASK_RELAXED_ORDERING_WRITE =1ull <<25 ,MLX5_MKEY_MASK_FREE =1ull <<29 , +MLX5_MKEY_MASK_PAGE_SIZE_5 =1ull <<42 , MLX5_MKEY_MASK_RELAXED_ORDERING_READ = 1ull << 47, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/480 xen: fix UAF in dmabuf_exp_from_pages()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 532c8b51b3a8676cbf533a291f8156774f30ea87 ]
[dma_buf_fd() fixes; no preferences regarding the tree it goes through - up to xen folks]
As soon as we'd inserted a file reference into descriptor table, another thread could close it. That's fine for the case when all we are doing is returning that descriptor to userland (it's a race, but it's a userland race and there's nothing the kernel can do about it). However, if we follow fd_install() with any kind of access to objects that would be destroyed on close (be it the struct file itself or anything destroyed by its ->release()), we have a UAF.
dma_buf_fd() is a combination of reserving a descriptor and fd_install(). gntdev dmabuf_exp_from_pages() calls it and then proceeds to access the objects destroyed on close - starting with gntdev_dmabuf itself.
Fix that by doing reserving descriptor before anything else and do fd_install() only when everything had been set up.
Message-ID: <20250712050916.GY1880847@ZenIV>
--- drivers/xen/gntdev-dmabuf.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
drivers/xen/gntdev-dmabuf.c +10 -18
@@ -357,8 +357,11 @@ struct gntdev_dmabuf_export_args {static int dmabuf_exp_from_pages (struct gntdev_dmabuf_export_args *args) {DEFINE_DMA_BUF_EXPORT_INFO (exp_info); -struct gntdev_dmabuf *gntdev_dmabuf; -int ret; + struct gntdev_dmabuf *gntdev_dmabuf __free(kfree) = NULL; +CLASS (get_unused_fd, ret)(O_CLOEXEC ); + +if (ret <0 ) +return ret; gntdev_dmabuf =kzalloc (sizeof (*gntdev_dmabuf),GFP_KERNEL );if (!gntdev_dmabuf)
@@ -383,32 +386,21 @@ static int dmabuf_exp_from_pages(struct gntdev_dmabuf_export_args *args) exp_info.priv = gntdev_dmabuf; gntdev_dmabuf->dmabuf =dma_buf_export (&exp_info); -if (IS_ERR (gntdev_dmabuf->dmabuf)) { - ret =PTR_ERR (gntdev_dmabuf->dmabuf); - gntdev_dmabuf->dmabuf =NULL ; - goto fail; - } - - ret =dma_buf_fd (gntdev_dmabuf->dmabuf,O_CLOEXEC ); -if (ret <0 ) - goto fail; +if (IS_ERR (gntdev_dmabuf->dmabuf)) +return PTR_ERR (gntdev_dmabuf->dmabuf); gntdev_dmabuf->fd = ret; args->fd = ret;pr_debug ("Exporting DMA buffer with fd %d\n" , ret); +get_file (gntdev_dmabuf->priv->filp);mutex_lock (&args->dmabuf_priv->lock);list_add (&gntdev_dmabuf->next, &args->dmabuf_priv->exp_list);mutex_unlock (&args->dmabuf_priv->lock); -get_file (gntdev_dmabuf->priv->filp); -return 0 ; -fail: -if (gntdev_dmabuf->dmabuf) -dma_buf_put (gntdev_dmabuf->dmabuf); -kfree (gntdev_dmabuf); -return ret; +fd_install (take_fd (ret),no_free_ptr (gntdev_dmabuf)->dmabuf->file); +return 0 ; } static struct gntdev_grant_map *
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/480 sched/deadline: Initialize dl_servers after SMP
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
[ Upstream commit 9f239df55546ee1d28f0976130136ffd1cad0fd7 ]
dl-servers are currently initialized too early at boot when CPUs are not fully up (only boot CPU is). This results in miscalculation of per runqueue DEADLINE variables like extra_bw (which needs a stable CPU count).
Move initialization of dl-servers later on after SMP has been initialized and CPUs are all online, so that CPU count is stable and DEADLINE variables can be computed correctly.
--- kernel/sched/core.c | 2 ++ kernel/sched/deadline.c | 48 +++++++++++++++++++++++++---------------- kernel/sched/sched.h | 1 + 3 files changed, 33 insertions(+), 18 deletions(-)
kernel/sched/core.c +2 -0
@@ -8501,6 +8501,8 @@ void __init sched_init_smp(void)init_sched_rt_class ();init_sched_dl_class (); +sched_init_dl_servers (); + sched_smp_initialized = true; }
kernel/sched/deadline.c +30 -18
72 lines not on this page · raw message
kernel/sched/sched.h +1 -0
@@ -384,6 +384,7 @@ extern void dl_server_stop(struct sched_dl_entity *dl_se);extern void dl_server_init (struct sched_dl_entity *dl_se,struct rq *rq,dl_server_has_tasks_f has_tasks,dl_server_pick_f pick_task); +extern void sched_init_dl_servers (void );extern void dl_server_update_idle_time (struct rq *rq,struct task_struct *p);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/480 sched/deadline: Reset extra_bw to max_bw when clearing root domains
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
[ Upstream commit fcc9276c4d331cd1fe9319d793e80b02e09727f5 ]
dl_clear_root_domain() doesn't take into account the fact that per-rq extra_bw variables retain values computed before root domain changes, resulting in broken accounting.
Fix it by resetting extra_bw to max_bw before restoring back dl-servers contributions.
--- kernel/sched/deadline.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/sched/deadline.c +7 -0
@@ -3007,7 +3007,14 @@ void dl_clear_root_domain(struct root_domain *rd)int i;guard (raw_spinlock_irqsave)(&rd->dl_bw.lock); + +/* +* Reset total_bw to zero and extra_bw to max_bw so that next +* loop will add dl-servers contributions back properly, +*/ rd->dl_bw.total_bw =0 ; +for_each_cpu (i, rd->span) +cpu_rq (i)->dl.extra_bw =cpu_rq (i)->dl.max_bw;/* * dl_servers are not tasks. Since dl_add_task_root_domain ignores
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/480 iommu/vt-d: Do not wipe out the page table NID when devices detach
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 5c3687d5789cfff8d285a2c76bceb47f145bf01f ]
The NID is used to control which NUMA node memory for the page table is allocated it from. It should be a permanent property of the page table when it was allocated and not change during attach/detach of devices.
--- drivers/iommu/intel/iommu.c | 1 - 1 file changed, 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -1
@@ -1440,7 +1440,6 @@ void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu)if (--info->refcnt ==0 ) {clear_bit (info->did, iommu->domain_ids);xa_erase (&domain->iommu_array, iommu->seq_id); - domain->nid =NUMA_NO_NODE ;kfree (info); }spin_unlock (&iommu->lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/480 iommu/arm-smmu: disable PRR on SM8250
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit b9bb7e814cd0c3633791327a96749a1f9b7f3ef4 ]
On SM8250 / QRB5165-RB5 using PRR bits resets the device, most likely because of the hyp limitations. Disable PRR support on that platform.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +2 -1
@@ -342,7 +342,8 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, priv->set_prr_addr =NULL ;if (of_device_is_compatible (np,"qcom,smmu-500" ) && -of_device_is_compatible (np,"qcom,adreno-smmu" )) { + !of_device_is_compatible (np,"qcom,sm8250-smmu-500" ) && +of_device_is_compatible (np,"qcom,adreno-smmu" )) { priv->set_prr_bit = qcom_adreno_smmu_set_prr_bit; priv->set_prr_addr = qcom_adreno_smmu_set_prr_addr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/480 xen/gntdev: remove struct gntdev_copy_batch from stack
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 70045cf6593cbf0740956ea9b7b4269142c6ee38 ]
When compiling the kernel with LLVM, the following warning was issued:
drivers/xen/gntdev.c:991: warning: stack frame size (1160) exceeds limit (1024) in function 'gntdev_ioctl'
The main reason is struct gntdev_copy_batch which is located on the stack and has a size of nearly 1kb.
For performance reasons it shouldn't by just dynamically allocated instead, so allocate a new instance when needed and instead of freeing it put it into a list of free structs anchored in struct gntdev_priv.
Message-ID: <[email protected]>
--- drivers/xen/gntdev-common.h | 4 +++ drivers/xen/gntdev.c | 71 ++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 21 deletions(-)
drivers/xen/gntdev-common.h +4 -0
@@ -26,6 +26,10 @@ struct gntdev_priv {/* lock protects maps and freeable_maps. */ struct mutex lock; +/* Free instances of struct gntdev_copy_batch. */ +struct gntdev_copy_batch *batch; +struct mutex batch_lock; +#ifdef CONFIG_XEN_GRANT_DMA_ALLOC /* Device for which DMA memory is allocated. */ struct device *dma_dev;
drivers/xen/gntdev.c +50 -21
127 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/480 tcp: call tcp_measure_rcv_mss() for ooo packets
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 38d7e444336567bae1c7b21fc18b7ceaaa5643a0 ]
tcp_measure_rcv_mss() is used to update icsk->icsk_ack.rcv_mss (tcpi_rcv_mss in tcp_info) and tp->scaling_ratio.
Calling it from tcp_data_queue_ofo() makes sure these fields are updated, and permits a better tuning of sk->sk_rcvbuf, in the case a new flow receives many ooo packets.
--- net/ipv4/tcp_input.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp_input.c +1 -0
@@ -5056,6 +5056,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)return ; } +tcp_measure_rcv_mss (sk, skb);/* Disable header prediction. */ tp->pred_flags =0 ;inet_csk_schedule_ack (sk);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/480 wifi: rtl8xxxu: Fix RX skb size for aggregation disabled
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kaistra <[email protected]>
[ Upstream commit d76a1abcf57734d2bcd4a7ec051617edd4513d7f ]
Commit 1e5b3b3fe9e0 ("rtl8xxxu: Adjust RX skb size to include space for phystats") increased the skb size when aggregation is enabled but decreased it for the aggregation disabled case.
As a result, if a frame near the maximum size is received, rtl8xxxu_rx_complete() is called with status -EOVERFLOW and then the driver starts to malfunction and no further communication is possible.
Restore the skb size in the aggregation disabled case.
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/core.c +1 -1
@@ -6617,7 +6617,7 @@ static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, skb_size = fops->rx_agg_buf_size; skb_size += (rx_desc_sz +sizeof (struct rtl8723au_phy_stats )); }else { - skb_size =IEEE80211_MAX_FRAME_LEN ; + skb_size =IEEE80211_MAX_FRAME_LEN + rx_desc_sz; } skb =__netdev_alloc_skb (NULL , skb_size,GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/480 wifi: rtw88: Fix macid assigned to TDLS station
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 526b000991b557c40ea53e64ba24bb9e0fff0071 ]
When working in station mode, TDLS peers are assigned macid 0, even though 0 was already assigned to the AP. This causes the connection with the AP to stop working after the TDLS connection is torn down.
Assign the next available macid to TDLS peers, same as client stations in AP mode.
--- drivers/net/wireless/realtek/rtw88/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +2 -2
@@ -349,7 +349,7 @@ int rtw_sta_add(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;int i; -if (vif->type ==NL80211_IFTYPE_STATION ) { +if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) { si->mac_id = rtwvif->mac_id; }else { si->mac_id =rtw_acquire_macid (rtwdev);
@@ -386,7 +386,7 @@ void rtw_sta_remove(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,cancel_work_sync (&si->rc_work); -if (vif->type !=NL80211_IFTYPE_STATION ) +if (vif->type !=NL80211_IFTYPE_STATION || sta->tdls)rtw_release_macid (rtwdev, si->mac_id);if (fw_exist)rtw_fw_media_status_report (rtwdev, si->mac_id, false);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/480 mwl8k: Add missing check after DMA map
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 50459501b9a212dbe7a673727589ee105a8a9954 ]
The DMA map functions can fail and should be tested for errors. If the mapping fails, unmap and return an error.
--- drivers/net/wireless/marvell/mwl8k.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/marvell/mwl8k.c +4 -0
@@ -1227,6 +1227,10 @@ static int rxq_refill(struct ieee80211_hw *hw, int index, int limit) addr =dma_map_single (&priv->pdev->dev, skb->data,MWL8K_RX_MAXSZ ,DMA_FROM_DEVICE ); +if (dma_mapping_error (&priv->pdev->dev, addr)) { +kfree_skb (skb); +break ; + } rxq->rxd_count++; rx = rxq->tail++;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/480 wifi: ath12k: Use HTT_TCL_METADATA_VER_V1 in FTM mode
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaradhana Sahu <[email protected]>
[ Upstream commit 66b3ebc77d23d6574a965bdbfe41de8aeb7f384e ]
Currently host sends HTT_TCL_METADATA_VER_V2 to the firmware regardless of the operating mode (Mission or FTM).
Firmware expects additional software information (like peer ID, vdev ID, and link ID) in Tx packets when HTT_TCL_METADATA_VER_V2 is set. However, in FTM (Factory Test Mode) mode, no vdev is created on the host side (this is expected). As a result, the firmware fails to find the expected vdev during packet processing and ends up dropping packets.
To fix this, send HTT_TCL_METADATA_VER_V1 in FTM mode because FTM mode doesn't support HTT_TCL_METADATA_VER_V2.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp.h | 1 + drivers/net/wireless/ath/ath12k/dp_tx.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp.h +1 -0
@@ -425,6 +425,7 @@ enum htt_h2t_msg_type { };#define HTT_VER_REQ_INFO_MSG_ID GENMASK(7, 0) +#define HTT_OPTION_TCL_METADATA_VER_V1 1#define HTT_OPTION_TCL_METADATA_VER_V2 2#define HTT_OPTION_TAG GENMASK(7, 0)#define HTT_OPTION_LEN GENMASK(15, 8)
drivers/net/wireless/ath/ath12k/dp_tx.c +4 -1
@@ -1107,6 +1107,7 @@ int ath12k_dp_tx_htt_h2t_ver_req_msg(struct ath12k_base *ab)struct sk_buff *skb;struct htt_ver_req_cmd *cmd;int len =sizeof (*cmd); +u32 metadata_version;int ret;init_completion (&dp->htt_tgt_version_received);
@@ -1119,12 +1120,14 @@ int ath12k_dp_tx_htt_h2t_ver_req_msg(struct ath12k_base *ab) cmd = (struct htt_ver_req_cmd *)skb->data; cmd->ver_reg_info =le32_encode_bits (HTT_H2T_MSG_TYPE_VERSION_REQ ,HTT_OPTION_TAG ); + metadata_version = ath12k_ftm_mode ?HTT_OPTION_TCL_METADATA_VER_V1 : +HTT_OPTION_TCL_METADATA_VER_V2 ; cmd->tcl_metadata_version =le32_encode_bits (HTT_TAG_TCL_METADATA_VERSION ,HTT_OPTION_TAG ) |le32_encode_bits (HTT_TCL_METADATA_VER_SZ ,HTT_OPTION_LEN ) | -le32_encode_bits (HTT_OPTION_TCL_METADATA_VER_V2 , +le32_encode_bits (metadata_version,HTT_OPTION_VALUE ); ret =ath12k_htc_send (&ab->htc, dp->eid, skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/480 wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 65c12b104cb942d588a1a093acc4537fb3d3b129 ]
ath11k_mac_disable_peer_fixed_rate() is passed as the iterator to ieee80211_iterate_stations_atomic(). Note in this case the iterator is required to be atomic, however ath11k_mac_disable_peer_fixed_rate() does not follow it as it might sleep. Consequently below warning is seen:
BUG: sleeping function called from invalid context at wmi.c:304 Call Trace: <TASK> dump_stack_lvl __might_resched.cold ath11k_wmi_cmd_send ath11k_wmi_set_peer_param ath11k_mac_disable_peer_fixed_rate ieee80211_iterate_stations_atomic ath11k_mac_op_set_bitrate_mask.cold
Change to ieee80211_iterate_stations_mtx() to fix this issue.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
--- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +6 -6
@@ -8734,9 +8734,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, arvif->vdev_id, ret);return ret; } -ieee80211_iterate_stations_atomic (ar->hw, - ath11k_mac_disable_peer_fixed_rate, - arvif); +ieee80211_iterate_stations_mtx (ar->hw, + ath11k_mac_disable_peer_fixed_rate, + arvif); }else if (ath11k_mac_bitrate_mask_get_single_nss (ar, arvif, band, mask, &single_nss)) { rate =WMI_FIXED_RATE_NONE ;
@@ -8803,9 +8803,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, }mutex_lock (&ar->conf_mutex); -ieee80211_iterate_stations_atomic (ar->hw, - ath11k_mac_disable_peer_fixed_rate, - arvif); +ieee80211_iterate_stations_mtx (ar->hw, + ath11k_mac_disable_peer_fixed_rate, + arvif); arvif->bitrate_mask = *mask; ieee80211_iterate_stations_atomic(ar->hw,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/480 drm/amdgpu/gfx9: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 730ea5074dac1b105717316be5d9c18b09829385 ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -7299,8 +7299,8 @@ static int gfx_v9_0_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r) {DRM_ERROR ("fail to remap queue\n" );return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/480 drm/amdgpu/gfx9.4.3: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 08f116c59310728ea8b7e9dc3086569006c861cf ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +1 -2
@@ -3572,9 +3572,8 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r) {dev_err (adev->dev,"fail to remap queue\n" );return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/480 drm/amdgpu/gfx10: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit a4b2ba8f631d3e44b30b9b46ee290fbfe608b7d0 ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -4
@@ -9567,9 +9567,8 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring, kiq->pmf->kiq_unmap_queues (kiq_ring, ring,RESET_QUEUES ,0 ,0 );amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r)return r;
@@ -9605,9 +9604,8 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r)return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/480 selftests/bpf: fix implementation of smp_mb()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 0769857a07b4451a1dc1c3ad1f1c86a6f4ce136a ]
As BPF doesn't include any barrier instructions, smp_mb() is implemented by doing a dummy value returning atomic operation. Such an operation acts a full barrier as enforced by LKMM and also by the work in progress BPF memory model.
If the returned value is not used, clang[1] can optimize the value returning atomic instruction in to a normal atomic instruction which provides no ordering guarantees.
Mark the variable as volatile so the above optimization is never performed and smp_mb() works as expected.
[1] https://godbolt.org/z/qzze7bG6z
--- tools/testing/selftests/bpf/bpf_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_atomic.h +1 -1
@@ -61,7 +61,7 @@ extern bool CONFIG_X86_64 __kconfig __weak;#define smp_mb () \ ({ \ - unsigned long __val; \ + volatile unsigned long __val; \ __sync_fetch_and_add(&__val, 0); \ })
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/480 iommu/amd: Fix geometry.aperture_end for V2 tables
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 8637afa79cfa6123f602408cfafe8c9a73620ff1 ]
The AMD IOMMU documentation seems pretty clear that the V2 table follows the normal CPU expectation of sign extension. This is shown in
Figure 25: AMD64 Long Mode 4-Kbyte Page Address Translation
Where bits Sign-Extend [63:57] == [56]. This is typical for x86 which would have three regions in the page table: lower, non-canonical, upper.
The manual describes that the V1 table does not sign extend in section 2.2.4 Sharing AMD64 Processor and IOMMU Page Tables GPA-to-SPA
Further, Vasant has checked this and indicates the HW has an addtional behavior that the manual does not yet describe. The AMDv2 table does not have the sign extended behavior when attached to PASID 0, which may explain why this has gone unnoticed.
The iommu domain geometry does not directly support sign extended page tables. The driver should report only one of the lower/upper spaces. Solve this by removing the top VA bit from the geometry to use only the lower space.
This will also make the iommu_domain work consistently on all PASID 0 and PASID != 1.
Adjust dma_max_address() to remove the top VA bit. It now returns:
5 Level:
Before 0x1ffffffffffffff
After 0x0ffffffffffffff
4 Level:
Before 0xffffffffffff
After 0x7fffffffffff
--- drivers/iommu/amd/iommu.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/iommu/amd/iommu.c +15 -2
@@ -2526,8 +2526,21 @@ static inline u64 dma_max_address(enum protection_domain_mode pgtable)if (pgtable ==PD_MODE_V1 )return ~0ULL ; -/* V2 with 4/5 level page table */ -return ((1ULL <<PM_LEVEL_SHIFT (amd_iommu_gpt_level)) -1 ); +/* +* V2 with 4/5 level page table. Note that "2.2.6.5 AMD64 4-Kbyte Page +* Translation" shows that the V2 table sign extends the top of the +* address space creating a reserved region in the middle of the +* translation, just like the CPU does. Further Vasant says the docs are +* incomplete and this only applies to non-zero PASIDs. If the AMDv2 +* page table is assigned to the 0 PASID then there is no sign extension +* check. +* +* Since the IOMMU must have a fixed geometry, and the core code does +* not understand sign extended addressing, we have to chop off the high +* bit to get consistent behavior with attachments of the domain to any +* PASID. +*/ +return ((1ULL << (PM_LEVEL_SHIFT (amd_iommu_gpt_level) -1 )) -1 ); }static bool amd_iommu_hd_support (struct amd_iommu *iommu)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/480 rcu: Fix delayed execution of hurry callbacks
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tze-nan Wu <[email protected]>
[ Upstream commit 463d46044f04013306a4893242f65788b8a16b2e ]
We observed a regression in our customer’s environment after enabling CONFIG_LAZY_RCU. In the Android Update Engine scenario, where ioctl() is used heavily, we found that callbacks queued via call_rcu_hurry (such as percpu_ref_switch_to_atomic_rcu) can sometimes be delayed by up to 5 seconds before execution. This occurs because the new grace period does not start immediately after the previous one completes.
The root cause is that the wake_nocb_gp_defer() function now checks "rdp->nocb_defer_wakeup" instead of "rdp_gp->nocb_defer_wakeup". On CPUs that are not rcuog, "rdp->nocb_defer_wakeup" may always be RCU_NOCB_WAKE_NOT. This can cause "rdp_gp->nocb_defer_wakeup" to be downgraded and the "rdp_gp->nocb_timer" to be postponed by up to 10 seconds, delaying the execution of hurry RCU callbacks.
The trace log of one scenario we encountered is as follow:
// previous GP ends at this point
rcu_preempt [000] d..1. 137.240210: rcu_grace_period: rcu_preempt 8369 end rcu_preempt [000] ..... 137.240212: rcu_grace_period: rcu_preempt 8372 reqwait // call_rcu_hurry enqueues "percpu_ref_switch_to_atomic_rcu", the callback waited on by UpdateEngine update_engine [002] d..1. 137.301593: __call_rcu_common: wyy: unlikely p_ref = 00000000********. lazy = 0 // FirstQ on cpu 2 rdp_gp->nocb_timer is set to fire after 1 jiffy (4ms) // and the rdp_gp->nocb_defer_wakeup is set to RCU_NOCB_WAKE update_engine [002] d..2. 137.301595: rcu_nocb_wake: rcu_preempt 2 FirstQ on cpu2 with rdp_gp (cpu0). // FirstBQ event on cpu2 during the 1 jiffy, make the timer postpond 10 seconds later. // also, the rdp_gp->nocb_defer_wakeup is overwrite to RCU_NOCB_WAKE_LAZY update_engine [002] d..1. 137.301601: rcu_nocb_wake: rcu_preempt 2 WakeEmptyIsDeferred ... ... ... // before the 10 seconds timeout, cpu0 received another call_rcu_hurry // reset the timer to jiffies+1 and set the waketype = RCU_NOCB_WAKE. kworker/u32:0 [000] d..2. 142.557564: rcu_nocb_wake: rcu_preempt 0 FirstQ kworker/u32:0 [000] d..1. 142.557576: rcu_nocb_wake: rcu_preempt 0 WakeEmptyIsDeferred kworker/u32:0 [000] d..1. 142.558296: rcu_nocb_wake: rcu_preempt 0 WakeNot kworker/u32:0 [000] d..1. 142.558562: rcu_nocb_wake: rcu_preempt 0 WakeNot // idle(do_nocb_deferred_wakeup) wake rcuog due to waketype == RCU_NOCB_WAKE <idle> [000] d..1. 142.558786: rcu_nocb_wake: rcu_preempt 0 DoWake <idle> [000] dN.1. 142.558839: rcu_nocb_wake: rcu_preempt 0 DeferredWake rcuog/0 [000] ..... 142.558871: rcu_nocb_wake: rcu_preempt 0 EndSleep rcuog/0 [000] ..... 142.558877: rcu_nocb_wake: rcu_preempt 0 Check // finally rcuog request a new GP at this point (5 seconds after the FirstQ event) rcuog/0 [000] d..2. 142.558886: rcu_grace_period: rcu_preempt 8372 newreq rcu_preempt [001] d..1. 142.559458: rcu_grace_period: rcu_preempt 8373 start ... rcu_preempt [000] d..1. 142.564258: rcu_grace_period: rcu_preempt 8373 end rcuop/2 [000] D..1. 142.566337: rcu_batch_start: rcu_preempt CBs=219 bl=10
// the hurry CB is invoked at this point
rcuop/2 [000] b.... 142.566352: blk_queue_usage_counter_release: wyy: wakeup. p_ref = 00000000********.
This patch changes the condition to check "rdp_gp->nocb_defer_wakeup" in the lazy path. This prevents an already scheduled "rdp_gp->nocb_timer" from being postponed and avoids overwriting "rdp_gp->nocb_defer_wakeup" when it is not RCU_NOCB_WAKE_NOT.
--- kernel/rcu/tree_nocb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_nocb.h +1 -1
@@ -276,7 +276,7 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,* callback storms, no need to wake up too early. */ if (waketype ==RCU_NOCB_WAKE_LAZY && - rdp->nocb_defer_wakeup ==RCU_NOCB_WAKE_NOT ) { + rdp_gp->nocb_defer_wakeup ==RCU_NOCB_WAKE_NOT ) {mod_timer (&rdp_gp->nocb_timer, jiffies +rcu_get_jiffies_lazy_flush ());WRITE_ONCE (rdp_gp->nocb_defer_wakeup, waketype); }else if (waketype ==RCU_NOCB_WAKE_BYPASS ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/480 wifi: mac80211: reject TDLS operations when station is not associated
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moon Hee Lee <[email protected]>
[ Upstream commit 16ecdab5446f15a61ec88eb0d23d25d009821db0 ]
syzbot triggered a WARN in ieee80211_tdls_oper() by sending NL80211_TDLS_ENABLE_LINK immediately after NL80211_CMD_CONNECT, before association completed and without prior TDLS setup.
This left internal state like sdata->u.mgd.tdls_peer uninitialized, leading to a WARN_ON() in code paths that assumed it was valid.
Reject the operation early if not in station mode or not associated.
--- net/mac80211/tdls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tdls.c +1 -1
@@ -1422,7 +1422,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,if (!(wiphy->flags &WIPHY_FLAG_SUPPORTS_TDLS ))return -EOPNOTSUPP ; -if (sdata->vif.type !=NL80211_IFTYPE_STATION ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION || !sdata->vif.cfg.assoc)return -EINVAL ;switch (oper) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/480 wifi: plfxlc: Fix error handling in usb driver probe
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 3fe79a25c3cd54d25d30bc235c0c57f8a123d9d5 ]
If probe fails before ieee80211_register_hw() is successfully done, ieee80211_unregister_hw() will be called anyway. This may lead to various bugs as the implementation of ieee80211_unregister_hw() assumes that ieee80211_register_hw() has been called.
Divide error handling section into relevant subsections, so that ieee80211_unregister_hw() is called only when it is appropriate. Correct the order of the calls: ieee80211_unregister_hw() should go before plfxlc_mac_release(). Also move ieee80211_free_hw() to plfxlc_mac_release() as it supposed to be the opposite to plfxlc_mac_alloc_hw() that calls ieee80211_alloc_hw().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/purelifi/plfxlc/mac.c | 11 ++++---- drivers/net/wireless/purelifi/plfxlc/mac.h | 2 +- drivers/net/wireless/purelifi/plfxlc/usb.c | 29 +++++++++++----------- 3 files changed, 21 insertions(+), 21 deletions(-)
drivers/net/wireless/purelifi/plfxlc/mac.c +6 -5
@@ -99,11 +99,6 @@ int plfxlc_mac_init_hw(struct ieee80211_hw *hw)return r; } -void plfxlc_mac_release (struct plfxlc_mac *mac) -{ -plfxlc_chip_release (&mac->chip); -} -int plfxlc_op_start (struct ieee80211_hw *hw) {plfxlc_hw_mac (hw)->chip.usb.initialized =1 ;
@@ -755,3 +750,9 @@ struct ieee80211_hw *plfxlc_mac_alloc_hw(struct usb_interface *intf)SET_IEEE80211_DEV (hw, &intf->dev);return hw; } + +void plfxlc_mac_release_hw (struct ieee80211_hw *hw) +{ +plfxlc_chip_release (&plfxlc_hw_mac (hw)->chip); +ieee80211_free_hw (hw); +}
drivers/net/wireless/purelifi/plfxlc/mac.h +1 -1
@@ -168,7 +168,7 @@ static inline u8 *plfxlc_mac_get_perm_addr(struct plfxlc_mac *mac) }struct ieee80211_hw *plfxlc_mac_alloc_hw (struct usb_interface *intf); -void plfxlc_mac_release (struct plfxlc_mac *mac); +void plfxlc_mac_release_hw (struct ieee80211_hw *hw);int plfxlc_mac_preinit_hw (struct ieee80211_hw *hw,const u8 *hw_address);int plfxlc_mac_init_hw (struct ieee80211_hw *hw);
drivers/net/wireless/purelifi/plfxlc/usb.c +14 -15
@@ -604,7 +604,7 @@ static int probe(struct usb_interface *intf, r =plfxlc_upload_mac_and_serial (intf, hw_address, serial_number);if (r) {dev_err (&intf->dev,"MAC and Serial upload failed (%d)\n" , r); - goto error; + goto error_free_hw; } chip->unit_type =STA ;
@@ -613,13 +613,13 @@ static int probe(struct usb_interface *intf, r =plfxlc_mac_preinit_hw (hw, hw_address);if (r) {dev_err (&intf->dev,"Init mac failed (%d)\n" , r); - goto error; + goto error_free_hw; } r =ieee80211_register_hw (hw);if (r) {dev_err (&intf->dev,"Register device failed (%d)\n" , r); - goto error; + goto error_free_hw; } if ((le16_to_cpu(interface_to_usbdev(intf)->descriptor.idVendor) ==
@@ -632,7 +632,7 @@ static int probe(struct usb_interface *intf, }if (r !=0 ) {dev_err (&intf->dev,"FPGA download failed (%d)\n" , r); - goto error; + goto error_unreg_hw; } tx->mac_fifo_full =0 ;
@@ -642,21 +642,21 @@ static int probe(struct usb_interface *intf, r =plfxlc_usb_init_hw (usb);if (r <0 ) {dev_err (&intf->dev,"usb_init_hw failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME ); r =plfxlc_chip_switch_radio (chip,PLFXLC_RADIO_ON );if (r <0 ) {dev_dbg (&intf->dev,"chip_switch_radio_on failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME ); r =plfxlc_chip_set_rate (chip,8 );if (r <0 ) {dev_dbg (&intf->dev,"chip_set_rate failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME );
@@ -664,7 +664,7 @@ static int probe(struct usb_interface *intf, hw_address, ETH_ALEN, USB_REQ_MAC_WR);if (r <0 ) {dev_dbg (&intf->dev,"MAC_WR failure (%d)\n" , r); - goto error; + goto error_unreg_hw; }plfxlc_chip_enable_rxtx (chip);
@@ -691,12 +691,12 @@ static int probe(struct usb_interface *intf,plfxlc_mac_init_hw (hw); usb->initialized = true;return 0 ; + +error_unreg_hw: +ieee80211_unregister_hw (hw); +error_free_hw: +plfxlc_mac_release_hw (hw); error: -if (hw) { -plfxlc_mac_release (plfxlc_hw_mac (hw)); -ieee80211_unregister_hw (hw); -ieee80211_free_hw (hw); - }dev_err (&intf->dev,"pureLifi:Device error" );return r; }
@@ -730,8 +730,7 @@ static void disconnect(struct usb_interface *intf)*/ usb_reset_device (interface_to_usbdev (intf)); -plfxlc_mac_release (mac); -ieee80211_free_hw (hw); +plfxlc_mac_release_hw (hw); }static void plfxlc_usb_resume (struct plfxlc_usb *usb)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/480 wifi: cfg80211: Add missing lock in cfg80211_check_and_end_cac()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 2c5dee15239f3f3e31aa5c8808f18996c039e2c1 ]
Callers of wdev_chandef() must hold the wiphy mutex.
But the worker cfg80211_propagate_cac_done_wk() never takes the lock. Which triggers the warning below with the mesh_peer_connected_dfs test from hostapd and not (yet) released mac80211 code changes:
WARNING: CPU: 0 PID: 495 at net/wireless/chan.c:1552 wdev_chandef+0x60/0x165 Modules linked in: CPU: 0 UID: 0 PID: 495 Comm: kworker/u4:2 Not tainted 6.14.0-rc5-wt-g03960e6f9d47 #33 13c287eeabfe1efea01c0bcc863723ab082e17cf Workqueue: cfg80211 cfg80211_propagate_cac_done_wk Stack: 00000000 00000001 ffffff00 6093267c 00000000 6002ec30 6d577c50 60037608 00000000 67e8d108 6063717b 00000000 Call Trace: [<6002ec30>] ? _printk+0x0/0x98 [<6003c2b3>] show_stack+0x10e/0x11a [<6002ec30>] ? _printk+0x0/0x98 [<60037608>] dump_stack_lvl+0x71/0xb8 [<6063717b>] ? wdev_chandef+0x60/0x165 [<6003766d>] dump_stack+0x1e/0x20 [<6005d1b7>] __warn+0x101/0x20f [<6005d3a8>] warn_slowpath_fmt+0xe3/0x15d [<600b0c5c>] ? mark_lock.part.0+0x0/0x4ec [<60751191>] ? __this_cpu_preempt_check+0x0/0x16 [<600b11a2>] ? mark_held_locks+0x5a/0x6e [<6005d2c5>] ? warn_slowpath_fmt+0x0/0x15d [<60052e53>] ? unblock_signals+0x3a/0xe7 [<60052f2d>] ? um_set_signals+0x2d/0x43 [<60751191>] ? __this_cpu_preempt_check+0x0/0x16 [<607508b2>] ? lock_is_held_type+0x207/0x21f [<6063717b>] wdev_chandef+0x60/0x165 [<605f89b4>] regulatory_propagate_dfs_state+0x247/0x43f [<60052f00>] ? um_set_signals+0x0/0x43 [<605e6bfd>] cfg80211_propagate_cac_done_wk+0x3a/0x4a [<6007e460>] process_scheduled_works+0x3bc/0x60e [<6007d0ec>] ? move_linked_works+0x4d/0x81 [<6007d120>] ? assign_work+0x0/0xaa [<6007f81f>] worker_thread+0x220/0x2dc [<600786ef>] ? set_pf_worker+0x0/0x57 [<60087c96>] ? to_kthread+0x0/0x43 [<6008ab3c>] kthread+0x2d3/0x2e2 [<6007f5ff>] ? worker_thread+0x0/0x2dc [<6006c05b>] ? calculate_sigpending+0x0/0x56 [<6003b37d>] new_thread_handler+0x4a/0x64 irq event stamp: 614611 hardirqs last enabled at (614621): [<00000000600bc96b>] __up_console_sem+0x82/0xaf hardirqs last disabled at (614630): [<00000000600bc92c>] __up_console_sem+0x43/0xaf softirqs last enabled at (614268): [<00000000606c55c6>] __ieee80211_wake_queue+0x933/0x985 softirqs last disabled at (614266): [<00000000606c52d6>] __ieee80211_wake_queue+0x643/0x985
--- net/wireless/reg.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/reg.c +2 -0
@@ -4229,6 +4229,8 @@ static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev)struct wireless_dev *wdev;unsigned int link_id; +guard (wiphy)(&rdev->wiphy); +/* If we finished CAC or received radar, we should end any * CAC running on the same channels. * the check !cfg80211_chandef_dfs_usable contain 2 options:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/480 wifi: mac80211: Do not schedule stopped TXQs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 11e3e22fa533f5d7cf04e32343b05a27eda3c7a5 ]
Ignore TXQs with the flag IEEE80211_TXQ_STOP when scheduling a queue.
The flag is only set after all fragments have been dequeued and won't allow dequeueing other frames as long as the flag is set.
For drivers using ieee80211_txq_schedule_start() this prevents an loop trying to push the queued frames while IEEE80211_TXQ_STOP is set:
After setting IEEE80211_TXQ_STOP the driver will call ieee80211_return_txq(). Which calls __ieee80211_schedule_txq(), detects that there sill are frames in the queue and immediately restarts the stopped TXQ. Which can't dequeue any frame and thus starts over the loop.
--- net/mac80211/tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/tx.c +3 -1
@@ -4109,7 +4109,9 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,spin_lock_bh (&local->active_txq_lock[txq->ac]); - has_queue = force ||txq_has_queue (txq); + has_queue = force || + (!test_bit (IEEE80211_TXQ_STOP , &txqi->flags) && +txq_has_queue (txq));if (list_empty (&txqi->schedule_order) && (has_queue ||ieee80211_txq_keep_active (txqi))) {/* If airtime accounting is active, always enqueue STAs at the
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/480 wifi: mac80211: Dont call fq_flow_idx() for management frames
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit cb3bb3d88dfcd177a1050c0a009a3ee147b2e5b9 ]
skb_get_hash() can only be used when the skb is linked to a netdev device.
--- net/mac80211/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/tx.c +2 -1
@@ -1438,7 +1438,7 @@ static void ieee80211_txq_enqueue(struct ieee80211_local *local, {struct fq *fq = &local->fq;struct fq_tin *tin = &txqi->tin; -u32 flow_idx =fq_flow_idx (fq, skb); +u32 flow_idx;ieee80211_set_skb_enqueue_time (skb);
@@ -1454,6 +1454,7 @@ static void ieee80211_txq_enqueue(struct ieee80211_local *local,IEEE80211_TX_INTCFL_NEED_TXPROCESSING ;__skb_queue_tail (&txqi->frags, skb); }else { + flow_idx =fq_flow_idx (fq, skb);fq_tin_enqueue (fq, tin, flow_idx, skb, fq_skb_free_func); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/480 wifi: mac80211: Check 802.11 encaps offloading in ieee80211_tx_h_select_key()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 4037c468d1b3c508d69e6df0ef47fdee3d440e39 ]
With 802.11 encapsulation offloading, ieee80211_tx_h_select_key() is called on 802.3 frames. In that case do not try to use skb data as valid 802.11 headers.
--- net/mac80211/tx.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/tx.c +6 -0
@@ -622,6 +622,12 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)else tx->key =NULL ; +if (info->flags &IEEE80211_TX_CTL_HW_80211_ENCAP ) { +if (tx->key && tx->key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE ) + info->control.hw_key = &tx->key->conf; +return TX_CONTINUE ; + } +if (tx->key) {bool skip_hw = false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/480 Reapply "wifi: mac80211: Update skbs control block key in ieee80211_tx_dequeue()"
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 754fe848b3b297fc85ec24cd959bad22b6df8cb8 ]
This reverts commit 0937cb5f345c ("Revert "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()"").
This commit broke TX with 802.11 encapsulation HW offloading, now that this is fixed, reapply it.
--- net/mac80211/tx.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/tx.c +1 -0
@@ -3894,6 +3894,7 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,* The key can be removed while the packet was queued, so need to call * this here to get the current key. */ + info->control.hw_key =NULL ; r =ieee80211_tx_h_select_key (&tx);if (r !=TX_CONTINUE ) {ieee80211_free_txskb (&local->hw, skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/480 wifi: ath12k: fix endianness handling while accessing wmi service bit
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamizh Chelvam Raja <[email protected]>
[ Upstream commit 8f1a078842d4af4877fb686f3907788024d0d1b7 ]
Currently there is no endian conversion in ath12k_wmi_tlv_services_parser() so the service bit parsing will be incorrect on a big endian platform and to fix this by using appropriate endian conversion.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00217-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/wmi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +7 -5
@@ -6829,7 +6829,7 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab, void *data) {const struct wmi_service_available_event *ev; -u32 *wmi_ext2_service_bitmap; +__le32 *wmi_ext2_service_bitmap;int i, j;u16 expected_len;
@@ -6861,12 +6861,12 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab, ev->wmi_service_segment_bitmap[3]);break ;case WMI_TAG_ARRAY_UINT32 : - wmi_ext2_service_bitmap = (u32 *)ptr; + wmi_ext2_service_bitmap = (__le32 *)ptr;for (i =0 , j =WMI_MAX_EXT_SERVICE ; i <WMI_SERVICE_SEGMENT_BM_SIZE32 && j <WMI_MAX_EXT2_SERVICE ; i++) {do { -if (wmi_ext2_service_bitmap[i] & +if (__le32_to_cpu (wmi_ext2_service_bitmap[i]) &BIT (j %WMI_AVAIL_SERVICE_BITS_IN_SIZE32 ))set_bit (j, ab->wmi_ab.svc_map); }while (++j %WMI_AVAIL_SERVICE_BITS_IN_SIZE32 );
@@ -6874,8 +6874,10 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,ath12k_dbg (ab,ATH12K_DBG_WMI ,"wmi_ext2_service_bitmap 0x%04x 0x%04x 0x%04x 0x%04x" , - wmi_ext2_service_bitmap[0 ], wmi_ext2_service_bitmap[1 ], - wmi_ext2_service_bitmap[2 ], wmi_ext2_service_bitmap[3 ]); +__le32_to_cpu (wmi_ext2_service_bitmap[0 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[1 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[2 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[3 ]));break ; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/480 wifi: brcmfmac: fix P2P discovery failure in P2P peer due to missing P2P IE
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gokul Sivakumar <[email protected]>
[ Upstream commit 579bf8037b70b644a674c126a32bbb2212cf5c21 ]
After commit bd99a3013bdc ("brcmfmac: move configuration of probe request IEs"), the probe request MGMT IE addition operation brcmf_vif_set_mgmt_ie() got moved from the brcmf_p2p_scan_prep() to the brcmf_cfg80211_scan().
Because of this, as part of the scan request handler for the P2P Discovery, vif struct used for adding the Probe Request P2P IE in firmware got changed from the P2PAPI_BSSCFG_DEVICE vif to P2PAPI_BSSCFG_PRIMARY vif incorrectly. So the firmware stopped adding P2P IE to the outgoing P2P Discovery probe requests frames and the other P2P peers were unable to discover this device causing a regression on the P2P feature.
To fix this, while setting the P2P IE in firmware, properly use the vif of the P2P discovery wdev on which the driver received the P2P scan request. This is done by not changing the vif pointer, until brcmf_vif_set_mgmt_ie() is completed.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -4
@@ -1545,10 +1545,6 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)return -EAGAIN ; } -/* If scan req comes for p2p0, send it over primary I/F */ -if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE ].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY ].vif; -brcmf_dbg (SCAN ,"START ESCAN\n" ); cfg->scan_request = request;
@@ -1564,6 +1560,10 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)if (err) goto scan_out; +/* If scan req comes for p2p0, send it over primary I/F */ +if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE ].vif) + vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY ].vif; + err =brcmf_do_escan (vif->ifp, request);if (err) goto scan_out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/480 PM: cpufreq: powernv/tracing: Move powernv_throttle trace event
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 647fe16b46999258ce1aec41f4bdeabb4f0cc8e7 ]
As the trace event powernv_throttle is only used by the powernv code, move it to a separate include file and have that code directly enable it.
Trace events can take up around 5K of memory when they are defined regardless if they are used or not. It wastes memory to have them defined in configurations where the tracepoint is not used.
--- drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 ++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++ include/trace/events/power.h | 22 ---------------- kernel/trace/power-traces.c | 1 - 5 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
drivers/cpufreq/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_CPUFREQ_VIRT) += virtual-cpufreq.o # Traces CFLAGS_amd-pstate-trace.o := -I$(src) +CFLAGS_powernv-cpufreq.o := -I$(src) amd_pstate-y := amd-pstate.o amd-pstate-trace.o ##################################################################################
drivers/cpufreq/powernv-cpufreq.c +3 -1
@@ -21,7 +21,6 @@#include <linux/string_choices.h> #include <linux/cpu.h> #include <linux/hashtable.h> -#include <trace/events/power.h> #include <asm/cputhreads.h> #include <asm/firmware.h>
@@ -30,6 +29,9 @@#include <asm/opal.h> #include <linux/timer.h> +#define CREATE_TRACE_POINTS +#include "powernv-trace.h" +#define POWERNV_MAX_PSTATES_ORDER 8#define POWERNV_MAX_PSTATES (1UL << (POWERNV_MAX_PSTATES_ORDER))#define PMSR_PSAFE_ENABLE (1UL << 30)
drivers/cpufreq/powernv-trace.h new file +44 -0
44 lines not on this page · raw message
include/trace/events/power.h +0 -22
@@ -99,28 +99,6 @@ DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,TP_ARGS (cpu_id, state, s2idle) ); -TRACE_EVENT (powernv_throttle, - - TP_PROTO(int chip_id, const char *reason, int pmax), - -TP_ARGS (chip_id, reason, pmax), - -TP_STRUCT__entry ( - __field(int, chip_id) - __string(reason, reason) -__field (int, pmax) - ), - -TP_fast_assign ( - __entry->chip_id = chip_id; - __assign_str(reason); - __entry->pmax = pmax; - ), - -TP_printk ("Chip %d Pmax %d %s" , __entry->chip_id, - __entry->pmax,__get_str (reason)) -); - TRACE_EVENT(pstate_sample, TP_PROTO(u32 core_busy,
kernel/trace/power-traces.c +0 -1
@@ -17,5 +17,4 @@EXPORT_TRACEPOINT_SYMBOL_GPL (suspend_resume);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_idle);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_frequency); -EXPORT_TRACEPOINT_SYMBOL_GPL (powernv_throttle);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/480 wifi: mac80211: Write cnt before copying in ieee80211_copy_rnr_beacon()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit a37192c432adaec9e8ef29e4ddb319ea2f443aa6 ]
While I caught the need for setting cnt early in nl80211_parse_rnr_elems() in the original annotation of struct cfg80211_rnr_elems with __counted_by, I missed a similar pattern in ieee80211_copy_rnr_beacon(). Fix this by moving the cnt assignment to before the loop.
--- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/cfg.c +1 -1
@@ -1109,13 +1109,13 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst, {int i, offset =0 ; + dst->cnt = src->cnt;for (i =0 ; i < src->cnt; i++) {memcpy (pos + offset, src->elem[i].data, src->elem[i].len); dst->elem[i].len = src->elem[i].len; dst->elem[i].data = pos + offset; offset += dst->elem[i].len; } - dst->cnt = src->cnt;return offset; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/480 wifi: nl80211: Set num_sub_specs before looping through sub_specs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 2ed9a9fc9976262109d04f1a3c75c46de8ce4f22 ]
The processing of the struct cfg80211_sar_specs::sub_specs flexible array requires its counter, num_sub_specs, to be assigned before the loop in nl80211_set_sar_specs(). Leave the final assignment after the loop in place in case fewer ended up in the array.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -16892,6 +16892,7 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)if (!sar_spec)return -ENOMEM ; + sar_spec->num_sub_specs = specs; sar_spec->type = type; specs =0 ;nla_for_each_nested (spec_list, tb[NL80211_SAR_ATTR_SPECS ], rem) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/480 ring-buffer: Remove ring_buffer_read_prepare_sync()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 119a5d573622ae90ba730d18acfae9bb75d77b9a ]
When the ring buffer was first introduced, reading the non-consuming "trace" file required disabling the writing of the ring buffer. To make sure the writing was fully disabled before iterating the buffer with a non-consuming read, it would set the disable flag of the buffer and then call an RCU synchronization to make sure all the buffers were synchronized.
The function ring_buffer_read_start() originally would initialize the iterator and call an RCU synchronization, but this was for each individual per CPU buffer where this would get called many times on a machine with many CPUs before the trace file could be read. The commit 72c9ddfd4c5bf ("ring-buffer: Make non-consuming read less expensive with lots of cpus.") separated ring_buffer_read_start into ring_buffer_read_prepare(), ring_buffer_read_sync() and then ring_buffer_read_start() to allow each of the per CPU buffers to be prepared, call the read_buffer_read_sync() once, and then the ring_buffer_read_start() for each of the CPUs which made things much faster.
The commit 1039221cc278 ("ring-buffer: Do not disable recording when there is an iterator") removed the requirement of disabling the recording of the ring buffer in order to iterate it, but it did not remove the synchronization that was happening that was required to wait for all the buffers to have no more writers. It's now OK for the buffers to have writers and no synchronization is needed.
Remove the synchronization and put back the interface for the ring buffer iterator back before commit 72c9ddfd4c5bf was applied.
--- include/linux/ring_buffer.h | 4 +-- kernel/trace/ring_buffer.c | 63 ++++++------------------------------- kernel/trace/trace.c | 14 +++------ kernel/trace/trace_kdb.c | 8 ++--- 4 files changed, 18 insertions(+), 71 deletions(-)
include/linux/ring_buffer.h +1 -3
@@ -152,9 +152,7 @@ ring_buffer_consume(struct trace_buffer *buffer, int cpu, u64 *ts, unsigned long *lost_events);struct ring_buffer_iter * -ring_buffer_read_prepare (struct trace_buffer *buffer,int cpu,gfp_t flags); -void ring_buffer_read_prepare_sync (void ); -void ring_buffer_read_start (struct ring_buffer_iter *iter); +ring_buffer_read_start (struct trace_buffer *buffer,int cpu,gfp_t flags);void ring_buffer_read_finish (struct ring_buffer_iter *iter); struct ring_buffer_event *
kernel/trace/ring_buffer.c +10 -53
85 lines not on this page · raw message
kernel/trace/trace.c +4 -10
@@ -4640,21 +4640,15 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot)if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->array_buffer->buffer, - cpu,GFP_KERNEL ); - } -ring_buffer_read_prepare_sync (); -for_each_tracing_cpu (cpu) { -ring_buffer_read_start (iter->buffer_iter[cpu]); +ring_buffer_read_start (iter->array_buffer->buffer, + cpu,GFP_KERNEL );tracing_iter_reset (iter, cpu); } }else { cpu = iter->cpu_file; iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->array_buffer->buffer, - cpu,GFP_KERNEL ); -ring_buffer_read_prepare_sync (); -ring_buffer_read_start (iter->buffer_iter[cpu]); +ring_buffer_read_start (iter->array_buffer->buffer, + cpu,GFP_KERNEL );tracing_iter_reset (iter, cpu); }
kernel/trace/trace_kdb.c +3 -5
@@ -43,17 +43,15 @@ static void ftrace_dump_buf(int skip_entries, long cpu_file)if (cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter.buffer_iter[cpu] = -ring_buffer_read_prepare (iter.array_buffer->buffer, - cpu,GFP_ATOMIC ); -ring_buffer_read_start (iter.buffer_iter[cpu]); +ring_buffer_read_start (iter.array_buffer->buffer, + cpu,GFP_ATOMIC );tracing_iter_reset (&iter, cpu); } }else { iter.cpu_file = cpu_file; iter.buffer_iter[cpu_file] = -ring_buffer_read_prepare (iter.array_buffer->buffer, +ring_buffer_read_start (iter.array_buffer->buffer, cpu_file,GFP_ATOMIC ); -ring_buffer_read_start (iter.buffer_iter[cpu_file]);tracing_iter_reset (&iter, cpu_file); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/480 kcsan: test: Initialize dummy variable
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
[ Upstream commit 9872916ad1a1a5e7d089e05166c85dbd65e5b0e8 ]
Newer compiler versions rightfully point out:
kernel/kcsan/kcsan_test.c:591:41: error: variable 'dummy' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
591 | KCSAN_EXPECT_READ_BARRIER(atomic_read(&dummy), false);
| ^~~~~
1 error generated.
Although this particular test does not care about the value stored in the dummy atomic variable, let's silence the warning.
--- kernel/kcsan/kcsan_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kcsan/kcsan_test.c +1 -1
@@ -533,7 +533,7 @@ static void test_barrier_nothreads(struct kunit *test)struct kcsan_scoped_access *reorder_access =NULL ;#endif arch_spinlock_t arch_spinlock = __ARCH_SPIN_LOCK_UNLOCKED; -atomic_t dummy; +atomic_t dummy =ATOMIC_INIT (0 );KCSAN_TEST_REQUIRES (test, reorder_access !=NULL );KCSAN_TEST_REQUIRES (test,IS_ENABLED (CONFIG_SMP ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/480 memcg_slabinfo: Fix use of PG_slab
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 7f770e94d7936e8e35d4b4d5fa4618301b03ea33 ]
Check PGTY_slab instead of PG_slab.
--- tools/cgroup/memcg_slabinfo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/cgroup/memcg_slabinfo.py +2 -2
@@ -146,11 +146,11 @@ def detect_kernel_config(): def for_each_slab(prog): - PGSlab = ~prog.constant('PG_slab') + slabtype = prog.constant('PGTY_slab') for page in for_each_page(prog): try: - if page.page_type.value_() == PGSlab: + if (page.page_type.value_() >> 24) == slabtype: yield cast('struct slab *', page) except FaultError: pass
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/480 wifi: mac80211: fix WARN_ON for monitor mode on some devices
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit c57e5b9819dfd16d709bcd6cb633301ed0829a66 ]
On devices without WANT_MONITOR_VIF (and probably without channel context support) we get a WARN_ON for changing the per-link setting of a monitor interface.
Since we already skip AP_VLAN interfaces and MONITOR with WANT_MONITOR_VIF and/or NO_VIRTUAL_MONITOR should update the settings, catch this in the link change code instead of the warning.
--- net/mac80211/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/mac80211/main.c +12 -1
@@ -407,9 +407,20 @@ void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,WARN_ON_ONCE (changed &BSS_CHANGED_VIF_CFG_FLAGS ); -if (!changed || sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +if (!changed)return ; +switch (sdata->vif.type) { +case NL80211_IFTYPE_AP_VLAN : +return ; +case NL80211_IFTYPE_MONITOR : +if (!ieee80211_hw_check (&local->hw,WANT_MONITOR_VIF )) +return ; +break ; +default : +break ; + } +if (!check_sdata_in_driver (sdata))return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/480 arm64/gcs: task_gcs_el0_enable() should use passed task
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Linton <[email protected]>
[ Upstream commit cbbcfb94c55c02a8c4ce52b5da0770b5591a314c ]
Mark Rutland noticed that the task parameter is ignored and 'current' is being used instead. Since this is usually what its passed, it hasn't yet been causing problems but likely will as the code gets more testing.
But, once this is fixed, it creates a new bug in copy_thread_gcs() since the gcs_el_mode isn't yet set for the task before its being checked. Move gcs_alloc_thread_stack() after the new task's gcs_el0_mode initialization to avoid this.
--- arch/arm64/include/asm/gcs.h | 2 +- arch/arm64/kernel/process.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/include/asm/gcs.h +1 -1
@@ -58,7 +58,7 @@ static inline u64 gcsss2(void)static inline bool task_gcs_el0_enabled (struct task_struct *task) { -return current->thread.gcs_el0_mode &PR_SHADOW_STACK_ENABLE ; +return task->thread.gcs_el0_mode &PR_SHADOW_STACK_ENABLE ; }void gcs_set_el0_mode (struct task_struct *task);
arch/arm64/kernel/process.c +3 -3
@@ -305,13 +305,13 @@ static int copy_thread_gcs(struct task_struct *p, p->thread.gcs_base =0 ; p->thread.gcs_size =0 ; + p->thread.gcs_el0_mode = current->thread.gcs_el0_mode; + p->thread.gcs_el0_locked = current->thread.gcs_el0_locked; + gcs =gcs_alloc_thread_stack (p, args);if (IS_ERR_VALUE (gcs))return PTR_ERR ((void *)gcs); - p->thread.gcs_el0_mode = current->thread.gcs_el0_mode; - p->thread.gcs_el0_locked = current->thread.gcs_el0_locked; -return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/480 wifi: iwlwifi: mld: decode EOF bit for AMPDUs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit bc404dfddbf6817cae9b170c34556dc72ea975e5 ]
Only the EOF bit handling for single frames was ported to the MLD driver. The code to handle AMPDUs correctly was forgotten. Add it back so that the bit is reported in the radiotap headers again.
--- drivers/net/wireless/intel/iwlwifi/mld/rx.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/intel/iwlwifi/mld/rx.c +9 -0
@@ -1039,6 +1039,15 @@ static void iwl_mld_rx_eht(struct iwl_mld *mld, struct sk_buff *skb, rx_status->flag |=RX_FLAG_AMPDU_EOF_BIT ; } +/* update aggregation data for monitor sake on default queue */ +if (!queue && (phy_info &IWL_RX_MPDU_PHY_TSF_OVERLOAD ) && + (phy_info &IWL_RX_MPDU_PHY_AMPDU ) && phy_data->first_subframe) { + rx_status->flag |=RX_FLAG_AMPDU_EOF_BIT_KNOWN ; +if (phy_data->data0 & +cpu_to_le32 (IWL_RX_PHY_DATA0_EHT_DELIM_EOF )) + rx_status->flag |=RX_FLAG_AMPDU_EOF_BIT ; + } +if (phy_info &IWL_RX_MPDU_PHY_TSF_OVERLOAD )iwl_mld_decode_eht_phy_data (mld, phy_data, rx_status, eht, usig);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/480 Bluetooth: hci_sync: fix double free in hci_discovery_filter_clear()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arseniy Krasnov <[email protected]>
[ Upstream commit 2935e556850e9c94d7a00adf14d3cd7fe406ac03 ]
Function 'hci_discovery_filter_clear()' frees 'uuids' array and then sets it to NULL. There is a tiny chance of the following race:
'hci_cmd_sync_work()'
'update_passive_scan_sync()'
'hci_update_passive_scan_sync()'
'hci_discovery_filter_clear()'
kfree(uuids);
<-------------------------preempted-------------------------------->
'start_service_discovery()'
'hci_discovery_filter_clear()'
kfree(uuids); // DOUBLE FREE
<-------------------------preempted-------------------------------->
uuids = NULL;To fix it let's add locking around 'kfree()' call and NULL pointer assignment. Otherwise the following backtrace fires:
[ ] ------------[ cut here ]------------
[ ] kernel BUG at mm/slub.c:547!
[ ] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP [ ] CPU: 3 UID: 0 PID: 246 Comm: bluetoothd Tainted: G O 6.12.19-kernel #1 [ ] Tainted: [O]=OOT_MODULE
[ ] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ ] pc : __slab_free+0xf8/0x348
[ ] lr : __slab_free+0x48/0x348
...
[ ] Call trace:
[ ] __slab_free+0xf8/0x348 [ ] kfree+0x164/0x27c [ ] start_service_discovery+0x1d0/0x2c0 [ ] hci_sock_sendmsg+0x518/0x924 [ ] __sock_sendmsg+0x54/0x60 [ ] sock_write_iter+0x98/0xf8 [ ] do_iter_readv_writev+0xe4/0x1c8 [ ] vfs_writev+0x128/0x2b0 [ ] do_writev+0xfc/0x118 [ ] __arm64_sys_writev+0x20/0x2c [ ] invoke_syscall+0x68/0xf0 [ ] el0_svc_common.constprop.0+0x40/0xe0 [ ] do_el0_svc+0x1c/0x28 [ ] el0_svc+0x30/0xd0 [ ] el0t_64_sync_handler+0x100/0x12c [ ] el0t_64_sync+0x194/0x198
[ ] Code: 8b0002e6 eb17031f 54fffbe1 d503201f (d4210000) [ ] ---[ end trace 0000000000000000 ]---
--- include/net/bluetooth/hci_core.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/net/bluetooth/hci_core.h +6 -0
@@ -29,6 +29,7 @@#include <linux/idr.h> #include <linux/leds.h> #include <linux/rculist.h> +#include <linux/spinlock.h> #include <linux/srcu.h> #include <net/bluetooth/hci.h>
@@ -93,6 +94,7 @@ struct discovery_state {u16 uuid_count;u8 (*uuids)[16 ];unsigned long name_resolve_timeout; +spinlock_t lock; };#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000)/* 2 seconds */
@@ -885,6 +887,7 @@ static inline void iso_recv(struct hci_conn *hcon, struct sk_buff *skb,static inline void discovery_init (struct hci_dev *hdev) { +spin_lock_init (&hdev->discovery.lock); hdev->discovery.state =DISCOVERY_STOPPED ;INIT_LIST_HEAD (&hdev->discovery.all);INIT_LIST_HEAD (&hdev->discovery.unknown);
@@ -899,8 +902,11 @@ static inline void hci_discovery_filter_clear(struct hci_dev *hdev) hdev->discovery.report_invalid_rssi = true; hdev->discovery.rssi =HCI_RSSI_INVALID ; hdev->discovery.uuid_count =0 ; + +spin_lock (&hdev->discovery.lock);kfree (hdev->discovery.uuids); hdev->discovery.uuids =NULL ; +spin_unlock (&hdev->discovery.lock); }bool hci_discovery_active (struct hci_dev *hdev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/480 Bluetooth: hci_devcd_dump: fix out-of-bounds via dev_coredumpv
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Pravdin <[email protected]>
[ Upstream commit 7af4d7b53502286c6cf946d397ab183e76d14820 ]
Currently both dev_coredumpv and skb_put_data in hci_devcd_dump use hdev->dump.head. However, dev_coredumpv can free the buffer. From dev_coredumpm_timeout documentation, which is used by dev_coredumpv:
Quoted 4 lines
Creates a new device coredump for the given device. If a previous one hasn't been read yet, the new coredump is discarded. The data lifetime is determined by the device coredump framework and when it is no longer needed the @free function will be called to free the data.
If the data has not been read by the userspace yet, dev_coredumpv will discard new buffer, freeing hdev->dump.head. This leads to vmalloc-out-of-bounds error when skb_put_data tries to access hdev->dump.head.
A crash report from syzbot illustrates this:
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in skb_put_data
include/linux/skbuff.h:2752 [inline]
BUG: KASAN: vmalloc-out-of-bounds in hci_devcd_dump+0x142/0x240
net/bluetooth/coredump.c:258
Read of size 140 at addr ffffc90004ed5000 by task kworker/u9:2/5844
CPU: 1 UID: 0 PID: 5844 Comm: kworker/u9:2 Not tainted
6.14.0-syzkaller-10892-g4e82c87058f4 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 02/12/2025
Workqueue: hci0 hci_devcd_timeout
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xc3/0x670 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
__asan_memcpy+0x23/0x60 mm/kasan/shadow.c:105
skb_put_data include/linux/skbuff.h:2752 [inline]
hci_devcd_dump+0x142/0x240 net/bluetooth/coredump.c:258
hci_devcd_timeout+0xb5/0x2e0 net/bluetooth/coredump.c:413
process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
The buggy address ffffc90004ed5000 belongs to a vmalloc virtual mapping
Memory state around the buggy address:
ffffc90004ed4f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90004ed4f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc90004ed5000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffffc90004ed5080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90004ed5100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================To avoid this issue, reorder dev_coredumpv to be called after skb_put_data that does not free the data.
--- net/bluetooth/coredump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/coredump.c +3 -3
@@ -249,15 +249,15 @@ static void hci_devcd_dump(struct hci_dev *hdev) size = hdev->dump.tail - hdev->dump.head; -/* Emit a devcoredump with the available data */ -dev_coredumpv (&hdev->dev, hdev->dump.head, size,GFP_KERNEL ); -/* Send a copy to monitor as a diagnostic packet */ skb =bt_skb_alloc (size,GFP_ATOMIC );if (skb) {skb_put_data (skb, hdev->dump.head, size);hci_recv_diag (hdev, skb); } + +/* Emit a devcoredump with the available data */ +dev_coredumpv (&hdev->dev, hdev->dump.head, size,GFP_KERNEL ); } static void hci_devcd_handle_pkt_complete(struct hci_dev *hdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/480 Bluetooth: hci_event: Mask data status from LE ext adv reports
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Down <[email protected]>
[ Upstream commit 0cadf8534f2a727bc3a01e8c583b085d25963ee0 ]
The Event_Type field in an LE Extended Advertising Report uses bits 5 and 6 for data status (e.g. truncation or fragmentation), not the PDU type itself.
The ext_evt_type_to_legacy() function fails to mask these status bits before evaluation. This causes valid advertisements with status bits set (e.g. a truncated non-connectable advertisement, which ends up showing as PDU type 0x40) to be misclassified as unknown and subsequently dropped. This is okay for most checks which use bitwise AND on the relevant event type bits, but it doesn't work for non-connectable types, which are checked with '== LE_EXT_ADV_NON_CONN_IND' (that is, zero).
In terms of behaviour, first the device sends a truncated report:
Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 26
LE Extended Advertising Report (0x0d)
Entry 0
Event type: 0x0040
Data status: Incomplete, data truncated, no more to come
Address type: Random (0x01)
Address: 1D:12:46:FA:F8:6E (Non-Resolvable)
SID: 0x03
RSSI: -98 dBm (0x9e)
Data length: 0x00Then, a few seconds later, it sends the subsequent complete report:
Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 122
LE Extended Advertising Report (0x0d)
Entry 0
Event type: 0x0000
Data status: Complete
Address type: Random (0x01)
Address: 1D:12:46:FA:F8:6E (Non-Resolvable)
SID: 0x03
RSSI: -97 dBm (0x9f)
Data length: 0x60
Service Data: Google (0xfef3)
Data[92]: ...These devices often send multiple truncated reports per second.
This patch introduces a PDU type mask to ensure only the relevant bits are evaluated, allowing for the correct translation of all valid extended advertising packets.
--- include/net/bluetooth/hci.h | 1 + net/bluetooth/hci_event.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +1 -0
@@ -2633,6 +2633,7 @@ struct hci_ev_le_conn_complete {#define LE_EXT_ADV_DIRECT_IND 0x0004#define LE_EXT_ADV_SCAN_RSP 0x0008#define LE_EXT_ADV_LEGACY_PDU 0x0010 +#define LE_EXT_ADV_DATA_STATUS_MASK 0x0060#define LE_EXT_ADV_EVT_TYPE_MASK 0x007f#define ADDR_LE_DEV_PUBLIC 0x00
net/bluetooth/hci_event.c +6 -2
@@ -6239,6 +6239,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, void *data,static u8 ext_evt_type_to_legacy (struct hci_dev *hdev,u16 evt_type) { +u16 pdu_type = evt_type & ~LE_EXT_ADV_DATA_STATUS_MASK ; + +if (!pdu_type) +return LE_ADV_NONCONN_IND ; +if (evt_type &LE_EXT_ADV_LEGACY_PDU ) {switch (evt_type) {case LE_LEGACY_ADV_IND :
@@ -6270,8 +6275,7 @@ static u8 ext_evt_type_to_legacy(struct hci_dev *hdev, u16 evt_type)if (evt_type &LE_EXT_ADV_SCAN_IND )return LE_ADV_SCAN_IND ; -if (evt_type ==LE_EXT_ADV_NON_CONN_IND || - evt_type &LE_EXT_ADV_DIRECT_IND ) +if (evt_type &LE_EXT_ADV_DIRECT_IND )return LE_ADV_NONCONN_IND ; invalid:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/480 bpf: Disable migration in nf_hook_run_bpf().
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 17ce3e5949bc37557305ad46316f41c7875d6366 ]
syzbot reported that the netfilter bpf prog can be called without migration disabled in xmit path.
Then the assertion in __bpf_prog_run() fails, triggering the splat below. [0]
Let's use bpf_prog_run_pin_on_cpu() in nf_hook_run_bpf().
[0]:
BUG: assuming non migratable context at ./include/linux/filter.h:703
in_atomic(): 0, irqs_disabled(): 0, migration_disabled() 0 pid: 5829, name: sshd-session
3 locks held by sshd-session/5829:
#0: ffff88807b4e4218 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1667 [inline] #0: ffff88807b4e4218 (sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sendmsg+0x20/0x50 net/ipv4/tcp.c:1395 #1: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #1: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #1: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: __ip_queue_xmit+0x69/0x26c0 net/ipv4/ip_output.c:470 #2: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #2: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #2: ffffffff8e5c4e00 (rcu_read_lock){....}-{1:3}, at: nf_hook+0xb2/0x680 include/linux/netfilter.h:241
CPU: 0 UID: 0 PID: 5829 Comm: sshd-session Not tainted 6.16.0-rc6-syzkaller-00002-g155a3c003e55 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120 __cant_migrate kernel/sched/core.c:8860 [inline] __cant_migrate+0x1c7/0x250 kernel/sched/core.c:8834 __bpf_prog_run include/linux/filter.h:703 [inline] bpf_prog_run include/linux/filter.h:725 [inline] nf_hook_run_bpf+0x83/0x1e0 net/netfilter/nf_bpf_link.c:20 nf_hook_entry_hookfn include/linux/netfilter.h:157 [inline] nf_hook_slow+0xbb/0x200 net/netfilter/core.c:623 nf_hook+0x370/0x680 include/linux/netfilter.h:272 NF_HOOK_COND include/linux/netfilter.h:305 [inline] ip_output+0x1bc/0x2a0 net/ipv4/ip_output.c:433 dst_output include/net/dst.h:459 [inline] ip_local_out net/ipv4/ip_output.c:129 [inline] __ip_queue_xmit+0x1d7d/0x26c0 net/ipv4/ip_output.c:527 __tcp_transmit_skb+0x2686/0x3e90 net/ipv4/tcp_output.c:1479 tcp_transmit_skb net/ipv4/tcp_output.c:1497 [inline] tcp_write_xmit+0x1274/0x84e0 net/ipv4/tcp_output.c:2838 __tcp_push_pending_frames+0xaf/0x390 net/ipv4/tcp_output.c:3021 tcp_push+0x225/0x700 net/ipv4/tcp.c:759 tcp_sendmsg_locked+0x1870/0x42b0 net/ipv4/tcp.c:1359 tcp_sendmsg+0x2e/0x50 net/ipv4/tcp.c:1396 inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:851 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg net/socket.c:727 [inline] sock_write_iter+0x4aa/0x5b0 net/socket.c:1131 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x6c7/0x1150 fs/read_write.c:686 ksys_write+0x1f8/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe7d365d407 Code: 48 89 fa 4c 89 df e8 38 aa 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:
--- net/netfilter/nf_bpf_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_bpf_link.c +1 -1
@@ -17,7 +17,7 @@ static unsigned int nf_hook_run_bpf(void *bpf_prog, struct sk_buff *skb, .skb = skb, }; -return bpf_prog_run (prog, &ctx); +return bpf_prog_run_pin_on_cpu (prog, &ctx); }struct bpf_nf_link {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/480 tools/rv: Do not skip idle in trace
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit f60227f3448911b682c45041c3fbd94f6d3b15a2 ]
Currently, the userspace RV tool skips trace events triggered by the RV tool itself, this can be changed by passing the parameter -s, which sets the variable config_my_pid to 0 (instead of the tool's PID). This has the side effect of skipping events generated by idle (PID 0).
Set config_my_pid to -1 (an invalid pid) to avoid skipping idle.
--- tools/verification/rv/src/in_kernel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/verification/rv/src/in_kernel.c +2 -2
@@ -431,7 +431,7 @@ ikm_event_handler(struct trace_seq *s, struct tep_record *record,if (config_has_id && (config_my_pid == id))return 0 ; -else if (config_my_pid && (config_my_pid == pid)) +else if (config_my_pid == pid)return 0 ; tep_print_event(trace_event->tep, s, record, "%16s-%-8d [%.3d] ",
@@ -734,7 +734,7 @@ static int parse_arguments(char *monitor_name, int argc, char **argv) config_reactor = optarg;break ;case 's' : - config_my_pid =0 ; + config_my_pid =-1 ;break ;case 't' : config_trace =1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/480 selftests: drv-net: Fix remote command checking in require_cmd()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit b4d52c698210ae1a3ceb487b189701bc70551a48 ]
The require_cmd() method was checking for command availability locally even when remote=True was specified, due to a missing host parameter.
Fix by passing host=self.remote when checking remote command availability, ensuring commands are verified on the correct host.
--- tools/testing/selftests/drivers/net/lib/py/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/drivers/net/lib/py/env.py +1 -1
@@ -259,7 +259,7 @@ class NetDrvEpEnv(NetDrvEnvBase): if not self._require_cmd(comm, "local"): raise KsftSkipEx("Test requires command: " + comm) if remote: - if not self._require_cmd(comm, "remote"): + if not self._require_cmd(comm, "remote", host=self.remote): raise KsftSkipEx("Test requires (remote) command: " + comm) def wait_hw_stats_settle(self):
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/480 selftests: drv-net: tso: enable test cases based on hw_features
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Zahka <[email protected]>
[ Upstream commit 266b835e5e84a0f8fec7fd988ee81925890e8d89 ]
tso.py uses the active features at the time of test execution as the set of available gso features to test. This means if a gso feature is supported but toggled off at test start, the test will be skipped with a "Device does not support {feature}" message.
Instead, we can enumerate the set of toggleable features by capturing the driver's hw_features bitmap. To avoid configuration side-effects from running the test, we also snapshot the wanted_features flag set before making any feature changes, and then attempt to restore the same set of wanted_features before test exit.
--- tools/testing/selftests/drivers/net/hw/tso.py | 52 ++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-)
tools/testing/selftests/drivers/net/hw/tso.py +40 -12
@@ -119,15 +119,30 @@ def build_tunnel(cfg, outer_ipver, tun_info): return remote_v4, remote_v6 +def restore_wanted_features(cfg): + features_cmd = "" + for feature in cfg.hw_features: + setting = "on" if feature in cfg.wanted_features else "off" + features_cmd += f" {feature} {setting}" + try: + ethtool(f"-K {cfg.ifname} {features_cmd}") + except Exception as e: + ksft_pr(f"WARNING: failure restoring wanted features: {e}") + + def test_builder(name, cfg, outer_ipver, feature, tun=None, inner_ipver=None): """Construct specific tests from the common template.""" def f(cfg): cfg.require_ipver(outer_ipver) + defer(restore_wanted_features, cfg) if not cfg.have_stat_super_count and \ not cfg.have_stat_wire_count: raise KsftSkipEx(f"Device does not support LSO queue stats") + if feature not in cfg.hw_features: + raise KsftSkipEx(f"Device does not support {feature}") + ipver = outer_ipver if tun: remote_v4, remote_v6 = build_tunnel(cfg, ipver, tun)
@@ -138,12 +153,12 @@ def test_builder(name, cfg, outer_ipver, feature, tun=None, inner_ipver=None): tun_partial = tun and tun[1] # Tunnel which can silently fall back to gso-partial - has_gso_partial = tun and 'tx-gso-partial' in cfg.features + has_gso_partial = tun and 'tx-gso-partial' in cfg.hw_features # For TSO4 via partial we need mangleid if ipver == "4" and feature in cfg.partial_features: ksft_pr("Testing with mangleid enabled") - if 'tx-tcp-mangleid-segmentation' not in cfg.features: + if 'tx-tcp-mangleid-segmentation' not in cfg.hw_features: ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation on") defer(ethtool, f"-K {cfg.ifname} tx-tcp-mangleid-segmentation off")
@@ -161,11 +176,8 @@ def test_builder(name, cfg, outer_ipver, feature, tun=None, inner_ipver=None): should_lso=tun_partial) # Full feature enabled. - if feature in cfg.features: - ethtool(f"-K {cfg.ifname} {feature} on") - run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=True) - else: - raise KsftXfailEx(f"Device does not support {feature}") + ethtool(f"-K {cfg.ifname} {feature} on") + run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=True) f.__name__ = name + ((outer_ipver + "_") if tun else "") + "ipv" + inner_ipver return f
@@ -176,23 +188,39 @@ def query_nic_features(cfg) -> None: cfg.have_stat_super_count = False cfg.have_stat_wire_count = False - cfg.features = set() features = cfg.ethnl.features_get({"header": {"dev-index": cfg.ifindex}}) - for f in features["active"]["bits"]["bit"]: - cfg.features.add(f["name"]) + + cfg.wanted_features = set() + for f in features["wanted"]["bits"]["bit"]: + cfg.wanted_features.add(f["name"]) + + cfg.hw_features = set() + hw_all_features_cmd = "" + for f in features["hw"]["bits"]["bit"]: + if f.get("value", False): + feature = f["name"] + cfg.hw_features.add(feature) + hw_all_features_cmd += f" {feature} on" + try: + ethtool(f"-K {cfg.ifname} {hw_all_features_cmd}") + except Exception as e: + ksft_pr(f"WARNING: failure enabling all hw features: {e}") + ksft_pr("partial gso feature detection may be impacted") # Check which features are supported via GSO partial cfg.partial_features = set() - if 'tx-gso-partial' in cfg.features: + if 'tx-gso-partial' in cfg.hw_features: ethtool(f"-K {cfg.ifname} tx-gso-partial off") no_partial = set() features = cfg.ethnl.features_get({"header": {"dev-index": cfg.ifindex}}) for f in features["active"]["bits"]["bit"]: no_partial.add(f["name"]) - cfg.partial_features = cfg.features - no_partial + cfg.partial_features = cfg.hw_features - no_partial ethtool(f"-K {cfg.ifname} tx-gso-partial on") + restore_wanted_features(cfg) + stats = cfg.netnl.qstats_get({"ifindex": cfg.ifindex}, dump=True) if stats: if 'tx-hw-gso-packets' in stats[0]:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/480 selftests: drv-net: tso: fix vxlan tunnel flags to get correct gso_type
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Zahka <[email protected]>
[ Upstream commit 2cfbcc5d8af9199823151c21f740e476b223dd2e ]
When vxlan is used with ipv6 as the outer network header, the correct ip link parameters for acheiving the SKB_GSO_UDP_TUNNEL gso type is "udp6zerocsumtx udp6zerocsumrx". Otherwise the gso type will be SKB_GSO_UDP_TUNNEL_CSUM.
This bug was the reason for the second of the three possible invocations of run_one_stream() invocations, so that can be deleted as well. We only need to test with the feature off and on.
--- tools/testing/selftests/drivers/net/hw/tso.py | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-)
tools/testing/selftests/drivers/net/hw/tso.py +13 -24
@@ -102,7 +102,7 @@ def build_tunnel(cfg, outer_ipver, tun_info): remote_addr = cfg.remote_addr_v[outer_ipver] tun_type = tun_info[0] - tun_arg = tun_info[2] + tun_arg = tun_info[1] ip(f"link add {tun_type}-ksft type {tun_type} {tun_arg} local {local_addr} remote {remote_addr} dev {cfg.ifname}") defer(ip, f"link del {tun_type}-ksft") ip(f"link set dev {tun_type}-ksft up")
@@ -151,29 +151,17 @@ def test_builder(name, cfg, outer_ipver, feature, tun=None, inner_ipver=None): remote_v4 = cfg.remote_addr_v["4"] remote_v6 = cfg.remote_addr_v["6"] - tun_partial = tun and tun[1] - # Tunnel which can silently fall back to gso-partial - has_gso_partial = tun and 'tx-gso-partial' in cfg.hw_features - - # For TSO4 via partial we need mangleid - if ipver == "4" and feature in cfg.partial_features: - ksft_pr("Testing with mangleid enabled") - if 'tx-tcp-mangleid-segmentation' not in cfg.hw_features: - ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation on") - defer(ethtool, f"-K {cfg.ifname} tx-tcp-mangleid-segmentation off") - # First test without the feature enabled. ethtool(f"-K {cfg.ifname} {feature} off") - if has_gso_partial: - ethtool(f"-K {cfg.ifname} tx-gso-partial off") run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=False) - # Now test with the feature enabled. - # For compatible tunnels only - just GSO partial, not specific feature. - if has_gso_partial: + ethtool(f"-K {cfg.ifname} tx-gso-partial off") + ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation off") + if feature in cfg.partial_features: ethtool(f"-K {cfg.ifname} tx-gso-partial on") - run_one_stream(cfg, ipver, remote_v4, remote_v6, - should_lso=tun_partial) + if ipver == "4": + ksft_pr("Testing with mangleid enabled") + ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation on") # Full feature enabled. ethtool(f"-K {cfg.ifname} {feature} on")
@@ -239,13 +227,14 @@ def main() -> None: query_nic_features(cfg) test_info = ( - # name, v4/v6 ethtool_feature tun:(type, partial, args) + # name, v4/v6 ethtool_feature tun:(type, args) ("", "4", "tx-tcp-segmentation", None), ("", "6", "tx-tcp6-segmentation", None), - ("vxlan", "", "tx-udp_tnl-segmentation", ("vxlan", True, "id 100 dstport 4789 noudpcsum")), - ("vxlan_csum", "", "tx-udp_tnl-csum-segmentation", ("vxlan", False, "id 100 dstport 4789 udpcsum")), - ("gre", "4", "tx-gre-segmentation", ("gre", False, "")), - ("gre", "6", "tx-gre-segmentation", ("ip6gre", False, "")), + ("vxlan", "4", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 noudpcsum")), + ("vxlan", "6", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 udp6zerocsumtx udp6zerocsumrx")), + ("vxlan_csum", "", "tx-udp_tnl-csum-segmentation", ("vxlan", "id 100 dstport 4789 udpcsum")), + ("gre", "4", "tx-gre-segmentation", ("gre", "")), + ("gre", "6", "tx-gre-segmentation", ("ip6gre", "")), ) cases = []
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/480 selftests: drv-net: tso: fix non-tunneled tso6 test case name
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Zahka <[email protected]>
[ Upstream commit b25b44cd178cc54277f2dc0ff3b3d5a37ae4b26b ]
The non-tunneled tso6 test case was showing up as:
ok 8 tso.ipv4
This is because of the way test_builder() uses the inner_ipver arg in test naming, and how test_info is iterated over in main(). Given that some tunnels not supported yet, e.g. ipip or sit, only support ipv4 or ipv6 as the inner network protocol, I think the best fix here is to call test_builder() in separate branches for tunneled and non-tunneled tests, and to make supported inner l3 types an explicit attribute of tunnel test cases.
# Detected qstat for LSO wire-packets
TAP version 13
1..14
ok 1 tso.ipv4
# Testing with mangleid enabled
ok 2 tso.vxlan4_ipv4
ok 3 tso.vxlan4_ipv6
# Testing with mangleid enabled
ok 4 tso.vxlan_csum4_ipv4
ok 5 tso.vxlan_csum4_ipv6
# Testing with mangleid enabled
ok 6 tso.gre4_ipv4
ok 7 tso.gre4_ipv6
ok 8 tso.ipv6
# Testing with mangleid enabled
ok 9 tso.vxlan6_ipv4
ok 10 tso.vxlan6_ipv6
# Testing with mangleid enabled
ok 11 tso.vxlan_csum6_ipv4
ok 12 tso.vxlan_csum6_ipv6
# Testing with mangleid enabled
ok 13 tso.gre6_ipv4
ok 14 tso.gre6_ipv6
# Totals: pass:14 fail:0 xfail:0 xpass:0 skip:0 error:0
--- tools/testing/selftests/drivers/net/hw/tso.py | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-)
tools/testing/selftests/drivers/net/hw/tso.py +14 -12
@@ -227,14 +227,14 @@ def main() -> None: query_nic_features(cfg) test_info = ( - # name, v4/v6 ethtool_feature tun:(type, args) - ("", "4", "tx-tcp-segmentation", None), - ("", "6", "tx-tcp6-segmentation", None), - ("vxlan", "4", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 noudpcsum")), - ("vxlan", "6", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 udp6zerocsumtx udp6zerocsumrx")), - ("vxlan_csum", "", "tx-udp_tnl-csum-segmentation", ("vxlan", "id 100 dstport 4789 udpcsum")), - ("gre", "4", "tx-gre-segmentation", ("gre", "")), - ("gre", "6", "tx-gre-segmentation", ("ip6gre", "")), + # name, v4/v6 ethtool_feature tun:(type, args, inner ip versions) + ("", "4", "tx-tcp-segmentation", None), + ("", "6", "tx-tcp6-segmentation", None), + ("vxlan", "4", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 noudpcsum", ("4", "6"))), + ("vxlan", "6", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 udp6zerocsumtx udp6zerocsumrx", ("4", "6"))), + ("vxlan_csum", "", "tx-udp_tnl-csum-segmentation", ("vxlan", "id 100 dstport 4789 udpcsum", ("4", "6"))), + ("gre", "4", "tx-gre-segmentation", ("gre", "", ("4", "6"))), + ("gre", "6", "tx-gre-segmentation", ("ip6gre","", ("4", "6"))), ) cases = []
@@ -244,11 +244,13 @@ def main() -> None: if info[1] and outer_ipver != info[1]: continue - cases.append(test_builder(info[0], cfg, outer_ipver, info[2], - tun=info[3], inner_ipver="4")) if info[3]: - cases.append(test_builder(info[0], cfg, outer_ipver, info[2], - tun=info[3], inner_ipver="6")) + cases += [ + test_builder(info[0], cfg, outer_ipver, info[2], info[3], inner_ipver) + for inner_ipver in info[3][2] + ] + else: + cases.append(test_builder(info[0], cfg, outer_ipver, info[2], None, outer_ipver)) ksft_run(cases=cases, args=(cfg, )) ksft_exit()
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/480 can: peak_usb: fix USB FD devices potential malfunction
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Grosjean <[email protected]>
[ Upstream commit 788199b73b6efe4ee2ade4d7457b50bb45493488 ]
The latest firmware versions of USB CAN FD interfaces export the EP numbers to be used to dialog with the device via the "type" field of a response to a vendor request structure, particularly when its value is greater than or equal to 2.
Correct the driver's test of this field.
--- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +9 -8
@@ -49,7 +49,7 @@ struct __packed pcan_ufd_fw_info {__le32 ser_no;/* S/N */ __le32 flags;/* special functions */ -/* extended data when type == PCAN_USBFD_TYPE_EXT */ +/* extended data when type >= PCAN_USBFD_TYPE_EXT */ u8 cmd_out_ep;/* ep for cmd */ u8 cmd_in_ep;/* ep for replies */ u8 data_out_ep[2 ];/* ep for CANx TX */
@@ -982,10 +982,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) dev->can.ctrlmode |=CAN_CTRLMODE_FD_NON_ISO ; } -/* if vendor rsp is of type 2, then it contains EP numbers to -* use for cmds pipes. If not, then default EP should be used. +/* if vendor rsp type is greater than or equal to 2, then it +* contains EP numbers to use for cmds pipes. If not, then +* default EP should be used. */ -if (fw_info->type !=cpu_to_le16 (PCAN_USBFD_TYPE_EXT )) { +if (le16_to_cpu (fw_info->type) <PCAN_USBFD_TYPE_EXT ) { fw_info->cmd_out_ep =PCAN_USBPRO_EP_CMDOUT ; fw_info->cmd_in_ep =PCAN_USBPRO_EP_CMDIN ; }
@@ -1018,11 +1019,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) dev->can_channel_id =le32_to_cpu (pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]); -/* if vendor rsp is of type 2, then it contains EP numbers to -* use for data pipes. If not, then statically defined EP are used -* (see peak_usb_create_dev()). +/* if vendor rsp type is greater than or equal to 2, then it contains EP +* numbers to use for data pipes. If not, then statically defined EP are +* used (see peak_usb_create_dev()). */ -if (fw_info->type ==cpu_to_le16 (PCAN_USBFD_TYPE_EXT )) { +if (le16_to_cpu (fw_info->type) >=PCAN_USBFD_TYPE_EXT ) { dev->ep_msg_in = fw_info->data_in_ep; dev->ep_msg_out = fw_info->data_out_ep[dev->ctrl_idx]; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/480 can: kvaser_pciefd: Store device channel index
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jimmy Assarsson <[email protected]>
[ Upstream commit d54b16b40ddadb7d0a77fff48af7b319a0cd6aae ]
Store device channel index in netdev.dev_port.
--- drivers/net/can/kvaser_pciefd.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/kvaser_pciefd.c +1 -0
@@ -981,6 +981,7 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie) can->completed_tx_bytes =0 ; can->bec.txerr =0 ; can->bec.rxerr =0 ; + can->can.dev->dev_port = i;init_completion (&can->start_comp);init_completion (&can->flush_comp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/480 can: kvaser_usb: Assign netdev.dev_port based on device channel index
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jimmy Assarsson <[email protected]>
[ Upstream commit c151b06a087a61c7a1790b75ee2f1d6edb6a8a45 ]
Assign netdev.dev_port based on the device channel index, to indicate the port number of the network device.
While this driver already uses netdev.dev_id for that purpose, dev_port is more appropriate. However, retain dev_id to avoid potential regressions.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -0
@@ -852,6 +852,7 @@ static int kvaser_usb_init_one(struct kvaser_usb *dev, int channel) netdev->ethtool_ops = &kvaser_usb_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->intf->dev); netdev->dev_id = channel; + netdev->dev_port = channel; dev->nets[channel] = priv;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/480 netfilter: xt_nfacct: dont assume acct name is null-terminated
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit bf58e667af7d96c8eb9411f926a0a0955f41ce21 ]
BUG: KASAN: slab-out-of-bounds in .. lib/vsprintf.c:721 Read of size 1 at addr ffff88801eac95c8 by task syz-executor183/5851 [..] string+0x231/0x2b0 lib/vsprintf.c:721 vsnprintf+0x739/0xf00 lib/vsprintf.c:2874 [..] nfacct_mt_checkentry+0xd2/0xe0 net/netfilter/xt_nfacct.c:41 xt_check_match+0x3d1/0xab0 net/netfilter/x_tables.c:523
nfnl_acct_find_get() handles non-null input, but the error printk relied on its presence.
--- net/netfilter/xt_nfacct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/xt_nfacct.c +2 -2
@@ -38,8 +38,8 @@ nfacct_mt_checkentry(const struct xt_mtchk_param *par) nfacct =nfnl_acct_find_get (par->net, info->name);if (nfacct ==NULL ) { -pr_info_ratelimited ("accounting object `%s' does not exists\n" , - info->name); +pr_info_ratelimited ("accounting object `%.*s' does not exist\n" , +NFACCT_NAME_MAX , info->name);return -ENOENT ; } info->nfacct = nfacct;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/480 net/mlx5e: Clear Read-Only port buffer size in PBMC before update
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Lazar <[email protected]>
[ Upstream commit fd4b97246a23c1149479b88490946bcfbd28de63 ]
When updating the PBMC register, we read its current value, modify desired fields, then write it back.
The port_buffer_size field within PBMC is Read-Only (RO). If this RO field contains a non-zero value when read, attempting to write it back will cause the entire PBMC register update to fail.
This commit ensures port_buffer_size is explicitly cleared to zero after reading the PBMC register but before writing back the modified value.
This allows updates to other fields in the PBMC register to succeed.
--- drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +3 -0
@@ -331,6 +331,9 @@ static int port_set_buffer(struct mlx5e_priv *priv,if (err) goto out; +/* RO bits should be set to 0 on write */ +MLX5_SET (pbmc_reg, in, port_buffer_size,0 ); + err =mlx5e_port_set_pbmc (mdev, in); out:kfree (in);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/480 net/mlx5e: Remove skb secpath if xfrm state is not found
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianbo Liu <[email protected]>
[ Upstream commit 6d19c44b5c6dd72f9a357d0399604ec16a77de3c ]
Hardware returns a unique identifier for a decrypted packet's xfrm state, this state is looked up in an xarray. However, the state might have been freed by the time of this lookup.
Currently, if the state is not found, only a counter is incremented. The secpath (sp) extension on the skb is not removed, resulting in sp->len becoming 0.
Subsequently, functions like __xfrm_policy_check() attempt to access fields such as xfrm_input_state(skb)->xso.type (which dereferences sp->xvec[sp->len - 1]) without first validating sp->len. This leads to a crash when dereferencing an invalid state pointer.
This patch prevents the crash by explicitly removing the secpath extension from the skb if the xfrm state is not found after hardware decryption. This ensures downstream functions do not operate on a zero-length secpath.
BUG: unable to handle page fault for address: ffffffff000002c8 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 282e067 P4D 282e067 PUD 0 Oops: Oops: 0000 [#1] SMP CPU: 12 UID: 0 PID: 0 Comm: swapper/12 Not tainted 6.15.0-rc7_for_upstream_min_debug_2025_05_27_22_44 #1 NONE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:__xfrm_policy_check+0x61a/0xa30 Code: b6 77 7f 83 e6 02 74 14 4d 8b af d8 00 00 00 41 0f b6 45 05 c1 e0 03 48 98 49 01 c5 41 8b 45 00 83 e8 01 48 98 49 8b 44 c5 10 <0f> b6 80 c8 02 00 00 83 e0 0c 3c 04 0f 84 0c 02 00 00 31 ff 80 fa RSP: 0018:ffff88885fb04918 EFLAGS: 00010297 RAX: ffffffff00000000 RBX: 0000000000000002 RCX: 0000000000000000 RDX: 0000000000000002 RSI: 0000000000000002 RDI: 0000000000000000 RBP: ffffffff8311af80 R08: 0000000000000020 R09: 00000000c2eda353 R10: ffff88812be2bbc8 R11: 000000001faab533 R12: ffff88885fb049c8 R13: ffff88812be2bbc8 R14: 0000000000000000 R15: ffff88811896ae00 FS: 0000000000000000(0000) GS:ffff8888dca82000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff000002c8 CR3: 0000000243050002 CR4: 0000000000372eb0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> ? try_to_wake_up+0x108/0x4c0 ? udp4_lib_lookup2+0xbe/0x150 ? udp_lib_lport_inuse+0x100/0x100 ? __udp4_lib_lookup+0x2b0/0x410 __xfrm_policy_check2.constprop.0+0x11e/0x130 udp_queue_rcv_one_skb+0x1d/0x530 udp_unicast_rcv_skb+0x76/0x90 __udp4_lib_rcv+0xa64/0xe90 ip_protocol_deliver_rcu+0x20/0x130 ip_local_deliver_finish+0x75/0xa0 ip_local_deliver+0xc1/0xd0 ? ip_protocol_deliver_rcu+0x130/0x130 ip_sublist_rcv+0x1f9/0x240 ? ip_rcv_finish_core+0x430/0x430 ip_list_rcv+0xfc/0x130 __netif_receive_skb_list_core+0x181/0x1e0 netif_receive_skb_list_internal+0x200/0x360 ? mlx5e_build_rx_skb+0x1bc/0xda0 [mlx5_core] gro_receive_skb+0xfd/0x210 mlx5e_handle_rx_cqe_mpwrq+0x141/0x280 [mlx5_core] mlx5e_poll_rx_cq+0xcc/0x8e0 [mlx5_core] ? mlx5e_handle_rx_dim+0x91/0xd0 [mlx5_core] mlx5e_napi_poll+0x114/0xab0 [mlx5_core] __napi_poll+0x25/0x170 net_rx_action+0x32d/0x3a0 ? mlx5_eq_comp_int+0x8d/0x280 [mlx5_core] ? notifier_call_chain+0x33/0xa0 handle_softirqs+0xda/0x250 irq_exit_rcu+0x6d/0xc0 common_interrupt+0x81/0xa0 </IRQ>
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +4 -0
@@ -327,6 +327,10 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,if (unlikely (!sa_entry)) {rcu_read_unlock ();atomic64_inc (&ipsec->sw_stats.ipsec_rx_drop_sadb_miss); +/* Clear secpath to prevent invalid dereference +* in downstream XFRM policy checks. +*/ +secpath_reset (skb);return ; }xfrm_state_hold (sa_entry->x);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/480 macsec: set IFF_UNICAST_FLT priv flag
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 0349659fd72f662c054ff20d432559bfaa228ce4 ]
Cosmin reports the following locking issue:
# BUG: sleeping function called from invalid context at kernel/locking/mutex.c:275
# dump_stack_lvl+0x4f/0x60 # __might_resched+0xeb/0x140 # mutex_lock+0x1a/0x40 # dev_set_promiscuity+0x26/0x90 # __dev_set_promiscuity+0x85/0x170 # __dev_set_rx_mode+0x69/0xa0 # dev_uc_add+0x6d/0x80 # vlan_dev_open+0x5f/0x120 [8021q] # __dev_open+0x10c/0x2a0 # __dev_change_flags+0x1a4/0x210 # netif_change_flags+0x22/0x60 # do_setlink.isra.0+0xdb0/0x10f0 # rtnl_newlink+0x797/0xb00 # rtnetlink_rcv_msg+0x1cb/0x3f0 # netlink_rcv_skb+0x53/0x100 # netlink_unicast+0x273/0x3b0 # netlink_sendmsg+0x1f2/0x430
Which is similar to recent syzkaller reports in [0] and [1] and triggers because macsec does not advertise IFF_UNICAST_FLT although it has proper ndo_set_rx_mode callback that takes care of pushing uc/mc addresses down to the real device.
In general, dev_uc_add call path is problematic for stacking non-IFF_UNICAST_FLT because we might grab netdev instance lock under addr_list_lock spinlock, so this is not a systemic fix.
0: https://lore.kernel.org/netdev/[email protected]
1: https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/macsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macsec.c +1 -1
@@ -3868,7 +3868,7 @@ static void macsec_setup(struct net_device *dev)ether_setup (dev); dev->min_mtu =0 ; dev->max_mtu =ETH_MAX_MTU ; - dev->priv_flags |=IFF_NO_QUEUE ; + dev->priv_flags |=IFF_NO_QUEUE |IFF_UNICAST_FLT ; dev->netdev_ops = &macsec_netdev_ops; dev->needs_free_netdev = true; dev->priv_destructor = macsec_free_netdev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/480 net: dsa: microchip: Fix wrong rx drop MIB counter for KSZ8863
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristram Ha <[email protected]>
[ Upstream commit 165a7f5db919ab68a45ae755cceb751e067273ef ]
When KSZ8863 support was first added to KSZ driver the RX drop MIB counter was somehow defined as 0x105. The TX drop MIB counter starts at 0x100 for port 1, 0x101 for port 2, and 0x102 for port 3, so the RX drop MIB counter should start at 0x103 for port 1, 0x104 for port 2, and 0x105 for port 3.
There are 5 ports for KSZ8895, so its RX drop MIB counter starts at 0x105.
--- drivers/net/dsa/microchip/ksz8.c | 3 +++ drivers/net/dsa/microchip/ksz8_reg.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz8.c +3 -0
@@ -371,6 +371,9 @@ static void ksz8863_r_mib_pkt(struct ksz_device *dev, int port, u16 addr, addr -= dev->info->reg_mib_cnt; ctrl_addr = addr ?KSZ8863_MIB_PACKET_DROPPED_TX_0 :KSZ8863_MIB_PACKET_DROPPED_RX_0 ; +if (ksz_is_8895_family (dev) && + ctrl_addr ==KSZ8863_MIB_PACKET_DROPPED_RX_0 ) + ctrl_addr =KSZ8895_MIB_PACKET_DROPPED_RX_0 ; ctrl_addr += port; ctrl_addr |=IND_ACC_TABLE (TABLE_MIB |TABLE_READ );
drivers/net/dsa/microchip/ksz8_reg.h +3 -1
@@ -784,7 +784,9 @@#define KSZ8795_MIB_TOTAL_TX_1 0x105#define KSZ8863_MIB_PACKET_DROPPED_TX_0 0x100 -#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x105 +#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x103 + +#define KSZ8895_MIB_PACKET_DROPPED_RX_0 0x105#define MIB_PACKET_DROPPED 0x0000FFFF
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/480 neighbour: Fix null-ptr-deref in neigh_flush_dev().
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 1bbb76a899486827394530916f01214d049931b3 ]
kernel test robot reported null-ptr-deref in neigh_flush_dev(). [0]
The cited commit introduced per-netdev neighbour list and converted neigh_flush_dev() to use it instead of the global hash table.
One thing we missed is that neigh_table_clear() calls neigh_ifdown() with NULL dev.
Let's restore the hash table iteration.
Note that IPv6 module is no longer unloadable, so neigh_table_clear() is called only when IPv6 fails to initialise, which is unlikely to happen.
[0]:
IPv6: Attempt to unregister permanent protocol 136
IPv6: Attempt to unregister permanent protocol 17
Oops: general protection fault, probably for non-canonical address 0xdffffc00000001a0: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000d00-0x0000000000000d07] CPU: 1 UID: 0 PID: 1 Comm: systemd Tainted: G T 6.12.0-rc6-01246-gf7f52738637f #1 Tainted: [T]=RANDSTRUCT Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:neigh_flush_dev.llvm.6395807810224103582+0x52/0x570 Code: c1 e8 03 42 8a 04 38 84 c0 0f 85 15 05 00 00 31 c0 41 83 3e 0a 0f 94 c0 48 8d 1c c3 48 81 c3 f8 0c 00 00 48 89 d8 48 c1 e8 03 <42> 80 3c 38 00 74 08 48 89 df e8 f7 49 93 fe 4c 8b 3b 4d 85 ff 0f RSP: 0000:ffff88810026f408 EFLAGS: 00010206 RAX: 00000000000001a0 RBX: 0000000000000d00 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffc0631640 RBP: ffff88810026f470 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffffffffc0625250 R14: ffffffffc0631640 R15: dffffc0000000000 FS: 00007f575cb83940(0000) GS:ffff8883aee00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f575db40008 CR3: 00000002bf936000 CR4: 00000000000406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __neigh_ifdown.llvm.6395807810224103582+0x44/0x390 neigh_table_clear+0xb1/0x268 ndisc_cleanup+0x21/0x38 [ipv6] init_module+0x2f5/0x468 [ipv6] do_one_initcall+0x1ba/0x628 do_init_module+0x21a/0x530 load_module+0x2550/0x2ea0 __se_sys_finit_module+0x3d2/0x620 __x64_sys_finit_module+0x76/0x88 x64_sys_call+0x7ff/0xde8 do_syscall_64+0xfb/0x1e8 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x7f575d6f2719 Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 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 8b 0d b7 06 0d 00 f7 d8 64 89 01 48 RSP: 002b:00007fff82a2a268 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 0000557827b45310 RCX: 00007f575d6f2719 RDX: 0000000000000000 RSI: 00007f575d584efd RDI: 0000000000000004 RBP: 00007f575d584efd R08: 0000000000000000 R09: 0000557827b47b00 R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000020000 R13: 0000000000000000 R14: 0000557827b470e0 R15: 00007f575dbb4270 </TASK> Modules linked in: ipv6(+)
--- net/core/neighbour.c | 88 ++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 27 deletions(-)
net/core/neighbour.c +61 -27
@@ -368,6 +368,43 @@ static void pneigh_queue_purge(struct sk_buff_head *list, struct net *net, } } +static void neigh_flush_one (struct neighbour *n) +{ +hlist_del_rcu (&n->hash); +hlist_del_rcu (&n->dev_list); + +write_lock (&n->lock); + +neigh_del_timer (n); +neigh_mark_dead (n); + +if (refcount_read (&n->refcnt) !=1 ) { +/* The most unpleasant situation. +* We must destroy neighbour entry, +* but someone still uses it. +* +* The destroy will be delayed until +* the last user releases us, but +* we must kill timers etc. and move +* it to safe state. +*/ +__skb_queue_purge (&n->arp_queue); + n->arp_queue_len_bytes =0 ; +WRITE_ONCE (n->output, neigh_blackhole); + +if (n->nud_state &NUD_VALID ) + n->nud_state =NUD_NOARP ; +else + n->nud_state =NUD_NONE ; + +neigh_dbg (2 ,"neigh %p is stray\n" , n); + } + +write_unlock (&n->lock); + +neigh_cleanup_and_release (n); +} +static void neigh_flush_dev (struct neigh_table *tbl,struct net_device *dev,bool skip_perm) {
@@ -381,32 +418,24 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,if (skip_perm && n->nud_state &NUD_PERMANENT )continue ; -hlist_del_rcu (&n->hash); -hlist_del_rcu (&n->dev_list); -write_lock (&n->lock); -neigh_del_timer (n); -neigh_mark_dead (n); -if (refcount_read (&n->refcnt) !=1 ) { -/* The most unpleasant situation. -* We must destroy neighbour entry, -* but someone still uses it. -* -* The destroy will be delayed until -* the last user releases us, but -* we must kill timers etc. and move -* it to safe state. -*/ -__skb_queue_purge (&n->arp_queue); - n->arp_queue_len_bytes =0 ; -WRITE_ONCE (n->output, neigh_blackhole); -if (n->nud_state &NUD_VALID ) - n->nud_state =NUD_NOARP ; -else - n->nud_state =NUD_NONE ; -neigh_dbg (2 ,"neigh %p is stray\n" , n); - } -write_unlock (&n->lock); -neigh_cleanup_and_release (n); +neigh_flush_one (n); + } +} + +static void neigh_flush_table (struct neigh_table *tbl) +{ +struct neigh_hash_table *nht; +int i; + + nht =rcu_dereference_protected (tbl->nht, +lockdep_is_held (&tbl->lock)); + +for (i =0 ; i < (1 << nht->hash_shift); i++) { +struct hlist_node *tmp; +struct neighbour *n; + +neigh_for_each_in_bucket_safe (n, tmp, &nht->hash_heads[i]) +neigh_flush_one (n); } }
@@ -422,7 +451,12 @@ static int __neigh_ifdown(struct neigh_table *tbl, struct net_device *dev, bool skip_perm) {write_lock_bh (&tbl->lock); -neigh_flush_dev (tbl, dev, skip_perm); +if (likely (dev)) { +neigh_flush_dev (tbl, dev, skip_perm); + }else { +DEBUG_NET_WARN_ON_ONCE (skip_perm); +neigh_flush_table (tbl); + }pneigh_ifdown_and_unlock (tbl, dev);pneigh_queue_purge (&tbl->proxy_queue, dev ?dev_net (dev) :NULL , tbl->family);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/480 stmmac: xsk: fix negative overflow of budget in zerocopy mode
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 2764ab51d5f0e8c7d3b7043af426b1883e3bde1d ]
A negative overflow can happen when the budget number of descs are consumed. as long as the budget is decreased to zero, it will again go into while (budget-- > 0) statement and get decreased by one, so the overflow issue can happen. It will lead to returning true whereas the expected value should be false.
In this case where all the budget is used up, it means zc function should return false to let the poll run again because normally we might have more data to process. Without this patch, zc function would return true instead.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -2585,7 +2585,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) budget =min (budget,stmmac_tx_avail (priv, queue)); -while (budget-- >0 ) { +for (; budget >0 ; budget--) {struct stmmac_metadata_request meta_req;struct xsk_tx_metadata *meta =NULL ;dma_addr_t dma_addr;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/480 igb: xsk: solve negative overflow of nb_pkts in zerocopy mode
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 3b7c13dfdcc26a78756cc17a23cdf4310c5a24a9 ]
There is no break time in the while() loop, so every time at the end of igb_xmit_zc(), negative overflow of nb_pkts will occur, which renders the return value always false. But theoretically, the result should be set after calling xsk_tx_peek_release_desc_batch(). We can take i40e_xmit_zc() as a good example.
Returning false means we're not done with transmission and we need one more poll, which is exactly what igb_xmit_zc() always did before this patch. After this patch, the return value depends on the nb_pkts value. Two cases might happen then:
1. if (nb_pkts < budget), it means we process all the possible data, so return true and no more necessary poll will be triggered because of this.
2. if (nb_pkts == budget), it means we might have more data, so return false to let another poll run again.
--- drivers/net/ethernet/intel/igb/igb_xsk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_xsk.c +1 -2
@@ -481,7 +481,7 @@ bool igb_xmit_zc(struct igb_ring *tx_ring, struct xsk_buff_pool *xsk_pool)if (!nb_pkts)return true; -while (nb_pkts-- >0 ) { +for (; i < nb_pkts; i++) { dma =xsk_buff_raw_get_dma (xsk_pool, descs[i].addr);xsk_buff_raw_dma_sync_for_device (xsk_pool, dma, descs[i].len);
@@ -511,7 +511,6 @@ bool igb_xmit_zc(struct igb_ring *tx_ring, struct xsk_buff_pool *xsk_pool) total_bytes += descs[i].len; - i++; tx_ring->next_to_use++; tx_buffer_info->next_to_watch = tx_desc;if (tx_ring->next_to_use == tx_ring->count)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/480 selftests: rtnetlink.sh: remove esp4_offload after test
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiumei Mu <[email protected]>
[ Upstream commit 5b32321fdaf3fd1a92ec726af18765e225b0ee2b ]
The esp4_offload module, loaded during IPsec offload tests, should be reset to its default settings after testing.
Otherwise, leaving it enabled could unintentionally affect subsequence test cases by keeping offload active.
Without this fix:
$ lsmod | grep offload; ./rtnetlink.sh -t kci_test_ipsec_offload ; lsmod | grep offload; PASS: ipsec_offload esp4_offload 12288 0 esp4 32768 1 esp4_offload
With this fix:
$ lsmod | grep offload; ./rtnetlink.sh -t kci_test_ipsec_offload ; lsmod | grep offload; PASS: ipsec_offload
--- tools/testing/selftests/net/rtnetlink.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/net/rtnetlink.sh +6 -0
@@ -673,6 +673,11 @@ kci_test_ipsec_offload() sysfsf=$sysfsd/ipsec sysfsnet=/sys/bus/netdevsim/devices/netdevsim0/net/ probed=false + esp4_offload_probed_default=false + + if lsmod | grep -q esp4_offload; then + esp4_offload_probed_default=true + fi if ! mount | grep -q debugfs; then mount -t debugfs none /sys/kernel/debug/ &> /dev/null
@@ -766,6 +771,7 @@ EOF fi # clean up any leftovers + ! "$esp4_offload_probed_default" && lsmod | grep -q esp4_offload && rmmod esp4_offload echo 0 > /sys/bus/netdevsim/del_device $probed && rmmod netdevsim
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/480 vrf: Drop existing dst reference in vrf_ip6_input_dst
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit f388f807eca1de9e6e70f9ffb1a573c3811c4215 ]
Commit ff3fbcdd4724 ("selftests: tc: Add generic erspan_opts matching support for tc-flower") started triggering the following kmemleak warning:
unreferenced object 0xffff888015fb0e00 (size 512):
comm "softirq", pid 0, jiffies 4294679065 hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 40 d2 85 9e ff ff ff ff ........@.......
41 69 59 9d ff ff ff ff 00 00 00 00 00 00 00 00 AiY.............
backtrace (crc 30b71e8b):
__kmalloc_noprof+0x359/0x460
metadata_dst_alloc+0x28/0x490
erspan_rcv+0x4f1/0x1160 [ip_gre]
gre_rcv+0x217/0x240 [ip_gre]
gre_rcv+0x1b8/0x400 [gre]
ip_protocol_deliver_rcu+0x31d/0x3a0
ip_local_deliver_finish+0x37d/0x620
ip_local_deliver+0x174/0x460
ip_rcv+0x52b/0x6b0
__netif_receive_skb_one_core+0x149/0x1a0
process_backlog+0x3c8/0x1390
__napi_poll.constprop.0+0xa1/0x390
net_rx_action+0x59b/0xe00
handle_softirqs+0x22b/0x630
do_softirq+0xb1/0xf0
__local_bh_enable_ip+0x115/0x150vrf_ip6_input_dst unconditionally sets skb dst entry, add a call to skb_dst_drop to drop any existing entry.
--- drivers/net/vrf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vrf.c +2 -0
@@ -1304,6 +1304,8 @@ static void vrf_ip6_input_dst(struct sk_buff *skb, struct net_device *vrf_dev,struct net *net =dev_net (vrf_dev);struct rt6_info *rt6; +skb_dst_drop (skb); + rt6 =vrf_ip6_route_lookup (net, vrf_dev, &fl6, ifindex, skb,RT6_LOOKUP_F_HAS_SADDR |RT6_LOOKUP_F_IFACE );if (unlikely (!rt6))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/480 ipv6: prevent infinite loop in rt6_nlmsg_size()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 54e6fe9dd3b0e7c481c2228782c9494d653546da ]
While testing prior patch, I was able to trigger an infinite loop in rt6_nlmsg_size() in the following place:
list_for_each_entry_rcu(sibling, &f6i->fib6_siblings,
fib6_siblings) {
rt6_nh_nlmsg_size(sibling->fib6_nh, &nexthop_len);
}This is because fib6_del_route() and fib6_add_rt2node() uses list_del_rcu(), which can confuse rcu readers, because they might no longer see the head of the list.
Restart the loop if f6i->fib6_nsiblings is zero.
--- net/ipv6/ip6_fib.c | 4 ++-- net/ipv6/route.c | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 18 deletions(-)
net/ipv6/ip6_fib.c +2 -2
@@ -1244,7 +1244,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, &rt->fib6_siblings, fib6_siblings) sibling->fib6_nsiblings--; - rt->fib6_nsiblings =0 ; +WRITE_ONCE (rt->fib6_nsiblings,0 );list_del_rcu (&rt->fib6_siblings);rt6_multipath_rebalance (next_sibling);return err;
@@ -1962,7 +1962,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,list_for_each_entry_safe (sibling, next_sibling, &rt->fib6_siblings, fib6_siblings) sibling->fib6_nsiblings--; - rt->fib6_nsiblings =0 ; +WRITE_ONCE (rt->fib6_nsiblings,0 );list_del_rcu (&rt->fib6_siblings);rt6_multipath_rebalance (next_sibling); }
net/ipv6/route.c +18 -16
@@ -5596,32 +5596,34 @@ static int rt6_nh_nlmsg_size(struct fib6_nh *nh, void *arg)static size_t rt6_nlmsg_size (struct fib6_info *f6i) { +struct fib6_info *sibling; +struct fib6_nh *nh;int nexthop_len;if (f6i->nh) { nexthop_len =nla_total_size (4 );/* RTA_NH_ID */ nexthop_for_each_fib6_nh (f6i->nh, rt6_nh_nlmsg_size, &nexthop_len); - }else { -struct fib6_nh *nh = f6i->fib6_nh; -struct fib6_info *sibling; - - nexthop_len =0 ; -if (f6i->fib6_nsiblings) { -rt6_nh_nlmsg_size (nh, &nexthop_len); - -rcu_read_lock (); + goto common; + } -list_for_each_entry_rcu (sibling, &f6i->fib6_siblings, - fib6_siblings) { -rt6_nh_nlmsg_size (sibling->fib6_nh, &nexthop_len); - } +rcu_read_lock (); +retry: + nh = f6i->fib6_nh; + nexthop_len =0 ; +if (READ_ONCE (f6i->fib6_nsiblings)) { +rt6_nh_nlmsg_size (nh, &nexthop_len); -rcu_read_unlock (); +list_for_each_entry_rcu (sibling, &f6i->fib6_siblings, + fib6_siblings) { +rt6_nh_nlmsg_size (sibling->fib6_nh, &nexthop_len); +if (!READ_ONCE (f6i->fib6_nsiblings)) + goto retry; } - nexthop_len +=lwtunnel_get_encap_size (nh->fib_nh_lws); } - +rcu_read_unlock (); + nexthop_len +=lwtunnel_get_encap_size (nh->fib_nh_lws); +common:return NLMSG_ALIGN (sizeof (struct rtmsg )) +nla_total_size (16 )/* RTA_SRC */ +nla_total_size (16 )/* RTA_DST */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/480 ipv6: fix possible infinite loop in fib6_info_uses_dev()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f8d8ce1b515a0a6af72b30502670a406cfb75073 ]
fib6_info_uses_dev() seems to rely on RCU without an explicit protection.
Like the prior fix in rt6_nlmsg_size(),
we need to make sure fib6_del_route() or fib6_add_rt2node() have not removed the anchor from the list, or we risk an infinite loop.
--- net/ipv6/route.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
net/ipv6/route.c +11 -6
@@ -5884,16 +5884,21 @@ static bool fib6_info_uses_dev(const struct fib6_info *f6i,if (f6i->fib6_nh->fib_nh_dev == dev)return true; -if (f6i->fib6_nsiblings) { -struct fib6_info *sibling, *next_sibling; +if (READ_ONCE (f6i->fib6_nsiblings)) { +const struct fib6_info *sibling; -list_for_each_entry_safe (sibling, next_sibling, - &f6i->fib6_siblings, fib6_siblings) { -if (sibling->fib6_nh->fib_nh_dev == dev) +rcu_read_lock (); +list_for_each_entry_rcu (sibling, &f6i->fib6_siblings, + fib6_siblings) { +if (sibling->fib6_nh->fib_nh_dev == dev) { +rcu_read_unlock ();return true; + } +if (!READ_ONCE (f6i->fib6_nsiblings)) +break ; } +rcu_read_unlock (); } -return false; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/480 ipv6: annotate data-races around rt->fib6_nsiblings
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 31d7d67ba1274f42494256d52e86da80ed09f3cb ]
rt->fib6_nsiblings can be read locklessly, add corresponding READ_ONCE() and WRITE_ONCE() annotations.
--- net/ipv6/ip6_fib.c | 20 +++++++++++++------- net/ipv6/route.c | 5 +++-- 2 files changed, 16 insertions(+), 9 deletions(-)
net/ipv6/ip6_fib.c +13 -7
@@ -433,15 +433,17 @@ struct fib6_dump_arg {static int fib6_rt_dump (struct fib6_info *rt,struct fib6_dump_arg *arg) {enum fib_event_type fib_event =FIB_EVENT_ENTRY_REPLACE ; +unsigned int nsiblings;int err;if (!rt || rt == arg->net->ipv6.fib6_null_entry)return 0 ; -if (rt->fib6_nsiblings) + nsiblings =READ_ONCE (rt->fib6_nsiblings); +if (nsiblings) err =call_fib6_multipath_entry_notifier (arg->nb, fib_event, rt, - rt->fib6_nsiblings, + nsiblings, arg->extack);else err = call_fib6_entry_notifier(arg->nb, fib_event, rt,
@@ -1119,7 +1121,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,if (rt6_duplicate_nexthop (iter, rt)) {if (rt->fib6_nsiblings) - rt->fib6_nsiblings =0 ; +WRITE_ONCE (rt->fib6_nsiblings,0 );if (!(iter->fib6_flags &RTF_EXPIRES ))return -EEXIST ;if (!(rt->fib6_flags &RTF_EXPIRES )) {
@@ -1148,7 +1150,8 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,*/ if (rt_can_ecmp &&rt6_qualify_for_ecmp (iter)) - rt->fib6_nsiblings++; +WRITE_ONCE (rt->fib6_nsiblings, + rt->fib6_nsiblings +1 ); }if (iter->fib6_metric > rt->fib6_metric)
@@ -1198,7 +1201,8 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt, fib6_nsiblings =0 ;list_for_each_entry_safe (sibling, temp_sibling, &rt->fib6_siblings, fib6_siblings) { - sibling->fib6_nsiblings++; +WRITE_ONCE (sibling->fib6_nsiblings, + sibling->fib6_nsiblings +1 );BUG_ON (sibling->fib6_nsiblings != rt->fib6_nsiblings); fib6_nsiblings++; }
@@ -1243,7 +1247,8 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,list_for_each_entry_safe (sibling, next_sibling, &rt->fib6_siblings, fib6_siblings) - sibling->fib6_nsiblings--; +WRITE_ONCE (sibling->fib6_nsiblings, + sibling->fib6_nsiblings -1 );WRITE_ONCE (rt->fib6_nsiblings,0 );list_del_rcu (&rt->fib6_siblings);rt6_multipath_rebalance (next_sibling);
@@ -1961,7 +1966,8 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn, notify_del = true;list_for_each_entry_safe (sibling, next_sibling, &rt->fib6_siblings, fib6_siblings) - sibling->fib6_nsiblings--; +WRITE_ONCE (sibling->fib6_nsiblings, + sibling->fib6_nsiblings -1 );WRITE_ONCE (rt->fib6_nsiblings,0 );list_del_rcu (&rt->fib6_siblings);rt6_multipath_rebalance (next_sibling);
net/ipv6/route.c +3 -2
@@ -5249,7 +5249,8 @@ static void ip6_route_mpath_notify(struct fib6_info *rt,*/ rcu_read_lock (); -if ((nlflags &NLM_F_APPEND ) && rt_last && rt_last->fib6_nsiblings) { +if ((nlflags &NLM_F_APPEND ) && rt_last && +READ_ONCE (rt_last->fib6_nsiblings)) { rt =list_first_or_null_rcu (&rt_last->fib6_siblings, struct fib6_info, fib6_siblings);
@@ -5782,7 +5783,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,if (dst->lwtstate &&lwtunnel_fill_encap (skb, dst->lwtstate,RTA_ENCAP ,RTA_ENCAP_TYPE ) <0 ) goto nla_put_failure; - }else if (rt->fib6_nsiblings) { + }else if (READ_ONCE (rt->fib6_nsiblings)) {struct fib6_info *sibling;struct nlattr *mp;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/480 bpf/preload: Dont select USERMODE_DRIVER
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 2b03164eee20eac7ce0fe3aa4fbda7efc1e5427a ]
The usermode driver framework is not used anymore by the BPF preload code.
--- kernel/bpf/preload/Kconfig | 1 - 1 file changed, 1 deletion(-)
kernel/bpf/preload/Kconfig +0 -1
@@ -10,7 +10,6 @@ menuconfig BPF_PRELOAD # The dependency on !COMPILE_TEST prevents it from being enabled # in allmodconfig or allyesconfig configurations depends on !COMPILE_TEST - select USERMODE_DRIVER help This builds kernel module with several embedded BPF programs that are pinned into BPF FS mount point as human readable files that are
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/480 bpf, arm64: Fix fp initialization for exception boundary
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit b114fcee766d5101eada1aca7bb5fd0a86c89b35 ]
In the ARM64 BPF JIT when prog->aux->exception_boundary is set for a BPF program, find_used_callee_regs() is not called because for a program acting as exception boundary, all callee saved registers are saved. find_used_callee_regs() sets ctx->fp_used = true; when it sees FP being used in any of the instructions.
For programs acting as exception boundary, ctx->fp_used remains false even if frame pointer is used by the program and therefore, FP is not set-up for such programs in the prologue. This can cause the kernel to crash due to a pagefault.
Fix it by setting ctx->fp_used = true for exception boundary programs as fp is always saved in such programs.
--- arch/arm64/net/bpf_jit_comp.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/net/bpf_jit_comp.c +1 -0
@@ -412,6 +412,7 @@ static void push_callee_regs(struct jit_ctx *ctx)emit (A64_PUSH (A64_R (23 ),A64_R (24 ),A64_SP ), ctx);emit (A64_PUSH (A64_R (25 ),A64_R (26 ),A64_SP ), ctx);emit (A64_PUSH (A64_R (27 ),A64_R (28 ),A64_SP ), ctx); + ctx->fp_used = true; }else {find_used_callee_regs (ctx);for (i =0 ; i +1 < ctx->nr_used_callee_reg; i +=2 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/480 RISC-V: KVM: Fix inclusion of Smnpm in the guest ISA bitmap
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Holland <[email protected]>
[ Upstream commit 7826c8f37220daabf90c09fcd9a835d6763f1372 ]
The Smnpm extension requires special handling because the guest ISA extension maps to a different extension (Ssnpm) on the host side. commit 1851e7836212 ("RISC-V: KVM: Allow Smnpm and Ssnpm extensions for guests") missed that the vcpu->arch.isa bit is based only on the host extension, so currently both KVM_RISCV_ISA_EXT_{SMNPM,SSNPM} map to vcpu->arch.isa[RISCV_ISA_EXT_SSNPM]. This does not cause any problems for the guest, because both extensions are force-enabled anyway when the host supports Ssnpm, but prevents checking for (guest) Smnpm in the SBI FWFT logic.
Redefine kvm_isa_ext_arr to look up the guest extension, since only the guest -> host mapping is unambiguous. Factor out the logic for checking for host support of an extension, so this special case only needs to be handled in one place, and be explicit about which variables hold a host vs a guest ISA extension.
--- arch/riscv/kvm/vcpu_onereg.c | 83 +++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 30 deletions(-)
arch/riscv/kvm/vcpu_onereg.c +53 -30
@@ -23,7 +23,7 @@#define KVM_ISA_EXT_ARR (ext) \ [KVM_RISCV_ISA_EXT_##ext] = RISCV_ISA_EXT_##ext -/* Mapping between KVM ISA Extension ID & Host ISA extension ID */ +/* Mapping between KVM ISA Extension ID & guest ISA extension ID */ static const unsigned long kvm_isa_ext_arr[] = {/* Single letter extensions (alphabetically sorted) */ [KVM_RISCV_ISA_EXT_A ] = RISCV_ISA_EXT_a,
@@ -35,7 +35,7 @@ static const unsigned long kvm_isa_ext_arr[] = { [KVM_RISCV_ISA_EXT_M] = RISCV_ISA_EXT_m, [KVM_RISCV_ISA_EXT_V] = RISCV_ISA_EXT_v,/* Multi letter extensions (alphabetically sorted) */ - [KVM_RISCV_ISA_EXT_SMNPM] = RISCV_ISA_EXT_SSNPM, +KVM_ISA_EXT_ARR (SMNPM ),KVM_ISA_EXT_ARR (SMSTATEEN ),KVM_ISA_EXT_ARR (SSAIA ), KVM_ISA_EXT_ARR(SSCOFPMF),
@@ -112,6 +112,36 @@ static unsigned long kvm_riscv_vcpu_base2isa_ext(unsigned long base_ext)return KVM_RISCV_ISA_EXT_MAX ; } +static int kvm_riscv_vcpu_isa_check_host (unsigned long kvm_ext,unsigned long *guest_ext) +{ +unsigned long host_ext; + +if (kvm_ext >=KVM_RISCV_ISA_EXT_MAX || + kvm_ext >=ARRAY_SIZE (kvm_isa_ext_arr)) +return -ENOENT ; + + *guest_ext = kvm_isa_ext_arr[kvm_ext]; +switch (*guest_ext) { +case RISCV_ISA_EXT_SMNPM : +/* +* Pointer masking effective in (H)S-mode is provided by the +* Smnpm extension, so that extension is reported to the guest, +* even though the CSR bits for configuring VS-mode pointer +* masking on the host side are part of the Ssnpm extension. +*/ + host_ext =RISCV_ISA_EXT_SSNPM ; +break ; +default : + host_ext = *guest_ext; +break ; + } + +if (!__riscv_isa_extension_available (NULL , host_ext)) +return -ENOENT ; + +return 0 ; +} +static bool kvm_riscv_vcpu_isa_enable_allowed (unsigned long ext) {switch (ext) {
@@ -219,13 +249,13 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext)void kvm_riscv_vcpu_setup_isa (struct kvm_vcpu *vcpu) { -unsigned long host_isa, i; +unsigned long guest_ext, i;for (i =0 ; i <ARRAY_SIZE (kvm_isa_ext_arr); i++) { - host_isa = kvm_isa_ext_arr[i]; -if (__riscv_isa_extension_available (NULL , host_isa) && -kvm_riscv_vcpu_isa_enable_allowed (i)) -set_bit (host_isa, vcpu->arch.isa); +if (kvm_riscv_vcpu_isa_check_host (i, &guest_ext)) +continue ; +if (kvm_riscv_vcpu_isa_enable_allowed (i)) +set_bit (guest_ext, vcpu->arch.isa); } }
@@ -607,18 +637,15 @@ static int riscv_vcpu_get_isa_ext_single(struct kvm_vcpu *vcpu,unsigned long reg_num, unsigned long *reg_val) { - unsigned long host_isa_ext; - -if (reg_num >=KVM_RISCV_ISA_EXT_MAX || - reg_num >=ARRAY_SIZE (kvm_isa_ext_arr)) -return -ENOENT ; + unsigned long guest_ext; +int ret; - host_isa_ext = kvm_isa_ext_arr[reg_num]; -if (!__riscv_isa_extension_available (NULL , host_isa_ext)) -return -ENOENT ; + ret =kvm_riscv_vcpu_isa_check_host (reg_num, &guest_ext); +if (ret) +return ret; *reg_val =0 ; -if (__riscv_isa_extension_available (vcpu->arch.isa, host_isa_ext)) +if (__riscv_isa_extension_available (vcpu->arch.isa, guest_ext)) *reg_val =1 ;/* Mark the given extension as available */ return 0 ;
@@ -628,17 +655,14 @@ static int riscv_vcpu_set_isa_ext_single(struct kvm_vcpu *vcpu, unsigned long reg_num, unsigned long reg_val) { -unsigned long host_isa_ext; - -if (reg_num >=KVM_RISCV_ISA_EXT_MAX || - reg_num >=ARRAY_SIZE (kvm_isa_ext_arr)) -return -ENOENT ; +unsigned long guest_ext; +int ret; - host_isa_ext = kvm_isa_ext_arr[reg_num]; -if (!__riscv_isa_extension_available (NULL , host_isa_ext)) -return -ENOENT ; + ret =kvm_riscv_vcpu_isa_check_host (reg_num, &guest_ext); +if (ret) +return ret; -if (reg_val ==test_bit (host_isa_ext, vcpu->arch.isa)) +if (reg_val ==test_bit (guest_ext, vcpu->arch.isa))return 0 ;if (!vcpu->arch.ran_atleast_once) {
@@ -648,10 +672,10 @@ static int riscv_vcpu_set_isa_ext_single(struct kvm_vcpu *vcpu,*/ if (reg_val ==1 &&kvm_riscv_vcpu_isa_enable_allowed (reg_num)) -set_bit (host_isa_ext, vcpu->arch.isa); +set_bit (guest_ext, vcpu->arch.isa);else if (!reg_val &&kvm_riscv_vcpu_isa_disable_allowed (reg_num)) -clear_bit (host_isa_ext, vcpu->arch.isa); +clear_bit (guest_ext, vcpu->arch.isa);else return -EINVAL ;kvm_riscv_vcpu_fp_reset (vcpu);
@@ -1009,16 +1033,15 @@ static int copy_fp_d_reg_indices(const struct kvm_vcpu *vcpu,static int copy_isa_ext_reg_indices (const struct kvm_vcpu *vcpu,u64 __user *uindices) { +unsigned long guest_ext;unsigned int n =0 ; -unsigned long isa_ext;for (int i =0 ; i <KVM_RISCV_ISA_EXT_MAX ; i++) {u64 size =IS_ENABLED (CONFIG_32BIT ) ?KVM_REG_SIZE_U32 :KVM_REG_SIZE_U64 ;u64 reg =KVM_REG_RISCV | size |KVM_REG_RISCV_ISA_EXT | i; - isa_ext = kvm_isa_ext_arr[i]; -if (!__riscv_isa_extension_available (NULL , isa_ext)) +if (kvm_riscv_vcpu_isa_check_host (i, &guest_ext))continue ;if (uindices) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/480 Adjust monitor dependencies
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit 79de661707a4a2dc695fd3e00529a14b4f5ec50d ]
RV monitors relying on the preemptirqs tracepoints are set as dependent on PREEMPT_TRACER and IRQSOFF_TRACER. In fact, those configurations do enable the tracepoints but are not the minimal configurations enabling them, which are TRACE_PREEMPT_TOGGLE and TRACE_IRQFLAGS (not selectable manually).
Set TRACE_PREEMPT_TOGGLE and TRACE_IRQFLAGS as dependencies for monitors.
--- kernel/trace/rv/monitors/scpd/Kconfig | 2 +- kernel/trace/rv/monitors/sncid/Kconfig | 2 +- kernel/trace/rv/monitors/snep/Kconfig | 2 +- kernel/trace/rv/monitors/wip/Kconfig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
kernel/trace/rv/monitors/scpd/Kconfig +1 -1
@@ -2,7 +2,7 @@ # config RV_MON_SCPD depends on RV - depends on PREEMPT_TRACER + depends on TRACE_PREEMPT_TOGGLE depends on RV_MON_SCHED default y select DA_MON_EVENTS_IMPLICIT
kernel/trace/rv/monitors/sncid/Kconfig +1 -1
@@ -2,7 +2,7 @@ # config RV_MON_SNCID depends on RV - depends on IRQSOFF_TRACER + depends on TRACE_IRQFLAGS depends on RV_MON_SCHED default y select DA_MON_EVENTS_IMPLICIT
kernel/trace/rv/monitors/snep/Kconfig +1 -1
@@ -2,7 +2,7 @@ # config RV_MON_SNEP depends on RV - depends on PREEMPT_TRACER + depends on TRACE_PREEMPT_TOGGLE depends on RV_MON_SCHED default y select DA_MON_EVENTS_IMPLICIT
kernel/trace/rv/monitors/wip/Kconfig +1 -1
@@ -2,7 +2,7 @@ # config RV_MON_WIP depends on RV - depends on PREEMPT_TRACER + depends on TRACE_PREEMPT_TOGGLE select DA_MON_EVENTS_IMPLICIT bool "wip monitor" help
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/480 staging: media: atomisp: Fix stack buffer overflow in gmin_get_var_int()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit ee4cf798202d285dcbe85e4467a094c44f5ed8e6 ]
When gmin_get_config_var() calls efi.get_variable() and the EFI variable is larger than the expected buffer size, two behaviors combine to create a stack buffer overflow:
1. gmin_get_config_var() does not return the proper error code when efi.get_variable() fails. It returns the stale 'ret' value from earlier operations instead of indicating the EFI failure.
2. When efi.get_variable() returns EFI_BUFFER_TOO_SMALL, it updates *out_len to the required buffer size but writes no data to the output buffer. However, due to bug #1, gmin_get_var_int() believes the call succeeded.
The caller gmin_get_var_int() then performs:
- Allocates val[CFG_VAR_NAME_MAX + 1] (65 bytes) on stack
- Calls gmin_get_config_var(dev, is_gmin, var, val, &len) with len=64
- If EFI variable is >64 bytes, efi.get_variable() sets len=required_size
- Due to bug #1, thinks call succeeded with len=required_size
- Executes val[len] = 0, writing past end of 65-byte stack buffer
This creates a stack buffer overflow when EFI variables are larger than 64 bytes. Since EFI variables can be controlled by firmware or system configuration, this could potentially be exploited for code execution.
Fix the bug by returning proper error codes from gmin_get_config_var() based on EFI status instead of stale 'ret' value.
The gmin_get_var_int() function is called during device initialization for camera sensor configuration on Intel Bay Trail and Cherry Trail platforms using the atomisp camera stack.
--- .../staging/media/atomisp/pci/atomisp_gmin_platform.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +5 -4
@@ -1358,14 +1358,15 @@ static int gmin_get_config_var(struct device *maindev,if (efi_rt_services_supported (EFI_RT_SUPPORTED_GET_VARIABLE )) status = efi.get_variable (var16, &GMIN_CFG_VAR_EFI_GUID ,NULL , (unsigned long *)out_len, out); -if (status ==EFI_SUCCESS ) +if (status ==EFI_SUCCESS ) {dev_info (maindev,"found EFI entry for '%s'\n" , var8); -else if (is_gmin) +return 0 ; + } +if (is_gmin)dev_info (maindev,"Failed to find EFI gmin variable %s\n" , var8);else dev_info (maindev,"Failed to find EFI variable %s\n" , var8); - -return ret; +return -ENOENT ; }int gmin_get_var_int (struct device *dev,bool is_gmin,const char *var,int def)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/480 fortify: Fix incorrect reporting of read buffer size
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 94fd44648dae2a5b6149a41faa0b07928c3e1963 ]
When FORTIFY_SOURCE reports about a run-time buffer overread, the wrong buffer size was being shown in the error message. (The bounds checking was correct.)
--- include/linux/fortify-string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/fortify-string.h +1 -1
@@ -596,7 +596,7 @@ __FORTIFY_INLINE bool fortify_memcpy_chk(__kernel_size_t size,if (p_size !=SIZE_MAX && p_size < size)fortify_panic (func,FORTIFY_WRITE , p_size, size, true);else if (q_size !=SIZE_MAX && q_size < size) -fortify_panic (func,FORTIFY_READ , p_size, size, true); +fortify_panic (func,FORTIFY_READ , q_size, size, true);/* * Warn when writing beyond destination field size.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/480 remoteproc: qcom: pas: Conclude the rename from adsp
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit 2c0c883f895f16fd9d367ec2e64bccab907d8d87 ]
The change that renamed the driver from "adsp" to "pas" didn't change any of the implementation. The result is an aesthetic eyesore, and confusing to many.
Conclude the rename of the driver, by updating function, structures and variable names to match what the driver actually is. The "Hexagon v5" is also dropped from the name and Kconfig, as this isn't correct either.
No functional change.
--- drivers/remoteproc/Kconfig | 11 +- drivers/remoteproc/qcom_q6v5_pas.c | 621 ++++++++++++++--------------- 2 files changed, 313 insertions(+), 319 deletions(-)
drivers/remoteproc/Kconfig +5 -6
@@ -214,7 +214,7 @@ config QCOM_Q6V5_MSS handled by QCOM_Q6V5_PAS driver. config QCOM_Q6V5_PAS - tristate "Qualcomm Hexagon v5 Peripheral Authentication Service support" + tristate "Qualcomm Peripheral Authentication Service support" depends on OF && ARCH_QCOM depends on QCOM_SMEM depends on RPMSG_QCOM_SMD || RPMSG_QCOM_SMD=n
@@ -229,11 +229,10 @@ config QCOM_Q6V5_PAS select QCOM_RPROC_COMMON select QCOM_SCM help - Say y here to support the TrustZone based Peripheral Image Loader - for the Qualcomm Hexagon v5 based remote processors. This is commonly - used to control subsystems such as ADSP (Audio DSP), - CDSP (Compute DSP), MPSS (Modem Peripheral SubSystem), and - SLPI (Sensor Low Power Island). + Say y here to support the TrustZone based Peripheral Image Loader for + the Qualcomm remote processors. This is commonly used to control + subsystems such as ADSP (Audio DSP), CDSP (Compute DSP), MPSS (Modem + Peripheral SubSystem), and SLPI (Sensor Low Power Island). config QCOM_Q6V5_WCSS tristate "Qualcomm Hexagon based WCSS Peripheral Image Loader"
drivers/remoteproc/qcom_q6v5_pas.c +308 -313
1,235 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/480 PCI: rockchip-host: Fix "Unexpected Completion" log message
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit fcc5f586c4edbcc10de23fb9b8c0972a84e945cd ]
Fix the debug message for the PCIE_CORE_INT_UCR interrupt to clearly indicate "Unexpected Completion" instead of a duplicate "malformed TLP" message.
--- drivers/pci/controller/pcie-rockchip-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-rockchip-host.c +1 -1
@@ -439,7 +439,7 @@ static irqreturn_t rockchip_pcie_subsys_irq_handler(int irq, void *arg)dev_dbg (dev,"malformed TLP received from the link\n" );if (sub_reg &PCIE_CORE_INT_UCR ) -dev_dbg (dev,"malformed TLP received from the link\n" ); +dev_dbg (dev,"Unexpected Completion received from the link\n" );if (sub_reg &PCIE_CORE_INT_FCE )dev_dbg (dev,"an error was observed in the flow control advertisements from the other side\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/480 clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv clocks
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 715676d8418062f54d746451294ccce9786c1734 ]
Commit bc4d25fdfadf ("clk: renesas: rzv2h: Add support for dynamic switching divider clocks") missed setting the CLK_SET_RATE_PARENT flag when registering ddiv clocks.
Without this flag, rate changes to the divider clock do not propagate to its parent, potentially resulting in incorrect clock configurations.
Fix this by setting CLK_SET_RATE_PARENT in the clock init data.
--- drivers/clk/renesas/rzv2h-cpg.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/renesas/rzv2h-cpg.c +1 -0
@@ -323,6 +323,7 @@ rzv2h_cpg_ddiv_clk_register(const struct cpg_core_clk *core, init.ops = &rzv2h_ddiv_clk_divider_ops; init.parent_names = &parent_name; init.num_parents =1 ; + init.flags =CLK_SET_RATE_PARENT ; ddiv->priv = priv; ddiv->mon = cfg_ddiv.monbit;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/480 crypto: sun8i-ce - fix nents passed to dma_unmap_sg()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit b6cd3cfb5afe49952f8f6be947aeeca9ba0faebb ]
In sun8i_ce_cipher_unprepare(), dma_unmap_sg() is incorrectly called with the number of entries returned by dma_map_sg(), rather than using the original number of entries passed when mapping the scatterlist.
To fix this, stash the original number of entries passed to dma_map_sg() in the request context.
--- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c +2 -2
@@ -265,8 +265,8 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req } chan->timeout = areq->cryptlen; - rctx->nr_sgs = nr_sgs; - rctx->nr_sgd = nr_sgd; + rctx->nr_sgs = ns; + rctx->nr_sgd = nd;return 0 ; theend_sgs:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/480 crypto: qat - use unmanaged allocation for dc_data
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Kumar Chakraborty <[email protected]>
[ Upstream commit 4cc871ad0173e8bc22f80e3609e34d546d30ef1a ]
The dc_data structure holds data required for handling compression operations, such as overflow buffers. In this context, the use of managed memory allocation APIs (devm_kzalloc() and devm_kfree()) is not necessary, as these data structures are freed and re-allocated when a device is restarted in adf_dev_down() and adf_dev_up().
Additionally, managed APIs automatically handle memory cleanup when the device is detached, which can lead to conflicts with manual cleanup processes. Specifically, if a device driver invokes the adf_dev_down() function as part of the cleanup registered with devm_add_action_or_reset(), it may attempt to free memory that is also managed by the device's resource management system, potentially leading to a double-free.
This might result in a warning similar to the following when unloading the device specific driver, for example qat_6xxx.ko:
qat_free_dc_data+0x4f/0x60 [intel_qat]
qat_compression_event_handler+0x3d/0x1d0 [intel_qat]
adf_dev_shutdown+0x6d/0x1a0 [intel_qat]
adf_dev_down+0x32/0x50 [intel_qat]
devres_release_all+0xb8/0x110
device_unbind_cleanup+0xe/0x70
device_release_driver_internal+0x1c1/0x200
driver_detach+0x48/0x90
bus_remove_driver+0x74/0xf0
pci_unregister_driver+0x2e/0xb0Use unmanaged memory allocation APIs (kzalloc_node() and kfree()) for the dc_data structure. This ensures that memory is explicitly allocated and freed under the control of the driver code, preventing manual deallocation from interfering with automatic cleanup.
--- drivers/crypto/intel/qat/qat_common/qat_compression.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_compression.c +2 -2
@@ -197,7 +197,7 @@ static int qat_compression_alloc_dc_data(struct adf_accel_dev *accel_dev)struct adf_dc_data *dc_data =NULL ;u8 *obuff =NULL ; - dc_data =devm_kzalloc (dev,sizeof (*dc_data),GFP_KERNEL ); + dc_data =kzalloc_node (sizeof (*dc_data),GFP_KERNEL ,dev_to_node (dev));if (!dc_data) goto err;
@@ -235,7 +235,7 @@ static void qat_free_dc_data(struct adf_accel_dev *accel_dev)dma_unmap_single (dev, dc_data->ovf_buff_p, dc_data->ovf_buff_sz,DMA_FROM_DEVICE );kfree_sensitive (dc_data->ovf_buff); -devm_kfree (dev, dc_data); +kfree (dc_data); accel_dev->dc_data =NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/480 crypto: marvell/cesa - Fix engine load inaccuracy
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 442134ab30e75b7229c4bfc1ac5641d245cffe27 ]
If an error occurs during queueing the engine load will never be decremented. Fix this by moving the engine load adjustment into the cleanup function.
--- drivers/crypto/marvell/cesa/cipher.c | 4 +++- drivers/crypto/marvell/cesa/hash.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/crypto/marvell/cesa/cipher.c +3 -1
@@ -75,9 +75,12 @@ mv_cesa_skcipher_dma_cleanup(struct skcipher_request *req)static inline void mv_cesa_skcipher_cleanup (struct skcipher_request *req) {struct mv_cesa_skcipher_req *creq =skcipher_request_ctx (req); +struct mv_cesa_engine *engine = creq->base.engine;if (mv_cesa_req_get_type (&creq->base) ==CESA_DMA_REQ )mv_cesa_skcipher_dma_cleanup (req); + +atomic_sub (req->cryptlen, &engine->load); }static void mv_cesa_skcipher_std_step (struct skcipher_request *req)
@@ -212,7 +215,6 @@ mv_cesa_skcipher_complete(struct crypto_async_request *req)struct mv_cesa_engine *engine = creq->base.engine;unsigned int ivsize; -atomic_sub (skreq->cryptlen, &engine->load); ivsize =crypto_skcipher_ivsize (crypto_skcipher_reqtfm (skreq));if (mv_cesa_req_get_type (&creq->base) ==CESA_DMA_REQ ) {
drivers/crypto/marvell/cesa/hash.c +3 -2
@@ -110,9 +110,12 @@ static inline void mv_cesa_ahash_dma_cleanup(struct ahash_request *req)static inline void mv_cesa_ahash_cleanup (struct ahash_request *req) {struct mv_cesa_ahash_req *creq =ahash_request_ctx (req); +struct mv_cesa_engine *engine = creq->base.engine;if (mv_cesa_req_get_type (&creq->base) ==CESA_DMA_REQ )mv_cesa_ahash_dma_cleanup (req); + +atomic_sub (req->nbytes, &engine->load); }static void mv_cesa_ahash_last_cleanup (struct ahash_request *req)
@@ -395,8 +398,6 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req) } } } - -atomic_sub (ahashreq->nbytes, &engine->load); } static void mv_cesa_ahash_prepare(struct crypto_async_request *req,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/480 padata: Fix pd UAF once and for all
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 71203f68c7749609d7fc8ae6ad054bdedeb24f91 ]
There is a race condition/UAF in padata_reorder that goes back to the initial commit. A reference count is taken at the start of the process in padata_do_parallel, and released at the end in padata_serial_worker.
This reference count is (and only is) required for padata_replace to function correctly. If padata_replace is never called then there is no issue.
In the function padata_reorder which serves as the core of padata, as soon as padata is added to queue->serial.list, and the associated spin lock released, that padata may be processed and the reference count on pd would go away.
Fix this by getting the next padata before the squeue->serial lock is released.
In order to make this possible, simplify padata_reorder by only calling it once the next padata arrives.
--- include/linux/padata.h | 3 - kernel/padata.c | 132 ++++++++++++----------------------------- 2 files changed, 37 insertions(+), 98 deletions(-)
include/linux/padata.h +0 -3
@@ -91,7 +91,6 @@ struct padata_cpumask {* @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. * @reorder_work: work struct for reordering. -* @lock: Reorder lock. */ struct parallel_data {struct padata_shell *ps;
@@ -102,8 +101,6 @@ struct parallel_data {unsigned int processed;int cpu;struct padata_cpumask cpumask; -struct work_struct reorder_work; -spinlock_t ____cacheline_aligned lock; };/**
kernel/padata.c +37 -95
198 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/480 crypto: qat - allow enabling VFs in the absence of IOMMU
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahsan Atta <[email protected]>
[ Upstream commit 53669ff591d4deb2d80eed4c07593ad0c0b45899 ]
The commit ca88a2bdd4dd ("crypto: qat - allow disabling SR-IOV VFs") introduced an unnecessary change that prevented enabling SR-IOV when IOMMU is disabled. In certain scenarios, it is desirable to enable SR-IOV even in the absence of IOMMU. Thus, restoring the previous functionality to allow VFs to be enumerated in the absence of IOMMU.
--- drivers/crypto/intel/qat/qat_common/adf_sriov.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_sriov.c +0 -1
@@ -155,7 +155,6 @@ static int adf_do_enable_sriov(struct adf_accel_dev *accel_dev)if (!device_iommu_mapped (&GET_DEV (accel_dev))) {dev_warn (&GET_DEV (accel_dev),"IOMMU should be enabled for SR-IOV to work correctly\n" ); -return -EINVAL ; }if (adf_dev_started (accel_dev)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/480 crypto: qat - fix state restore for banks with exceptions
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Pankratov <[email protected]>
[ Upstream commit 254923ca8715f623704378266815b6d14eb26194 ]
Change the logic in the restore function to properly handle bank exceptions.
The check for exceptions in the saved state should be performed before conducting any other ringstat register checks.
If a bank was saved with an exception, the ringstat will have the appropriate rp_halt/rp_exception bits set, causing the driver to exit the restore process with an error. Instead, the restore routine should first check the ringexpstat register, and if any exception was raised, it should stop further checks and return without any error. In other words, if a ring pair is in an exception state at the source, it should be restored the same way at the destination but without raising an error.
Even though this approach might lead to losing the exception state during migration, the driver will log the exception from the saved state during the restore process.
--- .../intel/qat/qat_common/adf_gen4_hw_data.c | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c +22 -7
@@ -579,6 +579,28 @@ static int bank_state_restore(struct adf_hw_csr_ops *ops, void __iomem *base, ops->write_csr_int_srcsel_w_val (base, bank, state->iaintflagsrcsel0); ops->write_csr_exp_int_en (base, bank, state->ringexpintenable); ops->write_csr_int_col_ctl (base, bank, state->iaintcolctl); + +/* +* Verify whether any exceptions were raised during the bank save process. +* If exceptions occurred, the status and exception registers cannot +* be directly restored. Consequently, further restoration is not +* feasible, and the current state of the ring should be maintained. +*/ + val = state->ringexpstat; +if (val) { +pr_info ("QAT: Bank %u state not fully restored due to exception in saved state (%#x)\n" , + bank, val); +return 0 ; + } + +/* Ensure that the restoration process completed without exceptions */ + tmp_val = ops->read_csr_exp_stat (base, bank); +if (tmp_val) { +pr_err ("QAT: Bank %u restored with exception: %#x\n" , + bank, tmp_val); +return -EFAULT ; + } + ops->write_csr_ring_srv_arb_en (base, bank, state->ringsrvarben);/* Check that all ring statuses match the saved state. */
@@ -612,13 +634,6 @@ static int bank_state_restore(struct adf_hw_csr_ops *ops, void __iomem *base,if (ret)return ret; - tmp_val = ops->read_csr_exp_stat (base, bank); - val = state->ringexpstat; -if (tmp_val && !val) { -pr_err ("QAT: Bank was restored with exception: 0x%x\n" , val); -return -EINVAL ; - } -return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/480 mtd: fix possible integer overflow in erase_xfer()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Stepchenko <[email protected]>
[ Upstream commit 9358bdb9f9f54d94ceafc650deffefd737d19fdd ]
The expression '1 << EraseUnitSize' is evaluated in int, which causes a negative result when shifting by 31 - the upper bound of the valid range [10, 31], enforced by scan_header(). This leads to incorrect extension when storing the result in 'erase->len' (uint64_t), producing a large unexpected value.
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- drivers/mtd/ftl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ftl.c +1 -1
@@ -344,7 +344,7 @@ static int erase_xfer(partition_t *part,return -ENOMEM ; erase->addr = xfer->Offset; - erase->len =1 << part->header.EraseUnitSize; + erase->len =1ULL << part->header.EraseUnitSize; ret =mtd_erase (part->mbd.mtd, erase);if (!ret) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/480 clk: davinci: Add NULL check in davinci_lpsc_clk_register()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit 13de464f445d42738fe18c9a28bab056ba3a290a ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, davinci_lpsc_clk_register() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue and ensuring no resources are left allocated.
--- drivers/clk/davinci/psc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/davinci/psc.c +5 -0
@@ -277,6 +277,11 @@ davinci_lpsc_clk_register(struct device *dev, const char *name, lpsc->pm_domain.name =devm_kasprintf (dev,GFP_KERNEL ,"%s: %s" ,best_dev_name (dev), name); +if (!lpsc->pm_domain.name) { +clk_hw_unregister (&lpsc->hw); +kfree (lpsc); +return ERR_PTR (-ENOMEM ); + } lpsc->pm_domain.attach_dev = davinci_psc_genpd_attach_dev; lpsc->pm_domain.detach_dev = davinci_psc_genpd_detach_dev; lpsc->pm_domain.flags =GENPD_FLAG_PM_CLK ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/480 media: v4l2-ctrls: Fix H264 SEPARATE_COLOUR_PLANE check
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Cowgill <[email protected]>
[ Upstream commit 803b9eabc649c778986449eb0596e5ffeb7a8aed ]
The separate_colour_plane_flag element is only present in the SPS if chroma_format_idc == 3, so the corresponding flag should be disabled whenever that is not the case and not just on profiles where chroma_format_idc is not present.
--- drivers/media/v4l2-core/v4l2-ctrls-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls-core.c +4 -4
@@ -968,12 +968,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, p_h264_sps->flags &= ~V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS ; - -if (p_h264_sps->chroma_format_idc <3 ) - p_h264_sps->flags &= - ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE ; } +if (p_h264_sps->chroma_format_idc <3 ) + p_h264_sps->flags &= + ~V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE ; +if (p_h264_sps->flags &V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY ) p_h264_sps->flags &= ~V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/480 perf parse-events: Set default GH modifier properly
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit dcbe6e51a0bb80a40f9a8c87750c291c2364573d ]
Commit 7b100989b4f6bce7 ("perf evlist: Remove __evlist__add_default") changed to use "cycles:P" as a default event. But the problem is it cannot set other default modifiers correctly.
perf kvm needs to set attr.exclude_host by default but it didn't work because of the logic in the parse_events__modifier_list(). Also the exclude_GH_default was applied only if ":u" modifier was specified - which is strange. Move it out after handling the ":GH" and check perf_host and perf_guest properly.
Before:
$ ./perf kvm record -vv true |& grep exclude (nothing)
But specifying an event (without a modifier) works:
$ ./perf kvm record -vv -e cycles true |& grep exclude
exclude_host 1After:
It now works for the both cases:
$ ./perf kvm record -vv true |& grep exclude
exclude_host 1 $ ./perf kvm record -vv -e cycles true |& grep exclude
exclude_host 1--- tools/perf/util/parse-events.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/perf/util/parse-events.c +8 -3
@@ -1733,13 +1733,11 @@ static int parse_events__modifier_list(struct parse_events_state *parse_state,int eH = group ? evsel->core.attr.exclude_host :0 ;int eG = group ? evsel->core.attr.exclude_guest :0 ;int exclude = eu | ek | eh; -int exclude_GH = group ? evsel->exclude_GH :0 ; +int exclude_GH = eG | eH;if (mod.user) {if (!exclude) exclude = eu = ek = eh =1 ; -if (!exclude_GH && !perf_guest && exclude_GH_default) - eG =1 ; eu =0 ; }if (mod.kernel) {
@@ -1762,6 +1760,13 @@ static int parse_events__modifier_list(struct parse_events_state *parse_state, exclude_GH = eG = eH =1 ; eH =0 ; } +if (!exclude_GH && exclude_GH_default) { +if (perf_host) + eG =1 ; +else if (perf_guest) + eH =1 ; + } + evsel->core.attr.exclude_user = eu; evsel->core.attr.exclude_kernel = ek; evsel->core.attr.exclude_hv = eh;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/480 clk: xilinx: vcu: unregister pll_post only if registered correctly
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohit Visavalia <[email protected]>
[ Upstream commit 3b0abc443ac22f7d4f61ddbbbbc5dbb06c87139d ]
If registration of pll_post is failed, it will be set to NULL or ERR, unregistering same will fail with following call trace:
Unable to handle kernel NULL pointer dereference at virtual address 008 pc : clk_hw_unregister+0xc/0x20 lr : clk_hw_unregister_fixed_factor+0x18/0x30 sp : ffff800011923850 ... Call trace: clk_hw_unregister+0xc/0x20 clk_hw_unregister_fixed_factor+0x18/0x30 xvcu_unregister_clock_provider+0xcc/0xf4 [xlnx_vcu] xvcu_probe+0x2bc/0x53c [xlnx_vcu]
--- drivers/clk/xilinx/xlnx_vcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/xilinx/xlnx_vcu.c +2 -2
@@ -587,8 +587,8 @@ static void xvcu_unregister_clock_provider(struct xvcu_device *xvcu)xvcu_clk_hw_unregister_leaf (hws[CLK_XVCU_ENC_MCU ]);if (!IS_ERR_OR_NULL (hws[CLK_XVCU_ENC_CORE ]))xvcu_clk_hw_unregister_leaf (hws[CLK_XVCU_ENC_CORE ]); - -clk_hw_unregister_fixed_factor (xvcu->pll_post); +if (!IS_ERR_OR_NULL (xvcu->pll_post)) +clk_hw_unregister_fixed_factor (xvcu->pll_post); }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/480 power: supply: cpcap-charger: Fix null check for power_supply_get_by_name
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit d9fa3aae08f99493e67fb79413c0e95d30fca5e9 ]
In the cpcap_usb_detect() function, the power_supply_get_by_name() function may return NULL instead of an error pointer. To prevent potential null pointer dereferences, Added a null check.
--- drivers/power/supply/cpcap-charger.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/power/supply/cpcap-charger.c +2 -3
@@ -689,9 +689,8 @@ static void cpcap_usb_detect(struct work_struct *work)struct power_supply *battery; battery =power_supply_get_by_name ("battery" ); -if (IS_ERR_OR_NULL (battery)) { -dev_err (ddata->dev,"battery power_supply not available %li\n" , -PTR_ERR (battery)); +if (!battery) { +dev_err (ddata->dev,"battery power_supply not available\n" );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/480 power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 2937f5d2e24eefef8cb126244caec7fe3307f724 ]
When the kernel is not configured CONFIG_OF, the max14577_charger_dt_init function returns NULL. Fix the max14577_charger_probe functionby returning -ENODATA instead of potentially passing a NULL pointer to PTR_ERR.
This fixes the below smatch warning:max14577_charger_probe() warn: passing zero to 'PTR_ERR'
--- drivers/power/supply/max14577_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/max14577_charger.c +2 -2
@@ -501,7 +501,7 @@ static struct max14577_charger_platform_data *max14577_charger_dt_init(static struct max14577_charger_platform_data *max14577_charger_dt_init (struct platform_device *pdev) { -return NULL ; +return ERR_PTR (-ENODATA ); }#endif /* CONFIG_OF */
@@ -572,7 +572,7 @@ static int max14577_charger_probe(struct platform_device *pdev) chg->max14577 = max14577; chg->pdata =max14577_charger_dt_init (pdev); -if (IS_ERR_OR_NULL (chg->pdata)) +if (IS_ERR (chg->pdata))return PTR_ERR (chg->pdata); ret =max14577_charger_reg_init (chg);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/480 power: supply: qcom_pmi8998_charger: fix wakeirq
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Casey Connolly <[email protected]>
[ Upstream commit 6c5393771c50fac30f08dfb6d2f65f4f2cfeb8c7 ]
Unloading and reloading the driver (e.g. when built as a module) currently leads to errors trying to enable wake IRQ since it's already enabled.
Use devm to manage this for us so it correctly gets disabled when removing the driver.
Additionally, call device_init_wakeup() so that charger attach/remove will trigger a wakeup by default.
--- drivers/power/supply/qcom_pmi8998_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/qcom_pmi8998_charger.c +3 -1
@@ -1016,7 +1016,9 @@ static int smb2_probe(struct platform_device *pdev)if (rc <0 )return rc; - rc =dev_pm_set_wake_irq (chip->dev, chip->cable_irq); +devm_device_init_wakeup (chip->dev); + + rc =devm_pm_set_wake_irq (chip->dev, chip->cable_irq);if (rc <0 )return dev_err_probe (chip->dev, rc,"Couldn't set wake irq\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/480 power: supply: max1720x correct capacity computation
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Antoine <[email protected]>
[ Upstream commit 58ae036172b5f051a19a32eba94a3e5eb37bf47e ]
Quoted 1 line
From the datasheet of the MAX17201/17205, the LSB should be "5.0μVh/RSENSE".
The current computation sets it at 0.5mAh=5.0μVh/10mOhm, which does not take into account the value of rsense (which is in 10µV steps) which can be different from 10mOhm.
Change the computation to fit the specs.
--- drivers/power/supply/max1720x_battery.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/power/supply/max1720x_battery.c +6 -5
@@ -288,9 +288,10 @@ static int max172xx_voltage_to_ps(unsigned int reg)return reg *1250 ;/* in uV */ } -static int max172xx_capacity_to_ps (unsigned int reg) +static int max172xx_capacity_to_ps (unsigned int reg, +struct max1720x_device_info *info) { -return reg *500 ;/* in uAh */ +return reg * (500000 / info->rsense);/* in uAh */ }/*
@@ -394,11 +395,11 @@ static int max1720x_battery_get_property(struct power_supply *psy,break ;case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN : ret =regmap_read (info->regmap,MAX172XX_DESIGN_CAP , ®_val); - val->intval =max172xx_capacity_to_ps (reg_val); + val->intval =max172xx_capacity_to_ps (reg_val, info);break ;case POWER_SUPPLY_PROP_CHARGE_AVG : ret =regmap_read (info->regmap,MAX172XX_REPCAP , ®_val); - val->intval =max172xx_capacity_to_ps (reg_val); + val->intval =max172xx_capacity_to_ps (reg_val, info);break ;case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG : ret =regmap_read (info->regmap,MAX172XX_TTE , ®_val);
@@ -422,7 +423,7 @@ static int max1720x_battery_get_property(struct power_supply *psy,break ;case POWER_SUPPLY_PROP_CHARGE_FULL : ret =regmap_read (info->regmap,MAX172XX_FULL_CAP , ®_val); - val->intval =max172xx_capacity_to_ps (reg_val); + val->intval =max172xx_capacity_to_ps (reg_val, info);break ;case POWER_SUPPLY_PROP_MODEL_NAME : ret =regmap_read (info->regmap,MAX172XX_DEV_NAME , ®_val);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/480 crypto: arm/aes-neonbs - work around gcc-15 warning
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit d5fa96dc5590915f060fee3209143313e4f5b03b ]
I get a very rare -Wstringop-overread warning with gcc-15 for one function in aesbs_ctr_encrypt():
arch/arm/crypto/aes-neonbs-glue.c: In function 'ctr_encrypt':arch/arm/crypto/aes-neonbs-glue.c:212:1446: error: '__builtin_memcpy' offset [17, 2147483647] is out of the bounds [0, 16] of object 'buf' with type 'u8[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds=]
212 | src = dst = memcpy(buf + sizeof(buf) - bytes,arch/arm/crypto/aes-neonbs-glue.c: In function 'ctr_encrypt':arch/arm/crypto/aes-neonbs-glue.c:218:17: error: 'aesbs_ctr_encrypt' reading 1 byte from a region of size 0 [-Werror=stringop-overread]
218 | aesbs_ctr_encrypt(dst, src, ctx->rk, ctx->rounds, bytes, walk.iv);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~arch/arm/crypto/aes-neonbs-glue.c:218:17: note: referencing argument 2 of type 'const u8[0]' {aka 'const unsigned char[]'} arch/arm/crypto/aes-neonbs-glue.c:218:17: note: referencing argument 3 of type 'const u8[0]' {aka 'const unsigned char[]'} arch/arm/crypto/aes-neonbs-glue.c:218:17: note: referencing argument 6 of type 'u8[0]' {aka 'unsigned char[]'} arch/arm/crypto/aes-neonbs-glue.c:36:17: note: in a call to function 'aesbs_ctr_encrypt'
36 | asmlinkage void aesbs_ctr_encrypt(u8 out[], u8 const in[], u8 const rk[],
This could happen in theory if walk.nbytes is larger than INT_MAX and gets converted to a negative local variable.
Keep the type unsigned like the orignal nbytes to be sure there is no integer overflow.
--- arch/arm/crypto/aes-neonbs-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/crypto/aes-neonbs-glue.c +1 -1
@@ -232,7 +232,7 @@ static int ctr_encrypt(struct skcipher_request *req)while (walk.nbytes >0 ) {const u8 *src = walk.src.virt.addr;u8 *dst = walk.dst.virt.addr; -int bytes = walk.nbytes; +unsigned int bytes = walk.nbytes;if (unlikely (bytes <AES_BLOCK_SIZE )) src = dst = memcpy(buf + sizeof(buf) - bytes,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/480 PCI: endpoint: pci-epf-vntb: Return -ENOENT if pci_epc_get_next_free_bar() fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 7ea488cce73263231662e426639dd3e836537068 ]
According the function documentation of epf_ntb_init_epc_bar(), the function should return an error code on error. However, it returns -1 when no BAR is available i.e., when pci_epc_get_next_free_bar() fails.
Return -ENOENT instead.
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
@@ -700,7 +700,7 @@ static int epf_ntb_init_epc_bar(struct epf_ntb *ntb) barno =pci_epc_get_next_free_bar (epc_features, barno);if (barno <0 ) {dev_err (dev,"Fail to get NTB function BAR\n" ); -return barno; +return -ENOENT ; } ntb->epf_ntb_bar[bar] = barno; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/480 pinctrl: sunxi: Fix memory leak on krealloc failure
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit e3507c56cbb208d4f160942748c527ef6a528ba1 ]
In sunxi_pctrl_dt_node_to_map(), when krealloc() fails to resize the pinctrl_map array, the function returns -ENOMEM directly without freeing the previously allocated *map buffer. This results in a memory leak of the original kmalloc_array allocation.
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +8 -3
@@ -408,6 +408,7 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,const char *function, *pin_prop;const char *group;int ret, npins, nmaps, configlen =0 , i =0 ; +struct pinctrl_map *new_map; *map =NULL ; *num_maps =0 ;
@@ -482,9 +483,13 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,* We know have the number of maps we need, we can resize our * map array */ - *map =krealloc (*map, i *sizeof (struct pinctrl_map ),GFP_KERNEL ); -if (!*map) -return -ENOMEM ; + new_map =krealloc (*map, i *sizeof (struct pinctrl_map ),GFP_KERNEL ); +if (!new_map) { + ret = -ENOMEM ; + goto err_free_map; + } + + *map = new_map;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/480 pinctrl: berlin: fix memory leak in berlin_pinctrl_build_state()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 8f6f303551100291bf2c1e1ccc66b758fffb1168 ]
In the original implementation, krealloc() failure handling incorrectly assigned the original memory pointer to NULL after kfree(), causing a memory leak when reallocation failed.
--- drivers/pinctrl/berlin/berlin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/berlin/berlin.c +6 -2
@@ -204,6 +204,7 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)const struct berlin_desc_group *desc_group;const struct berlin_desc_function *desc_function;int i, max_functions =0 ; +struct pinfunction *new_functions; pctrl->nfunctions =0 ;
@@ -229,12 +230,15 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) } } - pctrl->functions =krealloc (pctrl->functions, + new_functions =krealloc (pctrl->functions, pctrl->nfunctions *sizeof (*pctrl->functions),GFP_KERNEL ); -if (!pctrl->functions) +if (!new_functions) { +kfree (pctrl->functions);return -ENOMEM ; + } + pctrl->functions = new_functions;/* map functions to theirs groups */ for (i =0 ; i < pctrl->desc->ngroups; i++) { desc_group = pctrl->desc->groups + i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/480 pinctrl: canaan: k230: add NULL check in DT parse
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ze Huang <[email protected]>
[ Upstream commit 65bd0be486390fc12a84eafaad78758c5e5a55e6 ]
Add a NULL check for the return value of of_get_property() when retrieving the "pinmux" property in the group parser. This avoids a potential NULL pointer dereference if the property is missing from the device tree node.
Also fix a typo ("sintenel") in the device ID match table comment, correcting it to "sentinel".
--- drivers/pinctrl/pinctrl-k230.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-k230.c +5 -1
@@ -477,6 +477,10 @@ static int k230_pinctrl_parse_groups(struct device_node *np, grp->name = np->name; list =of_get_property (np,"pinmux" , &size); +if (!list) { +dev_err (dev,"failed to get pinmux property\n" ); +return -EINVAL ; + } size /=sizeof (*list); grp->num_pins = size;
@@ -623,7 +627,7 @@ static int k230_pinctrl_probe(struct platform_device *pdev)static const struct of_device_id k230_dt_ids[] = { { .compatible ="canaan,k230-pinctrl" , }, - {/* sintenel */ } + {/* sentinel */ } };MODULE_DEVICE_TABLE (of, k230_dt_ids);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/480 pinctrl: canaan: k230: Fix order of DT parse and pinctrl register
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ze Huang <[email protected]>
[ Upstream commit d94a32ac688f953dc9a9f12b5b4139ecad841bbb ]
Move DT parse before pinctrl register. This ensures that device tree parsing is done before calling devm_pinctrl_register() to prevent using uninitialized pin resources.
--- drivers/pinctrl/pinctrl-k230.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-k230.c +5 -2
@@ -590,6 +590,7 @@ static int k230_pinctrl_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct k230_pinctrl *info;struct pinctrl_desc *pctl; +int ret; info =devm_kzalloc (dev,sizeof (*info),GFP_KERNEL );if (!info)
@@ -615,13 +616,15 @@ static int k230_pinctrl_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (info->regmap_base),"failed to init regmap\n" ); + ret =k230_pinctrl_parse_dt (pdev, info); +if (ret) +return ret; + info->pctl_dev =devm_pinctrl_register (dev, pctl, info);if (IS_ERR (info->pctl_dev))return dev_err_probe (dev,PTR_ERR (info->pctl_dev),"devm_pinctrl_register failed\n" ); -k230_pinctrl_parse_dt (pdev, info); -return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/480 PCI: Adjust the position of reading the Link Control 2 register
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiwei Sun <[email protected]>
[ Upstream commit b85af48de3ece4e5bbdb2248a5360a409991cf67 ]
In a89c82249c37 ("PCI: Work around PCIe link training failures"), if the speed limit is set to 2.5 GT/s and the retraining is successful, an attempt will be made to lift the speed limit. One condition for lifting the speed limit is to check whether the link speed field of the Link Control 2 register is PCI_EXP_LNKCTL2_TLS_2_5GT.
However, since de9a6c8d5dbf ("PCI/bwctrl: Add pcie_set_target_speed() to set PCIe Link Speed"), the lnkctl2 local variable does not undergo any changes during the speed limit setting and retraining process. As a result, the code intended to lift the speed limit is not executed.
To address this issue, adjust the position of the Link Control 2 register read operation in the code and place it before its use.
--- drivers/pci/quirks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pci/quirks.c +4 -2
@@ -109,13 +109,13 @@ int pcie_failed_link_retrain(struct pci_dev *dev) !pcie_cap_has_lnkctl2(dev) || !dev->link_active_reporting)return ret; -pcie_capability_read_word (dev,PCI_EXP_LNKCTL2 , &lnkctl2);pcie_capability_read_word (dev,PCI_EXP_LNKSTA , &lnksta);if (!(lnksta &PCI_EXP_LNKSTA_DLLLA ) &&pcie_lbms_seen (dev, lnksta)) { -u16 oldlnkctl2 = lnkctl2; +u16 oldlnkctl2;pci_info (dev,"broken device, retraining non-functional downstream link at 2.5GT/s\n" ); +pcie_capability_read_word (dev,PCI_EXP_LNKCTL2 , &oldlnkctl2); ret =pcie_set_target_speed (dev,PCIE_SPEED_2_5GT , false);if (ret) {pci_info (dev,"retraining failed\n" );
@@ -127,6 +127,8 @@ int pcie_failed_link_retrain(struct pci_dev *dev)pcie_capability_read_word (dev,PCI_EXP_LNKSTA , &lnksta); } +pcie_capability_read_word (dev,PCI_EXP_LNKCTL2 , &lnkctl2); +if ((lnksta &PCI_EXP_LNKSTA_DLLLA ) && (lnkctl2 &PCI_EXP_LNKCTL2_TLS ) ==PCI_EXP_LNKCTL2_TLS_2_5GT &&pci_match_id (ids, dev)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/480 soundwire: Correct some property names
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit ae6a0f5b8a5b0ca2e4bf1c0380267ad83aca8401 ]
The DisCo properties should be mipi-sdw-paging-supported and mipi-sdw-bank-delay-supported, with an 'ed' on the end. Correct the property names used in sdw_slave_read_prop().
The internal flag bank_delay_support is currently unimplemented, so that being read wrong does not currently affect anything. The two existing users for this helper and the paging_support flag rt1320-sdw.c and rt721-sdca-sdw.c both manually set the flag in their slave properties, thus are not affected by this bug either.
--- drivers/soundwire/mipi_disco.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soundwire/mipi_disco.c +2 -2
@@ -451,10 +451,10 @@ int sdw_slave_read_prop(struct sdw_slave *slave) "mipi-sdw-highPHY-capable"); prop->paging_support =mipi_device_property_read_bool (dev, -"mipi-sdw-paging-support" ); +"mipi-sdw-paging-supported" ); prop->bank_delay_support =mipi_device_property_read_bool (dev, -"mipi-sdw-bank-delay-support" ); +"mipi-sdw-bank-delay-supported" );device_property_read_u32 (dev,"mipi-sdw-port15-read-behavior" , &prop->p15_behave);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/480 dmaengine: mmp: Fix again Wvoid-pointer-to-enum-cast warning
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit a0b1589b62e2fcfb112996e0f4d5593bd2edf069 ]
This was fixed and re-introduced. 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes:
mmp_tdma.c:644:9: error: cast to smaller integer type 'enum mmp_tdma_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
--- drivers/dma/mmp_tdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/mmp_tdma.c +1 -1
@@ -641,7 +641,7 @@ static int mmp_tdma_probe(struct platform_device *pdev)int chan_num =TDMA_CHANNEL_NUM ;struct gen_pool *pool =NULL ; - type = (enum mmp_tdma_type )device_get_match_data (&pdev->dev); + type = (kernel_ulong_t )device_get_match_data (&pdev->dev);/* always have couple channels */ tdev =devm_kzalloc (&pdev->dev,sizeof (*tdev),GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/480 soundwire: debugfs: move debug statement outside of error handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Gobbi <[email protected]>
[ Upstream commit 06f77ff9d852c9f2764659ea81489364d8a69a9c ]
The start_t and finish_t variables are not properly initialized if errors happens over request_firmware actions.
This was also detected by smatch:
drivers/soundwire/debugfs.c:301 cmd_go() error: uninitialized symbol 'finish_t'. drivers/soundwire/debugfs.c:301 cmd_go() error: uninitialized symbol 'start_t'.
Move the debug statement outside of firmware error handling.
--- drivers/soundwire/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/soundwire/debugfs.c +3 -3
@@ -291,6 +291,9 @@ static int cmd_go(void *data, u64 value) finish_t =ktime_get (); +dev_dbg (&slave->dev,"command completed, num_byte %zu status %d, time %lld ms\n" , + num_bytes, ret,div_u64 (finish_t - start_t,NSEC_PER_MSEC )); + out:if (fw)release_firmware (fw);
@@ -298,9 +301,6 @@ static int cmd_go(void *data, u64 value)pm_runtime_mark_last_busy (&slave->dev);pm_runtime_put (&slave->dev); -dev_dbg (&slave->dev,"command completed, num_byte %zu status %d, time %lld ms\n" , - num_bytes, ret,div_u64 (finish_t - start_t,NSEC_PER_MSEC )); -return ret; } DEFINE_DEBUGFS_ATTRIBUTE(cmd_go_fops, NULL,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 251/480 phy: qualcomm: phy-qcom-eusb2-repeater: Dont zero-out registers
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit 31bc94de76026c527f82c238f414539a14f0f3e6 ]
Zeroing out registers does not happen in the downstream kernel, and will "tune" the repeater in surely unexpected ways since most registers don't have a reset value of 0x0.
Stop doing that and instead just set the registers that are in the init sequence (though long term I don't think there's actually PMIC-specific init sequences, there's board specific tuning, but that's a story for another day).
--- .../phy/qualcomm/phy-qcom-eusb2-repeater.c | 87 +++++++------------ 1 file changed, 32 insertions(+), 55 deletions(-)
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c +32 -55
@@ -37,32 +37,13 @@#define EUSB2_TUNE_EUSB_EQU 0x5A#define EUSB2_TUNE_EUSB_HS_COMP_CUR 0x5B -enum eusb2_reg_layout { -TUNE_EUSB_HS_COMP_CUR , -TUNE_EUSB_EQU , -TUNE_EUSB_SLEW , -TUNE_USB2_HS_COMP_CUR , -TUNE_USB2_PREEM , -TUNE_USB2_EQU , -TUNE_USB2_SLEW , -TUNE_SQUELCH_U , -TUNE_HSDISC , -TUNE_RES_FSDIF , -TUNE_IUSB2 , -TUNE_USB2_CROSSOVER , -NUM_TUNE_FIELDS , - -FORCE_VAL_5 =NUM_TUNE_FIELDS , -FORCE_EN_5 , - -EN_CTL1 , - -RPTR_STATUS , -LAYOUT_SIZE , +struct eusb2_repeater_init_tbl_reg { +unsigned int reg; +unsigned int value; };struct eusb2_repeater_cfg { -const u32 *init_tbl; +const struct eusb2_repeater_init_tbl_reg *init_tbl;int init_tbl_num;const char *const *vreg_list;int num_vregs;
@@ -82,16 +63,16 @@ static const char * const pm8550b_vreg_l[] = { "vdd18", "vdd3", }; -static const u32 pm8550b_init_tbl[NUM_TUNE_FIELDS ] = { - [TUNE_IUSB2 ] =0x8 , - [TUNE_SQUELCH_U ] =0x3 , - [TUNE_USB2_PREEM ] =0x5 , +static const struct eusb2_repeater_init_tbl_reg pm8550b_init_tbl[] = { + {EUSB2_TUNE_IUSB2 ,0x8 }, + {EUSB2_TUNE_SQUELCH_U ,0x3 }, + {EUSB2_TUNE_USB2_PREEM ,0x5 }, }; -static const u32 smb2360_init_tbl[NUM_TUNE_FIELDS ] = { - [TUNE_IUSB2 ] =0x5 , - [TUNE_SQUELCH_U ] =0x3 , - [TUNE_USB2_PREEM ] =0x2 , +static const struct eusb2_repeater_init_tbl_reg smb2360_init_tbl[] = { + {EUSB2_TUNE_IUSB2 ,0x5 }, + {EUSB2_TUNE_SQUELCH_U ,0x3 }, + {EUSB2_TUNE_USB2_PREEM ,0x2 }, };static const struct eusb2_repeater_cfg pm8550b_eusb2_cfg = {
@@ -129,17 +110,10 @@ static int eusb2_repeater_init(struct phy *phy)struct eusb2_repeater *rptr =phy_get_drvdata (phy);struct device_node *np = rptr->dev->of_node;struct regmap *regmap = rptr->regmap; -const u32 *init_tbl = rptr->cfg->init_tbl; -u8 tune_usb2_preem = init_tbl[TUNE_USB2_PREEM ]; -u8 tune_hsdisc = init_tbl[TUNE_HSDISC ]; -u8 tune_iusb2 = init_tbl[TUNE_IUSB2 ];u32 base = rptr->base; -u32 val; +u32 poll_val;int ret; - -of_property_read_u8 (np,"qcom,tune-usb2-amplitude" , &tune_iusb2); -of_property_read_u8 (np,"qcom,tune-usb2-disc-thres" , &tune_hsdisc); -of_property_read_u8 (np,"qcom,tune-usb2-preem" , &tune_usb2_preem); +u8 val; ret =regulator_bulk_enable (rptr->cfg->num_vregs, rptr->vregs);if (ret)
@@ -147,21 +121,24 @@ static int eusb2_repeater_init(struct phy *phy)regmap_write (regmap, base +EUSB2_EN_CTL1 ,EUSB2_RPTR_EN ); -regmap_write (regmap, base +EUSB2_TUNE_EUSB_HS_COMP_CUR , init_tbl[TUNE_EUSB_HS_COMP_CUR ]); -regmap_write (regmap, base +EUSB2_TUNE_EUSB_EQU , init_tbl[TUNE_EUSB_EQU ]); -regmap_write (regmap, base +EUSB2_TUNE_EUSB_SLEW , init_tbl[TUNE_EUSB_SLEW ]); -regmap_write (regmap, base +EUSB2_TUNE_USB2_HS_COMP_CUR , init_tbl[TUNE_USB2_HS_COMP_CUR ]); -regmap_write (regmap, base +EUSB2_TUNE_USB2_EQU , init_tbl[TUNE_USB2_EQU ]); -regmap_write (regmap, base +EUSB2_TUNE_USB2_SLEW , init_tbl[TUNE_USB2_SLEW ]); -regmap_write (regmap, base +EUSB2_TUNE_SQUELCH_U , init_tbl[TUNE_SQUELCH_U ]); -regmap_write (regmap, base +EUSB2_TUNE_RES_FSDIF , init_tbl[TUNE_RES_FSDIF ]); -regmap_write (regmap, base +EUSB2_TUNE_USB2_CROSSOVER , init_tbl[TUNE_USB2_CROSSOVER ]); - -regmap_write (regmap, base +EUSB2_TUNE_USB2_PREEM , tune_usb2_preem); -regmap_write (regmap, base +EUSB2_TUNE_HSDISC , tune_hsdisc); -regmap_write (regmap, base +EUSB2_TUNE_IUSB2 , tune_iusb2); - - ret =regmap_read_poll_timeout (regmap, base +EUSB2_RPTR_STATUS , val, val &RPTR_OK ,10 ,5 ); +/* Write registers from init table */ +for (int i =0 ; i < rptr->cfg->init_tbl_num; i++) +regmap_write (regmap, base + rptr->cfg->init_tbl[i].reg, + rptr->cfg->init_tbl[i].value); + +/* Override registers from devicetree values */ +if (!of_property_read_u8 (np,"qcom,tune-usb2-amplitude" , &val)) +regmap_write (regmap, base +EUSB2_TUNE_USB2_PREEM , val); + +if (!of_property_read_u8 (np,"qcom,tune-usb2-disc-thres" , &val)) +regmap_write (regmap, base +EUSB2_TUNE_HSDISC , val); + +if (!of_property_read_u8 (np,"qcom,tune-usb2-preem" , &val)) +regmap_write (regmap, base +EUSB2_TUNE_IUSB2 , val); + +/* Wait for status OK */ + ret =regmap_read_poll_timeout (regmap, base +EUSB2_RPTR_STATUS , poll_val, + poll_val &RPTR_OK ,10 ,5 );if (ret)dev_err (rptr->dev,"initialization timed-out\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 252/480 fanotify: sanitize handle_type values when reporting fid
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
[ Upstream commit 8631e01c2c5d1fe6705bcc0d733a0b7a17d3daac ]
Unlike file_handle, type and len of struct fanotify_fh are u8. Traditionally, filesystem return handle_type < 0xff, but there is no enforecement for that in vfs.
Add a sanity check in fanotify to avoid truncating handle_type if its value is > 0xff.
--- fs/notify/fanotify/fanotify.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/notify/fanotify/fanotify.c +7 -1
@@ -454,7 +454,13 @@ static int fanotify_encode_fh(struct fanotify_fh *fh, struct inode *inode, dwords = fh_len >>2 ; type =exportfs_encode_fid (inode, buf, &dwords); err = -EINVAL ; -if (type <=0 || type ==FILEID_INVALID || fh_len != dwords <<2 ) +/* +* Unlike file_handle, type and len of struct fanotify_fh are u8. +* Traditionally, filesystem return handle_type < 0xff, but there +* is no enforecement for that in vfs. +*/ +BUILD_BUG_ON (MAX_HANDLE_SZ >0xff ||FILEID_INVALID >0xff ); +if (type <=0 || type >=FILEID_INVALID || fh_len != dwords <<2 ) goto out_err; fh->type = type;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 253/480 clk: clk-axi-clkgen: fix fpfd_max frequency for zynq
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sá <[email protected]>
[ Upstream commit ce8a9096699500e2c5bca09dde27b16edda5f636 ]
The fpfd_max frequency should be set to 450 MHz instead of 300 MHz. Well, it actually depends on the platform speed grade but we are being conservative for ultrascale so let's be consistent. In a following change we will set these limits at runtime.
--- drivers/clk/clk-axi-clkgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-axi-clkgen.c +1 -1
@@ -118,7 +118,7 @@ static const struct axi_clkgen_limits axi_clkgen_zynqmp_default_limits = {static const struct axi_clkgen_limits axi_clkgen_zynq_default_limits = { .fpfd_min =10000 , - .fpfd_max =300000 , + .fpfd_max =450000 , .fvco_min =600000 , .fvco_max =1200000 , };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 254/480 Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 1db50f7b7a793670adcf062df9ff27798829d963 ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/infiniband/hw/erdma/erdma_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/erdma/erdma_verbs.c +2 -1
@@ -629,7 +629,8 @@ static struct erdma_mtt *erdma_create_cont_mtt(struct erdma_dev *dev,static void erdma_destroy_mtt_buf_sg (struct erdma_dev *dev,struct erdma_mtt *mtt) { -dma_unmap_sg (&dev->pdev->dev, mtt->sglist, mtt->nsg,DMA_TO_DEVICE ); +dma_unmap_sg (&dev->pdev->dev, mtt->sglist, +DIV_ROUND_UP (mtt->size,PAGE_SIZE ),DMA_TO_DEVICE );vfree (mtt->sglist); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 255/480 perf tools: Fix use-after-free in help_unknown_cmd()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 1fdf938168c4d26fa279d4f204768690d1f9c4ae ]
Currently perf aborts when it finds an invalid command. I guess it depends on the environment as I have some custom commands in the path.
$ perf bad-command perf: 'bad-command' is not a perf-command. See 'perf --help'. Aborted (core dumped)
It's because the exclude_cmds() in libsubcmd has a use-after-free when it removes some entries. After copying one to another entry, it keeps the pointer in the both position. And the next copy operation will free the later one but it's the same entry in the previous one.
For example, let's say cmds = { A, B, C, D, E } and excludes = { B, E }.
ci cj ei cmds-name excludes
-----------+--------------------
0 0 0 | A B : cmp < 0, ci == cj 1 1 0 | B B : cmp == 0 2 1 1 | C E : cmp < 0, ci != cj
At this point, it frees cmds->names[1] and cmds->names[1] is assigned to cmds->names[2].
3 2 1 | D E : cmp < 0, ci != cj
Now it frees cmds->names[2] but it's the same as cmds->names[1]. So accessing cmds->names[1] will be invalid.
This makes the subcmd tests succeed.
$ perf test subcmd 69: libsubcmd help tests : 69.1: Load subcmd names : Ok 69.2: Uniquify subcmd names : Ok 69.3: Exclude duplicate subcmd names : Ok
--- tools/lib/subcmd/help.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tools/lib/subcmd/help.c +7 -5
@@ -9,6 +9,7 @@#include <sys/stat.h> #include <unistd.h> #include <dirent.h> +#include <assert.h> #include "subcmd-util.h" #include "help.h" #include "exec-cmd.h"
@@ -82,10 +83,11 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) ci++; cj++; }else { -zfree (&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + cmds->names[cj++] = cmds->names[ci]; + cmds->names[ci++] =NULL ; } }else if (cmp ==0 ) { +zfree (&cmds->names[ci]); ci++; ei++; }else if (cmp >0 ) {
@@ -94,12 +96,12 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) }if (ci != cj) {while (ci < cmds->cnt) { -zfree (&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + cmds->names[cj++] = cmds->names[ci]; + cmds->names[ci++] =NULL ; } }for (ci = cj; ci < cmds->cnt; ci++) -zfree (&cmds->names[ci]); +assert (cmds->names[ci] ==NULL ); cmds->cnt = cj; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 256/480 perf dso: Add missed dso__put to dso__load_kcore
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 63a088e999de3f431f87d9a367933da894ddb613 ]
The kcore loading creates a set of list nodes that have reference counted references to maps of the kcore. The list node freeing in the success path wasn't releasing the maps, add the missing puts. It is unclear why this leak was being missed by leak sanitizer.
--- tools/perf/util/symbol.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/symbol.c +1 -0
@@ -1414,6 +1414,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map, goto out_err; } } +map__zput (new_node->map);free (new_node); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 257/480 mtd: spi-nor: spansion: Fixup params->set_4byte_addr_mode for SEMPER
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit a45ab839f52f3f00ac3dae18a50e902efd216de2 ]
Infineon SEMPER flash family does not support E9h opcode as Exit 4-byte mode (EX4B). Therefore, params->set_4byte_addr_mode is not determined by BFPT parse. Fixup it up by introducing vendor specific EX4B opcode (B8h) and function.
--- drivers/mtd/spi-nor/spansion.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/mtd/spi-nor/spansion.c +31 -0
@@ -17,6 +17,7 @@#define SPINOR_OP_CLSR 0x30/* Clear status register 1 */ #define SPINOR_OP_CLPEF 0x82/* Clear program/erase failure flags */ +#define SPINOR_OP_CYPRESS_EX4B 0xB8/* Exit 4-byte address mode */ #define SPINOR_OP_CYPRESS_DIE_ERASE 0x61/* Chip (die) erase */ #define SPINOR_OP_RD_ANY_REG 0x65/* Read any register */ #define SPINOR_OP_WR_ANY_REG 0x71/* Write any register */
@@ -58,6 +59,13 @@ SPI_MEM_OP_DUMMY(ndummy, 0), \ SPI_MEM_OP_DATA_IN(1, buf, 0)) +#define CYPRESS_NOR_EN4B_EX4B_OP (enable) \ + SPI_MEM_OP(SPI_MEM_OP_CMD(enable ? SPINOR_OP_EN4B : \ + SPINOR_OP_CYPRESS_EX4B, 0), \ + SPI_MEM_OP_NO_ADDR, \ + SPI_MEM_OP_NO_DUMMY, \ + SPI_MEM_OP_NO_DATA) +#define SPANSION_OP (opcode) \ SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 0), \ SPI_MEM_OP_NO_ADDR, \
@@ -356,6 +364,20 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)return 0 ; } +static int cypress_nor_set_4byte_addr_mode (struct spi_nor *nor,bool enable) +{ +int ret; +struct spi_mem_op op =CYPRESS_NOR_EN4B_EX4B_OP (enable); + +spi_nor_spimem_setup_op (nor, &op, nor->reg_proto); + + ret =spi_mem_exec_op (nor->spimem, &op); +if (ret) +dev_dbg (nor->dev,"error %d setting 4-byte mode\n" , ret); + +return ret; +} +/** * cypress_nor_determine_addr_mode_by_sr1() - Determine current address mode * (3 or 4-byte) by querying status
@@ -526,6 +548,9 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,struct spi_mem_op op;int ret; +/* Assign 4-byte address mode method that is not determined in BFPT */ + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode; + ret =cypress_nor_set_addr_mode_nbytes (nor);if (ret)return ret;
@@ -591,6 +616,9 @@ s25hx_t_post_bfpt_fixup(struct spi_nor *nor, {int ret; +/* Assign 4-byte address mode method that is not determined in BFPT */ + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode; + ret =cypress_nor_set_addr_mode_nbytes (nor);if (ret)return ret;
@@ -718,6 +746,9 @@ static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor,const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt) { +/* Assign 4-byte address mode method that is not determined in BFPT */ + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode; +return cypress_nor_set_addr_mode_nbytes (nor); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 258/480 perf sched: Make sure it frees the usage string
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 10d9b89203765fb776512742c13af8dd92821842 ]
The parse_options_subcommand() allocates the usage string based on the given subcommands. So it should reach the end of the function to free the string to prevent memory leaks.
--- tools/perf/builtin-sched.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
tools/perf/builtin-sched.c +13 -12
@@ -3902,9 +3902,9 @@ int cmd_sched(int argc, const char **argv)* Aliased to 'perf script' for now: */ if (!strcmp (argv[0 ],"script" )) { -return cmd_script (argc, argv); + ret =cmd_script (argc, argv); }else if (strlen (argv[0 ]) >2 &&strstarts ("record" , argv[0 ])) { -return __cmd_record (argc, argv); + ret =__cmd_record (argc, argv); }else if (strlen (argv[0 ]) >2 &&strstarts ("latency" , argv[0 ])) { sched.tp_handler = &lat_ops;if (argc >1 ) {
@@ -3913,7 +3913,7 @@ int cmd_sched(int argc, const char **argv)usage_with_options (latency_usage, latency_options); }setup_sorting (&sched, latency_options, latency_usage); -return perf_sched__lat (&sched); + ret =perf_sched__lat (&sched); }else if (!strcmp (argv[0 ],"map" )) {if (argc) { argc =parse_options (argc, argv, map_options, map_usage,0 );
@@ -3924,13 +3924,14 @@ int cmd_sched(int argc, const char **argv) sched.map.task_names =strlist__new (sched.map.task_name,NULL );if (sched.map.task_names ==NULL ) {fprintf (stderr,"Failed to parse task names\n" ); -return -1 ; + ret =-1 ; + goto out; } } } sched.tp_handler = &map_ops;setup_sorting (&sched, latency_options, latency_usage); -return perf_sched__map (&sched); + ret =perf_sched__map (&sched); }else if (strlen (argv[0 ]) >2 &&strstarts ("replay" , argv[0 ])) { sched.tp_handler = &replay_ops;if (argc) {
@@ -3938,7 +3939,7 @@ int cmd_sched(int argc, const char **argv)if (argc)usage_with_options (replay_usage, replay_options); } -return perf_sched__replay (&sched); + ret =perf_sched__replay (&sched); }else if (!strcmp (argv[0 ],"timehist" )) {if (argc) { argc = parse_options(argc, argv, timehist_options,
@@ -3954,19 +3955,19 @@ int cmd_sched(int argc, const char **argv)parse_options_usage (NULL , timehist_options,"w" , true);if (sched.show_next)parse_options_usage (NULL , timehist_options,"n" , true); -return -EINVAL ; + ret = -EINVAL ; + goto out; } ret =symbol__validate_sym_arguments (); -if (ret) -return ret; - -return perf_sched__timehist (&sched); +if (!ret) + ret =perf_sched__timehist (&sched); }else {usage_with_options (sched_usage, sched_options); } +out:/* free usage string allocated by parse_options_subcommand */ free ((void *)sched_usage[0 ]); -return 0 ; +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 259/480 perf sched: Free thread->priv using priv_destructor
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit aa9fdd106bab8c478d37eba5703c0950ad5c0d4f ]
In many perf sched subcommand saves priv data structure in the thread but it forgot to free them. As it's an opaque type with 'void *', it needs to register that knows how to free the data. In this case, just regular 'free()' is fine.
--- tools/perf/builtin-sched.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-sched.c +2 -0
@@ -3898,6 +3898,8 @@ int cmd_sched(int argc, const char **argv)if (!argc)usage_with_options (sched_usage, sched_options); +thread__set_priv_destructor (free); +/* * Aliased to 'perf script' for now: */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 260/480 perf sched: Fix memory leaks in perf sched map
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit dc3a80c98884d86389b3b572c50ccc7f502cd41b ]
It maintains per-cpu pointers for the current thread but it doesn't release the refcounts.
--- tools/perf/builtin-sched.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
tools/perf/builtin-sched.c +20 -11
@@ -1634,6 +1634,7 @@ static int map_switch_event(struct perf_sched *sched, struct evsel *evsel,const char *color =PERF_COLOR_NORMAL ;char stimestamp[32 ];const char *str; +int ret =-1 ;BUG_ON (this_cpu.cpu >=MAX_CPUS || this_cpu.cpu <0 );
@@ -1664,17 +1665,20 @@ static int map_switch_event(struct perf_sched *sched, struct evsel *evsel, sched_in =map__findnew_thread (sched, machine,-1 , next_pid); sched_out =map__findnew_thread (sched, machine,-1 , prev_pid);if (sched_in ==NULL || sched_out ==NULL ) -return -1 ; + goto out; tr =thread__get_runtime (sched_in); -if (tr ==NULL ) { -thread__put (sched_in); -return -1 ; - } +if (tr ==NULL ) + goto out; + +thread__put (sched->curr_thread[this_cpu.cpu]); +thread__put (sched->curr_out_thread[this_cpu.cpu]); sched->curr_thread[this_cpu.cpu] =thread__get (sched_in); sched->curr_out_thread[this_cpu.cpu] =thread__get (sched_out); + ret =0 ; + str =thread__comm_str (sched_in); new_shortname =0 ;if (!tr->shortname[0 ]) {
@@ -1769,12 +1773,10 @@ static int map_switch_event(struct perf_sched *sched, struct evsel *evsel,color_fprintf (stdout, color,"\n" ); out: -if (sched->map.task_name) -thread__put (sched_out); - +thread__put (sched_out);thread__put (sched_in); -return 0 ; +return ret; } static int process_sched_switch_event(const struct perf_tool *tool,
@@ -3556,10 +3558,10 @@ static int perf_sched__map(struct perf_sched *sched) sched->curr_out_thread =calloc (MAX_CPUS ,sizeof (*(sched->curr_out_thread)));if (!sched->curr_out_thread) -return rc; + goto out_free_curr_thread;if (setup_cpus_switch_event (sched)) - goto out_free_curr_thread; + goto out_free_curr_out_thread;if (setup_map_cpus (sched)) goto out_free_cpus_switch_event;
@@ -3590,7 +3592,14 @@ static int perf_sched__map(struct perf_sched *sched) out_free_cpus_switch_event:free_cpus_switch_event (sched); +out_free_curr_out_thread: +for (int i =0 ; i <MAX_CPUS ; i++) +thread__put (sched->curr_out_thread[i]); +zfree (&sched->curr_out_thread); + out_free_curr_thread: +for (int i =0 ; i <MAX_CPUS ; i++) +thread__put (sched->curr_thread[i]);zfree (&sched->curr_thread);return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 261/480 perf sched: Fix thread leaks in perf sched timehist
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit e2eb59260c4f6bac403491d0112891766b8650d1 ]
Add missing thread__put() after machine__findnew_thread() or timehist_get_thread(). Also idle threads' last_thread should be refcounted properly.
--- tools/perf/builtin-sched.c | 48 +++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-)
tools/perf/builtin-sched.c +37 -11
@@ -2313,8 +2313,10 @@ static void save_task_callchain(struct perf_sched *sched,return ; } -if (!sched->show_callchain || sample->callchain ==NULL ) +if (!sched->show_callchain || sample->callchain ==NULL ) { +thread__put (thread);return ; + } cursor =get_tls_callchain_cursor ();
@@ -2323,10 +2325,12 @@ static void save_task_callchain(struct perf_sched *sched,if (verbose >0 )pr_err ("Failed to resolve callchain. Skipping\n" ); +thread__put (thread);return ; }callchain_cursor_commit (cursor); +thread__put (thread);while (true) {struct callchain_cursor_node *node;
@@ -2403,8 +2407,17 @@ static void free_idle_threads(void)return ;for (i =0 ; i < idle_max_cpu; ++i) { -if ((idle_threads[i])) -thread__delete (idle_threads[i]); +struct thread *idle = idle_threads[i]; + +if (idle) { +struct idle_thread_runtime *itr; + + itr =thread__priv (idle); +if (itr) +thread__put (itr->last_thread); + +thread__delete (idle); + } }free (idle_threads);
@@ -2441,7 +2454,7 @@ static struct thread *get_idle_thread(int cpu) } } -return idle_threads[cpu]; +return thread__get (idle_threads[cpu]); } static void save_idle_callchain(struct perf_sched *sched,
@@ -2496,7 +2509,8 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,if (itr ==NULL )return NULL ; - itr->last_thread = thread; +thread__put (itr->last_thread); + itr->last_thread =thread__get (thread);/* copy task callchain when entering to idle */ if (evsel__intval (evsel, sample,"next_pid" ) ==0 )
@@ -2567,6 +2581,7 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,/* show wakeup unless both awakee and awaker are filtered */ if (timehist_skip_sample (sched, thread, evsel, sample) &&timehist_skip_sample (sched, awakened, evsel, sample)) { +thread__put (thread);return ; }
@@ -2583,6 +2598,8 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,printf ("awakened: %s" ,timehist_get_commstr (awakened));printf ("\n" ); + +thread__put (thread); } static int timehist_sched_wakeup_ignore(const struct perf_tool *tool __maybe_unused,
@@ -2611,8 +2628,10 @@ static int timehist_sched_wakeup_event(const struct perf_tool *tool,return -1 ; tr =thread__get_runtime (thread); -if (tr ==NULL ) +if (tr ==NULL ) { +thread__put (thread);return -1 ; + }if (tr->ready_to_run ==0 ) tr->ready_to_run = sample->time;
@@ -2622,6 +2641,7 @@ static int timehist_sched_wakeup_event(const struct perf_tool *tool, !perf_time__skip_sample(&sched->ptime, sample->time))timehist_print_wakeup_event (sched, evsel, sample, machine, thread); +thread__put (thread);return 0 ; }
@@ -2649,6 +2669,7 @@ static void timehist_print_migration_event(struct perf_sched *sched,if (timehist_skip_sample (sched, thread, evsel, sample) &&timehist_skip_sample (sched, migrated, evsel, sample)) { +thread__put (thread);return ; }
@@ -2676,6 +2697,7 @@ static void timehist_print_migration_event(struct perf_sched *sched,printf (" cpu %d => %d" , ocpu, dcpu);printf ("\n" ); +thread__put (thread); } static int timehist_migrate_task_event(const struct perf_tool *tool,
@@ -2695,8 +2717,10 @@ static int timehist_migrate_task_event(const struct perf_tool *tool,return -1 ; tr =thread__get_runtime (thread); -if (tr ==NULL ) +if (tr ==NULL ) { +thread__put (thread);return -1 ; + } tr->migrations++; tr->migrated = sample->time;
@@ -2706,6 +2730,7 @@ static int timehist_migrate_task_event(const struct perf_tool *tool,timehist_print_migration_event (sched, evsel, sample, machine, thread); } +thread__put (thread);return 0 ; }
@@ -2728,10 +2753,10 @@ static void timehist_update_task_prio(struct evsel *evsel,return ; tr =thread__get_runtime (thread); -if (tr ==NULL ) -return ; +if (tr !=NULL ) + tr->prio = next_prio; - tr->prio = next_prio; +thread__put (thread); } static int timehist_sched_change_event(const struct perf_tool *tool,
@@ -2743,7 +2768,7 @@ static int timehist_sched_change_event(const struct perf_tool *tool, struct perf_sched *sched = container_of(tool, struct perf_sched, tool);struct perf_time_interval *ptime = &sched->ptime;struct addr_location al; -struct thread *thread; +struct thread *thread =NULL ;struct thread_runtime *tr =NULL ;u64 tprev, t = sample->time;int rc =0 ;
@@ -2867,6 +2892,7 @@ static int timehist_sched_change_event(const struct perf_tool *tool,evsel__save_time (evsel, sample->time, sample->cpu); +thread__put (thread);addr_location__exit (&al);return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 262/480 perf sched: Fix memory leaks for evsel->priv in timehist
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 117e5c33b1c44037af016d77ce6c0b086d55535f ]
It uses evsel->priv to save per-cpu timing information. It should be freed when the evsel is released.
Add the priv destructor for evsel same as thread to handle that.
--- tools/perf/builtin-sched.c | 12 ++++++++++++ tools/perf/util/evsel.c | 11 +++++++++++ tools/perf/util/evsel.h | 2 ++ 3 files changed, 25 insertions(+)
tools/perf/builtin-sched.c +12 -0
@@ -2020,6 +2020,16 @@ static u64 evsel__get_time(struct evsel *evsel, u32 cpu)return r->last_time[cpu]; } +static void timehist__evsel_priv_destructor (void *priv) +{ +struct evsel_runtime *r = priv; + +if (r) { +free (r->last_time); +free (r); + } +} +static int comm_width =30 ;static char *timehist_get_commstr (struct thread *thread)
@@ -3314,6 +3324,8 @@ static int perf_sched__timehist(struct perf_sched *sched)setup_pager (); +evsel__set_priv_destructor (timehist__evsel_priv_destructor); +/* prefer sched_waking if it is captured */ if (evlist__find_tracepoint_by_name (session->evlist,"sched:sched_waking" )) handlers[1 ].handler = timehist_sched_wakeup_ignore;
tools/perf/util/evsel.c +11 -0
@@ -1652,6 +1652,15 @@ static void evsel__free_config_terms(struct evsel *evsel)free_config_terms (&evsel->config_terms); } +static void (*evsel__priv_destructor)(void *priv); + +void evsel__set_priv_destructor (void (*destructor)(void *priv)) +{ +assert (evsel__priv_destructor ==NULL ); + + evsel__priv_destructor = destructor; +} +void evsel__exit (struct evsel *evsel) {assert (list_empty (&evsel->core.node));
@@ -1680,6 +1689,8 @@ void evsel__exit(struct evsel *evsel)hashmap__free (evsel->per_pkg_mask); evsel->per_pkg_mask =NULL ;zfree (&evsel->metric_events); +if (evsel__priv_destructor) +evsel__priv_destructor (evsel->priv); perf_evsel__object.fini (evsel);if (evsel__tool_event (evsel) ==TOOL_PMU__EVENT_SYSTEM_TIME ||evsel__tool_event (evsel) ==TOOL_PMU__EVENT_USER_TIME )
tools/perf/util/evsel.h +2 -0
@@ -270,6 +270,8 @@ void evsel__init(struct evsel *evsel, struct perf_event_attr *attr, int idx);void evsel__exit (struct evsel *evsel);void evsel__delete (struct evsel *evsel); +void evsel__set_priv_destructor (void (*destructor)(void *priv)); +struct callchain_param ; void evsel__config(struct evsel *evsel, struct record_opts *opts,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 263/480 perf sched: Use RC_CHK_EQUAL() to compare pointers
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 7a4002ec9e0fced907179da94f67c3082d7b4162 ]
So that it can check two pointers to the same object properly when REFCNT_CHECKING is on.
--- tools/perf/builtin-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-sched.c +1 -1
@@ -994,7 +994,7 @@ thread_atoms_search(struct rb_root_cached *root, struct thread *thread,else if (cmp <0 ) node = node->rb_right;else { -BUG_ON (thread != atoms->thread); +BUG_ON (!RC_CHK_EQUAL (thread, atoms->thread));return atoms; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 264/480 perf sched: Fix memory leaks in perf sched latency
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit e68b1c0098b959cb88afce5c93dd6a9324e6da78 ]
The work_atoms should be freed after use. Add free_work_atoms() to make sure to release all. It should use list_splice_init() when merging atoms to prevent accessing invalid pointers.
--- tools/perf/builtin-sched.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
tools/perf/builtin-sched.c +24 -3
@@ -1111,6 +1111,21 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp) atoms->nb_atoms++; } +static void free_work_atoms (struct work_atoms *atoms) +{ +struct work_atom *atom, *tmp; + +if (atoms ==NULL ) +return ; + +list_for_each_entry_safe (atom, tmp, &atoms->work_list, list) { +list_del (&atom->list); +free (atom); + } +thread__zput (atoms->thread); +free (atoms); +} + static int latency_switch_event(struct perf_sched *sched, struct evsel *evsel, struct perf_sample *sample,
@@ -3426,13 +3441,13 @@ static void __merge_work_atoms(struct rb_root_cached *root, struct work_atoms *d this->total_runtime += data->total_runtime; this->nb_atoms += data->nb_atoms; this->total_lat += data->total_lat; -list_splice (&data->work_list, &this->work_list); +list_splice_init (&data->work_list, &this->work_list);if (this->max_lat < data->max_lat) { this->max_lat = data->max_lat; this->max_lat_start = data->max_lat_start; this->max_lat_end = data->max_lat_end; } -zfree (&data); +free_work_atoms (data);return ; } }
@@ -3511,7 +3526,6 @@ static int perf_sched__lat(struct perf_sched *sched) work_list = rb_entry(next, struct work_atoms, node);output_lat_thread (sched, work_list); next =rb_next (next); -thread__zput (work_list->thread); }printf (" -----------------------------------------------------------------------------------------------------------------\n" );
@@ -3525,6 +3539,13 @@ static int perf_sched__lat(struct perf_sched *sched) rc =0 ; +while ((next =rb_first_cached (&sched->sorted_atom_root))) { +struct work_atoms *data; + + data = rb_entry(next, struct work_atoms, node); +rb_erase_cached (next, &sched->sorted_atom_root); +free_work_atoms (data); + } out_free_cpus_switch_event:free_cpus_switch_event (sched);return rc;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 265/480 RDMA/hns: Fix double destruction of rsv_qp
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wenglianfa <[email protected]>
[ Upstream commit c6957b95ecc5b63c5a4bb4ecc28af326cf8f6dc8 ]
rsv_qp may be double destroyed in error flow, first in free_mr_init(), and then in hns_roce_exit(). Fix it by moving the free_mr_init() call into hns_roce_v2_init().
list_del corruption, ffff589732eb9b50->next is LIST_POISON1 (dead000000000100)
WARNING: CPU: 8 PID: 1047115 at lib/list_debug.c:53 __list_del_entry_valid+0x148/0x240 ... Call trace: __list_del_entry_valid+0x148/0x240 hns_roce_qp_remove+0x4c/0x3f0 [hns_roce_hw_v2] hns_roce_v2_destroy_qp_common+0x1dc/0x5f4 [hns_roce_hw_v2] hns_roce_v2_destroy_qp+0x22c/0x46c [hns_roce_hw_v2] free_mr_exit+0x6c/0x120 [hns_roce_hw_v2] hns_roce_v2_exit+0x170/0x200 [hns_roce_hw_v2] hns_roce_exit+0x118/0x350 [hns_roce_hw_v2] __hns_roce_hw_v2_init_instance+0x1c8/0x304 [hns_roce_hw_v2] hns_roce_hw_v2_reset_notify_init+0x170/0x21c [hns_roce_hw_v2] hns_roce_hw_v2_reset_notify+0x6c/0x190 [hns_roce_hw_v2] hclge_notify_roce_client+0x6c/0x160 [hclge] hclge_reset_rebuild+0x150/0x5c0 [hclge] hclge_reset+0x10c/0x140 [hclge] hclge_reset_subtask+0x80/0x104 [hclge] hclge_reset_service_task+0x168/0x3ac [hclge] hclge_service_task+0x50/0x100 [hclge] process_one_work+0x250/0x9a0 worker_thread+0x324/0x990 kthread+0x190/0x210 ret_from_fork+0x10/0x18
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 25 +++++++++++----------- drivers/infiniband/hw/hns/hns_roce_main.c | 6 +++--- 2 files changed, 16 insertions(+), 15 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +13 -12
@@ -2971,14 +2971,22 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) {int ret; +if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 ) { + ret =free_mr_init (hr_dev); +if (ret) { +dev_err (hr_dev->dev,"failed to init free mr!\n" ); +return ret; + } + } +/* The hns ROCEE requires the extdb info to be cleared before using */ ret =hns_roce_clear_extdb_list_info (hr_dev);if (ret) -return ret; + goto err_clear_extdb_failed; ret =get_hem_table (hr_dev);if (ret) -return ret; + goto err_clear_extdb_failed;if (hr_dev->is_vf)return 0 ;
@@ -2993,6 +3001,9 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) err_llm_init_failed:put_hem_table (hr_dev); +err_clear_extdb_failed: +if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 ) +free_mr_exit (hr_dev);return ret; }
@@ -7027,21 +7038,11 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle) goto error_failed_roce_init; } -if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 ) { - ret =free_mr_init (hr_dev); -if (ret) { -dev_err (hr_dev->dev,"failed to init free mr!\n" ); - goto error_failed_free_mr_init; - } - } handle->priv = hr_dev;return 0 ; -error_failed_free_mr_init: -hns_roce_exit (hr_dev); - error_failed_roce_init:kfree (hr_dev->priv);
drivers/infiniband/hw/hns/hns_roce_main.c +3 -3
@@ -965,6 +965,9 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)spin_lock_init (&hr_dev->sm_lock); +INIT_LIST_HEAD (&hr_dev->qp_list); +spin_lock_init (&hr_dev->qp_list_lock); +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_RECORD_DB ) {INIT_LIST_HEAD (&hr_dev->pgdir_list);
@@ -1132,9 +1135,6 @@ int hns_roce_init(struct hns_roce_dev *hr_dev) } } -INIT_LIST_HEAD (&hr_dev->qp_list); -spin_lock_init (&hr_dev->qp_list_lock); - ret =hns_roce_register_device (hr_dev);if (ret) goto error_failed_register_device;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/480 RDMA/hns: Fix HW configurations not cleared in error flow
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wenglianfa <[email protected]>
[ Upstream commit 998b41cb20b02c4e28ac558e4e7f8609d659ec05 ]
hns_roce_clear_extdb_list_info() will eventually do some HW configurations through FW, and they need to be cleared by calling hns_roce_function_clear() when the initialization fails.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -1
@@ -2986,7 +2986,7 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) ret =get_hem_table (hr_dev);if (ret) - goto err_clear_extdb_failed; + goto err_get_hem_table_failed;if (hr_dev->is_vf)return 0 ;
@@ -3001,6 +3001,8 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) err_llm_init_failed:put_hem_table (hr_dev); +err_get_hem_table_failed: +hns_roce_function_clear (hr_dev); err_clear_extdb_failed:if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 )free_mr_exit (hr_dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/480 crypto: ccp - Fix locking on alloc failure handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kardashevskiy <[email protected]>
[ Upstream commit b4abeccb8d39db7d9b51cb0098d6458760b30a75 ]
The __snp_alloc_firmware_pages() helper allocates pages in the firmware state (alloc + rmpupdate). In case of failed rmpupdate, it tries reclaiming pages with already changed state. This requires calling the PSP firmware and since there is sev_cmd_mutex to guard such calls, the helper takes a "locked" parameter so specify if the lock needs to be held.
Most calls happen from snp_alloc_firmware_page() which executes without the lock. However
commit 24512afa4336 ("crypto: ccp: Handle the legacy TMR allocation when SNP is enabled")
switched sev_fw_alloc() from alloc_pages() (which does not call the PSP) to __snp_alloc_firmware_pages() (which does) but did not account for the fact that sev_fw_alloc() is called from __sev_platform_init_locked() (via __sev_platform_init_handle_tmr()) and executes with the lock held.
Add a "locked" parameter to __snp_alloc_firmware_pages().
Make sev_fw_alloc() use the new parameter to prevent potential deadlock in rmp_mark_pages_firmware() if rmpupdate() failed.
--- drivers/crypto/ccp/sev-dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/ccp/sev-dev.c +4 -4
@@ -424,7 +424,7 @@ static int rmp_mark_pages_firmware(unsigned long paddr, unsigned int npages, booreturn rc; } -static struct page *__snp_alloc_firmware_pages (gfp_t gfp_mask,int order) +static struct page *__snp_alloc_firmware_pages (gfp_t gfp_mask,int order,bool locked) {unsigned long npages =1ul << order, paddr;struct sev_device *sev;
@@ -443,7 +443,7 @@ static struct page *__snp_alloc_firmware_pages(gfp_t gfp_mask, int order)return page; paddr =__pa ((unsigned long )page_address (page)); -if (rmp_mark_pages_firmware (paddr, npages, false)) +if (rmp_mark_pages_firmware (paddr, npages, locked))return NULL ;return page;
@@ -453,7 +453,7 @@ void *snp_alloc_firmware_page(gfp_t gfp_mask) {struct page *page; - page =__snp_alloc_firmware_pages (gfp_mask,0 ); + page =__snp_alloc_firmware_pages (gfp_mask,0 , false);return page ?page_address (page) :NULL ; }
@@ -488,7 +488,7 @@ static void *sev_fw_alloc(unsigned long len) {struct page *page; - page =__snp_alloc_firmware_pages (GFP_KERNEL ,get_order (len)); + page =__snp_alloc_firmware_pages (GFP_KERNEL ,get_order (len), true);if (!page)return NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/480 crypto: inside-secure - Fix `dma_unmap_sg()` nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit cb7fa6b6fc71e0c801e271aa498e2f19e6df2931 ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/inside-secure/safexcel_hash.c +6 -2
@@ -249,7 +249,9 @@ static int safexcel_handle_req_result(struct safexcel_crypto_priv *priv,safexcel_complete (priv, ring);if (sreq->nents) { -dma_unmap_sg (priv->dev, areq->src, sreq->nents,DMA_TO_DEVICE ); +dma_unmap_sg (priv->dev, areq->src, +sg_nents_for_len (areq->src, areq->nbytes), +DMA_TO_DEVICE ); sreq->nents =0 ; }
@@ -497,7 +499,9 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring, DMA_FROM_DEVICE); unmap_sg:if (req->nents) { -dma_unmap_sg (priv->dev, areq->src, req->nents,DMA_TO_DEVICE ); +dma_unmap_sg (priv->dev, areq->src, +sg_nents_for_len (areq->src, areq->nbytes), +DMA_TO_DEVICE ); req->nents =0 ; } cdesc_rollback:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/480 crypto: ccp - Fix crash when rebind ccp device for ccp.ko
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mengbiao Xiong <[email protected]>
[ Upstream commit 181698af38d3f93381229ad89c09b5bd0496661a ]
When CONFIG_CRYPTO_DEV_CCP_DEBUGFS is enabled, rebinding the ccp device causes the following crash:
$ echo '0000:0a:00.2' > /sys/bus/pci/drivers/ccp/unbind $ echo '0000:0a:00.2' > /sys/bus/pci/drivers/ccp/bind
[ 204.976930] BUG: kernel NULL pointer dereference, address: 0000000000000098 [ 204.978026] #PF: supervisor write access in kernel mode [ 204.979126] #PF: error_code(0x0002) - not-present page [ 204.980226] PGD 0 P4D 0 [ 204.981317] Oops: Oops: 0002 [#1] SMP NOPTI ... [ 204.997852] Call Trace: [ 204.999074] <TASK> [ 205.000297] start_creating+0x9f/0x1c0 [ 205.001533] debugfs_create_dir+0x1f/0x170 [ 205.002769] ? srso_return_thunk+0x5/0x5f [ 205.004000] ccp5_debugfs_setup+0x87/0x170 [ccp] [ 205.005241] ccp5_init+0x8b2/0x960 [ccp] [ 205.006469] ccp_dev_init+0xd4/0x150 [ccp] [ 205.007709] sp_init+0x5f/0x80 [ccp] [ 205.008942] sp_pci_probe+0x283/0x2e0 [ccp] [ 205.010165] ? srso_return_thunk+0x5/0x5f [ 205.011376] local_pci_probe+0x4f/0xb0 [ 205.012584] pci_device_probe+0xdb/0x230 [ 205.013810] really_probe+0xed/0x380 [ 205.015024] __driver_probe_device+0x7e/0x160 [ 205.016240] device_driver_attach+0x2f/0x60 [ 205.017457] bind_store+0x7c/0xb0 [ 205.018663] drv_attr_store+0x28/0x40 [ 205.019868] sysfs_kf_write+0x5f/0x70 [ 205.021065] kernfs_fop_write_iter+0x145/0x1d0 [ 205.022267] vfs_write+0x308/0x440 [ 205.023453] ksys_write+0x6d/0xe0 [ 205.024616] __x64_sys_write+0x1e/0x30 [ 205.025778] x64_sys_call+0x16ba/0x2150 [ 205.026942] do_syscall_64+0x56/0x1e0 [ 205.028108] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 205.029276] RIP: 0033:0x7fbc36f10104 [ 205.030420] Code: 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 8d 05 e1 08 2e 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 f3 c3 66 90 41 54 55 49 89 d4 53 48 89 f5
This patch sets ccp_debugfs_dir to NULL after destroying it in ccp5_debugfs_destroy, allowing the directory dentry to be recreated when rebinding the ccp device.
Tested on AMD Ryzen 7 1700X.
--- drivers/crypto/ccp/ccp-debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/ccp/ccp-debugfs.c +3 -0
@@ -319,5 +319,8 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)void ccp5_debugfs_destroy (void ) { +mutex_lock (&ccp_debugfs_lock);debugfs_remove_recursive (ccp_debugfs_dir); + ccp_debugfs_dir =NULL ; +mutex_unlock (&ccp_debugfs_lock); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/480 RDMA/hns: Get message length of ack_req from FW
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 2c2ec0106c0f1f12d4eefd11de318ac47557a750 ]
ACK_REQ_FREQ indicates the number of packets (after MTU fragmentation) HW sends before setting an ACK request. When MTU is greater than or equal to 1024, the current ACK_REQ_FREQ value causes HW to request an ACK for every MTU fragment. The processing of a large number of ACKs severely impacts HW performance when sending large size payloads.
Get message length of ack_req from FW so that we can adjust this parameter according to different situations. There are several constraints for ACK_REQ_FREQ:
1. mtu * (2 ^ ACK_REQ_FREQ) should not be too large, otherwise it may cause some unexpected retries when sending large payload.
2. ACK_REQ_FREQ should be larger than or equal to LP_PKTN_INI.
3. ACK_REQ_FREQ must be equal to LP_PKTN_INI when using LDCP or HC3 congestion control algorithm.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 45 ++++++++++++++++----- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 8 +++- 3 files changed, 43 insertions(+), 11 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +1 -0
@@ -856,6 +856,7 @@ struct hns_roce_caps {u16 default_ceq_arm_st;u8 cong_cap;enum hns_roce_cong_type default_cong_type; +u32 max_ack_req_msg_len; };enum hns_roce_device_state {
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +35 -10
100 lines not on this page · raw message
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +7 -1
@@ -1168,7 +1168,8 @@ struct hns_roce_cfg_gmv_tb_b {#define GMV_TB_B_SMAC_H GMV_TB_B_FIELD_LOC(47, 32)#define GMV_TB_B_SGID_IDX GMV_TB_B_FIELD_LOC(71, 64) -#define HNS_ROCE_QUERY_PF_CAPS_CMD_NUM 5 +#define HNS_ROCE_QUERY_PF_CAPS_CMD_NUM_HIP08 5 +#define HNS_ROCE_QUERY_PF_CAPS_CMD_NUM 6struct hns_roce_query_pf_caps_a {u8 number_ports;u8 local_ca_ack_delay;
@@ -1280,6 +1281,11 @@ struct hns_roce_query_pf_caps_e {__le16 aeq_period; }; +struct hns_roce_query_pf_caps_f { +__le32 max_ack_req_msg_len; +__le32 rsv[5 ]; +}; +#define PF_CAPS_E_FIELD_LOC (h, l) \ FIELD_LOC(struct hns_roce_query_pf_caps_e, h, l)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 271/480 RDMA/hns: Fix accessing uninitialized resources
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 278c18a4a78a9a6bf529ef45ccde512a5686ea9d ]
hr_dev->pgdir_list and hr_dev->pgdir_mutex won't be initialized if CQ/QP record db are not enabled, but they are also needed when using SRQ with SRQ record db enabled. Simplified the logic by always initailizing the reosurces.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +4 -12
@@ -947,10 +947,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev)static void hns_roce_teardown_hca (struct hns_roce_dev *hr_dev) {hns_roce_cleanup_bitmap (hr_dev); - -if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || - hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_RECORD_DB ) -mutex_destroy (&hr_dev->pgdir_mutex); +mutex_destroy (&hr_dev->pgdir_mutex); }/**
@@ -968,11 +965,8 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)INIT_LIST_HEAD (&hr_dev->qp_list);spin_lock_init (&hr_dev->qp_list_lock); -if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || - hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_RECORD_DB ) { -INIT_LIST_HEAD (&hr_dev->pgdir_list); -mutex_init (&hr_dev->pgdir_mutex); - } +INIT_LIST_HEAD (&hr_dev->pgdir_list); +mutex_init (&hr_dev->pgdir_mutex);hns_roce_init_uar_table (hr_dev);
@@ -1004,9 +998,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev) err_uar_table_free:ida_destroy (&hr_dev->uar_ida.ida); -if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || - hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_RECORD_DB ) -mutex_destroy (&hr_dev->pgdir_mutex); +mutex_destroy (&hr_dev->pgdir_mutex);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 272/480 RDMA/hns: Drop GFP_NOWARN
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 5338abb299f0cd764edf78a7e71a0b746af35030 ]
GFP_NOWARN silences all warnings on dma_alloc_coherent() failure, which might otherwise help with troubleshooting.
--- drivers/infiniband/hw/hns/hns_roce_hem.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.c +5 -13
@@ -249,15 +249,12 @@ int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev, }static struct hns_roce_hem *hns_roce_alloc_hem (struct hns_roce_dev *hr_dev, -unsigned long hem_alloc_size, -gfp_t gfp_mask) +unsigned long hem_alloc_size) {struct hns_roce_hem *hem;int order;void *buf; -WARN_ON (gfp_mask & __GFP_HIGHMEM); - order =get_order (hem_alloc_size);if (PAGE_SIZE << order != hem_alloc_size) { dev_err(hr_dev->dev, "invalid hem_alloc_size: %lu!\n",
@@ -265,13 +262,12 @@ static struct hns_roce_hem *hns_roce_alloc_hem(struct hns_roce_dev *hr_dev,return NULL ; } - hem =kmalloc (sizeof (*hem), - gfp_mask & ~(__GFP_HIGHMEM | __GFP_NOWARN)); + hem =kmalloc (sizeof (*hem),GFP_KERNEL );if (!hem)return NULL ; buf =dma_alloc_coherent (hr_dev->dev, hem_alloc_size, - &hem->dma, gfp_mask); + &hem->dma,GFP_KERNEL );if (!buf) goto fail;
@@ -378,7 +374,6 @@ static int alloc_mhop_hem(struct hns_roce_dev *hr_dev, {u32 bt_size = mhop->bt_chunk_size;struct device *dev = hr_dev->dev; -gfp_t flag;u64 bt_ba;u32 size;int ret;
@@ -417,8 +412,7 @@ static int alloc_mhop_hem(struct hns_roce_dev *hr_dev,* alloc bt space chunk for MTT/CQE. */ size = table->type <HEM_TYPE_MTT ? mhop->buf_chunk_size : bt_size; - flag =GFP_KERNEL | __GFP_NOWARN; - table->hem[index->buf] =hns_roce_alloc_hem (hr_dev, size, flag); + table->hem[index->buf] =hns_roce_alloc_hem (hr_dev, size);if (!table->hem[index->buf]) { ret = -ENOMEM ; goto err_alloc_hem;
@@ -546,9 +540,7 @@ int hns_roce_table_get(struct hns_roce_dev *hr_dev, goto out; } - table->hem[i] =hns_roce_alloc_hem (hr_dev, - table->table_chunk_size, -GFP_KERNEL | __GFP_NOWARN); + table->hem[i] =hns_roce_alloc_hem (hr_dev, table->table_chunk_size);if (!table->hem[i]) { ret = -ENOMEM ; goto out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 273/480 RDMA/hns: Fix -Wframe-larger-than issue
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 79d56805c5068f2bc81518043e043c3dedd1c82a ]
Fix -Wframe-larger-than issue by allocating memory for qpc struct with kzalloc() instead of using stack memory.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +10 -5
@@ -5371,11 +5371,10 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, {struct hns_roce_dev *hr_dev =to_hr_dev (ibqp->device);struct hns_roce_qp *hr_qp =to_hr_qp (ibqp); -struct hns_roce_v2_qp_context ctx[2 ]; -struct hns_roce_v2_qp_context *context = ctx; -struct hns_roce_v2_qp_context *qpc_mask = ctx +1 ; +struct hns_roce_v2_qp_context *context; +struct hns_roce_v2_qp_context *qpc_mask;struct ib_device *ibdev = &hr_dev->ib_dev; -int ret; +int ret = -ENOMEM ;if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS )return -EOPNOTSUPP ;
@@ -5386,7 +5385,11 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,* we should set all bits of the relevant fields in context mask to * 0 at the same time, else set them to 0x1. */ -memset (context,0 , hr_dev->caps.qpc_sz); + context =kvzalloc (sizeof (*context),GFP_KERNEL ); + qpc_mask =kvzalloc (sizeof (*qpc_mask),GFP_KERNEL ); +if (!context || !qpc_mask) + goto out; +memset (qpc_mask,0xff , hr_dev->caps.qpc_sz); ret = hns_roce_v2_set_abs_fields(ibqp, attr, attr_mask, cur_state,
@@ -5428,6 +5431,8 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,clear_qp (hr_qp); out: +kvfree (qpc_mask); +kvfree (context);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 274/480 tracing: Use queue_rcu_work() to free filters
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 3aceaa539cfe3a2e62bd92e6697d9fae1c20c0be ]
Freeing of filters requires to wait for both an RCU grace period as well as a RCU task trace wait period after they have been detached from their lists. The trace task period can be quite large so the freeing of the filters was moved to use the call_rcu*() routines. The problem with that is that the callback functions of call_rcu*() is done from a soft irq and can cause latencies if the callback takes a bit of time.
The filters are freed per event in a system and the syscalls system contains an event per system call, which can be over 700 events. Freeing 700 filters in a bottom half is undesirable.
Instead, move the freeing to use queue_rcu_work() which is done in task context.
--- kernel/trace/trace_events_filter.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
kernel/trace/trace_events_filter.c +20 -8
@@ -1342,13 +1342,14 @@ struct filter_list {struct filter_head {struct list_head list; -struct rcu_head rcu; +union { +struct rcu_head rcu; +struct rcu_work rwork; + }; }; - -static void free_filter_list (struct rcu_head *rhp) +static void free_filter_list (struct filter_head *filter_list) { - struct filter_head *filter_list = container_of(rhp, struct filter_head, rcu);struct filter_list *filter_item, *tmp;list_for_each_entry_safe (filter_item, tmp, &filter_list->list, list) {
@@ -1359,9 +1360,20 @@ static void free_filter_list(struct rcu_head *rhp)kfree (filter_list); } +static void free_filter_list_work (struct work_struct *work) +{ +struct filter_head *filter_list; + + filter_list = container_of(to_rcu_work(work), struct filter_head, rwork); +free_filter_list (filter_list); +} +static void free_filter_list_tasks (struct rcu_head *rhp) { -call_rcu (rhp, free_filter_list); + struct filter_head *filter_list = container_of(rhp, struct filter_head, rcu); + +INIT_RCU_WORK (&filter_list->rwork, free_filter_list_work); +queue_rcu_work (system_wq, &filter_list->rwork); }/*
@@ -1458,7 +1470,7 @@ static void filter_free_subsystem_filters(struct trace_subsystem_dir *dir,tracepoint_synchronize_unregister ();if (head) -free_filter_list (&head->rcu); +free_filter_list (head);list_for_each_entry (file, &tr->events, list) {if (file->system != dir || !file->filter)
@@ -2303,7 +2315,7 @@ static int process_system_preds(struct trace_subsystem_dir *dir,return 0 ; fail:/* No call succeeded */ -free_filter_list (&filter_list->rcu); +free_filter_list (filter_list);parse_error (pe,FILT_ERR_BAD_SUBSYS_FILTER ,0 );return -EINVAL ; fail_mem:
@@ -2313,7 +2325,7 @@ static int process_system_preds(struct trace_subsystem_dir *dir,if (!fail)delay_free_filter (filter_list);else -free_filter_list (&filter_list->rcu); +free_filter_list (filter_list);return -ENOMEM ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/480 kernel: trace: preemptirq_delay_test: use offstack cpu mask
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit adc353c0bfb243ebfd29b6222fa3bf149169a6de ]
A CPU mask on the stack is broken for large values of CONFIG_NR_CPUS:
kernel/trace/preemptirq_delay_test.c: In function ‘preemptirq_delay_run’:kernel/trace/preemptirq_delay_test.c:143:1: error: the frame size of 8512 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
Fall back to dynamic allocation here.
--- kernel/trace/preemptirq_delay_test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/trace/preemptirq_delay_test.c +9 -4
@@ -117,12 +117,15 @@ static int preemptirq_delay_run(void *data) {int i;int s =MIN (burst_size,NR_TEST_FUNCS ); -struct cpumask cpu_mask; +cpumask_var_t cpu_mask; + +if (!alloc_cpumask_var (&cpu_mask,GFP_KERNEL )) +return -ENOMEM ;if (cpu_affinity >-1 ) { -cpumask_clear (&cpu_mask); -cpumask_set_cpu (cpu_affinity, &cpu_mask); -if (set_cpus_allowed_ptr (current, &cpu_mask)) +cpumask_clear (cpu_mask); +cpumask_set_cpu (cpu_affinity, cpu_mask); +if (set_cpus_allowed_ptr (current, cpu_mask))pr_err ("cpu_affinity:%d, failed\n" , cpu_affinity); }
@@ -139,6 +142,8 @@ static int preemptirq_delay_run(void *data)__set_current_state (TASK_RUNNING ); +free_cpumask_var (cpu_mask); +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/480 proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangzijie <[email protected]>
[ Upstream commit ff7ec8dc1b646296f8d94c39339e8d3833d16c05 ]
Check pde->proc_ops->proc_lseek directly may cause UAF in rmmod scenario. It's a gap in proc_reg_open() after commit 654b33ada4ab("proc: fix UAF in proc_get_inode()"). Followed by AI Viro's suggestion, fix it in same manner.
--- fs/proc/generic.c | 2 ++ fs/proc/inode.c | 2 +- fs/proc/internal.h | 5 +++++ include/linux/proc_fs.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-)
fs/proc/generic.c +2 -0
@@ -569,6 +569,8 @@ static void pde_set_flags(struct proc_dir_entry *pde)if (pde->proc_ops->proc_compat_ioctl) pde->flags |= PROC_ENTRY_proc_compat_ioctl;#endif +if (pde->proc_ops->proc_lseek) + pde->flags |= PROC_ENTRY_proc_lseek; } struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
fs/proc/inode.c +1 -1
@@ -473,7 +473,7 @@ static int proc_reg_open(struct inode *inode, struct file *file) typeof_member(struct proc_ops, proc_open) open;struct pde_opener *pdeo; -if (!pde->proc_ops->proc_lseek) +if (!pde_has_proc_lseek (pde)) file->f_mode &= ~FMODE_LSEEK ;if (pde_is_permanent (pde)) {
fs/proc/internal.h +5 -0
@@ -99,6 +99,11 @@ static inline bool pde_has_proc_compat_ioctl(const struct proc_dir_entry *pde)#endif } +static inline bool pde_has_proc_lseek (const struct proc_dir_entry *pde) +{ +return pde->flags & PROC_ENTRY_proc_lseek; +} +extern struct kmem_cache *proc_dir_entry_cache;void pde_free (struct proc_dir_entry *pde);
include/linux/proc_fs.h +1 -0
@@ -27,6 +27,7 @@ enum { PROC_ENTRY_proc_read_iter =1U <<1 , PROC_ENTRY_proc_compat_ioctl =1U <<2 , + PROC_ENTRY_proc_lseek = 1U << 3, }; struct proc_ops {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 277/480 pinmux: fix race causing mux_owner NULL with active mux_usecount
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 0b075c011032f88d1cfde3b45d6dcf08b44140eb ]
commit 5a3e85c3c397 ("pinmux: Use sequential access to access desc->pinmux data") tried to address the issue when two client of the same gpio calls pinctrl_select_state() for the same functionality, was resulting in NULL pointer issue while accessing desc->mux_owner. However, issue was not completely fixed due to the way it was handled and it can still result in the same NULL pointer.
The issue occurs due to the following interleaving:
cpu0 (process A) cpu1 (process B)
pin_request() { pin_free() {
mutex_lock()
desc->mux_usecount--; //becomes 0
..
mutex_unlock()mutex_lock(desc->mux) desc->mux_usecount++; // becomes 1 desc->mux_owner = owner; mutex_unlock(desc->mux)
mutex_lock(desc->mux)
desc->mux_owner = NULL;
mutex_unlock(desc->mux)This sequence leads to a state where the pin appears to be in use (mux_usecount == 1) but has no owner (mux_owner == NULL), which can cause NULL pointer on next pin_request on the same pin.
Ensure that updates to mux_usecount and mux_owner are performed atomically under the same lock. Only clear mux_owner when mux_usecount reaches zero and no new owner has been assigned.
--- drivers/pinctrl/pinmux.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/pinctrl/pinmux.c +9 -11
@@ -236,18 +236,7 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,if (desc->mux_usecount)return NULL ; } - } - -/* -* If there is no kind of request function for the pin we just assume -* we got it by default and proceed. -*/ -if (gpio_range && ops->gpio_disable_free) - ops->gpio_disable_free (pctldev, gpio_range, pin); -else if (ops->free) - ops->free (pctldev, pin); - scoped_guard(mutex, &desc->mux_lock) {if (gpio_range) { owner = desc->gpio_owner; desc->gpio_owner =NULL ;
@@ -258,6 +247,15 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin, } } +/* +* If there is no kind of request function for the pin we just assume +* we got it by default and proceed. +*/ +if (gpio_range && ops->gpio_disable_free) + ops->gpio_disable_free (pctldev, gpio_range, pin); +else if (ops->free) + ops->free (pctldev, pin); +module_put (pctldev->owner);return owner;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 278/480 perf tests bp_account: Fix leaked file descriptor
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 4a6cdecaa1497f1fbbd1d5307a225b6ca5a62a90 ]
Since the commit e9846f5ead26 ("perf test: In forked mode add check that fds aren't leaked"), the test "Breakpoint accounting" reports the error:
# perf test -vvv "Breakpoint accounting" 20: Breakpoint accounting: --- start --- test child forked, pid 373 failed opening event 0 failed opening event 0 watchpoints count 4, breakpoints count 6, has_ioctl 1, share 0 wp 0 created wp 1 created wp 2 created wp 3 created wp 0 modified to bp wp max created ---- end(0) ---- Leak of file descriptor 7 that opened: 'anon_inode:[perf_event]'
A watchpoint's file descriptor was not properly released. This patch fixes the leak.
--- tools/perf/tests/bp_account.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/bp_account.c +1 -0
@@ -104,6 +104,7 @@ static int bp_accounting(int wp_cnt, int share) fd_wp =wp_event ((void *)&the_var, &attr_new);TEST_ASSERT_VAL ("failed to create max wp\n" , fd_wp !=-1 );pr_debug ("wp max created\n" ); +close (fd_wp); }for (i =0 ; i < wp_cnt; i++)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 279/480 perf hwmon_pmu: Avoid shortening hwmon PMU name
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 28f5aa8184c9c9b8eab35fa3884c416fe75e88e4 ]
Long names like ucsi_source_psy_USBC000:001 when prefixed with hwmon_ exceed the buffer size and the last digit is lost. This causes confusion with similar names like ucsi_source_psy_USBC000:002. Extend the buffer size to avoid this.
--- tools/perf/util/hwmon_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/hwmon_pmu.c +1 -1
@@ -344,7 +344,7 @@ static int hwmon_pmu__read_events(struct hwmon_pmu *pmu)struct perf_pmu *hwmon_pmu__new (struct list_head *pmus,int hwmon_dir,const char *sysfs_name,const char *name) { -char buf[32 ]; +char buf[64 ];struct hwmon_pmu *hwm; hwm =zalloc (sizeof (*hwm));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 280/480 RDMA/mana_ib: Fix DSCP value in modify QP
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiraz Saleem <[email protected]>
[ Upstream commit 62de0e67328e9503459a24b9343c3358937cdeef ]
Convert the traffic_class in GRH to a DSCP value as required by the HW.
--- drivers/infiniband/hw/mana/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mana/qp.c +1 -1
@@ -773,7 +773,7 @@ static int mana_ib_gd_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, req.ah_attr.dest_port =ROCE_V2_UDP_DPORT ; req.ah_attr.src_port =rdma_get_udp_sport (attr->ah_attr.grh.flow_label, ibqp->qp_num, attr->dest_qp_num); - req.ah_attr.traffic_class = attr->ah_attr.grh.traffic_class; + req.ah_attr.traffic_class = attr->ah_attr.grh.traffic_class >>2 ; req.ah_attr.hop_limit = attr->ah_attr.grh.hop_limit; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 281/480 clk: thead: th1520-ap: Correctly refer the parent of osc_12m
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Zi <[email protected]>
[ Upstream commit d274c77ffa202b70ad01d579f33b73b4de123375 ]
The "osc_12m" fixed factor clock refers the external oscillator by setting clk_parent_data.fw_name to osc_24m, which is obviously wrong since no clock-names property is allowed for compatible thead,th1520-clk-ap.
Refer the oscillator as parent by index instead.
--- drivers/clk/thead/clk-th1520-ap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/clk/thead/clk-th1520-ap.c +8 -1
@@ -582,7 +582,14 @@ static const struct clk_parent_data peri2sys_apb_pclk_pd[] = { { .hw = &peri2sys_apb_pclk.common.hw } }; -static CLK_FIXED_FACTOR_FW_NAME(osc12m_clk, "osc_12m", "osc_24m", 2, 1, 0); +static struct clk_fixed_factor osc12m_clk = { + .div =2 , + .mult =1 , + .hw.init =CLK_HW_INIT_PARENTS_DATA ("osc_12m" , + osc_24m_clk, + &clk_fixed_factor_ops, +0 ), +};static const char *const out_parents[] = {"osc_24m" ,"osc_12m" };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 282/480 clk: sunxi-ng: v3s: Fix de clock definition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Kocialkowski <[email protected]>
[ Upstream commit e8ab346f9907a1a3aa2f0e5decf849925c06ae2e ]
The de clock is marked with CLK_SET_RATE_PARENT, which is really not necessary (as confirmed from experimentation) and significantly restricts flexibility for other clocks using the same parent.
In addition the source selection (parent) field is marked as using 2 bits, when it the documentation reports that it uses 3.
Fix both issues in the de clock definition.
--- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +1 -2
@@ -347,8 +347,7 @@ static SUNXI_CCU_GATE(dram_ohci_clk, "dram-ohci", "dram",static const char *const de_parents[] = {"pll-video" ,"pll-periph0" }; static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, -0x104 ,0 ,4 ,24 ,2 ,BIT (31 ), - CLK_SET_RATE_PARENT); + 0x104, 0, 4, 24, 3, BIT(31), 0);static const char *const tcon_parents[] = {"pll-video" }; static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 283/480 scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 023a293b9cd0bb86a9b50cd7688a3d9d266826db ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/scsi/ibmvscsi_tgt/libsrp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/ibmvscsi_tgt/libsrp.c +4 -2
@@ -184,7 +184,8 @@ static int srp_direct_data(struct ibmvscsis_cmd *cmd, struct srp_direct_buf *md, err =rdma_io (cmd, sg, nsg, md,1 , dir, len);if (dma_map) -dma_unmap_sg (iue->target->dev, sg, nsg,DMA_BIDIRECTIONAL ); +dma_unmap_sg (iue->target->dev, sg, cmd->se_cmd.t_data_nents, +DMA_BIDIRECTIONAL );return err; }
@@ -256,7 +257,8 @@ static int srp_indirect_data(struct ibmvscsis_cmd *cmd, struct srp_cmd *srp_cmd, err =rdma_io (cmd, sg, nsg, md, nmd, dir, len);if (dma_map) -dma_unmap_sg (iue->target->dev, sg, nsg,DMA_BIDIRECTIONAL ); +dma_unmap_sg (iue->target->dev, sg, cmd->se_cmd.t_data_nents, +DMA_BIDIRECTIONAL ); free_mem:if (token && dma_map) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 284/480 scsi: elx: efct: Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 3a988d0b65d7d1713ce7596eae288a293f3b938e ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/scsi/elx/efct/efct_lio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/elx/efct/efct_lio.c +1 -1
@@ -382,7 +382,7 @@ efct_lio_sg_unmap(struct efct_io *io)return ;dma_unmap_sg (&io->efct->pci->dev, cmd->t_data_sg, - ocp->seg_map_cnt, cmd->data_direction); + cmd->t_data_nents, cmd->data_direction); ocp->seg_map_cnt =0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 285/480 scsi: mvsas: Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 0141618727bc929fe868153d21797f10ce5bef3f ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/scsi/mvsas/mv_sas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_sas.c +2 -2
@@ -818,7 +818,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmfdev_printk (KERN_ERR , mvi->dev,"mvsas prep failed[%d]!\n" , rc);if (!sas_protocol_ata (task->task_proto))if (n_elem) -dma_unmap_sg (mvi->dev, task->scatter, n_elem, +dma_unmap_sg (mvi->dev, task->scatter, task->num_scatter, task->data_dir); prep_out:return rc;
@@ -864,7 +864,7 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task,if (!sas_protocol_ata (task->task_proto))if (slot->n_elem)dma_unmap_sg (mvi->dev, task->scatter, - slot->n_elem, task->data_dir); + task->num_scatter, task->data_dir);switch (task->task_proto) {case SAS_PROTOCOL_SMP :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/480 scsi: isci: Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 063bec4444d54e5f35d11949c5c90eaa1ff84c11 ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/scsi/isci/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/isci/request.c +1 -1
@@ -2904,7 +2904,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost, task->total_xfer_len, task->data_dir); else /* unmap the sgl dma addresses */ dma_unmap_sg(&ihost->pdev->dev, task->scatter, - request->num_sg_entries, task->data_dir); + task->num_scatter, task->data_dir);break ;case SAS_PROTOCOL_SMP : {struct scatterlist *sg = &task->smp_task.smp_req;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/480 PCI: Fix driver_managed_dma check
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
[ Upstream commit 78447d4545b2ea76ee04f4e46d473639483158b2 ]
Since it's not currently safe to take device_lock() in the IOMMU probe path, that can race against really_probe() setting dev->driver before attempting to bind. The race itself isn't so bad, since we're only concerned with dereferencing dev->driver itself anyway, but sadly my attempt to implement the check with minimal churn leads to a kind of Time-of-Check to Time-of-Use (TOCTOU) issue, where dev->driver becomes valid after to_pci_driver(NULL) is already computed, and thus the check fails to work as intended.
Will and I both hit this with the platform bus, but the pattern here is the same, so fix it for correctness too.
--- drivers/pci/pci-driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/pci-driver.c +3 -3
@@ -1634,7 +1634,7 @@ static int pci_bus_num_vf(struct device *dev)*/ static int pci_dma_configure (struct device *dev) { -struct pci_driver *driver =to_pci_driver (dev->driver); +const struct device_driver *drv =READ_ONCE (dev->driver);struct device *bridge;int ret =0 ;
@@ -1651,8 +1651,8 @@ static int pci_dma_configure(struct device *dev)pci_put_host_bridge_device (bridge); -/* @driver may not be valid when we're called from the IOMMU layer */ -if (!ret && dev->driver && !driver->driver_managed_dma) { +/* @drv may not be valid when we're called from the IOMMU layer */ +if (!ret && drv && !to_pci_driver (drv)->driver_managed_dma) { ret =iommu_device_use_default_domain (dev);if (ret)arch_teardown_dma_ops (dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/480 watchdog: ziirave_wdt: check record length in ziirave_firm_verify()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 8b61d8ca751bc15875b50e0ff6ac3ba0cf95a529 ]
The "rec->len" value comes from the firmware. We generally do trust firmware, but it's always better to double check. If the length value is too large it would lead to memory corruption when we set "data[i] = ret;"
--- drivers/watchdog/ziirave_wdt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/watchdog/ziirave_wdt.c +3 -0
@@ -302,6 +302,9 @@ static int ziirave_firm_verify(struct watchdog_device *wdd,const u16 len =be16_to_cpu (rec->len);const u32 addr =be32_to_cpu (rec->addr); +if (len >sizeof (data)) +return -EINVAL ; +if (ziirave_firm_addr_readonly (addr))continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/480 ext4: fix inode use after free in ext4_end_io_rsv_work()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit c678bdc998754589cea2e6afab9401d7d8312ac4 ]
In ext4_io_end_defer_completion(), check if io_end->list_vec is empty to avoid adding an io_end that requires no conversion to the i_rsv_conversion_list, which in turn prevents starting an unnecessary worker. An ext4_emergency_state() check is also added to avoid attempting to abort the journal in an emergency state.
Additionally, ext4_put_io_end_defer() is refactored to call ext4_io_end_defer_completion() directly instead of being open-coded. This also prevents starting an unnecessary worker when EXT4_IO_END_FAILED is set but data_err=abort is not enabled.
This ensures that the check in ext4_put_io_end_defer() is consistent with the check in ext4_end_bio(). Otherwise, we might add an io_end to the i_rsv_conversion_list and then call ext4_finish_bio(), after which the inode could be freed before ext4_end_io_rsv_work() is called, triggering a use-after-free issue.
--- fs/ext4/page-io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/ext4/page-io.c +8 -8
@@ -236,10 +236,12 @@ static void dump_completed_IO(struct inode *inode, struct list_head *head)static bool ext4_io_end_defer_completion (ext4_io_end_t *io_end) { -if (io_end->flag &EXT4_IO_END_UNWRITTEN ) +if (io_end->flag &EXT4_IO_END_UNWRITTEN && + !list_empty (&io_end->list_vec))return true;if (test_opt (io_end->inode->i_sb,DATA_ERR_ABORT ) && - io_end->flag &EXT4_IO_END_FAILED ) + io_end->flag &EXT4_IO_END_FAILED && + !ext4_emergency_state (io_end->inode->i_sb))return true;return false; }
@@ -256,6 +258,7 @@ static void ext4_add_complete_io(ext4_io_end_t *io_end)WARN_ON (!(io_end->flag &EXT4_IO_END_DEFER_COMPLETION ));WARN_ON (io_end->flag &EXT4_IO_END_UNWRITTEN && !io_end->handle && sbi->s_journal); +WARN_ON (!io_end->bio);spin_lock_irqsave (&ei->i_completed_io_lock, flags); wq = sbi->rsv_conversion_wq;
@@ -318,12 +321,9 @@ ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags)void ext4_put_io_end_defer (ext4_io_end_t *io_end) {if (refcount_dec_and_test (&io_end->count)) { -if (io_end->flag &EXT4_IO_END_FAILED || - (io_end->flag &EXT4_IO_END_UNWRITTEN && - !list_empty (&io_end->list_vec))) { -ext4_add_complete_io (io_end); -return ; - } +if (ext4_io_end_defer_completion (io_end)) +return ext4_add_complete_io (io_end); +ext4_release_io_end (io_end); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/480 ext4: Make sure BH_New bit is cleared in ->write_end handler
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 91b8ca8b26729b729dda8a4eddb9aceaea706f37 ]
Currently we clear BH_New bit in case of error and also in the standard ext4_write_end() handler (in block_commit_write()). However ext4_journalled_write_end() misses this clearing and thus we are leaving stale BH_New bits behind. Generally ext4_block_write_begin() clears these bits before any harm can be done but in case blocksize < pagesize and we hit some error when processing a page with these stale bits, we'll try to zero buffers with these stale BH_New bits and jbd2 will complain (as buffers were not prepared for writing in this transaction). Fix the problem by clearing BH_New bits in ext4_journalled_write_end() and WARN if ext4_block_write_begin() sees stale BH_New bits.
--- fs/ext4/inline.c | 2 ++ fs/ext4/inode.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
fs/ext4/inline.c +2 -0
@@ -611,6 +611,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping, }else ret =ext4_block_write_begin (handle, folio, from, to, ext4_get_block); +clear_buffer_new (folio_buffers (folio));if (!ret &&ext4_should_journal_data (inode)) { ret = ext4_walk_page_buffers(handle, inode,
@@ -890,6 +891,7 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,return ret; } +clear_buffer_new (folio_buffers (folio));folio_mark_dirty (folio);folio_mark_uptodate (folio);ext4_clear_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA );
fs/ext4/inode.c +2 -1
@@ -1065,7 +1065,7 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio, }continue ; } -if (buffer_new (bh)) +if (WARN_ON_ONCE (buffer_new (bh)))clear_buffer_new (bh);if (!buffer_mapped (bh)) {WARN_ON (bh->b_size != blocksize);
@@ -1282,6 +1282,7 @@ static int write_end_fn(handle_t *handle, struct inode *inode, ret =ext4_dirty_journalled_data (handle, bh);clear_buffer_meta (bh);clear_buffer_prio (bh); +clear_buffer_new (bh);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 291/480 clk: at91: sam9x7: update pll clk ranges
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Varshini Rajendran <[email protected]>
[ Upstream commit c7f7ddbd27d55fa552a7269b7bae539adc2a3d46 ]
Update the min, max ranges of the PLL clocks according to the latest datasheet to be coherent in the driver. This patch solves the issues in configuring the clocks related to peripherals with the desired frequency within the range.
--- drivers/clk/at91/sam9x7.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/clk/at91/sam9x7.c +10 -10
@@ -61,44 +61,44 @@ static const struct clk_master_layout sam9x7_master_layout = {/* Fractional PLL core output range. */ static const struct clk_range plla_core_outputs[] = { - { .min =375000000 , .max =1600000000 }, + { .min =800000000 , .max =1600000000 }, };static const struct clk_range upll_core_outputs[] = { - { .min =600000000 , .max =1200000000 }, + { .min =600000000 , .max =960000000 }, };static const struct clk_range lvdspll_core_outputs[] = { - { .min =400000000 , .max =800000000 }, + { .min =600000000 , .max =1200000000 }, };static const struct clk_range audiopll_core_outputs[] = { - { .min =400000000 , .max =800000000 }, + { .min =600000000 , .max =1200000000 }, };static const struct clk_range plladiv2_core_outputs[] = { - { .min =375000000 , .max =1600000000 }, + { .min =800000000 , .max =1600000000 }, };/* Fractional PLL output range. */ static const struct clk_range plla_outputs[] = { - { .min =732421 , .max =800000000 }, + { .min =400000000 , .max =800000000 }, };static const struct clk_range upll_outputs[] = { - { .min =300000000 , .max =600000000 }, + { .min =300000000 , .max =480000000 }, };static const struct clk_range lvdspll_outputs[] = { - { .min =10000000 , .max =800000000 }, + { .min =175000000 , .max =550000000 }, };static const struct clk_range audiopll_outputs[] = { - { .min =10000000 , .max =800000000 }, + { .min =0 , .max =300000000 }, };static const struct clk_range plladiv2_outputs[] = { - { .min =366210 , .max =400000000 }, + { .min =200000000 , .max =400000000 }, };/* PLL characteristics. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 292/480 hwrng: mtk - handle devm_pm_runtime_enable errors
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Panait <[email protected]>
[ Upstream commit 522a242a18adc5c63a24836715dbeec4dc3faee1 ]
Although unlikely, devm_pm_runtime_enable() call might fail, so handle the return value.
--- drivers/char/hw_random/mtk-rng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/hw_random/mtk-rng.c +3 -1
@@ -142,7 +142,9 @@ static int mtk_rng_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, priv);pm_runtime_set_autosuspend_delay (&pdev->dev,RNG_AUTOSUSPEND_TIMEOUT );pm_runtime_use_autosuspend (&pdev->dev); -devm_pm_runtime_enable (&pdev->dev); + ret =devm_pm_runtime_enable (&pdev->dev); +if (ret) +return ret;dev_info (&pdev->dev,"registered RNG driver\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 293/480 crypto: keembay - Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 01951a7dc5ac1a37e5fb7d86ea7eb2dfbf96e8b6 ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c +7 -1
@@ -68,6 +68,7 @@ struct ocs_hcu_ctx {* @sg_data_total: Total data in the SG list at any time. * @sg_data_offset: Offset into the data of the current individual SG node. * @sg_dma_nents: Number of sg entries mapped in dma_list. +* @nents: Number of entries in the scatterlist. */ struct ocs_hcu_rctx {struct ocs_hcu_dev *hcu_dev;
@@ -91,6 +92,7 @@ struct ocs_hcu_rctx {unsigned int sg_data_total;unsigned int sg_data_offset;unsigned int sg_dma_nents; +unsigned int nents; };/**
@@ -199,7 +201,7 @@ static void kmb_ocs_hcu_dma_cleanup(struct ahash_request *req,/* Unmap req->src (if mapped). */ if (rctx->sg_dma_nents) { -dma_unmap_sg (dev, req->src, rctx->sg_dma_nents,DMA_TO_DEVICE ); +dma_unmap_sg (dev, req->src, rctx->nents,DMA_TO_DEVICE ); rctx->sg_dma_nents =0 ; }
@@ -260,6 +262,10 @@ static int kmb_ocs_dma_prepare(struct ahash_request *req) rc = -ENOMEM ; goto cleanup; } + +/* Save the value of nents to pass to dma_unmap_sg. */ + rctx->nents = nents; +/* * The value returned by dma_map_sg() can be < nents; so update * nents accordingly.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 294/480 crypto: img-hash - Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 34b283636181ce02c52633551f594fec9876bec7 ]
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/crypto/img-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/img-hash.c +1 -1
@@ -436,7 +436,7 @@ static int img_hash_write_via_dma_stop(struct img_hash_dev *hdev)struct img_hash_request_ctx *ctx =ahash_request_ctx (hdev->req);if (ctx->flags &DRIVER_FLAGS_SG ) -dma_unmap_sg (hdev->dev, ctx->sg, ctx->dma_ct,DMA_TO_DEVICE ); +dma_unmap_sg (hdev->dev, ctx->sg,1 ,DMA_TO_DEVICE );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 295/480 crypto: qat - disable ZUC-256 capability for QAT GEN5
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bairavi Alagappan <[email protected]>
[ Upstream commit d956692c7dd523b331d4556ee03def8dd02609dc ]
The ZUC-256 EEA (encryption) and EIA (integrity) algorithms are not supported on QAT GEN5 devices, as their current implementation does not align with the NIST specification. Earlier versions of the ZUC-256 specification used a different initialization scheme, which has since been revised to comply with the 5G specification.
Due to this misalignment with the updated specification, remove support for ZUC-256 EEA and EIA for QAT GEN5 by masking out the ZUC-256 capability.
--- drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c +1 -8
@@ -193,7 +193,6 @@ static u32 get_accel_cap(struct adf_accel_dev *accel_dev)ICP_ACCEL_CAPABILITIES_SM4 |ICP_ACCEL_CAPABILITIES_AES_V2 |ICP_ACCEL_CAPABILITIES_ZUC | -ICP_ACCEL_CAPABILITIES_ZUC_256 |ICP_ACCEL_CAPABILITIES_WIRELESS_CRYPTO_EXT |ICP_ACCEL_CAPABILITIES_EXT_ALGCHAIN ;
@@ -225,17 +224,11 @@ static u32 get_accel_cap(struct adf_accel_dev *accel_dev)if (fusectl1 &ICP_ACCEL_GEN4_MASK_WCP_WAT_SLICE ) { capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_ZUC ; - capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_ZUC_256 ; capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_WIRELESS_CRYPTO_EXT ; } -if (fusectl1 &ICP_ACCEL_GEN4_MASK_EIA3_SLICE ) { +if (fusectl1 &ICP_ACCEL_GEN4_MASK_EIA3_SLICE ) capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_ZUC ; - capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_ZUC_256 ; - } - -if (fusectl1 &ICP_ACCEL_GEN4_MASK_ZUC_256_SLICE ) - capabilities_sym &= ~ICP_ACCEL_CAPABILITIES_ZUC_256 ; capabilities_asym =ICP_ACCEL_CAPABILITIES_CRYPTO_ASYMMETRIC | ICP_ACCEL_CAPABILITIES_SM2 |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 296/480 crypto: krb5 - Fix memory leak in krb5_test_one_prf()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit b19f1ab8d5bf417e00d5855c62e061fb449b13c5 ]
Fix a leak reported by kmemleak:
unreferenced object 0xffff8880093bf7a0 (size 32):
comm "swapper/0", pid 1, jiffies 4294877529
hex dump (first 32 bytes):
9d 18 86 16 f6 38 52 fe 86 91 5b b8 40 b4 a8 86 .....8R...[.@...
ff 3e 6b b0 f8 19 b4 9b 89 33 93 d3 93 85 42 95 .>k......3....B.
backtrace (crc 8ba12f3b):
kmemleak_alloc+0x8d/0xa0
__kmalloc_noprof+0x3cd/0x4d0
prep_buf+0x36/0x70
load_buf+0x10d/0x1c0
krb5_test_one_prf+0x1e1/0x3c0
krb5_selftest.cold+0x7c/0x54c
crypto_krb5_init+0xd/0x20
do_one_initcall+0xa5/0x230
do_initcalls+0x213/0x250
kernel_init_freeable+0x220/0x260
kernel_init+0x1d/0x170
ret_from_fork+0x301/0x410
ret_from_fork_asm+0x1a/0x30--- crypto/krb5/selftest.c | 1 + 1 file changed, 1 insertion(+)
crypto/krb5/selftest.c +1 -0
@@ -152,6 +152,7 @@ static int krb5_test_one_prf(const struct krb5_prf_test *test) out:clear_buf (&result); +clear_buf (&prf);clear_buf (&octet);clear_buf (&key);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 297/480 soundwire: stream: restore params when prepare ports fail
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit dba7d9dbfdc4389361ff3a910e767d3cfca22587 ]
The bus->params should be restored if the stream is failed to prepare. The issue exists since beginning. The Fixes tag just indicates the first commit that the commit can be applied to.
--- drivers/soundwire/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/stream.c +1 -1
@@ -1510,7 +1510,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,if (ret <0 ) {dev_err (bus->dev,"Prepare port(s) failed ret = %d\n" , ret); -return ret; + goto restore_params; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 298/480 PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 61ae7f8694fb4b57a8c02a1a8d2b601806afc999 ]
__iomem attribute is supposed to be used only with variables holding the MMIO pointer. But here, 'mw_addr' variable is just holding a 'void *' returned by pci_epf_alloc_space(). So annotating it with __iomem is clearly wrong. Hence, drop the attribute.
This also fixes the below sparse warning:
drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17: warning: incorrect type in assignment (different address spaces)
drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17: expected void [noderef] __iomem *mw_addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:524:17: got void *
drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21: warning: incorrect type in assignment (different address spaces)
drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21: expected unsigned int [usertype] *epf_db
drivers/pci/endpoint/functions/pci-epf-vntb.c:530:21: got void [noderef] __iomem *mw_addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38: warning: incorrect type in argument 2 (different address spaces)
drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38: expected void *addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:542:38: got void [noderef] __iomem *mw_addr
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
@@ -530,7 +530,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)struct device *dev = &ntb->epf->dev;int ret;struct pci_epf_bar *epf_bar; -void __iomem *mw_addr; +void *mw_addr;enum pci_barno barno;size_t size =sizeof (u32) * ntb->db_count;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 299/480 clk: imx95-blk-ctl: Fix synchronous abort
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Palcu <[email protected]>
[ Upstream commit b08217a257215ed9130fce93d35feba66b49bf0a ]
When enabling runtime PM for clock suppliers that also belong to a power domain, the following crash is thrown:
error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP
Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : clk_mux_get_parent+0x60/0x90 lr : clk_core_reparent_orphans_nolock+0x58/0xd8 Call trace: clk_mux_get_parent+0x60/0x90 clk_core_reparent_orphans_nolock+0x58/0xd8 of_clk_add_hw_provider.part.0+0x90/0x100 of_clk_add_hw_provider+0x1c/0x38 imx95_bc_probe+0x2e0/0x3f0 platform_probe+0x70/0xd8
Enabling runtime PM without explicitly resuming the device caused the power domain cut off after clk_register() is called. As a result, a crash happens when the clock hardware provider is added and attempts to access the BLK_CTL register.
Fix this by using devm_pm_runtime_enable() instead of pm_runtime_enable() and getting rid of the pm_runtime_disable() in the cleanup path.
--- drivers/clk/imx/clk-imx95-blk-ctl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/clk/imx/clk-imx95-blk-ctl.c +7 -6
@@ -342,8 +342,10 @@ static int imx95_bc_probe(struct platform_device *pdev)if (!clk_hw_data)return -ENOMEM ; -if (bc_data->rpm_enabled) -pm_runtime_enable (&pdev->dev); +if (bc_data->rpm_enabled) { +devm_pm_runtime_enable (&pdev->dev); +pm_runtime_resume_and_get (&pdev->dev); + } clk_hw_data->num = bc_data->num_clks; hws = clk_hw_data->hws;
@@ -383,8 +385,10 @@ static int imx95_bc_probe(struct platform_device *pdev) goto cleanup; } -if (pm_runtime_enabled (bc->dev)) +if (pm_runtime_enabled (bc->dev)) { +pm_runtime_put_sync (&pdev->dev);clk_disable_unprepare (bc->clk_apb); + }return 0 ;
@@ -395,9 +399,6 @@ static int imx95_bc_probe(struct platform_device *pdev)clk_hw_unregister (hws[i]); } -if (bc_data->rpm_enabled) -pm_runtime_disable (&pdev->dev); -return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 300/480 remoteproc: xlnx: Disable unsupported features
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tanmay Shah <[email protected]>
[ Upstream commit 699cdd706290208d47bd858a188b030df2e90357 ]
AMD-Xilinx platform driver does not support iommu or recovery mechanism yet. Disable both features in platform driver.
--- drivers/remoteproc/xlnx_r5_remoteproc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/remoteproc/xlnx_r5_remoteproc.c +2 -0
@@ -906,6 +906,8 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)rproc_coredump_set_elf_info (r5_rproc,ELFCLASS32 ,EM_ARM ); + r5_rproc->recovery_disabled = true; + r5_rproc->has_iommu = false; r5_rproc->auto_boot = false; r5_core = r5_rproc->priv; r5_core->dev = cdev;
Signature · 1 line
2.39.5