5.15.186-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 324/411 clk: rockchip: rk3036: mark ddrphy as critical
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 596a977b34a722c00245801a5774aa79cec4e81d ]
The ddrphy is supplied by the dpll, but due to the limited number of PLLs on the rk3036, the dpll also is used for other periperhals, like the GPU.
So it happened, when the Lima driver turned off the gpu clock, this in turn also disabled the dpll and thus the ram.
--- drivers/clk/rockchip/clk-rk3036.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-rk3036.c +1 -0
@@ -431,6 +431,7 @@ static const char *const rk3036_critical_clocks[] __initconst = {"hclk_peri" ,"pclk_peri" ,"pclk_ddrupctl" , + "ddrphy", };static void __init rk3036_clk_init (struct device_node *np)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 325/411 libbpf: Add identical pointer detection to btf_dedup_is_equiv()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Maguire <[email protected]>
[ Upstream commit 8e64c387c942229c551d0f23de4d9993d3a2acb6 ]
Recently as a side-effect of
commit ac053946f5c4 ("compiler.h: introduce TYPEOF_UNQUAL() macro")
issues were observed in deduplication between modules and kernel BTF such that a large number of kernel types were not deduplicated so were found in module BTF (task_struct, bpf_prog etc). The root cause appeared to be a failure to dedup struct types, specifically those with members that were pointers with __percpu annotations.
The issue in dedup is at the point that we are deduplicating structures, we have not yet deduplicated reference types like pointers. If multiple copies of a pointer point at the same (deduplicated) integer as in this case, we do not see them as identical. Special handling already exists to deal with structures and arrays, so add pointer handling here too.
--- tools/lib/bpf/btf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tools/lib/bpf/btf.c +16 -0
@@ -3770,6 +3770,19 @@ static bool btf_dedup_identical_structs(struct btf_dedup *d, __u32 id1, __u32 idreturn true; } +static bool btf_dedup_identical_ptrs (struct btf_dedup *d,__u32 id1,__u32 id2) +{ +struct btf_type *t1, *t2; + + t1 =btf_type_by_id (d->btf, id1); + t2 =btf_type_by_id (d->btf, id2); + +if (!btf_is_ptr (t1) || !btf_is_ptr (t2)) +return false; + +return t1->type == t2->type; +} +/* * Check equivalence of BTF type graph formed by candidate struct/union (we'll * call it "candidate graph" in this description for brevity) to a type graph
@@ -3902,6 +3915,9 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id,*/ if (btf_dedup_identical_structs (d, hypot_type_id, cand_id))return 1 ; +/* A similar case is again observed for PTRs. */ +if (btf_dedup_identical_ptrs (d, hypot_type_id, cand_id)) +return 1 ;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 326/411 scsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 05ae6c9c7315d844fbc15afe393f5ba5e5771126 ]
In lpfc_check_sli_ndlp(), the get_job_els_rsp64_did remote_id assignment does not apply for GEN_REQUEST64 commands as it only has meaning for a ELS_REQUEST64 command. So, if (iocb->ndlp == ndlp) is false, we could erroneously return the wrong value. Fix by replacing the fallthrough statement with a break statement before the remote_id check.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +1 -1
@@ -5086,7 +5086,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,case CMD_GEN_REQUEST64_CR :if (iocb->context_un.ndlp == ndlp)return 1 ; - fallthrough; +break ;case CMD_ELS_REQUEST64_CR :if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)return 1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 327/411 iommu/amd: Ensure GA log notifier callbacks finish running before module unload
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
[ Upstream commit 94c721ea03c7078163f41dbaa101ac721ddac329 ]
Synchronize RCU when unregistering KVM's GA log notifier to ensure all in-flight interrupt handlers complete before KVM-the module is unloaded.
--- drivers/iommu/amd/iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iommu/amd/iommu.c +8 -0
@@ -679,6 +679,14 @@ int amd_iommu_register_ga_log_notifier(int (*notifier)(u32)) { iommu_ga_log_notifier = notifier; +/* +* Ensure all in-flight IRQ handlers run to completion before returning +* to the caller, e.g. to ensure module code isn't unloaded while it's +* being executed in the IRQ handler. +*/ +if (!notifier) +synchronize_rcu (); +return 0 ; }EXPORT_SYMBOL (amd_iommu_register_ga_log_notifier);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 328/411 net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yong Wang <[email protected]>
[ Upstream commit 4b30ae9adb047dd0a7982975ec3933c529537026 ]
When a bridge port STP state is changed from BLOCKING/DISABLED to FORWARDING, the port's igmp query timer will NOT re-arm itself if the bridge has been configured as per-VLAN multicast snooping.
Solve this by choosing the correct multicast context(s) to enable/disable port multicast based on whether per-VLAN multicast snooping is enabled or not, i.e. using per-{port, VLAN} context in case of per-VLAN multicast snooping by re-implementing br_multicast_enable_port() and br_multicast_disable_port() functions.
Before the patch, the IGMP query does not happen in the last step of the following test sequence, i.e. no growth for tx counter:
# ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 1 mcast_vlan_snooping 1 mcast_querier 1 mcast_stats_enabled 1 # bridge vlan global set vid 1 dev br1 mcast_snooping 1 mcast_querier 1 mcast_query_interval 100 mcast_startup_query_count 0 # ip link add name swp1 up master br1 type dummy # bridge link set dev swp1 state 0 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 1 # sleep 1 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 1 # bridge link set dev swp1 state 3 # sleep 2 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 1
After the patch, the IGMP query happens in the last step of the test:
# ip link add name br1 up type bridge vlan_filtering 1 mcast_snooping 1 mcast_vlan_snooping 1 mcast_querier 1 mcast_stats_enabled 1 # bridge vlan global set vid 1 dev br1 mcast_snooping 1 mcast_querier 1 mcast_query_interval 100 mcast_startup_query_count 0 # ip link add name swp1 up master br1 type dummy # bridge link set dev swp1 state 0 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 1 # sleep 1 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 1 # bridge link set dev swp1 state 3 # sleep 2 # ip -j -p stats show dev swp1 group xstats_slave subgroup bridge suite mcast | jq '.[]["multicast"]["igmp_queries"]["tx_v2"]' 3
--- net/bridge/br_multicast.c | 77 +++++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 8 deletions(-)
net/bridge/br_multicast.c +69 -8
@@ -1931,12 +1931,17 @@ static void __br_multicast_enable_port_ctx(struct net_bridge_mcast_port *pmctx) } } -void br_multicast_enable_port (struct net_bridge_port *port) +static void br_multicast_enable_port_ctx (struct net_bridge_mcast_port *pmctx) { -struct net_bridge *br = port->br; +struct net_bridge *br = pmctx->port->br;spin_lock_bh (&br->multicast_lock); -__br_multicast_enable_port_ctx (&port->multicast_ctx); +if (br_multicast_port_ctx_is_vlan (pmctx) && + !(pmctx->vlan->priv_flags &BR_VLFLAG_MCAST_ENABLED )) { +spin_unlock_bh (&br->multicast_lock); +return ; + } +__br_multicast_enable_port_ctx (pmctx);spin_unlock_bh (&br->multicast_lock); }
@@ -1963,11 +1968,67 @@ static void __br_multicast_disable_port_ctx(struct net_bridge_mcast_port *pmctx)br_multicast_rport_del_notify (pmctx, del); } +static void br_multicast_disable_port_ctx (struct net_bridge_mcast_port *pmctx) +{ +struct net_bridge *br = pmctx->port->br; + +spin_lock_bh (&br->multicast_lock); +if (br_multicast_port_ctx_is_vlan (pmctx) && + !(pmctx->vlan->priv_flags &BR_VLFLAG_MCAST_ENABLED )) { +spin_unlock_bh (&br->multicast_lock); +return ; + } + +__br_multicast_disable_port_ctx (pmctx); +spin_unlock_bh (&br->multicast_lock); +} + +static void br_multicast_toggle_port (struct net_bridge_port *port,bool on) +{ +#if IS_ENABLED (CONFIG_BRIDGE_VLAN_FILTERING ) +if (br_opt_get (port->br,BROPT_MCAST_VLAN_SNOOPING_ENABLED )) { +struct net_bridge_vlan_group *vg; +struct net_bridge_vlan *vlan; + +rcu_read_lock (); + vg =nbp_vlan_group_rcu (port); +if (!vg) { +rcu_read_unlock (); +return ; + } + +/* iterate each vlan, toggle vlan multicast context */ +list_for_each_entry_rcu (vlan, &vg->vlan_list, vlist) { +struct net_bridge_mcast_port *pmctx = + &vlan->port_mcast_ctx; +u8 state =br_vlan_get_state (vlan); +/* enable vlan multicast context when state is +* LEARNING or FORWARDING +*/ +if (on &&br_vlan_state_allowed (state, true)) +br_multicast_enable_port_ctx (pmctx); +else +br_multicast_disable_port_ctx (pmctx); + } +rcu_read_unlock (); +return ; + } +#endif +/* toggle port multicast context when vlan snooping is disabled */ +if (on) +br_multicast_enable_port_ctx (&port->multicast_ctx); +else +br_multicast_disable_port_ctx (&port->multicast_ctx); +} + +void br_multicast_enable_port (struct net_bridge_port *port) +{ +br_multicast_toggle_port (port, true); +} +void br_multicast_disable_port (struct net_bridge_port *port) { -spin_lock_bh (&port->br->multicast_lock); -__br_multicast_disable_port_ctx (&port->multicast_ctx); -spin_unlock_bh (&port->br->multicast_lock); +br_multicast_toggle_port (port, false); }static int __grp_src_delete_marked (struct net_bridge_port_group *pg)
@@ -4130,9 +4191,9 @@ int br_multicast_toggle_vlan_snooping(struct net_bridge *br, bool on,__br_multicast_open (&br->multicast_ctx);list_for_each_entry (p, &br->port_list, list) {if (on) -br_multicast_disable_port (p); +br_multicast_disable_port_ctx (&p->multicast_ctx);else -br_multicast_enable_port (p); +br_multicast_enable_port_ctx (&p->multicast_ctx); }list_for_each_entry (vlan, &vg->vlan_list, vlist)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 329/411 vxlan: Do not treat dst cache initialization errors as fatal
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 20c76dadc783759fd3819d289c72be590660cc8b ]
FDB entries are allocated in an atomic context as they can be added from the data path when learning is enabled.
After converting the FDB hash table to rhashtable, the insertion rate will be much higher (*) which will entail a much higher rate of per-CPU allocations via dst_cache_init().
When adding a large number of entries (e.g., 256k) in a batch, a small percentage (< 0.02%) of these per-CPU allocations will fail [1]. This does not happen with the current code since the insertion rate is low enough to give the per-CPU allocator a chance to asynchronously create new chunks of per-CPU memory.
Given that:
a. Only a small percentage of these per-CPU allocations fail.
b. The scenario where this happens might not be the most realistic one.
c. The driver can work correctly without dst caches. The dst_cache_*() APIs first check that the dst cache was properly initialized.
d. The dst caches are not always used (e.g., 'tos inherit').
It seems reasonable to not treat these allocation failures as fatal.
Therefore, do not bail when dst_cache_init() fails and suppress warnings by specifying '__GFP_NOWARN'.
[1] percpu: allocation failed, size=40 align=8 atomic=1, atomic alloc failed, no space left
(*) 97% reduction in average latency of vxlan_fdb_update() when adding 256k entries in a batch.
--- drivers/net/vxlan/vxlan_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/vxlan/vxlan_core.c +4 -4
@@ -713,10 +713,10 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,if (rd ==NULL )return -ENOMEM ; -if (dst_cache_init (&rd->dst_cache,GFP_ATOMIC )) { -kfree (rd); -return -ENOMEM ; - } +/* The driver can work correctly without a dst cache, so do not treat +* dst cache initialization errors as fatal. +*/ +dst_cache_init (&rd->dst_cache,GFP_ATOMIC | __GFP_NOWARN); rd->remote_ip = *ip; rd->remote_port = port;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 330/411 software node: Correct a OOB check in software_node_get_reference_args()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit 31e4e12e0e9609850cefd4b2e1adf782f56337d6 ]
software_node_get_reference_args() wants to get @index-th element, so the property value requires at least '(index + 1) * sizeof(*ref)' bytes but that can not be guaranteed by current OOB check, and may cause OOB for malformed property.
Fix by using as OOB check '((index + 1) * sizeof(*ref) > prop->length)'.
--- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/swnode.c +1 -1
@@ -524,7 +524,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,if (prop->is_inline)return -EINVAL ; -if (index *sizeof (*ref) >= prop->length) +if ((index +1 ) *sizeof (*ref) > prop->length)return -ENOENT ; ref_array = prop->pointer;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 331/411 pinctrl: mcp23s08: Reset all pins to input at probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Looijmans <[email protected]>
[ Upstream commit 3ede3f8b4b4b399b0ca41e44959f80d5cf84fc98 ]
At startup, the driver just assumes that all registers have their default values. But after a soft reset, the chip will just be in the state it was, and some pins may have been configured as outputs. Any modification of the output register will cause these pins to be driven low, which leads to unexpected/unwanted effects. To prevent this from happening, set the chip's IO configuration register to a known safe mode (all inputs) before toggling any other bits.
--- drivers/pinctrl/pinctrl-mcp23s08.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pinctrl/pinctrl-mcp23s08.c +8 -0
@@ -567,6 +567,14 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, mcp->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); +/* +* Reset the chip - we don't really know what state it's in, so reset +* all pins to input first to prevent surprises. +*/ + ret =mcp_write (mcp,MCP_IODIR , mcp->chip.ngpio ==16 ?0xFFFF :0xFF ); +if (ret <0 ) +return ret; +/* verify MCP_IOCON.SEQOP = 0, so sequential reads work, * and MCP_IOCON.HAEN = 1, so we work with all chips. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 332/411 scsi: lpfc: Use memcpy() for BIOS version
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit ae82eaf4aeea060bb736c3e20c0568b67c701d7d ]
The strlcat() with FORTIFY support is triggering a panic because it thinks the target buffer will overflow although the correct target buffer size is passed in.
Anyway, instead of memset() with 0 followed by a strlcat(), just use memcpy() and ensure that the resulting buffer is NULL terminated.
BIOSVersion is only used for the lpfc_printf_log() which expects a properly terminated string.
--- drivers/scsi/lpfc/lpfc_sli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +2 -2
@@ -5926,9 +5926,9 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba) phba->sli4_hba.flash_id =bf_get (lpfc_cntl_attr_flash_id, cntl_attr); phba->sli4_hba.asic_rev =bf_get (lpfc_cntl_attr_asic_rev, cntl_attr); -memset (phba->BIOSVersion,0 ,sizeof (phba->BIOSVersion)); -strlcat (phba->BIOSVersion, (char *)cntl_attr->bios_ver_str, +memcpy (phba->BIOSVersion, cntl_attr->bios_ver_str,sizeof (phba->BIOSVersion)); + phba->BIOSVersion[sizeof (phba->BIOSVersion) -1 ] ='\0' ;lpfc_printf_log (phba,KERN_INFO ,LOG_SLI , "3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s, "
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 333/411 sock: Correct error checking condition for (assign|release)_proto_idx()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit faeefc173be40512341b102cf1568aa0b6571acd ]
(assign|release)_proto_idx() wrongly check find_first_zero_bit() failure by condition '(prot->inuse_idx == PROTO_INUSE_NR - 1)' obviously.
Fix by correcting the condition to '(prot->inuse_idx == PROTO_INUSE_NR)'
--- net/core/sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sock.c +2 -2
@@ -3571,7 +3571,7 @@ static int assign_proto_idx(struct proto *prot) { prot->inuse_idx =find_first_zero_bit (proto_inuse_idx,PROTO_INUSE_NR ); -if (unlikely (prot->inuse_idx ==PROTO_INUSE_NR -1 )) { +if (unlikely (prot->inuse_idx ==PROTO_INUSE_NR )) {pr_err ("PROTO_INUSE_NR exhausted\n" );return -ENOSPC ; }
@@ -3582,7 +3582,7 @@ static int assign_proto_idx(struct proto *prot)static void release_proto_idx (struct proto *prot) { -if (prot->inuse_idx !=PROTO_INUSE_NR -1 ) +if (prot->inuse_idx !=PROTO_INUSE_NR )clear_bit (prot->inuse_idx, proto_inuse_idx); }#else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 334/411 i40e: fix MMIO write access to an invalid page in i40e_clear_hw
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyungwook Boo <[email protected]>
[ Upstream commit 015bac5daca978448f2671478c553ce1f300c21e ]
When the device sends a specific input, an integer underflow can occur, leading to MMIO write access to an invalid page.
Prevent the integer underflow by changing the type of related variables.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +4 -3
@@ -1061,10 +1061,11 @@ int i40e_pf_reset(struct i40e_hw *hw)void i40e_clear_hw (struct i40e_hw *hw) {u32 num_queues, base_queue; -u32 num_pf_int; -u32 num_vf_int; +s32 num_pf_int; +s32 num_vf_int;u32 num_vfs; -u32 i, j; +s32 i; +u32 j;u32 val;u32 eol =0x7ff ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 335/411 bpf, sockmap: Fix data lost during EAGAIN retries
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 7683167196bd727ad5f3c3fc6a9ca70f54520a81 ]
We call skb_bpf_redirect_clear() to clean _sk_redir before handling skb in backlog, but when sk_psock_handle_skb() return EAGAIN due to sk_rcvbuf limit, the redirect info in _sk_redir is not recovered.
Fix skb redir loss during EAGAIN retries by restoring _sk_redir information using skb_bpf_set_redir().
Before this patch:
'''
./bench sockmap -c 2 -p 1 -a --rx-verdict-ingress
Setting up benchmark 'sockmap'...
create socket fd c1:13 p1:14 c2:15 p2:16
Benchmark 'sockmap' started.
Send Speed 1343.172 MB/s, BPF Speed 1343.238 MB/s, Rcv Speed 65.271 MB/s Send Speed 1352.022 MB/s, BPF Speed 1352.088 MB/s, Rcv Speed 0 MB/s Send Speed 1354.105 MB/s, BPF Speed 1354.105 MB/s, Rcv Speed 0 MB/s Send Speed 1355.018 MB/s, BPF Speed 1354.887 MB/s, Rcv Speed 0 MB/s
'''
Due to the high send rate, the RX processing path may frequently hit the sk_rcvbuf limit. Once triggered, incorrect _sk_redir will cause the flow to mistakenly enter the "!ingress" path, leading to send failures. (The Rcv speed depends on tcp_rmem).
After this patch:
'''
./bench sockmap -c 2 -p 1 -a --rx-verdict-ingress
Setting up benchmark 'sockmap'...
create socket fd c1:13 p1:14 c2:15 p2:16
Benchmark 'sockmap' started.
Send Speed 1347.236 MB/s, BPF Speed 1347.367 MB/s, Rcv Speed 65.402 MB/s Send Speed 1353.320 MB/s, BPF Speed 1353.320 MB/s, Rcv Speed 65.536 MB/s Send Speed 1353.186 MB/s, BPF Speed 1353.121 MB/s, Rcv Speed 65.536 MB/s
'''
--- net/core/skmsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/skmsg.c +2 -1
@@ -672,7 +672,8 @@ static void sk_psock_backlog(struct work_struct *work)if (ret <=0 ) {if (ret == -EAGAIN ) {sk_psock_skb_state (psock, state, len, off); - +/* Restore redir info we cleared before */ +skb_bpf_set_redir (skb, psock->sk, ingress);/* Delay slightly to prioritize any * other work that might be here. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 336/411 octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 9c056ec6dd1654b1420dafbbe2a69718850e6ff2 ]
The cn10k_free_matchall_ipolicer() calls the cn10k_map_unmap_rq_policer() for each queue in a for loop without checking for any errors.
Check the return value of the cn10k_map_unmap_rq_policer() function during each loop, and report a warning if the function fails.
--- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +6 -3
@@ -351,9 +351,12 @@ int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf)mutex_lock (&pfvf->mbox.lock);/* Remove RQ's policer mapping */ -for (qidx =0 ; qidx < hw->rx_queues; qidx++) -cn10k_map_unmap_rq_policer (pfvf, qidx, - hw->matchall_ipolicer, false); +for (qidx =0 ; qidx < hw->rx_queues; qidx++) { + rc =cn10k_map_unmap_rq_policer (pfvf, qidx, hw->matchall_ipolicer, false); +if (rc) +dev_warn (pfvf->dev,"Failed to unmap RQ %d's policer (error %d)." , + qidx, rc); + } rc =cn10k_free_leaf_profile (pfvf, hw->matchall_ipolicer);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 337/411 watchdog: da9052_wdt: respect TWDMIN
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcus Folkesson <[email protected]>
[ Upstream commit 325f510fcd9cda5a44bcb662b74ba4e3dabaca10 ]
We have to wait at least the minimium time for the watchdog window (TWDMIN) before writings to the wdt register after the watchdog is activated.
Otherwise the chip will assert TWD_ERROR and power down to reset mode.
--- drivers/watchdog/da9052_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/da9052_wdt.c +1 -0
@@ -164,6 +164,7 @@ static int da9052_wdt_probe(struct platform_device *pdev) da9052_wdt = &driver_data->wdt; da9052_wdt->timeout =DA9052_DEF_TIMEOUT ; + da9052_wdt->min_hw_heartbeat_ms =DA9052_TWDMIN ; da9052_wdt->info = &da9052_wdt_info; da9052_wdt->ops = &da9052_wdt_ops; da9052_wdt->parent = dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 338/411 bus: fsl-mc: increase MC_CMD_COMPLETION_TIMEOUT_MS value
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Tudor <[email protected]>
[ Upstream commit 23d060136841c58c2f9ee8c08ad945d1879ead4b ]
In case the MC firmware runs in debug mode with extensive prints pushed to the console, the current timeout of 500ms is not enough. Increase the timeout value so that we don't have any chance of wrongly assuming that the firmware is not responding when it's just taking more time.
--- drivers/bus/fsl-mc/mc-sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/fsl-mc/mc-sys.c +1 -1
@@ -19,7 +19,7 @@/* * Timeout in milliseconds to wait for the completion of an MC command */ -#define MC_CMD_COMPLETION_TIMEOUT_MS 500 +#define MC_CMD_COMPLETION_TIMEOUT_MS 15000/* * usleep_range() min and max values used to throttle down polling
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 339/411 ARM: OMAP2+: Fix l4ls clk domain handling in STANDBY
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sukrut Bellary <[email protected]>
[ Upstream commit 47fe74098f3dadba2f9cc1e507d813a4aa93f5f3 ]
Don't put the l4ls clk domain to sleep in case of standby. Since CM3 PM FW[1](ti-v4.1.y) doesn't wake-up/enable the l4ls clk domain upon wake-up, CM3 PM FW fails to wake-up the MPU.
[1] https://git.ti.com/cgit/processor-firmware/ti-amx3-cm3-pm-firmware/
--- arch/arm/mach-omap2/clockdomain.h | 1 + arch/arm/mach-omap2/clockdomains33xx_data.c | 2 +- arch/arm/mach-omap2/cm33xx.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clockdomain.h +1 -0
@@ -48,6 +48,7 @@#define CLKDM_NO_AUTODEPS (1 << 4)#define CLKDM_ACTIVE_WITH_MPU (1 << 5)#define CLKDM_MISSING_IDLE_REPORTING (1 << 6) +#define CLKDM_STANDBY_FORCE_WAKEUP BIT(7)#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
arch/arm/mach-omap2/clockdomains33xx_data.c +1 -1
@@ -27,7 +27,7 @@ static struct clockdomain l4ls_am33xx_clkdm = { .pwrdm = { .name = "per_pwrdm" }, .cm_inst = AM33XX_CM_PER_MOD, .clkdm_offs = AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET, - .flags = CLKDM_CAN_SWSUP, + .flags = CLKDM_CAN_SWSUP | CLKDM_STANDBY_FORCE_WAKEUP, };static struct clockdomain l3s_am33xx_clkdm = {
arch/arm/mach-omap2/cm33xx.c +13 -1
@@ -28,6 +28,9 @@#include "cm-regbits-34xx.h" #include "cm-regbits-33xx.h" #include "prm33xx.h" +#if IS_ENABLED (CONFIG_SUSPEND ) +#include <linux/suspend.h> +#endif /* * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
@@ -336,8 +339,17 @@ static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm) {bool hwsup = false; +#if IS_ENABLED (CONFIG_SUSPEND ) +/* +* In case of standby, Don't put the l4ls clk domain to sleep. +* Since CM3 PM FW doesn't wake-up/enable the l4ls clk domain +* upon wake-up, CM3 PM FW fails to wake-up th MPU. +*/ +if (pm_suspend_target_state ==PM_SUSPEND_STANDBY && + (clkdm->flags &CLKDM_STANDBY_FORCE_WAKEUP )) +return 0 ; +#endif hwsup =am33xx_cm_is_clkdm_in_hwsup (clkdm->cm_inst, clkdm->clkdm_offs); -if (!hwsup && (clkdm->flags &CLKDM_CAN_FORCE_SLEEP ))am33xx_clkdm_sleep (clkdm);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 340/411 tee: Prevent size calculation wraparound on 32-bit kernels
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 39bb67edcc582b3b386a9ec983da67fa8a10ec03 ]
The current code around TEE_IOCTL_PARAM_SIZE() is a bit wrong on 32-bit kernels: Multiplying a user-provided 32-bit value with the size of a structure can wrap around on such platforms.
Fix it by using saturating arithmetic for the size calculation.
This has no security consequences because, in all users of TEE_IOCTL_PARAM_SIZE(), the subsequent kcalloc() implicitly checks for wrapping.
--- drivers/tee/tee_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/tee/tee_core.c +6 -5
@@ -10,6 +10,7 @@#include <linux/fs.h> #include <linux/idr.h> #include <linux/module.h> +#include <linux/overflow.h> #include <linux/slab.h> #include <linux/tee_drv.h> #include <linux/uaccess.h>
@@ -19,7 +20,7 @@#define TEE_NUM_DEVICES 32 -#define TEE_IOCTL_PARAM_SIZE (x) (sizeof(struct tee_param) * (x)) +#define TEE_IOCTL_PARAM_SIZE (x) (size_mul(sizeof(struct tee_param), (x)))#define TEE_UUID_NS_NAME_SIZE 128
@@ -493,7 +494,7 @@ static int tee_ioctl_open_session(struct tee_context *ctx,if (copy_from_user (&arg, uarg,sizeof (arg)))return -EFAULT ; -if (sizeof (arg) +TEE_IOCTL_PARAM_SIZE (arg.num_params) != buf.buf_len) +if (size_add (sizeof (arg),TEE_IOCTL_PARAM_SIZE (arg.num_params)) != buf.buf_len)return -EINVAL ;if (arg.num_params) {
@@ -571,7 +572,7 @@ static int tee_ioctl_invoke(struct tee_context *ctx,if (copy_from_user (&arg, uarg,sizeof (arg)))return -EFAULT ; -if (sizeof (arg) +TEE_IOCTL_PARAM_SIZE (arg.num_params) != buf.buf_len) +if (size_add (sizeof (arg),TEE_IOCTL_PARAM_SIZE (arg.num_params)) != buf.buf_len)return -EINVAL ;if (arg.num_params) {
@@ -705,7 +706,7 @@ static int tee_ioctl_supp_recv(struct tee_context *ctx,if (get_user (num_params, &uarg->num_params))return -EFAULT ; -if (sizeof (*uarg) +TEE_IOCTL_PARAM_SIZE (num_params) != buf.buf_len) +if (size_add (sizeof (*uarg),TEE_IOCTL_PARAM_SIZE (num_params)) != buf.buf_len)return -EINVAL ; params =kcalloc (num_params,sizeof (struct tee_param ),GFP_KERNEL );
@@ -804,7 +805,7 @@ static int tee_ioctl_supp_send(struct tee_context *ctx, get_user(num_params, &uarg->num_params))return -EFAULT ; -if (sizeof (*uarg) +TEE_IOCTL_PARAM_SIZE (num_params) > buf.buf_len) +if (size_add (sizeof (*uarg),TEE_IOCTL_PARAM_SIZE (num_params)) > buf.buf_len)return -EINVAL ; params =kcalloc (num_params,sizeof (struct tee_param ),GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 341/411 Revert "bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
[ Upstream commit 36305857b1ead8f6ca033a913162ebc09bee0b43 ]
This reverts commit 4700a00755fb5a4bb5109128297d6fd2d1272ee6.
It breaks target-module@2b300050 ("ti,sysc-omap2") probe on AM62x in a case when minimally-configured system tries to network-boot:
[ 6.888776] probe of 2b300050.target-module returned 517 after 258 usecs [ 17.129637] probe of 2b300050.target-module returned 517 after 708 usecs [ 17.137397] platform 2b300050.target-module: deferred probe pending: (reason unknown) [ 26.878471] Waiting up to 100 more seconds for network.
There are minimal configurations possible when the deferred device is not being probed any more (because everything else has been successfully probed) and deferral lists are not processed any more.
Stable mmc enumeration can be achieved by filling /aliases node properly (4700a00755fb commit's rationale).
After revert:
[ 9.006816] IP-Config: Complete: [ 9.010058] device=lan0, ...
--- drivers/bus/ti-sysc.c | 49 ------------------------------------------- 1 file changed, 49 deletions(-)
drivers/bus/ti-sysc.c +0 -49
@@ -687,51 +687,6 @@ static int sysc_parse_and_check_child_range(struct sysc *ddata)return 0 ; } -/* Interconnect instances to probe before l4_per instances */ -static struct resource early_bus_ranges[] = { -/* am3/4 l4_wkup */ - { .start =0x44c00000 , .end =0x44c00000 +0x300000 , }, -/* omap4/5 and dra7 l4_cfg */ - { .start =0x4a000000 , .end =0x4a000000 +0x300000 , }, -/* omap4 l4_wkup */ - { .start =0x4a300000 , .end =0x4a300000 +0x30000 , }, -/* omap5 and dra7 l4_wkup without dra7 dcan segment */ - { .start =0x4ae00000 , .end =0x4ae00000 +0x30000 , }, -}; - -static atomic_t sysc_defer =ATOMIC_INIT (10 ); - -/** -* sysc_defer_non_critical - defer non_critical interconnect probing -* @ddata: device driver data -* -* We want to probe l4_cfg and l4_wkup interconnect instances before any -* l4_per instances as l4_per instances depend on resources on l4_cfg and -* l4_wkup interconnects. -*/ -static int sysc_defer_non_critical (struct sysc *ddata) -{ -struct resource *res; -int i; - -if (!atomic_read (&sysc_defer)) -return 0 ; - -for (i =0 ; i <ARRAY_SIZE (early_bus_ranges); i++) { - res = &early_bus_ranges[i]; -if (ddata->module_pa >= res->start && - ddata->module_pa <= res->end) { -atomic_set (&sysc_defer,0 ); - -return 0 ; - } - } - -atomic_dec_if_positive (&sysc_defer); - -return -EPROBE_DEFER ; -} -static struct device_node *stdout_path;static void sysc_init_stdout_path (struct sysc *ddata)
@@ -957,10 +912,6 @@ static int sysc_map_and_check_registers(struct sysc *ddata)if (error)return error; - error =sysc_defer_non_critical (ddata); -if (error) -return error; -sysc_check_children (ddata);if (!of_get_property (np,"reg" ,NULL ))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 342/411 platform/x86: dell_rbu: Fix list usage
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Hayes <[email protected]>
[ Upstream commit 61ce04601e0d8265ec6d2ffa6df5a7e1bce64854 ]
Pass the correct list head to list_for_each_entry*() when looping through the packet list.
Without this patch, reading the packet data via sysfs will show the data incorrectly (because it starts at the wrong packet), and clearing the packet list will result in a NULL pointer dereference.
--- drivers/platform/x86/dell/dell_rbu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell_rbu.c +2 -2
@@ -292,7 +292,7 @@ static int packet_read_list(char *data, size_t * pread_length) remaining_bytes = *pread_length; bytes_read = rbu_data.packet_read_count; -list_for_each_entry (newpacket, (&packet_data_head.list)->next, list) { +list_for_each_entry (newpacket, &packet_data_head.list, list) { bytes_copied =do_packet_read (pdest, newpacket, remaining_bytes, bytes_read, &temp_count); remaining_bytes -= bytes_copied;
@@ -315,7 +315,7 @@ static void packet_empty_list(void) {struct packet_data *newpacket, *tmp; -list_for_each_entry_safe (newpacket, tmp, (&packet_data_head.list)->next, list) { +list_for_each_entry_safe (newpacket, tmp, &packet_data_head.list, list) {list_del (&newpacket->list);/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 343/411 platform/x86: dell_rbu: Stop overwriting data buffer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Hayes <[email protected]>
[ Upstream commit f4b0fa38d5fefe9aed6ed831f3bd3538c168ee19 ]
The dell_rbu driver will use memset() to clear the data held by each packet when it is no longer needed (when the driver is unloaded, the packet size is changed, etc).
The amount of memory that is cleared (before this patch) is the normal packet size. However, the last packet in the list may be smaller.
Fix this to only clear the memory actually used by each packet, to prevent it from writing past the end of data buffer.
Because the packet data buffers are allocated with __get_free_pages() (in page-sized increments), this bug could only result in a buffer being overwritten when a packet size larger than one page is used. The only user of the dell_rbu module should be the Dell BIOS update program, which uses a packet size of 4096, so no issues should be seen without the patch, it just blocks the possiblity.
--- drivers/platform/x86/dell/dell_rbu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/dell/dell_rbu.c +1 -1
@@ -322,7 +322,7 @@ static void packet_empty_list(void)* zero out the RBU packet memory before freeing * to make sure there are no stale RBU packets left in memory */ -memset (newpacket->data,0 , rbu_data.packetsize); +memset (newpacket->data,0 , newpacket->length);set_memory_wb ((unsigned long )newpacket->data,1 << newpacket->ordernum); free_pages((unsigned long) newpacket->data,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 344/411 powerpc/eeh: Fix missing PE bridge reconfiguration during VFIO EEH recovery
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narayana Murty N <[email protected]>
[ Upstream commit 33bc69cf6655cf60829a803a45275f11a74899e5 ]
VFIO EEH recovery for PCI passthrough devices fails on PowerNV and pseries platforms due to missing host-side PE bridge reconfiguration. In the current implementation, eeh_pe_configure() only performs RTAS or OPAL-based bridge reconfiguration for native host devices, but skips it entirely for PEs managed through VFIO in guest passthrough scenarios.
This leads to incomplete EEH recovery when a PCI error affects a passthrough device assigned to a QEMU/KVM guest. Although VFIO triggers the EEH recovery flow through VFIO_EEH_PE_ENABLE ioctl, the platform-specific bridge reconfiguration step is silently bypassed. As a result, the PE's config space is not fully restored, causing subsequent config space access failures or EEH freeze-on-access errors inside the guest.
This patch fixes the issue by ensuring that eeh_pe_configure() always invokes the platform's configure_bridge() callback (e.g., pseries_eeh_phb_configure_bridge) even for VFIO-managed PEs. This ensures that RTAS or OPAL calls to reconfigure the PE bridge are correctly issued on the host side, restoring the PE's configuration space after an EEH event.
This fix is essential for reliable EEH recovery in QEMU/KVM guests using VFIO PCI passthrough on PowerNV and pseries systems.
Tested with:
- QEMU/KVM guest using VFIO passthrough (IBM Power9,(lpar)Power11 host)
- Injected EEH errors with pseries EEH errinjct tool on host, recovery verified on qemu guest.
- Verified successful config space access and CAP_EXP DevCtl restoration after recovery
--- arch/powerpc/kernel/eeh.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/eeh.c +2 -0
@@ -1504,6 +1504,8 @@ int eeh_pe_configure(struct eeh_pe *pe)/* Invalid PE ? */ if (!pe)return -ENODEV ; +else + ret = eeh_ops->configure_bridge (pe);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 345/411 Revert "x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2" on v6.6 and older
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
This reverts commit 4fc2d289b3cc4cf23ccabe59cf936d1dc49aeda8 which is commit 98fdaeb296f51ef08e727a7cc72e5b5c864c4f4d upstream.
commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") depends on commit 72c70f480a70 ("x86/bugs: Add a separate config for Spectre V2"), which introduced MITIGATION_SPECTRE_V2.
commit 72c70f480a70 ("x86/bugs: Add a separate config for Spectre V2") never landed in stable tree, thus, stable tree doesn't have MITIGATION_SPECTRE_V2, that said, commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") has no value if the dependecy was not applied.
Revert commit 7adb96687ce8 ("x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2") in stable kernel which landed in in 5.4.294, 5.10.238, 5.15.185, 6.1.141 and 6.6.93 stable versions.
--- Documentation/admin-guide/kernel-parameters.txt | 2 -- arch/x86/kernel/cpu/bugs.c | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +0 -2
@@ -5445,8 +5445,6 @@ Selecting 'on' will also enable the mitigation against user space to user space task attacks. - Selecting specific mitigation does not force enable - user mitigations. Selecting 'off' will disable both the kernel and the user space protections.
arch/x86/kernel/cpu/bugs.c +3 -7
@@ -1382,13 +1382,9 @@ static __ro_after_init enum spectre_v2_mstatic enum spectre_v2_user_cmd __init spectre_v2_parse_user_cmdline (void ) { -enum spectre_v2_user_cmd mode;char arg[20 ];int ret, i; - mode =IS_ENABLED (CONFIG_MITIGATION_SPECTRE_V2 ) ? -SPECTRE_V2_USER_CMD_AUTO :SPECTRE_V2_USER_CMD_NONE ; -switch (spectre_v2_cmd) {case SPECTRE_V2_CMD_NONE :return SPECTRE_V2_USER_CMD_NONE ;
@@ -1401,7 +1397,7 @@ spectre_v2_parse_user_cmdline(void) ret =cmdline_find_option (boot_command_line,"spectre_v2_user" , arg,sizeof (arg));if (ret <0 ) -return mode; +return SPECTRE_V2_USER_CMD_AUTO ;for (i =0 ; i <ARRAY_SIZE (v2_user_options); i++) {if (match_option (arg, ret, v2_user_options[i].option)) {
@@ -1411,8 +1407,8 @@ spectre_v2_parse_user_cmdline(void) } } -pr_err ("Unknown user space protection option (%s). Switching to default\n" , arg); -return mode; +pr_err ("Unknown user space protection option (%s). Switching to AUTO select\n" , arg); +return SPECTRE_V2_USER_CMD_AUTO ; }static inline bool spectre_v2_in_eibrs_mode (enum spectre_v2_mitigation mode)
Greg Kroah-Hartman
maintainerPATCH 346/411 drivers/rapidio/rio_cm.c: prevent possible heap overwrite
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit 50695153d7ddde3b1696dbf0085be0033bf3ddb3 upstream.
In
riocm_cdev_ioctl(RIO_CM_CHAN_SEND)
-> cm_chan_msg_send()
-> riocm_ch_send()
cm_chan_msg_send() checks that userspace didn't send too much data but riocm_ch_send() failed to check that userspace sent sufficient data. The result is that riocm_ch_send() can write to fields in the rio_ch_chan_hdr which were outside the bounds of the space which cm_chan_msg_send() allocated.
Address this by teaching riocm_ch_send() to check that the entire rio_ch_chan_hdr was copied in from userspace.
--- drivers/rapidio/rio_cm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/rapidio/rio_cm.c +3 -0
@@ -787,6 +787,9 @@ static int riocm_ch_send(u16 ch_id, voidif (buf ==NULL || ch_id ==0 || len ==0 || len >RIO_MAX_MSG_SIZE )return -EINVAL ; +if (len <sizeof (struct rio_ch_chan_hdr )) +return -EINVAL ;/* insufficient data from user */ + ch =riocm_get_channel (ch_id);if (!ch) { riocm_error("%s(%d) ch_%d not found", current->comm,
Greg Kroah-Hartman
maintainerPATCH 347/411 jffs2: check that raw node were preallocated before writing summary
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Sadovnikov <[email protected]>
commit ec9e6f22bce433b260ea226de127ec68042849b0 upstream.
Syzkaller detected a kernel bug in jffs2_link_node_ref, caused by fault injection in jffs2_prealloc_raw_node_refs. jffs2_sum_write_sumnode doesn't check return value of jffs2_prealloc_raw_node_refs and simply lets any error propagate into jffs2_sum_write_data, which eventually calls jffs2_link_node_ref in order to link the summary to an expectedly allocated node.
kernel BUG at fs/jffs2/nodelist.c:592!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 PID: 31277 Comm: syz-executor.7 Not tainted 6.1.128-syzkaller-00139-ge10f83ca10a1 #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:jffs2_link_node_ref+0x570/0x690 fs/jffs2/nodelist.c:592 Call Trace: <TASK> jffs2_sum_write_data fs/jffs2/summary.c:841 [inline] jffs2_sum_write_sumnode+0xd1a/0x1da0 fs/jffs2/summary.c:874 jffs2_do_reserve_space+0xa18/0xd60 fs/jffs2/nodemgmt.c:388 jffs2_reserve_space+0x55f/0xaa0 fs/jffs2/nodemgmt.c:197 jffs2_write_inode_range+0x246/0xb50 fs/jffs2/write.c:362 jffs2_write_end+0x726/0x15d0 fs/jffs2/file.c:301 generic_perform_write+0x314/0x5d0 mm/filemap.c:3856 __generic_file_write_iter+0x2ae/0x4d0 mm/filemap.c:3973 generic_file_write_iter+0xe3/0x350 mm/filemap.c:4005 call_write_iter include/linux/fs.h:2265 [inline] do_iter_readv_writev+0x20f/0x3c0 fs/read_write.c:735 do_iter_write+0x186/0x710 fs/read_write.c:861 vfs_iter_write+0x70/0xa0 fs/read_write.c:902 iter_file_splice_write+0x73b/0xc90 fs/splice.c:685 do_splice_from fs/splice.c:763 [inline] direct_splice_actor+0x10c/0x170 fs/splice.c:950 splice_direct_to_actor+0x337/0xa10 fs/splice.c:896 do_splice_direct+0x1a9/0x280 fs/splice.c:1002 do_sendfile+0xb13/0x12c0 fs/read_write.c:1255 __do_sys_sendfile64 fs/read_write.c:1323 [inline] __se_sys_sendfile64 fs/read_write.c:1309 [inline] __x64_sys_sendfile64+0x1cf/0x210 fs/read_write.c:1309 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x6e/0xd8
Fix this issue by checking return value of jffs2_prealloc_raw_node_refs before calling jffs2_sum_write_data.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jffs2/summary.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/jffs2/summary.c +6 -1
@@ -858,7 +858,10 @@ int jffs2_sum_write_sumnode(struct jffs2spin_unlock (&c->erase_completion_lock); jeb = c->nextblock; -jffs2_prealloc_raw_node_refs (c, jeb,1 ); + ret =jffs2_prealloc_raw_node_refs (c, jeb,1 ); + +if (ret) + goto out;if (!c->summary->sum_num || !c->summary->sum_list_head) {JFFS2_WARNING ("Empty summary info!!!\n" );
@@ -872,6 +875,8 @@ int jffs2_sum_write_sumnode(struct jffs2 datasize += padsize; ret =jffs2_sum_write_data (c, jeb, infosize, datasize, padsize); + +out:spin_lock (&c->erase_completion_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 348/411 jffs2: check jffs2_prealloc_raw_node_refs() result in few other places
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 2b6d96503255a3ed676cd70f8368870c6d6a25c6 upstream.
Fuzzing hit another invalid pointer dereference due to the lack of checking whether jffs2_prealloc_raw_node_refs() completed successfully. Subsequent logic implies that the node refs have been allocated.
Handle that. The code is ready for propagating the error upwards.
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 1 PID: 5835 Comm: syz-executor145 Not tainted 5.10.234-syzkaller #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:jffs2_link_node_ref+0xac/0x690 fs/jffs2/nodelist.c:600 Call Trace: jffs2_mark_erased_block fs/jffs2/erase.c:460 [inline] jffs2_erase_pending_blocks+0x688/0x1860 fs/jffs2/erase.c:118 jffs2_garbage_collect_pass+0x638/0x1a00 fs/jffs2/gc.c:253 jffs2_reserve_space+0x3f4/0xad0 fs/jffs2/nodemgmt.c:167 jffs2_write_inode_range+0x246/0xb50 fs/jffs2/write.c:362 jffs2_write_end+0x712/0x1110 fs/jffs2/file.c:302 generic_perform_write+0x2c2/0x500 mm/filemap.c:3347 __generic_file_write_iter+0x252/0x610 mm/filemap.c:3465 generic_file_write_iter+0xdb/0x230 mm/filemap.c:3497 call_write_iter include/linux/fs.h:2039 [inline] do_iter_readv_writev+0x46d/0x750 fs/read_write.c:740 do_iter_write+0x18c/0x710 fs/read_write.c:866 vfs_writev+0x1db/0x6a0 fs/read_write.c:939 do_pwritev fs/read_write.c:1036 [inline] __do_sys_pwritev fs/read_write.c:1083 [inline] __se_sys_pwritev fs/read_write.c:1078 [inline] __x64_sys_pwritev+0x235/0x310 fs/read_write.c:1078 do_syscall_64+0x30/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x67/0xd1
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jffs2/erase.c | 4 +++- fs/jffs2/scan.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
fs/jffs2/erase.c +3 -1
@@ -427,7 +427,9 @@ static void jffs2_mark_erased_block(stru .totlen = cpu_to_je32(c->cleanmarker_size) }; -jffs2_prealloc_raw_node_refs (c, jeb,1 ); + ret =jffs2_prealloc_raw_node_refs (c, jeb,1 ); +if (ret) + goto filebad; marker.hdr_crc =cpu_to_je32 (crc32 (0 , &marker,sizeof (struct jffs2_unknown_node )-4 ));
fs/jffs2/scan.c +3 -1
@@ -256,7 +256,9 @@ int jffs2_scan_medium(struct jffs2_sb_injffs2_dbg (1 ,"%s(): Skipping %d bytes in nextblock to ensure page alignment\n" , __func__, skip); -jffs2_prealloc_raw_node_refs (c, c->nextblock,1 ); + ret =jffs2_prealloc_raw_node_refs (c, c->nextblock,1 ); +if (ret) + goto out; jffs2_scan_dirty_space(c, c->nextblock, skip); }#endif
Greg Kroah-Hartman
maintainerPATCH 349/411 scsi: storvsc: Increase the timeouts to storvsc_timeout
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
commit b2f966568faaad326de97481096d0f3dc0971c43 upstream.
Currently storvsc_timeout is only used in storvsc_sdev_configure(), and 5s and 10s are used elsewhere. It turns out that rarely the 5s is not enough on Azure, so let's use storvsc_timeout everywhere.
In case a timeout happens and storvsc_channel_init() returns an error, close the VMBus channel so that any host-to-guest messages in the channel's ringbuffer, which might come late, can be safely ignored.
Add a "const" to storvsc_timeout.
--- drivers/scsi/storvsc_drv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/storvsc_drv.c +6 -4
@@ -399,7 +399,7 @@ MODULE_PARM_DESC(ring_avail_percent_lowa/* * Timeout in seconds for all devices managed by this driver. */ -static int storvsc_timeout =180 ; +static const int storvsc_timeout =180 ;#if IS_ENABLED (CONFIG_SCSI_FC_ATTRS )static struct scsi_transport_template *fc_transport_template;
@@ -819,7 +819,7 @@ static void handle_multichannel_storagereturn ; } - t =wait_for_completion_timeout (&request->wait_event,10 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 ) {dev_err (dev,"Failed to create sub-channel: timed out\n" );return ;
@@ -885,7 +885,7 @@ static int storvsc_execute_vstor_op(struif (ret !=0 )return ret; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 )return -ETIMEDOUT ;
@@ -1398,6 +1398,8 @@ static int storvsc_connect_to_vsp(structreturn ret; ret =storvsc_channel_init (device, is_fc); +if (ret) +vmbus_close (device->channel);return ret; }
@@ -1719,7 +1721,7 @@ static int storvsc_host_reset_handler(stif (ret !=0 )return FAILED ; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 )return TIMEOUT_ERROR ;
Greg Kroah-Hartman
maintainerPATCH 350/411 scsi: s390: zfcp: Ensure synchronous unit_add
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
commit 9697ca0d53e3db357be26d2414276143c4a2cd49 upstream.
Improve the usability of the unit_add sysfs attribute by ensuring that the associated FCP LUN scan processing is completed synchronously. This enables configuration tooling to consistently determine the end of the scan process to allow for serialization of follow-on actions.
While the scan process associated with unit_add typically completes synchronously, it is deferred to an asynchronous background process if unit_add is used before initial remote port scanning has completed. This occurs when unit_add is used immediately after setting the associated FCP device online.
To ensure synchronous unit_add processing, wait for remote port scanning to complete before initiating the FCP LUN scan.
--- drivers/s390/scsi/zfcp_sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/s390/scsi/zfcp_sysfs.c +2 -0
@@ -450,6 +450,8 @@ static ssize_t zfcp_sysfs_unit_add_storeif (kstrtoull (buf,0 , (unsigned long long *) &fcp_lun))return -EINVAL ; +flush_work (&port->rport_work); + retval =zfcp_unit_add (port, fcp_lun);if (retval)return retval;
Greg Kroah-Hartman
maintainerPATCH 351/411 udmabuf: use sgtable-based scatterlist wrappers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit afe382843717d44b24ef5014d57dcbaab75a4052 upstream.
Use common wrappers operating directly on the struct sg_table objects to fix incorrect use of scatterlists sync calls. dma_sync_sg_for_*() functions have to be called with the number of elements originally passed to dma_map_sg_*() function, not the one returned in sgtable's nents.
--- drivers/dma-buf/udmabuf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/dma-buf/udmabuf.c +2 -3
@@ -133,8 +133,7 @@ static int begin_cpu_udmabuf(struct dma_ ubuf->sg =NULL ; } }else { -dma_sync_sg_for_cpu (dev, ubuf->sg->sgl, ubuf->sg->nents, - direction); +dma_sync_sgtable_for_cpu (dev, ubuf->sg, direction); }return ret;
@@ -149,7 +148,7 @@ static int end_cpu_udmabuf(struct dma_buif (!ubuf->sg)return -EINVAL ; -dma_sync_sg_for_device (dev, ubuf->sg->sgl, ubuf->sg->nents, direction); +dma_sync_sgtable_for_device (dev, ubuf->sg, direction);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 352/411 selftests/x86: Add a test to detect infinite SIGTRAP handler loop
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Li (Intel) <[email protected]>
commit f287822688eeb44ae1cf6ac45701d965efc33218 upstream.
When FRED is enabled, if the Trap Flag (TF) is set without an external debugger attached, it can lead to an infinite loop in the SIGTRAP handler. To avoid this, the software event flag in the augmented SS must be cleared, ensuring that no single-step trap remains pending when ERETU completes.
This test checks for that specific scenario—verifying whether the kernel correctly prevents an infinite SIGTRAP loop in this edge case when FRED is enabled.
The test should _always_ pass with IDT event delivery, thus no need to disable the test even when FRED is not enabled.
--- tools/testing/selftests/x86/Makefile | 2 tools/testing/selftests/x86/sigtrap_loop.c | 101 +++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/x86/sigtrap_loop.c
tools/testing/selftests/x86/Makefile +1 -1
@@ -12,7 +12,7 @@ CAN_BUILD_WITH_NOPIE := $(shell ./check_ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ check_initial_reg_state sigreturn iopl ioperm \ - test_vsyscall mov_ss_trap \ + test_vsyscall mov_ss_trap sigtrap_loop \ syscall_arg_fault fsgsbase_restore sigaltstack TARGETS_C_32BIT_ONLY := entry_from_vm86 test_syscall_vdso unwind_vdso \ test_FCMOV test_FCOMI test_FISTTP \
tools/testing/selftests/x86/sigtrap_loop.c new file +101 -0
101 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 353/411 selinux: fix selinux_xfrm_alloc_user() to set correct ctx_len
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Smalley <[email protected]>
commit 86c8db86af43f52f682e53a0f2f0828683be1e52 upstream.
We should count the terminating NUL byte as part of the ctx_len. Otherwise, UBSAN logs a warning:
UBSAN: array-index-out-of-bounds in security/selinux/xfrm.c:99:14 index 60 is out of range for type 'char [*]'
The allocation itself is correct so there is no actual out of bounds indexing, just a warning.
--- security/selinux/xfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/xfrm.c +1 -1
@@ -95,7 +95,7 @@ static int selinux_xfrm_alloc_user(struc ctx->ctx_doi =XFRM_SC_DOI_LSM ; ctx->ctx_alg =XFRM_SC_ALG_SELINUX ; - ctx->ctx_len = str_len; + ctx->ctx_len = str_len +1 ;memcpy (ctx->ctx_str, &uctx[1 ], str_len); ctx->ctx_str[str_len] ='\0' ; rc = security_context_to_sid(&selinux_state, ctx->ctx_str, str_len,
Greg Kroah-Hartman
maintainerPATCH 354/411 atm: Revert atm_account_tx() if copy_from_iter_full() fails.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 7851263998d4269125fd6cb3fdbfc7c6db853859 upstream.
In vcc_sendmsg(), we account skb->truesize to sk->sk_wmem_alloc by atm_account_tx().
It is expected to be reverted by atm_pop_raw() later called by vcc->dev->ops->send(vcc, skb).
However, vcc_sendmsg() misses the same revert when copy_from_iter_full() fails, and then we will leak a socket.
Let's factorise the revert part as atm_return_tx() and call it in the failure path.
Note that the corresponding sk_wmem_alloc operation can be found in alloc_tx() as of the blamed commit.
$ git blame -L:alloc_tx net/atm/common.c c55fa3cccbc2c~
--- include/linux/atmdev.h | 6 ++++++ net/atm/common.c | 1 + net/atm/raw.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-)
include/linux/atmdev.h +6 -0
@@ -249,6 +249,12 @@ static inline void atm_account_tx(structATM_SKB (skb)->atm_options = vcc->atm_options; } +static inline void atm_return_tx (struct atm_vcc *vcc,struct sk_buff *skb) +{ +WARN_ON_ONCE (refcount_sub_and_test (ATM_SKB (skb)->acct_truesize, + &sk_atm (vcc)->sk_wmem_alloc)); +} +static inline void atm_force_charge (struct atm_vcc *vcc,int truesize) {atomic_add (truesize, &sk_atm (vcc)->sk_rmem_alloc);
net/atm/common.c +1 -0
@@ -635,6 +635,7 @@ int vcc_sendmsg(struct socket *sock, str skb->dev =NULL ;/* for paths shared with net_device interfaces */ if (!copy_from_iter_full (skb_put (skb, size), size, &m->msg_iter)) { +atm_return_tx (vcc, skb);kfree_skb (skb); error = -EFAULT ; goto out;
net/atm/raw.c +1 -1
@@ -36,7 +36,7 @@ static void atm_pop_raw(struct atm_vcc *pr_debug ("(%d) %d -= %d\n" , vcc->vci,sk_wmem_alloc_get (sk),ATM_SKB (skb)->acct_truesize); -WARN_ON (refcount_sub_and_test (ATM_SKB (skb)->acct_truesize, &sk->sk_wmem_alloc)); +atm_return_tx (vcc, skb);dev_kfree_skb_any (skb); sk->sk_write_space (sk); }
Greg Kroah-Hartman
maintainerPATCH 355/411 HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Junge <[email protected]>
commit fe7f7ac8e0c708446ff017453add769ffc15deed upstream.
Update struct hid_descriptor to better reflect the mandatory and optional parts of the HID Descriptor as per USB HID 1.11 specification.
Note: the kernel currently does not parse any optional HID class descriptors, only the mandatory report descriptor.
Update all references to member element desc[0] to rpt_desc.
Add test to verify bLength and bNumDescriptors values are valid.
Replace the for loop with direct access to the mandatory HID class descriptor member for the report descriptor. This eliminates the possibility of getting an out-of-bounds fault.
Add a warning message if the HID descriptor contains any unsupported optional HID class descriptors.
--- drivers/hid/hid-hyperv.c | 5 +++-- drivers/hid/usbhid/hid-core.c | 25 ++++++++++++++----------- drivers/usb/gadget/function/f_hid.c | 12 ++++++------ include/linux/hid.h | 3 ++- 4 files changed, 25 insertions(+), 20 deletions(-)
drivers/hid/hid-hyperv.c +3 -2
@@ -199,7 +199,8 @@ static void mousevsc_on_receive_device_iif (!input_device->hid_desc) goto cleanup; - input_device->report_desc_size = desc->desc[0 ].wDescriptorLength; + input_device->report_desc_size =le16_to_cpu ( + desc->rpt_desc.wDescriptorLength);if (input_device->report_desc_size ==0 ) { input_device->dev_info_status = -EINVAL ; goto cleanup;
@@ -217,7 +218,7 @@ static void mousevsc_on_receive_device_imemcpy (input_device->report_desc, ((unsigned char *)desc) + desc->bLength, - desc->desc[0 ].wDescriptorLength); +le16_to_cpu (desc->rpt_desc.wDescriptorLength));/* Send the ack */ memset (&ack,0 ,sizeof (struct mousevsc_prt_msg ));
drivers/hid/usbhid/hid-core.c +14 -11
@@ -982,12 +982,11 @@ static int usbhid_parse(struct hid_devicstruct usb_host_interface *interface = intf->cur_altsetting;struct usb_device *dev =interface_to_usbdev (intf);struct hid_descriptor *hdesc; +struct hid_class_descriptor *hcdesc;u32 quirks =0 ;unsigned int rsize =0 ;char *rdesc; -int ret, n; -int num_descriptors; -size_t offset = offsetof(struct hid_descriptor , desc); +int ret; quirks =hid_lookup_quirk (hid);
@@ -1009,20 +1008,19 @@ static int usbhid_parse(struct hid_devicreturn -ENODEV ; } -if (hdesc->bLength <sizeof (struct hid_descriptor )) { -dbg_hid ("hid descriptor is too short\n" ); +if (!hdesc->bNumDescriptors || + hdesc->bLength !=sizeof (*hdesc) + + (hdesc->bNumDescriptors -1 ) *sizeof (*hcdesc)) { +dbg_hid ("hid descriptor invalid, bLen=%hhu bNum=%hhu\n" , + hdesc->bLength, hdesc->bNumDescriptors);return -EINVAL ; } hid->version =le16_to_cpu (hdesc->bcdHID); hid->country = hdesc->bCountryCode; - num_descriptors =min_t (int, hdesc->bNumDescriptors, - (hdesc->bLength - offset) /sizeof (struct hid_class_descriptor )); - -for (n =0 ; n < num_descriptors; n++) -if (hdesc->desc[n].bDescriptorType ==HID_DT_REPORT ) - rsize =le16_to_cpu (hdesc->desc[n].wDescriptorLength); +if (hdesc->rpt_desc.bDescriptorType ==HID_DT_REPORT ) + rsize =le16_to_cpu (hdesc->rpt_desc.wDescriptorLength);if (!rsize || rsize >HID_MAX_DESCRIPTOR_SIZE ) {dbg_hid ("weird size of report descriptor (%u)\n" , rsize);
@@ -1050,6 +1048,11 @@ static int usbhid_parse(struct hid_devic goto err; } +if (hdesc->bNumDescriptors >1 ) +hid_warn (intf, +"%u unsupported optional hid class descriptors\n" , + (int )(hdesc->bNumDescriptors -1 )); + hid->quirks |= quirks;return 0 ;
drivers/usb/gadget/function/f_hid.c +6 -6
@@ -114,8 +114,8 @@ static struct hid_descriptor hidg_desc = .bcdHID = cpu_to_le16(0x0101), .bCountryCode = 0x00, .bNumDescriptors = 0x1, -/*.desc[0].bDescriptorType = DYNAMIC */ -/*.desc[0].wDescriptorLenght = DYNAMIC */ +/*.rpt_desc.bDescriptorType = DYNAMIC */ +/*.rpt_desc.wDescriptorLength = DYNAMIC */ };/* Super-Speed Support */
@@ -724,8 +724,8 @@ static int hidg_setup(struct usb_functiostruct hid_descriptor hidg_desc_copy = hidg_desc;VDBG (cdev,"USB_REQ_GET_DESCRIPTOR: HID\n" ); - hidg_desc_copy.desc[0 ].bDescriptorType =HID_DT_REPORT ; - hidg_desc_copy.desc[0 ].wDescriptorLength = + hidg_desc_copy.rpt_desc.bDescriptorType =HID_DT_REPORT ; + hidg_desc_copy.rpt_desc.wDescriptorLength =cpu_to_le16 (hidg->report_desc_length); length = min_t(unsigned short, length,
@@ -966,8 +966,8 @@ static int hidg_bind(struct usb_configur* We can use hidg_desc struct here but we should not relay * that its content won't change after returning from this function. */ - hidg_desc.desc[0 ].bDescriptorType =HID_DT_REPORT ; - hidg_desc.desc[0 ].wDescriptorLength = + hidg_desc.rpt_desc.bDescriptorType =HID_DT_REPORT ; + hidg_desc.rpt_desc.wDescriptorLength =cpu_to_le16 (hidg->report_desc_length); hidg_hs_in_ep_desc.bEndpointAddress =
include/linux/hid.h +2 -1
@@ -680,8 +680,9 @@ struct hid_descriptor {__le16 bcdHID;__u8 bCountryCode;__u8 bNumDescriptors; +struct hid_class_descriptor rpt_desc; -struct hid_class_descriptor desc[1 ]; +struct hid_class_descriptor opt_descs[]; } __attribute__ ((packed));#define HID_DEVICE (b, g, ven, prod) \
Greg Kroah-Hartman
maintainerPATCH 356/411 block: default BLOCK_LEGACY_AUTOLOAD to y
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 451f0b6f4c44d7b649ae609157b114b71f6d7875 upstream.
As Luis reported, losetup currently doesn't properly create the loop device without this if the device node already exists because old scripts created it manually. So default to y for now and remove the aggressive removal schedule.
--- block/Kconfig | 8 +++----- block/bdev.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
block/Kconfig +3 -5
@@ -28,15 +28,13 @@ if BLOCK config BLOCK_LEGACY_AUTOLOAD bool "Legacy autoloading support" + default y help Enable loading modules and creating block device instances based on accesses through their device special file. This is a historic Linux feature and makes no sense in a udev world where device files are - created on demand. - - Say N here unless booting or other functionality broke without it, in - which case you should also send a report to your distribution and - [email protected]. + created on demand, but scripts that manually create device nodes and + then call losetup might rely on this behavior. config BLK_RQ_ALLOC_TIME bool
block/bdev.c +1 -1
@@ -741,7 +741,7 @@ struct block_device *blkdev_get_no_open( inode =ilookup (blockdev_superblock, dev);if (inode)pr_warn_ratelimited ( -"block device autoloading is deprecated. It will be removed in Linux 5.19\n" ); +"block device autoloading is deprecated and will be removed.\n" ); }if (!inode)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 357/411 Input: sparcspkr - avoid unannotated fall-through
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit 8b1d858cbd4e1800e9336404ba7892b5a721230d upstream.
Fix follow warnings with clang-21i (and reformat for clarity):
drivers/input/misc/sparcspkr.c:78:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
78 | case SND_TONE: break;
| ^
drivers/input/misc/sparcspkr.c:78:3: note: insert 'break;' to avoid fall-through
78 | case SND_TONE: break;
| ^
| break;
drivers/input/misc/sparcspkr.c:113:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
113 | case SND_TONE: break;
| ^
drivers/input/misc/sparcspkr.c:113:3: note: insert 'break;' to avoid fall-through
113 | case SND_TONE: break;
| ^
| break;2 warnings generated.
--- drivers/input/misc/sparcspkr.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/input/misc/sparcspkr.c +16 -6
@@ -74,9 +74,14 @@ static int bbc_spkr_event(struct input_dreturn -1 ;switch (code) { -case SND_BELL :if (value) value =1000 ; -case SND_TONE :break ; -default :return -1 ; +case SND_BELL : +if (value) + value =1000 ; +break ; +case SND_TONE : +break ; +default : +return -1 ; }if (value >20 && value <32767 )
@@ -112,9 +117,14 @@ static int grover_spkr_event(struct inpureturn -1 ;switch (code) { -case SND_BELL :if (value) value =1000 ; -case SND_TONE :break ; -default :return -1 ; +case SND_BELL : +if (value) + value =1000 ; +break ; +case SND_TONE : +break ; +default : +return -1 ; }if (value >20 && value <32767 )
Greg Kroah-Hartman
maintainerPATCH 358/411 ALSA: usb-audio: Rename ALSA kcontrol PCM and PCM1 for the KTMicro sound card
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
commit 93adf20ff4d6e865e0b974110d3cf2f07c057177 upstream.
PCM1 not in Pulseaudio's control list; standardize control to "Speaker" and "Headphone".
--- sound/usb/mixer_maps.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/usb/mixer_maps.c +12 -0
@@ -366,6 +366,13 @@ static const struct usbmix_name_map cors { 0 } }; +/* KTMicro USB */ +static struct usbmix_name_map s31b2_0022_map[] = { + {23 ,"Speaker Playback" }, + {18 ,"Headphone Playback" }, + {0 } +}; +/* ASUS ROG Zenith II with Realtek ALC1220-VB */ static const struct usbmix_name_map asus_zenith_ii_map[] = { {19 ,NULL ,12 },/* FU, Input Gain Pad - broken response, disabled */
@@ -701,5 +708,10 @@ static const struct usbmix_ctl_map uac3_ .id = UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE, .map = uac3_badd_speakerphone_map, }, + { +/* KTMicro USB */ + .id = USB_ID(0X31b2, 0x0022), + .map = s31b2_0022_map, + }, { 0 } /* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 359/411 ALSA: hda/intel: Add Thinkpad E15 to PM deny list
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit c987a390f1b3b8bdac11031d7004e3410fe259bd upstream.
Lenovo Thinkpad E15 with Conexant CX8070 codec seems causing ugly noises after runtime-PM suspend. Disable the codec runtime PM as a workaround.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2227,6 +2227,8 @@ static const struct snd_pci_quirk power_SND_PCI_QUIRK (0x1734 ,0x1232 ,"KONTRON SinglePC" ,0 ),/* Dell ALC3271 */ SND_PCI_QUIRK (0x1028 ,0x0962 ,"Dell ALC3271" ,0 ), +/* https://bugzilla.kernel.org/show_bug.cgi?id=220210 */ + SND_PCI_QUIRK(0x17aa, 0x5079, "Lenovo Thinkpad E15", 0), {} };#endif /* CONFIG_PM */
Greg Kroah-Hartman
maintainerPATCH 360/411 ALSA: hda/realtek: enable headset mic on Latitude 5420 Rugged
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Lane <[email protected]>
commit efa6bdf1bc75e26cafaa5f1d775e8bb7c5b0c431 upstream.
Like many Dell laptops, the 3.5mm port by default can not detect a combined headphones+mic headset or even a pure microphone. This change enables the port's functionality.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9214,6 +9214,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0871 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0872 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0873 ,"Dell Precision 3930" ,ALC255_FIXUP_DUMMY_LINEOUT_VERB ), +SND_PCI_QUIRK (0x1028 ,0x0879 ,"Dell Latitude 5420 Rugged" ,ALC269_FIXUP_DELL4_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x08ad ,"Dell WYSE AIO" ,ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x08ae ,"Dell WYSE NB" ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Greg Kroah-Hartman
maintainerPATCH 361/411 iio: accel: fxls8962af: Fix temperature calculation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Nyekjaer <[email protected]>
commit 16038474e3a0263572f36326ef85057aaf341814 upstream.
According to spec temperature should be returned in milli degrees Celsius. Add in_temp_scale to calculate from Celsius to milli Celsius.
--- drivers/iio/accel/fxls8962af-core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +12 -2
@@ -20,6 +20,7 @@#include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> #include <linux/regmap.h> +#include <linux/units.h> #include <linux/iio/buffer.h> #include <linux/iio/iio.h>
@@ -416,8 +417,16 @@ static int fxls8962af_read_raw(struct ii *val =FXLS8962AF_TEMP_CENTER_VAL ;return IIO_VAL_INT ;case IIO_CHAN_INFO_SCALE : - *val =0 ; -return fxls8962af_read_full_scale (data, val2); +switch (chan->type) { +case IIO_TEMP : + *val =MILLIDEGREE_PER_DEGREE ; +return IIO_VAL_INT ; +case IIO_ACCEL : + *val =0 ; +return fxls8962af_read_full_scale (data, val2); +default : +return -EINVAL ; + }case IIO_CHAN_INFO_SAMP_FREQ :return fxls8962af_read_samp_freq (data, val, val2);default :
@@ -494,6 +503,7 @@ static int fxls8962af_set_watermark(stru .type = IIO_TEMP, \ .address = FXLS8962AF_TEMP_OUT, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_OFFSET),\ .scan_index = -1, \ .scan_type = { \
Greg Kroah-Hartman
maintainerPATCH 362/411 mm/hugetlb: unshare page tables during VMA split, not before
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 081056dc00a27bccb55ccc3c6f230a3d5fd3f7e0 upstream.
Currently, __split_vma() triggers hugetlb page table unsharing through vm_ops->may_split(). This happens before the VMA lock and rmap locks are taken - which is too early, it allows racing VMA-locked page faults in our process and racing rmap walks from other processes to cause page tables to be shared again before we actually perform the split.
Fix it by explicitly calling into the hugetlb unshare logic from __split_vma() in the same place where THP splitting also happens. At that point, both the VMA and the rmap(s) are write-locked.
An annoying detail is that we can now call into the helper hugetlb_unshare_pmds() from two different locking contexts:
1. from hugetlb_split(), holding:
- mmap lock (exclusively)
- VMA lock
- file rmap lock (exclusively)
2. hugetlb_unshare_all_pmds(), which I think is designed to be able to call us with only the mmap lock held (in shared mode), but currently only runs while holding mmap lock (exclusively) and VMA lock
Backporting note:
This commit fixes a racy protection that was introduced in commit b30c14cd6102 ("hugetlb: unshare some PMDs when splitting VMAs"); that commit claimed to fix an issue introduced in 5.13, but it should actually also go all the way back.
[stable backport: code got moved around, VMA splitting is in __vma_adjust, hugetlb lock wasn't used back then]
--- include/linux/hugetlb.h | 3 ++ mm/hugetlb.c | 56 ++++++++++++++++++++++++++++++++++++------------ mm/mmap.c | 8 ++++++ 3 files changed, 53 insertions(+), 14 deletions(-)
include/linux/hugetlb.h +3 -0
@@ -213,6 +213,7 @@ unsigned long hugetlb_change_protection(bool is_hugetlb_entry_migration (pte_t pte);void hugetlb_unshare_all_pmds (struct vm_area_struct *vma); +void hugetlb_split (struct vm_area_struct *vma,unsigned long addr);#else /* !CONFIG_HUGETLB_PAGE */
@@ -409,6 +410,8 @@ static inline vm_fault_t hugetlb_fault(sstatic inline void hugetlb_unshare_all_pmds (struct vm_area_struct *vma) { } +static inline void hugetlb_split (struct vm_area_struct *vma,unsigned long addr) {} +#endif /* !CONFIG_HUGETLB_PAGE */ /* * hugepages at page global directory. If arch support
mm/hugetlb.c +42 -14
105 lines not on this page · raw message
mm/mmap.c +8 -0
@@ -833,7 +833,15 @@ int __vma_adjust(struct vm_area_struct * } } again: +/* +* Get rid of huge pages and shared page tables straddling the split +* boundary. +*/ vma_adjust_trans_huge (orig_vma, start, end, adjust_next); +if (is_vm_hugetlb_page (orig_vma)) { +hugetlb_split (orig_vma, start); +hugetlb_split (orig_vma, end); + }if (file) { mapping = file->f_mapping;
Greg Kroah-Hartman
maintainerPATCH 363/411 mm: hugetlb: independent PMD page table shared count
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Shixin <[email protected]>
commit 59d9094df3d79443937add8700b2ef1a866b1081 upstream.
The folio refcount may be increased unexpectly through try_get_folio() by caller such as split_huge_pages. In huge_pmd_unshare(), we use refcount to check whether a pmd page table is shared. The check is incorrect if the refcount is increased by the above caller, and this can cause the page table leaked:
BUG: Bad page state in process sh pfn:109324 page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x66 pfn:0x109324 flags: 0x17ffff800000000(node=0|zone=2|lastcpupid=0xfffff) page_type: f2(table) raw: 017ffff800000000 0000000000000000 0000000000000000 0000000000000000 raw: 0000000000000066 0000000000000000 00000000f2000000 0000000000000000 page dumped because: nonzero mapcount ... CPU: 31 UID: 0 PID: 7515 Comm: sh Kdump: loaded Tainted: G B 6.13.0-rc2master+ #7 Tainted: [B]=BAD_PAGE Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 Call trace: show_stack+0x20/0x38 (C) dump_stack_lvl+0x80/0xf8 dump_stack+0x18/0x28 bad_page+0x8c/0x130 free_page_is_bad_report+0xa4/0xb0 free_unref_page+0x3cc/0x620 __folio_put+0xf4/0x158 split_huge_pages_all+0x1e0/0x3e8 split_huge_pages_write+0x25c/0x2d8 full_proxy_write+0x64/0xd8 vfs_write+0xcc/0x280 ksys_write+0x70/0x110 __arm64_sys_write+0x24/0x38 invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0xc8/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x34/0x128 el0t_64_sync_handler+0xc8/0xd0 el0t_64_sync+0x190/0x198
The issue may be triggered by damon, offline_page, page_idle, etc, which will increase the refcount of page table.
1. The page table itself will be discarded after reporting the "nonzero mapcount".
2. The HugeTLB page mapped by the page table miss freeing since we treat the page table as shared and a shared page table will not be unmapped.
Fix it by introducing independent PMD page table shared count. As described by comment, pt_index/pt_mm/pt_frag_refcount are used for s390 gmap, x86 pgds and powerpc, pt_share_count is used for x86/arm64/riscv pmds, so we can reuse the field as pt_share_count.
[backport note: struct ptdesc did not exist yet, stuff it equivalently into struct page instead]
--- include/linux/mm.h | 3 +++ include/linux/mm_types.h | 3 +++ mm/hugetlb.c | 18 ++++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-)
include/linux/mm.h +3 -0
@@ -2352,6 +2352,9 @@ static inline bool pgtable_pmd_page_ctorif (!pmd_ptlock_init (page))return false;__SetPageTable (page); +#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE +atomic_set (&page->pt_share_count,0 ); +#endif inc_lruvec_page_state (page,NR_PAGETABLE );return true; }
include/linux/mm_types.h +3 -0
@@ -166,6 +166,9 @@ struct page {union {struct mm_struct *pt_mm;/* x86 pgds only */ atomic_t pt_frag_refcount;/* powerpc */ +#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE +atomic_t pt_share_count; +#endif };#if ALLOC_SPLIT_PTLOCKS spinlock_t *ptl;
mm/hugetlb.c +8 -10
@@ -6046,7 +6046,7 @@ pte_t *huge_pmd_share(struct mm_struct * spte =huge_pte_offset (svma->vm_mm, saddr,vma_mmu_pagesize (svma));if (spte) { -get_page (virt_to_page (spte)); +atomic_inc (&virt_to_page (spte)->pt_share_count);break ; } }
@@ -6061,7 +6061,7 @@ pte_t *huge_pmd_share(struct mm_struct * (pmd_t *)((unsigned long)spte & PAGE_MASK));mm_inc_nr_pmds (mm); }else { -put_page (virt_to_page (spte)); +atomic_dec (&virt_to_page (spte)->pt_share_count); }spin_unlock (ptl); out:
@@ -6072,11 +6072,7 @@ out:/* * unmap huge page backed by shared pte. * -* Hugetlb pte page is ref counted at the time of mapping. If pte is shared -* indicated by page_count > 1, unmap is achieved by clearing pud and -* decrementing the ref count. If count == 1, the pte page is not shared. -* -* Called with page table lock held and i_mmap_rwsem held in write mode. +* Called with page table lock held. * * returns: 1 successfully unmapped a shared pte page * 0 the underlying pte page is not shared, or it is the last user
@@ -6084,17 +6080,19 @@ out:int huge_pmd_unshare (struct mm_struct *mm,struct vm_area_struct *vma,unsigned long *addr,pte_t *ptep) { +unsigned long sz =huge_page_size (hstate_vma (vma));pgd_t *pgd =pgd_offset (mm, *addr);p4d_t *p4d =p4d_offset (pgd, *addr);pud_t *pud =pud_offset (p4d, *addr);i_mmap_assert_write_locked (vma->vm_file->f_mapping); -BUG_ON (page_count (virt_to_page (ptep)) ==0 ); -if (page_count (virt_to_page (ptep)) ==1 ) +if (sz !=PMD_SIZE ) +return 0 ; +if (!atomic_read (&virt_to_page (ptep)->pt_share_count))return 0 ;pud_clear (pud); -put_page (virt_to_page (ptep)); +atomic_dec (&virt_to_page (ptep)->pt_share_count);mm_dec_nr_pmds (mm);/* * This update of passed address optimizes loops sequentially
Greg Kroah-Hartman
maintainerPATCH 364/411 mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 1013af4f585fccc4d3e5c5824d174de2257f7d6d upstream.
huge_pmd_unshare() drops a reference on a page table that may have previously been shared across processes, potentially turning it into a normal page table used in another process in which unrelated VMAs can afterwards be installed.
If this happens in the middle of a concurrent gup_fast(), gup_fast() could end up walking the page tables of another process. While I don't see any way in which that immediately leads to kernel memory corruption, it is really weird and unexpected.
Fix it with an explicit broadcast IPI through tlb_remove_table_sync_one(), just like we do in khugepaged when removing page tables for a THP collapse.
--- mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/hugetlb.c +7 -0
@@ -6092,6 +6092,13 @@ int huge_pmd_unshare(struct mm_struct *mreturn 0 ;pud_clear (pud); +/* +* Once our caller drops the rmap lock, some other process might be +* using this page table as a normal, non-hugetlb page table. +* Wait for pending gup_fast() in other threads to finish before letting +* that happen. +*/ +tlb_remove_table_sync_one ();atomic_dec (&virt_to_page (ptep)->pt_share_count);mm_dec_nr_pmds (mm);/*
Greg Kroah-Hartman
maintainerPATCH 365/411 erofs: remove unused trace event erofs_destroy_inode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit 30b58444807c93bffeaba7d776110f2a909d2f9a upstream.
The trace event erofs_destroy_inode was added but remains unused. This unused event contributes approximately 5KB to the kernel module size.
--- include/trace/events/erofs.h | 18 ------------------ 1 file changed, 18 deletions(-)
include/trace/events/erofs.h +0 -18
@@ -235,24 +235,6 @@ DEFINE_EVENT(erofs__map_blocks_exit, z_eTP_ARGS (inode, map, flags, ret) ); -TRACE_EVENT (erofs_destroy_inode, - TP_PROTO(struct inode *inode), - -TP_ARGS (inode), - -TP_STRUCT__entry ( - __field( dev_t, dev ) -__field ( erofs_nid_t, nid ) - ), - -TP_fast_assign ( - __entry->dev = inode->i_sb->s_dev; - __entry->nid = EROFS_I(inode)->nid; - ), - -TP_printk ("dev = (%d,%d), nid = %llu" ,show_dev_nid (__entry)) -); -#endif /* _TRACE_EROFS_H */ /* This part must be outside protection */
Greg Kroah-Hartman
maintainerPATCH 366/411 drm/msm/dsi/dsi_phy_10nm: Fix missing initial VCO rate
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8a48e35becb214743214f5504e726c3ec131cd6d ]
Driver unconditionally saves current state on first init in dsi_pll_10nm_init(), but does not save the VCO rate, only some of the divider registers. The state is then restored during probe/enable via msm_dsi_phy_enable() -> msm_dsi_phy_pll_restore_state() -> dsi_10nm_pll_restore_state().
Restoring calls dsi_pll_10nm_vco_set_rate() with pll_10nm->vco_current_rate=0, which basically overwrites existing rate of VCO and messes with clock hierarchy, by setting frequency to 0 to clock tree. This makes anyway little sense - VCO rate was not saved, so should not be restored.
If PLL was not configured configure it to minimum rate to avoid glitches and configuring entire in clock hierarchy to 0 Hz.
Patchwork: https://patchwork.freedesktop.org/patch/654796/
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +7 -0
@@ -713,6 +713,13 @@ static int dsi_pll_10nm_init(struct msm_dsi_phy *phy)/* TODO: Remove this when we have proper display handover support */ msm_dsi_phy_pll_save_state (phy); +/* +* Store also proper vco_current_rate, because its value will be used in +* dsi_10nm_pll_restore_state(). +*/ +if (!dsi_pll_10nm_vco_recalc_rate (&pll_10nm->clk_hw,VCO_REF_CLK_RATE )) + pll_10nm->vco_current_rate = pll_10nm->phy->cfg->min_pll_rate; +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 367/411 drm/nouveau/bl: increase buffer size to avoid truncate warning
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit 61b2b3737499f1fb361a54a16828db24a8345e85 ]
The nouveau_get_backlight_name() function generates a unique name for the backlight interface, appending an id from 1 to 99 for all backlight devices after the first.
GCC 15 (and likely other compilers) produce the following -Wformat-truncation warning:
nouveau_backlight.c: In function ‘nouveau_backlight_init’:
nouveau_backlight.c:56:69: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Werror=format-truncation=]
56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
| ^~
In function ‘nouveau_get_backlight_name’,
inlined from ‘nouveau_backlight_init’ at nouveau_backlight.c:351:7:
nouveau_backlight.c:56:56: note: directive argument in the range [1, 2147483647]
56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
| ^~~~~~~~~~~~~~~~
nouveau_backlight.c:56:17: note: ‘snprintf’ output between 14 and 23 bytes into a destination of size 15
56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The warning started appearing after commit ab244be47a8f ("drm/nouveau:
Fix a potential theorical leak in nouveau_get_backlight_name()") This fix for the ida usage removed the explicit value check for ids larger than 99. The compiler is unable to intuit that the ida_alloc_max() limits the returned value range between 0 and 99.
Because the compiler can no longer infer that the number ranges from 0 to 99, it thinks that it could use as many as 11 digits (10 + the potential - sign for negative numbers).
The warning has gone unfixed for some time, with at least one kernel test robot report. The code breaks W=1 builds, which is especially frustrating with the introduction of CONFIG_WERROR.
The string is stored temporarily on the stack and then copied into the device name. Its not a big deal to use 11 more bytes of stack rounding out to an even 24 bytes. Increase BL_NAME_SIZE to 24 to avoid the truncation warning. This fixes the W=1 builds that include this driver.
Compile tested only.
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +1 -1
@@ -40,7 +40,7 @@#include "nouveau_connector.h" static struct ida bl_ida; -#define BL_NAME_SIZE 15 // 12 for name + 2 for digits + 1 for '\0' +#define BL_NAME_SIZE 24 // 12 for name + 11 for digits + 1 for '\0' static bool nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE],
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 368/411 hwmon: (occ) Add soft minimum power cap attribute
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eddie James <[email protected]>
[ Upstream commit 84dc9e8a7eec2cdff00728baedf0fb35fc7c11e8 ]
Export the power caps data for the soft minimum power cap through hwmon.
Stable-dep-of: 744c2fe950e9 ("hwmon: (occ) Rework attribute registration for stack usage")
--- drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/hwmon/occ/common.c +16 -3
@@ -675,6 +675,9 @@ static ssize_t occ_show_caps_3(struct device *dev,case 7 : val = caps->user_source;break ; +case 8 : + val =get_unaligned_be16 (&caps->soft_min) *1000000ULL ; +break ;default :return -EINVAL ; }
@@ -836,12 +839,13 @@ static int occ_setup_sensor_attrs(struct occ *occ)case 1 : num_attrs += (sensors->caps.num_sensors *7 );break ; -case 3 : - show_caps = occ_show_caps_3; - fallthrough;case 2 : num_attrs += (sensors->caps.num_sensors *8 );break ; +case 3 : + show_caps = occ_show_caps_3; + num_attrs += (sensors->caps.num_sensors *9 ); +break ;default : sensors->caps.num_sensors =0 ; }
@@ -1048,6 +1052,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL ,7 ,0 ); attr++; + +if (sensors->caps.version >2 ) { +snprintf (attr->name,sizeof (attr->name), +"power%d_cap_min_soft" , s); + attr->sensor =OCC_INIT_ATTR (attr->name,0444 , + show_caps,NULL , +8 ,0 ); + attr++; + } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 369/411 hwmon: (occ) Rework attribute registration for stack usage
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 744c2fe950e936c4d62430de899d6253424200ed ]
clang produces an output with excessive stack usage when building the occ_setup_sensor_attrs() function, apparently the result of having a lot of struct literals and building with the -fno-strict-overflow option that leads clang to skip some optimization in case the 'attr' pointer overruns:
drivers/hwmon/occ/common.c:775:12: error: stack frame size (1392) exceeds limit (1280) in 'occ_setup_sensor_attrs' [-Werror,-Wframe-larger-than]
Replace the custom macros for initializing the attributes with a simpler function call that does not run into this corner case.
--- drivers/hwmon/occ/common.c | 212 +++++++++++++++---------------------- 1 file changed, 85 insertions(+), 127 deletions(-)
drivers/hwmon/occ/common.c +85 -127
@@ -750,29 +750,30 @@ static ssize_t occ_show_extended(struct device *dev, }/* -* Some helper macros to make it easier to define an occ_attribute. Since these -* are dynamically allocated, we shouldn't use the existing kernel macros which +* A helper to make it easier to define an occ_attribute. Since these +* are dynamically allocated, we cannot use the existing kernel macros which * stringify the name argument. */ -#define ATTR_OCC (_name, _mode, _show, _store) { \ - .attr = { \ - .name = _name, \ - .mode = VERIFY_OCTAL_PERMISSIONS(_mode), \ - }, \ - .show = _show, \ - .store = _store, \ -} - -#define SENSOR_ATTR_OCC (_name, _mode, _show, _store, _nr, _index) { \ - .dev_attr = ATTR_OCC(_name, _mode, _show, _store), \ - .index = _index, \ - .nr = _nr, \ +static void occ_init_attribute (struct occ_attribute *attr,int mode, +ssize_t (*show)(struct device *dev,struct device_attribute *attr,char *buf), +ssize_t (*store)(struct device *dev,struct device_attribute *attr, +const char *buf,size_t count), +int nr,int index,const char *fmt, ...) +{ +va_list args; + +va_start (args, fmt); +vsnprintf (attr->name,sizeof (attr->name), fmt, args); +va_end (args); + + attr->sensor.dev_attr.attr.name = attr->name; + attr->sensor.dev_attr.attr.mode = mode; + attr->sensor.dev_attr.show = show; + attr->sensor.dev_attr.store = store; + attr->sensor.index = index; + attr->sensor.nr = nr; } -#define OCC_INIT_ATTR (_name, _mode, _show, _store, _nr, _index) \ - ((struct sensor_device_attribute_2) \ - SENSOR_ATTR_OCC(_name, _mode, _show, _store, _nr, _index)) -/* * Allocate and instatiate sensor_device_attribute_2s. It's most efficient to * use our own instead of the built-in hwmon attribute types.
@@ -858,14 +859,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) sensors->extended.num_sensors =0 ; } - occ->attrs =devm_kzalloc (dev,sizeof (*occ->attrs) * num_attrs, + occ->attrs =devm_kcalloc (dev, num_attrs,sizeof (*occ->attrs),GFP_KERNEL );if (!occ->attrs)return -ENOMEM ;/* null-terminated list */ - occ->group.attrs =devm_kzalloc (dev,sizeof (*occ->group.attrs) * - num_attrs +1 ,GFP_KERNEL ); + occ->group.attrs =devm_kcalloc (dev, num_attrs +1 , +sizeof (*occ->group.attrs), +GFP_KERNEL );if (!occ->group.attrs)return -ENOMEM ;
@@ -875,43 +877,33 @@ static int occ_setup_sensor_attrs(struct occ *occ) s = i +1 ; temp = ((struct temp_sensor_2 *)sensors->temp.data) + i; -snprintf (attr->name,sizeof (attr->name),"temp%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_temp,NULL , -0 , i); +occ_init_attribute (attr,0444 , show_temp,NULL , +0 , i,"temp%d_label" , s); attr++;if (sensors->temp.version ==2 && temp->fru_type ==OCC_FRU_TYPE_VRM ) { -snprintf (attr->name,sizeof (attr->name), -"temp%d_alarm" , s); +occ_init_attribute (attr,0444 , show_temp,NULL , +1 , i,"temp%d_alarm" , s); }else { -snprintf (attr->name,sizeof (attr->name), -"temp%d_input" , s); +occ_init_attribute (attr,0444 , show_temp,NULL , +1 , i,"temp%d_input" , s); } - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_temp,NULL , -1 , i); attr++;if (sensors->temp.version >1 ) { -snprintf (attr->name,sizeof (attr->name), -"temp%d_fru_type" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_temp,NULL ,2 , i); +occ_init_attribute (attr,0444 , show_temp,NULL , +2 , i,"temp%d_fru_type" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"temp%d_fault" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_temp,NULL ,3 , i); +occ_init_attribute (attr,0444 , show_temp,NULL , +3 , i,"temp%d_fault" , s); attr++;if (sensors->temp.version ==0x10 ) { -snprintf (attr->name,sizeof (attr->name), -"temp%d_max" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_temp,NULL , -4 , i); +occ_init_attribute (attr,0444 , show_temp,NULL , +4 , i,"temp%d_max" , s); attr++; } }
@@ -920,14 +912,12 @@ static int occ_setup_sensor_attrs(struct occ *occ)for (i =0 ; i < sensors->freq.num_sensors; ++i) { s = i +1 ; -snprintf (attr->name,sizeof (attr->name),"freq%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_freq,NULL , -0 , i); +occ_init_attribute (attr,0444 , show_freq,NULL , +0 , i,"freq%d_label" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"freq%d_input" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_freq,NULL , -1 , i); +occ_init_attribute (attr,0444 , show_freq,NULL , +1 , i,"freq%d_input" , s); attr++; }
@@ -943,32 +933,24 @@ static int occ_setup_sensor_attrs(struct occ *occ) s = (i *4 ) +1 ;for (j =0 ; j <4 ; ++j) { -snprintf (attr->name,sizeof (attr->name), -"power%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL , - nr++, i); +occ_init_attribute (attr,0444 , show_power, +NULL , nr++, i, +"power%d_label" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_average" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL , - nr++, i); +occ_init_attribute (attr,0444 , show_power, +NULL , nr++, i, +"power%d_average" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_average_interval" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL , - nr++, i); +occ_init_attribute (attr,0444 , show_power, +NULL , nr++, i, +"power%d_average_interval" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_input" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL , - nr++, i); +occ_init_attribute (attr,0444 , show_power, +NULL , nr++, i, +"power%d_input" , s); attr++; s++;
@@ -980,28 +962,20 @@ static int occ_setup_sensor_attrs(struct occ *occ)for (i =0 ; i < sensors->power.num_sensors; ++i) { s = i +1 ; -snprintf (attr->name,sizeof (attr->name), -"power%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL ,0 , i); +occ_init_attribute (attr,0444 , show_power,NULL , +0 , i,"power%d_label" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_average" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL ,1 , i); +occ_init_attribute (attr,0444 , show_power,NULL , +1 , i,"power%d_average" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_average_interval" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL ,2 , i); +occ_init_attribute (attr,0444 , show_power,NULL , +2 , i,"power%d_average_interval" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_input" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_power,NULL ,3 , i); +occ_init_attribute (attr,0444 , show_power,NULL , +3 , i,"power%d_input" , s); attr++; }
@@ -1009,56 +983,43 @@ static int occ_setup_sensor_attrs(struct occ *occ) }if (sensors->caps.num_sensors >=1 ) { -snprintf (attr->name,sizeof (attr->name),"power%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -0 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +0 ,0 ,"power%d_label" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"power%d_cap" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -1 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +1 ,0 ,"power%d_cap" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"power%d_input" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -2 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +2 ,0 ,"power%d_input" , s); attr++; -snprintf (attr->name,sizeof (attr->name), -"power%d_cap_not_redundant" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -3 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +3 ,0 ,"power%d_cap_not_redundant" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"power%d_cap_max" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -4 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +4 ,0 ,"power%d_cap_max" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"power%d_cap_min" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , show_caps,NULL , -5 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +5 ,0 ,"power%d_cap_min" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"power%d_cap_user" , - s); - attr->sensor =OCC_INIT_ATTR (attr->name,0644 , show_caps, - occ_store_caps_user,6 ,0 ); +occ_init_attribute (attr,0644 , show_caps, occ_store_caps_user, +6 ,0 ,"power%d_cap_user" , s); attr++;if (sensors->caps.version >1 ) { -snprintf (attr->name,sizeof (attr->name), -"power%d_cap_user_source" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_caps,NULL ,7 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +7 ,0 ,"power%d_cap_user_source" , s); attr++;if (sensors->caps.version >2 ) { -snprintf (attr->name,sizeof (attr->name), -"power%d_cap_min_soft" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - show_caps,NULL , -8 ,0 ); +occ_init_attribute (attr,0444 , show_caps,NULL , +8 ,0 , +"power%d_cap_min_soft" , s); attr++; } }
@@ -1067,19 +1028,16 @@ static int occ_setup_sensor_attrs(struct occ *occ)for (i =0 ; i < sensors->extended.num_sensors; ++i) { s = i +1 ; -snprintf (attr->name,sizeof (attr->name),"extn%d_label" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - occ_show_extended,NULL ,0 , i); +occ_init_attribute (attr,0444 , occ_show_extended,NULL , +0 , i,"extn%d_label" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"extn%d_flags" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - occ_show_extended,NULL ,1 , i); +occ_init_attribute (attr,0444 , occ_show_extended,NULL , +1 , i,"extn%d_flags" , s); attr++; -snprintf (attr->name,sizeof (attr->name),"extn%d_input" , s); - attr->sensor =OCC_INIT_ATTR (attr->name,0444 , - occ_show_extended,NULL ,2 , i); +occ_init_attribute (attr,0444 , occ_show_extended,NULL , +2 , i,"extn%d_input" , s); attr++; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 370/411 hwmon: (occ) fix unaligned accesses
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 2c021b45c154958566aad0cae9f74ab26a2d5732 ]
Passing a pointer to an unaligned integer as a function argument is undefined behavior:
drivers/hwmon/occ/common.c:492:27: warning: taking address of packed member 'accumulator' of class or structure 'power_sensor_2' may result in an unaligned pointer value [-Waddress-of-packed-member]
492 | val = occ_get_powr_avg(&power->accumulator,
| ^~~~~~~~~~~~~~~~~~
drivers/hwmon/occ/common.c:493:13: warning: taking address of packed member 'update_tag' of class or structure 'power_sensor_2' may result in an unaligned pointer value [-Waddress-of-packed-member]
493 | &power->update_tag);
| ^~~~~~~~~~~~~~~~~Move the get_unaligned() calls out of the function and pass these through argument registers instead.
--- drivers/hwmon/occ/common.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/hwmon/occ/common.c +13 -15
@@ -458,12 +458,10 @@ static ssize_t occ_show_power_1(struct device *dev,return sysfs_emit (buf,"%llu\n" , val); } -static u64 occ_get_powr_avg (u64 *accum,u32 *samples) +static u64 occ_get_powr_avg (u64 accum,u32 samples) { -u64 divisor =get_unaligned_be32 (samples); - -return (divisor ==0 ) ?0 : -div64_u64 (get_unaligned_be64 (accum) *1000000ULL , divisor); +return (samples ==0 ) ?0 : +mul_u64_u32_div (accum,1000000UL , samples); } static ssize_t occ_show_power_2(struct device *dev,
@@ -488,8 +486,8 @@ static ssize_t occ_show_power_2(struct device *dev,get_unaligned_be32 (&power->sensor_id), power->function_id, power->apss_channel);case 1 : - val =occ_get_powr_avg (&power->accumulator, - &power->update_tag); + val =occ_get_powr_avg (get_unaligned_be64 (&power->accumulator), +get_unaligned_be32 (&power->update_tag));break ;case 2 : val = (u64)get_unaligned_be32(&power->update_tag) *
@@ -526,8 +524,8 @@ static ssize_t occ_show_power_a0(struct device *dev,return sysfs_emit (buf,"%u_system\n" ,get_unaligned_be32 (&power->sensor_id));case 1 : - val =occ_get_powr_avg (&power->system.accumulator, - &power->system.update_tag); + val =occ_get_powr_avg (get_unaligned_be64 (&power->system.accumulator), +get_unaligned_be32 (&power->system.update_tag));break ;case 2 : val = (u64)get_unaligned_be32(&power->system.update_tag) *
@@ -540,8 +538,8 @@ static ssize_t occ_show_power_a0(struct device *dev,return sysfs_emit (buf,"%u_proc\n" ,get_unaligned_be32 (&power->sensor_id));case 5 : - val =occ_get_powr_avg (&power->proc.accumulator, - &power->proc.update_tag); + val =occ_get_powr_avg (get_unaligned_be64 (&power->proc.accumulator), +get_unaligned_be32 (&power->proc.update_tag));break ;case 6 : val = (u64)get_unaligned_be32(&power->proc.update_tag) *
@@ -554,8 +552,8 @@ static ssize_t occ_show_power_a0(struct device *dev,return sysfs_emit (buf,"%u_vdd\n" ,get_unaligned_be32 (&power->sensor_id));case 9 : - val =occ_get_powr_avg (&power->vdd.accumulator, - &power->vdd.update_tag); + val =occ_get_powr_avg (get_unaligned_be64 (&power->vdd.accumulator), +get_unaligned_be32 (&power->vdd.update_tag));break ;case 10 : val = (u64)get_unaligned_be32(&power->vdd.update_tag) *
@@ -568,8 +566,8 @@ static ssize_t occ_show_power_a0(struct device *dev,return sysfs_emit (buf,"%u_vdn\n" ,get_unaligned_be32 (&power->sensor_id));case 13 : - val =occ_get_powr_avg (&power->vdn.accumulator, - &power->vdn.update_tag); + val =occ_get_powr_avg (get_unaligned_be64 (&power->vdn.accumulator), +get_unaligned_be32 (&power->vdn.update_tag));break ;case 14 : val = (u64)get_unaligned_be32(&power->vdn.update_tag) *
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 371/411 pldmfw: Select CRC32 when PLDMFW is selected
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 1224b218a4b9203656ecc932152f4c81a97b4fcc ]
pldmfw calls crc32 code and depends on it being enabled, else there is a link error as follows. So PLDMFW should select CRC32.
lib/pldmfw/pldmfw.o: In function `pldmfw_flash_image':
pldmfw.c:(.text+0x70f): undefined reference to `crc32_le_base'
This problem was introduced by commit b8265621f488 ("Add pldmfw library for PLDM firmware update").
It manifests as of commit d69ea414c9b4 ("ice: implement device flash update via devlink").
And is more likely to occur as of commit 9ad19171b6d6 ("lib/crc: remove unnecessary prompt for CONFIG_CRC32 and drop 'default y'").
Found by chance while exercising builds based on tinyconfig.
--- lib/Kconfig | 1 + 1 file changed, 1 insertion(+)
lib/Kconfig +1 -0
@@ -721,6 +721,7 @@ config GENERIC_LIB_DEVMEM_IS_ALLOWED config PLDMFW bool + select CRC32 default n config ASN1_ENCODER
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 372/411 aoe: clean device rq_list in aoedev_downdev()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Sanders <[email protected]>
[ Upstream commit 7f90d45e57cb2ef1f0adcaf925ddffdfc5e680ca ]
An aoe device's rq_list contains accepted block requests that are waiting to be transmitted to the aoe target. This queue was added as part of the conversion to blk_mq. However, the queue was not cleaned out when an aoe device is downed which caused blk_mq_freeze_queue() to sleep indefinitely waiting for those requests to complete, causing a hang. This fix cleans out the queue before calling blk_mq_freeze_queue().
--- drivers/block/aoe/aoedev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/block/aoe/aoedev.c +8 -0
@@ -198,6 +198,7 @@ aoedev_downdev(struct aoedev *d) {struct aoetgt *t, **tt, **te;struct list_head *head, *pos, *nx; +struct request *rq, *rqnext;int i; d->flags &= ~DEVFL_UP ;
@@ -223,6 +224,13 @@ aoedev_downdev(struct aoedev *d)/* clean out the in-process request (if any) */ aoe_failip (d); +/* clean out any queued block requests */ +list_for_each_entry_safe (rq, rqnext, &d->rq_list, queuelist) { +list_del_init (&rq->queuelist); +blk_mq_start_request (rq); +blk_mq_end_request (rq,BLK_STS_IOERR ); + } +/* fast fail all pending I/O */ if (d->blkq) {/* UP is cleared, freeze+quiesce to insure all are errored */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 373/411 net: ice: Perform accurate aRFS flow match
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Kumar <[email protected]>
[ Upstream commit 5d3bc9e5e725aa36cca9b794e340057feb6880b4 ]
This patch fixes an issue seen in a large-scale deployment under heavy incoming pkts where the aRFS flow wrongly matches a flow and reprograms the NIC with wrong settings. That mis-steering causes RX-path latency spikes and noisy neighbor effects when many connections collide on the same hash (some of our production servers have 20-30K connections).
set_rps_cpu() calls ndo_rx_flow_steer() with flow_id that is calculated by hashing the skb sized by the per rx-queue table size. This results in multiple connections (even across different rx-queues) getting the same hash value. The driver steer function modifies the wrong flow to use this rx-queue, e.g.: Flow#1 is first added:
Flow#1: <ip1, port1, ip2, port2>, Hash 'h', q#10
Later when a new flow needs to be added:
Flow#2: <ip3, port3, ip4, port4>, Hash 'h', q#20
The driver finds the hash 'h' from Flow#1 and updates it to use q#20. This results in both flows getting un-optimized - packets for Flow#1 goes to q#20, and then reprogrammed back to q#10 later and so on; and Flow #2 programming is never done as Flow#1 is matched first for all misses. Many flows may wrongly share the same hash and reprogram rules of the original flow each with their own q#.
Tested on two 144-core servers with 16K netperf sessions for 180s. Netperf clients are pinned to cores 0-71 sequentially (so that wrong packets on q#s 72-143 can be measured). IRQs are set 1:1 for queues -> CPUs, enable XPS, enable aRFS (global value is 144 * rps_flow_cnt).
Test notes about results from ice_rx_flow_steer():
---------------------------------------------------
1. "Skip:" counter increments here:
if (fltr_info->q_index == rxq_idx ||
arfs_entry->fltr_state != ICE_ARFS_ACTIVE)
goto out;
2. "Add:" counter increments here:
ret = arfs_entry->fltr_info.fltr_id;
INIT_HLIST_NODE(&arfs_entry->list_entry);
3. "Update:" counter increments here:
/* update the queue to forward to on an already existing flow */Runtime comparison: original code vs with the patch for different rps_flow_cnt values.
+-------------------------------+--------------+--------------+ | rps_flow_cnt | 512 | 2048 | +-------------------------------+--------------+--------------+ | Ratio of Pkts on Good:Bad q's | 214 vs 822K | 1.1M vs 980K | | Avoid wrong aRFS programming | 0 vs 310K | 0 vs 30K | | CPU User | 216 vs 183 | 216 vs 206 | | CPU System | 1441 vs 1171 | 1447 vs 1320 | | CPU Softirq | 1245 vs 920 | 1238 vs 961 | | CPU Total | 29 vs 22.7 | 29 vs 24.9 | | aRFS Update | 533K vs 59 | 521K vs 32 | | aRFS Skip | 82M vs 77M | 7.2M vs 4.5M | +-------------------------------+--------------+--------------+
A separate TCP_STREAM and TCP_RR with 1,4,8,16,64,128,256,512 connections showed no performance degradation.
Some points on the patch/aRFS behavior:
1. Enabling full tuple matching ensures flows are always correctly matched, even with smaller hash sizes.
2. 5-6% drop in CPU utilization as the packets arrive at the correct CPUs and fewer calls to driver for programming on misses.
3. Larger hash tables reduces mis-steering due to more unique flow hashes, but still has clashes. However, with larger per-device rps_flow_cnt, old flows take more time to expire and new aRFS flows cannot be added if h/w limits are reached (rps_may_expire_flow() succeeds when 10*rps_flow_cnt pkts have been processed by this cpu that are not part of the flow).
--- drivers/net/ethernet/intel/ice/ice_arfs.c | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+)
drivers/net/ethernet/intel/ice/ice_arfs.c +48 -0
@@ -376,6 +376,50 @@ ice_arfs_is_perfect_flow_set(struct ice_hw *hw, __be16 l3_proto, u8 l4_proto)return false; } +/** +* ice_arfs_cmp - Check if aRFS filter matches this flow. +* @fltr_info: filter info of the saved ARFS entry. +* @fk: flow dissector keys. +* @n_proto: One of htons(ETH_P_IP) or htons(ETH_P_IPV6). +* @ip_proto: One of IPPROTO_TCP or IPPROTO_UDP. +* +* Since this function assumes limited values for n_proto and ip_proto, it +* is meant to be called only from ice_rx_flow_steer(). +* +* Return: +* * true - fltr_info refers to the same flow as fk. +* * false - fltr_info and fk refer to different flows. +*/ +static bool +ice_arfs_cmp (const struct ice_fdir_fltr *fltr_info,const struct flow_keys *fk, +__be16 n_proto,u8 ip_proto) +{ +/* Determine if the filter is for IPv4 or IPv6 based on flow_type, +* which is one of ICE_FLTR_PTYPE_NONF_IPV{4,6}_{TCP,UDP}. +*/ +bool is_v4 = fltr_info->flow_type ==ICE_FLTR_PTYPE_NONF_IPV4_TCP || + fltr_info->flow_type ==ICE_FLTR_PTYPE_NONF_IPV4_UDP ; + +/* Following checks are arranged in the quickest and most discriminative +* fields first for early failure. +*/ +if (is_v4) +return n_proto ==htons (ETH_P_IP ) && + fltr_info->ip.v4.src_port == fk->ports.src && + fltr_info->ip.v4.dst_port == fk->ports.dst && + fltr_info->ip.v4.src_ip == fk->addrs.v4addrs.src && + fltr_info->ip.v4.dst_ip == fk->addrs.v4addrs.dst && + fltr_info->ip.v4.proto == ip_proto; + +return fltr_info->ip.v6.src_port == fk->ports.src && + fltr_info->ip.v6.dst_port == fk->ports.dst && + fltr_info->ip.v6.proto == ip_proto && + !memcmp (&fltr_info->ip.v6.src_ip, &fk->addrs.v6addrs.src, +sizeof (struct in6_addr )) && + !memcmp (&fltr_info->ip.v6.dst_ip, &fk->addrs.v6addrs.dst, +sizeof (struct in6_addr )); +} +/** * ice_rx_flow_steer - steer the Rx flow to where application is being run * @netdev: ptr to the netdev being adjusted
@@ -447,6 +491,10 @@ ice_rx_flow_steer(struct net_device *netdev, const struct sk_buff *skb,continue ; fltr_info = &arfs_entry->fltr_info; + +if (!ice_arfs_cmp (fltr_info, &fk, n_proto, ip_proto)) +continue ; + ret = fltr_info->fltr_id; if (fltr_info->q_index == rxq_idx ||
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 374/411 ptp: fix breakage after ptp_vclock_in_use() rework
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 5ab73b010cad294851e558f1d4714a85c6f206c7 ]
What is broken
--------------
ptp4l, and any other application which calls clock_adjtime() on a physical clock, is greeted with error -EBUSY after commit 87f7ce260a3c ("ptp: remove ptp->n_vclocks check logic in ptp_vclock_in_use()").
Explanation for the breakage
----------------------------
The blamed commit was based on the false assumption that ptp_vclock_in_use() callers already test for n_vclocks prior to calling this function.
This is notably incorrect for the code path below, in which there is, in fact, no n_vclocks test:
ptp_clock_adjtime()
-> ptp_clock_freerun()
-> ptp_vclock_in_use()
The result is that any clock adjustment on any physical clock is now impossible. This is _despite_ there not being any vclock over this physical clock.
$ ptp4l -i eno0 -2 -P -m ptp4l[58.425]: selected /dev/ptp0 as PTP clock [ 58.429749] ptp: physical clock is free running ptp4l[58.431]: Failed to open /dev/ptp0: Device or resource busy failed to create a clock $ cat /sys/class/ptp/ptp0/n_vclocks 0
The patch makes the ptp_vclock_in_use() function say "if it's not a virtual clock, then this physical clock does have virtual clocks on top".
Then ptp_clock_freerun() uses this information to say "this physical clock has virtual clocks on top, so it must stay free-running".
Then ptp_clock_adjtime() uses this information to say "well, if this physical clock has to be free-running, I can't do it, return -EBUSY".
Simply put, ptp_vclock_in_use() cannot be simplified so as to remove the test whether vclocks are in use.
What did the blamed commit intend to fix
----------------------------------------
The blamed commit presents a lockdep warning stating "possible recursive locking detected", with the n_vclocks_store() and ptp_clock_unregister() functions involved.
The recursive locking seems this:n_vclocks_store()
-> mutex_lock_interruptible(&ptp->n_vclocks_mux) // 1 -> device_for_each_child_reverse(..., unregister_vclock)
-> unregister_vclock()
-> ptp_vclock_unregister()
-> ptp_clock_unregister()
-> ptp_vclock_in_use()
-> mutex_lock_interruptible(&ptp->n_vclocks_mux) // 2The issue can be triggered by creating and then deleting vclocks:
$ echo 2 > /sys/class/ptp/ptp0/n_vclocks $ echo 0 > /sys/class/ptp/ptp0/n_vclocks
But note that in the original stack trace, the address of the first lock is different from the address of the second lock. This is because at step 1 marked above, &ptp->n_vclocks_mux is the lock of the parent (physical) PTP clock, and at step 2, the lock is of the child (virtual) PTP clock. They are different locks of different devices.
In this situation there is no real deadlock, the lockdep warning is caused by the fact that the mutexes have the same lock class on both the parent and the child. Functionally it is fine.
Proposed alternative solution
-----------------------------
We must reintroduce the body of ptp_vclock_in_use() mostly as it was structured prior to the blamed commit, but avoid the lockdep warning.
Based on the fact that vclocks cannot be nested on top of one another (ptp_is_attribute_visible() hides n_vclocks for virtual clocks), we already know that ptp->n_vclocks is zero for a virtual clock. And ptp->is_virtual_clock is a runtime invariant, established at ptp_clock_register() time and never changed. There is no need to serialize on any mutex in order to read ptp->is_virtual_clock, and we take advantage of that by moving it outside the lock.
Thus, virtual clocks do not need to acquire &ptp->n_vclocks_mux at all, and step 2 in the code walkthrough above can simply go away. We can simply return false to the question "ptp_vclock_in_use(a virtual clock)".
Other notes
-----------
Releasing &ptp->n_vclocks_mux before ptp_vclock_in_use() returns execution seems racy, because the returned value can become stale as soon as the function returns and before the return value is used (i.e. n_vclocks_store() can run any time). The locking requirement should somehow be transferred to the caller, to ensure a longer life time for the returned value, but this seems out of scope for this severe bug fix.
Because we are also fixing up the logic from the original commit, there is another Fixes: tag for that.
--- drivers/ptp/ptp_private.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/ptp/ptp_private.h +21 -1
@@ -87,7 +87,27 @@ static inline int queue_cnt(const struct timestamp_event_queue *q)/* Check if ptp virtual clock is in use */ static inline bool ptp_vclock_in_use (struct ptp_clock *ptp) { -return !ptp->is_virtual_clock; +bool in_use = false; + +/* Virtual clocks can't be stacked on top of virtual clocks. +* Avoid acquiring the n_vclocks_mux on virtual clocks, to allow this +* function to be called from code paths where the n_vclocks_mux of the +* parent physical clock is already held. Functionally that's not an +* issue, but lockdep would complain, because they have the same lock +* class. +*/ +if (ptp->is_virtual_clock) +return false; + +if (mutex_lock_interruptible (&ptp->n_vclocks_mux)) +return true; + +if (ptp->n_vclocks) + in_use = true; + +mutex_unlock (&ptp->n_vclocks_mux); + +return in_use; }extern struct class *ptp_class;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 375/411 wifi: carl9170: do not ping device which has failed to load firmware
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 15d25307692312cec4b57052da73387f91a2e870 ]
Syzkaller reports [1, 2] crashes caused by an attempts to ping the device which has failed to load firmware. Since such a device doesn't pass 'ieee80211_register_hw()', an internal workqueue managed by 'ieee80211_queue_work()' is not yet created and an attempt to queue work on it causes null-ptr-deref.
[1] https://syzkaller.appspot.com/bug?extid=9a4aec827829942045ff
[2] https://syzkaller.appspot.com/bug?extid=0d8afba53e8fb2633217
--- drivers/net/wireless/ath/carl9170/usb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/carl9170/usb.c +13 -6
@@ -438,14 +438,21 @@ static void carl9170_usb_rx_complete(struct urb *urb)if (atomic_read (&ar->rx_anch_urbs) ==0 ) {/* -* The system is too slow to cope with -* the enormous workload. We have simply -* run out of active rx urbs and this -* unfortunately leads to an unpredictable -* device. +* At this point, either the system is too slow to +* cope with the enormous workload (so we have simply +* run out of active rx urbs and this unfortunately +* leads to an unpredictable device), or the device +* is not fully functional after an unsuccessful +* firmware loading attempts (so it doesn't pass +* ieee80211_register_hw() and there is no internal +* workqueue at all). */ -ieee80211_queue_work (ar->hw, &ar->ping_work); +if (ar->registered) +ieee80211_queue_work (ar->hw, &ar->ping_work); +else +pr_warn_once ("device %s is not registered\n" , +dev_name (&ar->udev->dev)); } }else {/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 376/411 mpls: Use rcu_dereference_rtnl() in mpls_route_input_rcu().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 6dbb0d97c5096072c78a6abffe393584e57ae945 ]
As syzbot reported [0], mpls_route_input_rcu() can be called from mpls_getroute(), where is under RTNL.
net->mpls.platform_label is only updated under RTNL.
Let's use rcu_dereference_rtnl() in mpls_route_input_rcu() to silence the splat.
[0]:
WARNING: suspicious RCU usage 6.15.0-rc7-syzkaller-00082-g5cdb2c77c4c3 #0 Not tainted
----------------------------net/mpls/af_mpls.c:84 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by syz.2.4451/17730:
#0: ffffffff9012a3e8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock net/core/rtnetlink.c:80 [inline] #0: ffffffff9012a3e8 (rtnl_mutex){+.+.}-{4:4}, at: rtnetlink_rcv_msg+0x371/0xe90 net/core/rtnetlink.c:6961
stack backtrace: CPU: 1 UID: 0 PID: 17730 Comm: syz.2.4451 Not tainted 6.15.0-rc7-syzkaller-00082-g5cdb2c77c4c3 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120 lockdep_rcu_suspicious+0x166/0x260 kernel/locking/lockdep.c:6865 mpls_route_input_rcu+0x1d4/0x200 net/mpls/af_mpls.c:84 mpls_getroute+0x621/0x1ea0 net/mpls/af_mpls.c:2381 rtnetlink_rcv_msg+0x3c9/0xe90 net/core/rtnetlink.c:6964 netlink_rcv_skb+0x16d/0x440 net/netlink/af_netlink.c:2534 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x53a/0x7f0 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg net/socket.c:727 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2566 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2620 __sys_sendmmsg+0x200/0x420 net/socket.c:2709 __do_sys_sendmmsg net/socket.c:2736 [inline] __se_sys_sendmmsg net/socket.c:2733 [inline] __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2733 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0a2818e969 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0a28f52038 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 00007f0a283b5fa0 RCX: 00007f0a2818e969 RDX: 0000000000000003 RSI: 0000200000000080 RDI: 0000000000000003 RBP: 00007f0a28210ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f0a283b5fa0 R15: 00007ffce5e9f268 </TASK>
--- net/mpls/af_mpls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mpls/af_mpls.c +2 -2
@@ -80,8 +80,8 @@ static struct mpls_route *mpls_route_input_rcu(struct net *net, unsigned index)if (index < net->mpls.platform_labels) {struct mpls_route __rcu **platform_label = -rcu_dereference (net->mpls.platform_label); - rt =rcu_dereference (platform_label[index]); +rcu_dereference_rtnl (net->mpls.platform_label); + rt =rcu_dereference_rtnl (platform_label[index]); }return rt; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 377/411 atm: atmtcp: Free invalid length skb in atmtcp_c_send().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 2f370ae1fb6317985f3497b1bb80d457508ca2f7 ]
syzbot reported the splat below. [0]
vcc_sendmsg() copies data passed from userspace to skb and passes it to vcc->dev->ops->send().
atmtcp_c_send() accesses skb->data as struct atmtcp_hdr after checking if skb->len is 0, but it's not enough.
Also, when skb->len == 0, skb and sk (vcc) were leaked because dev_kfree_skb() is not called and sk_wmem_alloc adjustment is missing to revert atm_account_tx() in vcc_sendmsg(), which is expected to be done in atm_pop_raw().
Let's properly free skb with an invalid length in atmtcp_c_send().
[0]:
BUG: KMSAN: uninit-value in atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294 atmtcp_c_send+0x255/0xed0 drivers/atm/atmtcp.c:294 vcc_sendmsg+0xd7c/0xff0 net/atm/common.c:644 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg+0x330/0x3d0 net/socket.c:727 ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620 __sys_sendmsg net/socket.c:2652 [inline] __do_sys_sendmsg net/socket.c:2657 [inline] __se_sys_sendmsg net/socket.c:2655 [inline] __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655 x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4154 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_node_noprof+0x818/0xf00 mm/slub.c:4249 kmalloc_reserve+0x13c/0x4b0 net/core/skbuff.c:579 __alloc_skb+0x347/0x7d0 net/core/skbuff.c:670 alloc_skb include/linux/skbuff.h:1336 [inline] vcc_sendmsg+0xb40/0xff0 net/atm/common.c:628 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg+0x330/0x3d0 net/socket.c:727 ____sys_sendmsg+0x7e0/0xd80 net/socket.c:2566 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2620 __sys_sendmsg net/socket.c:2652 [inline] __do_sys_sendmsg net/socket.c:2657 [inline] __se_sys_sendmsg net/socket.c:2655 [inline] __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2655 x64_sys_call+0x32fb/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 1 UID: 0 PID: 5798 Comm: syz-executor192 Not tainted 6.16.0-rc1-syzkaller-00010-g2c4a1f3fe03e #0 PREEMPT(undef) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
--- drivers/atm/atmtcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/atm/atmtcp.c +3 -1
@@ -288,7 +288,9 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)struct sk_buff *new_skb;int result =0 ; -if (!skb->len)return 0 ; +if (skb->len <sizeof (struct atmtcp_hdr )) + goto done; + dev = vcc->dev_data; hdr = (struct atmtcp_hdr *) skb->data;if (hdr->length ==ATMTCP_HDR_MAGIC ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 378/411 tcp: fix tcp_packet_delayed() for tcp_is_non_sack_preventing_reopen() behavior
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit d0fa59897e049e84432600e86df82aab3dce7aa5 ]
After the following commit from 2024:
commit e37ab7373696 ("tcp: fix to allow timestamp undo if no retransmits were sent")
...there was buggy behavior where TCP connections without SACK support could easily see erroneous undo events at the end of fast recovery or RTO recovery episodes. The erroneous undo events could cause those connections to suffer repeated loss recovery episodes and high retransmit rates.
The problem was an interaction between the non-SACK behavior on these connections and the undo logic. The problem is that, for non-SACK connections at the end of a loss recovery episode, if snd_una == high_seq, then tcp_is_non_sack_preventing_reopen() holds steady in CA_Recovery or CA_Loss, but clears tp->retrans_stamp to 0. Then upon the next ACK the "tcp: fix to allow timestamp undo if no retransmits were sent" logic saw the tp->retrans_stamp at 0 and erroneously concluded that no data was retransmitted, and erroneously performed an undo of the cwnd reduction, restoring cwnd immediately to the value it had before loss recovery. This caused an immediate burst of traffic and build-up of queues and likely another immediate loss recovery episode.
This commit fixes tcp_packet_delayed() to ignore zero retrans_stamp values for non-SACK connections when snd_una is at or above high_seq, because tcp_is_non_sack_preventing_reopen() clears retrans_stamp in this case, so it's not a valid signal that we can undo.
Note that the commit named in the Fixes footer restored long-present behavior from roughly 2005-2019, so apparently this bug was present for a while during that era, and this was simply not caught.
--- net/ipv4/tcp_input.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-)
net/ipv4/tcp_input.c +25 -12
@@ -2434,20 +2434,33 @@ static inline bool tcp_packet_delayed(const struct tcp_sock *tp) {const struct sock *sk = (const struct sock *)tp; -if (tp->retrans_stamp && -tcp_tsopt_ecr_before (tp, tp->retrans_stamp)) -return true;/* got echoed TS before first retransmission */ - -/* Check if nothing was retransmitted (retrans_stamp==0), which may -* happen in fast recovery due to TSQ. But we ignore zero retrans_stamp -* in TCP_SYN_SENT, since when we set FLAG_SYN_ACKED we also clear -* retrans_stamp even if we had retransmitted the SYN. +/* Received an echoed timestamp before the first retransmission? */ +if (tp->retrans_stamp) +return tcp_tsopt_ecr_before (tp, tp->retrans_stamp); + +/* We set tp->retrans_stamp upon the first retransmission of a loss +* recovery episode, so normally if tp->retrans_stamp is 0 then no +* retransmission has happened yet (likely due to TSQ, which can cause +* fast retransmits to be delayed). So if snd_una advanced while +* (tp->retrans_stamp is 0 then apparently a packet was merely delayed, +* not lost. But there are exceptions where we retransmit but then +* clear tp->retrans_stamp, so we check for those exceptions. */ -if (!tp->retrans_stamp &&/* no record of a retransmit/SYN? */ - sk->sk_state !=TCP_SYN_SENT )/* not the FLAG_SYN_ACKED case? */ -return true;/* nothing was retransmitted */ -return false; +/* (1) For non-SACK connections, tcp_is_non_sack_preventing_reopen() +* clears tp->retrans_stamp when snd_una == high_seq. +*/ +if (!tcp_is_sack (tp) && !before (tp->snd_una, tp->high_seq)) +return false; + +/* (2) In TCP_SYN_SENT tcp_clean_rtx_queue() clears tp->retrans_stamp +* when setting FLAG_SYN_ACKED is set, even if the SYN was +* retransmitted. +*/ +if (sk->sk_state ==TCP_SYN_SENT ) +return false; + +return true;/* tp->retrans_stamp is zero; no retransmit yet */ }/* Undo procedures. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 379/411 tipc: fix null-ptr-deref when acquiring remote ip of ethernet bearer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haixia Qu <[email protected]>
[ Upstream commit f82727adcf2992822e12198792af450a76ebd5ef ]
The reproduction steps:
1. create a tun interface
2. enable l2 bearer
3. TIPC_NL_UDP_GET_REMOTEIP with media name set to tun
tipc: Started in network mode
tipc: Node identity 8af312d38a21, cluster identity 4711
tipc: Enabled bearer <eth:syz_tun>, priority 1
Oops: general protection fault KASAN: null-ptr-deref in range CPU: 1 UID: 1000 PID: 559 Comm: poc Not tainted 6.16.0-rc1+ #117 PREEMPT Hardware name: QEMU Ubuntu 24.04 PC RIP: 0010:tipc_udp_nl_dump_remoteip+0x4a4/0x8f0
the ub was in fact a struct dev.
when bid != 0 && skip_cnt != 0, bearer_list[bid] may be NULL or other media when other thread changes it.
fix this by checking media_id.
--- net/tipc/udp_media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/udp_media.c +2 -2
@@ -489,7 +489,7 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)rtnl_lock (); b =tipc_bearer_find (net, bname); -if (!b) { +if (!b || b->bcast_addr.media_id !=TIPC_MEDIA_TYPE_UDP ) {rtnl_unlock ();return -EINVAL ; }
@@ -500,7 +500,7 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)rtnl_lock (); b =rtnl_dereference (tn->bearer_list[bid]); -if (!b) { +if (!b || b->bcast_addr.media_id !=TIPC_MEDIA_TYPE_UDP ) {rtnl_unlock ();return -EINVAL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 380/411 calipso: Fix null-ptr-deref in calipso_req_{set,del}attr().
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 10876da918fa1aec0227fb4c67647513447f53a9 ]
syzkaller reported a null-ptr-deref in sock_omalloc() while allocating a CALIPSO option. [0]
The NULL is of struct sock, which was fetched by sk_to_full_sk() in calipso_req_setattr().
Since commit a1a5344ddbe8 ("tcp: avoid two atomic ops for syncookies"), reqsk->rsk_listener could be NULL when SYN Cookie is returned to its client, as hinted by the leading SYN Cookie log.
Here are 3 options to fix the bug:
1) Return 0 in calipso_req_setattr()
2) Return an error in calipso_req_setattr()
3) Alaways set rsk_listener
1) is no go as it bypasses LSM, but 2) effectively disables SYN Cookie for CALIPSO. 3) is also no go as there have been many efforts to reduce atomic ops and make TCP robust against DDoS. See also commit 3b24d854cb35 ("tcp/dccp: do not touch listener sk_refcnt under synflood").
As of the blamed commit, SYN Cookie already did not need refcounting, and no one has stumbled on the bug for 9 years, so no CALIPSO user will care about SYN Cookie.
Let's return an error in calipso_req_setattr() and calipso_req_delattr() in the SYN Cookie case.
This can be reproduced by [1] on Fedora and now connect() of nc times out.
[0]:
TCP: request_sock_TCPv6: Possible SYN flooding on port [::]:20002. Sending cookies.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] CPU: 3 UID: 0 PID: 12262 Comm: syz.1.2611 Not tainted 6.14.0 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 RIP: 0010:read_pnet include/net/net_namespace.h:406 [inline] RIP: 0010:sock_net include/net/sock.h:655 [inline] RIP: 0010:sock_kmalloc+0x35/0x170 net/core/sock.c:2806 Code: 89 d5 41 54 55 89 f5 53 48 89 fb e8 25 e3 c6 fd e8 f0 91 e3 00 48 8d 7b 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 26 01 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b RSP: 0018:ffff88811af89038 EFLAGS: 00010216 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff888105266400 RDX: 0000000000000006 RSI: ffff88800c890000 RDI: 0000000000000030 RBP: 0000000000000050 R08: 0000000000000000 R09: ffff88810526640e R10: ffffed1020a4cc81 R11: ffff88810526640f R12: 0000000000000000 R13: 0000000000000820 R14: ffff888105266400 R15: 0000000000000050 FS: 00007f0653a07640(0000) GS:ffff88811af80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f863ba096f4 CR3: 00000000163c0005 CR4: 0000000000770ef0 PKRU: 80000000 Call Trace: <IRQ> ipv6_renew_options+0x279/0x950 net/ipv6/exthdrs.c:1288 calipso_req_setattr+0x181/0x340 net/ipv6/calipso.c:1204 calipso_req_setattr+0x56/0x80 net/netlabel/netlabel_calipso.c:597 netlbl_req_setattr+0x18a/0x440 net/netlabel/netlabel_kapi.c:1249 selinux_netlbl_inet_conn_request+0x1fb/0x320 security/selinux/netlabel.c:342 selinux_inet_conn_request+0x1eb/0x2c0 security/selinux/hooks.c:5551 security_inet_conn_request+0x50/0xa0 security/security.c:4945 tcp_v6_route_req+0x22c/0x550 net/ipv6/tcp_ipv6.c:825 tcp_conn_request+0xec8/0x2b70 net/ipv4/tcp_input.c:7275 tcp_v6_conn_request+0x1e3/0x440 net/ipv6/tcp_ipv6.c:1328 tcp_rcv_state_process+0xafa/0x52b0 net/ipv4/tcp_input.c:6781 tcp_v6_do_rcv+0x8a6/0x1a40 net/ipv6/tcp_ipv6.c:1667 tcp_v6_rcv+0x505e/0x5b50 net/ipv6/tcp_ipv6.c:1904 ip6_protocol_deliver_rcu+0x17c/0x1da0 net/ipv6/ip6_input.c:436 ip6_input_finish+0x103/0x180 net/ipv6/ip6_input.c:480 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_input+0x13c/0x6b0 net/ipv6/ip6_input.c:491 dst_input include/net/dst.h:469 [inline] ip6_rcv_finish net/ipv6/ip6_input.c:79 [inline] ip6_rcv_finish+0xb6/0x490 net/ipv6/ip6_input.c:69 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ipv6_rcv+0xf9/0x490 net/ipv6/ip6_input.c:309 __netif_receive_skb_one_core+0x12e/0x1f0 net/core/dev.c:5896 __netif_receive_skb+0x1d/0x170 net/core/dev.c:6009 process_backlog+0x41e/0x13b0 net/core/dev.c:6357 __napi_poll+0xbd/0x710 net/core/dev.c:7191 napi_poll net/core/dev.c:7260 [inline] net_rx_action+0x9de/0xde0 net/core/dev.c:7382 handle_softirqs+0x19a/0x770 kernel/softirq.c:561 do_softirq.part.0+0x36/0x70 kernel/softirq.c:462 </IRQ> <TASK> do_softirq arch/x86/include/asm/preempt.h:26 [inline] __local_bh_enable_ip+0xf1/0x110 kernel/softirq.c:389 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline] __dev_queue_xmit+0xc2a/0x3c40 net/core/dev.c:4679 dev_queue_xmit include/linux/netdevice.h:3313 [inline] neigh_hh_output include/net/neighbour.h:523 [inline] neigh_output include/net/neighbour.h:537 [inline] ip6_finish_output2+0xd69/0x1f80 net/ipv6/ip6_output.c:141 __ip6_finish_output net/ipv6/ip6_output.c:215 [inline] ip6_finish_output+0x5dc/0xd60 net/ipv6/ip6_output.c:226 NF_HOOK_COND include/linux/netfilter.h:303 [inline] ip6_output+0x24b/0x8d0 net/ipv6/ip6_output.c:247 dst_output include/net/dst.h:459 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_xmit+0xbbc/0x20d0 net/ipv6/ip6_output.c:366 inet6_csk_xmit+0x39a/0x720 net/ipv6/inet6_connection_sock.c:135 __tcp_transmit_skb+0x1a7b/0x3b40 net/ipv4/tcp_output.c:1471 tcp_transmit_skb net/ipv4/tcp_output.c:1489 [inline] tcp_send_syn_data net/ipv4/tcp_output.c:4059 [inline] tcp_connect+0x1c0c/0x4510 net/ipv4/tcp_output.c:4148 tcp_v6_connect+0x156c/0x2080 net/ipv6/tcp_ipv6.c:333 __inet_stream_connect+0x3a7/0xed0 net/ipv4/af_inet.c:677 tcp_sendmsg_fastopen+0x3e2/0x710 net/ipv4/tcp.c:1039 tcp_sendmsg_locked+0x1e82/0x3570 net/ipv4/tcp.c:1091 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1358 inet6_sendmsg+0xb9/0x150 net/ipv6/af_inet6.c:659 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg+0xf4/0x2a0 net/socket.c:733 __sys_sendto+0x29a/0x390 net/socket.c:2187 __do_sys_sendto net/socket.c:2194 [inline] __se_sys_sendto net/socket.c:2190 [inline] __x64_sys_sendto+0xe1/0x1c0 net/socket.c:2190 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xc3/0x1d0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f06553c47ed Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0653a06fc8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f0655605fa0 RCX: 00007f06553c47ed RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000000000b RBP: 00007f065545db38 R08: 0000200000000140 R09: 000000000000001c R10: f7384d4ea84b01bd R11: 0000000000000246 R12: 0000000000000000 R13: 00007f0655605fac R14: 00007f0655606038 R15: 00007f06539e7000 </TASK> Modules linked in:
[1]:
dnf install -y selinux-policy-targeted policycoreutils netlabel_tools procps-ng nmap-ncat mount -t selinuxfs none /sys/fs/selinuxload_policy
netlabelctl calipso add pass doi:1
netlabelctl map del default
netlabelctl map add default address:::1 protocol:calipso,1
sysctl net.ipv4.tcp_syncookies=2
nc -l ::1 80 &
nc ::1 80
--- net/ipv6/calipso.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/ipv6/calipso.c +8 -0
@@ -1210,6 +1210,10 @@ static int calipso_req_setattr(struct request_sock *req,struct ipv6_opt_hdr *old, *new;struct sock *sk =sk_to_full_sk (req_to_sk (req)); +/* sk is NULL for SYN+ACK w/ SYN Cookie */ +if (!sk) +return -ENOMEM ; +if (req_inet->ipv6_opt && req_inet->ipv6_opt->hopopt) old = req_inet->ipv6_opt->hopopt;else
@@ -1250,6 +1254,10 @@ static void calipso_req_delattr(struct request_sock *req)struct ipv6_txoptions *txopts;struct sock *sk =sk_to_full_sk (req_to_sk (req)); +/* sk is NULL for SYN+ACK w/ SYN Cookie */ +if (!sk) +return ; +if (!req_inet->ipv6_opt || !req_inet->ipv6_opt->hopopt)return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 381/411 net: atm: add lec_mutex
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d13a3824bfd2b4774b671a75cf766a16637a0e67 ]
syzbot found its way in net/atm/lec.c, and found an error path in lecd_attach() could leave a dangling pointer in dev_lec[].
Add a mutex to protect dev_lecp[] uses from lecd_attach(), lec_vcc_attach() and lec_mcast_attach().
Following patch will use this mutex for /proc/net/atm/lec.
BUG: KASAN: slab-use-after-free in lecd_attach net/atm/lec.c:751 [inline] BUG: KASAN: slab-use-after-free in lane_ioctl+0x2224/0x23e0 net/atm/lec.c:1008 Read of size 8 at addr ffff88807c7b8e68 by task syz.1.17/6142 CPU: 1 UID: 0 PID: 6142 Comm: syz.1.17 Not tainted 6.16.0-rc1-syzkaller-00239-g08215f5486ec #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xcd/0x680 mm/kasan/report.c:521 kasan_report+0xe0/0x110 mm/kasan/report.c:634 lecd_attach net/atm/lec.c:751 [inline] lane_ioctl+0x2224/0x23e0 net/atm/lec.c:1008 do_vcc_ioctl+0x12c/0x930 net/atm/ioctl.c:159 sock_do_ioctl+0x118/0x280 net/socket.c:1190 sock_ioctl+0x227/0x6b0 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> Allocated by task 6132: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4328 [inline] __kvmalloc_node_noprof+0x27b/0x620 mm/slub.c:5015 alloc_netdev_mqs+0xd2/0x1570 net/core/dev.c:11711 lecd_attach net/atm/lec.c:737 [inline] lane_ioctl+0x17db/0x23e0 net/atm/lec.c:1008 do_vcc_ioctl+0x12c/0x930 net/atm/ioctl.c:159 sock_do_ioctl+0x118/0x280 net/socket.c:1190 sock_ioctl+0x227/0x6b0 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6132: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free mm/slub.c:4643 [inline] kfree+0x2b4/0x4d0 mm/slub.c:4842 free_netdev+0x6c5/0x910 net/core/dev.c:11892 lecd_attach net/atm/lec.c:744 [inline] lane_ioctl+0x1ce8/0x23e0 net/atm/lec.c:1008 do_vcc_ioctl+0x12c/0x930 net/atm/ioctl.c:159 sock_do_ioctl+0x118/0x280 net/socket.c:1190 sock_ioctl+0x227/0x6b0 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893
--- net/atm/lec.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/atm/lec.c +7 -0
@@ -124,6 +124,7 @@ static unsigned char bus_mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };/* Device structures */ static struct net_device *dev_lec[MAX_LEC_ITF ]; +static DEFINE_MUTEX (lec_mutex);#if IS_ENABLED (CONFIG_BRIDGE )static void lec_handle_bridge (struct sk_buff *skb,struct net_device *dev)
@@ -687,6 +688,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)int bytes_left;struct atmlec_ioc ioc_data; +lockdep_assert_held (&lec_mutex);/* Lecd must be up in this case */ bytes_left =copy_from_user (&ioc_data, arg,sizeof (struct atmlec_ioc ));if (bytes_left !=0 )
@@ -712,6 +714,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)static int lec_mcast_attach (struct atm_vcc *vcc,int arg) { +lockdep_assert_held (&lec_mutex);if (arg <0 || arg >=MAX_LEC_ITF )return -EINVAL ; arg =array_index_nospec (arg,MAX_LEC_ITF );
@@ -727,6 +730,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)int i;struct lec_priv *priv; +lockdep_assert_held (&lec_mutex);if (arg <0 ) arg =0 ;if (arg >=MAX_LEC_ITF )
@@ -744,6 +748,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)snprintf (dev_lec[i]->name,IFNAMSIZ ,"lec%d" , i);if (register_netdev (dev_lec[i])) {free_netdev (dev_lec[i]); + dev_lec[i] =NULL ;return -EINVAL ; }
@@ -1005,6 +1010,7 @@ static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)return -ENOIOCTLCMD ; } +mutex_lock (&lec_mutex);switch (cmd) {case ATMLEC_CTRL : err =lecd_attach (vcc, (int )arg);
@@ -1019,6 +1025,7 @@ static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)break ; } +mutex_unlock (&lec_mutex);return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 382/411 net: atm: fix /proc/net/atm/lec handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d03b79f459c7935cff830d98373474f440bd03ae ]
/proc/net/atm/lec must ensure safety against dev_lec[] changes.
It appears it had dev_put() calls without prior dev_hold(), leading to imbalance and UAF.
--- net/atm/lec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/atm/lec.c +3 -2
@@ -911,7 +911,6 @@ static void *lec_itf_walk(struct lec_state *state, loff_t *l) v = (dev &&netdev_priv (dev)) ?lec_priv_walk (state, l,netdev_priv (dev)) :NULL ;if (!v && dev) { -dev_put (dev);/* Partial state reset for the next time we get called */ dev =NULL ; }
@@ -935,6 +934,7 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos) {struct lec_state *state = seq->private; +mutex_lock (&lec_mutex); state->itf =0 ; state->dev =NULL ; state->locked =NULL ;
@@ -952,8 +952,9 @@ static void lec_seq_stop(struct seq_file *seq, void *v)if (state->dev) {spin_unlock_irqrestore (&state->locked->lec_arp_lock, state->flags); -dev_put (state->dev); + state->dev =NULL ; } +mutex_unlock (&lec_mutex); }static void *lec_seq_next (struct seq_file *seq,void *v,loff_t *pos)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 383/411 ARM: dts: am335x-bone-common: Add GPIO PHY reset on revision C3 board
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengyu Qu <[email protected]>
commit 623cef652768860bd5f205fb7b741be278585fba upstream.
This patch adds ethernet PHY reset GPIO config for Beaglebone Black series boards with revision C3. This fixes a random phy startup failure bug discussed at [1]. The GPIO pin used for reset is not used on older revisions, so it is ok to apply to all board revisions. The reset timing was discussed and tested at [2].
[1] https://forum.digikey.com/t/ethernet-device-is-not-detecting-on-ubuntu-20-04-lts-on-bbg/19948
[2] https://forum.beagleboard.org/t/recognizing-a-beaglebone-black-rev-c3-board/31249/
Message-ID: <TY3P286MB26113797A3B2EC7E0348BBB2980FA@TY3P286MB2611.JPNP286.PROD.OUTLOOK.COM>
--- arch/arm/boot/dts/am335x-bone-common.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/am335x-bone-common.dtsi +8 -0
@@ -145,6 +145,8 @@ /* MDIO */ AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0) AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0) + /* Added to support GPIO controlled PHY reset */ + AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT_PULLUP, MUX_MODE7) >; };
@@ -153,6 +155,8 @@ /* MDIO reset value */ AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7) AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7) + /* Added to support GPIO controlled PHY reset */ + AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE7) >; };
@@ -377,6 +381,10 @@ ethphy0: ethernet-phy@0 { reg = <0>; + /* Support GPIO reset on revision C3 boards */ + reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + reset-assert-us = <300>; + reset-deassert-us = <6500>; }; };
Greg Kroah-Hartman
maintainerPATCH 384/411 ARM: dts: am335x-bone-common: Increase MDIO reset deassert time
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Foster <[email protected]>
commit b9bf5612610aa7e38d58fee16f489814db251c01 upstream.
Prior to commit df16c1c51d81 ("net: phy: mdio_device: Reset device only when necessary") MDIO reset deasserts were performed twice during boot. Now that the second deassert is no longer performed, device probe failures happen due to the change in timing with the following error message:
SMSC LAN8710/LAN8720: probe of 4a101000.mdio:00 failed with error -5
Restore the original effective timing, which resolves the probe failures.
--- arch/arm/boot/dts/am335x-bone-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am335x-bone-common.dtsi +1 -1
@@ -384,7 +384,7 @@ /* Support GPIO reset on revision C3 boards */ reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; reset-assert-us = <300>; - reset-deassert-us = <6500>; + reset-deassert-us = <13000>; }; };
Greg Kroah-Hartman
maintainerPATCH 385/411 ARM: dts: am335x-bone-common: Increase MDIO reset deassert delay to 50ms
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 929d8490f8790164f5f63671c1c58d6c50411cb2 upstream.
Commit b9bf5612610aa7e3 ("ARM: dts: am335x-bone-common: Increase MDIO reset deassert time") already increased the MDIO reset deassert delay from 6.5 to 13 ms, but this may still cause Ethernet PHY probe failures:
SMSC LAN8710/LAN8720 4a101000.mdio:00: probe with driver SMSC LAN8710/LAN8720 failed with error -5
On BeagleBone Black Rev. C3, ETH_RESETn is controlled by an open-drain AND gate. It is pulled high by a 10K resistor, and has a 4.7µF capacitor to ground, giving an RC time constant of 47ms. As it takes 0.7RC to charge the capacitor above the threshold voltage of a CMOS input (VDD/2), the delay should be at least 33ms. Considering the typical tolerance of 20% on capacitors, 40ms would be safer. Add an additional safety margin and settle for 50ms.
--- arch/arm/boot/dts/am335x-bone-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am335x-bone-common.dtsi +1 -1
@@ -384,7 +384,7 @@ /* Support GPIO reset on revision C3 boards */ reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; reset-assert-us = <300>; - reset-deassert-us = <13000>; + reset-deassert-us = <50000>; }; };
Greg Kroah-Hartman
maintainerPATCH 386/411 serial: sh-sci: Increment the runtime usage counter for the earlycon device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 651dee03696e1dfde6d9a7e8664bbdcd9a10ea7f upstream.
In the sh-sci driver, serial ports are mapped to the sci_ports[] array, with earlycon mapped at index zero.
The uart_add_one_port() function eventually calls __device_attach(), which, in turn, calls pm_request_idle(). The identified code path is as follows:
uart_add_one_port() ->
serial_ctrl_register_port() ->
serial_core_register_port() ->
serial_core_port_device_add() ->
serial_base_port_add() ->
device_add() ->
bus_probe_device() ->
device_initial_probe() ->
__device_attach() ->
// ...
if (dev->p->dead) {
// ...
} else if (dev->driver) {
// ...
} else {
// ...
pm_request_idle(dev);
// ...
}The earlycon device clocks are enabled by the bootloader. However, the pm_request_idle() call in __device_attach() disables the SCI port clocks while earlycon is still active.
The earlycon write function, serial_console_write(), calls sci_poll_put_char() via serial_console_putchar(). If the SCI port clocks are disabled, writing to earlycon may sometimes cause the SR.TDFE bit to remain unset indefinitely, causing the while loop in sci_poll_put_char() to never exit. On single-core SoCs, this can result in the system being blocked during boot when this issue occurs.
To resolve this, increment the runtime PM usage counter for the earlycon SCI device before registering the UART port.
--- drivers/tty/serial/sh-sci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/tty/serial/sh-sci.c +16 -0
@@ -3335,6 +3335,22 @@ static int sci_probe_single(struct platfif (sci_uart_earlycon && sci_ports[0 ].port.mapbase == sci_res->start) {/* +* In case: +* - this is the earlycon port (mapped on index 0 in sci_ports[]) and +* - it now maps to an alias other than zero and +* - the earlycon is still alive (e.g., "earlycon keep_bootcon" is +* available in bootargs) +* +* we need to avoid disabling clocks and PM domains through the runtime +* PM APIs called in __device_attach(). For this, increment the runtime +* PM reference counter (the clocks and PM domains were already enabled +* by the bootloader). Otherwise the earlycon may access the HW when it +* has no clocks enabled leading to failures (infinite loop in +* sci_poll_put_char()). +*/ +pm_runtime_get_noresume (&dev->dev); + +/* * Skip cleanup the sci_port[0] in early_console_exit(), this * port is the same as the earlycon one. */
Greg Kroah-Hartman
maintainerPATCH 387/411 Revert "cpufreq: tegra186: Share policy per cluster"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
This reverts commit 89172666228de1cefcacf5bc6f61c6281751d2ed which is upstream commit be4ae8c19492cd6d5de61ccb34ffb3f5ede5eec8.
This commit is causing a suspend regression on Tegra186 Jetson TX2 with Linux v6.12.y kernels. This is not seen with Linux v6.15 that includes this change but indicates that there are there changes missing. Therefore, revert this change.
--- drivers/cpufreq/tegra186-cpufreq.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/cpufreq/tegra186-cpufreq.c +0 -7
@@ -73,18 +73,11 @@ static int tegra186_cpufreq_init(struct {struct tegra186_cpufreq_data *data =cpufreq_get_driver_data ();unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id; -u32 cpu; policy->freq_table = data->clusters[cluster].table; policy->cpuinfo.transition_latency =300 *1000 ; policy->driver_data =NULL ; -/* set same policy for all cpus in a cluster */ -for (cpu =0 ; cpu <ARRAY_SIZE (tegra186_cpus); cpu++) { -if (data->cpus[cpu].bpmp_cluster_id == cluster) -cpumask_set_cpu (cpu, policy->cpus); - } -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 388/411 arm64: move AARCH64_BREAK_FAULT into insn-def.h
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit 97e58e395e9c074fd096dad13c54e9f4112cf71d ]
If CONFIG_ARM64_LSE_ATOMICS is off, encoders for LSE-related instructions can return AARCH64_BREAK_FAULT directly in insn.h. In order to access AARCH64_BREAK_FAULT in insn.h, we can not include debug-monitors.h in insn.h, because debug-monitors.h has already depends on insn.h, so just move AARCH64_BREAK_FAULT into insn-def.h.
It will be used by the following patch to eliminate unnecessary LSE-related encoders when CONFIG_ARM64_LSE_ATOMICS is off.
--- arch/arm64/include/asm/debug-monitors.h | 12 ------------ arch/arm64/include/asm/insn-def.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-)
arch/arm64/include/asm/debug-monitors.h +0 -12
@@ -34,18 +34,6 @@*/ #define BREAK_INSTR_SIZE AARCH64_INSN_SIZE -/* -* BRK instruction encoding -* The #imm16 value should be placed at bits[20:5] within BRK ins -*/ -#define AARCH64_BREAK_MON 0xd4200000 - -/* -* BRK instruction for provoking a fault on purpose -* Unlike kgdb, #imm16 value with unallocated handler is used for faulting. -*/ -#define AARCH64_BREAK_FAULT (AARCH64_BREAK_MON | (FAULT_BRK_IMM << 5)) -#define AARCH64_BREAK_KGDB_DYN_DBG \ (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5))
arch/arm64/include/asm/insn-def.h +14 -0
@@ -3,7 +3,21 @@#ifndef __ASM_INSN_DEF_H#define __ASM_INSN_DEF_H +#include <asm/brk-imm.h> +/* A64 instructions are always 32 bits. */ #define AARCH64_INSN_SIZE 4 +/* +* BRK instruction encoding +* The #imm16 value should be placed at bits[20:5] within BRK ins +*/ +#define AARCH64_BREAK_MON 0xd4200000 + +/* +* BRK instruction for provoking a fault on purpose +* Unlike kgdb, #imm16 value with unallocated handler is used for faulting. +*/ +#define AARCH64_BREAK_FAULT (AARCH64_BREAK_MON | (FAULT_BRK_IMM << 5)) +#endif /* __ASM_INSN_DEF_H */
Greg Kroah-Hartman
maintainerPATCH 389/411 arm64: insn: add encoders for atomic operations
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit fa1114d9eba5087ba5e81aab4c56f546995e6cd3 ]
It is a preparation patch for eBPF atomic supports under arm64. eBPF needs support atomic[64]_fetch_add, atomic[64]_[fetch_]{and,or,xor} and atomic[64]_{xchg|cmpxchg}. The ordering semantics of eBPF atomics are the same with the implementations in linux kernel.
Add three helpers to support LDCLR/LDEOR/LDSET/SWP, CAS and DMB instructions. STADD/STCLR/STEOR/STSET are simply encoded as aliases for LDADD/LDCLR/LDEOR/LDSET with XZR as the destination register, so no extra helper is added. atomic_fetch_add() and other atomic ops needs support for STLXR instruction, so extend enum aarch64_insn_ldst_type to do that.
LDADD/LDEOR/LDSET/SWP and CAS instructions are only available when LSE atomics is enabled, so just return AARCH64_BREAK_FAULT directly in these newly-added helpers if CONFIG_ARM64_LSE_ATOMICS is disabled.
--- arch/arm64/include/asm/insn.h | 80 ++++++++++++++++-- arch/arm64/lib/insn.c | 185 ++++++++++++++++++++++++++++++++++++++---- arch/arm64/net/bpf_jit.h | 11 ++ 3 files changed, 253 insertions(+), 23 deletions(-)
arch/arm64/include/asm/insn.h +73 -7
@@ -206,7 +206,9 @@ enum aarch64_insn_ldst_type {AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX ,AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX ,AARCH64_INSN_LDST_LOAD_EX , +AARCH64_INSN_LDST_LOAD_ACQ_EX ,AARCH64_INSN_LDST_STORE_EX , + AARCH64_INSN_LDST_STORE_REL_EX, }; enum aarch64_insn_adsb_type {
@@ -281,6 +283,36 @@ enum aarch64_insn_adr_type { AARCH64_INSN_ADR_TYPE_ADR, }; +enum aarch64_insn_mem_atomic_op { +AARCH64_INSN_MEM_ATOMIC_ADD , +AARCH64_INSN_MEM_ATOMIC_CLR , +AARCH64_INSN_MEM_ATOMIC_EOR , +AARCH64_INSN_MEM_ATOMIC_SET , +AARCH64_INSN_MEM_ATOMIC_SWP , +}; + +enum aarch64_insn_mem_order_type { +AARCH64_INSN_MEM_ORDER_NONE , +AARCH64_INSN_MEM_ORDER_ACQ , +AARCH64_INSN_MEM_ORDER_REL , +AARCH64_INSN_MEM_ORDER_ACQREL , +}; + +enum aarch64_insn_mb_type { +AARCH64_INSN_MB_SY , +AARCH64_INSN_MB_ST , +AARCH64_INSN_MB_LD , +AARCH64_INSN_MB_ISH , +AARCH64_INSN_MB_ISHST , +AARCH64_INSN_MB_ISHLD , +AARCH64_INSN_MB_NSH , +AARCH64_INSN_MB_NSHST , +AARCH64_INSN_MB_NSHLD , +AARCH64_INSN_MB_OSH , +AARCH64_INSN_MB_OSHST , +AARCH64_INSN_MB_OSHLD , +}; +#define __AARCH64_INSN_FUNCS (abbr, mask, val) \ static __always_inline bool aarch64_insn_is_##abbr(u32 code) \ { \
@@ -304,6 +336,11 @@ __AARCH64_INSN_FUNCS(store_post, 0x3FE00 __AARCH64_INSN_FUNCS(load_post, 0x3FE00C00, 0x38400400) __AARCH64_INSN_FUNCS(str_reg, 0x3FE0EC00, 0x38206800) __AARCH64_INSN_FUNCS(ldadd, 0x3F20FC00, 0x38200000) +__AARCH64_INSN_FUNCS(ldclr, 0x3F20FC00, 0x38201000) +__AARCH64_INSN_FUNCS(ldeor, 0x3F20FC00, 0x38202000) +__AARCH64_INSN_FUNCS(ldset, 0x3F20FC00, 0x38203000) +__AARCH64_INSN_FUNCS(swp, 0x3F20FC00, 0x38208000) +__AARCH64_INSN_FUNCS(cas, 0x3FA07C00, 0x08A07C00) __AARCH64_INSN_FUNCS(ldr_reg, 0x3FE0EC00, 0x38606800) __AARCH64_INSN_FUNCS(ldr_lit, 0xBF000000, 0x18000000)__AARCH64_INSN_FUNCS (ldrsw_lit,0xFF000000 ,0x98000000 )
@@ -475,13 +512,6 @@ u32 aarch64_insn_gen_load_store_ex(enumenum aarch64_insn_register state, enum aarch64_insn_size_type size, enum aarch64_insn_ldst_type type); -u32 aarch64_insn_gen_ldadd (enum aarch64_insn_register result, -enum aarch64_insn_register address, -enum aarch64_insn_register value, -enum aarch64_insn_size_type size); -u32 aarch64_insn_gen_stadd (enum aarch64_insn_register address, -enum aarch64_insn_register value, -enum aarch64_insn_size_type size); u32 aarch64_insn_gen_add_sub_imm(enum aarch64_insn_register dst, enum aarch64_insn_register src, int imm, enum aarch64_insn_variant variant,
@@ -542,6 +572,42 @@ u32 aarch64_insn_gen_prefetch(enum aarchenum aarch64_insn_prfm_type type, enum aarch64_insn_prfm_target target, enum aarch64_insn_prfm_policy policy); +#ifdef CONFIG_ARM64_LSE_ATOMICS +u32 aarch64_insn_gen_atomic_ld_op (enum aarch64_insn_register result, +enum aarch64_insn_register address, +enum aarch64_insn_register value, +enum aarch64_insn_size_type size, +enum aarch64_insn_mem_atomic_op op, +enum aarch64_insn_mem_order_type order); +u32 aarch64_insn_gen_cas (enum aarch64_insn_register result, +enum aarch64_insn_register address, +enum aarch64_insn_register value, +enum aarch64_insn_size_type size, +enum aarch64_insn_mem_order_type order); +#else +static inline +u32 aarch64_insn_gen_atomic_ld_op (enum aarch64_insn_register result, +enum aarch64_insn_register address, +enum aarch64_insn_register value, +enum aarch64_insn_size_type size, +enum aarch64_insn_mem_atomic_op op, +enum aarch64_insn_mem_order_type order) +{ +return AARCH64_BREAK_FAULT ; +} + +static inline +u32 aarch64_insn_gen_cas (enum aarch64_insn_register result, +enum aarch64_insn_register address, +enum aarch64_insn_register value, +enum aarch64_insn_size_type size, +enum aarch64_insn_mem_order_type order) +{ +return AARCH64_BREAK_FAULT ; +} +#endif +u32 aarch64_insn_gen_dmb (enum aarch64_insn_mb_type type); +s32 aarch64_get_branch_offset (u32 insn);u32 aarch64_set_branch_offset (u32 insn,s32 offset);
arch/arm64/lib/insn.c +171 -14
220 lines not on this page · raw message
arch/arm64/net/bpf_jit.h +9 -2
@@ -89,9 +89,16 @@#define A64_STXR (sf, Rt, Rn, Rs) \ A64_LSX(sf, Rt, Rn, Rs, STORE_EX) -/* LSE atomics */ +/* +* LSE atomics +* +* STADD is simply encoded as an alias for LDADD with XZR as +* the destination register. +*/ #define A64_STADD (sf, Rn, Rs) \ - aarch64_insn_gen_stadd(Rn, Rs, A64_SIZE(sf)) + aarch64_insn_gen_atomic_ld_op(A64_ZR, Rn, Rs, \ + A64_SIZE(sf), AARCH64_INSN_MEM_ATOMIC_ADD, \ + AARCH64_INSN_MEM_ORDER_NONE)/* Add/subtract (immediate) */ #define A64_ADDSUB_IMM (sf, Rd, Rn, imm12, type) \
Greg Kroah-Hartman
maintainerPATCH 390/411 arm64: insn: Add support for encoding DSB
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit 63de8abd97ddb9b758bd8f915ecbd18e1f1a87a0 ]
To generate code in the eBPF epilogue that uses the DSB instruction, insn.c needs a heler to encode the type and domain.
Re-use the crm encoding logic from the DMB instruction.
--- arch/arm64/include/asm/insn.h | 1 arch/arm64/lib/insn.c | 60 +++++++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 23 deletions(-)
arch/arm64/include/asm/insn.h +1 -0
@@ -607,6 +607,7 @@ u32 aarch64_insn_gen_cas(enum aarch64_in }#endif u32 aarch64_insn_gen_dmb (enum aarch64_insn_mb_type type); +u32 aarch64_insn_gen_dsb (enum aarch64_insn_mb_type type);s32 aarch64_get_branch_offset (u32 insn);u32 aarch64_set_branch_offset (u32 insn,s32 offset);
arch/arm64/lib/insn.c +37 -23
90 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 391/411 arm64: proton-pack: Expose whether the platform is mitigated by firmware
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit e7956c92f396a44eeeb6eaf7a5b5e1ad24db6748 ]
is_spectre_bhb_fw_affected() allows the caller to determine if the CPU is known to need a firmware mitigation. CPUs are either on the list of CPUs we know about, or firmware has been queried and reported that the platform is affected - and mitigated by firmware.
This helper is not useful to determine if the platform is mitigated by firmware. A CPU could be on the know list, but the firmware may not be implemented. Its affected but not mitigated.
spectre_bhb_enable_mitigation() handles this distinction by checking the firmware state before enabling the mitigation.
Add a helper to expose this state. This will be used by the BPF JIT to determine if calling firmware for a mitigation is necessary and supported.
--- arch/arm64/include/asm/spectre.h | 1 + arch/arm64/kernel/proton-pack.c | 5 +++++ 2 files changed, 6 insertions(+)
arch/arm64/include/asm/spectre.h +1 -0
@@ -97,6 +97,7 @@ enum mitigation_state arm64_get_meltdownenum mitigation_state arm64_get_spectre_bhb_state (void );bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); +bool is_spectre_bhb_fw_mitigated (void );void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);bool try_emulate_el1_ssbs (struct pt_regs *regs,u32 instr);#endif /* __ASSEMBLY__ */
arch/arm64/kernel/proton-pack.c +5 -0
@@ -1088,6 +1088,11 @@ void spectre_bhb_enable_mitigation(constupdate_mitigation_state (&spectre_bhb_state, state); } +bool is_spectre_bhb_fw_mitigated (void ) +{ +return test_bit (BHB_FW , &system_bhb_mitigations); +} +/* Patched to NOP when enabled */ void noinstr spectre_bhb_patch_loop_mitigation_enable(struct alt_instr *alt, __le32 *origptr,
Greg Kroah-Hartman
maintainerPATCH 392/411 arm64: proton-pack: Expose whether the branchy loop k value
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit a1152be30a043d2d4dcb1683415f328bf3c51978 ]
Add a helper to expose the k value of the branchy loop. This is needed by the BPF JIT to generate the mitigation sequence in BPF programs.
--- arch/arm64/include/asm/spectre.h | 1 + arch/arm64/kernel/proton-pack.c | 5 +++++ 2 files changed, 6 insertions(+)
arch/arm64/include/asm/spectre.h +1 -0
@@ -97,6 +97,7 @@ enum mitigation_state arm64_get_meltdownenum mitigation_state arm64_get_spectre_bhb_state (void );bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); +u8 get_spectre_bhb_loop_value (void );bool is_spectre_bhb_fw_mitigated (void );void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);bool try_emulate_el1_ssbs (struct pt_regs *regs,u32 instr);
arch/arm64/kernel/proton-pack.c +5 -0
@@ -998,6 +998,11 @@ bool is_spectre_bhb_affected(const strucreturn true; } +u8 get_spectre_bhb_loop_value (void ) +{ +return max_bhb_k; +} +static void this_cpu_set_vectors (enum arm64_bp_harden_el1_vectors slot) {const char *v =arm64_get_bp_hardening_vector (slot);
Greg Kroah-Hartman
maintainerPATCH 393/411 arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Song <[email protected]>
[ Upstream commit 877ace9eab7de032f954533afd5d1ecd0cf62eaf ]
In our environment, it was found that the mitigation BHB has a great impact on the benchmark performance. For example, in the lmbench test, the "process fork && exit" test performance drops by 20%. So it is necessary to have the ability to turn off the mitigation individually through cmdline, thus avoiding having to compile the kernel by adjusting the config.
--- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ arch/arm64/kernel/proton-pack.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +5 -0
@@ -3105,6 +3105,7 @@ spectre_bhi=off [X86] spectre_v2_user=off [X86] ssbd=force-off [ARM64] + nospectre_bhb [ARM64] tsx_async_abort=off [X86] Exceptions:
@@ -3526,6 +3527,10 @@ vulnerability. System may allow data leaks with this option. + nospectre_bhb [ARM64] Disable all mitigations for Spectre-BHB (branch + history injection) vulnerability. System may allow data leaks + with this option. + nospec_store_bypass_disable [HW] Disable all mitigations for the Speculative Store Bypass vulnerability
arch/arm64/kernel/proton-pack.c +9 -1
@@ -1023,6 +1023,14 @@ static void this_cpu_set_vectors(enum arisb (); } +static bool __read_mostly __nospectre_bhb; +static int __init parse_spectre_bhb_param (char *str) +{ + __nospectre_bhb = true; +return 0 ; +} +early_param ("nospectre_bhb" , parse_spectre_bhb_param); +void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *entry) {bp_hardening_cb_t cpu_cb;
@@ -1036,7 +1044,7 @@ void spectre_bhb_enable_mitigation(const/* No point mitigating Spectre-BHB alone. */ }else if (!IS_ENABLED (CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY )) {pr_info_once ("spectre-bhb mitigation disabled by compile time option\n" ); - }else if (cpu_mitigations_off ()) { + }else if (cpu_mitigations_off () || __nospectre_bhb) {pr_info_once ("spectre-bhb mitigation disabled by command line option\n" ); }else if (supports_ecbhb (SCOPE_LOCAL_CPU )) { state =SPECTRE_MITIGATED ;
Greg Kroah-Hartman
maintainerPATCH 394/411 arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit 0dfefc2ea2f29ced2416017d7e5b1253a54c2735 ]
A malicious BPF program may manipulate the branch history to influence what the hardware speculates will happen next.
On exit from a BPF program, emit the BHB mititgation sequence.
This is only applied for 'classic' cBPF programs that are loaded by seccomp.
--- arch/arm64/include/asm/spectre.h | 1 arch/arm64/kernel/proton-pack.c | 2 - arch/arm64/net/bpf_jit_comp.c | 55 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 53 insertions(+), 5 deletions(-)
arch/arm64/include/asm/spectre.h +1 -0
@@ -97,6 +97,7 @@ enum mitigation_state arm64_get_meltdownenum mitigation_state arm64_get_spectre_bhb_state (void );bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); +extern bool __nospectre_bhb;u8 get_spectre_bhb_loop_value (void );bool is_spectre_bhb_fw_mitigated (void );void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);
arch/arm64/kernel/proton-pack.c +1 -1
@@ -1023,7 +1023,7 @@ static void this_cpu_set_vectors(enum arisb (); } -static bool __read_mostly __nospectre_bhb; +bool __read_mostly __nospectre_bhb;static int __init parse_spectre_bhb_param (char *str) { __nospectre_bhb = true;
arch/arm64/net/bpf_jit_comp.c +51 -4
96 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 395/411 arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit f300769ead032513a68e4a02e806393402e626f8 ]
Support for eBPF programs loaded by unprivileged users is typically disabled. This means only cBPF programs need to be mitigated for BHB.
In addition, only mitigate cBPF programs that were loaded by an unprivileged user. Privileged users can also load the same program via eBPF, making the mitigation pointless.
--- arch/arm64/net/bpf_jit_comp.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/net/bpf_jit_comp.c +3 -0
@@ -341,6 +341,9 @@ static void __maybe_unused build_bhb_mit arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE)return ; +if (capable (CAP_SYS_ADMIN )) +return ; +if (supports_clearbhb (SCOPE_SYSTEM )) {emit (aarch64_insn_gen_hint (AARCH64_INSN_HINT_CLEARBHB ), ctx);return ;
Greg Kroah-Hartman
maintainerPATCH 396/411 arm64: proton-pack: Add new CPUs k values for branch mitigation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit efe676a1a7554219eae0b0dcfe1e0cdcc9ef9aef ]
Update the list of 'k' values for the branch mitigation from arm's website.
Add the values for Cortex-X1C. The MIDR_EL1 value can be found here:
https://developer.arm.com/documentation/101968/0002/Register-descriptions/AArch>
--- arch/arm64/include/asm/cputype.h | 2 ++ arch/arm64/kernel/proton-pack.c | 1 + 2 files changed, 3 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -81,6 +81,7 @@#define ARM_CPU_PART_CORTEX_A78AE 0xD42#define ARM_CPU_PART_CORTEX_X1 0xD44#define ARM_CPU_PART_CORTEX_A510 0xD46 +#define ARM_CPU_PART_CORTEX_X1C 0xD4C#define ARM_CPU_PART_CORTEX_A520 0xD80#define ARM_CPU_PART_CORTEX_A710 0xD47#define ARM_CPU_PART_CORTEX_A715 0xD4D
@@ -147,6 +148,7 @@#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) +#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C)#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
arch/arm64/kernel/proton-pack.c +1 -0
@@ -891,6 +891,7 @@ static u8 spectre_bhb_loop_affected(voidMIDR_ALL_VERSIONS (MIDR_CORTEX_A78AE ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A78C ),MIDR_ALL_VERSIONS (MIDR_CORTEX_X1 ), +MIDR_ALL_VERSIONS (MIDR_CORTEX_X1C ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A710 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_X2 ), MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
Greg Kroah-Hartman
maintainerPATCH 397/411 net_sched: sch_sfq: annotate data-races around q->perturb_period
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit a17ef9e6c2c1cf0fc6cd6ca6a9ce525c67d1da7f upstream.
sfq_perturbation() reads q->perturb_period locklessly. Add annotations to fix potential issues.
--- net/sched/sch_sfq.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/sched/sch_sfq.c +9 -4
@@ -611,6 +611,7 @@ static void sfq_perturbation(struct timestruct Qdisc *sch = q->sch;spinlock_t *root_lock =qdisc_lock (qdisc_root_sleeping (sch));siphash_key_t nkey; +int period;get_random_bytes (&nkey,sizeof (nkey));spin_lock (root_lock);
@@ -619,8 +620,12 @@ static void sfq_perturbation(struct timesfq_rehash (sch);spin_unlock (root_lock); -if (q->perturb_period) -mod_timer (&q->perturb_timer, jiffies + q->perturb_period); +/* q->perturb_period can change under us from +* sfq_change() and sfq_destroy(). +*/ + period =READ_ONCE (q->perturb_period); +if (period) +mod_timer (&q->perturb_timer, jiffies + period); }static int sfq_change (struct Qdisc *sch,struct nlattr *opt)
@@ -662,7 +667,7 @@ static int sfq_change(struct Qdisc *sch, q->quantum = ctl->quantum; q->scaled_quantum =SFQ_ALLOT_SIZE (q->quantum); } - q->perturb_period = ctl->perturb_period *HZ ; +WRITE_ONCE (q->perturb_period, ctl->perturb_period *HZ );if (ctl->flows) q->maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );if (ctl->divisor) {
@@ -724,7 +729,7 @@ static void sfq_destroy(struct Qdisc *scstruct sfq_sched_data *q =qdisc_priv (sch);tcf_block_put (q->block); - q->perturb_period =0 ; +WRITE_ONCE (q->perturb_period,0 );del_timer_sync (&q->perturb_timer);sfq_free (q->ht);sfq_free (q->slots);
Greg Kroah-Hartman
maintainerPATCH 398/411 net_sched: sch_sfq: handle bigger packets
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit e4650d7ae4252f67e997a632adfae0dd74d3a99a upstream.
SFQ has an assumption on dealing with packets smaller than 64KB.
Even before BIG TCP, TCA_STAB can provide arbitrary big values in qdisc_pkt_len(skb)
It is time to switch (struct sfq_slot)->allot to a 32bit field.
sizeof(struct sfq_slot) is now 64 bytes, giving better cache locality.
--- net/sched/sch_sfq.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-)
net/sched/sch_sfq.c +13 -26
@@ -77,12 +77,6 @@#define SFQ_EMPTY_SLOT 0xffff#define SFQ_DEFAULT_HASH_DIVISOR 1024 -/* We use 16 bits to store allot, and want to handle packets up to 64K -* Scale allot by 8 (1<<3) so that no overflow occurs. -*/ -#define SFQ_ALLOT_SHIFT 3 -#define SFQ_ALLOT_SIZE (X ) DIV_ROUND_UP(X, 1 << SFQ_ALLOT_SHIFT) -/* This type should contain at least SFQ_MAX_DEPTH + 1 + SFQ_MAX_FLOWS values */ typedef u16 sfq_index ;
@@ -104,7 +98,7 @@ struct sfq_slot {sfq_index next;/* next slot in sfq RR chain */ struct sfq_head dep;/* anchor in dep[] chains */ unsigned short hash;/* hash value (index in ht[]) */ -short allot;/* credit for this slot */ +int allot;/* credit for this slot */ unsigned int backlog;struct red_vars vars;
@@ -120,7 +114,6 @@ struct sfq_sched_data {siphash_key_t perturbation;u8 cur_depth;/* depth of longest slot */ u8 flags; -unsigned short scaled_quantum;/* SFQ_ALLOT_SIZE(quantum) */ struct tcf_proto __rcu *filter_list;struct tcf_block *block;sfq_index *ht;/* Hash table ('divisor' slots) */
@@ -459,7 +452,7 @@ enqueue:*/ q->tail = slot;/* We could use a bigger initial quantum for new flows */ - slot->allot = q->scaled_quantum; + slot->allot = q->quantum; }if (++sch->q.qlen <= q->limit)return NET_XMIT_SUCCESS ;
@@ -496,7 +489,7 @@ next_slot: slot = &q->slots[a];if (slot->allot <=0 ) { q->tail = slot; - slot->allot += q->scaled_quantum; + slot->allot += q->quantum; goto next_slot; } skb =slot_dequeue_head (slot);
@@ -515,7 +508,7 @@ next_slot: } q->tail->next = next_a; }else { - slot->allot -=SFQ_ALLOT_SIZE (qdisc_pkt_len (skb)); + slot->allot -=qdisc_pkt_len (skb); }return skb; }
@@ -598,7 +591,7 @@ drop: q->tail->next = x; } q->tail = slot; - slot->allot = q->scaled_quantum; + slot->allot = q->quantum; } } sch->q.qlen -= dropped;
@@ -628,7 +621,8 @@ static void sfq_perturbation(struct timemod_timer (&q->perturb_timer, jiffies + period); } -static int sfq_change (struct Qdisc *sch,struct nlattr *opt) +static int sfq_change (struct Qdisc *sch,struct nlattr *opt, +struct netlink_ext_ack *extack) {struct sfq_sched_data *q =qdisc_priv (sch);struct tc_sfq_qopt *ctl =nla_data (opt);
@@ -646,14 +640,10 @@ static int sfq_change(struct Qdisc *sch, (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))return -EINVAL ; -/* slot->allot is a short, make sure quantum is not too big. */ -if (ctl->quantum) { -unsigned int scaled =SFQ_ALLOT_SIZE (ctl->quantum); - -if (scaled <=0 || scaled >SHRT_MAX ) -return -EINVAL ; +if ((int )ctl->quantum <0 ) { +NL_SET_ERR_MSG_MOD (extack,"invalid quantum" ); +return -EINVAL ; } -if (ctl_v1 && !red_check_params (ctl_v1->qth_min, ctl_v1->qth_max, ctl_v1->Wlog, ctl_v1->Scell_log,NULL ))return -EINVAL ;
@@ -663,10 +653,8 @@ static int sfq_change(struct Qdisc *sch,return -ENOMEM ; }sch_tree_lock (sch); -if (ctl->quantum) { +if (ctl->quantum) q->quantum = ctl->quantum; - q->scaled_quantum =SFQ_ALLOT_SIZE (q->quantum); - }WRITE_ONCE (q->perturb_period, ctl->perturb_period *HZ );if (ctl->flows) q->maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );
@@ -762,12 +750,11 @@ static int sfq_init(struct Qdisc *sch, s q->divisor =SFQ_DEFAULT_HASH_DIVISOR ; q->maxflows =SFQ_DEFAULT_FLOWS ; q->quantum =psched_mtu (qdisc_dev (sch)); - q->scaled_quantum =SFQ_ALLOT_SIZE (q->quantum); q->perturb_period =0 ;get_random_bytes (&q->perturbation,sizeof (q->perturbation));if (opt) { -int err =sfq_change (sch, opt); +int err =sfq_change (sch, opt, extack);if (err)return err; }
@@ -878,7 +865,7 @@ static int sfq_dump_class_stats(struct Qif (idx !=SFQ_EMPTY_SLOT ) {const struct sfq_slot *slot = &q->slots[idx]; - xstats.allot = slot->allot <<SFQ_ALLOT_SHIFT ; + xstats.allot = slot->allot; qs.qlen = slot->qlen; qs.backlog = slot->backlog; }
Greg Kroah-Hartman
maintainerPATCH 399/411 net_sched: sch_sfq: dont allow 1 packet limit
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
commit 10685681bafce6febb39770f3387621bf5d67d0b upstream.
The current implementation does not work correctly with a limit of
1. iproute2 actually checks for this and this patch adds the check in kernel as well.
This fixes the following syzkaller reported crash:
UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:210:6 index 65535 is out of range for type 'struct sfq_head[128]' CPU: 0 PID: 2569 Comm: syz-executor101 Not tainted 5.10.0-smp-DEV #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x125/0x19f lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:148 [inline] __ubsan_handle_out_of_bounds+0xed/0x120 lib/ubsan.c:347 sfq_link net/sched/sch_sfq.c:210 [inline] sfq_dec+0x528/0x600 net/sched/sch_sfq.c:238 sfq_dequeue+0x39b/0x9d0 net/sched/sch_sfq.c:500 sfq_reset+0x13/0x50 net/sched/sch_sfq.c:525 qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 tbf_reset+0x3d/0x100 net/sched/sch_tbf.c:319 qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 dev_reset_queue+0x8c/0x140 net/sched/sch_generic.c:1296 netdev_for_each_tx_queue include/linux/netdevice.h:2350 [inline] dev_deactivate_many+0x6dc/0xc20 net/sched/sch_generic.c:1362 __dev_close_many+0x214/0x350 net/core/dev.c:1468 dev_close_many+0x207/0x510 net/core/dev.c:1506 unregister_netdevice_many+0x40f/0x16b0 net/core/dev.c:10738 unregister_netdevice_queue+0x2be/0x310 net/core/dev.c:10695 unregister_netdevice include/linux/netdevice.h:2893 [inline] __tun_detach+0x6b6/0x1600 drivers/net/tun.c:689 tun_detach drivers/net/tun.c:705 [inline] tun_chr_close+0x104/0x1b0 drivers/net/tun.c:3640 __fput+0x203/0x840 fs/file_table.c:280 task_work_run+0x129/0x1b0 kernel/task_work.c:185 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0x5ce/0x2200 kernel/exit.c:931 do_group_exit+0x144/0x310 kernel/exit.c:1046 __do_sys_exit_group kernel/exit.c:1057 [inline] __se_sys_exit_group kernel/exit.c:1055 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1055 do_syscall_64+0x6c/0xd0 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fe5e7b52479 Code: Unable to access opcode bytes at RIP 0x7fe5e7b5244f. RSP: 002b:00007ffd3c800398 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe5e7b52479 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 00007fe5e7bcd2d0 R08: ffffffffffffffb8 R09: 0000000000000014 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe5e7bcd2d0 R13: 0000000000000000 R14: 00007fe5e7bcdd20 R15: 00007fe5e7b24270
The crash can be also be reproduced with the following (with a tc recompiled to allow for sfq limits of 1):
tc qdisc add dev dummy0 handle 1: root tbf rate 1Kbit burst 100b lat 1s ../iproute2-6.9.0/tc/tc qdisc add dev dummy0 handle 2: parent 1:10 sfq limit 1 ifconfig dummy0 up
ping -I dummy0 -f -c2 -W0.1 8.8.8.8
sleep 1
Scenario that triggers the crash:
* the first packet is sent and queued in TBF and SFQ; qdisc qlen is 1
* TBF dequeues: it peeks from SFQ which moves the packet to the gso_skb list and keeps qdisc qlen set to 1. TBF is out of tokens so it schedules itself for later.
* the second packet is sent and TBF tries to queues it to SFQ. qdisc qlen is now 2 and because the SFQ limit is 1 the packet is dropped by SFQ. At this point qlen is 1, and all of the SFQ slots are empty, however q->tail is not NULL.
At this point, assuming no more packets are queued, when sch_dequeue runs again it will decrement the qlen for the current empty slot causing an underflow and the subsequent out of bounds access.
--- net/sched/sch_sfq.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_sfq.c +4 -0
@@ -652,6 +652,10 @@ static int sfq_change(struct Qdisc *sch,if (!p)return -ENOMEM ; } +if (ctl->limit ==1 ) { +NL_SET_ERR_MSG_MOD (extack,"invalid limit" ); +return -EINVAL ; + }sch_tree_lock (sch);if (ctl->quantum) q->quantum = ctl->quantum;
Greg Kroah-Hartman
maintainerPATCH 400/411 net_sched: sch_sfq: use a temporary work area for validating configuration
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
commit 8c0cea59d40cf6dd13c2950437631dd614fbade6 upstream.
Many configuration parameters have influence on others (e.g. divisor -> flows -> limit, depth -> limit) and so it is difficult to correctly do all of the validation before applying the configuration. And if a validation error is detected late it is difficult to roll back a partially applied configuration.
To avoid these issues use a temporary work area to update and validate the configuration and only then apply the configuration to the internal state.
--- net/sched/sch_sfq.c | 56 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-)
net/sched/sch_sfq.c +44 -12
@@ -631,6 +631,15 @@ static int sfq_change(struct Qdisc *sch,struct red_parms *p =NULL ;struct sk_buff *to_free =NULL ;struct sk_buff *tail =NULL ; +unsigned int maxflows; +unsigned int quantum; +unsigned int divisor; +int perturb_period; +u8 headdrop; +u8 maxdepth; +int limit; +u8 flags; +if (opt->nla_len <nla_attr_size (sizeof (*ctl)))return -EINVAL ;
@@ -656,36 +665,59 @@ static int sfq_change(struct Qdisc *sch,NL_SET_ERR_MSG_MOD (extack,"invalid limit" );return -EINVAL ; } +sch_tree_lock (sch); + + limit = q->limit; + divisor = q->divisor; + headdrop = q->headdrop; + maxdepth = q->maxdepth; + maxflows = q->maxflows; + perturb_period = q->perturb_period; + quantum = q->quantum; + flags = q->flags; + +/* update and validate configuration */ if (ctl->quantum) - q->quantum = ctl->quantum; -WRITE_ONCE (q->perturb_period, ctl->perturb_period *HZ ); + quantum = ctl->quantum; + perturb_period = ctl->perturb_period *HZ ;if (ctl->flows) - q->maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS ); + maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );if (ctl->divisor) { - q->divisor = ctl->divisor; - q->maxflows =min_t (u32, q->maxflows, q->divisor); + divisor = ctl->divisor; + maxflows =min_t (u32, maxflows, divisor); }if (ctl_v1) {if (ctl_v1->depth) - q->maxdepth =min_t (u32, ctl_v1->depth,SFQ_MAX_DEPTH ); + maxdepth =min_t (u32, ctl_v1->depth,SFQ_MAX_DEPTH );if (p) { -swap (q->red_parms, p); -red_set_parms (q->red_parms, +red_set_parms (p, ctl_v1->qth_min, ctl_v1->qth_max, ctl_v1->Wlog, ctl_v1->Plog, ctl_v1->Scell_log,NULL , ctl_v1->max_P); } - q->flags = ctl_v1->flags; - q->headdrop = ctl_v1->headdrop; + flags = ctl_v1->flags; + headdrop = ctl_v1->headdrop; }if (ctl->limit) { - q->limit =min_t (u32, ctl->limit, q->maxdepth * q->maxflows); - q->maxflows =min_t (u32, q->maxflows, q->limit); + limit =min_t (u32, ctl->limit, maxdepth * maxflows); + maxflows =min_t (u32, maxflows, limit); } +/* commit configuration */ + q->limit = limit; + q->divisor = divisor; + q->headdrop = headdrop; + q->maxdepth = maxdepth; + q->maxflows = maxflows; +WRITE_ONCE (q->perturb_period, perturb_period); + q->quantum = quantum; + q->flags = flags; +if (p) +swap (q->red_parms, p); + qlen = sch->q.qlen;while (sch->q.qlen > q->limit) { dropped +=sfq_drop (sch, &to_free);
Greg Kroah-Hartman
maintainerPATCH 401/411 net_sched: sch_sfq: move the limit validation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
commit b3bf8f63e6179076b57c9de660c9f80b5abefe70 upstream.
It is not sufficient to directly validate the limit on the data that the user passes as it can be updated based on how the other parameters are changed.
Move the check at the end of the configuration update process to also catch scenarios where the limit is indirectly updated, for example with the following configurations:
tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 depth 1 tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 divisor 1
This fixes the following syzkaller reported crash:
------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:203:6 index 65535 is out of range for type 'struct sfq_head[128]' CPU: 1 UID: 0 PID: 3037 Comm: syz.2.16 Not tainted 6.14.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x201/0x300 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0xf5/0x120 lib/ubsan.c:429 sfq_link net/sched/sch_sfq.c:203 [inline] sfq_dec+0x53c/0x610 net/sched/sch_sfq.c:231 sfq_dequeue+0x34e/0x8c0 net/sched/sch_sfq.c:493 sfq_reset+0x17/0x60 net/sched/sch_sfq.c:518 qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035 tbf_reset+0x41/0x110 net/sched/sch_tbf.c:339 qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035 dev_reset_queue+0x100/0x1b0 net/sched/sch_generic.c:1311 netdev_for_each_tx_queue include/linux/netdevice.h:2590 [inline] dev_deactivate_many+0x7e5/0xe70 net/sched/sch_generic.c:1375
--- net/sched/sch_sfq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/sched/sch_sfq.c +6 -4
@@ -661,10 +661,6 @@ static int sfq_change(struct Qdisc *sch,if (!p)return -ENOMEM ; } -if (ctl->limit ==1 ) { -NL_SET_ERR_MSG_MOD (extack,"invalid limit" ); -return -EINVAL ; - }sch_tree_lock (sch);
@@ -705,6 +701,12 @@ static int sfq_change(struct Qdisc *sch, limit =min_t (u32, ctl->limit, maxdepth * maxflows); maxflows =min_t (u32, maxflows, limit); } +if (limit ==1 ) { +sch_tree_unlock (sch); +kfree (p); +NL_SET_ERR_MSG_MOD (extack,"invalid limit" ); +return -EINVAL ; + }/* commit configuration */ q->limit = limit;
Greg Kroah-Hartman
maintainerPATCH 402/411 net_sched: sch_sfq: reject invalid perturb period
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 7ca52541c05c832d32b112274f81a985101f9ba8 upstream.
Gerrard Tai reported that SFQ perturb_period has no range check yet, and this can be used to trigger a race condition fixed in a separate patch.
We want to make sure ctl->perturb_period * HZ will not overflow and is positive.
Tested:
tc qd add dev lo root sfq perturb -10 # negative value : error
Error: sch_sfq: invalid perturb period.
tc qd add dev lo root sfq perturb 1000000000 # too big : error
Error: sch_sfq: invalid perturb period.
tc qd add dev lo root sfq perturb 2000000 # acceptable value
tc -s -d qd sh dev lo
qdisc sfq 8005: root refcnt 2 limit 127p quantum 64Kb depth 127 flows 128 divisor 1024 perturb 2000000sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
--- net/sched/sch_sfq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/sched/sch_sfq.c +8 -2
@@ -653,6 +653,14 @@ static int sfq_change(struct Qdisc *sch,NL_SET_ERR_MSG_MOD (extack,"invalid quantum" );return -EINVAL ; } + +if (ctl->perturb_period <0 || + ctl->perturb_period >INT_MAX /HZ ) { +NL_SET_ERR_MSG_MOD (extack,"invalid perturb period" ); +return -EINVAL ; + } + perturb_period = ctl->perturb_period *HZ ; +if (ctl_v1 && !red_check_params (ctl_v1->qth_min, ctl_v1->qth_max, ctl_v1->Wlog, ctl_v1->Scell_log,NULL ))return -EINVAL ;
@@ -669,14 +677,12 @@ static int sfq_change(struct Qdisc *sch, headdrop = q->headdrop; maxdepth = q->maxdepth; maxflows = q->maxflows; - perturb_period = q->perturb_period; quantum = q->quantum; flags = q->flags;/* update and validate configuration */ if (ctl->quantum) quantum = ctl->quantum; - perturb_period = ctl->perturb_period *HZ ;if (ctl->flows) maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );if (ctl->divisor) {
Greg Kroah-Hartman
maintainerPATCH 403/411 mm/huge_memory: fix dereferencing invalid pmd migration entry
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Guo <[email protected]>
commit be6e843fc51a584672dfd9c4a6a24c8cb81d5fb7 upstream.
When migrating a THP, concurrent access to the PMD migration entry during a deferred split scan can lead to an invalid address access, as illustrated below. To prevent this invalid access, it is necessary to check the PMD migration entry and return early. In this context, there is no need to use pmd_to_swp_entry and pfn_swap_entry_to_page to verify the equality of the target folio. Since the PMD migration entry is locked, it cannot be served as the target.
Mailing list discussion and explanation from Hugh Dickins: "An anon_vma lookup points to a location which may contain the folio of interest, but might instead contain another folio: and weeding out those other folios is precisely what the "folio != pmd_folio((*pmd)" check (and the "risk of replacing the wrong folio" comment a few lines above it) is for."
BUG: unable to handle page fault for address: ffffea60001db008 CPU: 0 UID: 0 PID: 2199114 Comm: tee Not tainted 6.14.0+ #4 NONE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:split_huge_pmd_locked+0x3b5/0x2b60 Call Trace: <TASK> try_to_migrate_one+0x28c/0x3730 rmap_walk_anon+0x4f6/0x770 unmap_folio+0x196/0x1f0 split_huge_page_to_list_to_order+0x9f6/0x1560 deferred_split_scan+0xac5/0x12a0 shrinker_debugfs_scan_write+0x376/0x470 full_proxy_write+0x15c/0x220 vfs_write+0x2fc/0xcb0 ksys_write+0x146/0x250 do_syscall_64+0x6a/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The bug is found by syzkaller on an internal kernel, then confirmed on upstream.
--- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/huge_memory.c +1 -1
@@ -2161,7 +2161,7 @@ void __split_huge_pmd(struct vm_area_strVM_BUG_ON (freeze && !page);if (page) {VM_WARN_ON_ONCE (!PageLocked (page)); -if (page !=pmd_page (*pmd)) +if (is_pmd_migration_entry (*pmd) || page !=pmd_page (*pmd)) goto out; }
Greg Kroah-Hartman
maintainerPATCH 404/411 ext4: make abort mount option handling standard
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 22b8d707b07e6e06f50fe1d9ca8756e1f894eb0d upstream.
'abort' mount option is the only mount option that has special handling and sets a bit in sbi->s_mount_flags. There is not strong reason for that so just simplify the code and make 'abort' set a bit in sbi->s_mount_opt2 as any other mount option. This simplifies the code and will allow us to drop EXT4_MF_FS_ABORTED completely in the following patch.
Stable-dep-of: 76486b104168 ("ext4: avoid remount errors with 'abort' mount option")
--- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -1255,6 +1255,7 @@ struct ext4_inode_info {#define EXT4_MOUNT2_MB_OPTIMIZE_SCAN 0x00000080/* Optimize group * scanning in mballoc */ +#define EXT4_MOUNT2_ABORT 0x00000100/* Abort filesystem */ #define clear_opt (sb, opt) EXT4_SB(sb)->s_mount_opt &= \ ~EXT4_MOUNT_##opt
fs/ext4/super.c +2 -4
@@ -2023,6 +2023,7 @@ static const struct mount_opts { MOPT_SET | MOPT_2 | MOPT_EXT4_ONLY}, {Opt_fc_debug_max_replay, 0, MOPT_GTE0}, #endif + {Opt_abort, EXT4_MOUNT2_ABORT, MOPT_SET | MOPT_2}, {Opt_err, 0, 0} };
@@ -2143,9 +2144,6 @@ static int handle_mount_opt(struct supercase Opt_removed:ext4_msg (sb,KERN_WARNING ,"Ignoring removed %s option" , opt);return 1 ; -case Opt_abort: -ext4_set_mount_flag (sb,EXT4_MF_FS_ABORTED ); -return 1 ;case Opt_i_version: sb->s_flags |=SB_I_VERSION ;return 1 ;
@@ -5851,7 +5849,7 @@ static int ext4_remount(struct super_blo goto restore_opts; } -if (ext4_test_mount_flag (sb,EXT4_MF_FS_ABORTED )) +if (test_opt2 (sb,ABORT ))ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
Greg Kroah-Hartman
maintainerPATCH 405/411 ext4: avoid remount errors with abort mount option
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 76486b104168ae59703190566e372badf433314b upstream.
When we remount filesystem with 'abort' mount option while changing other mount options as well (as is LTP test doing), we can return error from the system call after commit d3476f3dad4a ("ext4: don't set SB_RDONLY after filesystem errors") because the application of mount option changes detects shutdown filesystem and refuses to do anything. The behavior of application of other mount options in presence of 'abort' mount option is currently rather arbitary as some mount option changes are handled before 'abort' and some after it.
Move aborting of the filesystem to the end of remount handling so all requested changes are properly applied before the filesystem is shutdown to have a reasonably consistent behavior.
--- fs/ext4/super.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/ext4/super.c +8 -3
@@ -5849,9 +5849,6 @@ static int ext4_remount(struct super_blo goto restore_opts; } -if (test_opt2 (sb,ABORT )) -ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); - sb->s_flags = (sb->s_flags & ~SB_POSIXACL ) | (test_opt (sb,POSIX_ACL ) ?SB_POSIXACL :0 );
@@ -6027,6 +6024,14 @@ static int ext4_remount(struct super_blo*/ *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags); +/* +* Handle aborting the filesystem as the last thing during remount to +* avoid obsure errors during remount when some option changes fail to +* apply due to shutdown filesystem. +*/ +if (test_opt2 (sb,ABORT )) +ext4_abort (sb,ESHUTDOWN ,"Abort forced by user" ); +ext4_msg (sb,KERN_INFO ,"re-mounted. Opts: %s. Quota mode: %s." , orig_data,ext4_quota_mode (sb));kfree (orig_data);
Greg Kroah-Hartman
maintainerPATCH 406/411 net: Fix checksum update for ILA adj-transport
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
commit 6043b794c7668c19dabc4a93c75b924a19474d59 upstream.
During ILA address translations, the L4 checksums can be handled in different ways. One of them, adj-transport, consist in parsing the transport layer and updating any found checksum. This logic relies on inet_proto_csum_replace_by_diff and produces an incorrect skb->csum when in state CHECKSUM_COMPLETE.
This bug can be reproduced with a simple ILA to SIR mapping, assuming packets are received with CHECKSUM_COMPLETE:
$ ip a show dev eth0
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 62:ae:35:9e:0f:8d brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 3333:0:0:1::c078/64 scope global
valid_lft forever preferred_lft forever
inet6 fd00:10:244:1::c078/128 scope global nodad
valid_lft forever preferred_lft forever
inet6 fe80::60ae:35ff:fe9e:f8d/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
$ ip ila add loc_match fd00:10:244:1 loc 3333:0:0:1 \
csum-mode adj-transport ident-type luid dev eth0Then I hit [fd00:10:244:1::c078]:8000 with a server listening only on [3333:0:0:1::c078]:8000. With the bug, the SYN packet is dropped with SKB_DROP_REASON_TCP_CSUM after inet_proto_csum_replace_by_diff changed skb->csum. The translation and drop are visible on pwru [1] traces:
IFACE TUPLE FUNC eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ipv6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ip6_rcv_core eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) nf_hook_slow eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) inet_proto_csum_replace_by_diff eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_early_demux eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_route_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input_finish eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_protocol_deliver_rcu eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) raw6_local_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ipv6_raw_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) __skb_checksum_complete eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skb_reason(SKB_DROP_REASON_TCP_CSUM) eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_head_state eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_data eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_free_head eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skbmem
This is happening because inet_proto_csum_replace_by_diff is updating skb->csum when it shouldn't. The L4 checksum is updated such that it "cancels" the IPv6 address change in terms of checksum computation, so the impact on skb->csum is null.
Note this would be different for an IPv4 packet since three fields would be updated: the IPv4 address, the IP checksum, and the L4 checksum. Two would cancel each other and skb->csum would still need to be updated to take the L4 checksum change into account.
This patch fixes it by passing an ipv6 flag to inet_proto_csum_replace_by_diff, to skip the skb->csum update if we're in the IPv6 case. Note the behavior of the only other user of inet_proto_csum_replace_by_diff, the BPF subsystem, is left as is in this patch and fixed in the subsequent patch.
With the fix, using the reproduction from above, I can confirm skb->csum is not touched by inet_proto_csum_replace_by_diff and the TCP SYN proceeds to the application after the ILA translation.
--- include/net/checksum.h | 2 +- net/core/filter.c | 2 +- net/core/utils.c | 4 ++-- net/ipv6/ila/ila_common.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-)
include/net/checksum.h +1 -1
@@ -154,7 +154,7 @@ void inet_proto_csum_replace16(__sum16 * const __be32 *from, const __be32 *to, bool pseudohdr);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr); +__wsum diff,bool pseudohdr,bool ipv6); static __always_inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
net/core/filter.c +1 -1
@@ -1970,7 +1970,7 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sif (unlikely (from !=0 ))return -EINVAL ; -inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo); +inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, false);break ;case 2 :inet_proto_csum_replace2 (ptr, skb, from, to, is_pseudo);
net/core/utils.c +2 -2
@@ -473,11 +473,11 @@ void inet_proto_csum_replace16(__sum16 *EXPORT_SYMBOL (inet_proto_csum_replace16);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr) +__wsum diff,bool pseudohdr,bool ipv6) {if (skb->ip_summed !=CHECKSUM_PARTIAL ) { *sum =csum_fold (csum_add (diff, ~csum_unfold (*sum))); -if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr && !ipv6) skb->csum = ~csum_add (diff, ~skb->csum); }else if (pseudohdr) { *sum = ~csum_fold (csum_add (diff,csum_unfold (*sum)));
net/ipv6/ila/ila_common.c +3 -3
@@ -86,7 +86,7 @@ static void ila_csum_adjust_transport(st diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&th->check, skb, - diff, true); + diff, true, true); }break ;case NEXTHDR_UDP :
@@ -97,7 +97,7 @@ static void ila_csum_adjust_transport(stif (uh->check || skb->ip_summed ==CHECKSUM_PARTIAL ) { diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&uh->check, skb, - diff, true); + diff, true, true);if (!uh->check) uh->check =CSUM_MANGLED_0 ; }
@@ -111,7 +111,7 @@ static void ila_csum_adjust_transport(st diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&ih->icmp6_cksum, skb, - diff, true); + diff, true, true); }break ; }
Greg Kroah-Hartman
maintainerPATCH 407/411 bpf: Fix L4 csum update on IPv6 in CHECKSUM_COMPLETE
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
commit ead7f9b8de65632ef8060b84b0c55049a33cfea1 upstream.
In Cilium, we use bpf_csum_diff + bpf_l4_csum_replace to, among other things, update the L4 checksum after reverse SNATing IPv6 packets. That use case is however not currently supported and leads to invalid skb->csum values in some cases. This patch adds support for IPv6 address changes in bpf_l4_csum_update via a new flag.
When calling bpf_l4_csum_replace in Cilium, it ends up calling inet_proto_csum_replace_by_diff:
1: void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb,
2: __wsum diff, bool pseudohdr)
3: {
4: if (skb->ip_summed != CHECKSUM_PARTIAL) {
5: csum_replace_by_diff(sum, diff);
6: if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
7: skb->csum = ~csum_sub(diff, skb->csum);
8: } else if (pseudohdr) {
9: *sum = ~csum_fold(csum_add(diff, csum_unfold(*sum)));
10: }
11: }The bug happens when we're in the CHECKSUM_COMPLETE state. We've just updated one of the IPv6 addresses. The helper now updates the L4 header checksum on line 5. Next, it updates skb->csum on line 7. It shouldn't.
For an IPv6 packet, the updates of the IPv6 address and of the L4 checksum will cancel each other. The checksums are set such that computing a checksum over the packet including its checksum will result in a sum of 0. So the same is true here when we update the L4 checksum on line 5. We'll update it as to cancel the previous IPv6 address update. Hence skb->csum should remain untouched in this case.
The same bug doesn't affect IPv4 packets because, in that case, three fields are updated: the IPv4 address, the IP checksum, and the L4 checksum. The change to the IPv4 address and one of the checksums still cancel each other in skb->csum, but we're left with one checksum update and should therefore update skb->csum accordingly. That's exactly what inet_proto_csum_replace_by_diff does.
This special case for IPv6 L4 checksums is also described atop inet_proto_csum_replace16, the function we should be using in this case.
This patch introduces a new bpf_l4_csum_replace flag, BPF_F_IPV6, to indicate that we're updating the L4 checksum of an IPv6 packet. When the flag is set, inet_proto_csum_replace_by_diff will skip the skb->csum update.
--- include/uapi/linux/bpf.h | 2 ++ net/core/filter.c | 5 +++-- tools/include/uapi/linux/bpf.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-)
include/uapi/linux/bpf.h +2 -0
@@ -1695,6 +1695,7 @@ union bpf_attr {* for updates resulting in a null checksum the value is set to * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates * the checksum is to be computed against a pseudo-header. +* Flag **BPF_F_IPV6** should be set for IPv6 packets. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more
@@ -5106,6 +5107,7 @@ enum {BPF_F_PSEUDO_HDR = (1ULL <<4 ),BPF_F_MARK_MANGLED_0 = (1ULL <<5 ),BPF_F_MARK_ENFORCE = (1ULL <<6 ), + BPF_F_IPV6 = (1ULL << 7), };/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
net/core/filter.c +3 -2
@@ -1951,10 +1951,11 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sbool is_pseudo = flags &BPF_F_PSEUDO_HDR ;bool is_mmzero = flags &BPF_F_MARK_MANGLED_0 ;bool do_mforce = flags &BPF_F_MARK_ENFORCE ; +bool is_ipv6 = flags &BPF_F_IPV6 ;__sum16 *ptr;if (unlikely (flags & ~(BPF_F_MARK_MANGLED_0 |BPF_F_MARK_ENFORCE | -BPF_F_PSEUDO_HDR |BPF_F_HDR_FIELD_MASK ))) +BPF_F_PSEUDO_HDR |BPF_F_HDR_FIELD_MASK |BPF_F_IPV6 )))return -EINVAL ;if (unlikely (offset >0xffff || offset &1 ))return -EFAULT ;
@@ -1970,7 +1971,7 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sif (unlikely (from !=0 ))return -EINVAL ; -inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, false); +inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, is_ipv6);break ;case 2 :inet_proto_csum_replace2 (ptr, skb, from, to, is_pseudo);
tools/include/uapi/linux/bpf.h +2 -0
@@ -1695,6 +1695,7 @@ union bpf_attr {* for updates resulting in a null checksum the value is set to * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates * the checksum is to be computed against a pseudo-header. +* Flag **BPF_F_IPV6** should be set for IPv6 packets. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more
@@ -5106,6 +5107,7 @@ enum {BPF_F_PSEUDO_HDR = (1ULL <<4 ),BPF_F_MARK_MANGLED_0 = (1ULL <<5 ),BPF_F_MARK_ENFORCE = (1ULL <<6 ), + BPF_F_IPV6 = (1ULL << 7), };/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
Greg Kroah-Hartman
maintainerPATCH 408/411 s390/pci: Fix __pcilg_mio_inuser() inline assembly
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit c4abe6234246c75cdc43326415d9cff88b7cf06c upstream.
Use "a" constraint for the shift operand of the __pcilg_mio_inuser() inline assembly. The used "d" constraint allows the compiler to use any general purpose register for the shift operand, including register zero.
If register zero is used this my result in incorrect code generation:
8f6: a7 0a ff f8 ahi %r0,-8 8fa: eb 32 00 00 00 0c srlg %r3,%r2,0 <----
If register zero is selected to contain the shift value, the srlg instruction ignores the contents of the register and always shifts zero bits. Therefore use the "a" constraint which does not permit to select register zero.
--- arch/s390/pci/pci_mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/pci/pci_mmio.c +1 -1
@@ -222,7 +222,7 @@ static inline int __pcilg_mio_inuser( [ioaddr_len] "+&d" (ioaddr_len.pair), [cc] "+d" (cc), [val] "=d" (val), [dst] "+a" (dst), [cnt] "+d" (cnt), [tmp] "=d" (tmp), - [shift] "+d" (shift) + [shift] "+a" (shift) :: "cc", "memory"); /* did we write everything to the user space buffer? */
Greg Kroah-Hartman
maintainerPATCH 409/411 perf: Fix sample vs do_exit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 4f6fc782128355931527cefe3eb45338abd8ab39 ]
Baisheng Gao reported an ARM64 crash, which Mark decoded as being a synchronous external abort -- most likely due to trying to access MMIO in bad ways.
The crash further shows perf trying to do a user stack sample while in exit_mmap()'s tlb_finish_mmu() -- i.e. while tearing down the address space it is trying to access.
It turns out that we stop perf after we tear down the userspace mm; a receipie for disaster, since perf likes to access userspace for various reasons.
Flip this order by moving up where we stop perf in do_exit().
Additionally, harden PERF_SAMPLE_CALLCHAIN and PERF_SAMPLE_STACK_USER to abort when the current task does not have an mm (exit_mm() makes sure to set current->mm = NULL; before commencing with the actual teardown). Such that CPU wide events don't trip on this same problem.
--- kernel/events/core.c | 7 +++++++ kernel/exit.c | 17 +++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
kernel/events/core.c +7 -0
@@ -6886,6 +6886,10 @@ perf_sample_ustack_size(u16 stack_size, u16 header_size,if (!regs)return 0 ; +/* No mm, no stack, no dump. */ +if (!current->mm) +return 0 ; +/* * Check if we fit in with the requested stack size into the: * - TASK_SIZE
@@ -7579,6 +7583,9 @@ perf_callchain(struct perf_event *event, struct pt_regs *regs)const u32 max_stack = event->attr.sample_max_stack;struct perf_callchain_entry *callchain; +if (!current->mm) + user = false; +if (!kernel && !user)return &__empty_callchain;
kernel/exit.c +9 -8
@@ -858,6 +858,15 @@ void __noreturn do_exit(long code) tsk->exit_code = code;taskstats_exit (tsk, group_dead); +/* +* Since sampling can touch ->mm, make sure to stop everything before we +* tear it down. +* +* Also flushes inherited counters to the parent - before the parent +* gets woken up by child-exit notifications. +*/ +perf_event_exit_task (tsk); +exit_mm ();if (group_dead)
@@ -874,14 +883,6 @@ void __noreturn do_exit(long code)exit_task_work (tsk);exit_thread (tsk); -/* -* Flush inherited counters to the parent - before the parent -* gets woken up by child-exit notifications. -* -* because of cgroup mode, must be called before cgroup_exit() -*/ -perf_event_exit_task (tsk); -sched_autogroup_exit_task (tsk);cgroup_exit (tsk);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 410/411 arm64/ptrace: Fix stack-out-of-bounds read in regs_get_kernel_stack_nth()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengda Wu <[email protected]>
[ Upstream commit 39dfc971e42d886e7df01371cd1bef505076d84c ]
KASAN reports a stack-out-of-bounds read in regs_get_kernel_stack_nth().
Call Trace: [ 97.283505] BUG: KASAN: stack-out-of-bounds in regs_get_kernel_stack_nth+0xa8/0xc8 [ 97.284677] Read of size 8 at addr ffff800089277c10 by task 1.sh/2550 [ 97.285732] [ 97.286067] CPU: 7 PID: 2550 Comm: 1.sh Not tainted 6.6.0+ #11 [ 97.287032] Hardware name: linux,dummy-virt (DT) [ 97.287815] Call trace: [ 97.288279] dump_backtrace+0xa0/0x128 [ 97.288946] show_stack+0x20/0x38 [ 97.289551] dump_stack_lvl+0x78/0xc8 [ 97.290203] print_address_description.constprop.0+0x84/0x3c8 [ 97.291159] print_report+0xb0/0x280 [ 97.291792] kasan_report+0x84/0xd0 [ 97.292421] __asan_load8+0x9c/0xc0 [ 97.293042] regs_get_kernel_stack_nth+0xa8/0xc8 [ 97.293835] process_fetch_insn+0x770/0xa30 [ 97.294562] kprobe_trace_func+0x254/0x3b0 [ 97.295271] kprobe_dispatcher+0x98/0xe0 [ 97.295955] kprobe_breakpoint_handler+0x1b0/0x210 [ 97.296774] call_break_hook+0xc4/0x100 [ 97.297451] brk_handler+0x24/0x78 [ 97.298073] do_debug_exception+0xac/0x178 [ 97.298785] el1_dbg+0x70/0x90 [ 97.299344] el1h_64_sync_handler+0xcc/0xe8 [ 97.300066] el1h_64_sync+0x78/0x80 [ 97.300699] kernel_clone+0x0/0x500 [ 97.301331] __arm64_sys_clone+0x70/0x90 [ 97.302084] invoke_syscall+0x68/0x198 [ 97.302746] el0_svc_common.constprop.0+0x11c/0x150 [ 97.303569] do_el0_svc+0x38/0x50 [ 97.304164] el0_svc+0x44/0x1d8 [ 97.304749] el0t_64_sync_handler+0x100/0x130 [ 97.305500] el0t_64_sync+0x188/0x190 [ 97.306151] [ 97.306475] The buggy address belongs to stack of task 1.sh/2550 [ 97.307461] and is located at offset 0 in frame: [ 97.308257] __se_sys_clone+0x0/0x138 [ 97.308910] [ 97.309241] This frame has 1 object: [ 97.309873] [48, 184) 'args' [ 97.309876] [ 97.310749] The buggy address belongs to the virtual mapping at [ 97.310749] [ffff800089270000, ffff800089279000) created by: [ 97.310749] dup_task_struct+0xc0/0x2e8 [ 97.313347] [ 97.313674] The buggy address belongs to the physical page: [ 97.314604] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14f69a [ 97.315885] flags: 0x15ffffe00000000(node=1|zone=2|lastcpupid=0xfffff) [ 97.316957] raw: 015ffffe00000000 0000000000000000 dead000000000122 0000000000000000 [ 97.318207] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 97.319445] page dumped because: kasan: bad access detected [ 97.320371] [ 97.320694] Memory state around the buggy address: [ 97.321511] ffff800089277b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 97.322681] ffff800089277b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 97.323846] >ffff800089277c00: 00 00 f1 f1 f1 f1 f1 f1 00 00 00 00 00 00 00 00 [ 97.325023] ^ [ 97.325683] ffff800089277c80: 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3 [ 97.326856] ffff800089277d00: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
This issue seems to be related to the behavior of some gcc compilers and was also fixed on the s390 architecture before:
commit d93a855c31b7 ("s390/ptrace: Avoid KASAN false positives in regs_get_kernel_stack_nth()")
As described in that commit, regs_get_kernel_stack_nth() has confirmed that addr is on the stack, so reading the value at *addr should be allowed. Use READ_ONCE_NOCHECK() helper to silence the KASAN check for this case.
--- arch/arm64/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/ptrace.c +1 -1
@@ -140,7 +140,7 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n) addr += n;if (regs_within_kernel_stack (regs, (unsigned long )addr)) -return *addr; +return READ_ONCE_NOCHECK (*addr);else return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 411/411 scsi: elx: efct: Fix memory leak in efct_hw_parse_filter()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaliy Shevtsov <[email protected]>
[ Upstream commit 2a8a5a5dd06eef580f9818567773fd75057cb875 ]
strsep() modifies the address of the pointer passed to it so that it no longer points to the original address. This means kfree() gets the wrong pointer.
Fix this by passing unmodified pointer returned from kstrdup() to kfree().
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- drivers/scsi/elx/efct/efct_hw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/elx/efct/efct_hw.c +3 -2
@@ -1120,7 +1120,7 @@ int efct_hw_parse_filter(struct efct_hw *hw, void *value) { int rc = 0; -char *p =NULL ; +char *p =NULL , *pp =NULL ;char *token;u32 idx =0 ;
@@ -1132,6 +1132,7 @@ efct_hw_parse_filter(struct efct_hw *hw, void *value)efc_log_err (hw->os,"p is NULL\n" );return -ENOMEM ; } + pp = p; idx =0 ;while ((token =strsep (&p,"," )) && *token) {
@@ -1144,7 +1145,7 @@ efct_hw_parse_filter(struct efct_hw *hw, void *value)if (idx ==ARRAY_SIZE (hw->config.filter_def))break ; } -kfree (p); +kfree (pp);return rc; }
Signature · 1 line
2.39.5
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +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/v5.x/stable-review/patch-5.15.186-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +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/v5.x/stable-review/patch-5.15.186-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
105 tests: 105 pass, 0 failLinux version: 5.15.186-rc1-gcf95a0f111a6
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
Quoted 6 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/
patch-5.15.186-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.
No issues were seen on x86_64 and aarch64 platforms with our testing.
Quoted 4 lines
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency types
This patch triggers:
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,
and other similar problems. This is with gcc 13.4.0.
Guenter
Hi Guenter,
Quoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency typesThis patch triggers:
Quoted 7 lines
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,and other similar problems. This is with gcc 13.4.0.
Sorry to hear that this is causing issues.
Are you only seeing this with the backport on top of 5.15 or also on top of mainline or -next?
If it's only for 5.15 then personally I'd be happy with just skipping this patch (and the ones that depend on it).
5.15 is scheduled to be sunset in 16 months and I am not aware of many people running Amlogic SoCs with mainline 5.15.
Best regards,
Martin
Greg Kroah-Hartman
maintainerQuoted 26 lines · Martin Blumenstingl
Hi Guenter,
Quoted 23 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency typesThis patch triggers:
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,
Quoted 7 lines
Quoted 1 line
and other similar problems. This is with gcc 13.4.0.
Sorry to hear that this is causing issues.
Are you only seeing this with the backport on top of 5.15 or also on top of mainline or -next?If it's only for 5.15 then personally I'd be happy with just skipping this patch (and the ones that depend on it).
It's already merged, and I see these errors in the Android build reports now. I think they've just disabled the driver entirely to get around it :(
Quoted 2 lines
5.15 is scheduled to be sunset in 16 months and I am not aware of many people running Amlogic SoCs with mainline 5.15.
Great, can we send a "CONFIG_BROKEN" patch for this then?
thanks,
greg k-h
Hi Greg,
Quoted 33 lines · Greg Kroah-Hartman
Quoted 31 lines · Martin Blumenstingl
Hi Guenter,
Quoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency typesThis patch triggers:
Quoted 7 lines
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,and other similar problems. This is with gcc 13.4.0.
Sorry to hear that this is causing issues.
Are you only seeing this with the backport on top of 5.15 or also on top of mainline or -next?
Quoted 5 lines
Quoted 2 lines
If it's only for 5.15 then personally I'd be happy with just skipping this patch (and the ones that depend on it).
It's already merged, and I see these errors in the Android build reports now. I think they've just disabled the driver entirely to get around it :(
Can you confirm that only 5.15 is affected - or do you also see problems with other stable versions?
Quoted 4 lines
Quoted 2 lines
5.15 is scheduled to be sunset in 16 months and I am not aware of many people running Amlogic SoCs with mainline 5.15.
Great, can we send a "
CONFIG_BROKEN" patch for this then?
In my own words: you're asking for a patch for the next 5.15 release which adds "depends on BROKEN" to the meson drm driver. Is this correct?
Best regards,
Martin
Greg Kroah-Hartman
maintainerQuoted 45 lines · Martin Blumenstingl
Hi Greg,
Quoted 33 lines · Greg Kroah-Hartman
Quoted 31 lines · Martin Blumenstingl
Hi Guenter,
Quoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency typesThis patch triggers:
Quoted 7 lines
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,and other similar problems. This is with gcc 13.4.0.
Sorry to hear that this is causing issues.
Are you only seeing this with the backport on top of 5.15 or also on top of mainline or -next?Quoted 5 lines
Quoted 2 lines
If it's only for 5.15 then personally I'd be happy with just skipping this patch (and the ones that depend on it).
It's already merged, and I see these errors in the Android build reports now. I think they've just disabled the driver entirely to get around it :(
Can you confirm that only 5.15 is affected - or do you also see problems with other stable versions?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
5.15 is scheduled to be sunset in 16 months and I am not aware of many people running Amlogic SoCs with mainline 5.15.
Great, can we send a "
CONFIG_BROKEN" patch for this then?In my own words: you're asking for a patch for the next 5.15 release which adds "depends on BROKEN" to the meson drm driver. Is this correct?
Yes, given that it seems no one uses it there :)
thanks,
greg k-h
Quoted 37 lines · Martin Blumenstingl
Hi Greg,
Quoted 33 lines · Greg Kroah-Hartman
Quoted 31 lines · Martin Blumenstingl
Hi Guenter,
Quoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.186 release. There are 411 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 Wed, 25 Jun 2025 13:05:51 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Martin Blumenstingl <[email protected]>
drm/meson: use unsigned long long / Hz for frequency typesThis patch triggers:
Quoted 7 lines
Building arm:allmodconfig ... failed
--------------
Error log:drivers/gpu/drm/meson/meson_vclk.c:399:17: error: this decimal constant is unsigned only in ISO C90 [-Werror]
399 | .pll_freq = 2970000000,and other similar problems. This is with gcc 13.4.0.
Sorry to hear that this is causing issues.
Are you only seeing this with the backport on top of 5.15 or also on top of mainline or -next?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If it's only for 5.15 then personally I'd be happy with just skipping this patch (and the ones that depend on it).
It's already merged, and I see these errors in the Android build reports now. I think they've just disabled the driver entirely to get around it :(
Can you confirm that only 5.15 is affected - or do you also see problems with other stable versions?
Only 5.15.y is affected. I think that is due to "-std=gnu11" which was introduced around v5.18.
Guenter