7.2.6-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 1696/1815 ptp: netc: fix period truncation and potential divide-by-zero in PEROUT
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 777dbc9914b2f003f1d44af80c7a4a395c5961b2 ]
The max_period bound in net_timer_enable_perout() was computed as:
max_period = (u64)NETC_TMR_DEFAULT_FIPER + integral_period;
which exceeds U32_MAX when integral_period > 0 (e.g. 0x100000002 for the default 333333333 Hz clock). A period_ns that passes this check but exceeds U32_MAX is then silently truncated when stored into the u32 struct netc_pp::period field.
A truncated value of zero can reach netc_timer_set_perout_alarm(), where the local u32 period variable would also be 0, causing a divide-by-zero in roundup_u64(delta, period) whenever the stime < min_time branch is taken (which always happens for a start time of {0, 0}).
Additionally, netc_timer_enable_periodic_pulse() and netc_timer_enable_fiper() both compute:
fiper = pp->period - integral_period;
A zero pp->period results in an unsigned wraparound to 0xFFFFFFFD, mis-programming the FIPER hardware register.
Fix all three issues by capping max_period at NETC_TMR_DEFAULT_FIPER (0xFFFFFFFF). This ensures that any period_ns passing the range check fits in a u32 without truncation, so the stored value is always valid and non-zero. The accepted range is reduced by integral_period ns (typically only a few nanoseconds), which is negligible in practice.
--- drivers/ptp/ptp_netc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/ptp/ptp_netc.c +5 -5
@@ -440,7 +440,7 @@ static int net_timer_enable_perout(struct netc_timer *priv, }if (on) { -u64 period_ns, gclk_period, max_period, min_period; +u64 period_ns, gclk_period, min_period;struct timespec64 period, stime;u32 integral_period;int alarm_id;
@@ -450,12 +450,12 @@ static int net_timer_enable_perout(struct netc_timer *priv, period_ns =timespec64_to_ns (&period); integral_period =netc_timer_get_integral_period (priv); - max_period = (u64 )NETC_TMR_DEFAULT_FIPER + integral_period; gclk_period =netc_timer_get_gclk_period (priv); min_period = gclk_period *4 + integral_period; -if (period_ns > max_period || period_ns < min_period) { -dev_err (dev,"The period range is %llu ~ %llu\n" , - min_period, max_period); +if (period_ns >NETC_TMR_DEFAULT_FIPER || + period_ns < min_period) { +dev_err (dev,"The period range is %llu ~ %lu\n" , + min_period,NETC_TMR_DEFAULT_FIPER ); err = -EINVAL ; goto unlock_spinlock; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1697/1815 net/sched: account classifier filter allocations to memcg
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 1beb81947eb486716af80db7a584f9e9fef7e003 ]
Allocations in the tc classifier *_change() paths (filter objects, per-CPU counters, and per-filter aux data) use plain GFP_KERNEL without __GFP_ACCOUNT, allowing unprivileged users to pin kernel memory outside memcg charging. The shared tcf_exts_init_ex() action array allocation in cls_api.c was also uncharged; this patch closes it along with the per-classifier filter-object/percpu/aux allocations that remain unaccounted.
Add GFP_KERNEL_ACCOUNT to:
- the shared tcf_exts_init_ex() action array (cls_api.c), common to every filter of every classifier (32 pointers, 256 bytes);
- the filter-object, per-CPU-counter, and per-filter aux allocations in cls_basic, cls_bpf, cls_cgroup, cls_flow, cls_flower, cls_fw, cls_matchall, cls_route and cls_u32;
- the u32_init_knode() replace-path knode allocation (cls_u32.c), which allocates the same struct tc_u_knode + sel.keys on every replace of an existing knode and was missed by the create-path-only conversion.
Also fix the cls_basic error path: basic_change() inserts fnew into the IDR before allocating the per-CPU counter. If alloc_percpu() fails the errout path kfree'd fnew without idr_remove, leaving a dangling pointer in the IDR. With GFP_KERNEL_ACCOUNT the percpu alloc becomes failable on demand (memcg at memory.max), making the dead path attacker-reachable and burning the handle permanently. Add the idr_remove on the percpu failure path, matching the basic_set_parms failure-path pattern.
Note: [email protected] provided a poc for basic_cls, but it was easy to extend to the other classifiers.
Conditions to recreate the bug:
- CONFIG_NET_SCHED, CONFIG_NET_CLS_* (the classifier being used), CONFIG_NET_CLS_ACT, CONFIG_MEMCG, CONFIG_USER_NS, CONFIG_NET_NS.
- Unprivileged user in a fresh user+network namespace (unshare -Urn), or root with CAP_NET_ADMIN.
- Create a large number of tc filters (e.g. tc filter add dev lo ingress ... <classifier> ...) while watching a memcg-limited cgroup:
system slab grows far faster than memory.current, pinning kernel memory outside memcg charging.
--- net/sched/cls_api.c | 3 ++- net/sched/cls_basic.c | 6 ++++-- net/sched/cls_bpf.c | 6 +++--- net/sched/cls_cgroup.c | 2 +- net/sched/cls_flow.c | 2 +- net/sched/cls_flower.c | 4 ++-- net/sched/cls_fw.c | 4 ++-- net/sched/cls_matchall.c | 4 ++-- net/sched/cls_route.c | 4 ++-- net/sched/cls_u32.c | 11 ++++++----- 10 files changed, 25 insertions(+), 21 deletions(-)
net/sched/cls_api.c +2 -1
@@ -3372,7 +3372,8 @@ int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,* This reference might be taken later from tcf_exts_get_net(). */ exts->net = net; - exts->actions = kzalloc_objs(struct tc_action *, TCA_ACT_MAX_PRIO); + exts->actions = kzalloc_objs(struct tc_action *, TCA_ACT_MAX_PRIO, +GFP_KERNEL_ACCOUNT );if (!exts->actions)return -ENOMEM ;#endif
net/sched/cls_basic.c +4 -2
@@ -193,7 +193,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,return -EINVAL ; } - fnew =kzalloc_obj (*fnew); + fnew =kzalloc_obj (*fnew,GFP_KERNEL_ACCOUNT );if (!fnew)return -ENOBUFS ;
@@ -212,9 +212,11 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,if (err) goto errout; fnew->handle = handle; - fnew->pf = alloc_percpu(struct tc_basic_pcnt); + fnew->pf = alloc_percpu_gfp(struct tc_basic_pcnt, GFP_KERNEL_ACCOUNT);if (!fnew->pf) { err = -ENOMEM ; +if (!fold) +idr_remove (&head->handle_idr, fnew->handle); goto errout; }
net/sched/cls_bpf.c +3 -3
@@ -352,7 +352,7 @@ static int cls_bpf_prog_from_ops(struct nlattr **tb, struct cls_bpf_prog *prog)if (bpf_size !=nla_len (tb[TCA_BPF_OPS ]))return -EINVAL ; - bpf_ops =kmemdup (nla_data (tb[TCA_BPF_OPS ]), bpf_size,GFP_KERNEL ); + bpf_ops =kmemdup (nla_data (tb[TCA_BPF_OPS ]), bpf_size,GFP_KERNEL_ACCOUNT );if (bpf_ops ==NULL )return -ENOMEM ;
@@ -403,7 +403,7 @@ static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog, }if (tb[TCA_BPF_NAME ]) { - name =nla_memdup (tb[TCA_BPF_NAME ],GFP_KERNEL ); + name =nla_memdup (tb[TCA_BPF_NAME ],GFP_KERNEL_ACCOUNT );if (!name) {bpf_prog_put (fp);return -ENOMEM ;
@@ -443,7 +443,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,if (ret <0 )return ret; - prog =kzalloc_obj (*prog); + prog =kzalloc_obj (*prog,GFP_KERNEL_ACCOUNT );if (!prog)return -ENOBUFS ;
net/sched/cls_cgroup.c +1 -1
@@ -95,7 +95,7 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,if (head && handle != head->handle)return -ENOENT ; - new =kzalloc_obj (*head); + new =kzalloc_obj (*head,GFP_KERNEL_ACCOUNT );if (!new)return -ENOBUFS ;
net/sched/cls_flow.c +1 -1
@@ -438,7 +438,7 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,return -EOPNOTSUPP ; } - fnew =kzalloc_obj (*fnew); + fnew =kzalloc_obj (*fnew,GFP_KERNEL_ACCOUNT );if (!fnew)return -ENOBUFS ;
net/sched/cls_flower.c +2 -2
@@ -2233,7 +2233,7 @@ static struct fl_flow_mask *fl_create_new_mask(struct cls_fl_head *head,struct fl_flow_mask *newmask;int err; - newmask =kzalloc_obj (*newmask); + newmask =kzalloc_obj (*newmask,GFP_KERNEL_ACCOUNT );if (!newmask)return ERR_PTR (-ENOMEM );
@@ -2394,7 +2394,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, goto errout_tb; } - fnew =kzalloc_obj (*fnew); + fnew =kzalloc_obj (*fnew,GFP_KERNEL_ACCOUNT );if (!fnew) { err = -ENOBUFS ; goto errout_tb;
net/sched/cls_fw.c +2 -2
@@ -276,7 +276,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,if (f->id != handle && handle)return -EINVAL ; - fnew = kzalloc_obj(struct fw_filter); + fnew = kzalloc_obj(struct fw_filter, GFP_KERNEL_ACCOUNT);if (!fnew)return -ENOBUFS ;
@@ -330,7 +330,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,rcu_assign_pointer (tp->root, head); } - f = kzalloc_obj(struct fw_filter); + f = kzalloc_obj(struct fw_filter, GFP_KERNEL_ACCOUNT);if (f ==NULL )return -ENOBUFS ;
net/sched/cls_matchall.c +2 -2
@@ -189,7 +189,7 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,return -EINVAL ; } - new =kzalloc_obj (*new); + new =kzalloc_obj (*new,GFP_KERNEL_ACCOUNT );if (!new)return -ENOBUFS ;
@@ -201,7 +201,7 @@ static int mall_change(struct net *net, struct sk_buff *in_skb, handle =1 ; new->handle = handle; new->flags = userflags; - new->pf = alloc_percpu(struct tc_matchall_pcnt); + new->pf = alloc_percpu_gfp(struct tc_matchall_pcnt, GFP_KERNEL_ACCOUNT);if (!new->pf) { err = -ENOMEM ; goto err_alloc_percpu;
net/sched/cls_route.c +2 -2
@@ -455,7 +455,7 @@ static int route4_set_parms(struct net *net, struct tcf_proto *tp, h1 =to_hash (nhandle); b =rtnl_dereference (head->table[h1]);if (!b) { - b = kzalloc_obj(struct route4_bucket); + b = kzalloc_obj(struct route4_bucket, GFP_KERNEL_ACCOUNT);if (b ==NULL )return -ENOBUFS ;
@@ -524,7 +524,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,return -EINVAL ; err = -ENOBUFS ; - f = kzalloc_obj(struct route4_filter); + f = kzalloc_obj(struct route4_filter, GFP_KERNEL_ACCOUNT);if (!f) goto errout;
net/sched/cls_u32.c +6 -5
@@ -825,7 +825,7 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp,struct tc_u32_sel *s = &n->sel;struct tc_u_knode *new; - new =kzalloc_flex (*new, sel.keys, s->nkeys); + new =kzalloc_flex (*new, sel.keys, s->nkeys,GFP_KERNEL_ACCOUNT );if (!new)return NULL ;
@@ -1114,15 +1114,16 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, goto erridr; } - n =kzalloc_flex (*n, sel.keys, s->nkeys); + n =kzalloc_flex (*n, sel.keys, s->nkeys,GFP_KERNEL_ACCOUNT );if (n ==NULL ) { err = -ENOBUFS ; goto erridr; }#ifdef CONFIG_CLS_U32_PERF - n->pf =__alloc_percpu (struct_size (n->pf, kcnts, s->nkeys), - __alignof__(struct tc_u32_pcnt )); + n->pf =__alloc_percpu_gfp (struct_size (n->pf, kcnts, s->nkeys), + __alignof__(struct tc_u32_pcnt ), +GFP_KERNEL_ACCOUNT );if (!n->pf) { err = -ENOBUFS ; goto errfree;
@@ -1144,7 +1145,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, goto errout;#ifdef CONFIG_CLS_U32_MARK - n->pcpu_success =alloc_percpu (u32); + n->pcpu_success =alloc_percpu_gfp (u32,GFP_KERNEL_ACCOUNT );if (!n->pcpu_success) { err = -ENOMEM ; goto errout;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1698/1815 net: microchip: vcap: use port number instead of netdev name for debugfs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Machon <[email protected]>
[ Upstream commit b7adcc56fd3db4f5ddaf8c01069d26136d61e5c8 ]
sparx5_vcap_init() runs before sparx5_register_netdevs() in probe, and its debugfs setup calls vcap_port_debugfs() for every port using netdev_name(ndev) as the debugfs file name. At that point the netdevs have only been allocated, not registered, so dev->name still holds the "eth%d" template and netdev_name() returns "(unnamed net_device)". Every port tries to create the same file under vcaps/, producing a flood of warnings at boot:
debugfs: '(unnamed net_device)' already exists in 'vcaps'
debugfs: '(unnamed net_device)' already exists in 'vcaps'
...
Add vcap_port_debugfs_portno(), a variant of vcap_port_debugfs() that takes the port's stable hardware port number and uses "p%u" as the debugfs file name instead of netdev_name(ndev). This makes the file name independent of registration order; the file still stores and later dereferences the netdev itself, same as before. sparx5 already reports the same "p%d" string via ndo_get_phys_port_name(), so the debugfs name now matches that.
Only sparx5 (and lan969x, which shares this code) is switched to the new function. lan966x keeps calling vcap_port_debugfs() unchanged, so this fix does not rename any of its existing debugfs files.
--- .../microchip/sparx5/sparx5_vcap_impl.c | 5 +++-- .../microchip/vcap/vcap_api_debugfs.c | 21 +++++++++++++++++++ .../microchip/vcap/vcap_api_debugfs.h | 14 +++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +3 -2
@@ -2077,8 +2077,9 @@ int sparx5_vcap_init(struct sparx5 *sparx5) dir =vcap_debugfs (sparx5->dev, sparx5->debugfs_root, ctrl);for (idx =0 ; idx < consts->n_ports; ++idx)if (sparx5->ports[idx]) -vcap_port_debugfs (sparx5->dev, dir, ctrl, - sparx5->ports[idx]->ndev); +vcap_port_debugfs_portno (sparx5->dev, dir, ctrl, + sparx5->ports[idx]->ndev, + sparx5->ports[idx]->portno);return err; }
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c +21 -0
@@ -400,6 +400,27 @@ void vcap_port_debugfs(struct device *dev, struct dentry *parent, }EXPORT_SYMBOL_GPL (vcap_port_debugfs); +void vcap_port_debugfs_portno (struct device *dev, +struct dentry *parent, +struct vcap_control *vctrl, +struct net_device *ndev, +unsigned int portno) +{ +struct vcap_port_debugfs_info *info; +char name[16 ]; + + info =devm_kzalloc (dev,sizeof (*info),GFP_KERNEL ); +if (!info) +return ; + + info->vctrl = vctrl; + info->ndev = ndev; + +snprintf (name,sizeof (name),"p%u" , portno); +debugfs_create_file (name,0444 , parent, info, &vcap_port_debugfs_fops); +} +EXPORT_SYMBOL_GPL (vcap_port_debugfs_portno); +/* Show the full VCAP instance data (rules with all fields) */ static int vcap_debugfs_show (struct seq_file *m,void *unused) {
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.h +14 -0
@@ -18,6 +18,12 @@ void vcap_port_debugfs(struct device *dev, struct dentry *parent,struct vcap_control *vctrl, struct net_device *ndev); +void vcap_port_debugfs_portno (struct device *dev, +struct dentry *parent, +struct vcap_control *vctrl, +struct net_device *ndev, +unsigned int portno); +/* Create a debugFS entry for a vcap instance */ struct dentry *vcap_debugfs (struct device *dev,struct dentry *parent,struct vcap_control *vctrl);
@@ -30,6 +36,14 @@ static inline void vcap_port_debugfs(struct device *dev, struct dentry *parent, { } +static inline void vcap_port_debugfs_portno (struct device *dev, +struct dentry *parent, +struct vcap_control *vctrl, +struct net_device *ndev, +unsigned int portno) +{ +} +static inline struct dentry *vcap_debugfs (struct device *dev,struct dentry *parent,struct vcap_control *vctrl)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1699/1815 net: sparx5: fix sleep in atomic context in MAC table access
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Machon <[email protected]>
[ Upstream commit b62793a7baeea9cf20209c9fd2e333311aaf3b8d ]
sparx5_set_rx_mode() runs with netif_addr_lock_bh held and iterates dev->mc via __dev_mc_sync(), which per address calls sparx5_mc_sync() / sparx5_mc_unsync() -> sparx5_mact_learn() / sparx5_mact_forget(). These take sparx5->lock, a mutex, and then poll the MAC access command register with readx_poll_timeout(). A mutex may block, which is not allowed from atomic context.
Convert the driver to the new .ndo_set_rx_mode_async callback introduced in commit 3554b4345d85 ("net: introduce ndo_set_rx_mode_async and netdev_rx_mode_work"). The async callback is invoked from process context, so the mutex and sleeping completion poll can remain.
Observed with CONFIG_PROVE_LOCKING, CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_MUTEXES and CONFIG_DEBUG_ATOMIC_SLEEP enabled:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:591 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 217, name: ip preempt_count: 201, expected: 0 Call trace: __might_resched+0x144/0x248 __might_sleep+0x48/0x7c __mutex_lock+0x74/0x850 mutex_lock_nested+0x24/0x30 sparx5_mact_learn+0x78/0x100 sparx5_mc_sync+0x40/0x54 __hw_addr_sync_dev+0xc4/0x170 sparx5_set_rx_mode+0x4c/0x58 __dev_set_rx_mode+0x64/0xa4 __dev_open+0x1ec/0x26c
--- drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c +8 -3
@@ -162,13 +162,18 @@ static int sparx5_port_stop(struct net_device *ndev)return 0 ; } -static void sparx5_set_rx_mode (struct net_device *dev) +static int sparx5_set_rx_mode (struct net_device *dev, +struct netdev_hw_addr_list *uc, +struct netdev_hw_addr_list *mc) {struct sparx5_port *port =netdev_priv (dev);struct sparx5 *sparx5 = port->sparx5;if (!test_bit (port->portno, sparx5->bridge_mask)) -__dev_mc_sync (dev, sparx5_mc_sync, sparx5_mc_unsync); +return __hw_addr_sync_dev (mc, dev, sparx5_mc_sync, + sparx5_mc_unsync); + +return 0 ; } static int sparx5_port_get_phys_port_name(struct net_device *dev,
@@ -249,7 +254,7 @@ static const struct net_device_ops sparx5_port_netdev_ops = { .ndo_open = sparx5_port_open, .ndo_stop = sparx5_port_stop, .ndo_start_xmit = sparx5_port_xmit_impl, - .ndo_set_rx_mode = sparx5_set_rx_mode, + .ndo_set_rx_mode_async = sparx5_set_rx_mode, .ndo_get_phys_port_name = sparx5_port_get_phys_port_name, .ndo_set_mac_address = sparx5_set_mac_address, .ndo_validate_addr = eth_validate_addr,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1700/1815 net: txgbe: fix MISC interrupt unmasking in non-MSI-X mode and device shutdown
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 7bf29145d7a9564162c6b18f8d23760e141e2d15 ]
In txgbe_misc_irq_thread_fn(), the driver unmasks the miscellaneous interrupt at the end of the handler using TXGBE_INTR_MISC(wx) (which resolves to BIT(wx->num_q_vectors)). While this is correct for MSI-X mode, it is incorrect for legacy INTx or single MSI modes.
Due to hardware behavior, the WX_PX_MISC_IVAR register is completely ignored by the hardware when MSI-X is disabled. In non-MSI-X mode, the hardware forcibly merges all interrupt causes (both Queue and MISC) into a single bit: BIT(0) of the interrupt register.
Unconditionally unmasking TXGBE_INTR_MISC(wx) (e.g., BIT(1)) in non-MSI-X mode means the actual MISC interrupt bit (BIT(0)) is not unmasked promptly at the end of the MISC thread. Instead, it remains masked until NAPI completes its polling and unmasks the shared BIT(0). This delays the assertion of subsequent MISC interrupts, preventing timely handling of events like link state changes.
Fix this by explicitly checking pdev->msix_enabled and falling back to BIT(0) as the interrupt mask for the MISC cause when MSI-X is disabled.
Additionally, unconditionally unmasking the interrupt at the end of the thread introduces a race condition during device teardown. Guarding the wx_intr_enable() call with a check for the WX_STATE_DOWN bit, to prevent re-arming the interrupt during device shutdown.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c +4 -1
@@ -164,6 +164,7 @@ static irqreturn_t txgbe_misc_irq_thread_fn(int irq, void *data)struct wx *wx = txgbe->wx;unsigned int nhandled =0 ;unsigned int sub_irq; +u64 misc_mask;u32 eicr; eicr = txgbe->eicr;
@@ -183,7 +184,9 @@ static irqreturn_t txgbe_misc_irq_thread_fn(int irq, void *data) nhandled++; } -wx_intr_enable (wx,TXGBE_INTR_MISC (wx)); + misc_mask = wx->pdev->msix_enabled ?TXGBE_INTR_MISC (wx) :BIT (0 ); +if (!test_bit (WX_STATE_DOWN , wx->state)) +wx_intr_enable (wx, misc_mask);return (nhandled >0 ?IRQ_HANDLED :IRQ_NONE ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1691/1815 NFSv4/pnfs: key the data server cache on the NFS version
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
[ Upstream commit 13c23c5cb977f66390795437fd3837887ce1fd75 ]
nfs4_pnfs_ds_add() keys the per-net data server cache on the multipath address set alone, and struct nfs4_pnfs_ds records no version. That suffices for the files layout driver, which always connects with version 4, but flexfiles takes its version tuple from GETDEVICEINFO per device, and one address can legitimately serve both NFSv3 and NFSv4.
Two deviceids on one address with different ds_versions[0].version therefore share a single nfs4_pnfs_ds, and whichever mirror connects first pins ds_clp to its own version. The other one is handed that client anyway, so it selects rpc_call_ops for a version the connection does not speak, and the mismatched sequence-slot handling dereferences NULL.
Add the version to the cache key so the two cannot alias, giving each version its own nfs4_pnfs_ds and connection while both mirrors stay usable. Only the major version is compared, since that is what selects rpc_call_ops and rpc_ops; v4.0 and v4.1 keep sharing a client. The files layout driver passes the 4 it already hardcodes at connect time.
--- fs/nfs/filelayout/filelayoutdev.c | 3 ++- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 3 ++- fs/nfs/pnfs.h | 3 ++- fs/nfs/pnfs_nfs.c | 14 +++++++++----- 4 files changed, 15 insertions(+), 8 deletions(-)
fs/nfs/filelayout/filelayoutdev.c +2 -1
@@ -170,7 +170,8 @@ nfs4_fl_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, goto out_err_free_deviceid; } - dsaddr->ds_list[i] =nfs4_pnfs_ds_add (net, &dsaddrs, gfp_flags); + dsaddr->ds_list[i] =nfs4_pnfs_ds_add (net, &dsaddrs,4 , + gfp_flags);if (!dsaddr->ds_list[i]) goto out_err_drain_dsaddrs;trace_fl_getdevinfo (server, &pdev->dev_id, dsaddr->ds_list[i]->ds_remotestr);
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -1
@@ -153,7 +153,8 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, new_ds->ds_versions = ds_versions; new_ds->ds_versions_cnt = version_count; - new_ds->ds =nfs4_pnfs_ds_add (net, &dsaddrs, gfp_flags); + new_ds->ds =nfs4_pnfs_ds_add (net, &dsaddrs, ds_versions[0 ].version, + gfp_flags);if (!new_ds->ds) goto out_err_drain_dsaddrs;
fs/nfs/pnfs.h +2 -1
@@ -63,6 +63,7 @@ struct nfs4_pnfs_ds {const struct net *ds_net;struct nfs_client *ds_clp;refcount_t ds_count; +u32 ds_version;/* cache key, with ds_addrs */ unsigned long ds_state;#define NFS4DS_CONNECTING 0/* ds is establishing connection */ };
@@ -417,7 +418,7 @@ void pnfs_generic_write_commit_done(struct rpc_task *task, void *data);void nfs4_pnfs_ds_put (struct nfs4_pnfs_ds *ds);struct nfs4_pnfs_ds *nfs4_pnfs_ds_add (const struct net *net,struct list_head *dsaddrs, -gfp_t gfp_flags); +u32 version,gfp_t gfp_flags);void nfs4_pnfs_v3_ds_connect_unload (void ); int nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds, struct nfs4_deviceid_node *devid, unsigned int timeo,
fs/nfs/pnfs_nfs.c +9 -5
@@ -603,15 +603,17 @@ _same_data_server_addrs_locked(const struct list_head *dsaddrs1, }/* -* Lookup DS by addresses. nfs4_ds_cache_lock is held +* Lookup DS by addresses and NFS version. nfs4_ds_cache_lock is held */ static struct nfs4_pnfs_ds * -_data_server_lookup_locked (const struct nfs_net *nn,const struct list_head *dsaddrs) +_data_server_lookup_locked (const struct nfs_net *nn, +const struct list_head *dsaddrs,u32 version) {struct nfs4_pnfs_ds *ds;list_for_each_entry (ds, &nn->nfs4_data_server_cache, ds_node) -if (_same_data_server_addrs_locked (&ds->ds_addrs, dsaddrs)) +if (ds->ds_version == version && +_same_data_server_addrs_locked (&ds->ds_addrs, dsaddrs))return ds;return NULL ; }
@@ -719,7 +721,8 @@ nfs4_pnfs_remotestr(struct list_head *dsaddrs, gfp_t gfp_flags)* uncached and return cached struct nfs4_pnfs_ds. */ struct nfs4_pnfs_ds * -nfs4_pnfs_ds_add (const struct net *net,struct list_head *dsaddrs,gfp_t gfp_flags) +nfs4_pnfs_ds_add (const struct net *net,struct list_head *dsaddrs,u32 version, +gfp_t gfp_flags) {struct nfs_net *nn =net_generic (net, nfs_net_id);struct nfs4_pnfs_ds *tmp_ds, *ds =NULL ;
@@ -738,7 +741,7 @@ nfs4_pnfs_ds_add(const struct net *net, struct list_head *dsaddrs, gfp_t gfp_fla remotestr =nfs4_pnfs_remotestr (dsaddrs, gfp_flags);spin_lock (&nn->nfs4_data_server_lock); - tmp_ds =_data_server_lookup_locked (nn, dsaddrs); + tmp_ds =_data_server_lookup_locked (nn, dsaddrs, version);if (tmp_ds ==NULL ) {INIT_LIST_HEAD (&ds->ds_addrs);list_splice_init (dsaddrs, &ds->ds_addrs);
@@ -747,6 +750,7 @@ nfs4_pnfs_ds_add(const struct net *net, struct list_head *dsaddrs, gfp_t gfp_flaINIT_LIST_HEAD (&ds->ds_node); ds->ds_net = net; ds->ds_clp =NULL ; + ds->ds_version = version;list_add (&ds->ds_node, &nn->nfs4_data_server_cache);dprintk ("%s add new data server %s\n" , __func__, ds->ds_remotestr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1738/1815 net: enetc: convert ndo_set_rx_mode() to ndo_set_rx_mode_async()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit debf0c7a34fab2c4c47fc257a97a145543b6d3aa ]
The current ndo_set_rx_mode() is called under netif_addr_lock spinlock with BHs disabled, which prevents drivers from sleeping. To work around this limitation, the enetc driver uses a dedicated workqueue to defer MAC address list updates to a sleepable context.
Since commit 3554b4345d85 ("net: introduce ndo_set_rx_mode_async and netdev_rx_mode_work") introduced the ndo_set_rx_mode_async() callback, drivers can now handle address list updates directly in a sleepable context.
Therefore, convert the enetc driver to use ndo_set_rx_mode_async() and remove the dedicated workqueue and the deferred work item accordingly.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- drivers/net/ethernet/freescale/enetc/enetc.h | 2 - .../net/ethernet/freescale/enetc/enetc4_pf.c | 178 ++++++------------ 2 files changed, 58 insertions(+), 122 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.h +0 -2
@@ -331,8 +331,6 @@ struct enetc_si {const struct enetc_drvdata *drvdata;const struct enetc_si_ops *ops; -struct workqueue_struct *workqueue; -struct work_struct rx_mode_task;struct dentry *debugfs_root;struct enetc_msg_swbd msg;/* Only valid for VSI */ };
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +58 -120
287 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1747/1815 cifs: fix clearing stats for fastest execution of each smb2 command
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 48cab1fd5720508148673f59d8ed52c7c7fffca2 ]
The code to clear the 'fastest_cmd' statistics has a typo that repeatedly clears the stat for cmd 0, rather than iterating through each cmd. Fix the typo (0->i).
--- fs/smb/client/cifs_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifs_debug.c +1 -1
@@ -754,7 +754,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,atomic_set (&server->smb2slowcmd[i],0 ); server->time_per_cmd[i] =0 ; server->slowest_cmd[i] =0 ; - server->fastest_cmd[0] = 0; + server->fastest_cmd[i] = 0; }#endif /* CONFIG_CIFS_STATS2 */ list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1748/1815 smb/client: preserve open info type across compound queries
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ze Tan <[email protected]>
[ Upstream commit 9437f2113b60a5a8593aa4b41b6f6632f5cabcfd ]
contains_posix_file_info describes the metadata stored in the fi/posix_fi union. GET_REPARSE and QUERY_WSL_EA do not update that union, so clearing the flag while processing those responses can make POSIX metadata look like FILE_ALL_INFORMATION.
Set the flag when CREATE or a validated query response actually populates the union, and leave it unchanged for auxiliary compound operations. This also avoids changing the type when a query fails before copying any metadata.
The issue can be reproduced against a Samba server with SMB3 UNIX extensions enabled:
mount -t cifs //<server>/<share> /mnt/cifs \
-o vers=3.1.1,posix,reparse=nfs,actimeo=0
mkfifo /mnt/cifs/test-fifo
umount /mnt/cifs
mount -t cifs //<server>/<share> /mnt/cifs \
-o vers=3.1.1,posix,reparse=nfs,actimeo=0
stat -c '%F %s' /mnt/cifs/test-fifoBefore this change, stat reports "fifo 1024" although the server-side EOF is zero. After this change, it reports "fifo 0".
--- fs/smb/client/smb2inode.c | 9 +++++---- fs/smb/client/smb2pdu.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)
fs/smb/client/smb2inode.c +5 -4
@@ -576,6 +576,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, idata->fi.Attributes = create_rsp->FileAttributes; idata->fi.AllocationSize = create_rsp->AllocationSize; idata->fi.EndOfFile = create_rsp->EndofFile; + idata->contains_posix_file_info = false;if (le32_to_cpu (idata->fi.NumberOfLinks) ==0 ) idata->fi.NumberOfLinks =cpu_to_le32 (1 );/* dummy value */ idata->fi.DeletePending =0 ;/* successful open = not delete pending */
@@ -598,7 +599,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,switch (cmds[i]) {case SMB2_OP_QUERY_INFO : idata = in_iov[i].iov_base; - idata->contains_posix_file_info = false;if (rc ==0 && cfile && cfile->symlink_target) { idata->symlink_target =kstrdup (cfile->symlink_target,GFP_KERNEL );if (!idata->symlink_target)
@@ -611,6 +611,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,le16_to_cpu (qi_rsp->OutputBufferOffset),le32_to_cpu (qi_rsp->OutputBufferLength), &rsp_iov[i + 1], sizeof(idata->fi), (char *)&idata->fi); +if (!rc) + idata->contains_posix_file_info = false; }SMB2_query_info_free (&rqst[num_rqst++]);if (rc)
@@ -622,7 +624,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,break ;case SMB2_OP_POSIX_QUERY_INFO : idata = in_iov[i].iov_base; - idata->contains_posix_file_info = true;if (rc ==0 && cfile && cfile->symlink_target) { idata->symlink_target =kstrdup (cfile->symlink_target,GFP_KERNEL );if (!idata->symlink_target)
@@ -636,6 +637,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,le32_to_cpu (qi_rsp->OutputBufferLength), &rsp_iov[i +1 ],sizeof (idata->posix_fi)/* add SIDs */ , (char *)&idata->posix_fi); +if (!rc) + idata->contains_posix_file_info = true; }if (rc ==0 ) rc =parse_posix_sids (idata, &rsp_iov[i +1 ]);
@@ -707,7 +710,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, idata = in_iov[i].iov_base; idata->reparse.io.iov = *iov; idata->reparse.io.buftype = resp_buftype[i +1 ]; - idata->contains_posix_file_info = false;/* BB VERIFY */ rbuf =reparse_buf_ptr (iov);if (IS_ERR (rbuf)) { rc =PTR_ERR (rbuf);
@@ -729,7 +731,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,case SMB2_OP_QUERY_WSL_EA :if (!rc) { idata = in_iov[i].iov_base; - idata->contains_posix_file_info = false; qi_rsp = rsp_iov[i +1 ].iov_base; data[0 ] = (u8 *)qi_rsp +le16_to_cpu (qi_rsp->OutputBufferOffset); size[0 ] =le32_to_cpu (qi_rsp->OutputBufferLength);
fs/smb/client/smb2pdu.c +1 -0
@@ -3372,6 +3372,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,#endif /* CIFS_DEBUG2 */ if (file_info) { + buf->contains_posix_file_info = false; file_info->CreationTime = rsp->CreationTime; file_info->LastAccessTime = rsp->LastAccessTime; file_info->LastWriteTime = rsp->LastWriteTime;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1749/1815 selftests/mm: skip COW tmpfile cases when fallocate() is unsupported
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 4004c130c358b1561a55323b0e747f20f5133f7b ]
Patch series "selftests/mm: Handle unsupported and transient test conditions", v3.
Several MM selftests report failures when the test environment lacks an underlying prerequisite, such as fallocate() support, MADV_REMOVE, local page-cache semantics, or swap.
This series converts those unsupported cases to SKIP while preserving failures for unexpected errors. It also allows migration tests to retry transient move_pages() failures.
This patch (of 4):
The tmpfile-backed COW cases allocate a one-page file with fallocate() before exercising private and shared mappings. When the filesystem backing tmpfile() does not implement fallocate(), setup fails with EOPNOTSUPP and no COW behavior is exercised.
This occurs when the temporary directory resides on a filesystem with limited allocation support, such as NFSv3. Reporting a failure adds noise because the test prerequisite is absent rather than the COW implementation being broken.
Report EOPNOTSUPP as a skip. Continue treating every other fallocate() error as a failure so unexpected setup regressions remain visible.
--- tools/testing/selftests/mm/cow.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/mm/cow.c +7 -2
@@ -1718,8 +1718,13 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)/* File consists of a single page filled with zeroes. */ if (fallocate (fd,0 ,0 , pagesize)) { -ksft_perror ("fallocate() failed" ); -log_test_result (KSFT_FAIL ); +if (errno ==EOPNOTSUPP ) { +ksft_print_msg ("fallocate() not supported by filesystem\n" ); +log_test_result (KSFT_SKIP ); + }else { +ksft_perror ("fallocate() failed" ); +log_test_result (KSFT_FAIL ); + } goto close; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1750/1815 selftests/mm: fix read_file() return value check
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongfu Li <[email protected]>
[ Upstream commit 4050b5b0b60c93160a816d68ea1eb9ae92739a73 ]
read_file() returns 0 on open/read failures and never returns negative values. Existing < 0 error checks never trigger, so read failures are silently ignored. Check for zero return to detect read_file() failures.
Also fix misleading error message in get_finfo(). The error string incorrectly references read_num when reading uevent files.
--- tools/testing/selftests/mm/khugepaged.c | 4 ++-- tools/testing/selftests/mm/vm_util.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/mm/khugepaged.c +2 -2
@@ -138,8 +138,8 @@ static void get_finfo(const char *dir) major(path_stat.st_dev), minor(path_stat.st_dev)) >= sizeof(path))ksft_exit_fail_msg ("%s: Pathname is too long\n" , __func__); -if (read_file (path, buf,sizeof (buf)) <0 ) -ksft_exit_fail_perror ("read_file(read_num)" ); +if (!read_file (path, buf,sizeof (buf))) +ksft_exit_fail_perror ("read_file(uevent)" );if (strstr (buf,"DEVTYPE=disk" )) {/* Found it */ if (snprintf(finfo.dev_queue_read_ahead_path,
tools/testing/selftests/mm/vm_util.c +1 -1
@@ -755,7 +755,7 @@ unsigned long read_num(const char *path) {char buf[21 ]; -if (read_file (path, buf,sizeof (buf)) <0 ) +if (!read_file (path, buf,sizeof (buf)))ksft_exit_fail_perror ("read_file()" );return strtoul (buf,NULL ,10 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1751/1815 mm/memcontrol: avoid false sharing between vmstats and events
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Usama Arif <[email protected]>
[ Upstream commit c1afbd5de131f5e3c4fc7559acf055f8d9d86868 ]
Moving v1 userspace eventfd handling into memcontrol-v1.c shrank struct vmpressure from 112 to 24 bytes when CONFIG_MEMCG_V1 is disabled. This moved memory_events_local[MEMCG_SWAP_FAIL] and the hot vmstats_percpu pointer onto the same cacheline.
The stress-ng mremap stressor exercises MADV_PAGEOUT with swap disabled, generating about 20 million MEMCG_SWAP_FAIL updates per 60-second run on a 176-CPU test system. Those writes bounce the line while memcg statistics paths load vmstats_percpu.
Move cgwb_list into the existing alignment gap and cacheline-align vmstats_percpu. This separates the pointer from the event counters without increasing the size of struct mem_cgroup in the tested configuration.
The blamed commit reduced median mremap throughput by 4.38% on the test system with one socket. The patched kernel brings the performance to within 0.5% of the parent which is within the observed boot-to-boot spread (up to 1.2%).
--- include/linux/memcontrol.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/linux/memcontrol.h +7 -2
@@ -270,10 +270,15 @@ struct mem_cgroup {#endif int kmemcg_id; -struct memcg_vmstats_percpu __percpu *vmstats_percpu; -#ifdef CONFIG_CGROUP_WRITEBACK struct list_head cgwb_list; +#endif + +/* Keep the hot per-CPU stats pointer away from memory event counters. */ +struct memcg_vmstats_percpu __percpu *vmstats_percpu +____cacheline_aligned_in_smp ; + +#ifdef CONFIG_CGROUP_WRITEBACK struct wb_domain cgwb_domain;struct memcg_cgwb_frn cgwb_frn[MEMCG_CGWB_FRN_CNT ];#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1752/1815 maple_tree: catch race in mas_alloc_cyclic()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett (Oracle) <[email protected]>
[ Upstream commit 35f1342e5b893a740eff2ef9ab337bfaa63ab76d ]
If mas_alloc_cyclic() is called during a low memory situation, it is possible the lock may be dropped so reclaim can occur. There is a window where some other task may allocate the same id and cause the mas_insert() to fail with -EEXIST. In this scenario the function will return -EEXIST, which is not expected.
Modifying the retry on mas_nomem() to re-search for a slot means that any race with other writes will not matter as the lock will be held between finding the index and writing the index.
Moving the flag logic avoids cases where the flag is modified on drop lock/reacquire or when the write fails after clearing the flag.
No existing users are exposed to this issue.
--- lib/maple_tree.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-)
lib/maple_tree.c +24 -19
@@ -3793,35 +3793,40 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp, void *entry, unsigned long range_lo, unsigned long range_hi, unsigned long *next, gfp_t gfp) { - unsigned long min = range_lo; -int ret =0 ; - - range_lo =max (min, *next); - ret =mas_empty_area (mas, range_lo, range_hi,1 ); -if ((mas->tree->ma_flags &MT_FLAGS_ALLOC_WRAPPED ) && ret ==0 ) { - mas->tree->ma_flags &= ~MT_FLAGS_ALLOC_WRAPPED ; - ret =1 ; - } -if (ret <0 && range_lo > min) { -mas_reset (mas); - ret =mas_empty_area (mas, min, range_hi,1 ); -if (ret ==0 ) - ret =1 ; - } -if (ret <0 ) -return ret; + int ret; +unsigned long min; + min = range_lo;do { + range_lo =max (min, *next); + ret =mas_empty_area (mas, range_lo, range_hi,1 ); +if (ret <0 && range_lo > min) { +mas_reset (mas); + ret =mas_empty_area (mas, min, range_hi,1 ); +if (ret ==0 ) + ret =1 ; + } +if (ret <0 ) + goto out; +mas_insert (mas, entry); }while (mas_nomem (mas, gfp)); -if (mas_is_err (mas)) -return xa_err (mas->node); +if (mas_is_err (mas)) { + ret =xa_err (mas->node); + goto out; + } + +if ((mas->tree->ma_flags &MT_FLAGS_ALLOC_WRAPPED ) && ret ==0 ) { + mas->tree->ma_flags &= ~MT_FLAGS_ALLOC_WRAPPED ; + ret =1 ; + } *startp = mas->index; *next = *startp +1 ;if (*next ==0 ) mas->tree->ma_flags |=MT_FLAGS_ALLOC_WRAPPED ; +out:mas_destroy (mas);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1753/1815 maple_tree: fix argument name in header
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett (Oracle) <[email protected]>
[ Upstream commit 00f67814a14e614b749ebe54076ef1e3e6454f2b ]
The mas_prev_range() function takes a min and not a max.
--- include/linux/maple_tree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/maple_tree.h +1 -1
@@ -572,7 +572,7 @@ void maple_tree_init(void);void mas_destroy (struct ma_state *mas);void *mas_prev (struct ma_state *mas,unsigned long min); -void *mas_prev_range (struct ma_state *mas,unsigned long max); +void *mas_prev_range (struct ma_state *mas,unsigned long min);void *mas_next (struct ma_state *mas,unsigned long max);void *mas_next_range (struct ma_state *mas,unsigned long max);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1754/1815 selftests/proc: make proc-maps-race work with READ_IMPLIES_EXEC
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 0685630fdccb62dcb0e3f44525a40578da5f6dc8 ]
test_maps_tearing_from_split times out when READ_IMPLIES_EXEC is set. This happens by default on pre-ARMv6 CPUs, which lack no-execute support.
split_vma() re-maps the first page with mod_info->prot | PROT_EXEC to make it differ from its neighbours. With READ_IMPLIES_EXEC the original mapping is already executable, so no split occurs and the test hangs waiting for the modifier child.
Use PROT_NONE for the split mapping, which always differs from its readable neighbours.
--- tools/testing/selftests/proc/proc-maps-race.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/proc-maps-race.c +2 -1
@@ -490,7 +490,8 @@ static bool query_addr_at(int maps_fd, void *addr,static inline bool split_vma (FIXTURE_DATA (proc_maps_race) *self) { -return mmap (self->mod_info->addr, self->page_size, self->mod_info->prot |PROT_EXEC , +/* PROT_NONE differs from both readable neighbors. */ +return mmap (self->mod_info->addr, self->page_size,PROT_NONE ,MAP_PRIVATE |MAP_ANONYMOUS |MAP_FIXED ,-1 ,0 ) !=MAP_FAILED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1755/1815 net/sched: act_skbmod: fix length calculations and avoid invalid header warnings
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 81d0d1e64f30d9989c829c0953cd6e6c68d9c5fb ]
syzbot reported a warning in skb_network_header_len() triggered by tcf_skbmod_act():
!skb_transport_header_was_set(skb)
WARNING: CPU: 0 PID: 14949 at include/linux/skbuff.h:3243 skb_network_header_len include/linux/skbuff.h:3243 [inline] WARNING: CPU: 0 PID: 14949 at net/sched/act_skbmod.c:55 tcf_skbmod_act+0xfe8/0x1810 net/sched/act_skbmod.c:55
There are a few issues in tcf_skbmod_act():
1. Calling skb_network_header_len() assumes skb->transport_header is set, which is not guaranteed when tcf_skbmod_act() runs at TC ingress.
2. Unconditionally calling skb_mac_header_len() at the beginning of tcf_skbmod_act() triggers a warning on L3 devices (e.g. TUN) where the MAC header is unset, evaluating to an underflowed garbage length.
3. On TC ingress, skb->data points to the network header. Adding the MAC header length to the IP header length causes skb_ensure_writable() to request more bytes than the actual IP packet length, dropping valid short packets (e.g. 28-byte UDP/IPv4 packets).
Fix these by:
- Using skb_network_offset(skb) + sizeof(struct iphdr/ipv6hdr) for SKBMOD_F_ECN so that the required length is correctly calculated on both ingress (offset == 0) and egress (offset == mac_len).
- Setting max_edit_len to ETH_HLEN for Ethernet header modifications after validating ARPHRD_ETHER.
--- net/sched/act_skbmod.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/sched/act_skbmod.c +8 -4
@@ -38,7 +38,6 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,if (unlikely (p->action ==TC_ACT_SHOT )) goto drop; - max_edit_len =skb_mac_header_len (skb); flags = p->flags;/* tcf_skbmod_init() guarantees "flags" to be one of the following:
@@ -51,14 +50,19 @@ TC_INDIRECT_SCOPE int tcf_skbmod_act(struct sk_buff *skb,if (flags ==SKBMOD_F_ECN ) {switch (skb_protocol (skb, true)) {case cpu_to_be16 (ETH_P_IP ): + max_edit_len =sizeof (struct iphdr ); +break ;case cpu_to_be16 (ETH_P_IPV6 ): - max_edit_len +=skb_network_header_len (skb); + max_edit_len =sizeof (struct ipv6hdr );break ;default : goto out; } - }else if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) { - goto out; + max_edit_len +=skb_network_offset (skb); + }else { +if (!skb->dev || skb->dev->type !=ARPHRD_ETHER ) + goto out; + max_edit_len =ETH_HLEN ; } err =skb_ensure_writable (skb, max_edit_len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1756/1815 net: core: check skb_frags_readable before uncloning in skb_copy_ubufs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mina Almasry <[email protected]>
[ Upstream commit 00e11ee9831b3439264e0ae6762a0470126515af ]
skb_copy_ubufs drops clones and modifies the SKB via pskb_expand_head() before checking for !skb_frags_readable(skb). This alters the SKB geometry prior to throwing an -EFAULT on an invalid SKB. Check readability first.
--- net/core/skbuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/skbuff.c +3 -3
@@ -2004,12 +2004,12 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)int i, order, psize, new_frags;u32 d_off; -if (skb_shared (skb) ||skb_unclone (skb, gfp_mask)) -return -EINVAL ; -if (!skb_frags_readable (skb))return -EFAULT ; +if (skb_shared (skb) ||skb_unclone (skb, gfp_mask)) +return -EINVAL ; +if (!num_frags) goto release;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1739/1815 net: enetc: improve MAFT entry management with bitmap tracking
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 6228fc9c2bbe224a376c77e309bcf90158e0595c ]
Replace the counter-based MAFT entry tracking (num_mfe/mac_filter_num) with a bitmap (maft_eid_bitmap) stored in struct ntmp_user, which is a more appropriate place for NTMP resource management.
The bitmap approach brings two improvements. First, the entry deletion in enetc4_pf_clear_maft_entries() now checks the return value of ntmp_maft_delete_entry() and only clears the corresponding bit on success, keeping hardware and software state in sync. Previously, the counter was reset unconditionally regardless of whether the hardware deletion actually succeeded.
Second, entry allocation in enetc4_pf_add_maft_entries() uses ntmp_lookup_free_eid() to find available IDs dynamically, with an upfront capacity check via bitmap_weight() to avoid partial failures.
The MAFT entry count is moved into ntmp_user.maft_num_entries and initialized once during enetc4_init_ntmp_user(). Helper functions enetc4_ntmp_bitmap_init() and enetc4_ntmp_bitmap_free() manage the bitmap lifetime. The debugfs show function is updated accordingly to iterate over set bits under rtnl_lock().
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../ethernet/freescale/enetc/enetc4_debugfs.c | 30 ++++-- .../net/ethernet/freescale/enetc/enetc4_pf.c | 97 ++++++++++++++----- .../net/ethernet/freescale/enetc/enetc_pf.h | 3 - include/linux/fsl/ntmp.h | 2 + 4 files changed, 96 insertions(+), 36 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_debugfs.c +20 -10
@@ -31,9 +31,11 @@ static int enetc_mac_filter_show(struct seq_file *s, void *data)struct enetc_si *si = s->private;struct enetc_hw *hw = &si->hw;struct maft_entry_data maft; +struct ntmp_user *user;struct enetc_pf *pf; -int i, err, num_si; -u32 val; +u32 val, entry_id; +int i, num_si; +int err =0 ; pf =enetc_si_priv (si); num_si = pf->caps.num_vsi +1 ;
@@ -50,22 +52,30 @@ static int enetc_mac_filter_show(struct seq_file *s, void *data)for (i =0 ; i < num_si; i++)enetc_show_si_mac_hash_filter (s, i); -if (!pf->num_mfe) -return 0 ; + user = &si->ntmp_user; +rtnl_lock (); + +if (bitmap_empty (user->maft_eid_bitmap, user->maft_num_entries)) + goto unlock_rtnl;/* MAC address filter table */ seq_puts (s,"MAC address filter table\n" ); -for (i =0 ; i < pf->num_mfe; i++) { +for_each_set_bit (entry_id, user->maft_eid_bitmap, + user->maft_num_entries) {memset (&maft,0 ,sizeof (maft)); - err =ntmp_maft_query_entry (&si->ntmp_user, i, &maft); + err =ntmp_maft_query_entry (user, entry_id, &maft);if (err) -return err; + goto unlock_rtnl; -seq_printf (s,"Entry %d, MAC: %pM, SI bitmap: 0x%04x\n" , i, - maft.keye.mac_addr,le16_to_cpu (maft.cfge.si_bitmap)); +seq_printf (s,"Entry %d, MAC: %pM, SI bitmap: 0x%04x\n" , + entry_id, maft.keye.mac_addr, +le16_to_cpu (maft.cfge.si_bitmap)); } -return 0 ; +unlock_rtnl: +rtnl_unlock (); + +return err; }DEFINE_SHOW_ATTRIBUTE (enetc_mac_filter);
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +74 -23
170 lines not on this page · raw message
drivers/net/ethernet/freescale/enetc/enetc_pf.h +0 -3
@@ -22,7 +22,6 @@ struct enetc_port_caps {int num_msix;int num_rx_bdr;int num_tx_bdr; -int mac_filter_num; };struct enetc_pf ;
@@ -60,8 +59,6 @@ struct enetc_pf {struct enetc_port_caps caps;const struct enetc_pf_ops *ops; - -int num_mfe;/* number of mac address filter table entries */ };#define phylink_to_enetc_pf (config) \
include/linux/fsl/ntmp.h +2 -0
@@ -75,8 +75,10 @@ struct ntmp_user {/* NTMP table bitmaps for resource management */ u32 ett_bitmap_size;u32 ect_bitmap_size; +u16 maft_num_entries;unsigned long *ett_gid_bitmap;/* only valid for switch */ unsigned long *ect_gid_bitmap;/* only valid for switch */ +unsigned long *maft_eid_bitmap;/* only valid for ENETC */ };struct maft_entry_data {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1757/1815 net: fix a resource leak in copy_net_ns() error handling path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 3220b62fbb8a55feebd2a826d5ead0f49f09ed5a ]
Currently, preinit_net() does two things:
(1) call ns_common_init() which might fail
(2) initialize resources which does not fail
However, preinit_net() is returning early when (1) fails, and copy_net_ns() is jumping to the dec_ucounts: label. As a result, resources allocated by net_alloc() are leaking. We need to call key_remove_domain() and net_passive_dec() in order to release resources allocated by net_alloc().
We cannot simply jump to the put_userns: label when preinit_net() failed, for (2) is not yet done. But we can reorder (1) and (2), for there is no dependency between (1) and (2). Therefore, this patch decouples (1) from preinit_net() and changes preinit_net() back to a void function, and calls ns_common_init() after preinit_net() succeeded. Then, we can jump to immediately after ns_common_free() of the put_userns: label.
--- net/core/net_namespace.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
net/core/net_namespace.c +9 -12
@@ -399,14 +399,8 @@ static __net_init void preinit_net_sysctl(struct net *net) }/* init code that must occur even if setup_net() is not called. */ -static __net_init int preinit_net (struct net *net,struct user_namespace *user_ns) +static __net_init void preinit_net (struct net *net,struct user_namespace *user_ns) { -int ret; - - ret =ns_common_init (net); -if (ret) -return ret; -refcount_set (&net->passive,1 );ref_tracker_dir_init (&net->refcnt_tracker,128 ,"net_refcnt" );ref_tracker_dir_init (&net->notrefcnt_tracker,128 ,"net_notrefcnt" );
@@ -427,7 +421,6 @@ static __net_init int preinit_net(struct net *net, struct user_namespace *user_nINIT_LIST_HEAD (&net->ptype_all);INIT_LIST_HEAD (&net->ptype_specific);preinit_net_sysctl (net); -return 0 ; }/*
@@ -570,12 +563,14 @@ struct net *copy_net_ns(u64 flags, goto dec_ucounts; } - rv =preinit_net (net, user_ns); -if (rv <0 ) - goto dec_ucounts; +preinit_net (net, user_ns); net->ucounts = ucounts;get_user_ns (user_ns); + rv =ns_common_init (net); +if (rv) + goto put_userns_no_common; + rv =down_read_killable (&pernet_ops_rwsem);if (rv <0 ) goto put_userns;
@@ -587,6 +582,7 @@ struct net *copy_net_ns(u64 flags,if (rv <0 ) { put_userns:ns_common_free (net); +put_userns_no_common:#ifdef CONFIG_KEYS key_remove_domain (net->key_domain);#endif
@@ -1289,7 +1285,8 @@ void __init net_ns_init(void)* This currently cannot fail as the initial network namespace * has a static inode number. */ -if (preinit_net (&init_net, &init_user_ns)) +preinit_net (&init_net, &init_user_ns); +if (ns_common_init (&init_net))panic ("Could not preinitialize the initial network namespace" );down_write (&pernet_ops_rwsem);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1758/1815 net/sched: fq: add overflow bounds to quantum and initial quantum
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 709f34f7c28dc4dd6c40343d101850f11e172312 ]
fq_init() computes quantum = 2 * psched_mtu() and initial_quantum = 10 * psched_mtu() with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000; the 2 * and 10 * multiplications wrap to 0 in 32-bit arithmetic, so q->quantum == 0. Then in fq_dequeue() the credit-refill loop adds 0 to f->credit (which stays <= 0) and goto begin loops forever under the qdisc lock, creating a soft lockup.
Clamp psched_mtu() to [1, 1 << 20] before multiplying so the product cannot wrap, then cap the result at 1 << 20, matching the bound already enforced on TCA_FQ_QUANTUM in fq_change().
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) is large enough that 2 * psched_mtu() wraps (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_fq.c +4 -2
@@ -1226,12 +1226,14 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) {struct fq_sched_data *q =qdisc_priv (sch); +u32 mtu;int i, err; sch->limit =10000 ; q->flow_plimit =100 ; - q->quantum =2 *psched_mtu (qdisc_dev (sch)); - q->initial_quantum =10 *psched_mtu (qdisc_dev (sch)); + mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),1 ,1 <<20 ); + q->quantum =min_t (u32,2 * mtu,1 <<20 ); + q->initial_quantum =min_t (u32,10 * mtu,1 <<20 ); q->flow_refill_delay =msecs_to_jiffies (40 ); q->flow_max_rate = ~0UL ; q->time_next_delayed_flow = ~0ULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1759/1815 net/sched: fq_codel: clamp default quantum and mtu
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit d9ebd8f9aa8b2773235889cb903fafd61f2d8585 ]
fq_codel_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, which overflows the signed flow->deficit to INT_MIN in fq_codel_dequeue(), causing an infinite loop and soft lockup. Emulate fq_codel_change() and constrain to [256, FQ_CODEL_QUANTUM_MAX].
The same unclamped psched_mtu() is assigned to q->cparams.mtu a bit below, and fq_codel_change() never updates it. codel_should_drop() tests "*backlog <= params->mtu"; with mtu == 0x80000000 (~2 GiB) and the default 32 MiB memory_limit, the test is always true, so CoDel is silently and completely disabled (no drops, no ECN). Declare a single clamped mtu and assign both q->quantum and q->cparams.mtu from it, which also removes the double psched_mtu() call.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq_codel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_fq_codel.c +4 -2
@@ -509,6 +509,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) {struct fq_codel_sched_data *q =qdisc_priv (sch); +u32 mtu;int i;int err;
@@ -516,13 +517,14 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, q->flows_cnt =1024 ; q->memory_limit =32 <<20 ;/* 32 MBytes */ q->drop_batch_size =64 ; - q->quantum =psched_mtu (qdisc_dev (sch)); + mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),256 ,FQ_CODEL_QUANTUM_MAX ); + q->quantum = mtu;INIT_LIST_HEAD (&q->new_flows);INIT_LIST_HEAD (&q->old_flows);codel_params_init (&q->cparams);codel_stats_init (&q->cstats); q->cparams.ecn = true; - q->cparams.mtu =psched_mtu (qdisc_dev (sch)); + q->cparams.mtu = mtu;if (opt) { err =fq_codel_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1760/1815 net/sched: sch_codel: clamp default mtu to avoid disabling CoDel
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 6439461f1618ae176c048673ad28bdb6c68efbfc ]
codel_init() sets q->params.mtu = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000. In codel_should_drop() the test "*backlog <= params->mtu" then compares the backlog against ~2 GiB; with the default sch->limit of DEFAULT_CODEL_LIMIT (1000) packets the backlog can never reach it, so the test is always true and CoDel is silently and completely disabled i.e no drops, no ECN marking, codel degrades to a tail-drop FIFO. codel_change() never updates params.mtu, so the init path is the only place to clamp it. Constrain to [256, 1 << 20], matching the fq_codel bound; 256 is a sane floor that only makes CoDel slightly more willing to act on very small queues, which is the safe direction.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_codel.c +1 -1
@@ -205,7 +205,7 @@ static int codel_init(struct Qdisc *sch, struct nlattr *opt,codel_params_init (&q->params);codel_vars_init (&q->vars);codel_stats_init (&q->stats); - q->params.mtu =psched_mtu (qdisc_dev (sch)); + q->params.mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),256 ,1 <<20 );if (opt) {int err =codel_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1761/1815 net/sched: fq_pie: clamp default quantum to avoid signed overflow
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit c86cd7ed0b0e44779a3d1683f03e4353baf4bdc9 ]
fq_pie_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) without clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, which overflows the signed flow->deficit to INT_MIN in fq_pie_qdisc_dequeue(), causing an infinite loop and soft lockup. Emulate fq_pie_policy which is already bounded to [1, 1 << 20]; clamp the default to [256, 1 << 20]. 256 matches fq_codel's floor and is a sane minimum for a DRR quantum.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_fq_pie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/sch_fq_pie.c +2 -1
@@ -427,7 +427,8 @@ static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt,pie_params_init (&q->p_params); sch->limit =10 *1024 ; q->p_params.limit = sch->limit; - q->quantum =psched_mtu (qdisc_dev (sch)); + q->quantum =clamp_t (u32,psched_mtu (qdisc_dev (sch)), +256 ,1 <<20 ); q->sch = sch; q->ecn_prob =10 ; q->flows_cnt =1024 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1762/1815 net/sched: hhf: clamp quantum before hhf_change() to avoid overflow
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 2164b512b97bb053e8ce4d6e95576f11bed6a005 ]
hhf_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes weight * quantum overflow the signed deficit in hhf_dequeue(), spinning forever.
Clamp q->quantum before hhf_change() so both the opt and !opt paths see a sane quantum. Without this, bare "tc qdisc add ... hhf" succeeds with a clamped quantum but "tc qdisc add ... hhf limit 1000" (any option present) fails with -EINVAL because hhf_change() re-validates the unclamped default (sch_hhf.c:559). 256 matches fq_codel's floor and is a sane minimum for a DRR quantum.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_hhf.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_hhf.c +4 -0
@@ -624,6 +624,10 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt, q->hhf_evict_timeout =HZ ;/* 1 sec */ q->hhf_non_hh_weight =2 ; +if ((int )q->quantum <=0 || + (u64 )q->quantum * q->hhf_non_hh_weight >INT_MAX ) + q->quantum =256 ; +if (opt) {int err =hhf_change (sch, opt, extack);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1763/1815 net/sched: sfq: clamp quantum to avoid signed overflow soft lockup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 816e90057ab1879562a5b7cc688e35bb9027ae97 ]
sfq_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) (unsigned). A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, so slot->allot = INT_MIN and INT_MIN + INT_MIN toggles between INT_MIN and 0 forever, spinning sfq_dequeue() under the qdisc lock.
Clamp the quantum to [256, 1 << 20] so the refill loop terminates. The lower bound also covers q->quantum == 0 (psched_mtu() returning 0), which spins sfq_dequeue() identically. sfq_change() already rejects a negative quantum, so only the init path was exposed.
Conditions to recreate the bug: a device whose MTU (plus hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace.
--- net/sched/sch_sfq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/sch_sfq.c +2 -1
@@ -799,7 +799,8 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt, q->tail =NULL ; q->divisor =SFQ_DEFAULT_HASH_DIVISOR ; q->maxflows =SFQ_DEFAULT_FLOWS ; - q->quantum =psched_mtu (qdisc_dev (sch)); + q->quantum =clamp_t (u32,psched_mtu (qdisc_dev (sch)), +256 ,1 <<20 ); q->perturb_period =0 ;get_random_bytes (&q->perturbation,sizeof (q->perturbation));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1764/1815 net/sched: sch_teql: restore skb->dev on the slave failure path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit dc4b95b8fee95113587e93ca116356032d271371 ]
teql_master_xmit() sets skb->dev = slave before calling the slave's ndo_start_xmit(), but never restores it when that transmit fails. The skb then walks on to the next slave still pointing at the previous one.
If a later slave has no resolved neighbour, teql_resolve() hands the skb to neigh_event_send(), which queues it on that neighbour's arp_queue with the stale skb->dev. skb->dev holds no reference, so deleting the previous slave frees the net_device while the skb is still queued. Whatever runs next on that skb - arp_error_report() on timeout, or neigh_direct_output() -> dev_queue_xmit() once the neighbour resolves - causes a UAF like the one below:
BUG: KASAN: slab-use-after-free in __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) Read of size 4 at addr ffff888106e100b0 by task flood_packet/527 CPU: 0 UID: 0 PID: 527 Comm: flood_packet Not tainted 7.2.0-rc6-g594d90519502 #1 PREEMPT(lazy) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <IRQ> dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120) print_report (mm/kasan/report.c:378 mm/kasan/report.c:482) ? __pfx__raw_spin_lock_irqsave (./include/asm-generic/qrwlock.h:122 (discriminator 4)) ? __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) kasan_report (mm/kasan/report.c:595) ? __icmp_send (net/ipv4/icmp.c:914 (discriminator 2)) __icmp_send (net/ipv4/icmp.c:914 (discriminator 2))
[...]ipv4_link_failure (net/ipv4/route.c:1251 net/ipv4/route.c:1258)
? __pfx_ipv4_link_failure (./include/linux/skbuff.h:4327)
? _raw_write_lock (./include/linux/instrumented.h:55 ./include/linux/atomic/atomic-instrumented.h:1301 ./include/asm-generic/qrwlock.h:98 ./include/linux/rwlock_api_smp.h:230 kernel/locking/spinlock.c:304) ? __pfx__raw_write_lock (kernel/locking/spinlock.c:175)arp_error_report (./include/net/dst.h:438 net/ipv4/arp.c:296)neigh_invalidate (net/core/neighbour.c:1077)neigh_timer_handler (net/core/neighbour.c:1169)
[...]
Allocated by task 505: kasan_save_stack (mm/kasan/common.c:57) kasan_save_track (mm/kasan/common.c:78) __kasan_kmalloc (mm/kasan/common.c:398 mm/kasan/common.c:415) __kvmalloc_node_noprof (./include/linux/kasan.h:263 mm/slub.c:5334 mm/slub.c:6905) alloc_netdev_mqs (net/core/dev.c:12055 (discriminator 2))
rtnl_create_link (net/core/rtnetlink.c:3721)rtnl_newlink (net/core/rtnetlink.c:3903 net/core/rtnetlink.c:4044 net/core/rtnetlink.c:4159) rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
[...]
Freed by task 536: kasan_save_stack (mm/kasan/common.c:57) kasan_save_track (mm/kasan/common.c:78) kasan_save_free_info (mm/kasan/generic.c:584) __kasan_slab_free (mm/kasan/common.c:253 mm/kasan/common.c:285) kfree (./include/linux/kasan.h:235 mm/slub.c:2677 mm/slub.c:6377 mm/slub.c:6692)
device_release (drivers/base/core.c:2636)kobject_put (lib/kobject.c:689 lib/kobject.c:720 ./include/linux/kref.h:65 lib/kobject.c:737) netdev_run_todo (net/core/dev.c:11756)rtnl_dellink (net/core/rtnetlink.c:157 ./include/linux/rtnetlink.h:135 net/core/rtnetlink.c:3651) rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
[...]
Fix this by restoring skb->dev to the master at the end of each slave's iteration.
--- net/sched/sch_teql.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_teql.c +1 -0
@@ -377,6 +377,7 @@ static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) nores =1 ;break ; } + skb->dev = dev;__skb_pull (skb,skb_network_offset (skb)); }while ((q =rcu_dereference (NEXT_SLAVE (q))) != start);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1765/1815 tpm: st33zp24: Return zero on status read failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 8b92687708f5ef980de01c2042dbd76d11f78547 ]
st33zp24_status() ignores the result of the transport read and returns data even when no byte was received. The I2C transport, for example, skips i2c_master_recv() when the register-select write is short or fails, leaving data uninitialized. The resulting stack value can be interpreted as TPM_STS flags and let status checks complete spuriously.
The status callback cannot propagate a transport error. Return zero unless recv() reports exactly one byte. With no status bits set, callers retry or take their existing timeout or error path instead of acting on an invalid status value.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/char/tpm/st33zp24/st33zp24.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/tpm/st33zp24/st33zp24.c +3 -1
@@ -93,7 +93,9 @@ static u8 st33zp24_status(struct tpm_chip *chip)struct st33zp24_dev *tpm_dev =dev_get_drvdata (&chip->dev);u8 data; - tpm_dev->ops->recv (tpm_dev->phy_id,TPM_STS , &data,1 ); +if (tpm_dev->ops->recv (tpm_dev->phy_id,TPM_STS , &data,1 ) !=1 ) +return 0 ; +return data; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1766/1815 tpm: st33zp24: Validate locality read result
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 264216889d39df509b9c8045df53529480b0b718 ]
check_locality() treats every nonzero transport return as success. SPI errors remain negative, while the I2C path can convert a negative write error through its byte-sized status variable. Either result is nonzero even though the TPM_ACCESS byte can remain unwritten, so indeterminate ACTIVE_LOCALITY and VALID bits can falsely report an active locality.
Require recv() to return exactly the requested byte before examining TPM_ACCESS. Transport errors and short reads now report an inactive locality, while successful reads retain the existing behavior.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/char/tpm/st33zp24/st33zp24.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/st33zp24/st33zp24.c +2 -2
@@ -106,10 +106,10 @@ static bool check_locality(struct tpm_chip *chip) {struct st33zp24_dev *tpm_dev =dev_get_drvdata (&chip->dev);u8 data; -u8 status; +int status; status = tpm_dev->ops->recv (tpm_dev->phy_id,TPM_ACCESS , &data,1 ); -if (status && (data & +if (status ==1 && (data & (TPM_ACCESS_ACTIVE_LOCALITY |TPM_ACCESS_VALID )) == (TPM_ACCESS_ACTIVE_LOCALITY |TPM_ACCESS_VALID ))return true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1740/1815 net: enetc: remove invalid code from enetc4_pl_mac_link_up()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 59bb3d62489ce08d45dac2b7ec7b8f99a7b2040b ]
When adding phylink MAC operations support to the NETC switch driver, Russell King pointed out several pieces of invalid logic in the .mac_link_up() implementation (see [1] and [2]):
1) Half-duplex backpressure is not supported by the kernel, Ethernet relies on packet dropping for congestion management.
2) phylink_autoneg_inband() is unnecessary, as RGMII in-band status is not supported.
3) TX and RX pause are disabled in half-duplex mode, so there is no need to override them in .mac_link_up().
The same invalid logic is also present in enetc4_pl_mac_link_up(), so remove the invalid code from it.
Given enetc4_set_hd_flow_control() is removed, pf->caps.half_duplex has also become useless and should therefore be removed as well.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../net/ethernet/freescale/enetc/enetc4_hw.h | 2 - .../net/ethernet/freescale/enetc/enetc4_pf.c | 38 +------------------ .../net/ethernet/freescale/enetc/enetc_pf.h | 1 - 3 files changed, 1 insertion(+), 40 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_hw.h +0 -2
@@ -135,7 +135,6 @@#define ENETC4_PSIVHFR1 (a) ((a) * 0x80 + 0x2064)#define ENETC4_PMCAPR 0x4004 -#define PMCAPR_HD BIT(8)#define PMCAPR_FP GENMASK(10, 9)/* Port capability register */
@@ -198,7 +197,6 @@#define PM_CMD_CFG_CNT_FRM_EN BIT(13)#define PM_CMD_CFG_TXP BIT(15)#define PM_CMD_CFG_SEND_IDLE BIT(16) -#define PM_CMD_CFG_HD_FCEN BIT(18)#define PM_CMD_CFG_SFD BIT(21)#define PM_CMD_CFG_TX_FLUSH BIT(22)#define PM_CMD_CFG_TX_LOWP_EN BIT(23)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +1 -37
@@ -29,9 +29,6 @@ static void enetc4_get_port_caps(struct enetc_pf *pf) val =enetc_port_rd (hw,ENETC4_ECAPR2 ); pf->caps.num_rx_bdr = (val &ECAPR2_NUM_RX_BDR ) >>16 ; pf->caps.num_tx_bdr = val &ECAPR2_NUM_TX_BDR ; - - val =enetc_port_rd (hw,ENETC4_PMCAPR ); - pf->caps.half_duplex = (val &PMCAPR_HD ) ?1 :0 ; }static void enetc4_get_psi_hw_features (struct enetc_si *si)
@@ -588,11 +585,6 @@ static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode,case PHY_INTERFACE_MODE_RGMII_RXID :case PHY_INTERFACE_MODE_RGMII_TXID : val |=IFMODE_RGMII ; -/* We need to enable auto-negotiation for the MAC -* if its RGMII interface support In-Band status. -*/ -if (phylink_autoneg_inband (mode)) - val |=PM_IF_MODE_ENA ;break ;case PHY_INTERFACE_MODE_RMII : val |=IFMODE_RMII ;
@@ -703,22 +695,6 @@ static void enetc4_set_rmii_mac(struct enetc_pf *pf, int speed, int duplex)enetc_port_mac_wr (si,ENETC4_PM_IF_MODE (0 ), val); } -static void enetc4_set_hd_flow_control (struct enetc_pf *pf,bool enable) -{ -struct enetc_si *si = pf->si; -u32 old_val, val; - -if (!pf->caps.half_duplex) -return ; - - old_val =enetc_port_mac_rd (si,ENETC4_PM_CMD_CFG (0 )); - val =u32_replace_bits (old_val, enable ?1 :0 ,PM_CMD_CFG_HD_FCEN ); -if (val == old_val) -return ; - -enetc_port_mac_wr (si,ENETC4_PM_CMD_CFG (0 ), val); -} -static void enetc4_set_rx_pause (struct enetc_pf *pf,bool rx_pause) {struct enetc_si *si = pf->si;
@@ -894,13 +870,11 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config,struct enetc_pf *pf =phylink_to_enetc_pf (config);struct enetc_si *si = pf->si;struct enetc_ndev_priv *priv; -bool hd_fc = false; priv =netdev_priv (si->ndev);enetc4_set_port_speed (priv, speed); -if (!phylink_autoneg_inband (mode) && -phy_interface_mode_is_rgmii (interface)) +if (phy_interface_mode_is_rgmii (interface))enetc4_set_rgmii_mac (pf, speed, duplex);if (interface ==PHY_INTERFACE_MODE_RMII )
@@ -912,18 +886,8 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config,*/ if (priv->active_offloads &ENETC_F_QBU ) tx_pause = false; - }else {/* DUPLEX_HALF */ -if (tx_pause || rx_pause) - hd_fc = true; - -/* As per 802.3 annex 31B, PAUSE frames are only supported -* when the link is configured for full duplex operation. -*/ - tx_pause = false; - rx_pause = false; } -enetc4_set_hd_flow_control (pf, hd_fc);enetc4_set_tx_pause (pf, priv->num_rx_rings, tx_pause);enetc4_set_rx_pause (pf, rx_pause);enetc4_mac_tx_enable (pf);
drivers/net/ethernet/freescale/enetc/enetc_pf.h +0 -1
@@ -17,7 +17,6 @@ struct enetc_vf_state { };struct enetc_port_caps { -u32 half_duplex:1 ;int num_vsi;int num_msix;int num_rx_bdr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1767/1815 crypto: acomp - allocate async request context when cloning
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <[email protected]>
[ Upstream commit ee440d4fc0d2f15894ab1f64c474a3adbc858880 ]
ACOMP_REQUEST_ON_STACK() reserves only enough storage for the synchronous fallback. When an async implementation is selected, callers clone that stack request before retrying, but acomp_request_clone() currently copies only the stack-sized object. The clone therefore has no storage for the async provider request context, and providers such as QAT write past the allocation through acomp_request_ctx(). KASAN does report a slab OOB write.
Allocate a zeroed clone large enough for the runtime acomp request size, copy only the bytes present in the source object, and preserve the existing fallback-on-allocation-failure behavior. Use the runtime reqsize because an implementation may adjust it during tfm initialization.
--- crypto/acompress.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
crypto/acompress.c +13 -3
@@ -559,12 +559,22 @@ EXPORT_SYMBOL_GPL(acomp_walk_virt);struct acomp_req *acomp_request_clone (struct acomp_req *req,size_t total,gfp_t gfp) { +struct crypto_tfm *tfm = req->base.tfm;struct acomp_req *nreq; +size_t len; - nreq =container_of (crypto_request_clone (&req->base, total, gfp), - struct acomp_req, base); -if (nreq == req) + len =sizeof (*req) + +crypto_acomp_reqsize (crypto_acomp_reqtfm (req)); + len =ALIGN (len,CRYPTO_MINALIGN ); + + nreq =kzalloc (len, gfp); +if (!nreq) { + req->base.tfm = tfm->fb;return req; + } + +memcpy (nreq, req,sizeof (*req)); + nreq->base.flags &= ~CRYPTO_TFM_REQ_ON_STACK ;if (req->src == &req->chain.ssg) nreq->src = &nreq->chain.ssg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1768/1815 apparmor: policy_int make sure list heads are initialized before fail path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit 3daad923a8685adb66087e0d819559b7eb6ba975 ]
If profile create fails before policy_init is complete the list heads are not properly initialized causing profile_free() sanity checks to trigger the following splat.
AppArmor WARN aa_policy_destroy: (((!list_empty(&policy->profiles) && (&policy->profiles)->prev != ((void *) 0x122 + (0xdead000000000000UL))))):
WARNING: security/apparmor/lib.c:509 at aa_policy_destroy+0x164/0x1b0 security/apparmor/lib.c:509, CPU#0: syz.0.17/5541 Modules linked in: CPU: 0 UID: 0 PID: 5541 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:aa_policy_destroy+0x16b/0x1b0 security/apparmor/lib.c:509 Code: 85 ed 7e 4d e8 96 bc 37 fd 5b 41 5c 41 5e 41 5f 5d e9 19 27 4e 07 cc e8 83 bc 37 fd 48 8d 3d 0c f0 d3 0b 48 c7 c6 a4 eb 38 8e <67> 48 0f b9 3a e9 04 ff ff ff e8 66 bc 37 fd 48 8d 3d ff ef d3 0b RSP: 0018:ffffc9000345eaa0 EFLAGS: 00010293 RAX: ffffffff848f530d RBX: ffff88803f734800 RCX: ffff88801af2a580 RDX: 0000000000000000 RSI: ffffffff8e38eba4 RDI: ffffffff90634320 RBP: 0000000000000000 R08: 0000000000000cc0 R09: 00000000ffffffff R10: dffffc0000000000 R11: fffffbfff1d95913 R12: dead000000000122 R13: ffff88803f734800 R14: ffff88803f734828 R15: dffffc0000000000 FS: 00007f5f6a1836c0(0000) GS:ffff88808c519000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055d02407b048 CR3: 0000000012aa9000 CR4: 0000000000352ef0 Call Trace: <TASK> aa_free_profile+0x9d/0x9f0 security/apparmor/policy.c:334 aa_alloc_profile+0x1e4/0x3e0 security/apparmor/policy.c:416 unpack_profile security/apparmor/policy_unpack.c:1153 [inline] aa_unpack+0x17db/0x7430 security/apparmor/policy_unpack.c:1748 aa_replace_profiles+0x226/0x2a20 security/apparmor/policy.c:1183 policy_update+0x234/0x4a0 security/apparmor/apparmorfs.c:505 profile_load+0x1cb/0x320 security/apparmor/apparmorfs.c:522 vfs_write+0x296/0xba0 fs/read_write.c:685 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5f6939e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5f6a183028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f5f69625fa0 RCX: 00007f5f6939e0d9 RDX: 0000000000000041 RSI: 0000200000000400 RDI: 0000000000000003 RBP: 00007f5f6a183090 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007f5f69626038 R14: 00007f5f69625fa0 R15: 00007ffe23725c18
--- security/apparmor/lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/apparmor/lib.c +2 -2
@@ -482,6 +482,8 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix,char *hname;size_t hname_sz; +INIT_LIST_HEAD (&policy->list); +INIT_LIST_HEAD (&policy->profiles); hname_sz = (prefix ?strlen (prefix) +2 :0 ) +strlen (name) +1 ;/* freed by policy_free */ hname =aa_str_alloc (hname_sz, gfp);
@@ -494,8 +496,6 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix, policy->hname = hname;/* base.name is a substring of fqname */ policy->name =basename (policy->hname); -INIT_LIST_HEAD (&policy->list); -INIT_LIST_HEAD (&policy->profiles);return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1769/1815 of/irq: Fix device node refcount leak in of_irq_get_affinity()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <[email protected]>
[ Upstream commit fe66c3ff85e85d492673c6dc95c3d624a63e0282 ]
of_irq_parse_one() raises the refcount of the interrupt controller node on success, and of_irq_get_affinity() returns without putting it, so every call past the parse leaks one reference. It is reached from platform_get_irq_affinity(), used by arm_pmu, arm_spe_pmu and coresight-trbe.
Put it once irq_populate_fwspec_info() has run: no in-tree ->get_fwspec_info() returns a mask that lives in the node.
--- drivers/of/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/irq.c +3 -1
@@ -563,7 +563,9 @@ const struct cpumask *of_irq_get_affinity(struct device_node *dev, int index)of_phandle_args_to_fwspec (oirq.np, oirq.args, oirq.args_count, &fwspec); -if (irq_populate_fwspec_info (&fwspec, &info)) + rc =irq_populate_fwspec_info (&fwspec, &info); +of_node_put (oirq.np); +if (rc)return NULL ;return info.affinity;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1770/1815 ASoC: dapm: Fix off-by-one check on the second enum channel
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 14511c9b54ceeeef487409d73947c89ee8563590 ]
The snd_soc_dapm_put_enum_double() rejects item[0] once it reaches e->items, but it lets item[1] be equal to it. Both go on to snd_soc_enum_item_to_val(), which indexes e->values with no bound of its own, so an enum with a value table reads one element past the end.
The indexing arrived with the MUX consolidation, which relaxed the item[1] check in the same hunk. The value MUX handler it deleted used
Quoted 1 line
= there, and the
snd_soc_put_enum_double()insoc-ops.cstill does.
Only adav80x pairs a value table with two shifts, and its second channel looks accidental, but the control does report two values. Writing three into it reads off the end of adav80x_mux_values. The core catches that only under CONFIG_SND_CTL_INPUT_VALIDATION, which defaults off.
--- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-dapm.c +1 -1
@@ -3608,7 +3608,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, val =snd_soc_enum_item_to_val (e, item[0 ]) << e->shift_l; mask = e->mask << e->shift_l;if (e->shift_l != e->shift_r) { -if (item[1 ] > e->items) +if (item[1 ] >= e->items)return -EINVAL ; val |=snd_soc_enum_item_to_val (e, item[1 ]) << e->shift_r; mask |= e->mask << e->shift_r;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1771/1815 ceph: Fix ERR_PTR(0) in ceph_mkdir()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <[email protected]>
[ Upstream commit 4f49c3f8a5a86d237bb202ecb17c2802ddc8fd2f ]
When mkdir succeeds, ceph_mkdir() sets ret to ERR_PTR(0) which is incorrect. It should return NULL instead for success.
--- fs/ceph/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/dir.c +1 -1
@@ -1174,7 +1174,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, !req->r_reply_info.head->is_target && !req->r_reply_info.head->is_dentry) err =ceph_handle_notrace_create (dir, dentry); - ret =ERR_PTR (err); + ret = err ?ERR_PTR (err) :NULL ; out_req:if (!IS_ERR (ret) && req->r_dentry != dentry)/* Some other dentry was spliced in */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1772/1815 ceph: revalidate ki_pos for O_APPEND writes after cap acquisition
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit d2a8d446a09c74c8ddfe108b50dd791c889983fc ]
For O_APPEND writes, ki_pos is set to the current EOF via generic_write_checks() after fetching i_size from the MDS. However, ceph_get_caps() may need to wait for Fwx exclusive caps if the write extends the file (endoff > i_max_size). While waiting for Fwx, the previous Fwx holder (another client) may have already extended the file. When the MDS grants us Fwx, the cap grant message updates the local i_size, but ki_pos remains at the old EOF, causing the append write to land at a stale offset and overwrite data from the other client.
Fix by re-reading i_size_read(inode) after ceph_get_caps() returns. At this point we hold Fwx exclusive caps, no other client can modify the file, and i_size reflects the true EOF from the MDS cap grant. No extra MDS round-trip is needed. Only adjust ki_pos when the EOF has actually changed.
After adjusting ki_pos forward, the write range [pos, pos+count) may now exceed the i_max_size that was validated by ceph_get_caps() for the old range. Re-check against i_max_size and truncate the write if necessary to stay within the MDS-granted limit.
--- fs/ceph/file.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
fs/ceph/file.c +48 -0
@@ -2477,6 +2477,54 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)if (err <0 ) goto out; +/* +* For O_APPEND writes we may have waited for Fwx exclusive caps +* while the previous Fwx holder (another client) extended the +* file. i_size has been updated via the cap grant message from +* the MDS, but ki_pos is still the old EOF. Re-read i_size here +* (no extra MDS round-trip needed) and adjust ki_pos to the true +* EOF. Since we hold Fwx, no other client can change the file. +*/ +if (iocb->ki_flags &IOCB_APPEND ) { +loff_t cur_eof =i_size_read (inode); + +if (cur_eof != pos) { +doutc (cl, +"%p %llx.%llx O_APPEND: pos adjusted %lld -> %lld\n" , + inode,ceph_vinop (inode), pos, cur_eof); + iocb->ki_pos = cur_eof; + pos = cur_eof; +if (pos >= limit) { + err = -EFBIG ; + goto out_caps; + } +iov_iter_truncate (from, limit - pos); + count =iov_iter_count (from); + +/* +* ceph_get_caps() validated the old endoff +* against i_max_size; adjusting ki_pos forward +* may have shifted the write range beyond the +* granted max_size. Re-check and truncate if +* necessary. +*/ +spin_lock (&ci->i_ceph_lock); +if (pos + count > (loff_t )ci->i_max_size) { +loff_t max_size = ci->i_max_size; + +spin_unlock (&ci->i_ceph_lock); +if (pos >= max_size) { + err = -EFBIG ; + goto out_caps; + } +iov_iter_truncate (from, max_size - pos); + count =iov_iter_count (from); + }else { +spin_unlock (&ci->i_ceph_lock); + } + } + } + err =file_update_time (file);if (err) goto out_caps;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1773/1815 libceph: validate banner payload length
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Nogikh <[email protected]>
[ Upstream commit f374967fcdf04001c9b66df1c19106fa83cd91f7 ]
When parsing the Ceph messenger v2 protocol banner, the payload_len field is decoded from the banner prefix. If a client sends a banner with a payload_len of 0, the kernel sets up a 0-length socket read. This violates an invariant in the state machine, triggering a warning in populate_in_iter():
------------[ cut here ]------------ !iov_iter_count(&con->v2.in_iter) WARNING: net/ceph/messenger_v2.c:3129 at populate_in_iter net/ceph/messenger_v2.c:3129 [inline], CPU#1: kworker/1:3/5070 WARNING: net/ceph/messenger_v2.c:3129 at ceph_con_v2_try_read+0x6634/0x6810 net/ceph/messenger_v2.c:3159, CPU#1: kworker/1:3/5070 ... Call Trace: <TASK> ceph_con_workfn+0x1f5/0x14a0 net/ceph/messenger.c:1575 process_one_work kernel/workqueue.c:3322 [inline] process_scheduled_works+0xa8e/0x14e0 kernel/workqueue.c:3405 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3486 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK>
According to the msgr2 protocol specification, the banner payload is expected to contain at least two 64-bit integers (server_feat and server_req_feat). Therefore, payload_len must be at least 16 bytes.
Fix this by adding a check in process_banner_prefix() to reject a payload_len smaller than 16 bytes. This prevents the 0-length read and correctly aborts the connection with a protocol error.
--- net/ceph/messenger_v2.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ceph/messenger_v2.c +5 -0
@@ -2142,6 +2142,11 @@ static int process_banner_prefix(struct ceph_connection *con) payload_len =ceph_decode_16 (&p);dout ("%s con %p payload_len %d\n" , __func__, con, payload_len); +if (payload_len <sizeof (u64) +sizeof (u64)) { + con->error_msg ="protocol error, bad banner payload len" ; +return -EINVAL ; + } +return prepare_read_banner_payload (con, payload_len); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1774/1815 samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-modify
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit d79fb758e7e2e7a181eab630c0545a56041c473d ]
ftrace_direct_init() assigns kthread_run()'s return value to simple_tsk without an IS_ERR() check. When kthread_run() fails it returns ERR_PTR(-ENOMEM), but init still returns 0, so the module loads with simple_tsk holding an error pointer. On unload, ftrace_direct_exit() then passes that ERR_PTR to kthread_stop(), leading to a null-pointer-dereference.
Check the return value of kthread_run() with IS_ERR(); on failure, unregister the ftrace direct call and propagate the error code.
--- samples/ftrace/ftrace-direct-modify.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
samples/ftrace/ftrace-direct-modify.c +9 -3
@@ -320,9 +320,15 @@ static int __init ftrace_direct_init(void)ftrace_set_filter_ip (&direct, (unsigned long ) my_ip,0 ,0 ); ret =register_ftrace_direct (&direct, my_tramp); -if (!ret) - simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); -return ret; +if (ret) +return ret; + simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); +if (IS_ERR (simple_tsk)) { +unregister_ftrace_direct (&direct, my_tramp, true); +return PTR_ERR (simple_tsk); + } + +return 0 ; } static void __exit ftrace_direct_exit(void)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1775/1815 samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-multi-modify
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 6727b7618f49401acf373fa3ec5712e2ec52e5cf ]
ftrace_direct_multi_init() assigns kthread_run()'s return value to simple_tsk without an IS_ERR() check. When kthread_run() fails it returns ERR_PTR(-ENOMEM), but init still returns 0, so the module loads with simple_tsk holding an error pointer. On unload, ftrace_direct_multi_exit() then passes that ERR_PTR to kthread_stop(), leading to a null-pointer-dereference.
Check the return value of kthread_run() with IS_ERR(); on failure, unregister the ftrace direct call and propagate the error code.
--- samples/ftrace/ftrace-direct-multi-modify.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
samples/ftrace/ftrace-direct-multi-modify.c +9 -3
@@ -364,9 +364,15 @@ static int __init ftrace_direct_multi_init(void) ret =register_ftrace_direct (&direct, my_tramp); -if (!ret) - simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); -return ret; +if (ret) +return ret; + simple_tsk =kthread_run (simple_thread,NULL ,"event-sample-fn" ); +if (IS_ERR (simple_tsk)) { +unregister_ftrace_direct (&direct, my_tramp, true); +return PTR_ERR (simple_tsk); + } + +return 0 ; } static void __exit ftrace_direct_multi_exit(void)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1776/1815 ASoC: amd: acp-config: change quirks to cover all ASUS FA401EA variants
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengyu Qu <[email protected]>
[ Upstream commit 15596a87fcc6fa07a162858e5fd00ba31752096b ]
Existing quirk doesn't cover all known existing FA401EA devices, so use "FA401EA" to cover all of them.
--- sound/soc/amd/acp-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp-config.c +1 -1
@@ -54,7 +54,7 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { { .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC" ), - DMI_MATCH(DMI_PRODUCT_NAME, "TUF Gaming A14 FA401EA"), + DMI_MATCH(DMI_PRODUCT_NAME, "FA401EA"), }, }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1741/1815 net: enetc: restore RX ring congestion mode for ENETC v4
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit fa1a8457b8581725ae237efefb2358eddd7e05c9 ]
ENETC v4 has the same problem as ENETC v1: the RX BD ring congestion mode (CM) is only configured in the phylink .mac_link_up() callback, so it is cleared when enetc_reconfigure() rebuilds the RX BD rings at runtime (for example when enabling or disabling PTP RX hardware timestamping) without a link status change, and it is never restored. As a result, the MAC can no longer generate PAUSE frames on ingress congestion and flow control stops working.
Fix it in the same way as ENETC v1. Track the desired CM state in the software flag ENETC_RXBDR_CM. Route enetc4_set_tx_pause() through the shared helper enetc_set_congestion_mode(), which sets or clears the flag according to tx_pause and updates the ENETC_RBMR_CM bit under si->gen_lock. When the RX BD rings are (re)enabled, enetc_enable_rxbdr() consults this flag and restores the CM bit accordingly, so flow control survives ring reconfiguration even when the link status does not change.
--- drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +4 -12
@@ -708,22 +708,14 @@ static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause)enetc_port_mac_wr (si,ENETC4_PM_CMD_CFG (0 ), val); } -static void enetc4_set_tx_pause (struct enetc_pf *pf,int num_rxbdr,bool tx_pause) +static void enetc4_set_tx_pause (struct enetc_pf *pf,bool tx_pause) { +struct enetc_ndev_priv *priv =netdev_priv (pf->si->ndev);u32 pause_off_thresh =0 , pause_on_thresh =0 ;u32 init_quanta =0 , refresh_quanta =0 ;struct enetc_hw *hw = &pf->si->hw; -u32 rbmr, old_rbmr; -int i; -for (i =0 ; i < num_rxbdr; i++) { - old_rbmr =enetc_rxbdr_rd (hw, i,ENETC_RBMR ); - rbmr =u32_replace_bits (old_rbmr, tx_pause ?1 :0 ,ENETC_RBMR_CM ); -if (rbmr == old_rbmr) -continue ; - -enetc_rxbdr_wr (hw, i,ENETC_RBMR , rbmr); - } +enetc_set_congestion_mode (priv, tx_pause);if (tx_pause) {/* When the port first enters congestion, send a PAUSE request
@@ -888,7 +880,7 @@ static void enetc4_pl_mac_link_up(struct phylink_config *config, tx_pause = false; } -enetc4_set_tx_pause (pf, priv->num_rx_rings, tx_pause); +enetc4_set_tx_pause (pf, tx_pause);enetc4_set_rx_pause (pf, rx_pause);enetc4_mac_tx_enable (pf);enetc4_mac_rx_enable (pf);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1777/1815 net: ethernet: sun4i-emac: Fix IRQ error handling
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 991c2be78257cba5bf53cf935fe70f8836964288 ]
irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails. The current code checks for -ENXIO and therefore does not detect the failure.
Check for a zero return value and convert it to -ENXIO.
--- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/allwinner/sun4i-emac.c +2 -2
@@ -996,9 +996,9 @@ static int emac_probe(struct platform_device *pdev)/* fill in parameters for net-dev structure */ ndev->base_addr = (unsigned long )db->membase; ndev->irq =irq_of_parse_and_map (np,0 ); -if (ndev->irq == -ENXIO ) { +if (!ndev->irq) {netdev_err (ndev,"No irq resource\n" ); - ret = ndev->irq; + ret = -ENXIO ; goto out_iounmap; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1778/1815 net/smc: release the internal TCP sock on IPPROTO_SMC socket creation failure
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifei Chu <[email protected]>
[ Upstream commit cec261b0b4c5c0b044165303198d10ffcdf3414c ]
IPPROTO_SMC sockets create an internal TCP sock ("clcsock") from the proto->init hook. When socket creation fails after proto->init has run - e.g. a cgroup BPF program attached to BPF_CGROUP_INET_SOCK_CREATE denies the socket - sk_common_release() only invokes sk_prot->destroy if it is set, but neither smc_inet_prot nor smc_inet6_prot defines it, and smc_destruct() returns early unless sk_state is SMC_CLOSED. As a result, every failing socket(AF_INET, SOCK_STREAM, IPPROTO_SMC) call leaks one tcp_sock, so an unprivileged task able to attach a deny-all BPF_CGROUP_INET_SOCK_CREATE program to its own cgroup can grow kernel memory unboundedly.
Add a .destroy hook to both protos that releases the clcsock via smc_clcsock_release(). smc_sk_init() hashes the sock into the smc hashinfo before the clcsock is created, and smc_diag dumps walk that hash dereferencing smc->clcsock without taking clcsock_release_lock, while sk_common_release() calls .destroy before .unhash. Unhash the sock before releasing the clcsock, as __smc_release() does, so a concurrent dump cannot observe the release; the second unhash in sk_common_release() is a no-op.
--- net/smc/smc_inet.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/smc/smc_inet.c +16 -0
@@ -15,13 +15,16 @@#include "smc_inet.h" #include "smc.h" +#include "smc_close.h" static int smc_inet_init_sock (struct sock *sk); +static void smc_inet_destroy_sock (struct sock *sk);static struct proto smc_inet_prot = { .name ="INET_SMC" , .owner =THIS_MODULE , .init = smc_inet_init_sock, + .destroy = smc_inet_destroy_sock, .hash = smc_hash_sk, .unhash = smc_unhash_sk, .release_cb = smc_release_cb,
@@ -68,6 +71,7 @@ static struct proto smc_inet6_prot = { .name = "INET6_SMC", .owner = THIS_MODULE, .init = smc_inet_init_sock, + .destroy = smc_inet_destroy_sock, .hash = smc_hash_sk, .unhash = smc_unhash_sk, .release_cb = smc_release_cb,
@@ -116,6 +120,18 @@ static int smc_inet_init_sock(struct sock *sk)return smc_create_clcsk (net, sk, sk->sk_family); } +static void smc_inet_destroy_sock (struct sock *sk) +{ +/* The sock is hashed and smc_diag dumps dereference smc->clcsock +* without clcsock_release_lock, while sk_common_release() calls +* .destroy before .unhash. Unhash first, as __smc_release() does, +* so no dump can observe the clcsock being released; the second +* unhash is a no-op. +*/ + sk->sk_prot->unhash (sk); +smc_clcsock_release (smc_sk (sk)); +} +int __init smc_inet_init (void ) {int rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1779/1815 net: phy: air_en8811h: move LED GPIO configuration to config_init
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaliy Sochnev <[email protected]>
[ Upstream commit 03b4702fc5e311cbac9ba8654021a88f0dac914c ]
The LED GPIO pins (GPIO3/4/5, mapped to LED2/LED1/LED0) are only ever configured as outputs once, in .probe(). But .config_init() restarts the MD32 MCU via en8811h_restart_mcu() on every call after the first (priv->mcu_needs_restart), and that restart resets buckpbus-mapped MCU state, including EN8811H_GPIO_OUTPUT. As a result the LED GPIOs fall back to inputs after the first event that re-triggers .config_init() (link renegotiation, ifdown/ifup, resume), and the PHY's LEDs stop reflecting link/activity state even though they worked right after probe.
Move the GPIO-as-output configuration from .probe() to the end of .config_init(), so it is reapplied every time the MCU may have been restarted.
--- drivers/net/phy/air_en8811h.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/phy/air_en8811h.c +11 -7
@@ -1173,13 +1173,6 @@ static int en8811h_probe(struct phy_device *phydev)if (ret)return ret; -/* Configure led gpio pins as output */ - ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , -EN8811H_GPIO_OUTPUT_345 , -EN8811H_GPIO_OUTPUT_345 ); -if (ret <0 ) -return ret; -return 0 ; }
@@ -1324,6 +1317,17 @@ static int en8811h_config_init(struct phy_device *phydev)return ret; } +/* Configure led gpio pins as output. Must be redone on every +* .config_init(), not just once in .probe(): en8811h_restart_mcu() +* resets buckpbus-mapped MCU state (incl. this register) on every +* call after the first, e.g. on link renegotiation or ifup/ifdown. +*/ + ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , +EN8811H_GPIO_OUTPUT_345 , +EN8811H_GPIO_OUTPUT_345 ); +if (ret <0 ) +return ret; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1780/1815 net: wangxun: use BIT_ULL() to prevent shift overflow on 32-bit archs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 63c885688f38a757947d7050b1ee4171215269ce ]
The macros TXGBE_INTR_MISC() and WX_INTR_Q() rely on the standard BIT() macro to generate interrupt masks based on the queue vector index.
On 32-bit architectures, BIT() evaluates to a 32-bit unsigned long. Since the number of queue vectors can be up to 63 on txgbe devices, performing a left shift of 32 or more results in an integer overflow and undefined behavior. This causes incorrect interrupt masking and unmasking logic for both the queue and miscellaneous interrupts on 32-bit systems.
Fix this by replacing BIT() with BIT_ULL() in these macros. This ensures that the bitwise shift is always performed safely on a 64-bit unsigned long long type, regardless of the underlying architecture.
--- drivers/net/ethernet/wangxun/libwx/wx_type.h | 2 +- drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/wangxun/libwx/wx_type.h +1 -1
@@ -1427,7 +1427,7 @@ struct wx { };#define WX_INTR_ALL (~0ULL) -#define WX_INTR_Q (i) BIT((i)) +#define WX_INTR_Q (i) BIT_ULL((i))/* register operations */ #define wr32 (a, reg, value) writel((value), ((a)->hw_addr + (reg)))
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h +1 -1
@@ -303,7 +303,7 @@ struct txgbe_fdir_filter {#define TXGBE_DEFAULT_RX_WORK 128#endif -#define TXGBE_INTR_MISC (A ) BIT((A)->num_q_vectors) +#define TXGBE_INTR_MISC (A ) BIT_ULL((A)->num_q_vectors)#define TXGBE_INTR_QALL (A ) (TXGBE_INTR_MISC(A) - 1)#define TXGBE_MAX_EITR GENMASK(11, 3)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1781/1815 net: stmmac: selftests: Pass the IP proto mask in the TC selftest
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 9a56a27e6002e29a6707dc4238d469ec84c3a68e ]
The stmmac TC filtering rules have recently gained sanity checks to make sure the passed keys and their respective masks are aligned with the HW filtering abilities.
The stmmac selftests failed to pass the mask in the match data for L4 filtering tests, and are now failing consistently with -EINVAL :
$ ethtool -t eth1 [...] 23. L4 DA TCP Filtering -22 24. L4 SA TCP Filtering -22 25. L4 DA UDP Filtering -22 26. L4 SA UDP Filtering -22
Let's pass the ip_proto mask in the l4 filtering tests match data. Found on imx8mp, which now have passing L4 tests :
$ ethtool -t eth1 [...] 23. L4 DA TCP Filtering 0 24. L4 SA TCP Filtering 0 25. L4 DA UDP Filtering 0 26. L4 SA UDP Filtering 0
While at it, initialize the masks and keys to avoid re-using whatever was on the stack.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +4 -2
@@ -1452,11 +1452,11 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,struct {struct flow_dissector_key_basic bkey;struct flow_dissector_key_ports key; - }__aligned(BITS_PER_LONG / 8) keys; + }__aligned(BITS_PER_LONG / 8) keys = { };struct {struct flow_dissector_key_basic bmask;struct flow_dissector_key_ports mask; - }__aligned(BITS_PER_LONG / 8) masks; + }__aligned(BITS_PER_LONG / 8) masks = { };unsigned long dummy_cookie =0xdeadbeef ;struct stmmac_packet_attrs attr = { };struct flow_dissector *dissector;
@@ -1509,6 +1509,8 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, keys.bkey.ip_proto = udp ?IPPROTO_UDP :IPPROTO_TCP ; keys.key.src =htons (src); keys.key.dst =htons (dst); +/* Match the full IP proto field */ + masks.bmask.ip_proto =0xff ; masks.mask.src = src_mask; masks.mask.dst = dst_mask;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1742/1815 net/sched: act_ife: Only operate on Ethernet frames
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 5b483f7791b079bb97d411f1066652ff659207ff ]
act_ife encapsulates/decapsulates the original Ethernet header and uses skb->dev->hard_header_len as the length of that header. That is only correct for Ethernet devices: on a device where hard_header_len does not match the L2 header that was actually pulled (PPP reports PPP_HDRLEN while nothing is stripped on ingress), the ingress skb_push()/skb_pull() use the wrong length and can hit skb_under_panic when headroom is tight.
IFE is Ethernet-only by design - it builds an outer ethhdr, rewrites h_source/h_dest/h_proto, and calls eth_type_trans() on decode - so instead of trying to make the offsets work for arbitrary link types, simply drop packets that do not carry an Ethernet header.
Checking skb->dev->type alone is not enough. We have to cater for a corner case where mirred can redirect an skb from a non-Ethernet device to an Ethernet one, and skb->dev then says nothing about the framing the skb actually has: an skb redirected from ppp0 reaches the target's ingress hook with mac_len 0 and no Ethernet header at all. So at ingress also require mac_len to be ETH_HLEN. On egress mac_len is not maintained, so the device type is all we have; a bogus redirect there yields a malformed frame rather than an out-of-bounds push, and it would be malformed with or without IFE.
That corner case is not theoretical - redirecting from ppp0 into a veth that has an ife encode action on its ingress hook panics without this patch:
skbuff: skb_under_panic: len:98 put:14 head:ffff88800e410000
data:ffff88800e40fff5 tail:0x57 end:0x640 dev:veth3 kernel BUG at net/core/skbuff.c:214! Call Trace: skb_push (net/core/skbuff.c:224 net/core/skbuff.c:2657) tcf_ife_act (net/sched/act_ife.c:829 net/sched/act_ife.c:874) tc_run (net/core/dev.c:4463) netif_receive_skb (net/core/dev.c:6463 net/core/dev.c:6522) tcf_mirred_to_dev (net/sched/act_mirred.c:248 net/sched/act_mirred.c:328) tcf_mirred_act (net/sched/act_mirred.c:489) tc_run (net/core/dev.c:4463) process_backlog (net/core/dev.c:6728)
With Ethernet framing guaranteed, use ETH_HLEN instead of hard_header_len.
--- net/ife/ife.c | 14 +++++++------- net/sched/act_ife.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 11 deletions(-)
net/ife/ife.c +7 -7
@@ -37,7 +37,7 @@ void *ife_encode(struct sk_buff *skb, u16 metalen)* where ORIGDATA = original ethernet header ... */ int hdrm = metalen +IFE_METAHDRLEN ; -int total_push = hdrm + skb->dev->hard_header_len; +int total_push = hdrm +ETH_HLEN ;struct ifeheadr *ifehdr;struct ethhdr *iethh;/* inner ether header */ int skboff =0 ;
@@ -50,9 +50,9 @@ void *ife_encode(struct sk_buff *skb, u16 metalen) iethh = (struct ethhdr *) skb->data;__skb_push (skb, total_push); -memcpy (skb->data, iethh, skb->dev->hard_header_len); +memcpy (skb->data, iethh,ETH_HLEN );skb_reset_mac_header (skb); - skboff += skb->dev->hard_header_len; + skboff +=ETH_HLEN ;/* total metadata length */ ifehdr = (struct ifeheadr *) (skb->data + skboff);
@@ -69,12 +69,12 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen)int total_pull;u16 ifehdrln; -if (!pskb_may_pull (skb, skb->dev->hard_header_len +IFE_METAHDRLEN )) +if (!pskb_may_pull (skb,ETH_HLEN +IFE_METAHDRLEN ))return NULL ; - ifehdr = (struct ifeheadr *) (skb->data + skb->dev->hard_header_len); + ifehdr = (struct ifeheadr *)(skb->data +ETH_HLEN ); ifehdrln =ntohs (ifehdr->metalen); - total_pull = skb->dev->hard_header_len + ifehdrln; + total_pull =ETH_HLEN + ifehdrln;if (unlikely (ifehdrln <2 ))return NULL ;
@@ -82,7 +82,7 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen)if (unlikely (!pskb_may_pull (skb, total_pull +ETH_HLEN )))return NULL ; - ifehdr = (struct ifeheadr *)(skb->data + skb->dev->hard_header_len); + ifehdr = (struct ifeheadr *)(skb->data +ETH_HLEN );skb_set_mac_header (skb, total_pull);__skb_pull (skb, total_pull); *metalen = ifehdrln -IFE_METAHDRLEN ;
net/sched/act_ife.c +28 -4
@@ -28,6 +28,7 @@#include <uapi/linux/tc_act/tc_ife.h> #include <net/tc_act/tc_ife.h> #include <linux/etherdevice.h> +#include <linux/if_arp.h> #include <net/ife.h> #include <net/tc_wrapper.h>
@@ -723,7 +724,7 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a,tcf_lastuse_update (&ife->tcf_tm);if (skb_at_tc_ingress (skb)) -skb_push (skb, skb->dev->hard_header_len); +skb_push (skb,ETH_HLEN ); tlv_data =ife_decode (skb, &metalen);if (unlikely (!tlv_data)) {
@@ -795,7 +796,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,where ORIGDATA = original ethernet header ... */ u16 metalen =ife_get_sz (skb, p); -int hdrm = metalen + skb->dev->hard_header_len +IFE_METAHDRLEN ; +int hdrm = metalen +ETH_HLEN +IFE_METAHDRLEN ;unsigned int skboff =0 ;int new_len = skb->len + hdrm;bool exceed_mtu = false;
@@ -826,7 +827,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, }if (skb_at_tc_ingress (skb)) -skb_push (skb, skb->dev->hard_header_len); +skb_push (skb,ETH_HLEN ); ife_meta =ife_encode (skb, metalen);if (!ife_meta)
@@ -856,11 +857,27 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a, oethh->h_proto =htons (p->eth_type);if (skb_at_tc_ingress (skb)) -skb_pull (skb, skb->dev->hard_header_len); +skb_pull (skb,ETH_HLEN );return action; } +/* IFE encapsulates the original Ethernet header and, on decode, expects to +* find one, so it can only ever work on skbs that carry one. Loopback carries +* Ethernet header as well, so it qualifies here. +* At ingress, also verify that the L2 header about to be pushed back really +* is an Ethernet header because the skb could've been redirected with mirred +* from a non-Ethernet device. +*/ +static bool tcf_ife_is_eth_skb (const struct sk_buff *skb) +{ +if (skb->dev->type !=ARPHRD_ETHER && + skb->dev->type !=ARPHRD_LOOPBACK ) +return false; + +return !skb_at_tc_ingress (skb) || skb->mac_len ==ETH_HLEN ; +} + TC_INDIRECT_SCOPE int tcf_ife_act(struct sk_buff *skb,const struct tc_action *a,struct tcf_result *res)
@@ -869,6 +886,13 @@ TC_INDIRECT_SCOPE int tcf_ife_act(struct sk_buff *skb,struct tcf_ife_params *p;int ret; +if (unlikely (!tcf_ife_is_eth_skb (skb))) { +bstats_update (this_cpu_ptr (ife->common.cpu_bstats), skb); +tcf_lastuse_update (&ife->tcf_tm); +qstats_cpu_drop_inc (ife->common.cpu_qstats); +return TC_ACT_SHOT ; + } + p =rcu_dereference_bh (ife->params);if (p->flags &IFE_ENCODE ) { ret =tcf_ife_encode (skb, a, res, p);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1743/1815 net: mana: Cap MSI-X vectors to the device MSI-X table size
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 2c7493f980140a5c40eb4f98f97c557193a2c330 ]
mana_gd_query_max_resources() sizes gc->num_msix_usable from resp.max_msix and the CPU count, but never from the device MSI-X table. On a 1792 vCPU M-series VM that yields 1793 while the table has 1024 entries, and mana_gd_setup_remaining_irqs() then walks indices 1..1792, running off the end of the region mapped by msix_map_region():
BUG: unable to handle page fault for address: ff8e347f8b99800c RIP: 0010:msix_prepare_msi_desc+0x7a/0x90 RAX: 0000000000004000 RBX: ff4330cb164ea780 RCX: ff8e347f8b998000 Call Trace: <TASK> __msi_domain_alloc_irqs+0x13a/0x440 msi_domain_alloc_irq_at+0x149/0x1b0 mana_gd_setup+0x351/0x890 mana_gd_probe+0x274/0x390 </TASK>
RAX is index 1024 * PCI_MSIX_ENTRY_SIZE, one entry past the table.
msi_insert_desc() does range check the index, but only against the MSI domain hwsize, which matches the table only for devices on an MSI parent domain. With a global PCI/MSI domain hwsize is MSI_XA_DOMAIN_SIZE, so nothing bounds the request.
Cap num_msix_usable with pci_msix_vec_count().
--- .../net/ethernet/microsoft/mana/gdma_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/microsoft/mana/gdma_main.c +19 -0
@@ -180,6 +180,7 @@ static int mana_gd_query_max_resources(struct pci_dev *pdev)struct gdma_query_max_resources_resp resp = {};struct gdma_general_req req = {};unsigned int max_num_queues; +unsigned int msix_vec_count;u8 bm_hostmode;u16 num_ports;int err;
@@ -216,6 +217,24 @@ static int mana_gd_query_max_resources(struct pci_dev *pdev) gc->num_msix_usable =min (resp.max_msix,num_online_cpus () +1 ); } +/* MSI-X vectors are allocated by index into the device MSI-X table, so +* never ask for more than the table holds. It can be smaller than both +* resp.max_msix and the CPU count. +*/ + err =pci_msix_vec_count (pdev); +if (err <=0 ) { +dev_err (gc->dev,"Failed to query MSI-X table size: %d\n" , err); +return err <0 ? err : -ENOSPC ; + } + msix_vec_count = err; + +if (gc->num_msix_usable > msix_vec_count) { +dev_info (gc->dev, +"Limiting MSI-X vectors from %u to table size %u\n" , + gc->num_msix_usable, msix_vec_count); + gc->num_msix_usable = msix_vec_count; + } +if (gc->num_msix_usable <=1 )return -ENOSPC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1744/1815 net/rds: use wq_has_sleeper() in rds_cong_map_updated()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
[ Upstream commit d4f484661961636eb90d287050959e613795f73a ]
rds_cong_map_updated() runs after a peer's congestion map has been rewritten (by rds_tcp_cong_recv() and rds_ib_cong_recv(), or the clear-all in the loopback and IB send-completion paths). It bumps rds_cong_generation and then checks waitqueue_active() on map->m_waitq and on rds_poll_waitq to decide whether anyone needs waking. atomic_inc() carries no ordering and waitqueue_active() is a plain load, so nothing orders the map and generation stores before the wait queue reads. The waiters do the mirror image: rds_cong_wait() adds itself to m_waitq and then tests the port bit, and rds_poll() registers on rds_poll_waitq and then reads the generation. That is the store-buffering pattern described above waitqueue_active() in include/linux/wait.h - the updater can observe an empty wait queue while the waiter still observes the port as congested, and no wake-up is issued.
rds_cong_wait() is an interruptible sleep with no timeout, so a sender blocked on a congested port stays blocked until the next congestion update from that peer arrives or a signal is delivered. A poll() waiter misses the map-updated notification the same way.
Use wq_has_sleeper(), which is waitqueue_active() preceded by the required full barrier, as rds_tcp_state_change() already does for the same pattern.
--- net/rds/cong.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rds/cong.c +2 -2
@@ -256,9 +256,9 @@ void rds_cong_map_updated(struct rds_cong_map *map, uint64_t portmask) map, &map->m_addr);rds_stats_inc (s_cong_update_received);atomic_inc (&rds_cong_generation); -if (waitqueue_active (&map->m_waitq)) +if (wq_has_sleeper (&map->m_waitq))wake_up (&map->m_waitq); -if (waitqueue_active (&rds_poll_waitq)) +if (wq_has_sleeper (&rds_poll_waitq))wake_up_all (&rds_poll_waitq);if (portmask && !list_empty (&rds_cong_monitor)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1745/1815 octeontx2-pf: fix NULL deref of af_xdp_zc_qidx on rep setup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit b09a0503c755b6609fad59a84cc7f05b6843a03c ]
af_xdp_zc_qidx tracks receive queues using AF_XDP zero-copy and is allocated during PF/VF probe. Representors and other non-AF_XDP paths leave the pointer NULL, but several call sites used test_bit() on it unconditionally.
Switching to devlink eswitch mode creates representors and runs otx2_init_hw_resources(), which reaches otx2_pool_aq_init() and oopses when dereferencing the NULL bitmap. Add NULL checks before every af_xdp_zc_qidx test_bit() use in the RSS, ethtool, XSK, and pool init paths.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 6 ++++-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 3 ++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4 -2
@@ -333,7 +333,8 @@ int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32 *ind_tbl)/* Get memory to put this msg */ for (idx =0 ; idx < rss->rss_size; idx++) {/* Ignore the queue if AF_XDP zero copy is enabled */ -if (test_bit (ind_tbl[idx], pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (ind_tbl[idx], pfvf->af_xdp_zc_qidx))continue ; aq =otx2_mbox_alloc_msg_nix_aq_enq (mbox);
@@ -1510,7 +1511,8 @@ int otx2_pool_aq_init(struct otx2_nic *pfvf, u16 pool_id,if (type !=AURA_NIX_RQ )return 0 ; -if (!test_bit (pool_id, pfvf->af_xdp_zc_qidx)) { +if (!pfvf->af_xdp_zc_qidx || + !test_bit (pool_id, pfvf->af_xdp_zc_qidx)) { pp_params.order =get_order (buf_size); pp_params.flags =PP_FLAG_DMA_MAP ; pp_params.pool_size =min (OTX2_PAGE_POOL_SZ , numptrs);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +2 -1
@@ -939,7 +939,8 @@ static int otx2_get_rxfh(struct net_device *dev,for (idx =0 ; idx < rss->rss_size; idx++) {/* Ignore if the rx queue is AF_XDP zero copy enabled */ -if (test_bit (rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx))continue ; indir[idx] = rss->ind_tbl[idx]; }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c +2 -1
@@ -193,7 +193,8 @@ int otx2_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)void otx2_attach_xsk_buff (struct otx2_nic *pfvf,struct otx2_snd_queue *sq,int qidx) { -if (test_bit (qidx, pfvf->af_xdp_zc_qidx)) +if (pfvf->af_xdp_zc_qidx && +test_bit (qidx, pfvf->af_xdp_zc_qidx)) sq->xsk_pool =xsk_get_pool_from_qid (pfvf->netdev, qidx); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1746/1815 octeontx2-af: fix cn20k mailbox lifetime on repeated rvu_mbox_init()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sai Krishna <[email protected]>
[ Upstream commit 3b11a77f69980932c3924054d66e565c9a135747 ]
rvu_mbox_init() is called separately for AF-PF mailboxes during probe and for AF-VF mailboxes when SR-IOV is enabled. Each call used to allocate a new ng_rvu object, leaking the first allocation when the pointer was overwritten on the second call.
Sharing one ng_rvu across both paths exposed several teardown bugs:
the error path freed all cn20k mailbox DMA and kfree()d ng_rvu even when only the failing init type should be unwound, leaving live AF-PF mailbox memory in use after an AF-VF init failure. mutex_init() was also re-run on the AF-VF path while AF-PF mailbox handlers could still hold rvu->mbox_lock. Probe and SR-IOV failure paths did not release cn20k mailbox DMA either, since cleanup only happened in rvu_remove().
Allocate ng_rvu once with devm_kzalloc(), initialize mbox_lock in the same block, unwind only the mailbox memory for the failing init type, and free cn20k mailbox DMA from the probe and pci_enable_sriov() error paths.
--- .../ethernet/marvell/octeontx2/af/cn20k/api.h | 1 + .../marvell/octeontx2/af/cn20k/mbox_init.c | 21 +++++++++- .../net/ethernet/marvell/octeontx2/af/rvu.c | 39 +++++++++++-------- 3 files changed, 42 insertions(+), 19 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h +1 -0
@@ -21,6 +21,7 @@ int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int num);int cn20k_rvu_get_mbox_regions (struct rvu *rvu,void **mbox_addr,int num,int type,unsigned long *pf_bmap);void cn20k_free_mbox_memory (struct rvu *rvu); +void cn20k_free_mbox_memory_type (struct rvu *rvu,int type);int cn20k_register_afpf_mbox_intr (struct rvu *rvu);int cn20k_register_afvf_mbox_intr (struct rvu *rvu,int pf_vec_start);void cn20k_rvu_enable_mbox_intr (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c +19 -2
@@ -335,13 +335,30 @@ int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int ndevs)return rvu_alloc_mbox_memory (rvu, type, ndevs,MBOX_SIZE ); } +void cn20k_free_mbox_memory_type (struct rvu *rvu,int type) +{ +if (!is_cn20k (rvu->pdev) || !rvu->ng_rvu) +return ; + +switch (type) { +case TYPE_AFPF : +qmem_free (rvu->dev, rvu->ng_rvu->pf_mbox_addr); + rvu->ng_rvu->pf_mbox_addr =NULL ; +break ; +case TYPE_AFVF : +qmem_free (rvu->dev, rvu->ng_rvu->vf_mbox_addr); + rvu->ng_rvu->vf_mbox_addr =NULL ; +break ; + } +} +void cn20k_free_mbox_memory (struct rvu *rvu) {if (!is_cn20k (rvu->pdev))return ; -qmem_free (rvu->dev, rvu->ng_rvu->pf_mbox_addr); -qmem_free (rvu->dev, rvu->ng_rvu->vf_mbox_addr); +cn20k_free_mbox_memory_type (rvu,TYPE_AFPF ); +cn20k_free_mbox_memory_type (rvu,TYPE_AFVF ); }void cn20k_rvu_disable_afvf_intr (struct rvu *rvu,int vfs)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +22 -17
@@ -2585,12 +2585,6 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,if (!pf_bmap)return -ENOMEM ; - ng_rvu_mbox =kzalloc_obj (*ng_rvu_mbox); -if (!ng_rvu_mbox) { - err = -ENOMEM ; - goto free_bitmap; - } -/* RVU VFs */ if (type ==TYPE_AFVF )bitmap_set (pf_bmap,0 , num);
@@ -2604,15 +2598,22 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, } } - rvu->ng_rvu = ng_rvu_mbox; +if (!rvu->ng_rvu) { + ng_rvu_mbox =devm_kzalloc (rvu->dev,sizeof (*ng_rvu_mbox),GFP_KERNEL ); +if (!ng_rvu_mbox) { + err = -ENOMEM ; + goto free_bitmap; + } + + rvu->ng_rvu = ng_rvu_mbox; - rvu->ng_rvu->rvu_mbox_ops = &rvu_mbox_ops; + rvu->ng_rvu->rvu_mbox_ops = &rvu_mbox_ops; +mutex_init (&rvu->mbox_lock); + } err =cn20k_rvu_mbox_init (rvu, type, num);if (err) - goto free_mem; - -mutex_init (&rvu->mbox_lock); + goto free_bitmap; mbox_regions =kcalloc (num,sizeof (void __iomem *),GFP_KERNEL );if (!mbox_regions) {
@@ -2702,14 +2703,18 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, free_regions:kfree (mbox_regions); free_qmem: -cn20k_free_mbox_memory (rvu); -free_mem: -kfree (rvu->ng_rvu); +cn20k_free_mbox_memory_type (rvu, type); free_bitmap:bitmap_free (pf_bmap);return err; } +static void rvu_free_cn20k_mbox_memory (struct rvu *rvu) +{ +if (is_cn20k (rvu->pdev)) +cn20k_free_mbox_memory (rvu); +} +static void rvu_mbox_destroy (struct mbox_wq_info *mw) {struct otx2_mbox *mbox = &mw->mbox;
@@ -3519,6 +3524,7 @@ static int rvu_enable_sriov(struct rvu *rvu)if (err) {rvu_disable_afvf_intr (rvu);rvu_mbox_destroy (&rvu->afvf_wq_info); +cn20k_free_mbox_memory_type (rvu,TYPE_AFVF );return err; }
@@ -3681,6 +3687,7 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_mbox:rvu_mbox_destroy (&rvu->afpf_wq_info); err_hwsetup: +rvu_free_cn20k_mbox_memory (rvu);rvu_cgx_exit (rvu);rvu_fwdata_exit (rvu);rvu_mcs_exit (rvu);
@@ -3723,9 +3730,7 @@ static void rvu_remove(struct pci_dev *pdev)pci_set_drvdata (pdev,NULL );devm_kfree (&pdev->dev, rvu->hw); -if (is_cn20k (rvu->pdev)) -cn20k_free_mbox_memory (rvu); -kfree (rvu->ng_rvu); +rvu_free_cn20k_mbox_memory (rvu);devm_kfree (&pdev->dev, rvu);atomic_set (&device_bound,0 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1737/1815 net: enetc: extract common helpers for MAC hash filter configuration
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 0ce10770963e7b4bf252fe0f0283326504bcbb36 ]
The PSIUMHFR and PSIMMHFR registers in ENETC v4 have the same bit layout as in ENETC v1. The only difference between the two hardware generations is the register address offsets.
Since the register functionality is identical, the MAC hash filter configuration code can be shared between the ENETC v1 and v4 drivers. Extract two new common helper functions, enetc_set_si_uc_hash_filter() and enetc_set_si_mc_hash_filter(), into enetc_pf_common.c. These helpers select the correct register offset based on the hardware revision via is_enetc_rev1().
Remove v1-specific enetc_clear_mac_ht_flt() and enetc_set_mac_ht_flt() from enetc_pf.c, and v4-specific enetc4_pf_set_si_uc_hash_filter() and enetc4_pf_set_si_mc_hash_filter() from enetc4_pf.c, as they are now superseded by the shared implementations.
Stable-dep-of: fa1a8457b858 ("net: enetc: restore RX ring congestion mode for ENETC v4")
--- .../net/ethernet/freescale/enetc/enetc4_pf.c | 43 +++++++--------- .../net/ethernet/freescale/enetc/enetc_pf.c | 51 +++++-------------- .../freescale/enetc/enetc_pf_common.c | 40 +++++++++++++++ .../freescale/enetc/enetc_pf_common.h | 2 + 4 files changed, 73 insertions(+), 63 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +17 -26
@@ -75,20 +75,6 @@ static void enetc4_pf_get_si_primary_mac(struct enetc_hw *hw, int si,put_unaligned_le16 (lower, addr +4 ); } -static void enetc4_pf_set_si_uc_hash_filter (struct enetc_hw *hw,int si, -u64 hash) -{ -enetc_port_wr (hw,ENETC4_PSIUMHFR0 (si),lower_32_bits (hash)); -enetc_port_wr (hw,ENETC4_PSIUMHFR1 (si),upper_32_bits (hash)); -} - -static void enetc4_pf_set_si_mc_hash_filter (struct enetc_hw *hw,int si, -u64 hash) -{ -enetc_port_wr (hw,ENETC4_PSIMMHFR0 (si),lower_32_bits (hash)); -enetc_port_wr (hw,ENETC4_PSIMMHFR1 (si),upper_32_bits (hash)); -} -static void enetc4_pf_set_loopback (struct net_device *ndev,bool en) {struct enetc_ndev_priv *priv =netdev_priv (ndev);
@@ -147,11 +133,12 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)int max_num_mfe = pf->caps.mac_filter_num;struct enetc_mac_filter mac_filter = {};struct net_device *ndev = pf->si->ndev; -struct enetc_hw *hw = &pf->si->hw;struct enetc_mac_addr *mac_tbl; +struct enetc_si *si = pf->si;struct netdev_hw_addr *ha;int i =0 , err;int mac_cnt; +u64 hash;netif_addr_lock_bh (ndev);
@@ -159,7 +146,7 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)if (!mac_cnt) {netif_addr_unlock_bh (ndev);/* clear both MAC hash and exact filters */ -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );enetc4_pf_clear_maft_entries (pf);return 0 ;
@@ -186,11 +173,13 @@ static int enetc4_pf_set_uc_exact_filter(struct enetc_pf *pf)/* Set temporary unicast hash filters in case of Rx loss when * updating MAC address filter table */ -enetc4_pf_set_si_uc_hash_filter (hw,0 , *mac_filter.mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter.mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_uc_hash_filter (si,0 , hash);enetc4_pf_clear_maft_entries (pf);if (!enetc4_pf_add_maft_entries (pf, mac_tbl, i)) -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );kfree (mac_tbl);
@@ -206,8 +195,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type) {struct net_device *ndev = pf->si->ndev;struct enetc_mac_filter *mac_filter; -struct enetc_hw *hw = &pf->si->hw; +struct enetc_si *si = pf->si;struct netdev_hw_addr *ha; +u64 hash;netif_addr_lock_bh (ndev);if (type &ENETC_MAC_FILTER_TYPE_UC ) {
@@ -216,8 +206,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type)netdev_for_each_uc_addr (ha, ndev)enetc_add_mac_addr_ht_filter (mac_filter, ha->addr); -enetc4_pf_set_si_uc_hash_filter (hw,0 , - *mac_filter->mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter->mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_uc_hash_filter (si,0 , hash); }if (type &ENETC_MAC_FILTER_TYPE_MC ) {
@@ -226,8 +217,9 @@ static void enetc4_pf_set_mac_hash_filter(struct enetc_pf *pf, int type)netdev_for_each_mc_addr (ha, ndev)enetc_add_mac_addr_ht_filter (mac_filter, ha->addr); -enetc4_pf_set_si_mc_hash_filter (hw,0 , - *mac_filter->mac_hash_table); +bitmap_to_arr64 (&hash, mac_filter->mac_hash_table, +ENETC_MADDR_HASH_TBL_SZ ); +enetc_set_si_mc_hash_filter (si,0 , hash); }netif_addr_unlock_bh (ndev); }
@@ -480,7 +472,6 @@ static void enetc4_psi_do_set_rx_mode(struct work_struct *work) struct enetc_si *si = container_of(work, struct enetc_si, rx_mode_task);struct enetc_pf *pf =enetc_si_priv (si);struct net_device *ndev = si->ndev; -struct enetc_hw *hw = &si->hw;bool uc_promisc = false;bool mc_promisc = false;int type =0 ;
@@ -501,12 +492,12 @@ static void enetc4_psi_do_set_rx_mode(struct work_struct *work)enetc_set_si_mc_promisc (si,0 , mc_promisc);if (uc_promisc) { -enetc4_pf_set_si_uc_hash_filter (hw,0 ,0 ); +enetc_set_si_uc_hash_filter (si,0 ,0 );enetc4_pf_clear_maft_entries (pf); }if (mc_promisc) -enetc4_pf_set_si_mc_hash_filter (hw,0 ,0 ); +enetc_set_si_mc_hash_filter (si,0 ,0 );/* Set new MAC filter */ enetc4_pf_set_mac_filter (pf, type);
drivers/net/ethernet/freescale/enetc/enetc_pf.c +14 -37
81 lines not on this page · raw message
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +40 -0
@@ -131,6 +131,46 @@ void enetc_set_si_mc_promisc(struct enetc_si *si, int si_id, bool promisc) }EXPORT_SYMBOL_GPL (enetc_set_si_mc_promisc); +void enetc_set_si_uc_hash_filter (struct enetc_si *si,int si_id,u64 hash) +{ +int psiumhfr0_off, psiumhfr1_off; +struct enetc_hw *hw = &si->hw; + +if (is_enetc_rev1 (si)) { +bool err = si->errata &ENETC_ERR_UCMCSWP ; + + psiumhfr0_off =ENETC_PSIUMHFR0 (si_id, err); + psiumhfr1_off =ENETC_PSIUMHFR1 (si_id); + }else { + psiumhfr0_off =ENETC4_PSIUMHFR0 (si_id); + psiumhfr1_off =ENETC4_PSIUMHFR1 (si_id); + } + +enetc_port_wr (hw, psiumhfr0_off,lower_32_bits (hash)); +enetc_port_wr (hw, psiumhfr1_off,upper_32_bits (hash)); +} +EXPORT_SYMBOL_GPL (enetc_set_si_uc_hash_filter); + +void enetc_set_si_mc_hash_filter (struct enetc_si *si,int si_id,u64 hash) +{ +int psimmhfr0_off, psimmhfr1_off; +struct enetc_hw *hw = &si->hw; + +if (is_enetc_rev1 (si)) { +bool err = si->errata &ENETC_ERR_UCMCSWP ; + + psimmhfr0_off =ENETC_PSIMMHFR0 (si_id, err); + psimmhfr1_off =ENETC_PSIMMHFR1 (si_id); + }else { + psimmhfr0_off =ENETC4_PSIMMHFR0 (si_id); + psimmhfr1_off =ENETC4_PSIMMHFR1 (si_id); + } + +enetc_port_wr (hw, psimmhfr0_off,lower_32_bits (hash)); +enetc_port_wr (hw, psimmhfr1_off,upper_32_bits (hash)); +} +EXPORT_SYMBOL_GPL (enetc_set_si_mc_hash_filter); +void enetc_pf_netdev_setup (struct enetc_si *si,struct net_device *ndev,const struct net_device_ops *ndev_ops) {
drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +2 -0
@@ -19,6 +19,8 @@ int enetc_vlan_rx_del_vid(struct net_device *ndev, __be16 prot, u16 vid);int enetc_init_sriov_resources (struct enetc_pf *pf);void enetc_set_si_uc_promisc (struct enetc_si *si,int si_id,bool promisc);void enetc_set_si_mc_promisc (struct enetc_si *si,int si_id,bool promisc); +void enetc_set_si_uc_hash_filter (struct enetc_si *si,int si_id,u64 hash); +void enetc_set_si_mc_hash_filter (struct enetc_si *si,int si_id,u64 hash);static inline u16 enetc_get_ip_revision (struct enetc_hw *hw) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1783/1815 drm/xe/xe_gt_idle: Add CCS to the powergating info print
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Balasubramani Vivekanandan <[email protected]>
[ Upstream commit 369ba0d1efe91cccabe98ae53c53b7425f327edf ]
While reading the main GT powergating info from debugfs, include both RCS and CCS engine masks.
--- drivers/gpu/drm/xe/xe_gt_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_idle.c +2 -1
@@ -248,7 +248,8 @@ int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p) pg_status =xe_mmio_read32 (>->mmio,POWERGATE_DOMAIN_STATUS ); } -if (gt->info.engine_mask &XE_HW_ENGINE_RCS_MASK ) { +if (gt->info.engine_mask & + (XE_HW_ENGINE_RCS_MASK |XE_HW_ENGINE_CCS_MASK )) {drm_printf (p,"Render Power Gating Enabled: %s\n" ,str_yes_no (pg_enabled &RENDER_POWERGATE_ENABLE ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1792/1815 selftests/arm64: Fix MTE prctl TAP plan
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit bb52892f9234e4ecd982fa51222aab33ce282f79 ]
The MTE prctl test emits one result from check_basic_read() followed by one result for each of the seven entries in mte_modes[]. However, the TAP plan only accounts for the array entries, producing:
# Planned tests != run tests (7 != 8)
Include the basic read check in the plan so that all eight emitted results are declared.
--- tools/testing/selftests/arm64/mte/check_prctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/mte/check_prctl.c +1 -1
@@ -119,7 +119,7 @@ int main(void)int i;ksft_print_header (); -ksft_set_plan (ARRAY_SIZE (mte_modes)); +ksft_set_plan (ARRAY_SIZE (mte_modes) +1 );check_basic_read ();for (i =0 ; i <ARRAY_SIZE (mte_modes); i++)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1793/1815 net: airoha: npu: fix missing streaming DMA mask
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Pawlik <[email protected]>
[ Upstream commit 6fe7e31a45e3418a39e6343a85126124feec1c2f ]
The driver calls dma_set_coherent_mask() but never dma_set_mask(), leaving the streaming DMA mask at the bus default. On the non-coherent EN7581 platform (Cortex-A53), this causes the NPU mailbox to hang after approximately 41 calls when using streaming DMA mappings.
Replace dma_set_coherent_mask() with dma_set_mask_and_coherent() to set both the streaming and coherent DMA masks, matching standard driver practice.
--- drivers/net/ethernet/airoha/airoha_npu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_npu.c +1 -1
@@ -766,7 +766,7 @@ static int airoha_npu_probe(struct platform_device *pdev) npu->irqs[i] = irq; } - err =dma_set_coherent_mask (dev,DMA_BIT_MASK (32 )); + err =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ));if (err)return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1794/1815 drm/xe/uapi: Add additional error components to xe drm_ras
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riana Tauro <[email protected]>
[ Upstream commit cdeb5e248de11537cf23cd5174f6c55bab2e850b ]
Add additional Error components supported by XE drm_ras (Reliability, Availability and Serviceability).
Stable-dep-of: a62212b35a21 ("drm/xe/sysctrl: Read mailbox phase bit from hardware")
--- include/uapi/drm/xe_drm.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
include/uapi/drm/xe_drm.h +10 -1
@@ -2589,6 +2589,12 @@ enum drm_xe_ras_error_component {DRM_XE_RAS_ERR_COMP_CORE_COMPUTE =1 ,/** @DRM_XE_RAS_ERR_COMP_SOC_INTERNAL: SoC Internal Error */ DRM_XE_RAS_ERR_COMP_SOC_INTERNAL , +/** @DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY: Device Memory Error */ +DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY , +/** @DRM_XE_RAS_ERR_COMP_PCIE: PCIe Subsystem Error */ +DRM_XE_RAS_ERR_COMP_PCIE , +/** @DRM_XE_RAS_ERR_COMP_FABRIC: Fabric Subsystem Error */ +DRM_XE_RAS_ERR_COMP_FABRIC ,/** @DRM_XE_RAS_ERR_COMP_MAX: Max Error */ DRM_XE_RAS_ERR_COMP_MAX /* non-ABI */ };
@@ -2606,7 +2612,10 @@ enum drm_xe_ras_error_component {*/ #define DRM_XE_RAS_ERROR_COMPONENT_NAMES { \ [DRM_XE_RAS_ERR_COMP_CORE_COMPUTE] = "core-compute", \ - [DRM_XE_RAS_ERR_COMP_SOC_INTERNAL] = "soc-internal" \ + [DRM_XE_RAS_ERR_COMP_SOC_INTERNAL] = "soc-internal", \ + [DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY] = "device-memory", \ + [DRM_XE_RAS_ERR_COMP_PCIE] = "pcie", \ + [DRM_XE_RAS_ERR_COMP_FABRIC] = "fabric", \ }#if defined(__cplusplus)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1795/1815 drm/xe/xe_ras: Add support to get error counter value
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riana Tauro <[email protected]>
[ Upstream commit fe48a86980798ffc78c8713ec964877c8594610d ]
Add request/response structures and helper functions to query system controller to get error counter value.
Stable-dep-of: a62212b35a21 ("drm/xe/sysctrl: Read mailbox phase bit from hardware")
--- drivers/gpu/drm/xe/xe_ras.c | 91 +++++++++++++++++++ drivers/gpu/drm/xe/xe_ras.h | 3 + drivers/gpu/drm/xe/xe_ras_types.h | 26 ++++++ drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 28 ++++++ drivers/gpu/drm/xe/xe_sysctrl_mailbox.h | 3 + drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + 6 files changed, 153 insertions(+)
drivers/gpu/drm/xe/xe_ras.c +91 -0
@@ -4,11 +4,14 @@*/ #include "xe_device.h" +#include "xe_pm.h" #include "xe_printk.h" #include "xe_ras.h" #include "xe_ras_types.h" #include "xe_sysctrl.h" #include "xe_sysctrl_event_types.h" +#include "xe_sysctrl_mailbox.h" +#include "xe_sysctrl_mailbox_types.h" /* Severity of detected errors */ enum xe_ras_severity {
@@ -50,6 +53,36 @@ static const char *const xe_ras_components[] = { };static_assert (ARRAY_SIZE (xe_ras_components) ==XE_RAS_COMP_MAX ); +static u8 drm_to_xe_ras_severity (u8 severity) +{ +switch (severity) { +case DRM_XE_RAS_ERR_SEV_CORRECTABLE : +return XE_RAS_SEV_CORRECTABLE ; +case DRM_XE_RAS_ERR_SEV_UNCORRECTABLE : +return XE_RAS_SEV_UNCORRECTABLE ; +default : +return XE_RAS_SEV_NOT_SUPPORTED ; + } +} + +static u8 drm_to_xe_ras_component (u8 component) +{ +switch (component) { +case DRM_XE_RAS_ERR_COMP_CORE_COMPUTE : +return XE_RAS_COMP_CORE_COMPUTE ; +case DRM_XE_RAS_ERR_COMP_SOC_INTERNAL : +return XE_RAS_COMP_SOC_INTERNAL ; +case DRM_XE_RAS_ERR_COMP_DEVICE_MEMORY : +return XE_RAS_COMP_DEVICE_MEMORY ; +case DRM_XE_RAS_ERR_COMP_PCIE : +return XE_RAS_COMP_PCIE ; +case DRM_XE_RAS_ERR_COMP_FABRIC : +return XE_RAS_COMP_FABRIC ; +default : +return XE_RAS_COMP_NOT_SUPPORTED ; + } +} +static inline const char *sev_to_str (u8 severity) {if (severity >=XE_RAS_SEV_MAX )
@@ -91,3 +124,61 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, comp_to_str(component), sev_to_str(severity)); } } + +static int get_counter (struct xe_device *xe,struct xe_ras_error_class *counter,u32 *value) +{ +struct xe_ras_get_counter_response response = {0 }; +struct xe_ras_get_counter_request request = {0 }; +struct xe_sysctrl_mailbox_command command = {0 }; +struct xe_ras_error_common *common; +size_t rlen; +int ret; + + request.counter = *counter; + +xe_sysctrl_create_command (&command,XE_SYSCTRL_GROUP_GFSP ,XE_SYSCTRL_CMD_GET_COUNTER , + &request,sizeof (request), &response,sizeof (response)); + + ret =xe_sysctrl_send_command (&xe->sc, &command, &rlen); +if (ret) { +xe_err (xe,"sysctrl: failed to get counter %d\n" , ret); +return ret; + } + +if (rlen !=sizeof (response)) { +xe_err (xe,"sysctrl: unexpected get counter response length %zu (expected %zu)\n" , + rlen,sizeof (response)); +return -EIO ; + } + + common = &response.counter.common; + *value = response.value; + +xe_dbg (xe,"[RAS]: get counter %u for %s %s\n" , *value,comp_to_str (common->component), +sev_to_str (common->severity)); + +return 0 ; +} + +/** +* xe_ras_get_counter() - Get error counter value +* @xe: Xe device instance +* @severity: Error severity to be queried (&enum drm_xe_ras_error_severity) +* @component: Error component to be queried (&enum drm_xe_ras_error_component) +* @value: Counter value +* +* This function retrieves the value of a specific error counter based on +* the error severity and component. +* +* Return: 0 on success, negative error code on failure. +*/ +int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value) +{ +struct xe_ras_error_class counter = {0 }; + + counter.common.severity =drm_to_xe_ras_severity (severity); + counter.common.component =drm_to_xe_ras_component (component); + +guard (xe_pm_runtime)(xe); +return get_counter (xe, &counter, value); +}
drivers/gpu/drm/xe/xe_ras.h +3 -0
@@ -6,10 +6,13 @@#ifndef _XE_RAS_H_#define _XE_RAS_H_ +#include <linux/types.h> +struct xe_device ;struct xe_sysctrl_event_response ;void xe_ras_counter_threshold_crossed (struct xe_device *xe,struct xe_sysctrl_event_response *response); +int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value);#endif
drivers/gpu/drm/xe/xe_ras_types.h +26 -0
@@ -70,4 +70,30 @@ struct xe_ras_threshold_crossed { struct xe_ras_error_class counters[XE_RAS_NUM_COUNTERS]; } __packed; +/** +* struct xe_ras_get_counter_request - Request structure for get counter +*/ +struct xe_ras_get_counter_request { +/** @counter: Error counter to be queried */ +struct xe_ras_error_class counter; +/** @reserved: Reserved for future use */ +u32 reserved; +} __packed; + +/** +* struct xe_ras_get_counter_response - Response structure for get counter +*/ +struct xe_ras_get_counter_response { +/** @counter: Error counter that was queried */ +struct xe_ras_error_class counter; +/** @value: Current counter value */ +u32 value; +/** @timestamp: Timestamp when counter was last updated */ +u64 timestamp; +/** @threshold: Threshold value for the counter */ +u32 threshold; +/** @reserved: Reserved */ +u32 reserved[57 ]; +} __packed; +#endif
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c +28 -0
@@ -293,6 +293,34 @@ static int sysctrl_send_command(struct xe_sysctrl *sc,return 0 ; } +/** +* xe_sysctrl_create_command() - Create system controller command +* @command: Sysctrl command structure +* @group_id: Command group ID +* @cmd_id: Command ID +* @request: Pointer to request buffer (can be NULL) +* @request_len: Size of request buffer +* @response: Pointer to response buffer +* @response_len: Size of response buffer +* +* Helper function to create sysctrl command to be sent via %xe_sysctrl_send_command() +*/ +void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id, +void *request,size_t request_len,void *response, +size_t response_len) +{ +struct xe_sysctrl_app_msg_hdr header = {0 }; + + header.data =FIELD_PREP (APP_HDR_GROUP_ID_MASK , group_id) | +FIELD_PREP (APP_HDR_COMMAND_MASK , cmd_id); + + command->header = header; + command->data_in = request; + command->data_in_len = request_len; + command->data_out = response; + command->data_out_len = response_len; +} +/** * xe_sysctrl_mailbox_init - Initialize System Controller mailbox interface * @sc: System controller structure
drivers/gpu/drm/xe/xe_sysctrl_mailbox.h +3 -0
@@ -23,6 +23,9 @@ struct xe_sysctrl_mailbox_command;#define XE_SYSCTRL_APP_HDR_VERSION (hdr) \ FIELD_GET(APP_HDR_VERSION_MASK, (hdr)->data) +void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id, +void *request,size_t request_len,void *response, +size_t response_len);void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc); int xe_sysctrl_send_command(struct xe_sysctrl *sc, struct xe_sysctrl_mailbox_command *cmd,
drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +2 -0
@@ -22,9 +22,11 @@ enum xe_sysctrl_group {/** * enum xe_sysctrl_gfsp_cmd - Commands supported by GFSP group * +* @XE_SYSCTRL_CMD_GET_COUNTER: Get error counter value * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event */ enum xe_sysctrl_gfsp_cmd { +XE_SYSCTRL_CMD_GET_COUNTER =0x03 ,XE_SYSCTRL_CMD_GET_PENDING_EVENT =0x07 , };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1796/1815 drm/xe/sysctrl: Read mailbox phase bit from hardware
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anoop Vijay <[email protected]>
[ Upstream commit a62212b35a214c2ff3bd1c785a440d7ad8205ec9 ]
The mailbox PHASE bit in SYSCTRL_MB_CTRL is toggled per-message and was tracked in software as sc->phase_bit, reset to 0 on error paths. If the cached value ever drifts from what the hardware last saw, all following messages carry the wrong phase and get silently misread by firmware.
Drop the cache and read PHASE directly from SYSCTRL_MB_CTRL before each frame instead, removing xe_sysctrl_mailbox_init() and its call sites along with it.
--- drivers/gpu/drm/xe/xe_sysctrl.c | 7 +------ drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 22 ++++------------------ drivers/gpu/drm/xe/xe_sysctrl_mailbox.h | 1 - drivers/gpu/drm/xe/xe_sysctrl_types.h | 3 --- 4 files changed, 5 insertions(+), 28 deletions(-)
drivers/gpu/drm/xe/xe_sysctrl.c +1 -6
@@ -85,7 +85,6 @@ int xe_sysctrl_init(struct xe_device *xe)return ret; xe->soc_remapper.set_sysctrl_region (xe,SYSCTRL_MAILBOX_INDEX ); -xe_sysctrl_mailbox_init (sc);INIT_WORK (&sc->work, xe_sysctrl_work);return devm_add_action_or_reset (xe->drm.dev, sysctrl_fini, xe);
@@ -114,12 +113,10 @@ void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl)* @xe: xe device instance * * Invoked during system resume (S3/S4 to S0) and runtime resume from D3cold. -* Restores SoC remapper configuration and reinitializes mailbox interface. +* Restores SoC remapper configuration. */ void xe_sysctrl_pm_resume (struct xe_device *xe) { -struct xe_sysctrl *sc = &xe->sc; -if (!xe->info.has_soc_remapper_sysctrl)return ;
@@ -127,6 +124,4 @@ void xe_sysctrl_pm_resume(struct xe_device *xe)return ; xe->soc_remapper.set_sysctrl_region (xe,SYSCTRL_MAILBOX_INDEX ); - -xe_sysctrl_mailbox_init (sc); }
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c +4 -18
@@ -145,6 +145,7 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,struct xe_device *xe =sc_to_xe (sc);u32 ctrl_reg, total_frames, frame;size_t bytes_sent, frame_size; +bool phase; total_frames =DIV_ROUND_UP (cmd_size,XE_SYSCTRL_MB_FRAME_SIZE );
@@ -153,7 +154,8 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,return -EBUSY ; } - sc->phase_bit ^=1 ; + ctrl_reg =xe_mmio_read32 (sc->mmio,SYSCTRL_MB_CTRL ); + phase = !(ctrl_reg &SYSCTRL_FRAME_PHASE ); bytes_sent =0 ;for (frame =0 ; frame < total_frames; frame++) {
@@ -161,7 +163,6 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,if (sysctrl_write_frame (sc, mbox_cmd + bytes_sent, frame_size)) {xe_err (xe,"sysctrl: Failed to write frame %u\n" , frame); - sc->phase_bit =0 ;return -EIO ; }
@@ -169,13 +170,12 @@ static int sysctrl_send_frames(struct xe_sysctrl *sc,REG_FIELD_PREP (SYSCTRL_FRAME_CURRENT_MASK , frame) |REG_FIELD_PREP (SYSCTRL_FRAME_TOTAL_MASK , total_frames -1 ) |SYSCTRL_MB_CTRL_CMD | - (sc->phase_bit ?SYSCTRL_FRAME_PHASE :0 ); + (phase ?SYSCTRL_FRAME_PHASE :0 );xe_mmio_write32 (sc->mmio,SYSCTRL_MB_CTRL , ctrl_reg);if (!sysctrl_wait_bit_clear (sc,SYSCTRL_MB_CTRL_RUN_BUSY , timeout_ms)) {xe_err (xe,"sysctrl: Frame %u acknowledgment timeout\n" , frame); - sc->phase_bit =0 ;return -ETIMEDOUT ; }
@@ -321,20 +321,6 @@ void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 gr command->data_out_len = response_len; } -/** -* xe_sysctrl_mailbox_init - Initialize System Controller mailbox interface -* @sc: System controller structure -* -* Initialize system controller mailbox interface for communication. -*/ -void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc) -{ -u32 ctrl_reg; - - ctrl_reg =xe_mmio_read32 (sc->mmio,SYSCTRL_MB_CTRL ); - sc->phase_bit = (ctrl_reg &SYSCTRL_FRAME_PHASE ) ?1 :0 ; -} -/** * xe_sysctrl_send_command() - Send mailbox command to System Controller * @sc: System Controller instance
drivers/gpu/drm/xe/xe_sysctrl_mailbox.h +0 -1
@@ -26,7 +26,6 @@ struct xe_sysctrl_mailbox_command;void xe_sysctrl_create_command (struct xe_sysctrl_mailbox_command *command,u8 group_id,u8 cmd_id,void *request,size_t request_len,void *response,size_t response_len); -void xe_sysctrl_mailbox_init (struct xe_sysctrl *sc);int xe_sysctrl_send_command (struct xe_sysctrl *sc,struct xe_sysctrl_mailbox_command *cmd,size_t *rdata_len);
drivers/gpu/drm/xe/xe_sysctrl_types.h +0 -3
@@ -26,9 +26,6 @@ struct xe_sysctrl {/** @cmd_lock: Mutex protecting mailbox command operations */ struct mutex cmd_lock; -/** @phase_bit: Message boundary phase toggle bit (0 or 1) */ -bool phase_bit; -/** @work: Pending events worker */ struct work_struct work;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1797/1815 net: stmmac: selftests: Check multiple MMC counters
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit d29b399150b07796dfa81d8778d4804c08c2a41d ]
The MMC counters report MAC statistics. Multiple counters can be enabled when the IP is integrated, however there's no way to know exactly which ones. Un-implemented counters seem to report 0.
It was found that on StarFive JH7110 and Amlogic SM1, the counter that's used by the selftest (mmc_tx_framecount_g) isn't implemented, triggering an MMC selftest failure.
Both the above SoCs seem to implement mmc_rx_framecount_gb, let's use this counter as well for MMC counter validation.
Note that this doesn't guarantee that we won't encounter the same issue again if another IP implements yet another set of counters that don't include that new one.
If the game of whack-a-mole with implemented counters becomes too hard to maintain, we may simply consider removing the MMC selftest entirely.
--- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +10 -4
@@ -415,11 +415,17 @@ static int stmmac_test_mmc(struct stmmac_priv *priv)stmmac_mmc_read (priv, priv->mmcaddr, &final);/* -* The number of MMC counters available depends on HW configuration -* so we just use this one to validate the feature. I hope there is -* not a version without this counter. +* The number of MMC counters available depends on HW configuration, +* and there doesn't seem to be a way to enumerate the implemented +* counters. +* +* Let's check a hand-picked set of counters, knowing that : +* - Starfive JH7110 doesn't implement mmc_tx_framecount_g +* - Amlogic SM1 doesn't implement any mmc_tx_* +* */ -if (final.mmc_tx_framecount_g <= initial.mmc_tx_framecount_g) +if (final.mmc_tx_framecount_g <= initial.mmc_tx_framecount_g && + final.mmc_rx_framecount_gb <= initial.mmc_rx_framecount_gb)return -EINVAL ;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1798/1815 net: stmmac: dwmac1000: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 9698b6da3714fd2ef47846cb63098d2b2d252e25 ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +1 -1
@@ -194,7 +194,7 @@ static void dwmac1000_set_filter(struct mac_device_info *hw,dwmac1000_set_mchash (ioaddr, mc_filter, mcbitslog2);/* Handle multiple unicast addresses (perfect filtering) */ -if (netdev_uc_count (dev) > perfect_addr_number) +if (netdev_uc_count (dev) +1 > perfect_addr_number)/* Switch to promiscuous mode if more than unicast * addresses are requested than supported by hardware. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1799/1815 net: stmmac: dwmac4: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 82187f42c014d22520b9c3c4e2cfb519223fb29b ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -521,7 +521,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, value |=GMAC_PACKET_FILTER_HPF ;/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) > hw->unicast_filter_entries) { +if (netdev_uc_count (dev) +1 > hw->unicast_filter_entries) {/* Switch to promiscuous mode if more than 128 addrs * are required */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1800/1815 net: stmmac: dwxgmac: Account for the primary MAC address for UC filtering
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 2739d6f9a2b8729b0d85cbe0dc93e1d68670b6f2 ]
The same filter slots are used to store the main MAC address as well as the address for the unicast filter. Let's account for that when deciding whether or not to use promisc when programming the UC list in hardware.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +1 -1
@@ -532,7 +532,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw,dwxgmac2_set_mchash (ioaddr, mc_filter, mcbitslog2);/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) > hw->unicast_filter_entries) { +if (netdev_uc_count (dev) +1 > hw->unicast_filter_entries) { value |=XGMAC_FILTER_PR ; }else {struct netdev_hw_addr *ha;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1801/1815 net: stmmac: selftests: Account for the UC filter list for filtering tests
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit cd8c3b2752c684141eab2282e294cae2971a9759 ]
On dwmac, one of the Unicast filter entries is used to store the local HW addr. This means that we have to use promisc mode for any kind of unicast filtering if we only have one slot in our unicast filter.
The number of slots available depends on how the IP is integrated, and we can't autodiscover how many of these slots we have available, so the DT property snps,perfect-filter-entries can be used to specify how many are available.
Most IP variants default to 1 if this isn't specified, which is the case for the amlogic variants (in this case, S905X3).
The stmmac selftests for UC filtering look if we have enough slots in the filter to store the dev->uc list, but doesn't account for the device's own MAC address. The dev->uc list's size we get with netdev_uc_count() also doesn't account for the HW addr.
As the selftest only requires one available slot, in the case of single-slot platforms, that means we erroneously consider we have enough room for the test, when we actually don't, and the filtering test fails.
--- .../stmicro/stmmac/stmmac_selftests.c | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +18 -3
@@ -499,6 +499,21 @@ static int stmmac_filter_check(struct stmmac_priv *priv)return -EOPNOTSUPP ; } +static int stmmac_uc_filter_check (struct stmmac_priv *priv) +{ +/* For tests involving the UC filter, we need at least one empty +* slot in the UC filter. The UC filters contains netdev_uc_count() + 1 +* entries: The dev->uc list + one entry for the HW address. +* +* Having an empty slot therefore means netdev_uc_count() + 2 entries +* can fit in the filter +*/ +if (netdev_uc_count (priv->dev) +2 > priv->hw->unicast_filter_entries) +return -EOPNOTSUPP ; + +return 0 ; +} +static bool stmmac_hash_check (struct stmmac_priv *priv,unsigned char *addr) {int mc_offset =32 - priv->hw->mcast_bits_log2;
@@ -590,7 +605,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;while (--tries) {
@@ -634,7 +649,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ;
@@ -680,7 +695,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; -if (netdev_uc_count (priv->dev) >= priv->hw->unicast_filter_entries) +if (stmmac_uc_filter_check (priv))return -EOPNOTSUPP ;if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins)return -EOPNOTSUPP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1784/1815 drm/xe: Reject page faults from non-fault-mode scratch VMs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 5e977521d21717edb8e91d004434697d6e3f248c ]
Having scratch enabled does not make a VM capable of handling recoverable page faults. Allowing scratch VMs through the ASID lookup also admits dma-fence mode VMs.
If such a VM faults on an already valid VMA, the handler reports success without fixing the fault, causing the GPU to retry indefinitely.
Only allow fault-mode VMs through the ASID lookup. Fault-mode VMs using scratch remain supported, while faults from 3D VMs are rejected.
--- drivers/gpu/drm/xe/xe_pagefault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pagefault.c +1 -1
@@ -158,7 +158,7 @@ static struct xe_vm *xe_pagefault_asid_to_vm(struct xe_device *xe, u32 asid)down_read (&xe->usm.lock); vm =xa_load (&xe->usm.asid_to_vm, asid); -if (vm && (xe_vm_in_fault_mode (vm) ||xe_vm_has_scratch (vm))) +if (vm &&xe_vm_in_fault_mode (vm))xe_vm_get (vm);else vm =ERR_PTR (-EINVAL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1802/1815 net: stmmac: selftests: Dont test flow control for small rx fifos
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 96e8cb5527ce50c024a8e2d22d2bfedeccaf97d0 ]
On dwmac1000, dwmac4 and dwxgmac, we only emit pause frames if there's at least 4096 bytes in each queue's fifo.
The phylink mac capabilities are still MAC_ASYM_PAUSE | MAC_SYM_PAUSE as otherwise we won't be able to negotiate 'rx on' pause. ASYM only will prevent negotiating 'rx off tx on', while SYM only doesn't really matche the reality (not symmetric if we can only do RX pause).
--- .../ethernet/stmicro/stmmac/stmmac_selftests.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +13 -3
@@ -759,12 +759,24 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)struct phy_device *phydev = priv->dev->phydev;u32 rx_cnt = priv->plat->rx_queues_to_use;struct stmmac_test_priv *tpriv; +unsigned int rx_fifo_size;unsigned int pkt_count;int i, ret =0 ;if (!phydev || (!phydev->pause && !phydev->asym_pause))return -EOPNOTSUPP ; + rx_fifo_size = priv->plat->rx_fifo_size; +if (!rx_fifo_size) + rx_fifo_size = priv->dma_cap.rx_fifo_size; + +/* No pause frame is emitted if we don't have at least 4096 bytes per +* queue, except on dwmac100. +*/ +if (priv->plat->core_type !=DWMAC_CORE_MAC100 && + rx_fifo_size / priv->plat->rx_queues_to_use <4096 ) +return -EOPNOTSUPP ; + tpriv =kzalloc_obj (*tpriv);if (!tpriv)return -ENOMEM ;
@@ -778,9 +790,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)dev_add_pack (&tpriv->pt);/* Compute minimum number of packets to make FIFO full */ - pkt_count = priv->plat->rx_fifo_size; -if (!pkt_count) - pkt_count = priv->dma_cap.rx_fifo_size; + pkt_count = rx_fifo_size; pkt_count /=1400 ; pkt_count *=2 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1803/1815 net: stmmac: drop gso_enabled_types and rely on netdev features
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 9c24a504a3af1acb96da8d6a45a373fda8a9c687 ]
The gso_enabled_types field is used by stmmac_xmit() to decide whether a GSO skb should be passed to stmmac_tso_xmit(). It is updated in stmmac_set_features() based solely on NETIF_F_TSO, so disabling IPv4 TSO while keeping IPv6 TSO (NETIF_F_TSO6) enabled zeroes the mask. As a result IPv6 GSO frames, which the networking stack still generates since NETIF_F_TSO6 is enabled, fall through to the non-TSO xmit path where they are not handled.
The networking stack already manages the GSO logic: a GSO skb is only delivered to the driver when the matching offload feature (NETIF_F_TSO, NETIF_F_TSO6 or NETIF_F_GSO_UDP_L4) is enabled, otherwise the frame is segmented in software before reaching ndo_start_xmit(). stmmac_features_check() also validates each GSO frame against the TSO hardware constraints and falls back to software GSO when they are not met.
Drop the gso_enabled_types field and rely on skb_is_gso() in stmmac_xmit() instead, which correctly routes IPv6 GSO frames to the TSO path when NETIF_F_TSO is disabled. This also removes the data race between stmmac_set_gso_types(), called from the feature-set path, and the lockless read of gso_enabled_types in stmmac_xmit().
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +------------------ 2 files changed, 1 insertion(+), 20 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +0 -2
@@ -265,8 +265,6 @@ struct stmmac_priv {u32 rx_coal_frames[MTL_MAX_RX_QUEUES ];int hwts_tx_en; -/* skb_shinfo(skb)->gso_type types that we handle */ -unsigned int gso_enabled_types;bool tx_path_in_lpi_mode;bool sph_active;bool sph_capable;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -18
@@ -4376,18 +4376,6 @@ static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue)stmmac_set_queue_tx_tail_ptr (priv, tx_q, queue, tx_q->cur_tx); } -static void stmmac_set_gso_types (struct stmmac_priv *priv,bool tso) -{ -if (!tso) { - priv->gso_enabled_types =0 ; - }else { -/* Manage oversized TCP frames for GMAC4 device */ - priv->gso_enabled_types =SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ; -if (priv->plat->core_type ==DWMAC_CORE_GMAC4 ) - priv->gso_enabled_types |=SKB_GSO_UDP_L4 ; - } -} -static void stmmac_set_gso_features (struct net_device *ndev) {struct stmmac_priv *priv =netdev_priv (ndev);
@@ -4421,8 +4409,6 @@ static void stmmac_set_gso_features(struct net_device *ndev)if (priv->plat->core_type ==DWMAC_CORE_GMAC4 ) ndev->hw_features |=NETIF_F_GSO_UDP_L4 ; -stmmac_set_gso_types (priv, true); -dev_info (priv->device,"TSO feature enabled\n" ); }
@@ -4770,8 +4756,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)stmmac_stop_sw_lpi (priv); -if (skb_is_gso (skb) && -skb_shinfo (skb)->gso_type & priv->gso_enabled_types) +if (skb_is_gso (skb))return stmmac_tso_xmit (skb, dev); if (priv->est && priv->est->enable &&
@@ -6203,8 +6188,6 @@ static int stmmac_set_features(struct net_device *netdev,stmmac_enable_sph (priv, priv->ioaddr, sph_en, chan); } -stmmac_set_gso_types (priv, features &NETIF_F_TSO ); -if (features &NETIF_F_HW_VLAN_CTAG_RX ) priv->hw->hw_vlan_en = true;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1804/1815 net: stmmac: restore NET_IP_ALIGN in the RX DMA offset
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pascal Kneuper <[email protected]>
[ Upstream commit 23680bf5f8c69c923546b84a8e6c401bef8b88fe ]
Since the RX path was converted to zero-copy, the page pool page is handed to the stack directly as the skb head, and the offset the DMA engine writes at is what determines the alignment of the packet headers.
Before the conversion the payload was copied into an skb obtained from napi_alloc_skb(), which reserves NET_SKB_PAD + NET_IP_ALIGN. The conversion moved the headroom into stmmac_rx_offset() but did not carry over NET_IP_ALIGN, so on architectures where NET_IP_ALIGN is 2 the IP header now lands misaligned:
64 (NET_SKB_PAD) + 14 (ethernet) + 20 (IP) = 98
Same for the XDP branch:
256 (XDP_PACKET_HEADROOM) + 14 (ethernet) + 20 (IP) = 290
On ARM32 this is fatal, because ldm and ldrd trap on unaligned addresses even when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set.
Any received echo request panics the machine, e.g:
Unhandled fault: alignment exception (0x001) at 0x81873062
Internal error: : 1 [#1] SMP ARM Hardware name: Altera SOCFPGA Arria10 PC is at icmp_echo+0x38/0xa8 LR is at icmp_rcv+0x22c/0x370 Call trace: icmp_echo from icmp_rcv+0x22c/0x370 icmp_rcv from ip_protocol_deliver_rcu+0x2c/0x224 ip_protocol_deliver_rcu from ip_local_deliver+0xc8/0x1a0 ip_local_deliver from ip_sublist_rcv_finish+0x3c/0x50 ip_sublist_rcv_finish from ip_list_rcv_finish+0x110/0x118 ip_list_rcv_finish from ip_list_rcv+0xc8/0xdc ip_list_rcv from __netif_receive_skb_list_core+0x170/0x1c0 ... napi_complete_done from stmmac_napi_poll_rx+0xcb0/0x1030 Code: e24dd068 e59020a0 e28dc010 e0822001 (e8920003) Kernel panic - not syncing: Fatal exception in interrupt
The faulting instruction is the ldm of *icmp_hdr(skb) in icmp_echo().
Fix by adding NET_IP_ALIGN back to the RX offset, which restores the alignment the stack used to get.
Note that commit a955318fe67e ("stmmac: align RX buffers") made a similar change in 2021 and was reverted by commit 12d125b4574b ("stmmac: Revert "stmmac: align RX buffers"") because it caused packet corruption. That patch raised the offset from 0 without adjusting the buffer size accounting, so the DMA engine could arguably write past the end of the RX buffers, though this was never root caused.
Commit df542f669307 ("net: stmmac: Switch to zero-copy in non-XDP RX path") since derives the page pool allocation from stmmac_rx_offset(), so the extra bytes are accounted for.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -1531,9 +1531,9 @@ static void stmmac_display_rings(struct stmmac_priv *priv,static unsigned int stmmac_rx_offset (struct stmmac_priv *priv) {if (stmmac_xdp_is_enabled (priv)) -return XDP_PACKET_HEADROOM ; +return XDP_PACKET_HEADROOM +NET_IP_ALIGN ; -return NET_SKB_PAD ; +return NET_SKB_PAD +NET_IP_ALIGN ; }static int stmmac_set_bfsize (int mtu)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1805/1815 net: dsa: mxl862xx: enable assisted learning on CPU port
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edoardo Pinci <[email protected]>
[ Upstream commit 88c71cc0ad9800d8814bd3627b21a0da9028e057 ]
The MxL862xx driver enables FDB isolation but does not enable assisted learning on the CPU port. Consequently, MAC addresses learned through a physical switch port are not updated in hardware when the corresponding station moves to a foreign bridge port, such as a Wi-Fi interface.
The stale hardware FDB entry continues directing return traffic toward the original physical port. Traffic entering that same port is then filtered instead of being forwarded to the CPU and software bridge. This causes downstream unicast traffic, including DHCP OFFER and ACK packets, to disappear after a client roams to a local wireless interface. The client eventually considers the connection unusable and disconnects.
Enable assisted CPU-port learning so DSA installs foreign bridge FDB entries on the CPU port. This keeps the hardware FDB synchronized with the software bridge and allows return traffic to reach locally attached Wi-Fi clients after roaming.
Tested on a BPI R4 PRO with a MxL862xx switch and a BE14000 WiFi interface.
- Without patch, wired uplink on lan6 port (mxl path)
Wifi clients connect but roam away not getting DHCP offers
- Without patch, wired uplink on wan port (no mxl path)
Wifi clients connect and roam successfully
- With this patch, uplink on lan6 (mxl path)
Wifi clients connect and roam successfully
--- drivers/net/dsa/mxl862xx/mxl862xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mxl862xx/mxl862xx.c +1 -0
@@ -2111,6 +2111,7 @@ static int mxl862xx_probe(struct mdio_device *mdiodev) ds->ops = &mxl862xx_switch_ops; ds->phylink_mac_ops = &mxl862xx_phylink_mac_ops; ds->num_ports =MXL862XX_MAX_PORTS ; + ds->assisted_learning_on_cpu_port = true; ds->fdb_isolation = true; ds->max_num_bridges =MXL862XX_MAX_BRIDGES ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1806/1815 net/sched: bound qdisc_pkt_len to prevent qdisc soft lockup
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 8f735d64382dcf162f4276d6699d03ad2f859c0b ]
qdisc_get_stab() accepts a user-supplied size table, and __qdisc_calculate_pkt_len() amplifies qdisc_pkt_len() through the overhead, the size-table data (u16), and size_log (up to STAB_SIZE_LOG_MAX). A crafted stab can therefore set qdisc_pkt_len() to ~1 GiB for an ordinary skb. Per-flow deficit schedulers such as DRR and ETS replenish one quantum per loop iteration; with a tiny quantum (1) they spin billions of times under the qdisc lock, producing a soft lockup / RCU stall as illustrated by [email protected].
Cap the final qdisc_pkt_len() to QDISC_PKT_LEN_MAX so the size-table amplification cannot drive deficit schedulers into an unbounded loop. A legitimate size table (e.g. qfq's overhead 999999999, which is handled by dropping) is still accepted.
Introduce cap QDISC_PKT_LEN_MAX (1 << 20) = 1 MiB which is well above any legitimate single-skb wire length: the largest current skb->len is GSO_MAX_SIZE (524280), and an ATM-style size table (53/48 cell tax) amplifies that to ~578 KB, both comfortably below 1 MiB. At the same time, 1 MiB bounds the deficit refill loop to ~1M iterations per packet with quantum=1, which completes in a few milliseconds well under the demonstrated softlockup threshold (~10^9 iterations).
Conditions to recreate the bug:
- CONFIG_NET_SCHED=y, CONFIG_NET_SCH_DRR=y (or CONFIG_NET_SCH_ETS=y).
- Attach a DRR (or ETS) root qdisc with a crafted TCA_STAB that amplifies qdisc_pkt_len to ~1 GiB (e.g. size_log=15, data=[32768]).
- Add a class with a tiny quantum of 1 and send one small packet; the deficit loop spins billions of times under the qdisc lock and trips the softlockup detector (panic with kernel.softlockup_panic=1).
- Reachable as root or from an unprivileged user in a fresh user+net namespace (unshare -Urn) with namespace-local CAP_NET_ADMIN.
--- include/net/pkt_sched.h | 1 + net/sched/sch_api.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/pkt_sched.h +1 -0
@@ -12,6 +12,7 @@#define DEFAULT_TX_QUEUE_LEN 1000#define STAB_SIZE_LOG_MAX 30 +#define QDISC_PKT_LEN_MAX (1 << 20)/* 1 MiB */ struct qdisc_walker {int stop;
net/sched/sch_api.c +5 -2
@@ -610,8 +610,11 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb, pkt_len <<= stab->szopts.size_log; out: -if (unlikely (pkt_len <1 )) - pkt_len =1 ; +/* A size table can inflate qdisc_pkt_len() beyond any real packet +* (via overhead, the data table, or size_log); cap it so deficit +* schedulers such as DRR/ETS terminate their refill loops. +*/ + pkt_len =clamp_t (int, pkt_len,1 ,QDISC_PKT_LEN_MAX );qdisc_skb_cb (skb)->pkt_len = pkt_len; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1807/1815 slip: remove slip_hangup() to fix use-after-free in slip_receive_buf()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 23c53269f2baaedf2d92784290cb9ef6db2a3bce ]
Jaeyoung Chung and Eulgyu Kim reported a slab-use-after-free read in slip_receive_buf() when racing against tty hangup.
tty_ldisc_hangup() calls ld->ops->hangup() while holding only a read lock on tty->ldisc_sem (via tty_ldisc_ref()). Because slip_hangup() simply called slip_close(), it ran concurrently with reader functions such as slip_receive_buf().
slip_close() unregisters and frees the net device and its private struct slip, causing concurrent reader threads in slip_receive_buf() to dereference freed memory.
Line discipline close() is already guaranteed to be called under the write lock of tty->ldisc_sem during hangup processing (in tty_ldisc_reinit() or tty_ldisc_kill()).
Remove slip_hangup() so teardown is serialized cleanly by slip_close().
--- drivers/net/slip/slip.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/net/slip/slip.c +0 -8
@@ -886,8 +886,6 @@ static int slip_open(struct tty_struct *tty)* Close down a SLIP channel. * This means flushing out any pending queues, and then returning. This * call is serialized against other ldisc functions. -* -* We also use this method fo a hangup event */ static void slip_close (struct tty_struct *tty)
@@ -915,11 +913,6 @@ static void slip_close(struct tty_struct *tty)unregister_netdev (sl->dev);/* sl_uninit() has dropped the slip_devs[] entry by now */ } - -static void slip_hangup (struct tty_struct *tty) -{ -slip_close (tty); -}/************************************************************************ * STANDARD SLIP ENCAPSULATION * ************************************************************************/
@@ -1280,7 +1273,6 @@ static struct tty_ldisc_ops sl_ldisc = { .name = "slip", .open = slip_open, .close = slip_close, - .hangup = slip_hangup, .ioctl = slip_ioctl, .receive_buf = slip_receive_buf, .write_wakeup = slip_write_wakeup,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1808/1815 net: fec: only stop PTP if it was initialized
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit dd890ae29299636fb037276fc1b5238698d08b03 ]
fec_ptp_init() is only called when fep->bufdesc_ex is available. However, fec_probe() unconditionally calls fec_ptp_stop() on the failed_init path, and fec_drv_remove() unconditionally calls fec_ptp_stop() during device removal.
Check fep->bufdesc_ex before calling fec_ptp_stop() in both paths to avoid stopping PTP when it was not initialized.
--- drivers/net/ethernet/freescale/fec_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +4 -2
@@ -5457,7 +5457,8 @@ fec_probe(struct platform_device *pdev) failed_irq:fec_enet_deinit (ndev); failed_init: -fec_ptp_stop (pdev); +if (fep->bufdesc_ex) +fec_ptp_stop (pdev); failed_reset:pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -5499,7 +5500,8 @@ fec_drv_remove(struct platform_device *pdev) ERR_PTR(ret));cancel_work_sync (&fep->tx_timeout_work); -fec_ptp_stop (pdev); +if (fep->bufdesc_ex) +fec_ptp_stop (pdev);unregister_netdev (ndev);fec_enet_mii_remove (fep);if (fep->reg_phy)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1809/1815 usb: atm: usbatm: fix invalid ci_range initialization
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit a60fd8c6dbaa76da4163cf225ed2b9e982540f39 ]
syzbot reported a shift-out-of-bounds in __vcc_connect():
UBSAN: shift-out-of-bounds in net/atm/common.c:382:32 shift exponent -1 is negative CPU: 0 UID: 0 PID: 5987 Comm: syz.0.18 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026 Call Trace: <TASK> dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233 __ubsan_handle_shift_out_of_bounds+0x36d/0x400 lib/ubsan.c:494 __vcc_connect+0x14b4/0x19c0 net/atm/common.c:382 vcc_connect+0x328/0x8f0 net/atm/common.c:498 pvc_bind+0x272/0x380 net/atm/pvc.c:52 __sys_bind+0x2e3/0x410 net/socket.c:1976 __x64_sys_bind+0x7a/0x90 net/socket.c:1979 ...
ATM device ci_range fields (vpi_bits and vci_bits) represent the number of bits supported for VPI and VCI addressing on the device. net/atm/common.c directly uses these fields as bit shift counts:
vpi >> dev->ci_range.vpi_bits
vci >> dev->ci_range.vci_bits
1 << vcc->dev->ci_range.vpi_bits
1 << vcc->dev->ci_range.vci_bits
usbatm_atm_init() sets ci_range.vpi_bits and ci_range.vci_bits to ATM_CI_MAX (-1), which is defined in <uapi/linux/atmdev.h> as a sentinel value for userspace ATM_SETCIRANGE requests, not a valid bit count. Shifting by -1 is undefined behavior and triggers UBSAN warnings.
ATM UNI cell headers allow up to 8 bits for VPI (0..255) and 16 bits for VCI (0..65535). Initialize vpi_bits to 8 and vci_bits to 16, as done by solos-pci.
--- drivers/usb/atm/usbatm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/atm/usbatm.c +2 -2
@@ -917,8 +917,8 @@ static int usbatm_atm_init(struct usbatm_data *instance) instance->atm_dev = atm_dev; - atm_dev->ci_range.vpi_bits =ATM_CI_MAX ; - atm_dev->ci_range.vci_bits =ATM_CI_MAX ; + atm_dev->ci_range.vpi_bits =8 ; + atm_dev->ci_range.vci_bits =16 ; atm_dev->signal =ATM_PHY_SIG_UNKNOWN ;/* temp init ATM device, set to 128kbit */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1810/1815 tcp: fix corruption of urgent data on multi-segment retransmit
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit ce2b807f42ed5e55567b8864ab72963f90779270 ]
On the normal xmit path, while in urgent mode we refuse to build a multi-segment TSO packet, so every segment gets its own urg_ptr:
/* tcp_write_xmit() */ limit = mss_now; if (tso_segs > 1 && !tcp_urg_mode(tp)) limit = tcp_mss_split_point(...);
The retransmit path has no such guard. __tcp_retransmit_skb() builds a segs > 1 skb and hands it to the GSO layer, which only advances th->seq per segment and copies urg_ptr verbatim:
/* __tcp_retransmit_skb() */ len = cur_mss * segs; /* segs > 1, no urg_mode check */ ... /* tcp_gso_segment(): bumps seq only, urg_ptr is copied */
urg_ptr is an offset from the segment's own seq, so a copied value points at a different place on each segment. The receiver rebuilds the absolute urgent seq as seg.seq + urg_ptr, so it walks a moving urgent point instead of the one OOB byte:
seg1 seq 1 urg_ptr 5001 -> urgent @ 5001 (ok) seg2 seq 1001 urg_ptr 5001 -> urgent @ 6001 (wrong, +MSS) seg3 seq 2001 urg_ptr 5001 -> urgent @ 7001 (wrong, +2*MSS)
The real OOB byte is never pointed at, so the receiver stops splicing it out and delivers it as normal in-band data, corrupting the stream.
Guard the retransmit length like the xmit path: keep segs = 1 while in urgent mode.
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -3603,7 +3603,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) avail_wnd = cur_mss; } - len = cur_mss * segs; + len = cur_mss * (tcp_urg_mode (tp) ?1 : segs);if (len > avail_wnd) { len =rounddown (avail_wnd, cur_mss);if (!len)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1811/1815 net/sched: sch_htb: limit htb_classify inner-class filter hops
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 729c4896ab829169f95915d65edd530325910b37 ]
htb_classify() follows each filter-selected inner class by switching to cl->filter_list, but never bounds the number of hops. A filter on an inner class can point back to itself or to another inner class that points back, creating an infinite loop in the packet classification path with the qdisc lock held and BH disabled — a soft lockup / panic from a single packet.
Bound the traversal with a hop counter and drop the packet with a rate-limited warning once the bound is exceeded. The counter is incremented at the point the inner filter chain is picked up, after the TC_ACT_* switch has consumed the classifier verdict, so a terminal TC_ACT_QUEUED/STOLEN/TRAP on the last permitted chain still sets *qerr to __NET_XMIT_STOLEN and the packet is not charged as a drop by this qdisc or its parent.
The bound is TC_HTB_MAXDEPTH, taken from HTB's own parameters rather than from the qdisc hierarchy depth limit. Class levels run from 0 to TC_HTB_MAXDEPTH - 1, so a traversal that strictly descends in level can take at most TC_HTB_MAXDEPTH hops. That descent is what a sane configuration does, but it is assumed here rather than enforced:htb_find() resolves a classid against every class in the qdisc, so a filter may equally select a sibling or an ancestor. The normal root -> inner -> leaf path takes a single hop, so the bound does not affect legitimate classification.
htb_classify() can now return NULL irrespective of CONFIG_NET_CLS_ACT, whereas previously every NULL return sat inside that ifdef. The NULL handler in htb_enqueue() therefore cannot stay conditional either, so drop the ifdef around it. This matches hfsc_enqueue(), which has always handled a NULL class unconditionally. Without it, a kernel built without actions would dereference a NULL class instead of dropping.
Conditions to recreate the bug:
- CONFIG_NET_SCHED, CONFIG_NET_SCH_HTB, CONFIG_NET_CLS_U32, CONFIG_LOCKUP_DETECTOR.
- Create an HTB qdisc on a device (e.g. lo), add an inner class 1:1 with a leaf child 1:10, install a root u32 filter selecting 1:1, and an inner-class u32 filter on 1:1 also selecting 1:1.
- Send one packet (ping). On the unfixed kernel the classify loop spins with the qdisc lock held; with softlockup_panic=1 it panics.
- Reachable from unprivileged user via unshare -Urn (CAP_NET_ADMIN).
--- net/sched/sch_htb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/sched/sch_htb.c +5 -2
@@ -224,6 +224,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,struct htb_class *cl;struct tcf_result res;struct tcf_proto *tcf; +unsigned int hops =0 ;int result;/* allow to select class by setting skb->priority to valid classid;
@@ -266,6 +267,10 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,if (!cl->level)return cl;/* we hit leaf; return it */ +if (++hops >TC_HTB_MAXDEPTH ) { +pr_warn_ratelimited ("htb: classify loop detected, dropping packet\n" ); +return NULL ; + }/* we have got inner class; apply inner filter chain */ tcf =rcu_dereference_bh (cl->filter_list); }
@@ -633,13 +638,11 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, }else {return qdisc_drop (skb, sch, to_free); } -#ifdef CONFIG_NET_CLS_ACT }else if (!cl) {if (ret & __NET_XMIT_BYPASS)qdisc_qstats_drop (sch);__qdisc_drop (skb, to_free);return ret; -#endif }else if ((ret =qdisc_enqueue (skb, cl->leaf.q, to_free)) !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (ret)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1785/1815 virtio-net: Ensure that TCP packets dont overflow gso_segs
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit c27c449d455aafd9018a3cbab150f1c42c87923f ]
The user can specify any gso_size in a packet crafted with an AF_PACKET PACKET_VNET_HDR socket, even smaller than TCP_MIN_GSO_SIZE = 8. At the same time, GSO_MAX_SIZE = 8 * GSO_MAX_SEGS = 8 * 65535. When the user crafts a packet with gso_size < 8, there is a risk for partial GSO to overflow the 16-bit gso_segs field when dividing the SKB length by gso_size.
Adjust gso_size of TCP packets to be at least TCP_MIN_GSO_SIZE = 8. Keep gso_size of UDP GSO packets, as gso_size=1 is valid and explicitly tested at tools/testing/selftests/net/tun.c:649.
--- include/linux/virtio_net.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/virtio_net.h +4 -0
@@ -6,6 +6,7 @@#include <linux/ip.h> #include <linux/ipv6.h> #include <linux/udp.h> +#include <net/tcp.h> #include <uapi/linux/tcp.h> #include <uapi/linux/virtio_net.h>
@@ -179,6 +180,9 @@ static inline int __virtio_net_hdr_to_skb(struct sk_buff *skb,if (skb->ip_summed ==CHECKSUM_PARTIAL && skb->csum_offset != offsetof(struct tcphdr , check))return -EINVAL ; + +BUILD_BUG_ON (TCP_MIN_GSO_SIZE *GSO_MAX_SEGS <GSO_MAX_SIZE ); + gso_size =max (gso_size,TCP_MIN_GSO_SIZE );break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1812/1815 dm-integrity: fix buffer overflow with keyed discard
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Cressey <[email protected]>
commit 59e6f919d77d72ec79cbf171256f2f7819737580 upstream.
Since commit 68c5c42567bc ("dm-integrity: replace forgeable discard filler with a keyed sector marker"), integrity_metadata computes a checksum for every discarded block into the "checksums" buffer. integrity_sector_checksum always writes the whole digest. So if the tag size is smaller than the digest size, the checksum of the last block that fits into the buffer is written past the end of it. For example, with hmac(sha256) and tag size 16, a 4MiB discard writes 16 bytes past the kmalloc'ed page.
Fix this by subtracting extra_space from the buffer size when computing max_blocks, like we do for writes.
--- drivers/md/dm-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-integrity.c +1 -1
@@ -1980,7 +1980,7 @@ static void integrity_metadata(struct woif (unlikely (dio->op ==REQ_OP_DISCARD )) {unsigned int bi_size = dio->bio_details.bi_iter.bi_size;unsigned int max_size =likely (checksums != checksums_onstack) ?PAGE_SIZE :HASH_MAX_DIGESTSIZE ; -unsigned int max_blocks = max_size / ic->tag_size; +unsigned int max_blocks = (max_size - extra_space) / ic->tag_size;sector_t sector = dio->range.logical_sector;if (!ic->discard_keyed)
Greg Kroah-Hartman
maintainerPATCH 1813/1815 Revert "esp: do not unref managed frag pages in esp_ssg_unref()"
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit 0fda52de8bbd4ca9a852c8a7ef6536cf82bd71fd ]
This reverts commit 21697720ff43b8dfa25b8e8d9ca7f56f4597fc80.
The patch does not fix the issue completely, so revert for now and wait for an updated version.
--- net/ipv4/esp4.c | 7 ------- net/ipv6/esp6.c | 7 ------- 2 files changed, 14 deletions(-)
net/ipv4/esp4.c +0 -7
@@ -104,13 +104,6 @@ static void esp_ssg_unref(struct xfrm_state *x, void *tmp, struct sk_buff *skb,struct aead_request *req;struct scatterlist *sg; -/* Managed frags are owned by the zerocopy ubuf; the skb holds no -* per-frag page reference, so we must not drop one here. Mirrors -* the SKBFL_MANAGED_FRAG_REFS handling in skb_release_data(). -*/ -if (skb_zcopy_managed (skb)) -return ; -if (x->props.flags &XFRM_STATE_ESN ) extralen +=sizeof (struct esp_output_extra );
net/ipv6/esp6.c +0 -7
@@ -121,13 +121,6 @@ static void esp_ssg_unref(struct xfrm_state *x, void *tmp, struct sk_buff *skb,struct aead_request *req;struct scatterlist *sg; -/* Managed frags are owned by the zerocopy ubuf; the skb holds no -* per-frag page reference, so we must not drop one here. Mirrors -* the SKBFL_MANAGED_FRAG_REFS handling in skb_release_data(). -*/ -if (skb_zcopy_managed (skb)) -return ; -if (x->props.flags &XFRM_STATE_ESN ) extralen +=sizeof (struct esp_output_extra );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1814/1815 tcp: reject non zerocopy devmem tx
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 125755776bc6d4dd53eaf551c87e3d460625d638 ]
Devmem tcp tx doesn't work without zero-copy, however it's not currently enforced if NETIF_F_SG isn't present. In this case, tcp_sendmsg_locked() will try the copy path and try to copy data from an iovec which consists of offsets into the dma-buf and would normally fail. Moreover, d9c56501c72fd ("net: tcp: block mixing readable and unreadable frags") relies on that and assumes that the devmem binding is present IFF we're using the zero-copy path, which can be used to mix net-iov and pages in a single skb, and break invariants. Let's reject devmem tx without zero-copy.
Note, the parameter check the patch is modifying is too loose, we can create an io_uring request with dmabuf_id and all ZC flags, but which won't have the binding. We replace it with stricter validation.
--- net/ipv4/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp.c +1 -2
@@ -1169,8 +1169,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) zc =MSG_SPLICE_PAGES ; } -if (!sockc_err && sockc.dmabuf_id && - (!(flags &MSG_ZEROCOPY ) || !sock_flag (sk,SOCK_ZEROCOPY ))) { +if (!sockc_err && sockc.dmabuf_id && (zc !=MSG_ZEROCOPY || !binding)) { err = -EINVAL ; goto out_err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1815/1815 net/sched: fq: clamp quantum and initial_quantum in change path
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 094cc07f98dfe70a34e2a1923af17fd29b8cf622 ]
The fq change path accepts TCA_FQ_QUANTUM in [1, INT_MAX] and TCA_FQ_INITIAL_QUANTUM up to INT_MAX, while fq_init() already clamps to [1, 1<<20]. A user can override the init clamp via tc qdisc change, restoring the small-quantum deficit spin that the init clamp prevents.
Narrow iq_range.max to 1<<20 so TCA_FQ_INITIAL_QUANTUM is rejected at parse time. Clamp TCA_FQ_QUANTUM to [256, 1<<20] in fq_change() and fq_init() quantum to [256, 1<<20] for tiny-MTU devices.
Conditions to recreate the bug:
CONFIG_NET_SCH_FQ=y. Requires CAP_NET_ADMIN (namespace-local via unshare -Urn suffices).
tc qdisc add dev dummy0 root fq
tc qdisc change dev dummy0 root fq quantum 1 stab data 32768 size_log 15 cell_log 0
--- net/sched/sch_fq.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
net/sched/sch_fq.c +5 -9
@@ -980,7 +980,7 @@ static int fq_resize(struct Qdisc *sch, u32 log) }static const struct netlink_range_validation iq_range = { - .max =INT_MAX , + .max =1 <<20 , };static const struct nla_policy fq_policy[TCA_FQ_MAX +1 ] = {
@@ -1106,14 +1106,10 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]));if (tb[TCA_FQ_QUANTUM ]) { -u32 quantum =nla_get_u32 (tb[TCA_FQ_QUANTUM ]); +u32 quantum =clamp_t (u32,nla_get_u32 (tb[TCA_FQ_QUANTUM ]), +256 ,1 <<20 ); -if (quantum >0 && quantum <= (1 <<20 )) { -WRITE_ONCE (q->quantum, quantum); - }else { -NL_SET_ERR_MSG_MOD (extack,"invalid quantum" ); - err = -EINVAL ; - } +WRITE_ONCE (q->quantum, quantum); }if (tb[TCA_FQ_INITIAL_QUANTUM ])
@@ -1232,7 +1228,7 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt, sch->limit =10000 ; q->flow_plimit =100 ; mtu =clamp_t (u32,psched_mtu (qdisc_dev (sch)),1 ,1 <<20 ); - q->quantum =min_t (u32,2 * mtu,1 <<20 ); + q->quantum =clamp_t (u32,2 * mtu,256 ,1 <<20 ); q->initial_quantum =min_t (u32,10 * mtu,1 <<20 ); q->flow_refill_delay =msecs_to_jiffies (40 ); q->flow_max_rate = ~0UL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1786/1815 netfilter: nf_tables: move hardware offload step after building the chain blob
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b1881d362e1924b66f6016c3efd28807032b41bf ]
Allocate the chain blob before the ruleset offload to reduce chances of entering an inconsistent state where the offloaded ruleset in the nic and the software ruleset differ.
--- net/netfilter/nf_tables_api.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +10 -4
@@ -10941,10 +10941,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)return -EAGAIN ; } - err =nft_flow_rule_offload_commit (net); -if (err <0 ) -return err; -/* 1. Allocate space for next generation rules_gen_X[] */ list_for_each_entry_safe (trans, next, &nft_net->commit_list, list) {struct nft_table *table = trans->table;
@@ -10969,6 +10965,16 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) } } +/* must be last, so audit and chain blob set up does not leave hardware +* in consistent state. +*/ + err =nft_flow_rule_offload_commit (net); +if (err <0 ) { +nf_tables_commit_chain_prepare_cancel (net); +nf_tables_commit_audit_free (&adl); +return err; + } +/* step 2. Make rules_gen_X visible to packet path */ list_for_each_entry (table, &nft_net->tables, list) {list_for_each_entry (chain, &table->chains, list)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1787/1815 netfilter: x_tables: replace pr_{info,err}() by pr_info_ratelimited()
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 793d9eda4821f75b5f7cc9e6a870b72a58b44c2b ]
Several xtables extension still use pr_err() or pr_info() without ratelimit.
For xt_cgroup, while at this, remove redundant "xt_cgroup:" prefix since pr_fmt is already set on.
--- net/netfilter/xt_cgroup.c | 12 ++++++------ net/netfilter/xt_hl.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
net/netfilter/xt_cgroup.c +6 -6
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("Xtables: process control group matching");MODULE_ALIAS ("ipt_cgroup" );MODULE_ALIAS ("ip6t_cgroup" ); -#define NET_CLS_CLASSID_INVALID_MSG "xt_cgroup: classid invalid without net_cls cgroups\n" +#define NET_CLS_CLASSID_INVALID_MSG "classid invalid without net_cls cgroups\n"static int cgroup_mt_check_v0 (const struct xt_mtchk_param *par) {
@@ -33,7 +33,7 @@ static int cgroup_mt_check_v0(const struct xt_mtchk_param *par)return -EINVAL ;if (!IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
@@ -49,7 +49,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par)return -EINVAL ;if (!info->has_path && !info->has_classid) { -pr_info ("xt_cgroup: no path or classid specified\n" ); +pr_info_ratelimited ("no path or classid specified\n" );return -EINVAL ; }
@@ -59,7 +59,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par) }if (info->has_classid && !IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
@@ -89,7 +89,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par)return -EINVAL ;if (!info->has_path && !info->has_classid) { -pr_info ("xt_cgroup: no path or classid specified\n" ); +pr_info_ratelimited ("no path or classid specified\n" );return -EINVAL ; }
@@ -99,7 +99,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par) }if (info->has_classid && !IS_ENABLED (CONFIG_CGROUP_NET_CLASSID )) { -pr_info (NET_CLS_CLASSID_INVALID_MSG ); +pr_info_ratelimited (NET_CLS_CLASSID_INVALID_MSG );return -EINVAL ; }
net/netfilter/xt_hl.c +2 -2
@@ -28,7 +28,7 @@ static int ttl_mt_check(const struct xt_mtchk_param *par)const struct ipt_ttl_info *info = par->matchinfo;if (info->mode >IPT_TTL_GT ) { -pr_err ("Unknown TTL match mode: %d\n" , info->mode); +pr_info_ratelimited ("Unknown TTL match mode: %d\n" , info->mode);return -EINVAL ; }
@@ -59,7 +59,7 @@ static int hl_mt6_check(const struct xt_mtchk_param *par)const struct ip6t_hl_info *info = par->matchinfo;if (info->mode >IP6T_HL_GT ) { -pr_err ("Unknown Hop Limit match mode: %d\n" , info->mode); +pr_info_ratelimited ("Unknown Hop Limit match mode: %d\n" , info->mode);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1788/1815 netfilter: nf_tables: skip double clone set expressions on element insert
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 43559058d21e0493aa220ac167e0279334dea5f9 ]
Both the dynset and newsetelem path clone the existing set expressions when setting set element expressions if no override expressions are provided. This results in a double clone, once to clone the template set expressions then another clone on the new element. Add a flag to annotate if userspace provides a override expression (ie. expression of the same type of the set but different configuration), otherwise borrow the existing expression from the set. Add conditionals to release expression iif they represent an override. Use this new override_exprs flag to dump the dynset expression override to userspace.
This simplifies the existing logic and it also fixes a bug with the connlimit expression which results in a module refcount imbalance WARNING splat when resorting on the default set expressions.
--- include/net/netfilter/nf_tables.h | 2 -- net/netfilter/nf_tables_api.c | 56 ++++++++++--------------------- net/netfilter/nft_dynset.c | 25 ++++++++------ 3 files changed, 33 insertions(+), 50 deletions(-)
include/net/netfilter/nf_tables.h +0 -2
@@ -870,8 +870,6 @@ struct nft_elem_priv *nft_set_elem_init(const struct nft_set *set, const u32 *key, const u32 *key_end, const u32 *data, u64 timeout, u64 expiration, gfp_t gfp); -int nft_set_elem_expr_clone (const struct nft_ctx *ctx,struct nft_set *set, -struct nft_expr *expr_array[]);void nft_set_elem_expr_destroy (const struct nft_ctx *ctx,struct nft_set_elem_expr *elem_expr); void nft_set_elem_destroy(const struct nft_set *set,
net/netfilter/nf_tables_api.c +18 -38
114 lines not on this page · raw message
net/netfilter/nft_dynset.c +15 -10
@@ -19,7 +19,8 @@ struct nft_dynset {u8 sreg_key;u8 sreg_data;bool invert; -bool expr; + bool expr:1, + override_exprs:1;u8 num_exprs;u64 timeout;struct nft_expr *expr_array[NFT_SET_EXPR_MAX ];
@@ -257,6 +258,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx, priv->num_exprs++; priv->expr_array[0 ] = dynset_expr; + priv->override_exprs = true; if (set->num_exprs > 1 || (set->num_exprs == 1 &&
@@ -289,6 +291,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx, } priv->expr_array[i] = dynset_expr; priv->num_exprs++; + priv->override_exprs = true;if (set->num_exprs) {if (i >= set->num_exprs) {
@@ -307,9 +310,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx, goto err_expr_free; } }else if (set->num_exprs >0 ) { - err =nft_set_elem_expr_clone (ctx, set, priv->expr_array); -if (err <0 ) -return err; +for (i =0 ; i < set->num_exprs; i++) + priv->expr_array[i] = set->exprs[i]; priv->num_exprs = set->num_exprs; }
@@ -339,8 +341,10 @@ static int nft_dynset_init(const struct nft_ctx *ctx,return 0 ; err_expr_free: -for (i =0 ; i < priv->num_exprs; i++) -nft_expr_destroy (ctx, priv->expr_array[i]); +if (priv->override_exprs) { +for (i =0 ; i < priv->num_exprs; i++) +nft_expr_destroy (ctx, priv->expr_array[i]); + }return err; }
@@ -367,9 +371,10 @@ static void nft_dynset_destroy(const struct nft_ctx *ctx,struct nft_dynset *priv =nft_expr_priv (expr);int i; -for (i =0 ; i < priv->num_exprs; i++) -nft_expr_destroy (ctx, priv->expr_array[i]); - +if (priv->override_exprs) { +for (i =0 ; i < priv->num_exprs; i++) +nft_expr_destroy (ctx, priv->expr_array[i]); + }nf_tables_destroy_set (ctx, priv->set); }
@@ -393,7 +398,7 @@ static int nft_dynset_dump(struct sk_buff *skb, nf_jiffies64_to_msecs(priv->timeout), NFTA_DYNSET_PAD)) goto nla_put_failure; -if (priv->set->num_exprs ==0 ) { +if (priv->set->num_exprs ==0 || priv->override_exprs) {if (priv->num_exprs ==1 ) {if (nft_expr_dump (skb,NFTA_DYNSET_EXPR , priv->expr_array[0 ], reset))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1789/1815 ALSA: control: Dont add invalid kcontrols to LED layer
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 74e3b979ce8b78a690f8b94ccf2e2c965f7f5c11 ]
The kcontrol LED state layer tries to track the all associated kcontrol elements with naive assumptions that they are readable. But one can create a write-only element that has no get callback (even a user element can do it), and this may lead to a NULL dereference at the call chain of snd_ctl_led_notify(), as found by syzkaller.
For avoiding the Oops, add a sanity check of the kcontrol's info and get callbacks, and just skip the invalid kcontrols before assigning the kctl to the LED layer.
--- sound/core/control_led.c | 2 ++ 1 file changed, 2 insertions(+)
sound/core/control_led.c +2 -0
@@ -255,6 +255,8 @@ static int snd_ctl_led_set_id(int card_number, struct snd_ctl_elem_id *id, kctl =snd_ctl_find_id (card, id);if (!kctl)return -ENOENT ; +if (!kctl->info || !kctl->get) +return -EINVAL ; ioff =snd_ctl_get_ioff (kctl, id); vd = &kctl->vd[ioff]; access = vd->access &SNDRV_CTL_ELEM_ACCESS_LED_MASK ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1790/1815 selftests/arm64: Print missing MTE TAP headers
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 8d2237e9d6902e234bb89aabb9cd6a9e91357223 ]
Most MTE tests set a TAP plan and emit results without first printing the TAP version header. Direct execution therefore starts with a plan such as "1..20" instead of "TAP version 13".
The problem is particularly visible in the GCR_EL1 context-switch test. It prints its plan before forking 1,024 child processes. When stdout is fully buffered, the plan remains in the stdio buffer. Each child inherits the pending "1..1" line and flushes its copy from exit(), producing repeated plan lines.
ksft_print_header() prints the TAP header and enables line buffering. Call it in every MTE test that is missing it. In the GCR_EL1 test, call it before the plan so the plan is flushed before the children are forked. In the remaining tests, call it before setup and prerequisite checks so early failures and whole-test skips also retain the header.
--- tools/testing/selftests/arm64/mte/check_buffer_fill.c | 2 ++ tools/testing/selftests/arm64/mte/check_child_memory.c | 2 ++ tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 1 + tools/testing/selftests/arm64/mte/check_hugetlb_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_ksm_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_mmap_options.c | 2 ++ tools/testing/selftests/arm64/mte/check_tags_inclusion.c | 2 ++ tools/testing/selftests/arm64/mte/check_user_mem.c | 2 ++ 8 files changed, 15 insertions(+)
tools/testing/selftests/arm64/mte/check_buffer_fill.c +2 -0
@@ -406,6 +406,8 @@ int main(int argc, char *argv[])size_t page_size =getpagesize ();int item =ARRAY_SIZE (sizes); +ksft_print_header (); + sizes[item -3 ] = page_size -1 ; sizes[item -2 ] = page_size; sizes[item -1 ] = page_size +1 ;
tools/testing/selftests/arm64/mte/check_child_memory.c +2 -0
@@ -146,6 +146,8 @@ int main(int argc, char *argv[])int err;int item =ARRAY_SIZE (sizes); +ksft_print_header (); + page_size =getpagesize ();if (!page_size) {ksft_print_msg ("ERR: Unable to get page size\n" );
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c +1 -0
@@ -131,6 +131,7 @@ int main(int argc, char *argv[])if (err)return err; +ksft_print_header ();ksft_set_plan (1 ); evaluate_test(mte_gcr_fork_test(),
tools/testing/selftests/arm64/mte/check_hugetlb_options.c +2 -0
@@ -230,6 +230,8 @@ int main(int argc, char *argv[])void *map_ptr;unsigned long map_size; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_ksm_options.c +2 -0
@@ -132,6 +132,8 @@ int main(int argc, char *argv[]) {int err; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_mmap_options.c +2 -0
@@ -945,6 +945,8 @@ int main(int argc, char *argv[]) }, }; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_tags_inclusion.c +2 -0
@@ -175,6 +175,8 @@ int main(int argc, char *argv[]) {int err; +ksft_print_header (); + err =mte_default_setup ();if (err)return err;
tools/testing/selftests/arm64/mte/check_user_mem.c +2 -0
@@ -201,6 +201,8 @@ int main(int argc, char *argv[])int tag_offsets[] = {page_sz,MT_GRANULE_SIZE };char test_name[TEST_NAME_MAX ]; +ksft_print_header (); + page_sz =getpagesize ();if (!page_sz) {ksft_print_msg ("ERR: Unable to get page size\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1791/1815 selftests/arm64: Treat KSM merge_across_nodes as optional
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 1a0dba077f34a2f8faa98308d30d4b546d073145 ]
The MTE KSM test requires write access to KSM sysfs but does not check that it is running as root. It also unconditionally saves, enables and restores the merge_across_nodes attribute. The kernel only creates this attribute when CONFIG_NUMA=y, so a non-NUMA kernel prints the following message three times even though every KSM subtest passes:
# ERR: missing /sys/kernel/mm/ksm/merge_across_nodes
Skip the test when it is not running as root. Check that the optional attribute is readable and writable, treating ENOENT as its expected absence on non-NUMA kernels and skipping the test for other access failures. Only save, enable and restore the attribute when it is available.
Check MTE availability before the privilege and sysfs checks so systems without MTE retain the existing feature-unavailable skip result.
This preserves the existing behavior on NUMA kernels without requiring NUMA or reducing KSM coverage on single-node systems.
--- .../selftests/arm64/mte/check_ksm_options.c | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-)
tools/testing/selftests/arm64/mte/check_ksm_options.c +26 -3
@@ -6,6 +6,7 @@#include <errno.h> #include <fcntl.h> #include <signal.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
@@ -22,6 +23,20 @@static size_t page_sz;static unsigned long ksm_sysfs[5 ]; +static bool has_merge_across_nodes; + +static bool merge_across_nodes_available (void ) +{ +const char *path =PATH_KSM "merge_across_nodes" ; + +if (!access (path,R_OK |W_OK )) +return true; +if (errno ==ENOENT ) +return false; + +ksft_exit_skip ("Unable to read and write %s: %s\n" , path, +strerror (errno)); +}static unsigned long read_sysfs (char *str) {
@@ -56,8 +71,10 @@ static void write_sysfs(char *str, unsigned long val)static void mte_ksm_setup (void ) { - ksm_sysfs[0 ] =read_sysfs (PATH_KSM "merge_across_nodes" ); -write_sysfs (PATH_KSM "merge_across_nodes" ,1 ); +if (has_merge_across_nodes) { + ksm_sysfs[0 ] =read_sysfs (PATH_KSM "merge_across_nodes" ); +write_sysfs (PATH_KSM "merge_across_nodes" ,1 ); + } ksm_sysfs[1 ] =read_sysfs (PATH_KSM "sleep_millisecs" );write_sysfs (PATH_KSM "sleep_millisecs" ,0 ); ksm_sysfs[2 ] =read_sysfs (PATH_KSM "run" );
@@ -70,7 +87,8 @@ static void mte_ksm_setup(void)static void mte_ksm_restore (void ) { -write_sysfs (PATH_KSM "merge_across_nodes" , ksm_sysfs[0 ]); +if (has_merge_across_nodes) +write_sysfs (PATH_KSM "merge_across_nodes" , ksm_sysfs[0 ]);write_sysfs (PATH_KSM "sleep_millisecs" , ksm_sysfs[1 ]);write_sysfs (PATH_KSM "run" , ksm_sysfs[2 ]);write_sysfs (PATH_KSM "max_page_sharing" , ksm_sysfs[3 ]);
@@ -137,6 +155,11 @@ int main(int argc, char *argv[]) err =mte_default_setup ();if (err)return err; + +if (geteuid () !=0 ) +ksft_exit_skip ("Please run the test as root\n" ); + + has_merge_across_nodes =merge_across_nodes_available (); page_sz =getpagesize ();if (!page_sz) {ksft_print_msg ("ERR: Unable to get page size\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 1782/1815 drm/xe: Do not apply WA 14025883347 to media 3503
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Ceraolo Spurio <[email protected]>
[ Upstream commit f0feab6e9e008faa406d189fb40cb7ab1bed420a ]
The database was updated and the WA is no longer listed as applicable to media 3503, so don't enable it there.
--- drivers/gpu/drm/xe/xe_wa_oob.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_wa_oob.rules +1 -1
@@ -63,5 +63,5 @@ 16026007364 MEDIA_VERSION(3000) 14020316580 MEDIA_VERSION(1301) -14025883347 MEDIA_VERSION_RANGE(1301, 3503) +14025883347 MEDIA_VERSION_RANGE(1301, 3500) GRAPHICS_VERSION_RANGE(2004, 3005)
Signature · 1 line
2.53.0
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 7.2.6-rc1-g048ea6124e84 #2 SMP PREEMPT_DYNAMIC Sat Sep 12 09:31:29 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Thorsten Leemhuis
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]
My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears in
Reverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including bd86119c3ee6ed ("perf ui hists: Fix dso_filter reference leak and exit zoom cleanup") will fix this, too.
That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
Re: [PATCH 7.2 1107/1815] ARM: 9483/1: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
From: Karl Mehltretter <[email protected]>
[ Upstream commit
8a58a41100ea377e978d99600ec24a9bd0273662]Commit
c6e61c06d606("ARM: 9463/1: Allow to enable RT") enabledPREEMPT_RTon ARM but did not selectHAVE_POSIX_CPU_TIMERS_TASK_WORK. This leavesCONFIG_POSIX_CPU_TIMERS_TASK_WORKdisabled, so CPU timers expire in hard IRQ context.
Are you backporting the RT enablement as well? That may need additional patches, while without RT support, this patch is not needed.
Arnd
Re: [PATCH 7.2 1158/1815] leds: gpio: Make legacy gpiolib interface optional
In reply to Greg Kroah-HartmanQuoted 11 lines · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit
98c5c7b0d4269ecabfc86b8b49ffcfa47979e99d]There are still a handful of ancient mips/armv5/sh boards that use the gpio_led:gpio member to pass an old-style gpio number, but all modern users have been converted to gpio descriptors.
I think it's a bit too risky to backport the GPIOLIB_LEGACY cleanup to stable kernels. What is this one needed for?
Arnd
Hi
kernel build / boot test on x86_64 (Intel).
No regressions here.
Thanks
Re: [PATCH 7.2 0368/1815] iommufd/selftest: Fix dmabuf leak in iommufd_test_dmabuf_get()
In reply to Greg Kroah-HartmanHi Greg,
Success path return rc was changed to return 0.
Please refer,
https://lore.kernel.org/linux-iommu/[email protected]/
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
In reply to Greg Kroah-HartmanQuoted 1 line · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
[...]
Quoted 1 line
[ Upstream commit
9417c5818a0146980c2608fda94c908e604eb033]
Please drop this from 7.2, 6.18, 6.12, 6.6 and 6.1 for now.
On its own it breaks probe on MT7922 with linux-firmware 20260810:
the CLC blob in WIFI_RAM_CODE_MT7922_1.bin carries a record with idx 3, these trees size phy->clc[] at 3 or 2, and the new bounds check fails mt7921_run_firmware() with -EINVAL. Mainline is fine because e9f3f1cc133f, also in v7.3-rc1, grew the array to 4. Mikhail Gavrilov hit it with this commit on a v7.2 tree:
https://lore.kernel.org/all/[email protected]/
The check is still wanted here, today that record is indexed past the array (UBSAN, https://bugzilla.redhat.com/show_bug.cgi?id=2515420),
but only with the follow-up that skips unknown records. That is on linux-wireless with Tested-by and Reviewed-by, not applied yet:
https://lore.kernel.org/linux-wireless/[email protected]/
Once it lands the two can go together.
Re: [PATCH 7.2 1107/1815] ARM: 9483/1: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
In reply to Arnd BergmannQuoted 2 lines · Arnd Bergmann
Are you backporting the RT enablement as well? That may need additional patches, while without RT support, this patch is not needed.
RT on arm32 is already in 7.2. It went in with 7.1:
c6e61c06d606 ("ARM: 9463/1: Allow to enable RT") v7.1-rc1
So a 7.2 kernel can be built with PREEMPT_RT as it is, and nothing else needs to come along with this patch.
I have tested this rc1 series on arm32 with PREEMPT_RT in QEMU and RT works correctly. cyclictest, signaltest, pi_stress and the posix_timers selftest all pass.
One thing worth knowing: the symbol this selects is not RT only. Non-RT arm kernels also get CPU timer expiry moved out of the timer interrupt into task context. That is how x86, arm64, riscv, loongarch and s390 have worked for years, arm was just the last one without it.
Karl
Re: [PATCH 7.2 1107/1815] ARM: 9483/1: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
Quoted 10 lines · Karl Mehltretter
Quoted 2 lines · Arnd Bergmann
Are you backporting the RT enablement as well? That may need additional patches, while without RT support, this patch is not needed.
RT on arm32 is already in 7.2. It went in with 7.1:
c6e61c06d606("ARM: 9463/1: Allow to enable RT") v7.1-rc1So a 7.2 kernel can be built with
PREEMPT_RTas it is, and nothing else needs to come along with this patch.
Ah, indeed, I mixed things up as I was had just read some 6.18 and earlier backport patches, and didn't realize this was just for 7.2.
We definitely want this patch then.
Arnd
Re: [PATCH 7.2 1226/1815] btrfs: fix a lockdep caused by path resolution during device scan
In reply to Qu WenruoQuoted 13 lines · Qu Wenruo
Quoted 1 line · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
Please drop this one.
There are already users (although the minority of users) who do not use an initramfs to boot, and the device path of rootfs stays as "
/dev/root".With this patch, there will be no way to update the "
/dev/root" name of the rootfs.Normally it is just a cosmetic problem, but tools like grub2 will be unable to probe the driver for the rootfs.
Quoted 8 lines
I'd argue we should discourage root btrfs without an initramfs, and grub2 should use device number/libblkid to properly detect rootfs devices, but still there are users complaining.
There will be a special hot fix for it, but I'd prefer to at least delay this one.
The deadlock itself is not easy to trigger, it requires block device files created on btrfs, and doing block device scan on that file over btrfs.
Thanks,
Qu
I see that the stable-queue now has a revert for this patch queued up in staging-7.2. That could make sense if this patch had already made it into a 7.2.y release. However, it hasn't yet, so I think it would make more sense to either (a) just drop this patch from queue-7.2 or
(b) add the revert to queue-7.2 instead of staging-7.2.
(I guess I'm afraid 7.2.6 might be released with this patch even though it's already known that it needs to be dropped or reverted. Maybe I'm overreacting, but I just want to make sure this doesn't fall through the cracks.)
Signature · 1 line
-Barry K. Nathan <[email protected]>
Sasha Levin
maintainerRe: [PATCH 7.2 1226/1815] btrfs: fix a lockdep caused by path resolution during device scan
In reply to Qu WenruoQuoted 1 line
Please drop this one.
Dropped from the 7.2 queue.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerRe: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
In reply to Junjie CaoQuoted 1 line
Please drop this from 7.2, 6.18, 6.12, 6.6 and 6.1 for now.
Dropped from the 7.2, 6.18, 6.12, 6.6, and 6.1 queues.
Signature · 2 lines
Thanks, Sasha
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
Linux version 7.2.6-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
[ 0.000000] Linux version 7.2.6-rc1rv-g048ea6124e84
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 16.2.1 20260810, GNU ld (GNU Binutils) 2.47) #1 SMP PREEMPT_DYNAMIC Sun Sep 13 05:45:30 JST 2026
Greg Kroah-Hartman
maintainerPATCH 1004/1815 HID: asus: refactor the two workqueues and init sequence
In reply to Greg Kroah-Hartman7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Benato <[email protected]>
[ Upstream commit 47669bec44fe12fe2c7adf2b299e980d7935a2ce ]
Multiple issues have been found within the hid-asus driver:
- unchecked size in asus_raw_event()
- unclean teardown of asus_probe on failure
- possible use-after-free in asus_probe
- multiple workqueue used for jobs where one was enough
- sleeping calls in atomic context
- packets of incorrect size being sent to the keyboard controller
Join the two workqueues into one reusing the stopping mechanism of the brightness workqueue, use the joined workqueue to also move the asus_wmi_send_event() sleeping call away from atomic context and add a size check in asus_raw_event().
--- drivers/hid/hid-asus.c | 392 ++++++++++++++++++++++++++++++----------- 1 file changed, 286 insertions(+), 106 deletions(-)
drivers/hid/hid-asus.c +286 -106
@@ -109,11 +109,36 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");#define TRKID_SGN ((TRKID_MAX + 1) >> 1) -struct asus_kbd_leds { -struct asus_hid_listener listener; +enum asus_work_action_type { +FN_LOCK_SYNC , +BRIGHTNESS_SET , +WMI_FAN , +}; + +struct hid_raw_event_data { +u8 report_data[FEATURE_KBD_REPORT_SIZE ]; +size_t report_size; +}; + +struct asus_work_action { +struct list_head node; +enum asus_work_action_type type; +union { +/* Data for BRIGHTNESS_SET */ +unsigned int brightness; + +/* Data for FN_LOCK_SYNC */ +bool fn_lock; + +/* Data for WMI_FAN */ +struct hid_raw_event_data fan_hid_data; + } data; +}; + +struct asus_worker {struct hid_device *hdev;struct work_struct work; -unsigned int brightness; +struct list_head actions;spinlock_t lock;bool removed; };
@@ -133,7 +158,8 @@ struct asus_drvdata {struct hid_device *hdev;struct input_dev *input;struct input_dev *tp_kbd_input; -struct asus_kbd_leds *kbd_backlight; +struct asus_worker *worker; +unsigned int kbd_backlight_brightness;const struct asus_touchpad_info *tp;struct power_supply *battery;struct power_supply_desc battery_desc;
@@ -141,7 +167,7 @@ struct asus_drvdata {int battery_stat;bool battery_in_query;unsigned long battery_next_query; -struct work_struct fn_lock_sync_work; +struct asus_hid_listener listener;bool fn_lock; };
@@ -211,6 +237,29 @@ static const u8 asus_report_id_init[] = { FEATURE_KBD_LED_REPORT_ID2 }; +/* +* Send events to asus-wmi driver for handling special keys +*/ +static int asus_wmi_send_event (struct asus_drvdata *drvdata,u8 code) +{ +int err; +u32 retval; + + err =asus_wmi_evaluate_method (ASUS_WMI_METHODID_DEVS , +ASUS_WMI_METHODID_NOTIF , code, &retval); +if (err) { +pr_warn ("Failed to notify asus-wmi: %d\n" , err); +return err; + } + +if (retval !=0 ) { +pr_warn ("Failed to notify asus-wmi (retval): 0x%x\n" , retval); +return -EIO ; + } + +return 0 ; +} +static void asus_report_contact_down (struct asus_drvdata *drvdat,int toolType,u8 *data) {
@@ -331,25 +380,71 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size) }/* -* Send events to asus-wmi driver for handling special keys +* Used in atomic contexts to schedule work involving sleeps operations or +* asus-wmi interactions. +* +* Caller is responsible to store relevant data in the structure to carry out +* the required action. +* +* This function must be called while the spin lock protecting the workqueue +* is already being held. */ -static int asus_wmi_send_event (struct asus_drvdata *drvdata,u8 code) +static void asus_worker_schedule (struct asus_worker *worker,struct asus_work_action *action) { -int err; -u32 retval; - - err =asus_wmi_evaluate_method (ASUS_WMI_METHODID_DEVS , -ASUS_WMI_METHODID_NOTIF , code, &retval); -if (err) { -pr_warn ("Failed to notify asus-wmi: %d\n" , err); -return err; +if (worker->removed) { +kfree (action); +return ; } -if (retval !=0 ) { -pr_warn ("Failed to notify asus-wmi (retval): 0x%x\n" , retval); -return -EIO ; +list_add_tail (&action->node, &worker->actions); +schedule_work (&worker->work); +} + +static int asus_kbd_fn_lock_set (struct asus_drvdata *drvdata,bool enabled) +{ +struct asus_work_action *action; +unsigned long flags; + + action =kzalloc (sizeof (struct asus_work_action ),GFP_ATOMIC ); +if (!action) +return -ENOMEM ; + + drvdata->fn_lock = enabled; + action->type =FN_LOCK_SYNC ; + action->data.fn_lock = drvdata->fn_lock; +INIT_LIST_HEAD (&action->node); + +spin_lock_irqsave (&drvdata->worker->lock, flags); +asus_worker_schedule (drvdata->worker, action); +spin_unlock_irqrestore (&drvdata->worker->lock, flags); + +return 0 ; +} + +static int asus_kbd_wmi_fan_send (struct asus_drvdata *drvdata,u8 *report_data, +size_t report_size) +{ +struct asus_work_action *action; +unsigned long flags; + +if (report_size >FEATURE_KBD_REPORT_SIZE ) { +hid_err (drvdata->hdev,"Invalid report size for fan event: %zu\n" , report_size); +return -EINVAL ; } + action =kzalloc (sizeof (struct asus_work_action ),GFP_NOWAIT ); +if (!action) +return -ENOMEM ; + + action->type =WMI_FAN ; + action->data.fan_hid_data.report_size = report_size; +memcpy (action->data.fan_hid_data.report_data, report_data, report_size); +INIT_LIST_HEAD (&action->node); + +spin_lock_irqsave (&drvdata->worker->lock, flags); +asus_worker_schedule (drvdata->worker, action); +spin_unlock_irqrestore (&drvdata->worker->lock, flags); +return 0 ; }
@@ -357,6 +452,7 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) {struct asus_drvdata *drvdata =hid_get_drvdata (hdev); +int ret; if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR && (usage->hid & HID_USAGE) != 0x00 &&
@@ -375,8 +471,11 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,return !asus_hid_event (ASUS_EV_BRTTOGGLE );case KEY_FN_ESC :if (drvdata->quirks &QUIRK_HID_FN_LOCK ) { - drvdata->fn_lock = !drvdata->fn_lock; -schedule_work (&drvdata->fn_lock_sync_work); + ret =asus_kbd_fn_lock_set (drvdata, !drvdata->fn_lock); +if (ret) { +hid_err (hdev,"Error while toggling FN lock: %d\n" , ret); +return ret; + } }break ; }
@@ -389,6 +488,12 @@ static int asus_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { struct asus_drvdata *drvdata = hid_get_drvdata(hdev); +int ret; + +if (size <2 ) { +hid_dbg (hdev,"Unexpected keyboard report size %d\n" , size); +return 0 ; + }if (drvdata->battery && data[0 ] ==BATTERY_REPORT_ID )return asus_report_battery (drvdata, data, size);
@@ -414,19 +519,13 @@ static int asus_raw_event(struct hid_device *hdev,* pass to userspace so it can implement its own fan control. */ if (data[1 ] ==ASUS_FAN_CTRL_KEY_CODE ) { -int ret =asus_wmi_send_event (drvdata,ASUS_FAN_CTRL_KEY_CODE ); + ret =asus_kbd_wmi_fan_send (drvdata, data, size); -if (ret ==0 ) { -/* Successfully handled by asus-wmi, block event */ +/* if execution deferred successfully block event */ +if (ret ==0 )return -1 ; - } -/* -* Warn if asus-wmi failed (but not if it's unavailable). -* Let the event reach userspace in all failure cases. -*/ -if (ret != -ENODEV ) -hid_warn (hdev,"Failed to notify asus-wmi: %d\n" , ret); +return ret; }/*
@@ -569,59 +668,157 @@ static int asus_kbd_disable_oobe(struct hid_device *hdev)return 0 ; } -static int asus_kbd_set_fn_lock (struct hid_device *hdev,bool enabled) +static void asus_kbd_set_fn_lock (struct hid_device *hdev,bool enabled) { -u8 buf[] = {FEATURE_KBD_REPORT_ID ,0xd0 ,0x4e , !!enabled }; +const u8 buf[FEATURE_KBD_REPORT_SIZE ] = {FEATURE_KBD_REPORT_ID ,0xd0 ,0x4e , !!enabled }; +int ret; -return asus_kbd_set_report (hdev, buf,sizeof (buf)); + ret =asus_kbd_set_report (hdev, buf,sizeof (buf)); +if (ret <0 ) +hid_err (hdev,"Asus failed to set fn lock: %d\n" , ret); } -static void asus_sync_fn_lock (struct work_struct *work) +static void asus_kbd_set_brightness (struct hid_device *hdev,u8 brightness) { -struct asus_drvdata *drvdata = - container_of(work, struct asus_drvdata, fn_lock_sync_work); +const u8 buf[FEATURE_KBD_REPORT_SIZE ] = { +FEATURE_KBD_REPORT_ID ,0xba ,0xc5 ,0xc4 , brightness + }; +int ret; -asus_kbd_set_fn_lock (drvdata->hdev, drvdata->fn_lock); + ret =asus_kbd_set_report (hdev, buf,sizeof (buf)); +if (ret <0 ) +hid_err (hdev,"Asus failed to set keyboard backlight: %d\n" , ret); } -static void asus_schedule_work (struct asus_kbd_leds *led) +static void asus_kbd_wmi_fan (struct hid_device *hdev,struct hid_raw_event_data *data) { +struct asus_drvdata *drvdata =hid_get_drvdata (hdev); +int ret; + + ret =asus_wmi_send_event (drvdata,ASUS_FAN_CTRL_KEY_CODE ); + +/* +* Warn if asus-wmi failed (but not if it's unavailable). +* Let the event reach userspace in all failure cases. +*/ +switch (ret) { +case -ENODEV : +break ; +case 0 : +return ; +default : +hid_warn (hdev,"Failed to notify asus-wmi: %d\n" , ret); +break ; + } + +/* +* Fallback: pass the raw event to the HID core; to avoid +* racing against the hid_report_raw_event() that generated +* this event use the same locking mechanism and wait for +* that function to terminate and signal the deferred execution +* before raising the stored event. +*/ +down (&hdev->driver_input_lock); +hid_report_raw_event (hdev,HID_INPUT_REPORT , + data->report_data, data->report_size, + data->report_size,1 ); +up (&hdev->driver_input_lock); +} + +static void asus_kbd_backlight_set (struct asus_hid_listener *listener,int brightness) +{ + struct asus_drvdata *drvdata = container_of(listener, struct asus_drvdata, listener); +struct asus_worker *worker = drvdata->worker; +struct asus_work_action *action;unsigned long flags; -spin_lock_irqsave (&led->lock, flags); -if (!led->removed) -schedule_work (&led->work); -spin_unlock_irqrestore (&led->lock, flags); + drvdata->kbd_backlight_brightness = brightness; + + action =kzalloc (sizeof (struct asus_work_action ),GFP_NOWAIT ); +if (!action) +return ; + + action->type =BRIGHTNESS_SET ; + action->data.brightness = brightness; +INIT_LIST_HEAD (&action->node); + +spin_lock_irqsave (&worker->lock, flags); +asus_worker_schedule (worker, action); +spin_unlock_irqrestore (&worker->lock, flags); } -static void asus_kbd_backlight_set (struct asus_hid_listener *listener, -int brightness) +static void asus_work (struct work_struct *work) { - struct asus_kbd_leds *led = container_of(listener, struct asus_kbd_leds, - listener); + struct asus_worker *worker = container_of(work, struct asus_worker, work); +struct asus_work_action *action =NULL ;unsigned long flags; -spin_lock_irqsave (&led->lock, flags); - led->brightness = brightness; -spin_unlock_irqrestore (&led->lock, flags); +/* Save the action to be performed and clear the flag */ +spin_lock_irqsave (&worker->lock, flags); +if (!list_empty (&worker->actions)) { + action =list_first_entry (&worker->actions, + struct asus_work_action, node); +list_del (&action->node); + } +spin_unlock_irqrestore (&worker->lock, flags); + +if (!action) +return ; + +switch (action->type) { +case BRIGHTNESS_SET : +asus_kbd_set_brightness (worker->hdev, action->data.brightness); +break ; +case FN_LOCK_SYNC : +asus_kbd_set_fn_lock (worker->hdev, action->data.fn_lock); +break ; +case WMI_FAN : +asus_kbd_wmi_fan (worker->hdev, &action->data.fan_hid_data); +break ; +default : +hid_err (worker->hdev,"Invalid action type: %d\n" , action->type); +break ; + } + +kfree (action); -asus_schedule_work (led); +/* Re-schedule if there are more pending actions */ +spin_lock_irqsave (&worker->lock, flags); +if (!list_empty (&worker->actions)) +schedule_work (&worker->work); +spin_unlock_irqrestore (&worker->lock, flags); } -static void asus_kbd_backlight_work (struct work_struct *work) +static int asus_worker_create (struct hid_device *hdev,struct asus_drvdata *drvdata) { - struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work); -u8 buf[] = {FEATURE_KBD_REPORT_ID ,0xba ,0xc5 ,0xc4 ,0x00 }; -int ret; + drvdata->worker =devm_kzalloc (&hdev->dev,sizeof (struct asus_worker ),GFP_KERNEL ); +if (!drvdata->worker) +return -ENOMEM ; + + drvdata->worker->removed = false; + drvdata->worker->hdev = hdev; +INIT_LIST_HEAD (&drvdata->worker->actions); + +INIT_WORK (&drvdata->worker->work, asus_work); +spin_lock_init (&drvdata->worker->lock); + +return 0 ; +} + +static void asus_worker_stop (struct asus_worker *worker) +{ +struct asus_work_action *action, *tmp;unsigned long flags; -spin_lock_irqsave (&led->lock, flags); - buf[4 ] = led->brightness; -spin_unlock_irqrestore (&led->lock, flags); +spin_lock_irqsave (&worker->lock, flags); + worker->removed = true; +list_for_each_entry_safe (action, tmp, &worker->actions, node) { +list_del (&action->node); +kfree (action); + } +spin_unlock_irqrestore (&worker->lock, flags); - ret =asus_kbd_set_report (led->hdev, buf,sizeof (buf)); -if (ret <0 ) -hid_err (led->hdev,"Asus failed to set keyboard backlight: %d\n" , ret); +cancel_work_sync (&worker->work); }/*
@@ -760,23 +957,11 @@ static int asus_kbd_register_leds(struct hid_device *hdev) le16_to_cpu(udev->descriptor.idProduct)); } - drvdata->kbd_backlight =devm_kzalloc (&hdev->dev, -sizeof (struct asus_kbd_leds ), -GFP_KERNEL ); -if (!drvdata->kbd_backlight) -return -ENOMEM ; - - drvdata->kbd_backlight->removed = false; - drvdata->kbd_backlight->brightness =0 ; - drvdata->kbd_backlight->hdev = hdev; - drvdata->kbd_backlight->listener.brightness_set = asus_kbd_backlight_set; -INIT_WORK (&drvdata->kbd_backlight->work, asus_kbd_backlight_work); -spin_lock_init (&drvdata->kbd_backlight->lock); - - ret =asus_hid_register_listener (&drvdata->kbd_backlight->listener); + drvdata->listener.brightness_set = asus_kbd_backlight_set; + ret =asus_hid_register_listener (&drvdata->listener);if (ret <0 ) { -/* No need to have this still around */ -devm_kfree (&hdev->dev, drvdata->kbd_backlight); +hid_err (hdev,"Unable to register kbd brightness listener: %d\n" , ret); + drvdata->listener.brightness_set =NULL ; }return ret;
@@ -998,11 +1183,9 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) drvdata->input = input; -if (drvdata->quirks &QUIRK_HID_FN_LOCK ) { - drvdata->fn_lock = true; -INIT_WORK (&drvdata->fn_lock_sync_work, asus_sync_fn_lock); -asus_kbd_set_fn_lock (hdev, true); - } +if ((drvdata->quirks &QUIRK_HID_FN_LOCK ) && + (asus_kbd_fn_lock_set (drvdata, true))) +hid_warn (hdev,"Error while setting FN lock to ON\n" );return 0 ; }
@@ -1165,20 +1348,16 @@ static int asus_start_multitouch(struct hid_device *hdev)static int __maybe_unused asus_resume (struct hid_device *hdev) {struct asus_drvdata *drvdata =hid_get_drvdata (hdev); -int ret =0 ; -if (drvdata->kbd_backlight) { -const u8 buf[] = {FEATURE_KBD_REPORT_ID ,0xba ,0xc5 ,0xc4 , - drvdata->kbd_backlight->brightness }; - ret =asus_kbd_set_report (hdev, buf,sizeof (buf)); -if (ret <0 ) { -hid_err (hdev,"Asus failed to set keyboard backlight: %d\n" , ret); - goto asus_resume_err; - } - } +/* +* If we have a backlight listener registered, restore the previous state, +* in case of error do not fail: most models restore the backlight +* automatically, and the error is non-fatal. +*/ +if (drvdata->listener.brightness_set) +asus_kbd_backlight_set (&drvdata->listener, drvdata->kbd_backlight_brightness); -asus_resume_err: -return ret; +return 0 ; }static int __maybe_unused asus_reset_resume (struct hid_device *hdev)
@@ -1288,8 +1467,15 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) is_vendor = true; } + ret =asus_worker_create (hdev, drvdata); +if (ret) { +hid_warn (hdev,"Failed to initialize worker: %d\n" , ret); +return ret; + } + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT );if (ret) { +asus_worker_stop (drvdata->worker);hid_err (hdev,"Asus hw start failed: %d\n" , ret);return ret; }
@@ -1337,6 +1523,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)return 0 ; err_stop_hw: +if (drvdata->listener.brightness_set) +asus_hid_unregister_listener (&drvdata->listener); + +asus_worker_stop (drvdata->worker);hid_hw_stop (hdev);return ret; }
@@ -1344,21 +1534,11 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)static void asus_remove (struct hid_device *hdev) {struct asus_drvdata *drvdata =hid_get_drvdata (hdev); -unsigned long flags; - -if (drvdata->kbd_backlight) { -asus_hid_unregister_listener (&drvdata->kbd_backlight->listener); - -spin_lock_irqsave (&drvdata->kbd_backlight->lock, flags); - drvdata->kbd_backlight->removed = true; -spin_unlock_irqrestore (&drvdata->kbd_backlight->lock, flags); - -cancel_work_sync (&drvdata->kbd_backlight->work); - } -if (drvdata->quirks &QUIRK_HID_FN_LOCK ) -cancel_work_sync (&drvdata->fn_lock_sync_work); +if (drvdata->listener.brightness_set) +asus_hid_unregister_listener (&drvdata->listener); +asus_worker_stop (drvdata->worker);hid_hw_stop (hdev); }
Signature · 1 line
2.53.0
Am 12.09.2026 um 08:29 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Sasha Levin
maintainerRe: [PATCH 7.2 0368/1815] iommufd/selftest: Fix dmabuf leak in iommufd_test_dmabuf_get()
In reply to Yee LiQuoted 1 line
Success path return rc was changed to return 0.
Dropped from the 7.2 queue. Will requeue together with the upstream fix ("iommufd/selftest: Return dmabuf fd from IOMMU_TEST_OP_DMABUF_GET again") once that lands in Linus's mainline tree.
Thanks for the report.
Signature · 2 lines
Thanks, Sasha
Quoted 30 lines · Thorsten Leemhuis
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears inReverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including
bd86119c3ee6ed("perf ui hists: Fixdso_filterreference leak and exit zoom cleanup") will fix this, too.That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
build-tested and reproduced the 2 issues on x86_64 with:
make -j$(nproc) -C ./tools/perf O=/tmp/perf-build
observed errors:
1) tools/perf/ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared
2ec3b9858725 — "perf hists browser: Increase MAX_OPTIONS to prevent stack buffer overflow"
prerequisite: bd86119c3ee6 expects MAX_OPTIONS=32; stable-rc still has 16
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2ec3b985872594031cc1000b830344de5c26633dbd86119c3ee6 — declares hotkey_act, fixes dso_filter reference leak
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bd86119c3ee6ed7b8fc9be8298fe49f1a5355a46
2) tools/perf/util/python.c:1104:9: error: implicit declaration of function 'CHECK_INITIALIZED'
01fa2d416ace — defines CHECK_INITIALIZED
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01fa2d416aceab51f97ec2769e8da9971a605eeb
With the 3 patches applied, perf build successful.
Benni
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Build and boot tested with QEMU for x86_64, i386, arm64, and riscv across multiple configurations, and boots on AMD Ryzen 7 5800H. No regressions observed.
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
7.2.6-rc1 compiles on x86_64 (Xeon E5-1620 v2, Slackware64-15.0), and boots & runs on x86_64 (AMD Ryzen 5 7520U, Slackware64-current). No regressions observed during boot & my custom tests.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
I tested 7.2.5 + stable-queue as of commit 5bd01cb1b5d8bdc0b5480752350d2b0f2d487986
("drop 3 orphaned perf prerequisite patches from 6.18")
on my Lenovo ThinkPad T14 Gen 1. Working well, no regressions observed.
Signature · 1 line
-Barry K. Nathan <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · On Sat, 12 Sep 2026 08:29:10 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64 and arm32:
Thanks!
Cheers,
Miguel
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
In reply to Sasha LevinQuoted 1 line · Sasha Levin
Dropped from the 7.2, 6.18, 6.12, 6.6, and 6.1 queues.
The follow-up is in mainline as of v7.3-rc3:
1a296bfd3e77 ("wifi: mt76: mt7921: skip unknown CLC firmware records")
Please queue it with 9417c5818a01 for 7.2, 6.18, 6.12, 6.6 and 6.1. Your dropped backports of 9417c5818a01 plus 1a296bfd3e775e on top apply on 7.2.5, 6.18.51, 6.12.109, 6.6.156 and 6.1.187.
Greg Kroah-Hartman
maintainerRe: [PATCH 7.2 1158/1815] leds: gpio: Make legacy gpiolib interface optional
In reply to Arnd BergmannQuoted 7 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
Quoted 8 lines
Quoted 5 lines
[ Upstream commit
98c5c7b0d4269ecabfc86b8b49ffcfa47979e99d]There are still a handful of ancient mips/armv5/sh boards that use the gpio_led:gpio member to pass an old-style gpio number, but all modern users have been converted to gpio descriptors.
I think it's a bit too risky to backport the
GPIOLIB_LEGACYcleanup to stable kernels. What is this one needed for?
It had:
Stable-dep-of: 942901eeda93 ("leds: gpio: Clear error pointers for skipped LEDs")
But I've fixed that one up now to not need this and will drop this patch from 6.18.y and 7.2.y. Thanks for the review!
greg k-h
Quoted 2 lines
Arnd
Greg Kroah-Hartman
maintainerQuoted 54 lines · Benjamin Boortz
Quoted 30 lines · Thorsten Leemhuis
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
[...]My builds failed while compiling perf:
Quoted 5 lines
Quoted 5 lines
ui/browsers/hists.c: In function ‘evsel__hists_browse’:ui/browsers/hists.c:3191:41: error: ‘hotkey_act’ undeclared (first use in this function)
3191 |memset(&hotkey_act, 0, sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears inReverting "perf ui hists: In report UI ensure thread is set with reference counting" fixes this. Haven't tried, but maybe including
bd86119c3ee6ed("perf ui hists: Fixdso_filterreference leak and exit zoom cleanup") will fix this, too.That got me a little further, but then I ran into this:
Quoted 8 lines
Quoted 8 lines
tools/perf/util/python.c: In function ‘pyrf_evsel__open’:tools/perf/util/python.c:1104:9: error: implicit declaration of function ‘CHECK_INITIALIZED’ [-Wimplicit-function-declaration]1104 | CHECK_INITIALIZED(evsel, "evsel"); | ^~~~~~~~~~~~~~~~~ tools/perf/util/python.c: In function ‘pyrf_evsel__set_tracking’: tools/perf/util/python.c:1295:9: error: implicit declaration of function ‘CHECK_INITIALIZED_INT’ [-Wimplicit-function-declaration] 1295 | CHECK_INITIALIZED_INT(pevsel->evsel, "evsel"); | ^~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
Only looked briefly, but didn't spot a simple way to work around that through a simple revert or two (but it's quite likely I missed something).
Ciao, Thorsten
build-tested and reproduced the 2 issues on
x86_64with:make -j$(nproc) -C ./tools/perf O=/tmp/perf-buildobserved errors:
1)
tools/perf/ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared
2ec3b9858725— "perf hists browser: IncreaseMAX_OPTIONSto prevent stack buffer overflow"
prerequisite:bd86119c3ee6expects MAX_OPTIONS=32; stable-rc still has 16
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2ec3b985872594031cc1000b830344de5c26633dbd86119c3ee6— declareshotkey_act, fixesdso_filterreference leak
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bd86119c3ee6ed7b8fc9be8298fe49f1a5355a46
Quoted 7 lines
2)
tools/perf/util/python.c:1104:9: error: implicit declaration of function 'CHECK_INITIALIZED'
01fa2d416ace— definesCHECK_INITIALIZED
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01fa2d416aceab51f97ec2769e8da9971a605eebWith the 3 patches applied, perf build successful.
Thanks for that, it fixes it for me too, I'll go queue these up now.
greg k-h
Re: [PATCH 7.2 0292/1815] leds: st1202: Stop pattern sequence before reprogramming
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Fombuena <[email protected]>
[ Upstream commit
9c019a8cb95d820e0bd03e75cfbad2c5b13941b7]
Please note that this patch was part of the following series:
The testing I carried out on real hardware included the complete series, including upstream commit fd2529ba8fb44cd4b56f1069363b949644b42cec, "leds: st1202: Validate pattern input before stopping the sequence".
That patch did not carry a Fixes: tag, as I considered it an improvement rather than a fix in its own right.
I do not anticipate any issues with the series being applied without that commit, but I have not tested that configuration. I therefore wanted to make you aware of this, in case you consider it advisable to backport fd2529ba8f as well.
The same applies to all of the following proposed backports, including this one. I am not going to respond to each individually, to avoid unnecessary mailing list traffic:
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
https://lore.kernel.org/stable/[email protected]/T/#u
Signature · 1 line
Manuel Fombuena
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.2.6 release. There are 1815 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Mon, 14 Sep 2026 06:54:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.2.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.2.y
and the diffstat can be found below.thanks,
greg k-h
perf fails to build with arm/arm64/mips:
ui/browsers/hists.c: In function 'evsel__hists_browse':ui/browsers/hists.c:3191:41: error: 'hotkey_act' undeclared (first use in this function)
3191 | memset(&hotkey_act, 0,sizeof(hotkey_act));
| ^~~~~~~~~~ui/browsers/hists.c:3191:41: note: each undeclared identifier is reported only once for each function it appears in
CC
/local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/perf/trace/beauty/clone.o
make[7]: *** [/local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/build/Makefile.build:95: /local/users/fainelli/buildroot/output/arm/build/linux-custom/tools/perf/ui/browsers/hists.o] Error 1 make[7]: *** Waiting for unfinished jobs....
this is caused by b8ad2bfb11e0868b595b4cd9dfcb9e80f174b2d5 ("perf ui hists: In report UI ensure thread is set with reference counting")
Signature · 1 line
Florian
Re: [PATCH 7.2 0862/1815] wifi: mt76: mt7921: validate CLC firmware records
In reply to Junjie CaoQuoted 1 line
Please queue it with
9417c5818a01for 7.2, 6.18, 6.12, 6.6 and 6.1.
Queued both for 7.2, 6.18, 6.12, 6.6 and 6.1, thanks.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerRe: [PATCH 7.2 0292/1815] leds: st1202: Stop pattern sequence before reprogramming
In reply to Manuel FombuenaQuoted 4 lines
I do not anticipate any issues with the series being applied without that commit, but I have not tested that configuration. I therefore wanted to make you aware of this, in case you consider it advisable to backport
fd2529ba8fas well.
Thanks for flagging it. fd2529ba8fb4 ("leds: st1202: Validate pattern input before stopping the sequence") is queued for 7.2 and 6.18 alongside the rest of the series, so both trees match the configuration you actually tested. No older tree is taking this series.
Signature · 2 lines
Thanks, Sasha